diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java index 8a435ddc02..1eb716f5a4 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java @@ -33,8 +33,12 @@ import com.google.inject.ImplementedBy; @ImplementedBy(CloudStackContextImpl.class) public interface CloudStackContext extends ComputeServiceContext { - RestContext getDomainContext(); - - RestContext getGlobalContext(); + @SuppressWarnings("unchecked") + @Override + RestContext getProviderSpecificContext(); + + RestContext getDomainContext(); + + RestContext getGlobalContext(); } \ No newline at end of file diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java index b2828df32b..34b8e7077d 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java @@ -42,19 +42,27 @@ import org.jclouds.rest.RestContext; @Singleton public class CloudStackContextImpl extends ComputeServiceContextImpl implements CloudStackContext { + private final RestContext providerSpecificContext; private final RestContext domainContext; private final RestContext globalContext; @Inject public CloudStackContextImpl(ComputeService computeService, Map credentialStore, Utils utils, - @SuppressWarnings("rawtypes") RestContext providerSpecificContext, + RestContext providerSpecificContext, RestContext domainContext, RestContext globalContext) { super(computeService, credentialStore, utils, providerSpecificContext); + this.providerSpecificContext=providerSpecificContext; this.domainContext = domainContext; this.globalContext = globalContext; } - + + @SuppressWarnings("unchecked") + @Override + public RestContext getProviderSpecificContext() { + return providerSpecificContext; + } + @Override public RestContext getDomainContext() { return domainContext; diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountClientExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountClientExpectTest.java index 7a06cb3470..93f0b1bf71 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountClientExpectTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountClientExpectTest.java @@ -23,7 +23,6 @@ import static org.testng.Assert.assertEquals; import java.net.URI; import java.util.Set; -import org.jclouds.cloudstack.CloudStackClient; import org.jclouds.cloudstack.CloudStackContext; import org.jclouds.cloudstack.domain.Account; import org.jclouds.cloudstack.domain.User; @@ -110,6 +109,6 @@ public class AccountClientExpectTest extends BaseCloudStackRestClientExpectTest< @Override protected AccountClient clientFrom(CloudStackContext context) { - return CloudStackClient.class.cast(context.getProviderSpecificContext().getApi()).getAccountClient(); + return context.getProviderSpecificContext().getApi().getAccountClient(); } } \ No newline at end of file diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallClientExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallClientExpectTest.java index 1dcf53f4d3..e6632224d7 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallClientExpectTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallClientExpectTest.java @@ -24,7 +24,6 @@ import static org.testng.Assert.assertNull; import java.net.URI; import java.util.Set; -import org.jclouds.cloudstack.CloudStackClient; import org.jclouds.cloudstack.CloudStackContext; import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.FirewallRule; @@ -311,6 +310,6 @@ public class FirewallClientExpectTest extends BaseCloudStackRestClientExpectTest @Override protected FirewallClient clientFrom(CloudStackContext context) { - return CloudStackClient.class.cast(context.getProviderSpecificContext().getApi()).getFirewallClient(); + return context.getProviderSpecificContext().getApi().getFirewallClient(); } } \ No newline at end of file