diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorConstants.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorConstants.java index 3ac2dee73b..91088d307e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorConstants.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorConstants.java @@ -18,6 +18,12 @@ */ package org.jclouds.vcloud.director.v1_5; +import org.jclouds.rest.RestContext; +import org.jclouds.vcloud.director.v1_5.login.SessionAsyncClient; +import org.jclouds.vcloud.director.v1_5.login.SessionClient; + +import com.google.common.reflect.TypeToken; + /** * Constants used by VCloudDirector clients * @@ -63,4 +69,11 @@ public class VCloudDirectorConstants { /** TODO javadoc */ public static final String PROPERTY_NS_NAME_LEN_MAX = "jclouds.dns_name_length_max"; + + /** TODO javadoc */ + public static final TypeToken> SESSION_CONTEXT_TYPE = + new TypeToken>() { + /** The serialVersionUID */ + private static final long serialVersionUID = -3625362618882122604L; + }; } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/VCloudDirectorTestSession.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/VCloudDirectorTestSession.java index bb367b38ed..4199435c16 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/VCloudDirectorTestSession.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/VCloudDirectorTestSession.java @@ -19,8 +19,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Role.DefaultRoles; import org.jclouds.vcloud.director.v1_5.domain.User; import org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates; import org.jclouds.vcloud.director.v1_5.predicates.ReferencePredicates; -import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient; -import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableSet; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionClientLiveTest.java index f2c7be0033..ba581fd874 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionClientLiveTest.java @@ -24,11 +24,13 @@ import static org.testng.Assert.assertTrue; import java.net.URI; -import org.jclouds.apis.ApiMetadata; +import org.jclouds.ContextBuilder; import org.jclouds.apis.BaseContextLiveTest; -import org.jclouds.rest.AnonymousRestApiMetadata; +import org.jclouds.providers.AnonymousProviderMetadata; +import org.jclouds.providers.ProviderMetadata; import org.jclouds.rest.RestContext; import org.jclouds.vcloud.director.testng.FormatApiResultsListener; +import org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants; import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Listeners; @@ -84,17 +86,22 @@ public class SessionClientLiveTest extends BaseContextLiveTest> contextType() { - return new TypeToken>(){ - - /** The serialVersionUID */ - private static final long serialVersionUID = -3625362618882122604L;}; + return VCloudDirectorConstants.SESSION_CONTEXT_TYPE; } + + @Override + protected ProviderMetadata createProviderMetadata() { + return AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(SessionClient.class, SessionAsyncClient.class, endpoint); + } + + @Override + protected ContextBuilder newBuilder() { + ProviderMetadata pm = createProviderMetadata(); + ContextBuilder builder = ContextBuilder.newBuilder(pm); + return builder; + } + }