Merge pull request #85 from nacx/fix-test-config

Fix TransientChef and Strategy live tests
This commit is contained in:
Ignasi Barrera 2013-04-29 02:26:58 -07:00
commit 2afa950cb2
7 changed files with 15 additions and 7 deletions

View File

@ -41,12 +41,14 @@ import org.jclouds.concurrent.config.ExecutorServiceModule;
import org.jclouds.crypto.Crypto; import org.jclouds.crypto.Crypto;
import org.jclouds.domain.JsonBall; import org.jclouds.domain.JsonBall;
import org.jclouds.rest.ConfiguresHttpApi; import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule; import org.jclouds.rest.config.RestModule;
import org.jclouds.rest.config.SyncToAsyncHttpInvocationModule;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.common.cache.CacheLoader; import com.google.common.cache.CacheLoader;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.inject.AbstractModule;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Module; import com.google.inject.Module;
import com.google.inject.Provides; import com.google.inject.Provides;
@ -57,10 +59,12 @@ import com.google.inject.name.Names;
* @author Adrian Cole * @author Adrian Cole
*/ */
@ConfiguresHttpApi @ConfiguresHttpApi
public class TransientChefApiModule extends HttpApiModule<TransientChefApi> { public class TransientChefApiModule extends AbstractModule {
@Override @Override
protected void configure() { protected void configure() {
install(new RestModule());
install(new SyncToAsyncHttpInvocationModule());
bind(ChefApi.class).to(TransientChefApi.class); bind(ChefApi.class).to(TransientChefApi.class);
bind(LocalBlobStore.class).annotatedWith(Names.named("databags")) bind(LocalBlobStore.class).annotatedWith(Names.named("databags"))
.toInstance( .toInstance(

View File

@ -48,6 +48,10 @@ public abstract class BaseChefLiveTest<A extends ChefApi> extends BaseApiLiveTes
protected ChefService chefService; protected ChefService chefService;
protected Json json; protected Json json;
protected BaseChefLiveTest() {
provider = "chef";
}
/** /**
* the credential is a path to the pem file. * the credential is a path to the pem file.
*/ */

View File

@ -39,7 +39,7 @@ public class CleanupStaleNodesAndClientsImplLiveTest extends BaseChefLiveTest<Ch
private CleanupStaleNodesAndClientsImpl strategy; private CleanupStaleNodesAndClientsImpl strategy;
@Override @Override
public void initialize() { protected void initialize() {
super.initialize(); super.initialize();
this.creater = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class); this.creater = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class);
this.strategy = injector.getInstance(CleanupStaleNodesAndClientsImpl.class); this.strategy = injector.getInstance(CleanupStaleNodesAndClientsImpl.class);

View File

@ -43,7 +43,7 @@ public class CreateNodeAndPopulateAutomaticAttributesImplLiveTest extends BaseCh
private CreateNodeAndPopulateAutomaticAttributesImpl strategy; private CreateNodeAndPopulateAutomaticAttributesImpl strategy;
@Override @Override
public void initialize() { protected void initialize() {
super.initialize(); super.initialize();
this.currentUserProvider = injector.getInstance(CurrentUserProvider.class); this.currentUserProvider = injector.getInstance(CurrentUserProvider.class);
this.strategy = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class); this.strategy = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class);

View File

@ -39,7 +39,7 @@ public class DeleteAllApisAndNodesInListImplLiveTest extends BaseChefLiveTest<Ch
private CreateNodeAndPopulateAutomaticAttributesImpl creater; private CreateNodeAndPopulateAutomaticAttributesImpl creater;
@Override @Override
public void initialize() { protected void initialize() {
super.initialize(); super.initialize();
this.creater = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class); this.creater = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class);
this.strategy = injector.getInstance(DeleteAllNodesInListImpl.class); this.strategy = injector.getInstance(DeleteAllNodesInListImpl.class);

View File

@ -41,7 +41,7 @@ public class GetNodesImplLiveTest extends BaseChefLiveTest<ChefApi> {
private CreateNodeAndPopulateAutomaticAttributesImpl creater; private CreateNodeAndPopulateAutomaticAttributesImpl creater;
@Override @Override
public void initialize() { protected void initialize() {
super.initialize(); super.initialize();
this.creater = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class); this.creater = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class);
this.strategy = injector.getInstance(ListNodesImpl.class); this.strategy = injector.getInstance(ListNodesImpl.class);

View File

@ -42,7 +42,7 @@ public class UpdateAutomaticAttributesOnNodeImplLiveTest extends BaseChefLiveTes
private UpdateAutomaticAttributesOnNodeImpl strategy; private UpdateAutomaticAttributesOnNodeImpl strategy;
@Override @Override
public void initialize() { protected void initialize() {
super.initialize(); super.initialize();
this.currentUserProvider = injector.getInstance(CurrentUserProvider.class); this.currentUserProvider = injector.getInstance(CurrentUserProvider.class);
this.strategy = injector.getInstance(UpdateAutomaticAttributesOnNodeImpl.class); this.strategy = injector.getInstance(UpdateAutomaticAttributesOnNodeImpl.class);