From 2523d74ad1e98a1bb24839668d8d325e1516e726 Mon Sep 17 00:00:00 2001 From: Alex Heneveld Date: Thu, 15 Mar 2012 02:18:32 +0000 Subject: [PATCH] correct guice injection for cloudstack ComputeServiceAdapterLiveTest --- .../CloudStackComputeServiceContextModule.java | 2 +- .../CloudStackComputeServiceAdapterLiveTest.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/config/CloudStackComputeServiceContextModule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/config/CloudStackComputeServiceContextModule.java index 58d37a12c8..f008bfe2ed 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/config/CloudStackComputeServiceContextModule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/config/CloudStackComputeServiceContextModule.java @@ -212,7 +212,7 @@ public class CloudStackComputeServiceContextModule @Provides @Singleton - Map optionsConverters(){ + public Map optionsConverters(){ return ImmutableMap.of( NetworkType.ADVANCED, new AdvancedNetworkOptionsConverter(), NetworkType.BASIC, new BasicNetworkOptionsConverter()); diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java index 4343ee5cb0..0b500d458b 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java @@ -20,6 +20,7 @@ package org.jclouds.cloudstack.compute; import static com.google.common.collect.Iterables.getFirst; import static com.google.inject.name.Names.bindProperties; +import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.fail; @@ -33,20 +34,26 @@ import java.util.concurrent.TimeUnit; import javax.inject.Singleton; import org.jclouds.cloudstack.CloudStackClient; +import org.jclouds.cloudstack.compute.config.CloudStackComputeServiceContextModule; import org.jclouds.cloudstack.compute.config.CloudStackComputeServiceContextModule.GetIPForwardingRulesByVirtualMachine; import org.jclouds.cloudstack.compute.options.CloudStackTemplateOptions; import org.jclouds.cloudstack.compute.strategy.CloudStackComputeServiceAdapter; +import org.jclouds.cloudstack.compute.strategy.OptionsConverter; import org.jclouds.cloudstack.domain.IPForwardingRule; import org.jclouds.cloudstack.domain.Network; +import org.jclouds.cloudstack.domain.NetworkType; import org.jclouds.cloudstack.domain.ServiceOffering; import org.jclouds.cloudstack.domain.User; import org.jclouds.cloudstack.domain.VirtualMachine; +import org.jclouds.cloudstack.domain.Zone; import org.jclouds.cloudstack.features.BaseCloudStackClientLiveTest; import org.jclouds.cloudstack.functions.StaticNATVirtualMachineInNetwork; +import org.jclouds.cloudstack.functions.ZoneIdToZone; import org.jclouds.cloudstack.predicates.JobComplete; import org.jclouds.cloudstack.predicates.TemplatePredicates; import org.jclouds.cloudstack.suppliers.GetCurrentUser; import org.jclouds.cloudstack.suppliers.NetworksForCurrentUser; +import org.jclouds.cloudstack.suppliers.ZoneIdToZoneSupplier; import org.jclouds.collect.Memoized; import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials; import org.jclouds.compute.ComputeTestUtils; @@ -65,6 +72,7 @@ import org.testng.annotations.Test; import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; @@ -76,6 +84,7 @@ import com.google.inject.Provides; import com.google.inject.Scopes; import com.google.inject.TypeLiteral; import com.google.inject.assistedinject.FactoryModuleBuilder; +import com.google.inject.name.Names; @Test(groups = "live", singleThreaded = true, testName = "CloudStackComputeServiceAdapterLiveTest") public class CloudStackComputeServiceAdapterLiveTest extends BaseCloudStackClientLiveTest { @@ -103,6 +112,13 @@ public class CloudStackComputeServiceAdapterLiveTest extends BaseCloudStackClien bind(new TypeLiteral>() { }).toInstance(credentialStore); bind(CloudStackClient.class).toInstance(context.getApi()); + bind(new TypeLiteral>() {}). + toInstance(new CloudStackComputeServiceContextModule().optionsConverters()); + bind(Long.class).annotatedWith(Names.named(PROPERTY_SESSION_INTERVAL)).toInstance(60L); + bind(new TypeLiteral>() {}). + to(ZoneIdToZone.class); + bind(new TypeLiteral>>() {}). + to(ZoneIdToZoneSupplier.class); install(new FactoryModuleBuilder().build(StaticNATVirtualMachineInNetwork.Factory.class)); }