Issue 1022:Move naming convention to Api from Client or Services:: vcloud-director

This commit is contained in:
Adrian Cole 2012-07-15 01:50:18 -07:00
parent 05fd64af44
commit 6d13652338
149 changed files with 1950 additions and 1950 deletions

View File

@ -30,8 +30,8 @@ import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.rest.internal.BaseRestApiMetadata;
import org.jclouds.vcloud.director.v1_5.config.VCloudDirectorRestClientModule;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import com.google.common.reflect.TypeToken;
@ -82,7 +82,7 @@ public class VCloudDirectorApiMetadata extends BaseRestApiMetadata {
BaseRestApiMetadata.Builder {
protected Builder() {
super(VCloudDirectorClient.class, VCloudDirectorAsyncClient.class);
super(VCloudDirectorApi.class, VCloudDirectorAsyncApi.class);
id("vcloud-director")
.name("vCloud Director 1.5 API")
.identityName("User at Organization (user@org)")

View File

@ -19,19 +19,19 @@
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 org.jclouds.vcloud.director.v1_5.login.SessionAsyncApi;
import org.jclouds.vcloud.director.v1_5.login.SessionApi;
import com.google.common.reflect.TypeToken;
/**
* Constants used by VCloudDirector clients
* Constants used by VCloudDirector apis
*
* @author grkvlt@apache.org
*/
public class VCloudDirectorConstants {
/** The XML namespace used by the clients. */
/** The XML namespace used by the apis. */
public static final String VCLOUD_1_5_NS = "http://www.vmware.com/vcloud/v1.5";
public static final String VCLOUD_VMW_NS = "http://www.vmware.com/schema/ovf";
@ -71,8 +71,8 @@ public class VCloudDirectorConstants {
public static final String PROPERTY_NS_NAME_LEN_MAX = "jclouds.dns_name_length_max";
/** TODO javadoc */
public static final TypeToken<RestContext<SessionClient, SessionAsyncClient>> SESSION_CONTEXT_TYPE =
new TypeToken<RestContext<SessionClient, SessionAsyncClient>>() {
public static final TypeToken<RestContext<SessionApi, SessionAsyncApi>> SESSION_CONTEXT_TYPE =
new TypeToken<RestContext<SessionApi, SessionAsyncApi>>() {
/** The serialVersionUID */
private static final long serialVersionUID = -3625362618882122604L;
};

View File

@ -19,11 +19,11 @@
package org.jclouds.vcloud.director.v1_5;
import org.jclouds.rest.RestContext;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncApi;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorContextImpl;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import com.google.inject.ImplementedBy;
@ -31,7 +31,7 @@ import com.google.inject.ImplementedBy;
* @author danikov
*/
@ImplementedBy(VCloudDirectorContextImpl.class)
public interface VCloudDirectorContext extends RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> {
public interface VCloudDirectorContext extends RestContext<VCloudDirectorApi, VCloudDirectorAsyncApi> {
RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient> getAdminContext();
RestContext<VCloudDirectorAdminApi, VCloudDirectorAdminAsyncApi> getAdminContext();
}

View File

@ -22,67 +22,67 @@ import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcClient;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient;
import org.jclouds.vcloud.director.v1_5.features.admin.UserClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcApi;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupApi;
import org.jclouds.vcloud.director.v1_5.features.admin.UserApi;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
/**
* Provides synchronous access to VCloudDirector Admin.
*
* @see VCloudDirectorAsyncClient
* @see VCloudDirectorAsyncApi
* @author Adrian Cole
*/
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
public interface VCloudDirectorAdminClient extends VCloudDirectorClient {
public interface VCloudDirectorAdminApi extends VCloudDirectorApi {
/**
* @return asynchronous access to admin query features
*/
@Override
@Delegate
AdminQueryClient getQueryClient();
AdminQueryApi getQueryApi();
/**
* @return synchronous access to {@link Catalog} admin features
*/
@Override
@Delegate
AdminCatalogClient getCatalogClient();
AdminCatalogApi getCatalogApi();
/**
* @return synchronous access to admin {@link Group} features
*/
@Delegate
GroupClient getGroupClient();
GroupApi getGroupApi();
/**
* @return synchronous access to {@link AdminOrg} features
*/
@Override
@Delegate
AdminOrgClient getOrgClient();
AdminOrgApi getOrgApi();
/**
* @return synchronous access to {@link User} features
*/
@Delegate
UserClient getUserClient();
UserApi getUserApi();
/**
* @return synchronous access to {@link AdminVdc} features
*/
@Override
@Delegate
AdminVdcClient getVdcClient();
AdminVdcApi getVdcApi();
/**
* @return synchronous access to admin {@link Network} features
*/
@Override
@Delegate
AdminNetworkClient getNetworkClient();
AdminNetworkApi getNetworkApi();
}

View File

@ -19,28 +19,28 @@
package org.jclouds.vcloud.director.v1_5.admin;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.UserAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.UserAsyncApi;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
/**
* Provides asynchronous access to VCloudDirector Admin via their REST API.
*
* @see VCloudDirectorAdminClient
* @see VCloudDirectorAdminApi
* @author danikov
*/
public interface VCloudDirectorAdminAsyncClient extends VCloudDirectorAsyncClient {
public interface VCloudDirectorAdminAsyncApi extends VCloudDirectorAsyncApi {
/**
* @return asynchronous access to admin query features
*/
@Override
@Delegate
AdminQueryAsyncClient getQueryClient();
AdminQueryAsyncApi getQueryApi();
/**
@ -48,38 +48,38 @@ public interface VCloudDirectorAdminAsyncClient extends VCloudDirectorAsyncClien
*/
@Override
@Delegate
AdminCatalogAsyncClient getCatalogClient();
AdminCatalogAsyncApi getCatalogApi();
/**
* @return asynchronous access to admin {@link Group} features
*/
@Delegate
GroupAsyncClient getGroupClient();
GroupAsyncApi getGroupApi();
/**
* @return asynchronous access to {@link AdminOrg} features
*/
@Override
@Delegate
AdminOrgAsyncClient getOrgClient();
AdminOrgAsyncApi getOrgApi();
/**
* @return asynchronous access to {@link User} features
*/
@Delegate
UserAsyncClient getUserClient();
UserAsyncApi getUserApi();
/**
* @return asynchronous access to {@link AdminVdc} features
*/
@Override
@Delegate
AdminVdcAsyncClient getVdcClient();
AdminVdcAsyncApi getVdcApi();
/**
* @return asynchronous access to admin {@link Network} features
*/
@Override
@Delegate
AdminNetworkAsyncClient getNetworkClient();
AdminNetworkAsyncApi getNetworkApi();
}

View File

@ -41,56 +41,56 @@ import org.jclouds.rest.config.BinderUtils;
import org.jclouds.rest.config.RestClientModule;
import org.jclouds.rest.internal.RestContextImpl;
import org.jclouds.util.Suppliers2;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncApi;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
import org.jclouds.vcloud.director.v1_5.annotations.Login;
import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
import org.jclouds.vcloud.director.v1_5.features.MediaAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.MediaClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
import org.jclouds.vcloud.director.v1_5.features.UploadAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.UploadClient;
import org.jclouds.vcloud.director.v1_5.features.VAppAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
import org.jclouds.vcloud.director.v1_5.features.VmAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VmClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcClient;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient;
import org.jclouds.vcloud.director.v1_5.features.admin.UserAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.admin.UserClient;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.CatalogApi;
import org.jclouds.vcloud.director.v1_5.features.MediaAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.MediaApi;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.NetworkApi;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.OrgApi;
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.QueryApi;
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.TaskApi;
import org.jclouds.vcloud.director.v1_5.features.UploadAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.UploadApi;
import org.jclouds.vcloud.director.v1_5.features.VAppAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VAppApi;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateApi;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VdcApi;
import org.jclouds.vcloud.director.v1_5.features.VmAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VmApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcApi;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupApi;
import org.jclouds.vcloud.director.v1_5.features.admin.UserAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.admin.UserApi;
import org.jclouds.vcloud.director.v1_5.functions.LoginUserInOrgWithPassword;
import org.jclouds.vcloud.director.v1_5.handlers.InvalidateSessionAndRetryOn401AndLogoutOnClose;
import org.jclouds.vcloud.director.v1_5.handlers.VCloudDirectorErrorHandler;
import org.jclouds.vcloud.director.v1_5.login.SessionAsyncClient;
import org.jclouds.vcloud.director.v1_5.login.SessionClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.login.SessionAsyncApi;
import org.jclouds.vcloud.director.v1_5.login.SessionApi;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
@ -109,49 +109,49 @@ import com.google.inject.name.Named;
* @author Adrian Cole
*/
@ConfiguresRestClient
public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirectorClient, VCloudDirectorAsyncClient> {
public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirectorApi, VCloudDirectorAsyncApi> {
public static final Map<Class<?>, Class<?>> USER_DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>>builder()
.put(CatalogClient.class, CatalogAsyncClient.class)
.put(MediaClient.class, MediaAsyncClient.class)
.put(MetadataClient.Readable.class, MetadataAsyncClient.Readable.class)
.put(MetadataClient.Writeable.class, MetadataAsyncClient.Writeable.class)
.put(NetworkClient.class, NetworkAsyncClient.class)
.put(OrgClient.class, OrgAsyncClient.class)
.put(QueryClient.class, QueryAsyncClient.class)
.put(TaskClient.class, TaskAsyncClient.class)
.put(UploadClient.class, UploadAsyncClient.class)
.put(VAppClient.class, VAppAsyncClient.class)
.put(VAppTemplateClient.class, VAppTemplateAsyncClient.class)
.put(VdcClient.class, VdcAsyncClient.class)
.put(VmClient.class, VmAsyncClient.class)
.put(CatalogApi.class, CatalogAsyncApi.class)
.put(MediaApi.class, MediaAsyncApi.class)
.put(MetadataApi.Readable.class, MetadataAsyncApi.Readable.class)
.put(MetadataApi.Writeable.class, MetadataAsyncApi.Writeable.class)
.put(NetworkApi.class, NetworkAsyncApi.class)
.put(OrgApi.class, OrgAsyncApi.class)
.put(QueryApi.class, QueryAsyncApi.class)
.put(TaskApi.class, TaskAsyncApi.class)
.put(UploadApi.class, UploadAsyncApi.class)
.put(VAppApi.class, VAppAsyncApi.class)
.put(VAppTemplateApi.class, VAppTemplateAsyncApi.class)
.put(VdcApi.class, VdcAsyncApi.class)
.put(VmApi.class, VmAsyncApi.class)
.build();
public static final Map<Class<?>, Class<?>> ADMIN_DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>>builder()
.putAll(USER_DELEGATE_MAP)
.put(AdminCatalogClient.class, AdminCatalogAsyncClient.class)
.put(AdminNetworkClient.class, AdminNetworkAsyncClient.class)
.put(AdminOrgClient.class, AdminOrgAsyncClient.class)
.put(AdminQueryClient.class, AdminQueryAsyncClient.class)
.put(AdminVdcClient.class, AdminVdcAsyncClient.class)
.put(GroupClient.class, GroupAsyncClient.class)
.put(UserClient.class, UserAsyncClient.class)
.put(AdminCatalogApi.class, AdminCatalogAsyncApi.class)
.put(AdminNetworkApi.class, AdminNetworkAsyncApi.class)
.put(AdminOrgApi.class, AdminOrgAsyncApi.class)
.put(AdminQueryApi.class, AdminQueryAsyncApi.class)
.put(AdminVdcApi.class, AdminVdcAsyncApi.class)
.put(GroupApi.class, GroupAsyncApi.class)
.put(UserApi.class, UserAsyncApi.class)
.build();
@Override
protected void bindAsyncClient() {
// bind the user client (default)
// bind the user api (default)
super.bindAsyncClient();
// bind the admin client
BinderUtils.bindAsyncClient(binder(), VCloudDirectorAdminAsyncClient.class);
// bind the admin api
BinderUtils.bindAsyncClient(binder(), VCloudDirectorAdminAsyncApi.class);
}
@Override
protected void bindClient() {
// bind the user client (default)
// bind the user api (default)
super.bindClient();
// bind the admin client
BinderUtils.bindClient(binder(), VCloudDirectorAdminClient.class, VCloudDirectorAdminAsyncClient.class, ADMIN_DELEGATE_MAP);
// bind the admin api
BinderUtils.bindClient(binder(), VCloudDirectorAdminApi.class, VCloudDirectorAdminAsyncApi.class, ADMIN_DELEGATE_MAP);
}
public VCloudDirectorRestClientModule() {
@ -160,16 +160,16 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
@Override
protected void configure() {
bind(new TypeLiteral<RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient>>() {
}).to(new TypeLiteral<RestContextImpl<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient>>() {
bind(new TypeLiteral<RestContext<VCloudDirectorAdminApi, VCloudDirectorAdminAsyncApi>>() {
}).to(new TypeLiteral<RestContextImpl<VCloudDirectorAdminApi, VCloudDirectorAdminAsyncApi>>() {
});
// Bind clients that are used directly in Functions, Predicates and other circumstances
bindClientAndAsyncClient(binder(), OrgClient.class, OrgAsyncClient.class);
bindClientAndAsyncClient(binder(), SessionClient.class, SessionAsyncClient.class);
bindClientAndAsyncClient(binder(), TaskClient.class, TaskAsyncClient.class);
bindClientAndAsyncClient(binder(), VAppClient.class, VAppAsyncClient.class);
bindClientAndAsyncClient(binder(), VmClient.class, VmAsyncClient.class);
// Bind apis that are used directly in Functions, Predicates and other circumstances
bindClientAndAsyncClient(binder(), OrgApi.class, OrgAsyncApi.class);
bindClientAndAsyncClient(binder(), SessionApi.class, SessionAsyncApi.class);
bindClientAndAsyncClient(binder(), TaskApi.class, TaskAsyncApi.class);
bindClientAndAsyncClient(binder(), VAppApi.class, VAppAsyncApi.class);
bindClientAndAsyncClient(binder(), VmApi.class, VmAsyncApi.class);
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class);
@ -186,7 +186,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
@Provides
@Login
protected Supplier<URI> loginUrl(@Provider Supplier<URI> provider) {
// TODO: technically, we should implement version client, but this will work
// TODO: technically, we should implement version api, but this will work
return Suppliers2.compose(new Function<URI, URI>() {
@Override

View File

@ -163,7 +163,7 @@ public class Reference {
* the object, and is never reused. The value of the href attribute is a reference to a view of
* the object, and can be used to access a representation of the object that is valid in a
* particular context. Although URLs have a well-known syntax and a well-understood
* interpretation, a client should treat each href as an opaque string. The rules that govern how
* interpretation, a api should treat each href as an opaque string. The rules that govern how
* the server constructs href strings might change in future releases.
*
* @return an opaque reference and should never be parsed

View File

@ -146,7 +146,7 @@ public class Resource {
* the object, and is never reused. The value of the href attribute is a reference to a view of
* the object, and can be used to access a representation of the object that is valid in a
* particular context. Although URLs have a well-known syntax and a well-understood
* interpretation, a client should treat each href as an opaque string. The rules that govern how
* interpretation, a api should treat each href as an opaque string. The rules that govern how
* the server constructs href strings might change in future releases.
*
* @return an opaque reference and should never be parsed

View File

@ -93,7 +93,7 @@ public class SessionWithToken {
* the object, and is never reused. The value of the token attribute is a reference to a view of
* the object, and can be used to access a representation of the object that is valid in a
* particular context. Although URLs have a well-known syntax and a well-understood
* interpretation, a client should treat each token as an opaque string. The rules that govern
* interpretation, a api should treat each token as an opaque string. The rules that govern
* how the server constructs token strings might change in future releases.
*
* @return an opaque reference and should never be parsed

View File

@ -174,7 +174,7 @@ public class QueryResultRecordType {
* portion of the id attribute value, it uniquely identifies the object, persists for the life of the object, and is never
* reused. The value of the href attribute is a reference to a view of the object, and can be used to access a representation of
* the object that is valid in a particular context. Although URLs have a well-known syntax and a well-understood interpretation,
* a client should treat each href as an opaque string. The rules that govern how the server constructs href strings might change
* a api should treat each href as an opaque string. The rules that govern how the server constructs href strings might change
* in future releases.
*
* @return an opaque reference and should never be parsed

View File

@ -29,11 +29,11 @@ import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
/**
* Provides synchronous access to {@link Catalog} objects.
*
* @see CatalogAsyncClient
* @see CatalogAsyncApi
* @author grkvlt@apache.org
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface CatalogClient {
public interface CatalogApi {
/**
* Retrieves a catalog.
@ -100,12 +100,12 @@ public interface CatalogClient {
* @return synchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataClient.Readable getMetadataClient();
MetadataApi.Readable getMetadataApi();
/**
* @return synchronous access to {@link Metadata.Writeable} features for CatalogItems
*/
@Delegate
MetadataClient.Writeable getCatalogItemMetadataClient();
MetadataApi.Writeable getCatalogItemMetadataApi();
}

View File

@ -44,11 +44,11 @@ import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see CatalogClient
* @see CatalogApi
* @author grkvlt@apache.org
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface CatalogAsyncClient {
public interface CatalogAsyncApi {
/**
* Retrieves a catalog.
@ -101,11 +101,11 @@ public interface CatalogAsyncClient {
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncClient.Readable getMetadataClient();
MetadataAsyncApi.Readable getMetadataApi();
/**
* @return asynchronous access to {@link Metadata.Writeable} features for CatalogItems
*/
@Delegate
MetadataAsyncClient.Writeable getCatalogItemMetadataClient();
MetadataAsyncApi.Writeable getCatalogItemMetadataApi();
}

View File

@ -31,11 +31,11 @@ import org.jclouds.vcloud.director.v1_5.domain.params.CloneMediaParams;
/**
* Provides synchronous access to {@link Media}.
*
* @see MediaAsyncClient
* @see MediaAsyncApi
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface MediaClient {
public interface MediaApi {
/**
* Retrieves a media.
@ -84,6 +84,6 @@ public interface MediaClient {
* @return synchronous access to {@link Metadata.Writeable} features
*/
@Delegate
MetadataClient.Writeable getMetadataClient();
MetadataApi.Writeable getMetadataApi();
}

View File

@ -46,14 +46,14 @@ import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see MediaClient
* @see MediaApi
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface MediaAsyncClient {
public interface MediaAsyncApi {
/**
* @see MediaClient#getMedia(URI)
* @see MediaApi#getMedia(URI)
*/
@GET
@Consumes
@ -62,7 +62,7 @@ public interface MediaAsyncClient {
ListenableFuture<Media> getMedia(@EndpointParam URI uri);
/**
* @see MediaClient#createMedia(URI, Media)
* @see MediaApi#createMedia(URI, Media)
*/
@POST
@Consumes(VCloudDirectorMediaType.MEDIA)
@ -73,7 +73,7 @@ public interface MediaAsyncClient {
/**
* @see MediaClient#cloneMedia(URI, CloneMediaParams)
* @see MediaApi#cloneMedia(URI, CloneMediaParams)
*/
@POST
@Path("/action/cloneMedia")
@ -84,7 +84,7 @@ public interface MediaAsyncClient {
@BinderParam(BindToXMLPayload.class) CloneMediaParams params);
/**
* @see MediaClient#updateMedia(URI, Media))
* @see MediaApi#updateMedia(URI, Media))
*/
@PUT
@Consumes(VCloudDirectorMediaType.TASK)
@ -93,7 +93,7 @@ public interface MediaAsyncClient {
ListenableFuture<Task> updateMedia(@EndpointParam URI uri, @BinderParam(BindToXMLPayload.class) Media media);
/**
* @see MediaClient#deleteMedia(URI))
* @see MediaApi#deleteMedia(URI))
*/
@DELETE
@Consumes(VCloudDirectorMediaType.TASK)
@ -101,7 +101,7 @@ public interface MediaAsyncClient {
ListenableFuture<Task> deleteMedia(@EndpointParam URI uri);
/**
* @see MediaClient#getOwner(URI)
* @see MediaApi#getOwner(URI)
*/
@GET
@Path("/owner")
@ -114,5 +114,5 @@ public interface MediaAsyncClient {
* @return asynchronous access to {@link Metadata.Writeable} features
*/
@Delegate
MetadataAsyncClient.Writeable getMetadataClient();
MetadataAsyncApi.Writeable getMetadataApi();
}

View File

@ -29,13 +29,13 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
/**
* Provides synchronous access to {@linkl Metadata}.
*
* @see MetadataAsyncClient
* @see MetadataAsyncApi
* @author danikov
*/
public interface MetadataClient {
public interface MetadataApi {
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public static interface Readable extends MetadataClient {
public static interface Readable extends MetadataApi {
/**
* Retrieves an list of metadata

View File

@ -45,16 +45,16 @@ import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see MetadataClient
* @see MetadataApi
* @author danikov
*/
public interface MetadataAsyncClient {
public interface MetadataAsyncApi {
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public static interface Readable extends MetadataAsyncClient {
public static interface Readable extends MetadataAsyncApi {
/**
* @see MetadataClient.Readable#getMetadata(URISupplier)
* @see MetadataApi.Readable#getMetadata(URISupplier)
*/
@GET
@Path("/metadata")
@ -64,7 +64,7 @@ public interface MetadataAsyncClient {
ListenableFuture<Metadata> getMetadata(@EndpointParam URI metaDataUri);
/**
* @see MetadataClient.Readable#getMetadataValue(URI, String)
* @see MetadataApi.Readable#getMetadataValue(URI, String)
*/
@GET
@Path("/metadata/{key}")
@ -78,7 +78,7 @@ public interface MetadataAsyncClient {
public static interface Writeable extends Readable {
/**
* @see MetadataClient.Writable#mergeMetadata(URI, Metadata))
* @see MetadataApi.Writable#mergeMetadata(URI, Metadata))
*/
@POST
@Path("/metadata")
@ -88,7 +88,7 @@ public interface MetadataAsyncClient {
ListenableFuture<Task> mergeMetadata(@EndpointParam URI metaDataUri, @BinderParam(BindToXMLPayload.class) Metadata metadata);
/**
* @see MetadataClient.Writable#setMetadata(URI, String, MetadataEntry))
* @see MetadataApi.Writable#setMetadata(URI, String, MetadataEntry))
*/
@PUT
@Path("/metadata/{key}")
@ -100,7 +100,7 @@ public interface MetadataAsyncClient {
@BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
/**
* @see MetadataClient.Writable#deleteMetadataEntry(URISupplier, String))
* @see MetadataApi.Writable#deleteMetadataEntry(URISupplier, String))
*/
@DELETE
@Path("/metadata/{key}")

View File

@ -28,11 +28,11 @@ import org.jclouds.vcloud.director.v1_5.domain.network.Network;
/**
* Provides synchronous access to {@link Network}.
*
* @see NetworkAsyncClient
* @see NetworkAsyncApi
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface NetworkClient {
public interface NetworkApi {
/**
* Retrieves a network.
@ -45,5 +45,5 @@ public interface NetworkClient {
* @return synchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataClient.Readable getMetadataClient();
MetadataApi.Readable getMetadataApi();
}

View File

@ -35,14 +35,14 @@ import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see NetworkClient
* @see NetworkApi
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface NetworkAsyncClient {
public interface NetworkAsyncApi {
/**
* @see NetworkClient#getNetwork(URI)
* @see NetworkApi#getNetwork(URI)
*/
@GET
@Consumes
@ -54,6 +54,6 @@ public interface NetworkAsyncClient {
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncClient.Readable getMetadataClient();
MetadataAsyncApi.Readable getMetadataApi();
}

View File

@ -30,11 +30,11 @@ import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
/**
* Provides synchronous access to {@link Org}.
*
* @see OrgAsyncClient
* @see OrgAsyncApi
* @author Adrian Cole
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface OrgClient {
public interface OrgApi {
/**
* Retrieves a list of organizations.
@ -84,5 +84,5 @@ public interface OrgClient {
* @return synchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataClient.Readable getMetadataClient();
MetadataApi.Readable getMetadataApi();
}

View File

@ -45,14 +45,14 @@ import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see OrgClient
* @see OrgApi
* @author Adrian Cole
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface OrgAsyncClient {
public interface OrgAsyncApi {
/**
* @see OrgClient#getOrgList()
* @see OrgApi#getOrgList()
*/
@GET
@Path("/org/")
@ -61,7 +61,7 @@ public interface OrgAsyncClient {
ListenableFuture<OrgList> getOrgList();
/**
* @see OrgClient#getOrg(URI)
* @see OrgApi#getOrg(URI)
*/
@GET
@Consumes
@ -70,7 +70,7 @@ public interface OrgAsyncClient {
ListenableFuture<? extends Org> getOrg(@EndpointParam URI orgUri);
/**
* @see OrgClient#modifyControlAccess(URI, URI, ControlAccessParams)
* @see OrgApi#modifyControlAccess(URI, URI, ControlAccessParams)
*/
@POST
@Path("/catalog/{catalogId}/action/controlAccess")
@ -82,7 +82,7 @@ public interface OrgAsyncClient {
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
/**
* @see OrgClient#getControlAccess(URI, URI, ControlAccessParams)
* @see OrgApi#getControlAccess(URI, URI, ControlAccessParams)
*/
@GET
@Path("/catalog/{catalogId}/controlAccess")
@ -96,5 +96,5 @@ public interface OrgAsyncClient {
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncClient.Readable getMetadataClient();
MetadataAsyncApi.Readable getMetadataApi();
}

View File

@ -35,11 +35,11 @@ import org.jclouds.vcloud.director.v1_5.domain.query.VAppReferences;
/**
* Provides synchronous access to the REST API query interface.
*
* @see QueryAsyncClient
* @see QueryAsyncApi
* @author grkvlt@apache.org
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface QueryClient {
public interface QueryApi {
/**
* Redirects to the URL of an entity with the given VCD ID.

View File

@ -41,15 +41,15 @@ import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see QueryClient
* @see QueryApi
* @author grkvlt@apache.org
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
@SkipEncoding({ '=' })
public interface QueryAsyncClient {
public interface QueryAsyncApi {
/**
* @see QueryClient#entity(String)
* @see QueryApi#entity(String)
*/
@GET
@Path("/entity/{id}")

View File

@ -28,11 +28,11 @@ import org.jclouds.vcloud.director.v1_5.domain.TasksList;
/**
* Provides synchronous access to {@link Task} objects.
*
* @see TaskAsyncClient
* @see TaskAsyncApi
* @author grkvlt@apache.org
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface TaskClient {
public interface TaskApi {
/**
* Retrieves a list of tasks.

View File

@ -38,14 +38,14 @@ import org.jclouds.vcloud.director.v1_5.functions.OrgReferenceToTaskListEndpoint
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see TaskClient
* @see TaskApi
* @author grkvlt@apache.org
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface TaskAsyncClient {
public interface TaskAsyncApi {
/**
* @see TaskClient#getTaskList(URISupplier)
* @see TaskApi#getTaskList(URISupplier)
*/
@GET
@Consumes
@ -54,7 +54,7 @@ public interface TaskAsyncClient {
ListenableFuture<TasksList> getTaskList(@EndpointParam(parser = OrgReferenceToTaskListEndpoint.class) URI orgURI);
/**
* @see TaskClient#getTask(URI)
* @see TaskApi#getTask(URI)
*/
@GET
@Consumes
@ -63,7 +63,7 @@ public interface TaskAsyncClient {
ListenableFuture<Task> getTask(@EndpointParam URI taskURI);
/**
* @see TaskClient#cancelTask(URI)
* @see TaskApi#cancelTask(URI)
*/
@POST
@Path("/action/cancel")

View File

@ -27,11 +27,11 @@ import org.jclouds.io.Payload;
/**
* Provides synchronous access to upload.
*
* @see UploadAsyncClient
* @see UploadAsyncApi
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface UploadClient {
public interface UploadApi {
/**
* @return eTag

View File

@ -30,14 +30,14 @@ import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see UploadClient
* @see UploadApi
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface UploadAsyncClient {
public interface UploadAsyncApi {
/**
* @see UploadClient#put
* @see UploadApi#put
*/
@PUT
ListenableFuture<Void> upload(@EndpointParam URI location, Payload payload);

View File

@ -41,11 +41,11 @@ import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
* Provides synchronous access to {@link VApp} objects.
*
* @author grkvlt@apache.org
* @see VAppAsyncClient
* @see VAppAsyncApi
* @version 1.5
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface VAppClient {
public interface VAppApi {
/**
* Retrieves a {@link VApp}.
@ -186,7 +186,7 @@ public interface VAppClient {
*
* To remove VMs you should put their references in elements. The way you add
* VMs is the same as described in compose vApp operation
* {@link VdcClient#composeVApp(URI, org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams)}.
* {@link VdcApi#composeVApp(URI, org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams)}.
* The status of vApp will be in {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED}
* until the recompose task is finished.
*
@ -434,5 +434,5 @@ public interface VAppClient {
* Synchronous access to {@link VApp} {@link Metadata} features.
*/
@Delegate
MetadataClient.Writeable getMetadataClient();
MetadataApi.Writeable getMetadataApi();
}

View File

@ -66,13 +66,13 @@ import com.google.common.util.concurrent.ListenableFuture;
/**
* @author grkvlt@apache.org
* @see VAppClient
* @see VAppApi
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface VAppAsyncClient {
public interface VAppAsyncApi {
/**
* @see VAppClient#getVApp(URI)
* @see VAppApi#getVApp(URI)
*/
@GET
@Consumes(VAPP)
@ -81,7 +81,7 @@ public interface VAppAsyncClient {
ListenableFuture<VApp> getVApp(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyVApp(URI, VApp)
* @see VAppApi#modifyVApp(URI, VApp)
*/
@PUT
@Produces(VAPP)
@ -91,7 +91,7 @@ public interface VAppAsyncClient {
@BinderParam(BindToXMLPayload.class) VApp vApp);
/**
* @see VAppClient#deleteVApp(URI)
* @see VAppApi#deleteVApp(URI)
*/
@DELETE
@Consumes(TASK)
@ -99,7 +99,7 @@ public interface VAppAsyncClient {
ListenableFuture<Task> deleteVApp(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyControlAccess(URI, ControlAccessParams)
* @see VAppApi#modifyControlAccess(URI, ControlAccessParams)
*/
@POST
@Path("/action/controlAccess")
@ -110,7 +110,7 @@ public interface VAppAsyncClient {
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
/**
* @see VAppClient#deploy(URI, DeployVAppParams)
* @see VAppApi#deploy(URI, DeployVAppParams)
*/
@POST
@Path("/action/deploy")
@ -121,7 +121,7 @@ public interface VAppAsyncClient {
@BinderParam(BindToXMLPayload.class) DeployVAppParams params);
/**
* @see VAppClient#discardSuspendedState(URI)
* @see VAppApi#discardSuspendedState(URI)
*/
@POST
@Path("/action/discardSuspendedState")
@ -130,7 +130,7 @@ public interface VAppAsyncClient {
ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vAppURI);
/**
* @see VAppClient#enterMaintenanceMode(URI)
* @see VAppApi#enterMaintenanceMode(URI)
*/
@POST
@Path("/action/enterMaintenanceMode")
@ -139,7 +139,7 @@ public interface VAppAsyncClient {
ListenableFuture<Void> enterMaintenanceMode(@EndpointParam URI vAppURI);
/**
* @see VAppClient#exitMaintenanceMode(URI)
* @see VAppApi#exitMaintenanceMode(URI)
*/
@POST
@Path("/action/exitMaintenanceMode")
@ -148,7 +148,7 @@ public interface VAppAsyncClient {
ListenableFuture<Void> exitMaintenanceMode(@EndpointParam URI vAppURI);
/**
* @see VAppClient#recompose(URI, RecomposeVAppParams)
* @see VAppApi#recompose(URI, RecomposeVAppParams)
*/
@POST
@Path("/action/recomposeVApp")
@ -159,7 +159,7 @@ public interface VAppAsyncClient {
@BinderParam(BindToXMLPayload.class) RecomposeVAppParams params);
/**
* @see VAppClient#undeploy(URI, UndeployVAppParams)
* @see VAppApi#undeploy(URI, UndeployVAppParams)
*/
@POST
@Path("/action/undeploy")
@ -170,7 +170,7 @@ public interface VAppAsyncClient {
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
/**
* @see VAppClient#getControlAccess(URI)
* @see VAppApi#getControlAccess(URI)
*/
@GET
@Path("/controlAccess")
@ -180,7 +180,7 @@ public interface VAppAsyncClient {
ListenableFuture<ControlAccessParams> getControlAccess(@EndpointParam URI vAppURI);
/**
* @see VAppClient#powerOff(URI)
* @see VAppApi#powerOff(URI)
*/
@POST
@Path("/power/action/powerOff")
@ -189,7 +189,7 @@ public interface VAppAsyncClient {
ListenableFuture<Task> powerOff(@EndpointParam URI vAppURI);
/**
* @see VAppClient#powerOn(URI)
* @see VAppApi#powerOn(URI)
*/
@POST
@Path("/power/action/powerOn")
@ -198,7 +198,7 @@ public interface VAppAsyncClient {
ListenableFuture<Task> powerOn(@EndpointParam URI vAppURI);
/**
* @see VAppClient#reboot(URI)
* @see VAppApi#reboot(URI)
*/
@POST
@Path("/power/action/powerOff")
@ -207,7 +207,7 @@ public interface VAppAsyncClient {
ListenableFuture<Task> reboot(@EndpointParam URI vAppURI);
/**
* @see VAppClient#reset(URI)
* @see VAppApi#reset(URI)
*/
@POST
@Path("/power/action/reset")
@ -216,7 +216,7 @@ public interface VAppAsyncClient {
ListenableFuture<Task> reset(@EndpointParam URI vAppURI);
/**
* @see VAppClient#shutdown(URI)
* @see VAppApi#shutdown(URI)
*/
@POST
@Path("/power/action/shutdown")
@ -225,7 +225,7 @@ public interface VAppAsyncClient {
ListenableFuture<Task> shutdown(@EndpointParam URI vAppURI);
/**
* @see VAppClient#suspend(URI)
* @see VAppApi#suspend(URI)
*/
@POST
@Path("/power/action/suspend")
@ -234,7 +234,7 @@ public interface VAppAsyncClient {
ListenableFuture<Task> suspend(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getLeaseSettingsSection(URI)
* @see VAppApi#getLeaseSettingsSection(URI)
*/
@GET
@Path("/leaseSettingsSection")
@ -244,7 +244,7 @@ public interface VAppAsyncClient {
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyLeaseSettingsSection(URI, LeaseSettingsSection)
* @see VAppApi#modifyLeaseSettingsSection(URI, LeaseSettingsSection)
*/
@PUT
@Path("/leaseSettingsSection")
@ -255,7 +255,7 @@ public interface VAppAsyncClient {
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
/**
* @see VAppClient#getNetworkConfigSection(URI)
* @see VAppApi#getNetworkConfigSection(URI)
*/
@GET
@Path("/networkConfigSection")
@ -265,7 +265,7 @@ public interface VAppAsyncClient {
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyNetworkConfigSection(URI, NetworkConfigSection)
* @see VAppApi#modifyNetworkConfigSection(URI, NetworkConfigSection)
*/
@PUT
@Path("/networkConfigSection")
@ -276,7 +276,7 @@ public interface VAppAsyncClient {
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
/**
* @see VAppClient#getNetworkSection(URI)
* @see VAppApi#getNetworkSection(URI)
*/
@GET
@Path("/networkSection")
@ -286,7 +286,7 @@ public interface VAppAsyncClient {
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI vAppURI);
/**
* @see VAppClient#getOwner(URI)
* @see VAppApi#getOwner(URI)
*/
@GET
@Path("/owner")
@ -296,7 +296,7 @@ public interface VAppAsyncClient {
ListenableFuture<Owner> getOwner(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyOwner(URI, Owner)
* @see VAppApi#modifyOwner(URI, Owner)
*/
@PUT
@Path("/owner")
@ -307,7 +307,7 @@ public interface VAppAsyncClient {
@BinderParam(BindToXMLPayload.class) Owner owner);
/**
* @see VAppClient#getProductSections(URI)
* @see VAppApi#getProductSections(URI)
*/
@GET
@Path("/productSections")
@ -317,7 +317,7 @@ public interface VAppAsyncClient {
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyProductSections(URI, ProductSectionList)
* @see VAppApi#modifyProductSections(URI, ProductSectionList)
*/
@PUT
@Path("/productSections")
@ -329,7 +329,7 @@ public interface VAppAsyncClient {
/**
* @see VAppClient#getStartupSection(URI)
* @see VAppApi#getStartupSection(URI)
*/
@GET
@Path("/startupSection")
@ -339,7 +339,7 @@ public interface VAppAsyncClient {
ListenableFuture<StartupSection> getStartupSection(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyStartupSection(URI, StartupSection)
* @see VAppApi#modifyStartupSection(URI, StartupSection)
*/
@PUT
@Path("/startupSection")
@ -353,5 +353,5 @@ public interface VAppAsyncClient {
* Asynchronous access to {@link VApp} {@link Metadata} features
*/
@Delegate
MetadataAsyncClient.Writeable getMetadataClient();
MetadataAsyncApi.Writeable getMetadataApi();
}

View File

@ -41,10 +41,10 @@ import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
* Provides synchronous access to {@link VAppTemplate} objects.
*
* @author Adam Lowe
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncApi
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface VAppTemplateClient {
public interface VAppTemplateApi {
/**
* Retrieves a vApp template (can be used also to retrieve a VM from a vApp Template).
@ -362,5 +362,5 @@ public interface VAppTemplateClient {
* @return synchronous access to {@link Metadata} features
*/
@Delegate
MetadataClient.Writeable getMetadataClient();
MetadataApi.Writeable getMetadataApi();
}

View File

@ -67,13 +67,13 @@ import com.google.common.util.concurrent.ListenableFuture;
/**
* @author Adam Lowe
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateApi
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface VAppTemplateAsyncClient {
public interface VAppTemplateAsyncApi {
/**
* @see VAppTemplateClient#getVAppTemplate(URI)
* @see VAppTemplateApi#getVAppTemplate(URI)
*/
@GET
@Consumes(VAPP_TEMPLATE)
@ -83,7 +83,7 @@ public interface VAppTemplateAsyncClient {
/**
* @see VAppTemplateClient#modifyVAppTemplate(URI, VAppTemplate)
* @see VAppTemplateApi#modifyVAppTemplate(URI, VAppTemplate)
*/
@PUT
@Produces(VAPP_TEMPLATE)
@ -93,7 +93,7 @@ public interface VAppTemplateAsyncClient {
@BinderParam(BindToXMLPayload.class) VAppTemplate template);
/**
* @see VAppTemplateClient#deleteVappTemplate(URI)
* @see VAppTemplateApi#deleteVappTemplate(URI)
*/
@DELETE
@Consumes(TASK)
@ -101,7 +101,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<Task> deleteVappTemplate(@EndpointParam URI templateUri);
/**
* @see VAppTemplateClient#consolidateVm(URI)
* @see VAppTemplateApi#consolidateVm(URI)
*/
@POST
@Consumes(TASK)
@ -110,7 +110,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<Task> consolidateVm(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#disableDownload(URI)
* @see VAppTemplateApi#disableDownload(URI)
*/
@POST
@Path("/action/disableDownload")
@ -118,7 +118,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<Void> disableDownload(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#enableDownloadVappTemplate(URI)
* @see VAppTemplateApi#enableDownloadVappTemplate(URI)
*/
@POST
@Consumes(TASK)
@ -127,7 +127,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<Task> enableDownload(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#relocateVm(URI, RelocateParams)
* @see VAppTemplateApi#relocateVm(URI, RelocateParams)
*/
@POST
@Produces(RELOCATE_TEMPLATE)
@ -138,7 +138,7 @@ public interface VAppTemplateAsyncClient {
@BinderParam(BindToXMLPayload.class) RelocateParams params);
/**
* @see VAppTemplateClient#getCustomizationSection(URI)
* @see VAppTemplateApi#getCustomizationSection(URI)
*/
@GET
@Consumes(CUSTOMIZATION_SECTION)
@ -148,7 +148,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<CustomizationSection> getCustomizationSection(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#modifyCustomizationSection(URI, CustomizationSection)
* @see VAppTemplateApi#modifyCustomizationSection(URI, CustomizationSection)
*/
@PUT
@Produces(CUSTOMIZATION_SECTION)
@ -159,7 +159,7 @@ public interface VAppTemplateAsyncClient {
@BinderParam(BindToXMLPayload.class) CustomizationSection sectionType);
/**
* @see VAppTemplateClient#getGuestCustomizationSection(URI)
* @see VAppTemplateApi#getGuestCustomizationSection(URI)
*/
@GET
@Consumes(GUEST_CUSTOMIZATION_SECTION)
@ -169,7 +169,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#modifyGuestCustomizationSection(URI, org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection)
* @see VAppTemplateApi#modifyGuestCustomizationSection(URI, org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection)
*/
@PUT
@Produces(GUEST_CUSTOMIZATION_SECTION)
@ -180,7 +180,7 @@ public interface VAppTemplateAsyncClient {
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
/**
* @see VAppTemplateClient#getLeaseSettingsSection(URI)
* @see VAppTemplateApi#getLeaseSettingsSection(URI)
*/
@GET
@Consumes(LEASE_SETTINGS_SECTION)
@ -190,7 +190,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#modifyLeaseSettingsSection(URI, LeaseSettingsSection)
* @see VAppTemplateApi#modifyLeaseSettingsSection(URI, LeaseSettingsSection)
*/
@PUT
@Produces(LEASE_SETTINGS_SECTION)
@ -201,7 +201,7 @@ public interface VAppTemplateAsyncClient {
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection);
/**
* @see VAppTemplateClient#getNetworkConnectionSection(URI)
* @see VAppTemplateApi#getNetworkConnectionSection(URI)
*/
@GET
@Consumes(NETWORK_CONNECTION_SECTION)
@ -211,7 +211,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#getNetworkConfigSection(URI)
* @see VAppTemplateApi#getNetworkConfigSection(URI)
*/
@GET
@Consumes(NETWORK_CONFIG_SECTION)
@ -221,7 +221,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#modifyNetworkConfigSection(URI, NetworkConfigSection)
* @see VAppTemplateApi#modifyNetworkConfigSection(URI, NetworkConfigSection)
*/
@PUT
@Produces(NETWORK_CONFIG_SECTION)
@ -232,7 +232,7 @@ public interface VAppTemplateAsyncClient {
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
/**
* @see VAppTemplateClient#getNetworkConnectionSection(URI)
* @see VAppTemplateApi#getNetworkConnectionSection(URI)
*/
@GET
@Consumes(NETWORK_CONNECTION_SECTION)
@ -242,7 +242,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<NetworkConnectionSection> getVAppTemplateNetworkConnectionSection(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection)
* @see VAppTemplateApi#modifyNetworkConnectionSection(URI, NetworkConnectionSection)
*/
@PUT
@Produces(NETWORK_CONNECTION_SECTION)
@ -253,7 +253,7 @@ public interface VAppTemplateAsyncClient {
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
/**
* @see VAppTemplateClient#getNetworkSection(URI)
* @see VAppTemplateApi#getNetworkSection(URI)
*/
@GET
@Consumes(NETWORK_SECTION)
@ -263,7 +263,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#getOvf(URI)
* @see VAppTemplateApi#getOvf(URI)
*/
@GET
@Consumes
@ -273,7 +273,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<Envelope> getOvf(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#getOwnerOfVAppTemplate(URI)
* @see VAppTemplateApi#getOwnerOfVAppTemplate(URI)
*/
@GET
@Consumes(OWNER)
@ -283,7 +283,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<Owner> getOwner(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#getProductSectionsForVAppTemplate(URI)
* @see VAppTemplateApi#getProductSectionsForVAppTemplate(URI)
*/
@GET
@Consumes(PRODUCT_SECTION_LIST)
@ -293,7 +293,7 @@ public interface VAppTemplateAsyncClient {
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI templateURI);
/**
* @see VAppTemplateClient#modifyProductSections(URI, ProductSectionList)
* @see VAppTemplateApi#modifyProductSections(URI, ProductSectionList)
*/
@PUT
@Produces(PRODUCT_SECTION_LIST)
@ -304,7 +304,7 @@ public interface VAppTemplateAsyncClient {
@BinderParam(BindToXMLPayload.class) ProductSectionList sections);
/**
* @see VAppTemplateClient#getShadowVms(URI)
* @see VAppTemplateApi#getShadowVms(URI)
*/
@GET
@Consumes
@ -317,5 +317,5 @@ public interface VAppTemplateAsyncClient {
* @return asynchronous access to {@link Metadata} features
*/
@Delegate
MetadataAsyncClient.Writeable getMetadataClient();
MetadataAsyncApi.Writeable getMetadataApi();
}

View File

@ -39,12 +39,12 @@ import org.jclouds.vcloud.director.v1_5.domain.params.UploadVAppTemplateParams;
/**
* Provides synchronous access to a vDC.
*
* @see VdcAsyncClient
* @see VdcAsyncApi
* @see <a href= "http://support.theenterprisecloud.com/kb/default.asp?id=984&Lang=1&SID=" />
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface VdcClient {
public interface VdcApi {
/**
* Retrieves a vdc.
@ -105,7 +105,7 @@ public interface VdcClient {
*
* The vCloud API supports composing a vApp from any combination of vApp templates, vApps,
* or virtual machines. When you compose a vApp, all children of each composition source
* become peers in the Children collection of the composed vApp. To compose a vApp, a client
* become peers in the Children collection of the composed vApp. To compose a vApp, a api
* makes a compose vApp request whose body is a ComposeVAppParams element, includes the
* following information:
* <ul>
@ -179,6 +179,6 @@ public interface VdcClient {
* @return synchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataClient.Readable getMetadataClient();
MetadataApi.Readable getMetadataApi();
}

View File

@ -51,14 +51,14 @@ import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see VdcClient
* @see VdcApi
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface VdcAsyncClient {
public interface VdcAsyncApi {
/**
* @see VdcClient#getVdc(URI)
* @see VdcApi#getVdc(URI)
*/
@GET
@Consumes
@ -67,7 +67,7 @@ public interface VdcAsyncClient {
ListenableFuture<? extends Vdc> getVdc(@EndpointParam URI vdcURI);
/**
* @see VdcClient#captureVApp(URI, CaptureVAppParams)
* @see VdcApi#captureVApp(URI, CaptureVAppParams)
*/
@POST
@Path("/action/captureVApp")
@ -78,7 +78,7 @@ public interface VdcAsyncClient {
@BinderParam(BindToXMLPayload.class) CaptureVAppParams params);
/**
* @see VdcClient#cloneMedia(URI, CloneMediaParams)
* @see VdcApi#cloneMedia(URI, CloneMediaParams)
*/
@POST
@Path("/action/cloneMedia")
@ -89,7 +89,7 @@ public interface VdcAsyncClient {
@BinderParam(BindToXMLPayload.class) CloneMediaParams params);
/**
* @see VdcClient#cloneVApp(URI, CloneVAppParams)
* @see VdcApi#cloneVApp(URI, CloneVAppParams)
*/
@POST
@Path("/action/cloneVApp")
@ -100,7 +100,7 @@ public interface VdcAsyncClient {
@BinderParam(BindToXMLPayload.class) CloneVAppParams params);
/**
* @see VdcClient#cloneVAppTemplate(URI, CloneVAppTemplateParams)
* @see VdcApi#cloneVAppTemplate(URI, CloneVAppTemplateParams)
*/
@POST
@Path("/action/cloneVAppTemplate")
@ -111,7 +111,7 @@ public interface VdcAsyncClient {
@BinderParam(BindToXMLPayload.class) CloneVAppTemplateParams params);
/**
* @see VdcClient#composeVApp(URI, ComposeVAppParams)
* @see VdcApi#composeVApp(URI, ComposeVAppParams)
*/
@POST
@Path("/action/composeVApp")
@ -122,7 +122,7 @@ public interface VdcAsyncClient {
@BinderParam(BindToXMLPayload.class) ComposeVAppParams params);
/**
* @see VdcClient#instantiateVApp(URI, InstantiateVAppParamsType)
* @see VdcApi#instantiateVApp(URI, InstantiateVAppParamsType)
*/
@POST
@Path("/action/instantiateVAppTemplate")
@ -133,7 +133,7 @@ public interface VdcAsyncClient {
@BinderParam(BindToXMLPayload.class) InstantiateVAppParams params);
/**
* @see VdcClient#uploadVAppTemplate(URI, UploadVAppTemplateParams)
* @see VdcApi#uploadVAppTemplate(URI, UploadVAppTemplateParams)
*/
@POST
@Path("/action/uploadVAppTemplate")
@ -144,7 +144,7 @@ public interface VdcAsyncClient {
@BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params);
/**
* @see VdcClient#createMedia(URI, Media)
* @see VdcApi#createMedia(URI, Media)
*/
@POST
@Path("/media")
@ -158,6 +158,6 @@ public interface VdcAsyncClient {
* @return asynchronous access to {@link Metadata.Readable} features
*/
@Delegate
MetadataAsyncClient.Readable getMetadataClient();
MetadataAsyncApi.Readable getMetadataApi();
}

View File

@ -46,17 +46,17 @@ import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
* Provides synchronous access to {@link Vm} objects.
*
* @author grkvlt@apache.org
* @see VmAsyncClient
* @see VmAsyncApi
* @version 1.5
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface VmClient {
public interface VmApi {
/**
* Retrieves a {@link Vm}.
*
* @since 0.9
* @see VAppClient#getVApp(URI)
* @see VAppApi#getVApp(URI)
*/
Vm getVm(URI vmURI);
@ -64,7 +64,7 @@ public interface VmClient {
* Modifies the name/description of a {@link Vm}.
*
* @since 0.9
* @see VAppClient#modifyVApp(URI, VApp)
* @see VAppApi#modifyVApp(URI, VApp)
*/
Task modifyVm(URI vmURI, Vm vm);
@ -72,7 +72,7 @@ public interface VmClient {
* Deletes a {@link Vm}.
*
* @since 0.9
* @see VAppClient#deleteVApp(URI)
* @see VAppApi#deleteVApp(URI)
*/
Task deleteVm(URI vmURI);
@ -91,7 +91,7 @@ public interface VmClient {
* Deploys a {@link Vm}.
*
* @since 0.9
* @see VAppClient#deploy(URI, DeployVAppParams)
* @see VAppApi#deploy(URI, DeployVAppParams)
*/
Task deploy(URI vmURI, DeployVAppParams params);
@ -99,7 +99,7 @@ public interface VmClient {
* Discard suspended state of a {@link Vm}.
*
* @since 0.9
* @see VAppClient#discardSuspendedState(URI)
* @see VAppApi#discardSuspendedState(URI)
*/
Task discardSuspendedState(URI vmURI);
@ -131,7 +131,7 @@ public interface VmClient {
* Undeploy a {@link Vm}.
*
* @since 0.9
* @see VAppClient#undeploy(URI, UndeployVAppParams)
* @see VAppApi#undeploy(URI, UndeployVAppParams)
*/
Task undeploy(URI vmURI, UndeployVAppParams params);
@ -151,7 +151,7 @@ public interface VmClient {
* Powers off a {@link Vm}.
*
* @since 0.9
* @see VAppClient#powerOff(URI)
* @see VAppApi#powerOff(URI)
*/
Task powerOff(URI vmURI);
@ -159,7 +159,7 @@ public interface VmClient {
* Powers on a {@link Vm}.
*
* @since 0.9
* @see VAppClient#powerOn(URI)
* @see VAppApi#powerOn(URI)
*/
Task powerOn(URI vmURI);
@ -167,7 +167,7 @@ public interface VmClient {
* Reboots a {@link Vm}.
*
* @since 0.9
* @see VAppClient#reboot(URI)
* @see VAppApi#reboot(URI)
*/
Task reboot(URI vmURI);
@ -175,7 +175,7 @@ public interface VmClient {
* Resets a {@link Vm}.
*
* @since 0.9
* @see VAppClient#reset(URI)
* @see VAppApi#reset(URI)
*/
Task reset(URI vmURI);
@ -183,7 +183,7 @@ public interface VmClient {
* Shuts down a {@link Vm}.
*
* @since 0.9
* @see VAppClient#shutdown(URI)
* @see VAppApi#shutdown(URI)
*/
Task shutdown(URI vmURI);
@ -191,7 +191,7 @@ public interface VmClient {
* Suspends a {@link Vm}.
*
* @since 0.9
* @see VAppClient#suspend(URI)
* @see VAppApi#suspend(URI)
*/
Task suspend(URI vmURI);
@ -203,7 +203,7 @@ public interface VmClient {
* </pre>
*
* @since 1.0
* @see VAppClient#
* @see VAppApi#
*/
GuestCustomizationSection getGuestCustomizationSection(URI vmURI);
@ -288,7 +288,7 @@ public interface VmClient {
* Retrieves {@link Vm} product sections.
*
* @since 1.5
* @see VAppClient#getProductSections(URI)
* @see VAppApi#getProductSections(URI)
*/
ProductSectionList getProductSections(URI vmURI);
@ -296,7 +296,7 @@ public interface VmClient {
* Modifies the product section information of a {@link Vm}.
*
* @since 1.5
* @see VAppClient#modifyProductSections(URI, ProductSectionList)
* @see VAppApi#modifyProductSections(URI, ProductSectionList)
*/
Task modifyProductSections(URI vmURI, ProductSectionList sectionList);
@ -514,5 +514,5 @@ public interface VmClient {
* Synchronous access to {@link Vm} {@link Metadata} features.
*/
@Delegate
MetadataClient.Writeable getMetadataClient();
MetadataApi.Writeable getMetadataApi();
}

View File

@ -77,13 +77,13 @@ import com.google.common.util.concurrent.ListenableFuture;
/**
* @author grkvlt@apache.org
* @see VmClient
* @see VmApi
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface VmAsyncClient {
public interface VmAsyncApi {
/**
* @see VmClient#getVm(URI)
* @see VmApi#getVm(URI)
*/
@GET
@Consumes(VM)
@ -92,7 +92,7 @@ public interface VmAsyncClient {
ListenableFuture<Vm> getVm(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyVm(URI, Vm)
* @see VmApi#modifyVm(URI, Vm)
*/
@PUT
@Produces(VM)
@ -102,7 +102,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) Vm vApp);
/**
* @see VmClient#deleteVm(URI)
* @see VmApi#deleteVm(URI)
*/
@DELETE
@Consumes(TASK)
@ -110,7 +110,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> deleteVm(@EndpointParam URI vmURI);
/**
* @see VmClient#consolidateVm(URI)
* @see VmApi#consolidateVm(URI)
*/
@POST
@Path("/action/consolidate")
@ -119,7 +119,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> consolidateVm(@EndpointParam URI vmURI);
/**
* @see VmClient#deploy(URI, DeployVAppParams)
* @see VmApi#deploy(URI, DeployVAppParams)
*/
@POST
@Path("/action/deploy")
@ -130,7 +130,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) DeployVAppParams params);
/**
* @see VmClient#discardSuspendedState(URI)
* @see VmApi#discardSuspendedState(URI)
*/
@POST
@Path("/action/discardSuspendedState")
@ -139,7 +139,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vmURI);
/**
* @see VmClient#installVMwareTools(URI)
* @see VmApi#installVMwareTools(URI)
*/
@POST
@Path("/action/installVMwareTools")
@ -148,7 +148,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> installVMwareTools(@EndpointParam URI vmURI);
/**
* @see VmClient#relocateVm(URI, RelocateParams)
* @see VmApi#relocateVm(URI, RelocateParams)
*/
@POST
@Path("/action/relocate")
@ -159,7 +159,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) RelocateParams params);
/**
* @see VmClient#undeploy(URI, UndeployVAppParams)
* @see VmApi#undeploy(URI, UndeployVAppParams)
*/
@POST
@Path("/action/undeploy")
@ -170,7 +170,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) UndeployVAppParams params);
/**
* @see VmClient#upgradeHardwareVersion(URI)
* @see VmApi#upgradeHardwareVersion(URI)
*/
@POST
@Path("/action/upgradeHardwareVersion")
@ -179,7 +179,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam URI vmURI);
/**
* @see VmClient#powerOff(URI)
* @see VmApi#powerOff(URI)
*/
@POST
@Path("/power/action/powerOff")
@ -188,7 +188,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> powerOff(@EndpointParam URI vmURI);
/**
* @see VmClient#powerOn(URI)
* @see VmApi#powerOn(URI)
*/
@POST
@Path("/power/action/powerOn")
@ -197,7 +197,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> powerOn(@EndpointParam URI vmURI);
/**
* @see VmClient#reboot(URI)
* @see VmApi#reboot(URI)
*/
@POST
@Path("/power/action/powerOff")
@ -206,7 +206,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> reboot(@EndpointParam URI vmURI);
/**
* @see VmClient#reset(URI)
* @see VmApi#reset(URI)
*/
@POST
@Path("/power/action/reset")
@ -215,7 +215,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> reset(@EndpointParam URI vmURI);
/**
* @see VmClient#shutdown(URI)
* @see VmApi#shutdown(URI)
*/
@POST
@Path("/power/action/shutdown")
@ -224,7 +224,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> shutdown(@EndpointParam URI vmURI);
/**
* @see VmClient#suspend(URI)
* @see VmApi#suspend(URI)
*/
@POST
@Path("/power/action/suspend")
@ -233,7 +233,7 @@ public interface VmAsyncClient {
ListenableFuture<Task> suspend(@EndpointParam URI vmURI);
/**
* @see VmClient#getGuestCustomizationSection(URI)
* @see VmApi#getGuestCustomizationSection(URI)
*/
@GET
@Path("/guestCustomizationSection")
@ -243,7 +243,7 @@ public interface VmAsyncClient {
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyGuestCustomizationSection(URI, GuestCustomizationSection)
* @see VmApi#modifyGuestCustomizationSection(URI, GuestCustomizationSection)
*/
@PUT
@Path("/guestCustomizationSection")
@ -254,7 +254,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
/**
* @see VmClient#ejectMedia(URI, MediaInsertOrEjectParams)
* @see VmApi#ejectMedia(URI, MediaInsertOrEjectParams)
*/
@POST
@Path("/media/action/ejectMedia")
@ -265,7 +265,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
/**
* @see VmClient#insertMedia(URI, MediaInsertOrEjectParams)
* @see VmApi#insertMedia(URI, MediaInsertOrEjectParams)
*/
@POST
@Path("/media/action/insertMedia")
@ -276,7 +276,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
/**
* @see VmClient#getNetworkConnectionSection(URI)
* @see VmApi#getNetworkConnectionSection(URI)
*/
@GET
@Path("/networkConnectionSection")
@ -286,7 +286,7 @@ public interface VmAsyncClient {
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection)
* @see VmApi#modifyNetworkConnectionSection(URI, NetworkConnectionSection)
*/
@PUT
@Path("/networkConnectionSection")
@ -297,7 +297,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
/**
* @see VmClient#getOperatingSystemSection(URI)
* @see VmApi#getOperatingSystemSection(URI)
*/
@GET
@Path("/operatingSystemSection")
@ -307,7 +307,7 @@ public interface VmAsyncClient {
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyOperatingSystemSection(URI, OperatingSystemSection)
* @see VmApi#modifyOperatingSystemSection(URI, OperatingSystemSection)
*/
@PUT
@Path("/operatingSystemSection")
@ -318,7 +318,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
/**
* @see VmClient#getProductSections(URI)
* @see VmApi#getProductSections(URI)
*/
@GET
@Path("/productSections")
@ -328,7 +328,7 @@ public interface VmAsyncClient {
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyProductSections(URI, ProductSectionList)
* @see VmApi#modifyProductSections(URI, ProductSectionList)
*/
@PUT
@Path("/productSections")
@ -339,7 +339,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
/**
* @see VmClient#getPendingQuestion(URI)
* @see VmApi#getPendingQuestion(URI)
*/
@GET
@Path("/question")
@ -349,7 +349,7 @@ public interface VmAsyncClient {
ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam URI vmURI);
/**
* @see VmClient#answerQuestion(URI, VmQuestionAnswer)
* @see VmApi#answerQuestion(URI, VmQuestionAnswer)
*/
@POST
@Path("/question/action/answer")
@ -360,7 +360,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer);
/**
* @see VmClient#getRuntimeInfoSection(URI)
* @see VmApi#getRuntimeInfoSection(URI)
*/
@GET
@Path("/runtimeInfoSection")
@ -370,7 +370,7 @@ public interface VmAsyncClient {
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam URI vmURI);
/**
* @see VmClient#getScreenImage(URI)
* @see VmApi#getScreenImage(URI)
*/
@GET
@Path("/screen")
@ -380,7 +380,7 @@ public interface VmAsyncClient {
ListenableFuture<byte[]> getScreenImage(@EndpointParam URI vmURI);
/**
* @see VmClient#getScreenTicket(URI)
* @see VmApi#getScreenTicket(URI)
*/
@POST
@Path("/screen/action/acquireTicket")
@ -390,7 +390,7 @@ public interface VmAsyncClient {
ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam URI vmURI);
/**
* @see VmClient#getVirtualHardwareSection(URI)
* @see VmApi#getVirtualHardwareSection(URI)
*/
@GET
@Path("/virtualHardwareSection")
@ -400,7 +400,7 @@ public interface VmAsyncClient {
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyVirtualHardwareSection(URI, VirtualHardwareSection)
* @see VmApi#modifyVirtualHardwareSection(URI, VirtualHardwareSection)
*/
@PUT
@Path("/virtualHardwareSection")
@ -411,7 +411,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
/**
* @see VmClient#getVirtualHardwareSectionCpu(URI)
* @see VmApi#getVirtualHardwareSectionCpu(URI)
*/
@GET
@Path("/virtualHardwareSection/cpu")
@ -421,7 +421,7 @@ public interface VmAsyncClient {
ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData)
* @see VmApi#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData)
*/
@PUT
@Path("/virtualHardwareSection/cpu")
@ -432,7 +432,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
/**
* @see VmClient#getVirtualHardwareSectionDisks(URI)
* @see VmApi#getVirtualHardwareSectionDisks(URI)
*/
@GET
@Path("/virtualHardwareSection/disks")
@ -442,7 +442,7 @@ public interface VmAsyncClient {
ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyVirtualHardwareSectionDisks(URI, RasdItemsList)
* @see VmApi#modifyVirtualHardwareSectionDisks(URI, RasdItemsList)
*/
@PUT
@Path("/virtualHardwareSection/disks")
@ -453,7 +453,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/**
* @see VmClient#getVirtualHardwareSectionMedia(URI)
* @see VmApi#getVirtualHardwareSectionMedia(URI)
*/
@GET
@Path("/virtualHardwareSection/media")
@ -463,7 +463,7 @@ public interface VmAsyncClient {
ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia(@EndpointParam URI vmURI);
/**
* @see VmClient#getVirtualHardwareSectionMemory(URI)
* @see VmApi#getVirtualHardwareSectionMemory(URI)
*/
@GET
@Path("/virtualHardwareSection/memory")
@ -473,7 +473,7 @@ public interface VmAsyncClient {
ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData)
* @see VmApi#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData)
*/
@PUT
@Path("/virtualHardwareSection/memory")
@ -484,7 +484,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) RasdItem rasd);
/**
* @see VmClient#getVirtualHardwareSectionNetworkCards(URI)
* @see VmApi#getVirtualHardwareSectionNetworkCards(URI)
*/
@GET
@Path("/virtualHardwareSection/networkCards")
@ -494,7 +494,7 @@ public interface VmAsyncClient {
ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyVirtualHardwareSectionNetworkCards(URI, RasdItemsList)
* @see VmApi#modifyVirtualHardwareSectionNetworkCards(URI, RasdItemsList)
*/
@PUT
@Path("/virtualHardwareSection/networkCards")
@ -505,7 +505,7 @@ public interface VmAsyncClient {
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/**
* @see VmClient#getVirtualHardwareSectionSerialPorts(URI)
* @see VmApi#getVirtualHardwareSectionSerialPorts(URI)
*/
@GET
@Path("/virtualHardwareSection/serialPorts")
@ -515,7 +515,7 @@ public interface VmAsyncClient {
ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI);
/**
* @see VmClient#modifyVirtualHardwareSectionSerialPorts(URI, RasdItemsList)
* @see VmApi#modifyVirtualHardwareSectionSerialPorts(URI, RasdItemsList)
*/
@PUT
@Path("/virtualHardwareSection/serialPorts")
@ -529,5 +529,5 @@ public interface VmAsyncClient {
* Asynchronous access to {@Vm} {@link Metadata} features.
*/
@Delegate
MetadataAsyncClient.Writeable getMetadataClient();
MetadataAsyncApi.Writeable getMetadataApi();
}

View File

@ -26,17 +26,17 @@ import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams;
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataClient;
import org.jclouds.vcloud.director.v1_5.features.CatalogApi;
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
/**
* Provides synchronous access to {@link AdminCatalog} objects.
*
* @see AdminCatalogAsyncClient
* @see AdminCatalogAsyncApi
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface AdminCatalogClient extends CatalogClient {
public interface AdminCatalogApi extends CatalogApi {
/**
@ -118,5 +118,5 @@ public interface AdminCatalogClient extends CatalogClient {
*/
@Override
@Delegate
MetadataClient.Writeable getMetadataClient();
MetadataApi.Writeable getMetadataApi();
}

View File

@ -40,21 +40,21 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see AdminCatalogClient
* @see AdminCatalogApi
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
/**
* @see AdminClient#createCatalog(URI, AdminCatalog)
* @see AdminApi#createCatalog(URI, AdminCatalog)
*/
@POST
@Path("/catalogs")
@ -65,7 +65,7 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
@BinderParam(BindToXMLPayload.class) AdminCatalog catalog);
/**
* @see AdminClient#getCatalog(URI)
* @see AdminApi#getCatalog(URI)
*/
@Override
@GET
@ -75,7 +75,7 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
ListenableFuture<AdminCatalog> getCatalog(@EndpointParam URI catalogRef);
/**
* @see AdminClient#getCatalog(URI)
* @see AdminApi#getCatalog(URI)
*/
@PUT
@Consumes(VCloudDirectorMediaType.ADMIN_CATALOG)
@ -85,7 +85,7 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
@BinderParam(BindToXMLPayload.class) AdminCatalog catalog);
/**
* @see AdminClient#deleteCatalog(URI)
* @see AdminApi#deleteCatalog(URI)
*/
@DELETE
@Consumes
@ -93,7 +93,7 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
ListenableFuture<Void> deleteCatalog(@EndpointParam URI catalogRef);
/**
* @see AdminClient#getOwner(URI)
* @see AdminApi#getOwner(URI)
*/
@GET
@Path("/owner")
@ -103,7 +103,7 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
ListenableFuture<Owner> getOwner(@EndpointParam URI catalogRef);
/**
* @see AdminClient#setOwner(URI, Owner)
* @see AdminApi#setOwner(URI, Owner)
*/
@PUT
@Path("/owner")
@ -114,7 +114,7 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
@BinderParam(BindToXMLPayload.class) Owner newOwner);
/**
* @see AdminClient#AdminClient(URI, PublishCatalogParams)
* @see AdminApi#AdminApi(URI, PublishCatalogParams)
*/
@POST
@Path("/action/publish")
@ -129,6 +129,6 @@ public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
*/
@Override
@Delegate
MetadataAsyncClient.Writeable getMetadataClient();
MetadataAsyncApi.Writeable getMetadataApi();
}

View File

@ -26,17 +26,17 @@ import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.network.Network;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.features.MetadataClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
import org.jclouds.vcloud.director.v1_5.features.NetworkApi;
/**
* Provides synchronous access to admin {@link Network} objects.
*
* @see AdminNetworkAsyncClient
* @see AdminNetworkAsyncApi
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface AdminNetworkClient extends NetworkClient {
public interface AdminNetworkApi extends NetworkApi {
/**
* Gets admin representation of network. This operation could return admin
@ -86,10 +86,10 @@ public interface AdminNetworkClient extends NetworkClient {
Task resetNetwork(URI networkRef);
/**
* @return synchronous access to admin {@link MetadataClient.Writeable} features
* @return synchronous access to admin {@link MetadataApi.Writeable} features
*/
@Override
@Delegate
MetadataClient.Writeable getMetadataClient();
MetadataApi.Writeable getMetadataApi();
}

View File

@ -39,21 +39,21 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.network.ExternalNetwork;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see AdminNetworkClient
* @see AdminNetworkApi
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface AdminNetworkAsyncClient extends NetworkAsyncClient {
public interface AdminNetworkAsyncApi extends NetworkAsyncApi {
/**
* @see AdminNetworkClient#getNetwork(URI)
* @see AdminNetworkApi#getNetwork(URI)
*/
@Override
@GET
@ -63,7 +63,7 @@ public interface AdminNetworkAsyncClient extends NetworkAsyncClient {
ListenableFuture<ExternalNetwork> getNetwork(@EndpointParam URI networkRef);
/**
* @see AdminNetworkClient#updateNetwork(URI, OrgNetwork)
* @see AdminNetworkApi#updateNetwork(URI, OrgNetwork)
*/
@PUT
@Consumes(VCloudDirectorMediaType.TASK)
@ -73,7 +73,7 @@ public interface AdminNetworkAsyncClient extends NetworkAsyncClient {
@BinderParam(BindToXMLPayload.class) OrgNetwork network);
/**
* @see AdminNetworkClient#resetNetwork(URI)
* @see AdminNetworkApi#resetNetwork(URI)
*/
@POST
@Path("/action/reset")
@ -82,9 +82,9 @@ public interface AdminNetworkAsyncClient extends NetworkAsyncClient {
ListenableFuture<Task> resetNetwork(@EndpointParam URI networkRef);
/**
* @return asynchronous access to admin {@link MetadataAsyncClient.Writeable} features
* @return asynchronous access to admin {@link MetadataAsyncApi.Writeable} features
*/
@Override
@Delegate
MetadataAsyncClient.Writeable getMetadataClient();
MetadataAsyncApi.Writeable getMetadataApi();
}

View File

@ -31,17 +31,17 @@ import org.jclouds.vcloud.director.v1_5.domain.org.OrgLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgVAppTemplateLeaseSettings;
import org.jclouds.vcloud.director.v1_5.features.MetadataClient;
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
import org.jclouds.vcloud.director.v1_5.features.OrgApi;
/**
* Provides synchronous access to {@link Org} objects.
*
* @see GroupAsyncClient
* @see GroupAsyncApi
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface AdminOrgClient extends OrgClient {
public interface AdminOrgApi extends OrgApi {
/**
* Retrieves an admin view of an organization.
@ -220,10 +220,10 @@ public interface AdminOrgClient extends OrgClient {
OrgVAppTemplateLeaseSettings newSettings);
/**
* @return synchronous access to admin {@link MetadataClient.Writeable} features
* @return synchronous access to admin {@link MetadataApi.Writeable} features
*/
@Override
@Delegate
MetadataClient.Writeable getMetadataClient();
MetadataApi.Writeable getMetadataApi();
}

View File

@ -43,21 +43,21 @@ import org.jclouds.vcloud.director.v1_5.domain.org.OrgLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgVAppTemplateLeaseSettings;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see AdminOrgClient
* @see AdminOrgApi
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface AdminOrgAsyncClient extends OrgAsyncClient {
public interface AdminOrgAsyncApi extends OrgAsyncApi {
/**
* @see AdminOrgClient#getOrg(URI)
* @see AdminOrgApi#getOrg(URI)
*/
@Override
@GET
@ -67,7 +67,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
ListenableFuture<AdminOrg> getOrg(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#getSettings(URI)
* @see AdminOrgApi#getSettings(URI)
*/
@GET
@Path("/settings")
@ -77,7 +77,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
ListenableFuture<OrgSettings> getSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateSettings(URI, OrgSettings)
* @see AdminOrgApi#updateSettings(URI, OrgSettings)
*/
@PUT
@Path("/settings")
@ -88,7 +88,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@BinderParam(BindToXMLPayload.class) OrgSettings settings);
/**
* @see AdminOrgClient#getEmailSettings(URI)
* @see AdminOrgApi#getEmailSettings(URI)
*/
@GET
@Path("/settings/email")
@ -98,7 +98,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
ListenableFuture<OrgEmailSettings> getEmailSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateEmailSettings(URI, OrgEmailSettings)
* @see AdminOrgApi#updateEmailSettings(URI, OrgEmailSettings)
*/
@PUT
@Path("/settings/email")
@ -109,7 +109,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@BinderParam(BindToXMLPayload.class) OrgEmailSettings settings);
/**
* @see AdminOrgClient#getGeneralSettings(URI)
* @see AdminOrgApi#getGeneralSettings(URI)
*/
@GET
@Path("/settings/general")
@ -119,7 +119,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
ListenableFuture<OrgGeneralSettings> getGeneralSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateGeneralSettings(URI, OrgGeneralSettings)
* @see AdminOrgApi#updateGeneralSettings(URI, OrgGeneralSettings)
*/
@PUT
@Path("/settings/general")
@ -131,7 +131,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings);
/**
* @see AdminOrgClient#getPasswordPolicy(URI)
* @see AdminOrgApi#getPasswordPolicy(URI)
*/
@GET
@Path("/settings/ldap")
@ -141,7 +141,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
ListenableFuture<OrgLdapSettings> getLdapSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#getPasswordPolicy(URI)
* @see AdminOrgApi#getPasswordPolicy(URI)
*/
@GET
@Path("/settings/passwordPolicy")
@ -151,7 +151,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updatePasswordPolicy(URI, OrgPasswordPolicySettings)
* @see AdminOrgApi#updatePasswordPolicy(URI, OrgPasswordPolicySettings)
*/
@PUT
@Path("/settings/passwordPolicy")
@ -162,7 +162,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings);
/**
* @see AdminOrgClient#getVAppLeaseSettings(URI)
* @see AdminOrgApi#getVAppLeaseSettings(URI)
*/
@GET
@Path("/settings/vAppLeaseSettings")
@ -172,7 +172,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateVAppLeaseSettings(URI, OrgVAppLeaseSettings)
* @see AdminOrgApi#updateVAppLeaseSettings(URI, OrgVAppLeaseSettings)
*/
@PUT
@Path("/settings/vAppLeaseSettings")
@ -183,7 +183,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings);
/**
* @see AdminOrgClient#getVAppTemplateLeaseSettings(URI)
* @see AdminOrgApi#getVAppTemplateLeaseSettings(URI)
*/
@GET
@Path("/settings/vAppTemplateLeaseSettings")
@ -193,7 +193,7 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings(@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateVAppTemplateLeaseSettings(URI, OrgVAppTemplateLeaseSettings)
* @see AdminOrgApi#updateVAppTemplateLeaseSettings(URI, OrgVAppTemplateLeaseSettings)
*/
@PUT
@Path("/settings/vAppTemplateLeaseSettings")
@ -204,9 +204,9 @@ public interface AdminOrgAsyncClient extends OrgAsyncClient {
@BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings);
/**
* @return asynchronous access to admin {@link MetadataAsyncClient.Writeable} features
* @return asynchronous access to admin {@link MetadataAsyncApi.Writeable} features
*/
@Override
@Delegate
MetadataAsyncClient.Writeable getMetadataClient();
MetadataAsyncApi.Writeable getMetadataApi();
}

View File

@ -23,16 +23,16 @@ import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.director.v1_5.domain.RoleReferences;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
import org.jclouds.vcloud.director.v1_5.features.QueryApi;
/**
* Provides synchronous access to {@link AdminQuery} objects.
*
* @see AdminQueryAsyncClient
* @see AdminQueryAsyncApi
* @author Aled Sage
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface AdminQueryClient extends QueryClient {
public interface AdminQueryApi extends QueryApi {
/**
* Retrieves a list of {@link Group}s for organization the org admin belongs to by using REST API general QueryHandler

View File

@ -31,7 +31,7 @@ import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.RoleReferences;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
@ -39,12 +39,12 @@ import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to {@link AdminQuery} objects.
*
* @see AdminQueryClient
* @see AdminQueryApi
* @author Aled Sage
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface AdminQueryAsyncClient extends QueryAsyncClient {
public interface AdminQueryAsyncApi extends QueryAsyncApi {
@GET
@Path("/admin/groups/query")

View File

@ -26,17 +26,17 @@ import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.vcloud.director.v1_5.domain.AdminVdc;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.features.MetadataClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
import org.jclouds.vcloud.director.v1_5.features.VdcApi;
/**
* Provides synchronous access to {@link AdminVdc}.
*
* @see AdminVdcAsyncClient
* @see AdminVdcAsyncApi
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface AdminVdcClient extends VdcClient {
public interface AdminVdcApi extends VdcApi {
/**
* Retrieves an admin view of virtual data center. The redwood admin can disable an
@ -80,5 +80,5 @@ public interface AdminVdcClient extends VdcClient {
* @return synchronous access to {@link Writeable} features
*/
@Delegate
MetadataClient.Writeable getMetadataClient();
MetadataApi.Writeable getMetadataApi();
}

View File

@ -37,18 +37,18 @@ import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.AdminVdc;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncApi;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see AdminVdcClient
* @see AdminVdcApi
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface AdminVdcAsyncClient extends VdcAsyncClient {
public interface AdminVdcAsyncApi extends VdcAsyncApi {
@Override
@GET
@ -85,5 +85,5 @@ public interface AdminVdcAsyncClient extends VdcAsyncClient {
*/
@Override
@Delegate
MetadataAsyncClient.Writeable getMetadataClient();
MetadataAsyncApi.Writeable getMetadataApi();
}

View File

@ -27,11 +27,11 @@ import org.jclouds.vcloud.director.v1_5.domain.Group;
/**
* Provides synchronous access to {@link Group} objects.
*
* @see GroupAsyncClient
* @see GroupAsyncApi
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface GroupClient {
public interface GroupApi {
/**
* Imports a group in an organization.

View File

@ -42,11 +42,11 @@ import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see GroupClient
* @see GroupApi
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface GroupAsyncClient {
public interface GroupAsyncApi {
@POST
@Path("/groups")
@ -57,7 +57,7 @@ public interface GroupAsyncClient {
@BinderParam(BindToXMLPayload.class) Group group);
/**
* @see GroupClient#getGroup(URI)
* @see GroupApi#getGroup(URI)
*/
@GET
@Consumes
@ -66,7 +66,7 @@ public interface GroupAsyncClient {
ListenableFuture<Group> getGroup(@EndpointParam URI groupUri);
/**
* @see GroupClient#updateGroup(URI, Group)
* @see GroupApi#updateGroup(URI, Group)
*/
@PUT
@Consumes(VCloudDirectorMediaType.GROUP)
@ -76,7 +76,7 @@ public interface GroupAsyncClient {
@BinderParam(BindToXMLPayload.class) Group group);
/**
* @see GroupClient#deleteGroup(URI)
* @see GroupApi#deleteGroup(URI)
*/
@DELETE
@Consumes

View File

@ -27,11 +27,11 @@ import org.jclouds.vcloud.director.v1_5.domain.User;
/**
* Provides synchronous access to {@link Group} objects.
*
* @see GroupAsyncClient
* @see GroupAsyncApi
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface UserClient {
public interface UserApi {
/**
* Creates or imports a user in an organization. The user could be enabled or disabled.

View File

@ -42,14 +42,14 @@ import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see UserClient
* @see UserApi
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface UserAsyncClient {
public interface UserAsyncApi {
/**
* @see UserClient#createUser(URI, User)
* @see UserApi#createUser(URI, User)
*/
@POST
@Path("/users")
@ -60,7 +60,7 @@ public interface UserAsyncClient {
@BinderParam(BindToXMLPayload.class) User user);
/**
* @see UserClient#getUser(URI)
* @see UserApi#getUser(URI)
*/
@GET
@Consumes
@ -69,7 +69,7 @@ public interface UserAsyncClient {
ListenableFuture<User> getUser(@EndpointParam URI userRef);
/**
* @see UserClient#updateUser(URI, User)
* @see UserApi#updateUser(URI, User)
*/
@PUT
@Consumes(VCloudDirectorMediaType.USER)
@ -79,7 +79,7 @@ public interface UserAsyncClient {
@BinderParam(BindToXMLPayload.class) User user);
/**
* @see UserClient#deleteUser(URI)
* @see UserApi#deleteUser(URI)
*/
@DELETE
@Consumes
@ -87,7 +87,7 @@ public interface UserAsyncClient {
ListenableFuture<Void> deleteUser(@EndpointParam URI userRef);
/**
* @see UserClient#unlockUser(URI)
* @see UserApi#unlockUser(URI)
*/
@POST
@Path("/action/unlock")

View File

@ -35,7 +35,7 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
@ -48,12 +48,12 @@ public class AllCatalogItemsInCatalog implements Function<Catalog, Iterable<? ex
@Resource
public Logger logger = Logger.NULL;
private final VCloudDirectorAsyncClient aclient;
private final VCloudDirectorAsyncApi aapi;
private final ExecutorService executor;
@Inject
AllCatalogItemsInCatalog(VCloudDirectorAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.aclient = aclient;
AllCatalogItemsInCatalog(VCloudDirectorAsyncApi aapi, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.aapi = aapi;
this.executor = executor;
}
@ -71,7 +71,7 @@ public class AllCatalogItemsInCatalog implements Function<Catalog, Iterable<? ex
@Override
public Future<CatalogItem> apply(Reference from) {
return aclient.getCatalogClient().getCatalogItem(from.getHref());
return aapi.getCatalogApi().getCatalogItem(from.getHref());
}
}, executor, null, logger, "catalogItems in " + from.getHref());

View File

@ -32,7 +32,7 @@ import org.jclouds.logging.Logger;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.org.AdminOrg;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
import com.google.common.base.Function;
@ -44,12 +44,12 @@ public class AllCatalogsInOrg implements Function<AdminOrg, Iterable<? extends C
@Resource
public Logger logger = Logger.NULL;
private final VCloudDirectorAsyncClient aclient;
private final VCloudDirectorAsyncApi aapi;
private final ExecutorService executor;
@Inject
AllCatalogsInOrg(VCloudDirectorAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.aclient = aclient;
AllCatalogsInOrg(VCloudDirectorAsyncApi aapi, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.aapi = aapi;
this.executor = executor;
}
@ -59,7 +59,7 @@ public class AllCatalogsInOrg implements Function<AdminOrg, Iterable<? extends C
new Function<Reference, Future<? extends Catalog>>() {
@Override
public Future<? extends Catalog> apply(Reference from) {
return aclient.getCatalogClient().getCatalog(from.getHref());
return aapi.getCatalogApi().getCatalog(from.getHref());
}
}, executor, null, logger, "catalogs in " + org.getName());

View File

@ -33,7 +33,7 @@ import org.jclouds.logging.Logger;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.org.AdminOrg;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
import com.google.common.base.Function;
@ -45,12 +45,12 @@ public class AllVdcsInOrg implements Function<AdminOrg, Iterable<? extends Vdc>>
@Resource
public Logger logger = Logger.NULL;
private final VCloudDirectorAsyncClient aclient;
private final VCloudDirectorAsyncApi aapi;
private final ExecutorService executor;
@Inject
AllVdcsInOrg(VCloudDirectorAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.aclient = aclient;
AllVdcsInOrg(VCloudDirectorAsyncApi aapi, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.aapi = aapi;
this.executor = executor;
}
@ -61,7 +61,7 @@ public class AllVdcsInOrg implements Function<AdminOrg, Iterable<? extends Vdc>>
new Function<Reference, Future<? extends Vdc>>() {
@Override
public Future<? extends Vdc> apply(Reference from) {
return aclient.getVdcClient().getVdc(from.getHref());
return aapi.getVdcApi().getVdc(from.getHref());
}
}, executor, null, logger, "vdcs in org " + org.getName());

View File

@ -26,19 +26,19 @@ import javax.inject.Singleton;
import org.jclouds.domain.Credentials;
import org.jclouds.vcloud.director.v1_5.annotations.Login;
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
import org.jclouds.vcloud.director.v1_5.login.SessionClient;
import org.jclouds.vcloud.director.v1_5.login.SessionApi;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
@Singleton
public class LoginUserInOrgWithPassword implements Function<Credentials, SessionWithToken> {
private final SessionClient client;
private final SessionApi api;
private final Supplier<URI> loginUrl;
@Inject
public LoginUserInOrgWithPassword(SessionClient client, @Login Supplier<URI> loginUrl) {
this.client = client;
public LoginUserInOrgWithPassword(SessionApi api, @Login Supplier<URI> loginUrl) {
this.api = api;
this.loginUrl = loginUrl;
}
@ -48,7 +48,7 @@ public class LoginUserInOrgWithPassword implements Function<Credentials, Session
String org = input.identity.substring(input.identity.lastIndexOf('@') + 1);
String password = input.credential;
return client.loginUserInOrgWithPassword(loginUrl.get(), user, org, password);
return api.loginUserInOrgWithPassword(loginUrl.get(), user, org, password);
}
@Override

View File

@ -27,7 +27,7 @@ import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
import org.jclouds.vcloud.director.v1_5.features.OrgApi;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
@ -37,11 +37,11 @@ import com.google.common.base.Preconditions;
*/
@Singleton
public class OrgReferenceToTaskListEndpoint implements Function<Object, URI> {
private final OrgClient client;
private final OrgApi api;
@Inject
public OrgReferenceToTaskListEndpoint(OrgClient client) {
this.client = client;
public OrgReferenceToTaskListEndpoint(OrgApi api) {
this.api = api;
}
@Override
@ -49,7 +49,7 @@ public class OrgReferenceToTaskListEndpoint implements Function<Object, URI> {
Preconditions.checkNotNull(input);
Preconditions.checkArgument(input instanceof URI);
URI reference = (URI) input;
Org org = client.getOrg(reference);
Org org = api.getOrg(reference);
if (org == null) {
throw new ResourceNotFoundException();
}

View File

@ -36,7 +36,7 @@ import org.jclouds.domain.Location;
import org.jclouds.domain.LocationScope;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
@ -49,12 +49,12 @@ import com.google.common.collect.Sets;
public class OrgsForLocations implements Function<Iterable<Location>, Iterable<? extends Org>> {
@Resource
public Logger logger = Logger.NULL;
private final VCloudDirectorAsyncClient aclient;
private final VCloudDirectorAsyncApi aapi;
private final ExecutorService executor;
@Inject
OrgsForLocations(VCloudDirectorAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.aclient = aclient;
OrgsForLocations(VCloudDirectorAsyncApi aapi, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.aapi = aapi;
this.executor = executor;
}
@ -83,7 +83,7 @@ public class OrgsForLocations implements Function<Iterable<Location>, Iterable<?
@Override
public Future<? extends Org> apply(URI from) {
return aclient.getOrgClient().getOrg(from);
return aapi.getOrgApi().getOrg(from);
}
}, executor, null, logger, "organizations for uris");

View File

@ -34,8 +34,8 @@ import org.jclouds.Constants;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
@ -47,28 +47,28 @@ import com.google.common.collect.Iterables;
public class OrgsForNames implements Function<Iterable<String>, Iterable<? extends Org>> {
@Resource
public Logger logger = Logger.NULL;
private final VCloudDirectorAsyncClient aclient;
private final VCloudDirectorClient sclient;
private final VCloudDirectorAsyncApi aapi;
private final VCloudDirectorApi sapi;
private final ExecutorService executor;
@Inject
OrgsForNames(VCloudDirectorAsyncClient aclient,
VCloudDirectorClient sclient,
OrgsForNames(VCloudDirectorAsyncApi aapi,
VCloudDirectorApi sapi,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.aclient = aclient;
this.sclient = sclient;
this.aapi = aapi;
this.sapi = sapi;
this.executor = executor;
}
@Override
public Iterable<? extends Org> apply(Iterable<String> from) {
final Set<Reference> orgs = sclient.getOrgClient().getOrgList().getOrgs();
final Set<Reference> orgs = sapi.getOrgApi().getOrgList().getOrgs();
return transformParallel(from, new Function<String, Future<? extends Org>>() {
@Override
public Future<? extends Org> apply(String from) {
return aclient.getOrgClient().getOrg(Iterables.find(orgs, nameEquals(from)).getHref());
return aapi.getOrgApi().getOrg(Iterables.find(orgs, nameEquals(from)).getHref());
}
}, executor, null, logger, "organizations for names");

View File

@ -38,7 +38,7 @@ import org.jclouds.rest.AuthorizationException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
@ -52,7 +52,7 @@ public class VAppTemplatesForCatalogItems implements Function<Iterable<CatalogIt
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
public Logger logger = Logger.NULL;
private final VCloudDirectorAsyncClient aclient;
private final VCloudDirectorAsyncApi aapi;
private final ExecutorService executor;
private final ReturnNullOnAuthorizationException returnNullOnAuthorizationException;
@ -68,10 +68,10 @@ public class VAppTemplatesForCatalogItems implements Function<Iterable<CatalogIt
}
@Inject
VAppTemplatesForCatalogItems(VCloudDirectorAsyncClient aclient,
VAppTemplatesForCatalogItems(VCloudDirectorAsyncApi aapi,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor,
ReturnNullOnAuthorizationException returnNullOnAuthorizationException) {
this.aclient = aclient;
this.aapi = aapi;
this.executor = executor;
this.returnNullOnAuthorizationException = returnNullOnAuthorizationException;
}
@ -89,8 +89,8 @@ public class VAppTemplatesForCatalogItems implements Function<Iterable<CatalogIt
@Override
public Future<? extends VAppTemplate> apply(CatalogItem from) {
return new ExceptionParsingListenableFuture<VAppTemplate>(Futures.makeListenable(VCloudDirectorAsyncClient.class
.cast(aclient).getVAppTemplateClient().getVAppTemplate(from.getEntity().getHref()), executor),
return new ExceptionParsingListenableFuture<VAppTemplate>(Futures.makeListenable(VCloudDirectorAsyncApi.class
.cast(aapi).getVAppTemplateApi().getVAppTemplate(from.getEntity().getHref()), executor),
returnNullOnAuthorizationException);
}

View File

@ -30,7 +30,7 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
import org.jclouds.vcloud.director.v1_5.login.SessionClient;
import org.jclouds.vcloud.director.v1_5.login.SessionApi;
import com.google.common.cache.LoadingCache;
import com.google.inject.Inject;
@ -39,7 +39,7 @@ import com.google.inject.Singleton;
/**
* If the credentials supplied in the authentication header are invalid, or if the token has
* expired, the server returns HTTP response code 401. The token expires after a configurable
* interval of client inactivity. The default is 30 minutes after the token is created. After the
* interval of api inactivity. The default is 30 minutes after the token is created. After the
* token expires, you must log in again to obtain a new token.
*
* @author Adrian Cole
@ -51,13 +51,13 @@ public class InvalidateSessionAndRetryOn401AndLogoutOnClose extends BackoffLimit
protected Logger logger = Logger.NULL;
private final LoadingCache<Credentials, SessionWithToken> authenticationResponseCache;
private final SessionClient sessionClient;
private final SessionApi sessionApi;
@Inject
protected InvalidateSessionAndRetryOn401AndLogoutOnClose(
LoadingCache<Credentials, SessionWithToken> authenticationResponseCache, SessionClient sessionClient) {
LoadingCache<Credentials, SessionWithToken> authenticationResponseCache, SessionApi sessionApi) {
this.authenticationResponseCache = authenticationResponseCache;
this.sessionClient = sessionClient;
this.sessionApi = sessionApi;
}
@Override
@ -83,7 +83,7 @@ public class InvalidateSessionAndRetryOn401AndLogoutOnClose extends BackoffLimit
public void logoutOnClose() {
for (SessionWithToken s : authenticationResponseCache.asMap().values()) {
try {
sessionClient.logoutSessionWithToken(s.getSession().getHref(), s.getToken());
sessionApi.logoutSessionWithToken(s.getSession().getHref(), s.getToken());
} catch (Exception e) {
logger.error(e, "error logging out session %s", s.getSession());
}

View File

@ -28,10 +28,10 @@ import org.jclouds.rest.Utils;
import org.jclouds.rest.annotations.Identity;
import org.jclouds.rest.internal.RestContextImpl;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorContext;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncApi;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncApi;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import com.google.inject.Injector;
import com.google.inject.TypeLiteral;
@ -40,20 +40,20 @@ import com.google.inject.TypeLiteral;
* @author danikov
*/
@Singleton
public class VCloudDirectorContextImpl extends RestContextImpl<VCloudDirectorClient, VCloudDirectorAsyncClient> implements
public class VCloudDirectorContextImpl extends RestContextImpl<VCloudDirectorApi, VCloudDirectorAsyncApi> implements
VCloudDirectorContext {
private final RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient> adminContext;
private final RestContext<VCloudDirectorAdminApi, VCloudDirectorAdminAsyncApi> adminContext;
@Inject
VCloudDirectorContextImpl(ProviderMetadata providerMetadata, @Identity String identity, Utils utils, Closer closer,
Injector injector, RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient> adminContext) {
super(providerMetadata, identity, utils, closer, injector, TypeLiteral.get(VCloudDirectorClient.class),
TypeLiteral.get(VCloudDirectorAsyncClient.class));
Injector injector, RestContext<VCloudDirectorAdminApi, VCloudDirectorAdminAsyncApi> adminContext) {
super(providerMetadata, identity, utils, closer, injector, TypeLiteral.get(VCloudDirectorApi.class),
TypeLiteral.get(VCloudDirectorAsyncApi.class));
this.adminContext = adminContext;
}
@Override
public RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient> getAdminContext() {
public RestContext<VCloudDirectorAdminApi, VCloudDirectorAdminAsyncApi> getAdminContext() {
return adminContext;
}
}

View File

@ -29,11 +29,11 @@ import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
* Provides synchronous access to Session.
* <p/>
*
* @see SessionAsyncClient
* @see SessionAsyncApi
* @author Adrian Cole
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface SessionClient {
public interface SessionApi {
/**
* TODO

View File

@ -42,13 +42,13 @@ import com.google.common.util.concurrent.ListenableFuture;
* Provides asynchronous access to Session via their REST API.
* <p/>
*
* @see SessionClient
* @see SessionApi
* @author Adrian Cole
*/
public interface SessionAsyncClient {
public interface SessionAsyncApi {
/**
* @see SessionClient#loginUserInOrgWithPassword
* @see SessionApi#loginUserInOrgWithPassword
*/
@POST
@Consumes
@ -59,7 +59,7 @@ public interface SessionAsyncClient {
@PayloadParam("password") String password);
/**
* @see SessionClient#getSessionWithToken
* @see SessionApi#getSessionWithToken
*/
@GET
@Consumes
@ -68,7 +68,7 @@ public interface SessionAsyncClient {
@HeaderParam("x-vcloud-authorization") String authenticationToken);
/**
* @see SessionClient#logoutSessionWithToken
* @see SessionApi#logoutSessionWithToken
*/
@DELETE
@Consumes

View File

@ -30,7 +30,7 @@ import org.jclouds.logging.Logger;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.Task.Status;
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
import org.jclouds.vcloud.director.v1_5.features.TaskApi;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
@ -42,7 +42,7 @@ import com.google.common.collect.Iterables;
*/
public class TaskStatusEquals implements Predicate<Task> {
private final TaskClient taskClient;
private final TaskApi taskApi;
@Resource
protected Logger logger = Logger.NULL;
@ -50,12 +50,12 @@ public class TaskStatusEquals implements Predicate<Task> {
private Collection<Status> expectedStatuses;
private Collection<Status> failingStatuses;
public TaskStatusEquals(TaskClient taskClient, Status expectedStatus, Set<Status> failingStatuses) {
this(taskClient, Collections.singleton(expectedStatus), failingStatuses);
public TaskStatusEquals(TaskApi taskApi, Status expectedStatus, Set<Status> failingStatuses) {
this(taskApi, Collections.singleton(expectedStatus), failingStatuses);
}
public TaskStatusEquals(TaskClient taskClient, Set<Status> expectedStatuses, Set<Status> failingStatuses) {
this.taskClient = taskClient;
public TaskStatusEquals(TaskApi taskApi, Set<Status> expectedStatuses, Set<Status> failingStatuses) {
this.taskApi = taskApi;
this.expectedStatuses = expectedStatuses;
this.failingStatuses = failingStatuses;
}
@ -67,7 +67,7 @@ public class TaskStatusEquals implements Predicate<Task> {
logger.trace("looking for status on task %s", task);
// TODO shouldn't we see if it's already done before getting it from API server?
task = taskClient.getTask(task.getHref());
task = taskApi.getTask(task.getHref());
// perhaps task isn't available, yet
if (task == null) return false;

View File

@ -29,7 +29,7 @@ import javax.inject.Singleton;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
import org.jclouds.vcloud.director.v1_5.features.TaskApi;
import com.google.common.base.Predicate;
@ -41,14 +41,14 @@ import com.google.common.base.Predicate;
@Singleton
public class TaskSuccess implements Predicate<Task> {
private final TaskClient taskClient;
private final TaskApi taskApi;
@Resource
protected Logger logger = Logger.NULL;
@Inject
public TaskSuccess(TaskClient taskClient) {
this.taskClient = taskClient;
public TaskSuccess(TaskApi taskApi) {
this.taskApi = taskApi;
}
/** @see Predicate#apply(Object) */
@ -58,7 +58,7 @@ public class TaskSuccess implements Predicate<Task> {
logger.trace("looking for status on task %s", task.getOperationName());
// TODO shouldn't we see if it's already done before getting it from API server?
task = taskClient.getTask(task.getHref());
task = taskApi.getTask(task.getHref());
// perhaps task isn't available, yet
if (task == null) return false;

View File

@ -23,28 +23,28 @@ import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
import org.jclouds.vcloud.director.v1_5.features.MediaClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
import org.jclouds.vcloud.director.v1_5.features.UploadClient;
import org.jclouds.vcloud.director.v1_5.features.VAppClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
import org.jclouds.vcloud.director.v1_5.features.VmClient;
import org.jclouds.vcloud.director.v1_5.features.CatalogApi;
import org.jclouds.vcloud.director.v1_5.features.MediaApi;
import org.jclouds.vcloud.director.v1_5.features.NetworkApi;
import org.jclouds.vcloud.director.v1_5.features.OrgApi;
import org.jclouds.vcloud.director.v1_5.features.QueryApi;
import org.jclouds.vcloud.director.v1_5.features.TaskApi;
import org.jclouds.vcloud.director.v1_5.features.UploadApi;
import org.jclouds.vcloud.director.v1_5.features.VAppApi;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateApi;
import org.jclouds.vcloud.director.v1_5.features.VdcApi;
import org.jclouds.vcloud.director.v1_5.features.VmApi;
import com.google.inject.Provides;
/**
* Provides synchronous access to VCloudDirector.
*
* @see VCloudDirectorAdminAsyncClient
* @see VCloudDirectorAdminAsyncApi
* @author danikov
*/
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
public interface VCloudDirectorClient {
public interface VCloudDirectorApi {
/**
* @return the current login session
*/
@ -55,65 +55,65 @@ public interface VCloudDirectorClient {
* @return asynchronous access to query features
*/
@Delegate
QueryClient getQueryClient();
QueryApi getQueryApi();
/**
* @return synchronous access to {@link Org} features
*/
@Delegate
OrgClient getOrgClient();
OrgApi getOrgApi();
/**
* @return synchronous access to {@link Task} features
*/
@Delegate
TaskClient getTaskClient();
TaskApi getTaskApi();
/**
* @return synchronous access to {@link Network} features
*/
@Delegate
NetworkClient getNetworkClient();
NetworkApi getNetworkApi();
/**
* @return synchronous access to {@link Catalog} features
*/
@Delegate
CatalogClient getCatalogClient();
CatalogApi getCatalogApi();
/**
* @return synchronous access to {@link Media} features
*/
@Delegate
MediaClient getMediaClient();
MediaApi getMediaApi();
/**
* @return synchronous access to {@link Vdc} features
*/
@Delegate
VdcClient getVdcClient();
VdcApi getVdcApi();
/**
* @return synchronous access to upload features
*/
@Delegate
UploadClient getUploadClient();
UploadApi getUploadApi();
/**
* @return synchronous access to {@link VApp} features
*/
@Delegate
VAppClient getVAppClient();
VAppApi getVAppApi();
/**
* @return synchronous access to {@link VAppTemplate} features
*/
@Delegate
VAppTemplateClient getVAppTemplateClient();
VAppTemplateApi getVAppTemplateApi();
/**
* @return synchronous access to {@link Vm} features
*/
@Delegate
VmClient getVmClient();
VmApi getVmApi();
}

View File

@ -20,26 +20,26 @@ package org.jclouds.vcloud.director.v1_5.user;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.UploadAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VmAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.UploadAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VAppAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncApi;
import org.jclouds.vcloud.director.v1_5.features.VmAsyncApi;
import com.google.inject.Provides;
/**
* Provides asynchronous access to VCloudDirector via their REST API.
*
* @see VCloudDirectorClient
* @see VCloudDirectorApi
* @author Adrian Cole
*/
public interface VCloudDirectorAsyncClient {
public interface VCloudDirectorAsyncApi {
/**
*
* @return the current login session
@ -51,65 +51,65 @@ public interface VCloudDirectorAsyncClient {
* @return asynchronous access to query features
*/
@Delegate
QueryAsyncClient getQueryClient();
QueryAsyncApi getQueryApi();
/**
* @return asynchronous access to {@link Org} features
*/
@Delegate
OrgAsyncClient getOrgClient();
OrgAsyncApi getOrgApi();
/**
* @return asynchronous access to {@link Task} features
*/
@Delegate
TaskAsyncClient getTaskClient();
TaskAsyncApi getTaskApi();
/**
* @return asynchronous access to {@link Network} features
*/
@Delegate
NetworkAsyncClient getNetworkClient();
NetworkAsyncApi getNetworkApi();
/**
* @return asynchronous access to {@link Catalog} features
*/
@Delegate
CatalogAsyncClient getCatalogClient();
CatalogAsyncApi getCatalogApi();
/**
* @return asynchronous access to {@link Media} features
*/
@Delegate
CatalogAsyncClient getMediaClient();
CatalogAsyncApi getMediaApi();
/**
* @return asynchronous access to {@link Vdc} features
*/
@Delegate
VdcAsyncClient getVdcClient();
VdcAsyncApi getVdcApi();
/**
* @return asynchronous access to Upload features
*/
@Delegate
UploadAsyncClient getUploadClient();
UploadAsyncApi getUploadApi();
/**
* @return asynchronous access to {@link VApp} features
*/
@Delegate
VAppAsyncClient getVAppClient();
VAppAsyncApi getVAppApi();
/**
* @return asynchronous access to {@link VAppTemplate} features
*/
@Delegate
VAppTemplateAsyncClient getVAppTemplateClient();
VAppTemplateAsyncApi getVAppTemplateApi();
/**
* @return asynchronous access to {@link Vm} features
*/
@Delegate
VmAsyncClient getVmClient();
VmAsyncApi getVmApi();
}

View File

@ -49,14 +49,14 @@ import org.jclouds.vcloud.director.v1_5.domain.Vm;
import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataClient;
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
import org.jclouds.vcloud.director.v1_5.features.VAppClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
import org.jclouds.vcloud.director.v1_5.features.VmClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.features.CatalogApi;
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
import org.jclouds.vcloud.director.v1_5.features.QueryApi;
import org.jclouds.vcloud.director.v1_5.features.VAppApi;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateApi;
import org.jclouds.vcloud.director.v1_5.features.VdcApi;
import org.jclouds.vcloud.director.v1_5.features.VmApi;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.jclouds.vcloud.director.v1_5.predicates.ReferencePredicates;
import org.jclouds.xml.internal.JAXBParser;
import org.testng.Assert;
@ -72,11 +72,11 @@ import com.google.common.base.Throwables;
import com.google.common.collect.Iterables;
/**
* Shared code to test the behaviour of {@link VAppClient} and {@link VAppTemplateClient}.
* Shared code to test the behaviour of {@link VAppApi} and {@link VAppTemplateApi}.
*
* @author grkvlt@apache.org
*/
public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public static final String VAPP = "VApp";
public static final String VAPP_TEMPLATE = "VAppTemplate";
@ -84,16 +84,16 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
public static final String VM = "Vm";
/*
* Convenience reference to API clients.
* Convenience reference to API apis.
*/
protected CatalogClient catalogClient;
protected QueryClient queryClient;
protected VAppClient vAppClient;
protected VAppTemplateClient vAppTemplateClient;
protected VdcClient vdcClient;
protected VmClient vmClient;
protected MetadataClient.Writeable metadataClient;
protected CatalogApi catalogApi;
protected QueryApi queryApi;
protected VAppApi vAppApi;
protected VAppTemplateApi vAppTemplateApi;
protected VdcApi vdcApi;
protected VmApi vmApi;
protected MetadataApi.Writeable metadataApi;
/*
* Objects shared between tests.
@ -107,21 +107,21 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
protected URI vAppURI;
/**
* Retrieves the required clients from the REST API context
* Retrieves the required apis from the REST API context
*
* @see BaseVCloudDirectorClientLiveTest#setupRequiredClients()
* @see BaseVCloudDirectorApiLiveTest#setupRequiredApis()
*/
@Override
@BeforeClass(alwaysRun = true, description = "Retrieves the required clients from the REST API context")
protected void setupRequiredClients() {
@BeforeClass(alwaysRun = true, description = "Retrieves the required apis from the REST API context")
protected void setupRequiredApis() {
assertNotNull(context.getApi());
catalogClient = context.getApi().getCatalogClient();
queryClient = context.getApi().getQueryClient();
vAppClient = context.getApi().getVAppClient();
vAppTemplateClient = context.getApi().getVAppTemplateClient();
vdcClient = context.getApi().getVdcClient();
vmClient = context.getApi().getVmClient();
catalogApi = context.getApi().getCatalogApi();
queryApi = context.getApi().getQueryApi();
vAppApi = context.getApi().getVAppApi();
vAppTemplateApi = context.getApi().getVAppTemplateApi();
vdcApi = context.getApi().getVdcApi();
vmApi = context.getApi().getVmApi();
setupEnvironment();
}
@ -132,11 +132,11 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
*/
protected void setupEnvironment() {
// Get the configured Vdc for the tests
vdc = vdcClient.getVdc(vdcURI);
vdc = vdcApi.getVdc(vdcURI);
assertNotNull(vdc, String.format(ENTITY_NON_NULL, VDC));
// Get the configured VAppTemplate for the tests
vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE));
// Instantiate a new VApp
@ -149,7 +149,7 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
assertTrue(retryTaskSuccessLong.apply(instantiateTask), String.format(TASK_COMPLETE_TIMELY, "instantiateTask"));
// Get the instantiated VApp
vApp = vAppClient.getVApp(vAppURI);
vApp = vAppApi.getVApp(vAppURI);
// Get the Vm
List<Vm> vms = vApp.getChildren().getVms();
@ -190,7 +190,7 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
@AfterClass(alwaysRun = true, description = "Cleans up the environment by deleting created VApps")
protected void cleanUpEnvironment() {
vdc = vdcClient.getVdc(vdcURI); // Refresh
vdc = vdcApi.getVdc(vdcURI); // Refresh
// Find references in the Vdc with the VApp type and in the list of instantiated VApp names
Iterable<Reference> vApps = Iterables.filter(vdc.getResourceEntities(),
@ -248,13 +248,13 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
* Power on a {@link VApp}.
*/
protected VApp powerOnVApp(final URI testVAppURI) {
VApp test = vAppClient.getVApp(testVAppURI);
VApp test = vAppApi.getVApp(testVAppURI);
Status status = test.getStatus();
if (status != Status.POWERED_ON) {
Task powerOn = vAppClient.powerOn(vm.getHref());
Task powerOn = vAppApi.powerOn(vm.getHref());
assertTaskSucceedsLong(powerOn);
}
test = vAppClient.getVApp(testVAppURI);
test = vAppApi.getVApp(testVAppURI);
assertStatus(VAPP, test, Status.POWERED_ON);
return test;
}
@ -263,13 +263,13 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
* Power on a {@link Vm}.
*/
protected Vm powerOnVm(final URI testVmURI) {
Vm test = vmClient.getVm(testVmURI);
Vm test = vmApi.getVm(testVmURI);
Status status = test.getStatus();
if (status != Status.POWERED_ON) {
Task powerOn = vmClient.powerOn(vm.getHref());
Task powerOn = vmApi.powerOn(vm.getHref());
assertTaskSucceedsLong(powerOn);
}
test = vmClient.getVm(testVmURI);
test = vmApi.getVm(testVmURI);
assertStatus(VM, test, Status.POWERED_ON);
return test;
}
@ -278,13 +278,13 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
* Power off a {@link VApp}.
*/
protected VApp powerOffVApp(final URI testVAppURI) {
VApp test = vAppClient.getVApp(testVAppURI);
VApp test = vAppApi.getVApp(testVAppURI);
Status status = test.getStatus();
if (status != Status.POWERED_OFF) {
Task powerOff = vAppClient.powerOff(vm.getHref());
Task powerOff = vAppApi.powerOff(vm.getHref());
assertTaskSucceedsLong(powerOff);
}
test = vAppClient.getVApp(testVAppURI);
test = vAppApi.getVApp(testVAppURI);
assertStatus(VAPP, test, Status.POWERED_OFF);
return test;
}
@ -293,13 +293,13 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
* Power off a {@link Vm}.
*/
protected Vm powerOffVm(final URI testVmURI) {
Vm test = vmClient.getVm(testVmURI);
Vm test = vmApi.getVm(testVmURI);
Status status = test.getStatus();
if (status != Status.POWERED_OFF) {
Task powerOff = vmClient.powerOff(vm.getHref());
Task powerOff = vmApi.powerOff(vm.getHref());
assertTaskSucceedsLong(powerOff);
}
test = vmClient.getVm(testVmURI);
test = vmApi.getVm(testVmURI);
assertStatus(VM, test, Status.POWERED_OFF);
return test;
}
@ -308,13 +308,13 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
* Suspend a {@link VApp}.
*/
protected VApp suspendVApp(final URI testVAppURI) {
VApp test = vAppClient.getVApp(testVAppURI);
VApp test = vAppApi.getVApp(testVAppURI);
Status status = test.getStatus();
if (status != Status.SUSPENDED) {
Task suspend = vAppClient.suspend(vm.getHref());
Task suspend = vAppApi.suspend(vm.getHref());
assertTaskSucceedsLong(suspend);
}
test = vAppClient.getVApp(testVAppURI);
test = vAppApi.getVApp(testVAppURI);
assertStatus(VAPP, test, Status.SUSPENDED);
return test;
}
@ -323,13 +323,13 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
* Suspend a {@link Vm}.
*/
protected Vm suspendVm(final URI testVmURI) {
Vm test = vmClient.getVm(testVmURI);
Vm test = vmApi.getVm(testVmURI);
Status status = test.getStatus();
if (status != Status.SUSPENDED) {
Task suspend = vmClient.suspend(vm.getHref());
Task suspend = vmApi.suspend(vm.getHref());
assertTaskSucceedsLong(suspend);
}
test = vmClient.getVm(testVmURI);
test = vmApi.getVm(testVmURI);
assertStatus(VM, test, Status.SUSPENDED);
return test;
}
@ -338,7 +338,7 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
* Check the {@link VApp}s current status.
*/
protected void assertVAppStatus(final URI testVAppURI, final Status status) {
VApp testVApp = vAppClient.getVApp(testVAppURI);
VApp testVApp = vAppApi.getVApp(testVAppURI);
assertStatus(VAPP, testVApp, status);
}
@ -346,7 +346,7 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
* Check the {@link Vm}s current status.
*/
protected void assertVmStatus(final URI testVmURI, final Status status) {
Vm testVm = vmClient.getVm(testVmURI);
Vm testVm = vmApi.getVm(testVmURI);
assertStatus(VM, testVm, status);
}

View File

@ -32,7 +32,7 @@ import org.jclouds.rest.HttpClient;
import org.jclouds.util.Strings2;
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgList;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.jclouds.xml.internal.JAXBParser;
import org.testng.annotations.Test;
@ -44,13 +44,13 @@ import com.google.common.collect.Iterables;
* @author danikov
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "HttpClientLiveTest")
public class HttpClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public class HttpClientLiveTest extends BaseVCloudDirectorApiLiveTest {
private JAXBParser parser = new JAXBParser("true");
private SessionWithToken sessionWithToken;
@Override
protected void setupRequiredClients() {
protected void setupRequiredApis() {
}
@Test(description = "POST /login")
@ -87,7 +87,7 @@ public class HttpClientLiveTest extends BaseVCloudDirectorClientLiveTest {
assertTrue(orgList.getOrgs().size() > 0, "must have orgs");
context.getApi().getOrgClient().getOrg(Iterables.getLast(orgList.getOrgs()).getHref());
context.getApi().getOrgApi().getOrg(Iterables.getLast(orgList.getOrgs()).getHref());
}
@Test(description = "GET /schema/{schemaFileName}", dependsOnMethods = { "testPostLogin", "testGetLogin" })

View File

@ -20,21 +20,21 @@ package org.jclouds.vcloud.director.v1_5;
import static org.testng.Assert.assertEquals;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.login.SessionClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.jclouds.vcloud.director.v1_5.login.SessionApiExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "VCloudDirectorClient")
public class VCloudDirectorClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = "unit", testName = "VCloudDirectorApi")
public class VCloudDirectorApiExpectTest extends VCloudDirectorAdminApiExpectTest {
public void testRestClientModuleWorksProperly() throws Exception {
VCloudDirectorClient clientWhenSessionsExist = requestSendsResponse(loginRequest, sessionResponse);
VCloudDirectorApi apiWhenSessionsExist = requestSendsResponse(loginRequest, sessionResponse);
assertEquals(clientWhenSessionsExist.getCurrentSession(), SessionClientExpectTest.SESSION);
assertEquals(apiWhenSessionsExist.getCurrentSession(), SessionApiExpectTest.SESSION);
}
}

View File

@ -21,7 +21,7 @@ package org.jclouds.vcloud.director.v1_5;
import static org.testng.Assert.assertEquals;
import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -29,8 +29,8 @@ import org.testng.annotations.Test;
*
* @author Adrian Cole
*/
@Test(groups = "live", testName = "VCloudDirectorClientExperimentLiveTest")
public class VCloudDirectorClientExperimentLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = "live", testName = "VCloudDirectorApiExperimentLiveTest")
public class VCloudDirectorApiExperimentLiveTest extends BaseVCloudDirectorApiLiveTest {
public void testImplicitSession() {
Session session = context.getApi().getCurrentSession();
@ -40,10 +40,10 @@ public class VCloudDirectorClientExperimentLiveTest extends BaseVCloudDirectorCl
/**
* No operation.
*
* @see BaseVCloudDirectorClientLiveTest#setupRequiredClients()
* @see BaseVCloudDirectorApiLiveTest#setupRequiredApis()
*/
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() { }
public void setupRequiredApis() { }
}

View File

@ -566,13 +566,13 @@ public class Checks {
}
}
public static void checkMetadataFor(String client, Metadata metadata) {
public static void checkMetadataFor(String api, Metadata metadata) {
for (MetadataEntry entry : metadata.getMetadataEntries()) {
// Check required fields
assertNotNull(entry.getKey(),
String.format(OBJ_FIELD_ATTRB_REQ, client, "MetadataEntry", entry.getKey(), "key"));
String.format(OBJ_FIELD_ATTRB_REQ, api, "MetadataEntry", entry.getKey(), "key"));
assertNotNull(entry.getValue(),
String.format(OBJ_FIELD_ATTRB_REQ, client, "MetadataEntry", entry.getValue(), "value"));
String.format(OBJ_FIELD_ATTRB_REQ, api, "MetadataEntry", entry.getValue(), "value"));
// Check parent type
checkResourceType(entry);
@ -582,33 +582,33 @@ public class Checks {
checkResourceType(metadata);
}
public static void checkMetadataValueFor(String client, MetadataValue metadataValue) {
checkMetadataValueFor(client, metadataValue, "value");
public static void checkMetadataValueFor(String api, MetadataValue metadataValue) {
checkMetadataValueFor(api, metadataValue, "value");
}
public static void checkMetadataValueFor(String client, MetadataValue metadataValue, String expectedValue) {
public static void checkMetadataValueFor(String api, MetadataValue metadataValue, String expectedValue) {
// Check required fields
String value = metadataValue.getValue();
assertNotNull(value,
String.format(OBJ_FIELD_ATTRB_REQ, client, "MetadataEntry",
String.format(OBJ_FIELD_ATTRB_REQ, api, "MetadataEntry",
metadataValue.toString(), "value"));
assertEquals(value, expectedValue,
String.format(OBJ_FIELD_EQ, client, "metadataEntry.value", expectedValue, value));
String.format(OBJ_FIELD_EQ, api, "metadataEntry.value", expectedValue, value));
// Check parent type
checkResourceType(metadataValue);
}
public static void checkMetadataKeyAbsentFor(String client, Metadata metadata, String key) {
public static void checkMetadataKeyAbsentFor(String api, Metadata metadata, String key) {
Map<String,String> metadataMap = metadataToMap(metadata);
assertFalse(metadataMap.containsKey(key),
String.format(OBJ_DEL, client+" metadata key", key));
String.format(OBJ_DEL, api+" metadata key", key));
}
public static void checkMetadataFor(String client, Metadata metadata, Map<String, String> expectedMap) {
public static void checkMetadataFor(String api, Metadata metadata, Map<String, String> expectedMap) {
Map<String,String> actualMap = Checks.metadataToMap(metadata);
assertEquals(actualMap, expectedMap,
String.format(OBJ_FIELD_EQ, client, "metadata entries", expectedMap, actualMap));
String.format(OBJ_FIELD_EQ, api, "metadata entries", expectedMap, actualMap));
}
public static Map<String,String> metadataToMap(Metadata metadata) {
@ -802,13 +802,13 @@ public class Checks {
// TODO
}
public static void checkMediaFor(String client, Media media) {
public static void checkMediaFor(String api, Media media) {
// required
assertNotNull(media.getImageType(), String.format(OBJ_FIELD_REQ, client, "imageType"));
assertNotNull(media.getImageType(), String.format(OBJ_FIELD_REQ, api, "imageType"));
assertTrue(Media.ImageType.ALL.contains(media.getImageType()),
"The Image type of a Media must be one of the allowed list");
assertNotNull(media.getSize(), String.format(OBJ_FIELD_REQ, client, "size"));
assertTrue(media.getSize() >= 0, String.format(OBJ_FIELD_GTE_0, client, "size", media.getSize()));
assertNotNull(media.getSize(), String.format(OBJ_FIELD_REQ, api, "size"));
assertTrue(media.getSize() >= 0, String.format(OBJ_FIELD_GTE_0, api, "size", media.getSize()));
// parent type
checkResourceEntityType(media);
@ -940,29 +940,29 @@ public class Checks {
// NOTE groupSearchBase cannot be checked
}
public static void checkUserAttributes(String client, OrgLdapUserAttributes attributes) {
public static void checkUserAttributes(String api, OrgLdapUserAttributes attributes) {
// required
assertNotNull(attributes.getObjectClass(), String.format(OBJ_FIELD_REQ, client, "objectClass"));
assertNotNull(attributes.getObjectIdentifier(), String.format(OBJ_FIELD_REQ, client, "objectIdentifier"));
assertNotNull(attributes.getUserName(), String.format(OBJ_FIELD_REQ, client, "userName"));
assertNotNull(attributes.getEmail(), String.format(OBJ_FIELD_REQ, client, "email"));
assertNotNull(attributes.getFullName(), String.format(OBJ_FIELD_REQ, client, "fullName"));
assertNotNull(attributes.getGivenName(), String.format(OBJ_FIELD_REQ, client, "givenName"));
assertNotNull(attributes.getSurname(), String.format(OBJ_FIELD_REQ, client, "surname"));
assertNotNull(attributes.getTelephone(), String.format(OBJ_FIELD_REQ, client, "telephone"));
assertNotNull(attributes.getGroupMembershipIdentifier(), String.format(OBJ_FIELD_REQ, client, "groupMembershipIdentifier"));
assertNotNull(attributes.getObjectClass(), String.format(OBJ_FIELD_REQ, api, "objectClass"));
assertNotNull(attributes.getObjectIdentifier(), String.format(OBJ_FIELD_REQ, api, "objectIdentifier"));
assertNotNull(attributes.getUserName(), String.format(OBJ_FIELD_REQ, api, "userName"));
assertNotNull(attributes.getEmail(), String.format(OBJ_FIELD_REQ, api, "email"));
assertNotNull(attributes.getFullName(), String.format(OBJ_FIELD_REQ, api, "fullName"));
assertNotNull(attributes.getGivenName(), String.format(OBJ_FIELD_REQ, api, "givenName"));
assertNotNull(attributes.getSurname(), String.format(OBJ_FIELD_REQ, api, "surname"));
assertNotNull(attributes.getTelephone(), String.format(OBJ_FIELD_REQ, api, "telephone"));
assertNotNull(attributes.getGroupMembershipIdentifier(), String.format(OBJ_FIELD_REQ, api, "groupMembershipIdentifier"));
// optional
// NOTE groupBackLinkIdentifier cannot be checked
}
public static void checkGroupAttributes(String client, OrgLdapGroupAttributes attributes) {
public static void checkGroupAttributes(String api, OrgLdapGroupAttributes attributes) {
// required
assertNotNull(attributes.getObjectClass(), String.format(OBJ_FIELD_REQ, client, "objectClass"));
assertNotNull(attributes.getObjectIdentifier(), String.format(OBJ_FIELD_REQ, client, "objectIdentifier"));
assertNotNull(attributes.getGroupName(), String.format(OBJ_FIELD_REQ, client, "groupName"));
assertNotNull(attributes.getMembership(), String.format(OBJ_FIELD_REQ, client, "membership"));
assertNotNull(attributes.getMembershipIdentifier(), String.format(OBJ_FIELD_REQ, client, "membershipIdentifier"));
assertNotNull(attributes.getObjectClass(), String.format(OBJ_FIELD_REQ, api, "objectClass"));
assertNotNull(attributes.getObjectIdentifier(), String.format(OBJ_FIELD_REQ, api, "objectIdentifier"));
assertNotNull(attributes.getGroupName(), String.format(OBJ_FIELD_REQ, api, "groupName"));
assertNotNull(attributes.getMembership(), String.format(OBJ_FIELD_REQ, api, "membership"));
assertNotNull(attributes.getMembershipIdentifier(), String.format(OBJ_FIELD_REQ, api, "membershipIdentifier"));
// optional
// NOTE backLinkIdentifier cannot be checked

View File

@ -24,7 +24,7 @@ import java.net.URI;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClientExpectTest;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorApiExpectTest;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
@ -34,18 +34,18 @@ import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* Test the {@link CatalogClient} by observing its side effects.
* Test the {@link CatalogApi} by observing its side effects.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "CatalogClientExpectTest")
public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "CatalogApiExpectTest")
public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
@Test
public void testGetCatalog() {
@ -60,12 +60,12 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/catalog.xml", VCloudDirectorMediaType.CATALOG + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
Catalog expected = catalog();
URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4");
assertEquals(client.getCatalogClient().getCatalog(catalogURI), expected);
assertEquals(api.getCatalogApi().getCatalog(catalogURI), expected);
}
@Test
@ -83,7 +83,7 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/createdCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4");
@ -95,7 +95,7 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
CatalogItem expected = createdCatalogItem();
assertEquals(client.getCatalogClient().addCatalogItem(catalogURI, newItem), expected);
assertEquals(api.getCatalogApi().addCatalogItem(catalogURI, newItem), expected);
}
@Test
@ -112,7 +112,7 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/catalogMetadata.xml", VCloudDirectorMediaType.METADATA))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4");
@ -127,7 +127,7 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.entries(ImmutableSet.of(metadataEntry()))
.build();
assertEquals(client.getCatalogClient().getMetadataClient().getMetadata(catalogURI), expected);
assertEquals(api.getCatalogApi().getMetadataApi().getMetadata(catalogURI), expected);
}
@Test
@ -144,13 +144,13 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/catalogMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4");
MetadataValue expected = metadataValue();
assertEquals(client.getCatalogClient().getMetadataClient().getMetadataValue(catalogURI, "KEY"), expected);
assertEquals(api.getCatalogApi().getMetadataApi().getMetadataValue(catalogURI, "KEY"), expected);
}
@Test
@ -167,13 +167,13 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/catalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
CatalogItem expected = catalogItem();
assertEquals(client.getCatalogClient().getCatalogItem(catalogItemURI), expected);
assertEquals(api.getCatalogApi().getCatalogItem(catalogItemURI), expected);
}
@Test
@ -191,12 +191,12 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/updateCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
CatalogItem expected = catalogItem();
assertEquals(client.getCatalogClient().updateCatalogItem(catalogItemURI, expected), expected);
assertEquals(api.getCatalogApi().updateCatalogItem(catalogItemURI, expected), expected);
}
@Test
@ -212,11 +212,11 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.statusCode(200)
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
client.getCatalogClient().deleteCatalogItem(catalogItemURI);
api.getCatalogApi().deleteCatalogItem(catalogItemURI);
}
@Test
@ -233,7 +233,7 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/catalogItemMetadata.xml", VCloudDirectorMediaType.METADATA))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
@ -248,7 +248,7 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.entries(ImmutableSet.of(itemMetadataEntry()))
.build();
assertEquals(client.getCatalogClient().getMetadataClient().getMetadata(catalogItemURI), expected);
assertEquals(api.getCatalogApi().getMetadataApi().getMetadata(catalogItemURI), expected);
}
@Test
@ -266,7 +266,7 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/mergeMetadataTask.xml", VCloudDirectorMediaType.TASK + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
@ -274,7 +274,7 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
Task expected = mergeMetadataTask();
assertEquals(client.getCatalogClient().getCatalogItemMetadataClient().mergeMetadata(catalogItemURI, metadata), expected);
assertEquals(api.getCatalogApi().getCatalogItemMetadataApi().mergeMetadata(catalogItemURI, metadata), expected);
}
@Test
@ -291,13 +291,13 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/catalogItemMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
MetadataValue expected = itemMetadataValue();
assertEquals(client.getCatalogClient().getMetadataClient().getMetadataValue(catalogItemURI, "KEY"), expected);
assertEquals(api.getCatalogApi().getMetadataApi().getMetadataValue(catalogItemURI, "KEY"), expected);
}
@Test
@ -315,7 +315,7 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/setMetadataValueTask.xml", VCloudDirectorMediaType.TASK + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
@ -323,7 +323,7 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
Task expected = setMetadataValueTask();
assertEquals(client.getCatalogClient().getCatalogItemMetadataClient().setMetadata(catalogItemURI, "KEY", value), expected);
assertEquals(api.getCatalogApi().getCatalogItemMetadataApi().setMetadata(catalogItemURI, "KEY", value), expected);
}
@Test
@ -340,13 +340,13 @@ public class CatalogClientExpectTest extends VCloudDirectorClientExpectTest {
.payload(payloadFromResourceWithContentType("/catalog/deleteMetadataEntryTask.xml", VCloudDirectorMediaType.TASK))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
Task expected = deleteMetadataEntryTask();
assertEquals(client.getCatalogClient().getCatalogItemMetadataClient().deleteMetadataEntry(catalogItemURI, "KEY"), expected);
assertEquals(api.getCatalogApi().getCatalogItemMetadataApi().deleteMetadataEntry(catalogItemURI, "KEY"), expected);
}
public static final Catalog catalog() {

View File

@ -48,8 +48,8 @@ import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogApi;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
@ -57,17 +57,17 @@ import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
/**
* Tests live behavior of {@link CatalogClient}.
* Tests live behavior of {@link CatalogApi}.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "CatalogClientLiveTest")
public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "CatalogApiLiveTest")
public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
/*
* Convenience references to API clients.
* Convenience references to API apis.
*/
private CatalogClient catalogClient;
private CatalogApi catalogApi;
/*
* Shared state between dependant tests.
@ -79,29 +79,29 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
private Reference catalogRef;
@Override
protected void setupRequiredClients() {
protected void setupRequiredApis() {
// TODO why do I need a guard clause here?
if (adminCatalog != null) return;
catalogClient = context.getApi().getCatalogClient();
Reference orgRef = Iterables.getFirst(context.getApi().getOrgClient().getOrgList().getOrgs(), null).toAdminReference(endpoint);
catalogApi = context.getApi().getCatalogApi();
Reference orgRef = Iterables.getFirst(context.getApi().getOrgApi().getOrgList().getOrgs(), null).toAdminReference(endpoint);
if (adminContext != null) {
AdminCatalog newCatalog = AdminCatalog.builder()
.name(name("Test Catalog "))
.description("created by CatalogClientLiveTest")
.description("created by CatalogApiLiveTest")
.build();
AdminCatalogClient adminCatalogClient = adminContext.getApi().getCatalogClient();
adminCatalog = adminCatalogClient.createCatalog(orgRef.getHref(), newCatalog);
AdminCatalogApi adminCatalogApi = adminContext.getApi().getCatalogApi();
adminCatalog = adminCatalogApi.createCatalog(orgRef.getHref(), newCatalog);
catalogRef = find(adminCatalog.getLinks(), and(relEquals("alternate"), typeEquals(VCloudDirectorMediaType.CATALOG)));
Metadata newMetadata = Metadata.builder()
.entry(MetadataEntry.builder().entry("KEY", "MARMALADE").build())
.build();
Task mergeCatalogMetadata = adminCatalogClient.getMetadataClient().mergeMetadata(adminCatalog.getHref(), newMetadata);
Task mergeCatalogMetadata = adminCatalogApi.getMetadataApi().mergeMetadata(adminCatalog.getHref(), newMetadata);
checkTask(mergeCatalogMetadata);
assertTrue(retryTaskSuccess.apply(mergeCatalogMetadata), String.format(TASK_COMPLETE_TIMELY, "setupRequiredClients"));
assertTrue(retryTaskSuccess.apply(mergeCatalogMetadata), String.format(TASK_COMPLETE_TIMELY, "setupRequiredApis"));
} else {
catalogRef = Reference.builder().href(catalogURI).build();
}
@ -111,14 +111,14 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public void tearDown() {
if (catalogItem != null) {
try {
catalogClient.deleteCatalogItem(catalogItem.getHref());
catalogApi.deleteCatalogItem(catalogItem.getHref());
} catch (Exception e) {
logger.warn(e, "Error when deleting catalog item '%s'", catalogItem.getName());
}
}
if (media != null) {
try {
Task delete = context.getApi().getMediaClient().deleteMedia(media.getHref());
Task delete = context.getApi().getMediaApi().deleteMedia(media.getHref());
taskDoneEventually(delete);
} catch (Exception e) {
logger.warn(e, "Error when deleting media '%s'", media.getName());
@ -126,7 +126,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
}
if (adminContext != null && adminCatalog != null) {
try {
adminContext.getApi().getCatalogClient().deleteCatalog(adminCatalog.getHref());
adminContext.getApi().getCatalogApi().deleteCatalog(adminCatalog.getHref());
} catch (Exception e) {
logger.warn(e, "Error when deleting catalog '%s'", adminCatalog.getName());
}
@ -136,7 +136,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /catalog/{id}")
public void testGetCatalog() {
Catalog catalog = catalogClient.getCatalog(catalogRef.getHref());
Catalog catalog = catalogApi.getCatalog(catalogRef.getHref());
assertNotNull(catalog);
// Double check it's pointing at the correct catalog
assertEquals(catalog.getHref(), catalogRef.getHref());
@ -144,7 +144,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /catalogItem/{id}", dependsOnMethods = "testAddCatalogItem")
public void testGetCatalogItem() {
CatalogItem catalogItem = catalogClient.getCatalogItem(this.catalogItem.getHref());
CatalogItem catalogItem = catalogApi.getCatalogItem(this.catalogItem.getHref());
checkCatalogItem(catalogItem);
assertEquals(catalogItem.getEntity().getHref(), this.catalogItem.getEntity().getHref());
}
@ -154,7 +154,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
assertNotNull(vdcURI, String.format(REF_REQ_LIVE, VDC));
byte[] iso = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
Vdc vdc = context.getApi().getVdcClient().getVdc(vdcURI);
Vdc vdc = context.getApi().getVdcApi().getVdc(vdcURI);
assertNotNull(vdc, String.format(OBJ_REQ_LIVE, VDC));
Link addMedia = find(vdc.getLinks(), and(relEquals("add"), typeEquals(VCloudDirectorMediaType.MEDIA)));
@ -165,7 +165,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.imageType(Media.ImageType.ISO)
.description("Test media generated by testCreateMedia()")
.build();
media = context.getApi().getMediaClient().createMedia(addMedia.getHref(), sourceMedia);
media = context.getApi().getMediaApi().createMedia(addMedia.getHref(), sourceMedia);
Checks.checkMediaFor(VCloudDirectorMediaType.MEDIA, media);
@ -175,7 +175,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.type(VCloudDirectorMediaType.CATALOG_ITEM)
.entity(Reference.builder().href(media.getHref()).build())
.build();
catalogItem = catalogClient.addCatalogItem(catalogRef.getHref(), editedCatalogItem);
catalogItem = catalogApi.addCatalogItem(catalogRef.getHref(), editedCatalogItem);
checkCatalogItem(catalogItem);
assertEquals(catalogItem.getName(), "newitem");
assertEquals(catalogItem.getDescription(), "New Item");
@ -184,7 +184,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "PUT /catalogItem/{id}", dependsOnMethods = "testAddCatalogItem")
public void testUpdateCatalogItem() {
CatalogItem updatedCatalogItem = CatalogItem.builder().fromCatalogItem(catalogItem).name("UPDATEDNAME").build();
catalogItem = catalogClient.updateCatalogItem(catalogItem.getHref(), updatedCatalogItem);
catalogItem = catalogApi.updateCatalogItem(catalogItem.getHref(), updatedCatalogItem);
checkCatalogItem(catalogItem);
assertEquals(catalogItem.getName(), "UPDATEDNAME");
}
@ -192,27 +192,27 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
// Note this runs after all the metadata tests
@Test(description = "DELETE /catalogItem/{id}", dependsOnMethods = "testDeleteCatalogItemMetadataValue")
public void testDeleteCatalogItem() {
catalogClient.deleteCatalogItem(catalogItem.getHref());
catalogItem = catalogClient.getCatalogItem(catalogItem.getHref());
catalogApi.deleteCatalogItem(catalogItem.getHref());
catalogItem = catalogApi.getCatalogItem(catalogItem.getHref());
assertNull(catalogItem);
}
@Test(description = "GET /catalog/{id}/metadata")
public void testGetCatalogMetadata() {
Metadata catalogMetadata = catalogClient.getMetadataClient().getMetadata(catalogRef.getHref());
Metadata catalogMetadata = catalogApi.getMetadataApi().getMetadata(catalogRef.getHref());
checkMetadata(catalogMetadata);
}
@Test(description = "GET /catalog/{id}/metadata/{key}")
public void testGetCatalogMetadataValue() {
Metadata catalogMetadata = catalogClient.getMetadataClient().getMetadata(catalogRef.getHref());
Metadata catalogMetadata = catalogApi.getMetadataApi().getMetadata(catalogRef.getHref());
MetadataEntry existingMetadataEntry = Iterables.find(catalogMetadata.getMetadataEntries(), new Predicate<MetadataEntry>() {
@Override
public boolean apply(MetadataEntry input) {
return input.getKey().equals("KEY");
}
});
MetadataValue metadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogRef.getHref(), "KEY");
MetadataValue metadataValue = catalogApi.getMetadataApi().getMetadataValue(catalogRef.getHref(), "KEY");
assertEquals(metadataValue.getValue(), existingMetadataEntry.getValue(),
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", existingMetadataEntry.getValue(), metadataValue.getValue()));
checkMetadataValue(metadataValue);
@ -220,7 +220,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /catalogItem/{id}/metadata", dependsOnMethods = "testAddCatalogItem")
public void testGetCatalogItemMetadata() {
Metadata catalogItemMetadata = catalogClient.getCatalogItemMetadataClient().getMetadata(catalogItem.getHref());
Metadata catalogItemMetadata = catalogApi.getCatalogItemMetadataApi().getMetadata(catalogItem.getHref());
checkMetadata(catalogItemMetadata);
}
@ -231,22 +231,22 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.entry(MetadataEntry.builder().entry("VEGIMITE", "VALUE").build())
.build();
Metadata before = catalogClient.getCatalogItemMetadataClient().getMetadata(catalogItem.getHref());
Metadata before = catalogApi.getCatalogItemMetadataApi().getMetadata(catalogItem.getHref());
Task mergeCatalogItemMetadata = catalogClient.getCatalogItemMetadataClient().mergeMetadata(catalogItem.getHref(), newMetadata);
Task mergeCatalogItemMetadata = catalogApi.getCatalogItemMetadataApi().mergeMetadata(catalogItem.getHref(), newMetadata);
checkTask(mergeCatalogItemMetadata);
assertTrue(retryTaskSuccess.apply(mergeCatalogItemMetadata),
String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata"));
Metadata mergedCatalogItemMetadata = catalogClient.getCatalogItemMetadataClient().getMetadata(catalogItem.getHref());
Metadata mergedCatalogItemMetadata = catalogApi.getCatalogItemMetadataApi().getMetadata(catalogItem.getHref());
assertTrue(mergedCatalogItemMetadata.getMetadataEntries().size() > before.getMetadataEntries().size(),
"Should have added at least one other MetadataEntry to the CatalogItem");
MetadataValue keyMetadataValue = catalogClient.getCatalogItemMetadataClient().getMetadataValue(catalogItem.getHref(), "KEY");
MetadataValue keyMetadataValue = catalogApi.getCatalogItemMetadataApi().getMetadataValue(catalogItem.getHref(), "KEY");
assertEquals(keyMetadataValue.getValue(), "MARMALADE", "The Value of the MetadataValue for KEY should have changed");
checkMetadataValue(keyMetadataValue);
MetadataValue newKeyMetadataValue = catalogClient.getCatalogItemMetadataClient().getMetadataValue(catalogItem.getHref(), "VEGIMITE");
MetadataValue newKeyMetadataValue = catalogApi.getCatalogItemMetadataApi().getMetadataValue(catalogItem.getHref(), "VEGIMITE");
assertEquals(newKeyMetadataValue.getValue(), "VALUE", "The Value of the MetadataValue for NEW_KEY should have been set");
checkMetadataValue(newKeyMetadataValue);
@ -254,7 +254,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testSetCatalogItemMetadataValue")
public void testGetCatalogItemMetadataValue() {
MetadataValue metadataValue = catalogClient.getCatalogItemMetadataClient().getMetadataValue(catalogItem.getHref(), "KEY");
MetadataValue metadataValue = catalogApi.getCatalogItemMetadataApi().getMetadataValue(catalogItem.getHref(), "KEY");
checkMetadataValue(metadataValue);
}
@ -262,12 +262,12 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public void testSetCatalogItemMetadataValue() {
MetadataValue newMetadataValue = MetadataValue.builder().value("NEW").build();
Task setCatalogItemMetadataValue = catalogClient.getCatalogItemMetadataClient().setMetadata(catalogItem.getHref(), "KEY", newMetadataValue);
Task setCatalogItemMetadataValue = catalogApi.getCatalogItemMetadataApi().setMetadata(catalogItem.getHref(), "KEY", newMetadataValue);
checkTask(setCatalogItemMetadataValue);
assertTrue(retryTaskSuccess.apply(setCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "setCatalogItemMetadataValue"));
MetadataValue updatedMetadataValue = catalogClient.getCatalogItemMetadataClient().getMetadataValue(catalogItem.getHref(), "KEY");
MetadataValue updatedMetadataValue = catalogApi.getCatalogItemMetadataApi().getMetadataValue(catalogItem.getHref(), "KEY");
assertEquals(updatedMetadataValue.getValue(), newMetadataValue.getValue(),
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", newMetadataValue.getValue(), updatedMetadataValue.getValue()));
checkMetadataValue(updatedMetadataValue);
@ -275,11 +275,11 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "DELETE /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testGetCatalogItemMetadataValue")
public void testDeleteCatalogItemMetadataValue() {
Task deleteCatalogItemMetadataValue = catalogClient.getCatalogItemMetadataClient().deleteMetadataEntry(catalogItem.getHref(), "KEY");
Task deleteCatalogItemMetadataValue = catalogApi.getCatalogItemMetadataApi().deleteMetadataEntry(catalogItem.getHref(), "KEY");
checkTask(deleteCatalogItemMetadataValue);
assertTrue(retryTaskSuccess.apply(deleteCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "deleteCatalogItemMetadataValue"));
MetadataValue deleted = catalogClient.getMetadataClient().getMetadataValue(catalogItem.getHref(), "KEY");
MetadataValue deleted = catalogApi.getMetadataApi().getMetadataValue(catalogItem.getHref(), "KEY");
assertNull(deleted);
}
}

View File

@ -38,25 +38,25 @@ import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.params.CloneMediaParams;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* Test the {@link MediaClient} via its side effects.
* Test the {@link MediaApi} via its side effects.
*
* @author danikov
*/
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "MediaClientExpectTest")
public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "MediaApiExpectTest")
public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test
public void testCreateMedia() {
URI uploadLink = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media")
.acceptMedia(VCloudDirectorMediaType.MEDIA)
@ -75,14 +75,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
Media expected = createMedia();
assertEquals(client.getMediaClient().createMedia(uploadLink, source), expected);
assertEquals(api.getMediaApi().createMedia(uploadLink, source), expected);
}
@Test
public void testCloneMedia() {
URI vdcURI = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia")
.acceptMedia(VCloudDirectorMediaType.MEDIA)
@ -105,14 +105,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
Media expected = cloneMedia();
assertEquals(client.getMediaClient().cloneMedia(vdcURI, params), expected);
assertEquals(api.getMediaApi().cloneMedia(vdcURI, params), expected);
}
@Test
public void testGetMedia() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1")
.acceptAnyMedia()
@ -122,14 +122,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.httpResponseBuilder().build());
Media expected = getMedia();
assertEquals(client.getMediaClient().getMedia(mediaUri), expected);
assertEquals(api.getMediaApi().getMedia(mediaUri), expected);
}
@Test
public void testResponse400ForInvalidMedia() {
URI mediaUri = URI.create(endpoint + "/media/NOTAUUID");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/NOTAUUID")
.acceptAnyMedia()
@ -145,7 +145,7 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
try {
client.getMediaClient().getMedia(mediaUri);
api.getMediaApi().getMedia(mediaUri);
fail("Should give HTTP 400 error");
} catch (VCloudDirectorException vde) {
assertEquals(vde.getError(), expected);
@ -158,7 +158,7 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
public void testNullResponseForCatalogIdUsedAsMediaId() {
URI mediaUri = URI.create(endpoint + "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f")
.acceptAnyMedia()
@ -167,14 +167,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.xmlFilePayload("/media/error403-catalog.xml", VCloudDirectorMediaType.ERROR)
.httpResponseBuilder().statusCode(403).build());
assertNull(client.getMediaClient().getMedia(mediaUri));
assertNull(api.getMediaApi().getMedia(mediaUri));
}
@Test
public void testResponse403ForFakeMediaId() {
URI mediaUri = URI.create(endpoint + "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
.acceptAnyMedia()
@ -183,14 +183,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.xmlFilePayload("/media/error403-fake.xml", VCloudDirectorMediaType.ERROR)
.httpResponseBuilder().statusCode(403).build());
assertNull(client.getMediaClient().getMedia(mediaUri));
assertNull(api.getMediaApi().getMedia(mediaUri));
}
@Test
public void testUpdateMedia() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1")
.xmlFilePayload("/media/updateMedia.xml", VCloudDirectorMediaType.MEDIA)
@ -203,14 +203,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Media update = updateMedia();
Task expected = updateMediaTask();
assertEquals(client.getMediaClient().updateMedia(mediaUri, update), expected);
assertEquals(api.getMediaApi().updateMedia(mediaUri, update), expected);
}
@Test
public void testDeleteMedia() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1")
.acceptMedia(VCloudDirectorMediaType.TASK)
@ -221,14 +221,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = deleteMediaTask();
assertEquals(client.getMediaClient().deleteMedia(mediaUri), expected);
assertEquals(api.getMediaApi().deleteMedia(mediaUri), expected);
}
@Test
public void testGetMetadata() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata")
.acceptAnyMedia()
@ -240,14 +240,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Metadata expected = metadata();
assertEquals(client.getMediaClient().getMetadataClient().getMetadata(mediaUri), expected);
assertEquals(api.getMediaApi().getMetadataApi().getMetadata(mediaUri), expected);
}
@Test
public void testMergeMetadata() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata")
.xmlFilePayload("/media/mergeMetadata.xml", VCloudDirectorMediaType.METADATA)
@ -260,13 +260,13 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Metadata inputMetadata = metadata();
Task expectedTask = mergeMetadataTask();
assertEquals(client.getMediaClient().getMetadataClient().mergeMetadata(mediaUri, inputMetadata), expectedTask);
assertEquals(api.getMediaApi().getMetadataApi().mergeMetadata(mediaUri, inputMetadata), expectedTask);
}
public void testGetMetadataValue() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key")
.acceptAnyMedia()
@ -278,14 +278,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
MetadataValue expected = metadataValue();
assertEquals(client.getMediaClient().getMetadataClient().getMetadataValue(mediaUri, "key"), expected);
assertEquals(api.getMediaApi().getMetadataApi().getMetadataValue(mediaUri, "key"), expected);
}
@Test
public void testSetMetadataValue() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key")
.xmlFilePayload("/media/setMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE)
@ -299,14 +299,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expectedTask = setMetadataEntryTask();
assertEquals(client.getMediaClient().getMetadataClient().setMetadata(mediaUri, "key", inputMetadataValue), expectedTask);
assertEquals(api.getMediaApi().getMetadataApi().setMetadata(mediaUri, "key", inputMetadataValue), expectedTask);
}
@Test
public void testDeleteMetadataValue() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key")
.acceptMedia(VCloudDirectorMediaType.TASK)
@ -317,14 +317,14 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expectedTask = deleteMetadataEntryTask();
assertEquals(client.getMediaClient().getMetadataClient().deleteMetadataEntry(mediaUri, "key"), expectedTask);
assertEquals(api.getMediaApi().getMetadataApi().deleteMetadataEntry(mediaUri, "key"), expectedTask);
}
@Test
public void testGetOwner() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/owner")
.acceptAnyMedia()
@ -341,7 +341,7 @@ public class MediaClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build())
.build();
assertEquals(client.getMediaClient().getOwner(mediaUri), expected);
assertEquals(api.getMediaApi().getOwner(mediaUri), expected);
}
static Media createMedia() {

View File

@ -63,7 +63,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.params.CloneMediaParams;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -74,21 +74,21 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
/**
* Tests behavior of {@code MediaClient}
* Tests behavior of {@code MediaApi}
*
* @author danikov
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "MediaClientLiveTest")
public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "MediaApiLiveTest")
public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public static final String MEDIA = "media";
public static final String VDC = "vdc";
/*
* Convenience references to API clients.
* Convenience references to API apis.
*/
protected VdcClient vdcClient;
protected MediaClient mediaClient;
protected VdcApi vdcApi;
protected MediaApi mediaApi;
/*
* Shared state between dependent tests.
@ -101,16 +101,16 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() {
vdcClient = context.getApi().getVdcClient();
mediaClient = context.getApi().getMediaClient();
public void setupRequiredApis() {
vdcApi = context.getApi().getVdcApi();
mediaApi = context.getApi().getMediaApi();
}
@AfterClass(alwaysRun = true)
protected void tidyUp() {
if (media != null) {
try {
Task delete = mediaClient.deleteMedia(media.getHref());
Task delete = mediaApi.deleteMedia(media.getHref());
taskDoneEventually(delete);
} catch (Exception e) {
logger.warn(e, "Error when deleting media '%s': %s", media.getName());
@ -118,7 +118,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
}
if (oldMedia != null) {
try {
Task delete = mediaClient.deleteMedia(oldMedia.getHref());
Task delete = mediaApi.deleteMedia(oldMedia.getHref());
taskDoneEventually(delete);
} catch (Exception e) {
logger.warn(e, "Error when deleting media '%s': %s", oldMedia.getName());
@ -129,7 +129,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "POST /vdc/{id}/media")
public void testCreateMedia() throws URISyntaxException {
assertNotNull(vdcURI, String.format(REF_REQ_LIVE, VDC));
Vdc vdc = vdcClient.getVdc(vdcURI);
Vdc vdc = vdcApi.getVdc(vdcURI);
assertNotNull(vdc, String.format(OBJ_REQ_LIVE, VDC));
Link addMedia = find(vdc.getLinks(), and(relEquals("add"), typeEquals(VCloudDirectorMediaType.MEDIA)));
@ -143,7 +143,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.imageType(Media.ImageType.ISO)
.description("Test media generated by testCreateMedia()")
.build();
media = mediaClient.createMedia(addMedia.getHref(), sourceMedia);
media = mediaApi.createMedia(addMedia.getHref(), sourceMedia);
Checks.checkMediaFor(MEDIA, media);
@ -162,21 +162,21 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
String.format(OBJ_FIELD_REQ, MEDIA, "uploadFile.links.first"));
Link uploadLink = Iterables.find(links, LinkPredicates.relEquals(Link.Rel.UPLOAD_DEFAULT));
context.getApi().getUploadClient().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
if (media.getTasks().size() == 1) {
Task uploadTask = Iterables.getOnlyElement(media.getTasks());
Checks.checkTask(uploadTask);
assertEquals(uploadTask.getStatus(), Task.Status.RUNNING);
assertTrue(retryTaskSuccess.apply(uploadTask), String.format(TASK_COMPLETE_TIMELY, "uploadTask"));
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
}
}
@Test(description = "GET /media/{id}", dependsOnMethods = { "testCreateMedia" })
public void testGetMedia() {
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
assertNotNull(media, String.format(OBJ_REQ_LIVE, MEDIA));
owner = media.getOwner();
@ -188,7 +188,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /media/{id}/owner", dependsOnMethods = { "testGetMedia" })
public void testGetMediaOwner() {
Owner directOwner = mediaClient.getOwner(media.getHref());
Owner directOwner = mediaApi.getOwner(media.getHref());
assertEquals(owner.toBuilder()
.user(owner.getUser().toBuilder().id(null).build())
.build(),
@ -207,7 +207,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "POST /vdc/{id}/action/cloneMedia", dependsOnMethods = { "testGetMediaOwner" })
public void testCloneMedia() {
oldMedia = media;
media = vdcClient.cloneMedia(vdcURI, CloneMediaParams.builder()
media = vdcApi.cloneMedia(vdcURI, CloneMediaParams.builder()
.source(Reference.builder().fromEntity(media).build())
.name("copied "+media.getName())
.description("copied by testCloneMedia()")
@ -220,7 +220,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
if (copyTask != null) {
Checks.checkTask(copyTask);
assertTrue(retryTaskSuccess.apply(copyTask), String.format(TASK_COMPLETE_TIMELY, "copyTask"));
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
}
}
@ -228,9 +228,9 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
assertTrue(media.clone(oldMedia), String.format(OBJ_FIELD_CLONE, MEDIA, "copied media",
media.toString(), oldMedia.toString()));
mediaClient.getMetadataClient().setMetadata(media.getHref(), "key", MetadataValue.builder().value("value").build());
mediaApi.getMetadataApi().setMetadata(media.getHref(), "key", MetadataValue.builder().value("value").build());
media = vdcClient.cloneMedia(vdcURI, CloneMediaParams.builder()
media = vdcApi.cloneMedia(vdcURI, CloneMediaParams.builder()
.source(Reference.builder().fromEntity(media).build())
.name("moved test media")
.description("moved by testCloneMedia()")
@ -244,7 +244,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
if (copyTask != null) {
Checks.checkTask(copyTask);
assertTrue(retryTaskSuccess.apply(copyTask), String.format(TASK_COMPLETE_TIMELY, "copyTask"));
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
}
}
@ -261,10 +261,10 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
String newDescription = "new "+oldDescription;
media = media.toBuilder().name(newName).description(newDescription).build();
Task updateMedia = mediaClient.updateMedia(media.getHref(), media);
Task updateMedia = mediaApi.updateMedia(media.getHref(), media);
Checks.checkTask(updateMedia);
assertTrue(retryTaskSuccess.apply(updateMedia), String.format(TASK_COMPLETE_TIMELY, "updateMedia"));
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
assertTrue(equal(media.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, MEDIA, "name"));
assertTrue(equal(media.getDescription(), newDescription),
@ -276,15 +276,15 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
media = media.toBuilder().name(oldName).description(oldDescription).build();
updateMedia = mediaClient.updateMedia(media.getHref(), media);
updateMedia = mediaApi.updateMedia(media.getHref(), media);
Checks.checkTask(updateMedia);
assertTrue(retryTaskSuccess.apply(updateMedia), String.format(TASK_COMPLETE_TIMELY, "updateMedia"));
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
}
@Test(description = "GET /media/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" })
public void testGetMetadata() {
metadata = mediaClient.getMetadataClient().getMetadata(media.getHref());
metadata = mediaApi.getMetadataApi().getMetadata(media.getHref());
// required for testing
assertFalse(isEmpty(metadata.getMetadataEntries()),
String.format(OBJ_FIELD_REQ_LIVE, MEDIA, "metadata.entries"));
@ -300,14 +300,14 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.entries(inputEntries)
.build();
Task mergeMetadata = mediaClient.getMetadataClient().mergeMetadata(media.getHref(), inputMetadata);
Task mergeMetadata = mediaApi.getMetadataApi().mergeMetadata(media.getHref(), inputMetadata);
Checks.checkTask(mergeMetadata);
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(new)"));
metadata = mediaClient.getMetadataClient().getMetadata(media.getHref());
metadata = mediaApi.getMetadataApi().getMetadata(media.getHref());
Checks.checkMetadataFor(MEDIA, metadata);
checkMetadataContainsEntries(metadata, inputEntries);
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
Checks.checkMediaFor(MEDIA, media);
// test modify
@ -316,14 +316,14 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.entries(inputEntries)
.build();
mergeMetadata = mediaClient.getMetadataClient().mergeMetadata(media.getHref(), inputMetadata);
mergeMetadata = mediaApi.getMetadataApi().mergeMetadata(media.getHref(), inputMetadata);
Checks.checkTask(mergeMetadata);
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(modify)"));
metadata = mediaClient.getMetadataClient().getMetadata(media.getHref());
metadata = mediaApi.getMetadataApi().getMetadata(media.getHref());
Checks.checkMetadataFor(MEDIA, metadata);
checkMetadataContainsEntries(metadata, inputEntries);
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
Checks.checkMediaFor(MEDIA, media);
}
@ -346,7 +346,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /media/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
public void testGetMetadataValue() {
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media.getHref(), "key");
metadataValue = mediaApi.getMetadataApi().getMetadataValue(media.getHref(), "key");
Checks.checkMetadataValueFor(MEDIA, metadataValue);
}
@ -355,44 +355,44 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
metadataEntryValue = "value";
MetadataValue newValue = MetadataValue.builder().value(metadataEntryValue).build();
Task setMetadataEntry = mediaClient.getMetadataClient().setMetadata(media.getHref(), "key", newValue);
Task setMetadataEntry = mediaApi.getMetadataApi().setMetadata(media.getHref(), "key", newValue);
Checks.checkTask(setMetadataEntry);
assertTrue(retryTaskSuccess.apply(setMetadataEntry),
String.format(TASK_COMPLETE_TIMELY, "setMetadataEntry"));
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media.getHref(), "key");
metadataValue = mediaApi.getMetadataApi().getMetadataValue(media.getHref(), "key");
Checks.checkMetadataValueFor(MEDIA, metadataValue);
}
@Test(description = "DELETE /media/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata", "testGetMetadataValue" } )
public void testDeleteMetadata() {
Task deleteMetadataEntry = mediaClient.getMetadataClient().deleteMetadataEntry(media.getHref(), "testKey");
Task deleteMetadataEntry = mediaApi.getMetadataApi().deleteMetadataEntry(media.getHref(), "testKey");
Checks.checkTask(deleteMetadataEntry);
assertTrue(retryTaskSuccess.apply(deleteMetadataEntry),
String.format(TASK_COMPLETE_TIMELY, "deleteMetadataEntry"));
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media.getHref(), "testKey");
metadataValue = mediaApi.getMetadataApi().getMetadataValue(media.getHref(), "testKey");
assertNull(metadataValue, String.format(OBJ_FIELD_ATTRB_DEL, MEDIA,
"Metadata", metadataValue != null ? metadataValue.toString() : "",
"MetadataEntry", metadataValue != null ? metadataValue.toString() : ""));
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media.getHref(), "key");
metadataValue = mediaApi.getMetadataApi().getMetadataValue(media.getHref(), "key");
Checks.checkMetadataValueFor(MEDIA, metadataValue);
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
Checks.checkMediaFor(MEDIA, media);
}
@Test(description = "DELETE /media/{id}", dependsOnMethods = { "testDeleteMetadata" } )
public void testDeleteMedia() {
Task deleteMedia = mediaClient.deleteMedia(media.getHref());
Task deleteMedia = mediaApi.deleteMedia(media.getHref());
Checks.checkTask(deleteMedia);
assertTrue(retryTaskSuccess.apply(deleteMedia),
String.format(TASK_COMPLETE_TIMELY, "deleteMedia"));
media = mediaClient.getMedia(media.getHref());
media = mediaApi.getMedia(media.getHref());
assertNull(media, String.format(OBJ_DEL, MEDIA, media != null ? media.toString() : ""));
deleteMedia = mediaClient.deleteMedia(oldMedia.getHref());
deleteMedia = mediaApi.deleteMedia(oldMedia.getHref());
Checks.checkTask(deleteMedia);
assertTrue(retryTaskSuccess.apply(deleteMedia), String.format(TASK_COMPLETE_TIMELY, "deleteMedia"));
oldMedia = null;

View File

@ -42,25 +42,25 @@ import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConfiguration;
import org.jclouds.vcloud.director.v1_5.domain.network.NetworkFeatures;
import org.jclouds.vcloud.director.v1_5.domain.network.SyslogServerSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* Test the {@link NetworkClient} via its side effects.
* Test the {@link NetworkApi} via its side effects.
*
* @author danikov
*/
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "NetworkClientExpectTest")
public class NetworkClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "NetworkApiExpectTest")
public class NetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test
public void testGetNetwork() {
URI networkUri = URI.create(endpoint + "/network/f3ba8256-6f48-4512-aad6-600e85b4dc38");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/f3ba8256-6f48-4512-aad6-600e85b4dc38")
.acceptAnyMedia()
@ -70,14 +70,14 @@ public class NetworkClientExpectTest extends VCloudDirectorAdminClientExpectTest
.httpResponseBuilder().build());
OrgNetwork expected = orgNetwork();
assertEquals(Network.<OrgNetwork>toSubType(client.getNetworkClient().getNetwork(networkUri)), expected);
assertEquals(Network.<OrgNetwork>toSubType(api.getNetworkApi().getNetwork(networkUri)), expected);
}
@Test
public void testGetNetworkWithInvalidId() {
URI networkUri = URI.create(endpoint + "/network/NOTAUUID");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/NOTAUUID")
.acceptAnyMedia()
@ -93,7 +93,7 @@ public class NetworkClientExpectTest extends VCloudDirectorAdminClientExpectTest
.build();
try {
client.getNetworkClient().getNetwork(networkUri);
api.getNetworkApi().getNetwork(networkUri);
fail("Should give HTTP 400 error");
} catch (VCloudDirectorException vde) {
assertEquals(vde.getError(), expected);
@ -106,7 +106,7 @@ public class NetworkClientExpectTest extends VCloudDirectorAdminClientExpectTest
public void testGetNetworkWithCatalogId() {
URI networkUri = URI.create(endpoint + "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c")
.acceptAnyMedia()
@ -115,14 +115,14 @@ public class NetworkClientExpectTest extends VCloudDirectorAdminClientExpectTest
.xmlFilePayload("/network/error403-catalog.xml", VCloudDirectorMediaType.ERROR)
.httpResponseBuilder().statusCode(403).build());
assertNull(client.getNetworkClient().getNetwork(networkUri));
assertNull(api.getNetworkApi().getNetwork(networkUri));
}
@Test
public void testGetNetworkWithFakeId() {
URI networkUri = URI.create(endpoint + "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
.acceptAnyMedia()
@ -131,14 +131,14 @@ public class NetworkClientExpectTest extends VCloudDirectorAdminClientExpectTest
.xmlFilePayload("/network/error403-fake.xml", VCloudDirectorMediaType.ERROR)
.httpResponseBuilder().statusCode(403).build());
assertNull(client.getNetworkClient().getNetwork(networkUri));
assertNull(api.getNetworkApi().getNetwork(networkUri));
}
@Test
public void testGetMetadata() {
URI networkUri = URI.create(endpoint + "/network/55a677cf-ab3f-48ae-b880-fab90421980c");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata")
.acceptAnyMedia()
@ -158,14 +158,14 @@ public class NetworkClientExpectTest extends VCloudDirectorAdminClientExpectTest
.entries(ImmutableSet.of(MetadataEntry.builder().entry("key", "value").build()))
.build();
assertEquals(client.getNetworkClient().getMetadataClient().getMetadata(networkUri), expected);
assertEquals(api.getNetworkApi().getMetadataApi().getMetadata(networkUri), expected);
}
@Test
public void testGetMetadataValue() {
URI networkUri = URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata/KEY")
.acceptAnyMedia()
@ -184,7 +184,7 @@ public class NetworkClientExpectTest extends VCloudDirectorAdminClientExpectTest
.value("value")
.build();
assertEquals(client.getNetworkClient().getMetadataClient().getMetadataValue(networkUri, "KEY"), expected);
assertEquals(api.getNetworkApi().getMetadataApi().getMetadataValue(networkUri, "KEY"), expected);
}
public static OrgNetwork orgNetwork() {

View File

@ -37,7 +37,7 @@ import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.network.Network;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -45,33 +45,33 @@ import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
/**
* Tests behavior of {@link NetworkClient}
* Tests behavior of {@link NetworkApi}
*
* @author danikov
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "NetworkClientLiveTest")
public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "NetworkApiLiveTest")
public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public static final String NETWORK = "network";
/*
* Convenience reference to API client.
* Convenience reference to API api.
*/
protected NetworkClient networkClient;
protected NetworkApi networkApi;
private boolean metadataSet = false;
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() {
networkClient = context.getApi().getNetworkClient();
public void setupRequiredApis() {
networkApi = context.getApi().getNetworkApi();
}
@AfterClass(alwaysRun = true)
public void cleanUp() {
if (metadataSet) {
try {
Task delete = adminContext.getApi().getNetworkClient().getMetadataClient().deleteMetadataEntry(toAdminUri(networkURI), "key");
Task delete = adminContext.getApi().getNetworkApi().getMetadataApi().deleteMetadataEntry(toAdminUri(networkURI), "key");
taskDoneEventually(delete);
} catch (Exception e) {
logger.warn(e, "Error when deleting metadata");
@ -84,7 +84,7 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
// required for testing
assertNotNull(networkURI, String.format(REF_REQ_LIVE, NETWORK));
Network abstractNetwork = networkClient.getNetwork(networkURI);
Network abstractNetwork = networkApi.getNetwork(networkURI);
assertTrue(abstractNetwork instanceof OrgNetwork, String.format(REQUIRED_VALUE_OBJECT_FMT,
".class", NETWORK, abstractNetwork.getClass(),"OrgNetwork"));
OrgNetwork network = Network.toSubType(abstractNetwork);
@ -95,7 +95,7 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
}
private void setupMetadata() {
adminContext.getApi().getNetworkClient().getMetadataClient().setMetadata(toAdminUri(networkURI),
adminContext.getApi().getNetworkApi().getMetadataApi().setMetadata(toAdminUri(networkURI),
"key", MetadataValue.builder().value("value").build());
metadataSet = true;
}
@ -106,7 +106,7 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
setupMetadata();
}
Metadata metadata = networkClient.getMetadataClient().getMetadata(networkURI);
Metadata metadata = networkApi.getMetadataApi().getMetadata(networkURI);
// required for testing
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
String.format(OBJ_FIELD_REQ_LIVE, NETWORK, "metadata.entries"));
@ -117,9 +117,9 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
for (MetadataEntry entry : metadata.getMetadataEntries()) {
// required elements and attributes
assertNotNull(entry.getKey(),
String.format(OBJ_FIELD_ATTRB_REQ, networkClient, "MetadataEntry", entry.getKey(), "key"));
String.format(OBJ_FIELD_ATTRB_REQ, networkApi, "MetadataEntry", entry.getKey(), "key"));
assertNotNull(entry.getValue(),
String.format(OBJ_FIELD_ATTRB_REQ, networkClient, "MetadataEntry", entry.getValue(), "value"));
String.format(OBJ_FIELD_ATTRB_REQ, networkApi, "MetadataEntry", entry.getValue(), "value"));
// parent type
checkResourceType(entry);
@ -128,7 +128,7 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /network/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
public void testGetMetadataValue() {
MetadataValue metadataValue = networkClient.getMetadataClient().getMetadataValue(networkURI, "key");
MetadataValue metadataValue = networkApi.getMetadataApi().getMetadataValue(networkURI, "key");
// Check parent type
checkResourceType(metadataValue);

View File

@ -34,24 +34,24 @@ import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgList;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
/**
* Allows us to test the {@link OrgClient} via its side effects.
* Allows us to test the {@link OrgApi} via its side effects.
*
* @author Adrian Cole
*/
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "OrgClientExpectTest")
public class OrgClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "OrgApiExpectTest")
public class OrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test
public void testGetOrgList() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", "/org/"),
getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST));
@ -63,44 +63,44 @@ public class OrgClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build())
.build();
assertEquals(client.getOrgClient().getOrgList(), expected);
assertEquals(api.getOrgApi().getOrgList(), expected);
}
@Test
public void testGetOrgFromOrgListReference() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", "/org/"),
getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST));
Reference org = Iterables.getOnlyElement(client.getOrgClient().getOrgList().getOrgs());
Reference org = Iterables.getOnlyElement(api.getOrgApi().getOrgList().getOrgs());
client = requestsSendResponses(loginRequest, sessionResponse,
api = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", org.getHref()),
getStandardPayloadResponse("/org/org.xml", VCloudDirectorMediaType.ORG));
Org expected = org();
assertEquals(client.getOrgClient().getOrg(org.getHref()), expected);
assertEquals(api.getOrgApi().getOrg(org.getHref()), expected);
}
@Test
public void testGetOrg() {
URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"),
getStandardPayloadResponse("/org/org.xml", VCloudDirectorMediaType.ORG));
Org expected = org();
assertEquals(client.getOrgClient().getOrg(orgUri), expected);
assertEquals(api.getOrgApi().getOrg(orgUri), expected);
}
@Test
public void testGetOrgFailOnInvalidOrgId() {
URI orgUri = URI.create(endpoint + "/org/NOTAUUID");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", "/org/NOTAUUID"),
getStandardPayloadResponse(400, "/org/error400.xml", VCloudDirectorMediaType.ERROR));
@ -111,7 +111,7 @@ public class OrgClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
try {
client.getOrgClient().getOrg(orgUri);
api.getOrgApi().getOrg(orgUri);
fail("Should give HTTP 400 error");
} catch (VCloudDirectorException vde) {
assertEquals(vde.getError(), expected);
@ -124,29 +124,29 @@ public class OrgClientExpectTest extends VCloudDirectorAdminClientExpectTest {
public void testGetOrgFailOnWrongOrgId() {
URI orgUri = URI.create(endpoint + "/org/9e08c2f6-077a-42ce-bece-d5332e2ebb5c");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", "/org/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"),
getStandardPayloadResponse(403, "/org/error403-catalog.xml", VCloudDirectorMediaType.ERROR));
assertNull(client.getOrgClient().getOrg(orgUri));
assertNull(api.getOrgApi().getOrg(orgUri));
}
@Test
public void testGetOrgFailOnFakeOrgId() {
URI orgUri = URI.create(endpoint + "/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", "/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"),
getStandardPayloadResponse(403, "/org/error403-fake.xml", VCloudDirectorMediaType.ERROR));
assertNull(client.getOrgClient().getOrg(orgUri));
assertNull(api.getOrgApi().getOrg(orgUri));
}
@Test
public void testGetOrgMetadata() {
URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata")
.acceptAnyMedia()
@ -166,14 +166,14 @@ public class OrgClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.entries(ImmutableSet.of(metadataEntry()))
.build();
assertEquals(client.getOrgClient().getMetadataClient().getMetadata(orgUri), expected);
assertEquals(api.getOrgApi().getMetadataApi().getMetadata(orgUri), expected);
}
@Test
public void testGetOrgMetadataValue() {
URI orgUri = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY")
.acceptAnyMedia()
@ -184,7 +184,7 @@ public class OrgClientExpectTest extends VCloudDirectorAdminClientExpectTest {
MetadataValue expected = metadataValue();
assertEquals(client.getOrgClient().getMetadataClient().getMetadataValue(orgUri, "KEY"), expected);
assertEquals(api.getOrgApi().getMetadataApi().getMetadataValue(orgUri, "KEY"), expected);
}
public static Org org() {

View File

@ -41,7 +41,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.org.Org;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgList;
import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -49,25 +49,25 @@ import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
/**
* Tests live behavior of {@link OrgClient}.
* Tests live behavior of {@link OrgApi}.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "OrgClientLiveTest")
public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "OrgApiLiveTest")
public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
/*
* Convenience references to API clients.
* Convenience references to API apis.
*/
private OrgClient orgClient;
private OrgApi orgApi;
private URI catalogRef;
private String testCatalogId;
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() {
orgClient = context.getApi().getOrgClient();
public void setupRequiredApis() {
orgApi = context.getApi().getOrgApi();
testCatalogId = catalogId;
}
@ -75,13 +75,13 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public void cleanUp() throws Exception {
if (adminMembersSet) {
try {
Task delete = adminContext.getApi().getOrgClient().getMetadataClient().deleteMetadataEntry(toAdminUri(orgURI), "KEY");
Task delete = adminContext.getApi().getOrgApi().getMetadataApi().deleteMetadataEntry(toAdminUri(orgURI), "KEY");
taskDoneEventually(delete);
} catch (Exception e) {
logger.warn(e, "Error when deleting metadata entry");
}
try {
adminContext.getApi().getCatalogClient().deleteCatalog(catalogRef);
adminContext.getApi().getCatalogApi().deleteCatalog(catalogRef);
} catch (Exception e) {
logger.warn(e, "Error when deleting catalog'%s': %s", catalogRef);
}
@ -100,7 +100,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /org")
public void testGetOrgList() {
// Call the method being tested
orgList = orgClient.getOrgList();
orgList = orgApi.getOrgList();
// NOTE The environment MUST have at least one organisation configured
@ -121,7 +121,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
orgURI = orgRef.getHref();
// Call the method being tested
org = orgClient.getOrg(orgURI);
org = orgApi.getOrg(orgURI);
checkOrg(org);
@ -134,14 +134,14 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
* If we're running in an admin context, it's cleaner to make temporary entities, plus eliminates the need for configuration
*/
private void setupAdminMembers() {
adminContext.getApi().getOrgClient().getMetadataClient().setMetadata(toAdminUri(orgURI),
adminContext.getApi().getOrgApi().getMetadataApi().setMetadata(toAdminUri(orgURI),
"KEY", MetadataValue.builder().value("VALUE").build());
AdminCatalog newCatalog = AdminCatalog.builder()
.name("Test Catalog "+getTestDateTimeStamp())
.description("created by testOrg()")
.build();
newCatalog = adminContext.getApi().getCatalogClient().createCatalog(toAdminUri(orgURI), newCatalog);
newCatalog = adminContext.getApi().getCatalogApi().createCatalog(toAdminUri(orgURI), newCatalog);
catalogRef = newCatalog.getHref();
testCatalogId = newCatalog.getId().substring("urn:vcloud:catalog:".length());
@ -153,7 +153,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public void testGetOrgMetadata() {
// Call the method being tested
Metadata metadata = orgClient.getMetadataClient().getMetadata(orgURI);
Metadata metadata = orgApi.getMetadataApi().getMetadata(orgURI);
// NOTE The environment MUST have at one metadata entry for the first organisation configured
@ -166,7 +166,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /org/{id}/metadata/{key}", dependsOnMethods = { "testGetOrgMetadata" })
public void testGetOrgMetadataValue() {
// Call the method being tested
MetadataValue value = orgClient.getMetadataClient().getMetadataValue(orgURI, "KEY");
MetadataValue value = orgApi.getMetadataApi().getMetadataValue(orgURI, "KEY");
// NOTE The environment MUST have configured the metadata entry as '{ key="KEY", value="VALUE" )'
@ -179,7 +179,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /org/{id}/catalog/{catalogId}/controlAccess", dependsOnMethods = { "testGetOrg" })
public void testGetControlAccess() {
// Call the method being tested
ControlAccessParams params = orgClient.getControlAccess(orgURI, testCatalogId);
ControlAccessParams params = orgApi.getControlAccess(orgURI, testCatalogId);
// Check params are well formed
checkControlAccessParams(params);
@ -188,10 +188,10 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "POST /org/{id}/catalog/{catalogId}/action/controlAccess", dependsOnMethods = { "testGetControlAccess" })
public void testModifyControlAccess() {
// Setup params
ControlAccessParams params = orgClient.getControlAccess(orgURI, testCatalogId);
ControlAccessParams params = orgApi.getControlAccess(orgURI, testCatalogId);
// Call the method being tested
ControlAccessParams modified = orgClient.modifyControlAccess(orgURI, testCatalogId, params);
ControlAccessParams modified = orgApi.modifyControlAccess(orgURI, testCatalogId, params);
// Check params are well formed
checkControlAccessParams(modified);

View File

@ -30,17 +30,17 @@ import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultCatalogRecord;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.testng.annotations.Test;
/**
* Test the {@link QueryClient} by observing its side effects.
* Test the {@link QueryApi} by observing its side effects.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "QueryClientExpectTest")
public class QueryClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "QueryApiExpectTest")
public class QueryApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test
public void testQueryAllCatalogs() {
@ -57,7 +57,7 @@ public class QueryClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.payload(payloadFromResourceWithContentType("/query/allCatalogs.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
QueryResultRecords expected = QueryResultRecords.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=records"))
@ -114,7 +114,7 @@ public class QueryClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build())
.build();
assertEquals(client.getQueryClient().catalogsQueryAll(), expected);
assertEquals(api.getQueryApi().catalogsQueryAll(), expected);
}
@Test
@ -130,7 +130,7 @@ public class QueryClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.payload(payloadFromResourceWithContentType("/query/allCatalogReferences.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
CatalogReferences expected = CatalogReferences.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=references"))
@ -175,7 +175,7 @@ public class QueryClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build())
.build();
assertEquals(client.getQueryClient().catalogReferencesQueryAll(), expected);
assertEquals(api.getQueryApi().catalogReferencesQueryAll(), expected);
}
}

View File

@ -48,7 +48,7 @@ import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultVAppRecord;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultVAppTemplateRecord;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultVMRecord;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.jclouds.vcloud.director.v1_5.predicates.ReferencePredicates;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@ -57,20 +57,20 @@ import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
/**
* Tests live behavior of {@link QueryClient}.
* Tests live behavior of {@link QueryApi}.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "QueryClientLiveTest")
public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "QueryApiLiveTest")
public class QueryApiLiveTest extends BaseVCloudDirectorApiLiveTest {
/*
* Convenience references to API clients.
* Convenience references to API apis.
*/
private QueryClient queryClient;
private VAppTemplateClient vAppTemplateClient;
private VAppClient vAppClient;
private QueryApi queryApi;
private VAppTemplateApi vAppTemplateApi;
private VAppApi vAppApi;
private VApp vApp;
@ -81,34 +81,34 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() {
queryClient = context.getApi().getQueryClient();
vAppTemplateClient = context.getApi().getVAppTemplateClient();
vAppClient = context.getApi().getVAppClient();
public void setupRequiredApis() {
queryApi = context.getApi().getQueryApi();
vAppTemplateApi = context.getApi().getVAppTemplateApi();
vAppApi = context.getApi().getVAppApi();
}
@Test(description = "GET /entity/{id}")
public void testEntity() {
// Get a VAppTemplate to look up as an entity
VAppTemplate vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
// Method under test
Entity entity = queryClient.entity(vAppTemplate.getId());
Entity entity = queryApi.entity(vAppTemplate.getId());
// Check returned entity
checkEntityType(entity);
// Retrieve and check template using entity link
Link link = Iterables.find(entity.getLinks(), ReferencePredicates.<Link>typeEquals(VCloudDirectorMediaType.VAPP_TEMPLATE));
VAppTemplate retrieved = vAppTemplateClient.getVAppTemplate(link.getHref());
VAppTemplate retrieved = vAppTemplateApi.getVAppTemplate(link.getHref());
assertEquals(retrieved, vAppTemplate, String.format(ENTITY_EQUAL, "VAppTemplate"));
}
@Test(description = "GET /query")
public void testQuery() {
VAppTemplate vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
QueryResultRecords queryResult = queryClient.query("vAppTemplate", String.format("name==%s", vAppTemplate.getName()));
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
QueryResultRecords queryResult = queryApi.query("vAppTemplate", String.format("name==%s", vAppTemplate.getName()));
Set<URI> hrefs = toHrefs(queryResult);
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null), QueryResultVAppTemplateRecord.class);
@ -117,19 +117,19 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /catalogs/query")
public void testQueryAllCatalogs() {
QueryResultRecords catalogRecords = queryClient.catalogsQueryAll();
QueryResultRecords catalogRecords = queryApi.catalogsQueryAll();
assertFalse(catalogRecords.getRecords().isEmpty(), String.format(NOT_EMPTY_OBJECT_FMT, "CatalogRecord", "QueryResultRecords"));
}
@Test(description = "GET /catalogs/query?format=references", dependsOnMethods = { "testQueryAllCatalogs" })
public void testQueryAllCatalogReferences() {
CatalogReferences catalogReferences = queryClient.catalogReferencesQueryAll();
CatalogReferences catalogReferences = queryApi.catalogReferencesQueryAll();
assertFalse(catalogReferences.getReferences().isEmpty(), String.format(NOT_EMPTY_OBJECT_FMT, "CatalogReference", "CatalogReferences"));
}
@Test(description = "GET /vAppTemplates/query")
public void testQueryAllVAppTemplates() {
QueryResultRecords queryResult = queryClient.vAppTemplatesQueryAll();
QueryResultRecords queryResult = queryApi.vAppTemplatesQueryAll();
Set<URI> hrefs = toHrefs(queryResult);
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null), QueryResultVAppTemplateRecord.class);
@ -138,8 +138,8 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /vAppTemplates/query?filter")
public void testQueryVAppTemplatesWithFilter() {
VAppTemplate vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
QueryResultRecords queryResult = queryClient.vAppTemplatesQuery(String.format("name==%s", vAppTemplate.getName()));
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
QueryResultRecords queryResult = queryApi.vAppTemplatesQuery(String.format("name==%s", vAppTemplate.getName()));
Set<URI> hrefs = toHrefs(queryResult);
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP_TEMPLATE, null), QueryResultVAppTemplateRecord.class);
@ -150,7 +150,7 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public void testQueryAllVApps() {
vApp = instantiateVApp();
QueryResultRecords queryResult = queryClient.vAppsQueryAll();
QueryResultRecords queryResult = queryApi.vAppsQueryAll();
Set<URI> hrefs = toHrefs(queryResult);
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP, null), QueryResultVAppRecord.class);
@ -159,7 +159,7 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /vApps/query?filter", dependsOnMethods = { "testQueryAllVApps" } )
public void testQueryVAppsWithFilter() {
QueryResultRecords queryResult = queryClient.vAppsQuery(String.format("name==%s", vApp.getName()));
QueryResultRecords queryResult = queryApi.vAppsQuery(String.format("name==%s", vApp.getName()));
Set<URI> hrefs = toHrefs(queryResult);
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP, null), QueryResultVAppRecord.class);
@ -175,15 +175,15 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
}
// Start the vApp so that it has VMs
Task task = vAppClient.powerOn(vApp.getHref());
Task task = vAppApi.powerOn(vApp.getHref());
assertTaskSucceedsLong(task);
vApp = vAppClient.getVApp(vApp.getHref()); // reload, so it has the VMs
vApp = vAppApi.getVApp(vApp.getHref()); // reload, so it has the VMs
List<Vm> vms = vApp.getChildren().getVms();
Set<URI> vmHrefs = toHrefs(vms);
// Method under test: do the query
QueryResultRecords queryResult = queryClient.vmsQueryAll();
QueryResultRecords queryResult = queryApi.vmsQueryAll();
Set<URI> hrefs = toHrefs(queryResult);
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VM, null), QueryResultVMRecord.class);
@ -195,7 +195,7 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
List<Vm> vms = vApp.getChildren().getVms();
Set<URI> vmHrefs = toHrefs(vms);
QueryResultRecords queryResult = queryClient.vmsQuery(String.format("containerName==%s", vApp.getName()));
QueryResultRecords queryResult = queryApi.vmsQuery(String.format("containerName==%s", vApp.getName()));
Set<URI> hrefs = toHrefs(queryResult);
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VM, null), QueryResultVMRecord.class);
@ -204,7 +204,7 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /mediaList/query")
public void testQueryAllMedia() {
QueryResultRecords queryResult = queryClient.mediaListQueryAll();
QueryResultRecords queryResult = queryApi.mediaListQueryAll();
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP, null), QueryResultMediaRecord.class);
}
@ -212,7 +212,7 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /mediaList/query?filter")
public void testQueryMediaWithFilter() {
String mediaName = "abc";
QueryResultRecords queryResult = queryClient.mediaListQuery(String.format("name==%s", mediaName));
QueryResultRecords queryResult = queryApi.mediaListQuery(String.format("name==%s", mediaName));
assertRecordTypes(queryResult, Arrays.asList(VCloudDirectorMediaType.VAPP, null), QueryResultMediaRecord.class);
}

View File

@ -32,17 +32,17 @@ import org.jclouds.vcloud.director.v1_5.domain.Error;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.testng.annotations.Test;
/**
* Test the {@link TaskClient} by observing its side effects.
* Test the {@link TaskApi} by observing its side effects.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "TaskClientExpectTest")
public class TaskClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "TaskApiExpectTest")
public class TaskApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test
public void testTaskListForValidOrg() {
@ -69,7 +69,7 @@ public class TaskClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.payload(payloadFromResourceWithContentType("/org/org.xml", VCloudDirectorMediaType.TASKS_LIST + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse);
TasksList expected = TasksList.builder()
.name("Tasks Lists")
@ -79,7 +79,7 @@ public class TaskClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.task(taskTwo())
.build();
assertEquals(client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")), expected);
assertEquals(api.getTaskApi().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")), expected);
}
@Test
@ -102,7 +102,7 @@ public class TaskClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.payload(payloadFromResourceWithContentType("/org/error400.xml", VCloudDirectorMediaType.ERROR + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse);
Error expected = Error.builder()
.message("validation error on field 'id': String value has invalid format or length")
@ -111,7 +111,7 @@ public class TaskClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
try {
client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/NOTAUUID"));
api.getTaskApi().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/NOTAUUID"));
fail("Should give HTTP 400 error");
} catch (VCloudDirectorException vde) {
assertEquals(vde.getError(), expected);
@ -141,9 +141,9 @@ public class TaskClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.payload(payloadFromResourceWithContentType("/org/error403-fake.xml", VCloudDirectorMediaType.ERROR + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse);
assertNull(client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")));
assertNull(api.getTaskApi().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")));
}
@Test
@ -159,14 +159,14 @@ public class TaskClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.payload(payloadFromResourceWithContentType("/task/task.xml", VCloudDirectorMediaType.TASK + ";version=1.5"))
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse);
URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b");
//TODO: incorrect relationship, as task should not have a nested task container!!
Task expected = taskOne();
assertEquals(client.getTaskClient().getTask(taskUri), expected);
assertEquals(api.getTaskApi().getTask(taskUri), expected);
}
@Test
@ -181,11 +181,11 @@ public class TaskClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.statusCode(200)
.build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse);
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse);
URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b");
client.getTaskClient().cancelTask(taskUri);
api.getTaskApi().cancelTask(taskUri);
}
public static Task taskOne() {

View File

@ -30,7 +30,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgList;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -39,19 +39,19 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
/**
* Tests live behavior of {@link TaskClient}.
* Tests live behavior of {@link TaskApi}.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "TaskClientLiveTest")
public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "TaskApiLiveTest")
public class TaskApiLiveTest extends BaseVCloudDirectorApiLiveTest {
/*
* Convenience references to API clients.
* Convenience references to API apis.
*/
private OrgClient orgClient;
private TaskClient taskClient;
private OrgApi orgApi;
private TaskApi taskApi;
/*
* Shared state between dependant tests.
@ -67,9 +67,9 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() {
orgClient = context.getApi().getOrgClient();
taskClient = context.getApi().getTaskClient();
public void setupRequiredApis() {
orgApi = context.getApi().getOrgApi();
taskApi = context.getApi().getTaskApi();
}
@AfterClass(alwaysRun = true)
@ -79,13 +79,13 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /tasksList/{id}")
public void testGetTaskList() {
orgList = orgClient.getOrgList();
orgList = orgApi.getOrgList();
Reference orgRef = Iterables.getFirst(orgList.getOrgs(), null);
assertNotNull(orgRef);
orgURI = orgRef.getHref();
// Call the method being tested
taskList = taskClient.getTaskList(orgURI);
taskList = taskApi.getTaskList(orgURI);
// NOTE The environment MUST have ...
@ -105,7 +105,7 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
taskURI = taskRef.getHref();
// Call the method being tested
task = taskClient.getTask(taskURI);
task = taskApi.getTask(taskURI);
// Check required elements and attributes
checkTask(task);
@ -122,7 +122,7 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
assertTaskStatusEventually(task, Task.Status.RUNNING, ImmutableSet.of(Task.Status.ERROR, Task.Status.ABORTED));
// Call the method being tested
taskClient.cancelTask(taskURI);
taskApi.cancelTask(taskURI);
assertTaskStatusEventually(task, Task.Status.CANCELED, ImmutableSet.of(Task.Status.ERROR, Task.Status.ABORTED, Task.Status.SUCCESS));
}
}

View File

@ -18,29 +18,29 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Tests behavior of {@link NetworkClient}
* Tests behavior of {@link NetworkApi}
*
* @author danikov
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "UploadClientLiveTest")
public class UploadClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "UploadApiLiveTest")
public class UploadApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public static final String UPLOAD = "upload";
/*
* Convenience reference to API client.
* Convenience reference to API api.
*/
protected UploadClient uploadClient;
protected UploadApi uploadApi;
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() {
uploadClient = context.getApi().getUploadClient();
public void setupRequiredApis() {
uploadApi = context.getApi().getUploadApi();
}
@Test(description = "PUT ???", enabled = false)

View File

@ -48,19 +48,19 @@ import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection;
import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.internal.annotations.Sets;
/**
* Allows us to test the {@link VAppClient} via its side effects.
* Allows us to test the {@link VAppApi} via its side effects.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "VAppClientExpectTest")
public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "VAppApiExpectTest")
public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
private String vAppId = "vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be";
private URI vAppURI = URI.create(endpoint + vAppId);
@ -71,7 +71,7 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(enabled = false)//TODO
public void testGetVapp() {
VCloudDirectorClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId)
.acceptMedia(VCloudDirectorMediaType.VAPP)
@ -82,12 +82,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
VApp expected = getVApp();
assertEquals(client.getVAppClient().getVApp(vAppURI), expected);
assertEquals(api.getVAppApi().getVApp(vAppURI), expected);
}
@Test(enabled = false)
public void testModifyVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId)
.xmlFilePayload("/vApp/modifyVApp.xml", VCloudDirectorMediaType.VAPP)
@ -103,12 +103,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyVAppTask();
assertEquals(client.getVAppClient().modifyVApp(vAppURI, modified), expected);
assertEquals(api.getVAppApi().modifyVApp(vAppURI, modified), expected);
}
@Test(enabled = false)
public void testDeleteVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("DELETE", vAppId)
.acceptAnyMedia()
@ -119,12 +119,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = deleteVAppTask();
assertEquals(client.getVAppClient().deleteVApp(vAppURI), expected);
assertEquals(api.getVAppApi().deleteVApp(vAppURI), expected);
}
@Test(enabled = false)
public void testControlAccess() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/controlAccess")
.xmlFilePayload("/vApp/controlAccessParams.xml", VCloudDirectorMediaType.CONTROL_ACCESS)
@ -138,12 +138,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
ControlAccessParams expected = controlAccessParams();
assertEquals(client.getVAppClient().modifyControlAccess(vAppURI, params), expected);
assertEquals(api.getVAppApi().modifyControlAccess(vAppURI, params), expected);
}
@Test(enabled = false)
public void testDeploy() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/deploy")
.xmlFilePayload("/vApp/deployParams.xml", VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS)
@ -158,12 +158,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = deployTask();
assertEquals(client.getVAppClient().deploy(vAppURI, params), expected);
assertEquals(api.getVAppApi().deploy(vAppURI, params), expected);
}
@Test(enabled = false)
public void testDiscardSuspendedState() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/discardSuspendedState")
.acceptAnyMedia()
@ -174,12 +174,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = discardSuspendedStateTask();
assertEquals(client.getVAppClient().discardSuspendedState(vAppURI), expected);
assertEquals(api.getVAppApi().discardSuspendedState(vAppURI), expected);
}
@Test(enabled = false)
public void testEnterMaintenanceMode() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/enterMaintenanceMode")
.acceptAnyMedia()
@ -188,12 +188,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.httpResponseBuilder().statusCode(204).build());
// TODO how to test?
client.getVAppClient().enterMaintenanceMode(vAppURI);
api.getVAppApi().enterMaintenanceMode(vAppURI);
}
@Test(enabled = false)
public void testExitMaintenanceMode() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/exitMaintenanceMode")
.acceptAnyMedia()
@ -202,12 +202,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.httpResponseBuilder().statusCode(204).build());
// TODO how to test?
client.getVAppClient().exitMaintenanceMode(vAppURI);
api.getVAppApi().exitMaintenanceMode(vAppURI);
}
@Test(enabled = false)
public void testRecomposeVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/recomposeVApp")
.xmlFilePayload("/vApp/recomposeVAppParams.xml", VCloudDirectorMediaType.RECOMPOSE_VAPP_PARAMS)
@ -222,12 +222,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = recomposeVAppTask();
assertEquals(client.getVAppClient().recompose(vAppURI, params), expected);
assertEquals(api.getVAppApi().recompose(vAppURI, params), expected);
}
@Test(enabled = false)
public void testUndeploy() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/undeploy")
.xmlFilePayload("/vApp/undeployParams.xml", VCloudDirectorMediaType.UNDEPLOY_VAPP_PARAMS)
@ -242,12 +242,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = undeployTask();
assertEquals(client.getVAppClient().undeploy(vAppURI, params), expected);
assertEquals(api.getVAppApi().undeploy(vAppURI, params), expected);
}
@Test(enabled = false)
public void testPowerOff() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/powerOff")
.acceptAnyMedia()
@ -258,12 +258,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = powerOffTask();
assertEquals(client.getVAppClient().powerOff(vAppURI), expected);
assertEquals(api.getVAppApi().powerOff(vAppURI), expected);
}
@Test(enabled = false)
public void testPowerOn() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/powerOn")
.acceptAnyMedia()
@ -274,12 +274,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = powerOnTask();
assertEquals(client.getVAppClient().powerOn(vAppURI), expected);
assertEquals(api.getVAppApi().powerOn(vAppURI), expected);
}
@Test(enabled = false)
public void testReboot() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/reboot")
.acceptAnyMedia()
@ -290,12 +290,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = rebootTask();
assertEquals(client.getVAppClient().reboot(vAppURI), expected);
assertEquals(api.getVAppApi().reboot(vAppURI), expected);
}
@Test(enabled = false)
public void testReset() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/reset")
.acceptAnyMedia()
@ -306,12 +306,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = resetTask();
assertEquals(client.getVAppClient().reset(vAppURI), expected);
assertEquals(api.getVAppApi().reset(vAppURI), expected);
}
@Test(enabled = false)
public void testShutdown() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/shutdown")
.acceptAnyMedia()
@ -322,12 +322,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = shutdownTask();
assertEquals(client.getVAppClient().shutdown(vAppURI), expected);
assertEquals(api.getVAppApi().shutdown(vAppURI), expected);
}
@Test(enabled = false)
public void testSuspend() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/suspend")
.acceptAnyMedia()
@ -338,12 +338,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = suspendTask();
assertEquals(client.getVAppClient().suspend(vAppURI), expected);
assertEquals(api.getVAppApi().suspend(vAppURI), expected);
}
@Test(enabled = false)
public void testGetControlAccesss() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/controlAccess")
.acceptAnyMedia()
@ -354,12 +354,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
ControlAccessParams expected = getControlAccessParams();
assertEquals(client.getVAppClient().getControlAccess(vAppURI), expected);
assertEquals(api.getVAppApi().getControlAccess(vAppURI), expected);
}
@Test(enabled = false)
public void testGetLeaseSettingsSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/leaseSettingsSection")
.acceptAnyMedia()
@ -370,12 +370,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
LeaseSettingsSection expected = getLeaseSettingsSection();
assertEquals(client.getVAppClient().getLeaseSettingsSection(vAppURI), expected);
assertEquals(api.getVAppApi().getLeaseSettingsSection(vAppURI), expected);
}
@Test(enabled = false)
public void testModifyLeaseSettingsSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/leaseSettingsSection")
.xmlFilePayload("/vApp/modifyLeaseSettingsSection.xml", VCloudDirectorMediaType.LEASE_SETTINGS_SECTION)
@ -390,12 +390,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyLeaseSettingsSectionTask();
assertEquals(client.getVAppClient().modifyLeaseSettingsSection(vAppURI, section), expected);
assertEquals(api.getVAppApi().modifyLeaseSettingsSection(vAppURI, section), expected);
}
@Test(enabled = false)
public void testGetNetworkConfigSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/networkConfigSection")
.acceptAnyMedia()
@ -406,12 +406,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
NetworkConfigSection expected = getNetworkConfigSection();
assertEquals(client.getVAppClient().getNetworkConfigSection(vAppURI), expected);
assertEquals(api.getVAppApi().getNetworkConfigSection(vAppURI), expected);
}
@Test(enabled = false)
public void testModifyNetworkConfigSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/networkConfigSection")
.xmlFilePayload("/vApp/modifyNetworkConfigSection.xml", VCloudDirectorMediaType.NETWORK_CONFIG_SECTION)
@ -426,12 +426,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyNetworkConfigSectionTask();
assertEquals(client.getVAppClient().modifyNetworkConfigSection(vAppURI, section), expected);
assertEquals(api.getVAppApi().modifyNetworkConfigSection(vAppURI, section), expected);
}
@Test(enabled = false)
public void testGetNetworkSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/networkSection")
.acceptAnyMedia()
@ -442,12 +442,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
NetworkSection expected = getNetworkSection();
assertEquals(client.getVAppClient().getNetworkSection(vAppURI), expected);
assertEquals(api.getVAppApi().getNetworkSection(vAppURI), expected);
}
@Test(enabled = false)
public void testGetOwner() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/owner")
.acceptAnyMedia()
@ -458,12 +458,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Owner expected = getOwner();
assertEquals(client.getVAppClient().getOwner(vAppURI), expected);
assertEquals(api.getVAppApi().getOwner(vAppURI), expected);
}
@Test(enabled = false)
public void testModifyOwner() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/owner")
.xmlFilePayload("/vApp/modifyOwner.xml", VCloudDirectorMediaType.OWNER)
@ -475,12 +475,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Owner owner = Owner.builder()
.build();
client.getVAppClient().modifyOwner(vAppURI, owner);
api.getVAppApi().modifyOwner(vAppURI, owner);
}
@Test(enabled = false)
public void testGetProductSections() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/productSections")
.acceptAnyMedia()
@ -491,12 +491,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
ProductSectionList expected = getProductSections();
assertEquals(client.getVAppClient().getProductSections(vAppURI), expected);
assertEquals(api.getVAppApi().getProductSections(vAppURI), expected);
}
@Test(enabled = false)
public void testModifyProductSections() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/productSections")
.xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST)
@ -508,12 +508,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyProductSectionsTask();
assertEquals(client.getVAppClient().modifyProductSections(vAppURI, null), expected);
assertEquals(api.getVAppApi().modifyProductSections(vAppURI, null), expected);
}
@Test(enabled = false)
public void testGetStartupSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/startupSection")
.acceptAnyMedia()
@ -524,12 +524,12 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
StartupSection expected = getStartupSection();
assertEquals(client.getVAppClient().getStartupSection(vAppURI), expected);
assertEquals(api.getVAppApi().getStartupSection(vAppURI), expected);
}
@Test(enabled = false)
public void testModifyStartupSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/startupSection")
.xmlFilePayload("/vApp/modifyStartupSection.xml", VCloudDirectorMediaType.STARTUP_SECTION)
@ -544,7 +544,7 @@ public class VAppClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyStartupSectionTask();
assertEquals(client.getVAppClient().modifyStartupSection(vAppURI, section), expected);
assertEquals(api.getVAppApi().modifyStartupSection(vAppURI, section), expected);
}
public static VApp getVApp() {

View File

@ -60,7 +60,7 @@ import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.ProductSection;
import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.io.Payloads;
import org.jclouds.vcloud.director.v1_5.AbstractVAppClientLiveTest;
import org.jclouds.vcloud.director.v1_5.AbstractVAppApiLiveTest;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.AccessSetting;
import org.jclouds.vcloud.director.v1_5.domain.Checks;
@ -90,12 +90,12 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
/**
* Tests behavior of the {@link VAppClient}.
* Tests behavior of the {@link VAppApi}.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VAppClientLiveTest")
public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VAppApiLiveTest")
public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
private MetadataValue metadataValue;
private String key;
@ -103,9 +103,9 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
private boolean mediaCreated = false;
private boolean testUserCreated = false;
@BeforeClass(alwaysRun = true, dependsOnMethods = { "setupRequiredClients" })
@BeforeClass(alwaysRun = true, dependsOnMethods = { "setupRequiredApis" })
protected void setupRequiredEntities() {
Set<Link> links = vdcClient.getVdc(vdcURI).getLinks();
Set<Link> links = vdcApi.getVdc(vdcURI).getLinks();
if (mediaURI == null) {
Predicate<Link> addMediaLink = and(relEquals(Link.Rel.ADD), typeEquals(VCloudDirectorMediaType.MEDIA));
@ -119,21 +119,21 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
.name(name("media"))
.size(iso.length)
.imageType(Media.ImageType.ISO)
.description("Test media generated by VAppClientLiveTest")
.description("Test media generated by VAppApiLiveTest")
.build();
Media media = context.getApi().getMediaClient().createMedia(addMedia.getHref(), sourceMedia);
Media media = context.getApi().getMediaApi().createMedia(addMedia.getHref(), sourceMedia);
Link uploadLink = getFirst(getFirst(media.getFiles(), null).getLinks(), null);
context.getApi().getUploadClient().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
media = context.getApi().getMediaClient().getMedia(media.getHref());
media = context.getApi().getMediaApi().getMedia(media.getHref());
if (media.getTasks().size() == 1) {
Task uploadTask = Iterables.getOnlyElement(media.getTasks());
Checks.checkTask(uploadTask);
assertEquals(uploadTask.getStatus(), Task.Status.RUNNING);
assertTrue(retryTaskSuccess.apply(uploadTask), String.format(TASK_COMPLETE_TIMELY, "uploadTask"));
media = context.getApi().getMediaClient().getMedia(media.getHref());
media = context.getApi().getMediaApi().getMedia(media.getHref());
}
mediaURI = media.getHref();
@ -143,7 +143,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
if (adminContext != null) {
Link orgLink = find(links, and(relEquals("up"), typeEquals(VCloudDirectorMediaType.ORG)));
testUserURI = adminContext.getApi().getUserClient().createUser(toAdminUri(orgLink), randomTestUser("VAppAccessTest")).getHref();
testUserURI = adminContext.getApi().getUserApi().createUser(toAdminUri(orgLink), randomTestUser("VAppAccessTest")).getHref();
} else {
testUserURI = userURI;
}
@ -153,7 +153,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
public void cleanUp() {
if (adminContext != null && mediaCreated && mediaURI != null) {
try {
Task delete = context.getApi().getMediaClient().deleteMedia(mediaURI);
Task delete = context.getApi().getMediaApi().deleteMedia(mediaURI);
taskDoneEventually(delete);
} catch (Exception e) {
logger.warn(e, "Error when deleting media");
@ -161,7 +161,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
}
if (adminContext != null && testUserCreated && testUserURI != null) {
try {
adminContext.getApi().getUserClient().deleteUser(testUserURI);
adminContext.getApi().getUserApi().deleteUser(testUserURI);
} catch (Exception e) {
logger.warn(e, "Error when deleting user");
}
@ -169,12 +169,12 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
}
/**
* @see VAppClient#getVApp(URI)
* @see VAppApi#getVApp(URI)
*/
@Test(description = "GET /vApp/{id}")
public void testGetVApp() {
// The method under test
vApp = vAppClient.getVApp(vAppURI);
vApp = vAppApi.getVApp(vAppURI);
// Check the retrieved object is well formed
checkVApp(vApp);
@ -192,7 +192,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
}
/**
* @see VAppClient#modifyVApp(URI, VApp)
* @see VAppApi#modifyVApp(URI, VApp)
*/
@Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVApp" })
public void testModifyVApp() {
@ -203,11 +203,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
vAppNames.add(newVApp.getName());
// The method under test
Task modifyVApp = vAppClient.modifyVApp(vApp.getHref(), newVApp);
Task modifyVApp = vAppApi.modifyVApp(vApp.getHref(), newVApp);
assertTrue(retryTaskSuccess.apply(modifyVApp), String.format(TASK_COMPLETE_TIMELY, "modifyVApp"));
// Get the updated VApp
vApp = vAppClient.getVApp(vApp.getHref());
vApp = vAppApi.getVApp(vApp.getHref());
// Check the required fields are set
assertEquals(vApp.getName(), newVApp.getName(), String.format(OBJ_FIELD_EQ, VAPP, "Name", newVApp.getName(), vApp.getName()));
@ -223,11 +223,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task deployVApp = vAppClient.deploy(vApp.getHref(), params);
Task deployVApp = vAppApi.deploy(vApp.getHref(), params);
assertTrue(retryTaskSuccessLong.apply(deployVApp), String.format(TASK_COMPLETE_TIMELY, "deployVApp"));
// Get the updated VApp
vApp = vAppClient.getVApp(vApp.getHref());
vApp = vAppApi.getVApp(vApp.getHref());
// Check the required fields are set
assertTrue(vApp.isDeployed(), String.format(OBJ_FIELD_EQ, VAPP, "deployed", "TRUE", vApp.isDeployed().toString()));
@ -242,11 +242,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
vApp = powerOffVApp(vApp.getHref());
// The method under test
Task powerOnVApp = vAppClient.powerOn(vApp.getHref());
Task powerOnVApp = vAppApi.powerOn(vApp.getHref());
assertTaskSucceedsLong(powerOnVApp);
// Get the updated VApp
vApp = vAppClient.getVApp(vApp.getHref());
vApp = vAppApi.getVApp(vApp.getHref());
// Check status
assertVAppStatus(vAppURI, Status.POWERED_ON);
@ -258,11 +258,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
vApp = powerOnVApp(vApp.getHref());
// The method under test
Task reboot = vAppClient.reboot(vApp.getHref());
Task reboot = vAppApi.reboot(vApp.getHref());
assertTaskSucceedsLong(reboot);
// Get the updated VApp
vApp = vAppClient.getVApp(vApp.getHref());
vApp = vAppApi.getVApp(vApp.getHref());
// Check status
assertVAppStatus(vAppURI, Status.POWERED_OFF);
@ -274,11 +274,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
vApp = powerOnVApp(vApp.getHref());
// The method under test
Task shutdown = vAppClient.shutdown(vAppURI);
Task shutdown = vAppApi.shutdown(vAppURI);
assertTaskSucceedsLong(shutdown);
// Get the updated VApp
vApp = vAppClient.getVApp(vAppURI);
vApp = vAppApi.getVApp(vAppURI);
// Check status
assertVAppStatus(vAppURI, Status.POWERED_OFF);
@ -293,11 +293,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
vApp = powerOnVApp(vApp.getHref());
// The method under test
Task suspend = vAppClient.suspend(vAppURI);
Task suspend = vAppApi.suspend(vAppURI);
assertTaskSucceedsLong(suspend);
// Get the updated VApp
vApp = vAppClient.getVApp(vApp.getHref());
vApp = vAppApi.getVApp(vApp.getHref());
// Check status
assertVAppStatus(vAppURI, Status.SUSPENDED);
@ -312,11 +312,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
vApp = powerOnVApp(vApp.getHref());
// The method under test
Task reset = vAppClient.reset(vAppURI);
Task reset = vAppApi.reset(vAppURI);
assertTaskSucceedsLong(reset);
// Get the updated VApp
vApp = vAppClient.getVApp(vAppURI);
vApp = vAppApi.getVApp(vAppURI);
// Check status
assertVAppStatus(vAppURI, Status.POWERED_ON);
@ -330,11 +330,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
UndeployVAppParams params = UndeployVAppParams.builder().build();
// The method under test
Task undeploy = vAppClient.undeploy(vApp.getHref(), params);
Task undeploy = vAppApi.undeploy(vApp.getHref(), params);
assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
// Get the updated VApp
vApp = vAppClient.getVApp(vAppURI);
vApp = vAppApi.getVApp(vAppURI);
// Check status
assertFalse(vApp.isDeployed(), String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString()));
@ -347,11 +347,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
vApp = powerOnVApp(vApp.getHref());
// The method under test
Task powerOffVApp = vAppClient.powerOff(vApp.getHref());
Task powerOffVApp = vAppApi.powerOff(vApp.getHref());
assertTrue(retryTaskSuccess.apply(powerOffVApp), String.format(TASK_COMPLETE_TIMELY, "powerOffVApp"));
// Get the updated VApp
vApp = vAppClient.getVApp(vAppURI);
vApp = vAppApi.getVApp(vAppURI);
// Check status
assertVAppStatus(vAppURI, Status.POWERED_OFF);
@ -368,7 +368,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
ControlAccessParams modified = vAppClient.modifyControlAccess(vApp.getHref(), params);
ControlAccessParams modified = vAppApi.modifyControlAccess(vApp.getHref(), params);
// Check the retrieved object is well formed
checkControlAccessParams(modified);
@ -384,7 +384,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
ControlAccessParams modified = vAppClient.modifyControlAccess(vApp.getHref(), params);
ControlAccessParams modified = vAppApi.modifyControlAccess(vApp.getHref(), params);
// Check the retrieved object is well formed
checkControlAccessParams(modified);
@ -400,7 +400,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
vApp = suspendVApp(vAppURI);
// The method under test
Task discardSuspendedState = vAppClient.discardSuspendedState(vApp.getHref());
Task discardSuspendedState = vAppApi.discardSuspendedState(vApp.getHref());
assertTrue(retryTaskSuccess.apply(discardSuspendedState), String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
}
@ -413,18 +413,18 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
.notForceCustomization()
.notPowerOn()
.build();
Task deployVApp = vAppClient.deploy(temp.getHref(), params);
Task deployVApp = vAppApi.deploy(temp.getHref(), params);
assertTaskSucceedsLong(deployVApp);
try {
// Method under test
vAppClient.enterMaintenanceMode(temp.getHref());
vAppApi.enterMaintenanceMode(temp.getHref());
temp = vAppClient.getVApp(temp.getHref());
temp = vAppApi.getVApp(temp.getHref());
assertTrue(temp.isInMaintenanceMode(), String.format(CONDITION_FMT, "InMaintenanceMode", "TRUE", temp.isInMaintenanceMode()));
// Exit maintenance mode
vAppClient.exitMaintenanceMode(temp.getHref());
vAppApi.exitMaintenanceMode(temp.getHref());
} finally {
cleanUpVApp(temp);
}
@ -439,17 +439,17 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
.notForceCustomization()
.notPowerOn()
.build();
Task deployVApp = vAppClient.deploy(temp.getHref(), params);
Task deployVApp = vAppApi.deploy(temp.getHref(), params);
assertTaskSucceedsLong(deployVApp);
try {
// Enter maintenance mode
vAppClient.enterMaintenanceMode(temp.getHref());
vAppApi.enterMaintenanceMode(temp.getHref());
// Method under test
vAppClient.exitMaintenanceMode(temp.getHref());
vAppApi.exitMaintenanceMode(temp.getHref());
temp = vAppClient.getVApp(temp.getHref());
temp = vAppApi.getVApp(temp.getHref());
assertFalse(temp.isInMaintenanceMode(), String.format(CONDITION_FMT, "InMaintenanceMode", "FALSE", temp.isInMaintenanceMode()));
} finally {
cleanUpVApp(temp);
@ -464,14 +464,14 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
RecomposeVAppParams params = RecomposeVAppParams.builder().build();
// The method under test
Task recomposeVApp = vAppClient.recompose(vApp.getHref(), params);
Task recomposeVApp = vAppApi.recompose(vApp.getHref(), params);
assertTrue(retryTaskSuccess.apply(recomposeVApp), String.format(TASK_COMPLETE_TIMELY, "recomposeVApp"));
}
@Test(description = "GET /vApp/{id}/controlAccess", dependsOnMethods = { "testGetVApp" })
public void testGetControlAccess() {
// The method under test
ControlAccessParams controlAccess = vAppClient.getControlAccess(vApp.getHref());
ControlAccessParams controlAccess = vAppApi.getControlAccess(vApp.getHref());
// Check the retrieved object is well formed
checkControlAccessParams(controlAccess);
@ -480,7 +480,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetVApp" })
public void testGetLeaseSettingsSection() {
// The method under test
LeaseSettingsSection section = vAppClient.getLeaseSettingsSection(vApp.getHref());
LeaseSettingsSection section = vAppApi.getLeaseSettingsSection(vApp.getHref());
// Check the retrieved object is well formed
checkLeaseSettingsSection(section);
@ -489,18 +489,18 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetLeaseSettingsSection" })
public void testModifyLeaseSettingsSection() {
// Copy existing section
LeaseSettingsSection oldSection = vAppClient.getLeaseSettingsSection(vApp.getHref());
LeaseSettingsSection oldSection = vAppApi.getLeaseSettingsSection(vApp.getHref());
Integer twoHours = (int) TimeUnit.SECONDS.convert(2L, TimeUnit.HOURS);
LeaseSettingsSection newSection = oldSection.toBuilder()
.deploymentLeaseInSeconds(twoHours)
.build();
// The method under test
Task modifyLeaseSettingsSection = vAppClient.modifyLeaseSettingsSection(vApp.getHref(), newSection);
Task modifyLeaseSettingsSection = vAppApi.modifyLeaseSettingsSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyLeaseSettingsSection), String.format(TASK_COMPLETE_TIMELY, "modifyLeaseSettingsSection"));
// Retrieve the modified section
LeaseSettingsSection modified = vAppClient.getLeaseSettingsSection(vApp.getHref());
LeaseSettingsSection modified = vAppApi.getLeaseSettingsSection(vApp.getHref());
// Check the retrieved object is well formed
checkLeaseSettingsSection(modified);
@ -538,7 +538,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/networkConfigSection", dependsOnMethods = { "testGetVApp" })
public void testGetNetworkConfigSection() {
// The method under test
NetworkConfigSection section = vAppClient.getNetworkConfigSection(vApp.getHref());
NetworkConfigSection section = vAppApi.getNetworkConfigSection(vApp.getHref());
// Check the retrieved object is well formed
checkNetworkConfigSection(section);
@ -547,16 +547,16 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/networkConfigSection", dependsOnMethods = { "testGetNetworkConfigSection" })
public void testModifyNetworkConfigSection() {
// Copy existing section and update fields
NetworkConfigSection oldSection = vAppClient.getNetworkConfigSection(vApp.getHref());
NetworkConfigSection oldSection = vAppApi.getNetworkConfigSection(vApp.getHref());
NetworkConfigSection newSection = oldSection.toBuilder()
.build();
// The method under test
Task modifyNetworkConfigSection = vAppClient.modifyNetworkConfigSection(vApp.getHref(), newSection);
Task modifyNetworkConfigSection = vAppApi.modifyNetworkConfigSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyNetworkConfigSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConfigSection"));
// Retrieve the modified section
NetworkConfigSection modified = vAppClient.getNetworkConfigSection(vApp.getHref());
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vApp.getHref());
// Check the retrieved object is well formed
checkNetworkConfigSection(modified);
@ -571,7 +571,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/networkSection", dependsOnMethods = { "testGetVApp" })
public void testGetNetworkSection() {
// The method under test
NetworkSection section = vAppClient.getNetworkSection(vApp.getHref());
NetworkSection section = vAppApi.getNetworkSection(vApp.getHref());
// Check the retrieved object is well formed
checkNetworkSection(section);
@ -580,7 +580,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/owner", dependsOnMethods = { "testGetVApp" })
public void testGetOwner() {
// The method under test
Owner owner = vAppClient.getOwner(vApp.getHref());
Owner owner = vAppApi.getOwner(vApp.getHref());
// Check the retrieved object is well formed
checkOwner(owner);
@ -591,10 +591,10 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
Owner newOwner = Owner.builder().user(Reference.builder().href(testUserURI).type(ADMIN_USER).build()).build();
// The method under test
vAppClient.modifyOwner(vApp.getHref(), newOwner);
vAppApi.modifyOwner(vApp.getHref(), newOwner);
// Get the new VApp owner
Owner modified = vAppClient.getOwner(vApp.getHref());
Owner modified = vAppApi.getOwner(vApp.getHref());
// Check the retrieved object is well formed
checkOwner(modified);
@ -606,7 +606,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/productSections", dependsOnMethods = { "testGetVApp" })
public void testGetProductSections() {
// The method under test
ProductSectionList sectionList = vAppClient.getProductSections(vApp.getHref());
ProductSectionList sectionList = vAppApi.getProductSections(vApp.getHref());
// Check the retrieved object is well formed
checkProductSectionList(sectionList);
@ -615,7 +615,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
public void testModifyProductSections() {
// Copy existing section and update fields
ProductSectionList oldSections = vAppClient.getProductSections(vApp.getHref());
ProductSectionList oldSections = vAppApi.getProductSections(vApp.getHref());
ProductSectionList newSections = oldSections.toBuilder()
.productSection(ProductSection.builder()
.info("Information about the installed software") // Default ovf:Info text
@ -627,11 +627,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task modifyProductSections = vAppClient.modifyProductSections(vApp.getHref(), newSections);
Task modifyProductSections = vAppApi.modifyProductSections(vApp.getHref(), newSections);
assertTrue(retryTaskSuccess.apply(modifyProductSections), String.format(TASK_COMPLETE_TIMELY, "modifyProductSections"));
// Retrieve the modified section
ProductSectionList modified = vAppClient.getProductSections(vApp.getHref());
ProductSectionList modified = vAppApi.getProductSections(vApp.getHref());
// Check the retrieved object is well formed
checkProductSectionList(modified);
@ -646,7 +646,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/startupSection", dependsOnMethods = { "testGetVApp" })
public void testGetStartupSection() {
// The method under test
StartupSection section = vAppClient.getStartupSection(vApp.getHref());
StartupSection section = vAppApi.getStartupSection(vApp.getHref());
// Check the retrieved object is well formed
checkStartupSection(section);
@ -655,15 +655,15 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/startupSection", dependsOnMethods = { "testGetStartupSection" })
public void testModifyStartupSection() {
// Copy existing section and update fields
StartupSection oldSection = vAppClient.getStartupSection(vApp.getHref());
StartupSection oldSection = vAppApi.getStartupSection(vApp.getHref());
StartupSection newSection = oldSection.toBuilder().build();
// The method under test
Task modifyStartupSection = vAppClient.modifyStartupSection(vApp.getHref(), newSection);
Task modifyStartupSection = vAppApi.modifyStartupSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyStartupSection), String.format(TASK_COMPLETE_TIMELY, "modifyStartupSection"));
// Retrieve the modified section
StartupSection modified = vAppClient.getStartupSection(vApp.getHref());
StartupSection modified = vAppApi.getStartupSection(vApp.getHref());
// Check the retrieved object is well formed
checkStartupSection(modified);
@ -678,10 +678,10 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
key = name("key-");
String value = name("value-");
metadataValue = MetadataValue.builder().value(value).build();
vAppClient.getMetadataClient().setMetadata(vApp.getHref(), key, metadataValue);
vAppApi.getMetadataApi().setMetadata(vApp.getHref(), key, metadataValue);
// Retrieve the value, and assert it was set correctly
MetadataValue newMetadataValue = vAppClient.getMetadataClient().getMetadataValue(vApp.getHref(), key);
MetadataValue newMetadataValue = vAppApi.getMetadataApi().getMetadataValue(vApp.getHref(), key);
// Check the retrieved object is well formed
checkMetadataValueFor(VAPP, newMetadataValue, value);
@ -690,7 +690,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" })
public void testGetMetadata() {
// Call the method being tested
Metadata metadata = vAppClient.getMetadataClient().getMetadata(vApp.getHref());
Metadata metadata = vAppApi.getMetadataApi().getMetadata(vApp.getHref());
checkMetadata(metadata);
@ -701,7 +701,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
public void testGetOrgMetadataValue() {
// Call the method being tested
MetadataValue value = vAppClient.getMetadataClient().getMetadataValue(vApp.getHref(), key);
MetadataValue value = vAppApi.getMetadataApi().getMetadataValue(vApp.getHref(), key);
String expected = metadataValue.getValue();
@ -712,11 +712,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
public void testDeleteMetadataEntry() {
// Delete the entry
Task task = vAppClient.getMetadataClient().deleteMetadataEntry(vApp.getHref(), key);
Task task = vAppApi.getMetadataApi().deleteMetadataEntry(vApp.getHref(), key);
retryTaskSuccess.apply(task);
// Confirm the entry has been deleted
Metadata newMetadata = vAppClient.getMetadataClient().getMetadata(vApp.getHref());
Metadata newMetadata = vAppApi.getMetadataApi().getMetadata(vApp.getHref());
// Check the retrieved object is well formed
checkMetadataKeyAbsentFor(VAPP, newMetadata, key);
@ -724,7 +724,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
public void testMergeMetadata() {
Metadata oldMetadata = vAppClient.getMetadataClient().getMetadata(vApp.getHref());
Metadata oldMetadata = vAppApi.getMetadataApi().getMetadata(vApp.getHref());
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
// Store a value, to be deleted
@ -733,11 +733,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
Metadata addedMetadata = Metadata.builder()
.entry(MetadataEntry.builder().key(key).value(value).build())
.build();
Task task = vAppClient.getMetadataClient().mergeMetadata(vApp.getHref(), addedMetadata);
Task task = vAppApi.getMetadataApi().mergeMetadata(vApp.getHref(), addedMetadata);
retryTaskSuccess.apply(task);
// Confirm the entry contains everything that was there, and everything that was being added
Metadata newMetadata = vAppClient.getMetadataClient().getMetadata(vApp.getHref());
Metadata newMetadata = vAppApi.getMetadataApi().getMetadata(vApp.getHref());
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String>builder()
.putAll(oldMetadataMap)
.put(key, value)
@ -748,7 +748,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
}
/**
* @see VAppClient#deleteVApp(URI)
* @see VAppApi#deleteVApp(URI)
*/
@Test(description = "DELETE /vApp/{id}")
public void testDeleteVApp() {
@ -756,10 +756,10 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
VApp temp = instantiateVApp();
// The method under test
Task deleteVApp = vAppClient.deleteVApp(temp.getHref());
Task deleteVApp = vAppApi.deleteVApp(temp.getHref());
assertTrue(retryTaskSuccess.apply(deleteVApp), String.format(TASK_COMPLETE_TIMELY, "deleteVApp"));
VApp deleted = vAppClient.getVApp(temp.getHref());
VApp deleted = vAppApi.getVApp(temp.getHref());
assertNull(deleted, "The VApp "+temp.getName()+" should have been deleted");
}
}

View File

@ -67,20 +67,20 @@ import org.jclouds.vcloud.director.v1_5.domain.section.CustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection;
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* Tests the request/response behavior of {@link org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient}
* Tests the request/response behavior of {@link org.jclouds.vcloud.director.v1_5.features.VAppTemplateApi}
*
* @author Adam Lowe
*/
@Test(groups = { "unit", "user" }, testName = "VAppTemplateClientExpectTest")
public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "user" }, testName = "VAppTemplateApiExpectTest")
public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest {
public VAppTemplateClientExpectTest() {
public VAppTemplateApiExpectTest() {
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
}
@ -89,24 +89,24 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId).acceptMedia(VAPP_TEMPLATE).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/vAppTemplate.xml", VAPP_TEMPLATE).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId).xmlFilePayload("/vapptemplate/vAppTemplate.xml", VAPP_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
VAppTemplate template = client.getVAppTemplate(uri);
assertNotNull(api);
VAppTemplate template = api.getVAppTemplate(uri);
assertEquals(template, exampleTemplate());
Task task = client.modifyVAppTemplate(uri, exampleTemplate());
Task task = api.modifyVAppTemplate(uri, exampleTemplate());
assertNotNull(task);
task = client.deleteVappTemplate(uri);
task = api.deleteVappTemplate(uri);
assertNotNull(task);
}
@ -115,11 +115,11 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId).acceptMedia(VAPP_TEMPLATE).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
client.getVAppTemplate(uri);
api.getVAppTemplate(uri);
}
@Test(expectedExceptions = ResourceNotFoundException.class)
@ -127,11 +127,11 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId).xmlFilePayload("/vapptemplate/vAppTemplate.xml", VAPP_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
client.modifyVAppTemplate(uri, exampleTemplate());
api.modifyVAppTemplate(uri, exampleTemplate());
}
@Test(expectedExceptions = VCloudDirectorException.class)
@ -139,24 +139,24 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
client.deleteVappTemplate(uri);
api.deleteVappTemplate(uri);
}
public void testConsolidateVAppTemplate() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/consolidate").acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
Task task = client.consolidateVm(uri);
assertNotNull(api);
Task task = api.consolidateVm(uri);
assertNotNull(task);
}
@ -165,24 +165,24 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/consolidate").acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
client.consolidateVm(uri);
api.consolidateVm(uri);
}
public void testDisableDownloadVAppTemplate() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/disableDownload").httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
client.disableDownload(uri);
assertNotNull(api);
api.disableDownload(uri);
}
@Test(expectedExceptions = VCloudDirectorException.class)
@ -190,24 +190,24 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/disableDownload").httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
client.disableDownload(uri);
api.disableDownload(uri);
}
public void testEnableDownloadVAppTemplate() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/enableDownload").acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
Task task = client.enableDownload(uri);
assertNotNull(api);
Task task = api.enableDownload(uri);
assertNotNull(task);
}
@ -216,28 +216,28 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/enableDownload").acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
client.enableDownload(uri);
api.enableDownload(uri);
}
public void testRelocateVAppTemplate() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/relocate").xmlFilePayload("/vapptemplate/relocateParams.xml", RELOCATE_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
assertNotNull(api);
Reference datastore = Reference.builder().href(URI.create("https://vcloud.example.com/api/admin/extension/datastore/607")).build();
RelocateParams params = RelocateParams.builder().datastore(datastore).build();
Task task = client.relocateVm(uri, params);
Task task = api.relocateVm(uri, params);
assertNotNull(task);
}
@ -246,14 +246,14 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/relocate").xmlFilePayload("/vapptemplate/relocateParams.xml", RELOCATE_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
Reference datastore = Reference.builder().href(URI.create("https://vcloud.example.com/api/admin/extension/datastore/607")).build();
RelocateParams params = RelocateParams.builder().datastore(datastore).build();
client.relocateVm(uri, params);
api.relocateVm(uri, params);
}
@Test
@ -261,19 +261,19 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/customizationSection").acceptMedia(CUSTOMIZATION_SECTION).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/customizationSection.xml", CUSTOMIZATION_SECTION).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/customizationSection").xmlFilePayload("/vapptemplate/customizationSection.xml", CUSTOMIZATION_SECTION).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
CustomizationSection section = client.getCustomizationSection(uri);
assertNotNull(api);
CustomizationSection section = api.getCustomizationSection(uri);
assertEquals(section, exampleCustomizationSection());
Task task = client.modifyCustomizationSection(uri, exampleCustomizationSection());
Task task = api.modifyCustomizationSection(uri, exampleCustomizationSection());
assertNotNull(task);
}
@ -281,11 +281,11 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/customizationSection").acceptMedia(CUSTOMIZATION_SECTION).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
assertNull(client.getCustomizationSection(uri));
assertNull(api.getCustomizationSection(uri));
}
@Test(expectedExceptions = ResourceNotFoundException.class)
@ -293,30 +293,30 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/customizationSection").xmlFilePayload("/vapptemplate/customizationSection.xml", CUSTOMIZATION_SECTION).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
client.modifyCustomizationSection(uri, exampleCustomizationSection());
api.modifyCustomizationSection(uri, exampleCustomizationSection());
}
public void testGuestCustomizationSection() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/guestCustomizationSection").acceptMedia(GUEST_CUSTOMIZATION_SECTION).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/guestCustomizationSection.xml", GUEST_CUSTOMIZATION_SECTION).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/guestCustomizationSection").xmlFilePayload("/vapptemplate/guestCustomizationSection.xml", GUEST_CUSTOMIZATION_SECTION).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
GuestCustomizationSection section = client.getGuestCustomizationSection(uri);
assertNotNull(api);
GuestCustomizationSection section = api.getGuestCustomizationSection(uri);
assertEquals(section, exampleGuestCustomizationSection());
Task task = client.modifyGuestCustomizationSection(uri, exampleGuestCustomizationSection());
Task task = api.modifyGuestCustomizationSection(uri, exampleGuestCustomizationSection());
assertNotNull(task);
}
@ -325,11 +325,11 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/guestCustomizationSection").acceptMedia(GUEST_CUSTOMIZATION_SECTION).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
client.getGuestCustomizationSection(uri);
api.getGuestCustomizationSection(uri);
}
@Test(expectedExceptions = VCloudDirectorException.class)
@ -337,30 +337,30 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/guestCustomizationSection").xmlFilePayload("/vapptemplate/guestCustomizationSection.xml", GUEST_CUSTOMIZATION_SECTION).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
client.modifyGuestCustomizationSection(uri, exampleGuestCustomizationSection());
api.modifyGuestCustomizationSection(uri, exampleGuestCustomizationSection());
}
public void testLeaseSettingsSection() throws ParseException {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/leaseSettingsSection").acceptMedia(LEASE_SETTINGS_SECTION).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/leaseSettingsSection.xml", LEASE_SETTINGS_SECTION).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/leaseSettingsSection").xmlFilePayload("/vapptemplate/leaseSettingsSection.xml", LEASE_SETTINGS_SECTION).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
LeaseSettingsSection section = client.getLeaseSettingsSection(uri);
assertNotNull(api);
LeaseSettingsSection section = api.getLeaseSettingsSection(uri);
assertEquals(section, exampleLeaseSettingsSection());
Task task = client.modifyLeaseSettingsSection(uri, exampleLeaseSettingsSection());
Task task = api.modifyLeaseSettingsSection(uri, exampleLeaseSettingsSection());
assertNotNull(task);
}
@ -368,11 +368,11 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/leaseSettingsSection").acceptMedia(LEASE_SETTINGS_SECTION).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
assertNull(client.getLeaseSettingsSection(uri));
assertNull(api.getLeaseSettingsSection(uri));
}
@Test(expectedExceptions = ResourceNotFoundException.class)
@ -380,30 +380,30 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/leaseSettingsSection").xmlFilePayload("/vapptemplate/leaseSettingsSection.xml", LEASE_SETTINGS_SECTION).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
client.modifyLeaseSettingsSection(uri, exampleLeaseSettingsSection());
api.modifyLeaseSettingsSection(uri, exampleLeaseSettingsSection());
}
public void testVappTemplateMetadata() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(ANY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/metadata.xml", METADATA).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/metadata").xmlFilePayload("/vapptemplate/metadata.xml", METADATA).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
Metadata metadata = client.getMetadataClient().getMetadata(uri);
assertNotNull(api);
Metadata metadata = api.getMetadataApi().getMetadata(uri);
assertEquals(metadata, exampleMetadata());
Task task = client.getMetadataClient().mergeMetadata(uri, exampleMetadata());
Task task = api.getMetadataApi().mergeMetadata(uri, exampleMetadata());
assertNotNull(task);
}
@ -412,11 +412,11 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(ANY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
client.getMetadataClient().getMetadata(uri);
api.getMetadataApi().getMetadata(uri);
}
@Test(expectedExceptions = VCloudDirectorException.class)
@ -424,35 +424,35 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/metadata").xmlFilePayload("/vapptemplate/metadata.xml", METADATA).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
client.getMetadataClient().mergeMetadata(uri, exampleMetadata());
api.getMetadataApi().mergeMetadata(uri, exampleMetadata());
}
public void testVappTemplateMetadataValue() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata/12345").acceptMedia(METADATA_ENTRY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/metadataValue.xml", METADATA_ENTRY).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/metadata/12345").xmlFilePayload("/vapptemplate/metadataValue.xml", METADATA_ENTRY).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId + "/metadata/12345").acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
MetadataValue metadata = client.getMetadataClient().getMetadataValue(uri, "12345");
assertNotNull(api);
MetadataValue metadata = api.getMetadataApi().getMetadataValue(uri, "12345");
assertEquals(metadata, exampleMetadataValue());
Task task = client.getMetadataClient().setMetadata(uri, "12345", exampleMetadataValue());
Task task = api.getMetadataApi().setMetadata(uri, "12345", exampleMetadataValue());
assertNotNull(task);
task = client.getMetadataClient().deleteMetadataEntry(uri, "12345");
task = api.getMetadataApi().deleteMetadataEntry(uri, "12345");
assertNotNull(task);
}
@ -460,11 +460,11 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata/12345").acceptMedia(METADATA_ENTRY).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
assertNull(client.getMetadataClient().getMetadataValue(uri, "12345"));
assertNull(api.getMetadataApi().getMetadataValue(uri, "12345"));
}
@Test(expectedExceptions = VCloudDirectorException.class)
@ -472,11 +472,11 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/metadata/12345").xmlFilePayload("/vapptemplate/metadataValue.xml", METADATA_ENTRY).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
client.getMetadataClient().setMetadata(uri, "12345", exampleMetadataValue());
api.getMetadataApi().setMetadata(uri, "12345", exampleMetadataValue());
}
@Test(expectedExceptions = ResourceNotFoundException.class)
@ -484,31 +484,31 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId + "/metadata/12345").acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
client.getMetadataClient().deleteMetadataEntry(uri, "12345");
api.getMetadataApi().deleteMetadataEntry(uri, "12345");
}
public void testNetworkConfigSection() throws ParseException {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/networkConfigSection").acceptMedia(NETWORK_CONFIG_SECTION).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/networkConfigSection.xml", NETWORK_CONFIG_SECTION).httpResponseBuilder().build(),
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/networkConfigSection").xmlFilePayload("/vapptemplate/networkConfigSection.xml", NETWORK_CONFIG_SECTION).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient();
).getVAppTemplateApi();
assertNotNull(client);
assertNotNull(api);
NetworkConfigSection section = client.getNetworkConfigSection(uri);
NetworkConfigSection section = api.getNetworkConfigSection(uri);
assertEquals(section, exampleNetworkConfigSection());
Task task = client.modifyNetworkConfigSection(uri, exampleNetworkConfigSection());
Task task = api.modifyNetworkConfigSection(uri, exampleNetworkConfigSection());
assertNotNull(task);
}
@ -517,11 +517,11 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/networkConfigSection").acceptMedia(NETWORK_CONFIG_SECTION).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
client.getNetworkConfigSection(uri);
api.getNetworkConfigSection(uri);
}
@Test(expectedExceptions = VCloudDirectorException.class)
@ -529,11 +529,11 @@ public class VAppTemplateClientExpectTest extends VCloudDirectorAdminClientExpec
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VAppTemplateApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/networkConfigSection").xmlFilePayload("/vapptemplate/networkConfigSection.xml", NETWORK_CONFIG_SECTION).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
client.modifyNetworkConfigSection(uri, exampleNetworkConfigSection());
api.modifyNetworkConfigSection(uri, exampleNetworkConfigSection());
}
private VAppTemplate exampleTemplate() {

View File

@ -46,7 +46,7 @@ import java.util.Map;
import java.util.Set;
import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.AbstractVAppClientLiveTest;
import org.jclouds.vcloud.director.v1_5.AbstractVAppApiLiveTest;
import org.jclouds.vcloud.director.v1_5.domain.Checks;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.Link.Rel;
@ -78,14 +78,14 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
/**
* Tests the request/response behavior of {@link VAppTemplateClient}
* Tests the request/response behavior of {@link VAppTemplateApi}
*
* NOTE The environment MUST have at least one template configured
*
* @author Aled Sage
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VAppTemplateClientLiveTest")
public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VAppTemplateApiLiveTest")
public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
private String key;
private String val;
@ -94,7 +94,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
protected void tidyUp() {
if (key != null) {
try {
Task delete = vAppTemplateClient.getMetadataClient().deleteMetadataEntry(vAppTemplateURI, key);
Task delete = vAppTemplateApi.getMetadataApi().deleteMetadataEntry(vAppTemplateURI, key);
taskDoneEventually(delete);
} catch (Exception e) {
logger.warn(e, "Error when deleting metadata entry '%s'", key);
@ -107,11 +107,11 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
CloneVAppTemplateParams cloneVAppTemplateParams = CloneVAppTemplateParams.builder()
.source(Reference.builder().href(vAppTemplateURI).build())
.build();
VAppTemplate clonedVappTemplate = vdcClient.cloneVAppTemplate(vdcURI, cloneVAppTemplateParams);
VAppTemplate clonedVappTemplate = vdcApi.cloneVAppTemplate(vdcURI, cloneVAppTemplateParams);
if (waitForTask) {
Task cloneTask = Iterables.getFirst(clonedVappTemplate.getTasks(), null);
assertNotNull(cloneTask, "vdcClient.cloneVAppTemplate returned VAppTemplate that did not contain any tasks");
assertNotNull(cloneTask, "vdcApi.cloneVAppTemplate returned VAppTemplate that did not contain any tasks");
assertTaskSucceeds(cloneTask);
}
@ -120,7 +120,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vAppTemplate/{id}")
public void testGetVAppTemplate() {
vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
checkVAppTemplate(vAppTemplate);
assertEquals(vAppTemplate.getHref(), vAppTemplateURI);
@ -128,22 +128,22 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vAppTemplate/{id}/owner")
public void testGetVAppTemplateOwner() {
Owner owner = vAppTemplateClient.getOwner(vAppTemplateURI);
Owner owner = vAppTemplateApi.getOwner(vAppTemplateURI);
checkOwner(owner);
assertEquals(owner.getUser(), vAppTemplateClient.getVAppTemplate(vAppTemplateURI).getOwner().getUser());
assertEquals(owner.getUser(), vAppTemplateApi.getVAppTemplate(vAppTemplateURI).getOwner().getUser());
}
@Test(description = "GET /vAppTemplate/{id}/customizationSection")
public void testGetCustomizationSection() {
CustomizationSection customizationSection = vAppTemplateClient.getCustomizationSection(vAppTemplateURI);
CustomizationSection customizationSection = vAppTemplateApi.getCustomizationSection(vAppTemplateURI);
checkCustomizationSection(customizationSection);
}
@Test(description = "GET /vAppTemplate/{id}/productSections")
public void testGetProductSections() {
ProductSectionList productSectionList = vAppTemplateClient.getProductSections(vAppTemplateURI);
ProductSectionList productSectionList = vAppTemplateApi.getProductSections(vAppTemplateURI);
checkProductSectionList(productSectionList);
}
@ -152,13 +152,13 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
public void testEditProductSections() {
// TODO make a real modification
ProductSectionList origSections = vAppTemplateClient.getProductSections(vApp.getHref());
ProductSectionList origSections = vAppTemplateApi.getProductSections(vApp.getHref());
ProductSectionList newSections = origSections.toBuilder().build();
Task task = vAppTemplateClient.modifyProductSections(vApp.getHref(), newSections);
Task task = vAppTemplateApi.modifyProductSections(vApp.getHref(), newSections);
assertTaskSucceeds(task);
ProductSectionList modified = vAppTemplateClient.getProductSections(vApp.getHref());
ProductSectionList modified = vAppTemplateApi.getProductSections(vApp.getHref());
checkProductSectionList(modified);
}
@ -167,21 +167,21 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
getGuestCustomizationSection(new Function<URI, GuestCustomizationSection>() {
@Override
public GuestCustomizationSection apply(URI uri) {
return vAppTemplateClient.getGuestCustomizationSection(uri);
return vAppTemplateApi.getGuestCustomizationSection(uri);
}
});
}
@Test(description = "GET /vAppTemplate/{id}/leaseSettingsSection")
public void testGetLeaseSettingsSection() {
LeaseSettingsSection leaseSettingsSection = vAppTemplateClient.getLeaseSettingsSection(vAppTemplateURI);
LeaseSettingsSection leaseSettingsSection = vAppTemplateApi.getLeaseSettingsSection(vAppTemplateURI);
checkLeaseSettingsSection(leaseSettingsSection);
}
@Test(description = "GET /vAppTemplate/{id}/metadata", dependsOnMethods = { "testEditMetadataValue" })
public void testGetVAppTemplateMetadata() {
Metadata metadata = vAppTemplateClient.getMetadataClient().getMetadata(vAppTemplateURI);
Metadata metadata = vAppTemplateApi.getMetadataApi().getMetadata(vAppTemplateURI);
checkMetadata(metadata);
}
@ -189,10 +189,10 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
// implicitly tested by testEditVAppTemplateMetadataValue, which first creates the metadata entry; otherwise no entry may exist
@Test(description = "GET /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetVAppTemplateMetadata" })
public void testGetMetadataValue() {
Metadata metadata = vAppTemplateClient.getMetadataClient().getMetadata(vAppTemplateURI);
Metadata metadata = vAppTemplateApi.getMetadataApi().getMetadata(vAppTemplateURI);
MetadataEntry entry = Iterables.get(metadata.getMetadataEntries(), 0);
MetadataValue val = vAppTemplateClient.getMetadataClient().getMetadataValue(vAppTemplateURI, entry.getKey());
MetadataValue val = vAppTemplateApi.getMetadataApi().getMetadataValue(vAppTemplateURI, entry.getKey());
checkMetadataValue(val);
assertEquals(val.getValue(), entry.getValue());
@ -200,7 +200,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vAppTemplate/{id}/networkConfigSection")
public void testGetVAppTemplateNetworkConfigSection() {
NetworkConfigSection networkConfigSection = vAppTemplateClient.getNetworkConfigSection(vAppTemplateURI);
NetworkConfigSection networkConfigSection = vAppTemplateApi.getNetworkConfigSection(vAppTemplateURI);
checkNetworkConfigSection(networkConfigSection);
}
@ -210,21 +210,21 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
getNetworkConnectionSection(new Function<URI, NetworkConnectionSection>() {
@Override
public NetworkConnectionSection apply(URI uri) {
return vAppTemplateClient.getNetworkConnectionSection(uri);
return vAppTemplateApi.getNetworkConnectionSection(uri);
}
});
}
@Test(description = "GET /vAppTemplate/{id}/networkSection")
public void testGetVAppTemplateNetworkSection() {
NetworkSection networkSection = vAppTemplateClient.getNetworkSection(vAppTemplateURI);
NetworkSection networkSection = vAppTemplateApi.getNetworkSection(vAppTemplateURI);
checkOvfNetworkSection(networkSection);
}
@Test(description = "GET /vAppTemplate/{id}/ovf")
public void testGetVAppTemplateOvf() {
Envelope envelope = vAppTemplateClient.getOvf(vAppTemplateURI);
Envelope envelope = vAppTemplateApi.getOvf(vAppTemplateURI);
checkOvfEnvelope(envelope);
}
@ -238,17 +238,17 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
.description(description)
.build();
final Task task = vAppTemplateClient.modifyVAppTemplate(vAppTemplateURI, template);
final Task task = vAppTemplateApi.modifyVAppTemplate(vAppTemplateURI, template);
assertTaskSucceeds(task);
VAppTemplate newTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
VAppTemplate newTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
assertEquals(newTemplate.getName(), name);
assertEquals(newTemplate.getDescription(), description);
}
@Test(description = "POST /vAppTemplate/{id}/metadata", dependsOnMethods = { "testGetVAppTemplate" })
public void testEditMetadata() {
Metadata oldMetadata = vAppTemplateClient.getMetadataClient().getMetadata(vAppTemplateURI);
Metadata oldMetadata = vAppTemplateApi.getMetadataApi().getMetadata(vAppTemplateURI);
Map<String,String> oldMetadataMap = metadataToMap(oldMetadata);
key = name("key-");
@ -256,10 +256,10 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
MetadataEntry metadataEntry = MetadataEntry.builder().entry(key, val).build();
Metadata metadata = Metadata.builder().fromMetadata(oldMetadata).entry(metadataEntry).build();
final Task task = vAppTemplateClient.getMetadataClient().mergeMetadata(vAppTemplateURI, metadata);
final Task task = vAppTemplateApi.getMetadataApi().mergeMetadata(vAppTemplateURI, metadata);
assertTaskSucceeds(task);
Metadata newMetadata = vAppTemplateClient.getMetadataClient().getMetadata(vAppTemplateURI);
Metadata newMetadata = vAppTemplateApi.getMetadataApi().getMetadata(vAppTemplateURI);
Map<String,String> expectedMetadataMap = ImmutableMap.<String,String>builder()
.putAll(oldMetadataMap)
.put(key, val)
@ -272,19 +272,19 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
val = "new"+val;
MetadataValue metadataValue = MetadataValue.builder().value(val).build();
final Task task = vAppTemplateClient.getMetadataClient().setMetadata(vAppTemplateURI, key, metadataValue);
final Task task = vAppTemplateApi.getMetadataApi().setMetadata(vAppTemplateURI, key, metadataValue);
retryTaskSuccess.apply(task);
MetadataValue newMetadataValue = vAppTemplateClient.getMetadataClient().getMetadataValue(vAppTemplateURI, key);
MetadataValue newMetadataValue = vAppTemplateApi.getMetadataApi().getMetadataValue(vAppTemplateURI, key);
assertEquals(newMetadataValue.getValue(), metadataValue.getValue());
}
@Test(description = "DELETE /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadataValue" })
public void testDeleteVAppTemplateMetadataValue() {
final Task deletionTask = vAppTemplateClient.getMetadataClient().deleteMetadataEntry(vAppTemplateURI, key);
final Task deletionTask = vAppTemplateApi.getMetadataApi().deleteMetadataEntry(vAppTemplateURI, key);
assertTaskSucceeds(deletionTask);
Metadata newMetadata = vAppTemplateClient.getMetadataClient().getMetadata(vAppTemplateURI);
Metadata newMetadata = vAppTemplateApi.getMetadataApi().getMetadata(vAppTemplateURI);
checkMetadataKeyAbsentFor("vAppTemplate", newMetadata, key);
key = null;
}
@ -297,10 +297,10 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
.computerName(computerName)
.build();
final Task task = vAppTemplateClient.modifyGuestCustomizationSection(vm.getHref(), newSection);
final Task task = vAppTemplateApi.modifyGuestCustomizationSection(vm.getHref(), newSection);
assertTaskSucceeds(task);
GuestCustomizationSection modified = vAppTemplateClient.getGuestCustomizationSection(vm.getHref());
GuestCustomizationSection modified = vAppTemplateApi.getGuestCustomizationSection(vm.getHref());
checkGuestCustomizationSection(modified);
assertEquals(modified.getComputerName(), computerName);
@ -308,7 +308,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vAppTemplate/{id}/customizationSection")
public void testEditCustomizationSection() {
boolean oldVal = vAppTemplateClient.getCustomizationSection(vAppTemplateURI).isCustomizeOnInstantiate();
boolean oldVal = vAppTemplateApi.getCustomizationSection(vAppTemplateURI).isCustomizeOnInstantiate();
boolean newVal = !oldVal;
CustomizationSection customizationSection = CustomizationSection.builder()
@ -316,10 +316,10 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
.customizeOnInstantiate(newVal)
.build();
final Task task = vAppTemplateClient.modifyCustomizationSection(vAppTemplateURI, customizationSection);
final Task task = vAppTemplateApi.modifyCustomizationSection(vAppTemplateURI, customizationSection);
assertTaskSucceeds(task);
CustomizationSection newCustomizationSection = vAppTemplateClient.getCustomizationSection(vAppTemplateURI);
CustomizationSection newCustomizationSection = vAppTemplateApi.getCustomizationSection(vAppTemplateURI);
assertEquals(newCustomizationSection.isCustomizeOnInstantiate(), newVal);
}
@ -336,10 +336,10 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
.deploymentLeaseInSeconds(deploymentLeaseInSeconds)
.build();
final Task task = vAppTemplateClient.modifyLeaseSettingsSection(vAppTemplateURI, leaseSettingSection);
final Task task = vAppTemplateApi.modifyLeaseSettingsSection(vAppTemplateURI, leaseSettingSection);
assertTaskSucceeds(task);
LeaseSettingsSection newLeaseSettingsSection = vAppTemplateClient.getLeaseSettingsSection(vAppTemplateURI);
LeaseSettingsSection newLeaseSettingsSection = vAppTemplateApi.getLeaseSettingsSection(vAppTemplateURI);
assertEquals(newLeaseSettingsSection.getStorageLeaseInSeconds(), (Integer) storageLeaseInSeconds);
assertEquals(newLeaseSettingsSection.getDeploymentLeaseInSeconds(), (Integer) deploymentLeaseInSeconds);
}
@ -348,7 +348,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
public void testEditNetworkConfigSection() {
// TODO What to modify?
NetworkConfigSection oldSection = vAppTemplateClient.getNetworkConfigSection(vApp.getHref());
NetworkConfigSection oldSection = vAppTemplateApi.getNetworkConfigSection(vApp.getHref());
NetworkConfigSection newSection = oldSection.toBuilder().build();
// String networkName = ""+random.nextInt();
@ -365,10 +365,10 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
// .networkConfigs(vappNetworkConfigurations)
// .build();
final Task task = vAppTemplateClient.modifyNetworkConfigSection(vApp.getHref(), newSection);
final Task task = vAppTemplateApi.modifyNetworkConfigSection(vApp.getHref(), newSection);
assertTaskSucceeds(task);
NetworkConfigSection modified = vAppTemplateClient.getNetworkConfigSection(vAppTemplateURI);
NetworkConfigSection modified = vAppTemplateApi.getNetworkConfigSection(vAppTemplateURI);
checkNetworkConfigSection(modified);
// assertEquals(modified§.getNetworkConfigs().size(), 1);
@ -384,7 +384,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
Reference network = Iterables.getLast(networks);
// Copy existing section and update fields
NetworkConnectionSection oldSection = vAppTemplateClient.getNetworkConnectionSection(vm.getHref());
NetworkConnectionSection oldSection = vAppTemplateApi.getNetworkConnectionSection(vm.getHref());
NetworkConnectionSection newSection = oldSection.toBuilder()
.networkConnection(NetworkConnection.builder()
.ipAddressAllocationMode(IpAddressAllocationMode.DHCP.toString())
@ -392,10 +392,10 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
.build())
.build();
Task task = vAppTemplateClient.modifyNetworkConnectionSection(vm.getHref(), newSection);
Task task = vAppTemplateApi.modifyNetworkConnectionSection(vm.getHref(), newSection);
assertTaskSucceeds(task);
NetworkConnectionSection modified = vAppTemplateClient.getNetworkConnectionSection(vm.getHref());
NetworkConnectionSection modified = vAppTemplateApi.getNetworkConnectionSection(vm.getHref());
checkNetworkConnectionSection(modified);
}
@ -405,26 +405,26 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
VAppTemplate clonedVappTemplate = cloneVAppTemplate(true);
// Confirm that "get" works pre-delete
VAppTemplate vAppTemplatePreDelete = vAppTemplateClient.getVAppTemplate(clonedVappTemplate.getHref());
VAppTemplate vAppTemplatePreDelete = vAppTemplateApi.getVAppTemplate(clonedVappTemplate.getHref());
checkVAppTemplate(vAppTemplatePreDelete);
// Delete the template
final Task task = vAppTemplateClient.deleteVappTemplate(clonedVappTemplate.getHref());
final Task task = vAppTemplateApi.deleteVappTemplate(clonedVappTemplate.getHref());
assertTaskSucceeds(task);
// Confirm that can't access post-delete, i.e. template has been deleted
VAppTemplate deleted = vAppTemplateClient.getVAppTemplate(clonedVappTemplate.getHref());
VAppTemplate deleted = vAppTemplateApi.getVAppTemplate(clonedVappTemplate.getHref());
assertNull(deleted);
}
@Test(description = "POST /vAppTemplate/{id}/action/disableDownload")
public void testDisableVAppTemplateDownload() throws Exception {
vAppTemplateClient.disableDownload(vAppTemplateURI);
vAppTemplateApi.disableDownload(vAppTemplateURI);
// TODO Check that it really is disabled. The only thing I can see for determining this
// is the undocumented "download" link in the VAppTemplate. But that is brittle and we
// don't know what timing guarantees there are for adding/removing the link.
VAppTemplate vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
Set<Link> links = vAppTemplate.getLinks();
assertTrue(Iterables.all(Iterables.transform(links, rel), Predicates.not(Predicates.in(EnumSet.of(Link.Rel.DOWNLOAD_DEFAULT, Link.Rel.DOWNLOAD_ALTERNATE)))),
"Should not offer download link after disabling download: "+vAppTemplate);
@ -433,14 +433,14 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "POST /vAppTemplate/{id}/action/enableDownload")
public void testEnableVAppTemplateDownload() throws Exception {
// First disable so that enable really has some work to do...
vAppTemplateClient.disableDownload(vAppTemplateURI);
final Task task = vAppTemplateClient.enableDownload(vAppTemplateURI);
vAppTemplateApi.disableDownload(vAppTemplateURI);
final Task task = vAppTemplateApi.enableDownload(vAppTemplateURI);
assertTaskSucceeds(task);
// TODO Check that it really is enabled. The only thing I can see for determining this
// is the undocumented "download" link in the VAppTemplate. But that is brittle and we
// don't know what timing guarantees there are for adding/removing the link.
VAppTemplate vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
Set<Link> links = vAppTemplate.getLinks();
assertTrue(Iterables.any(Iterables.transform(links, rel), Predicates.in(EnumSet.of(Link.Rel.DOWNLOAD_DEFAULT, Link.Rel.DOWNLOAD_ALTERNATE))),
"Should offer download link after enabling download: "+vAppTemplate);
@ -455,7 +455,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "POST /vAppTemplate/{id}/action/consolidate")
public void testConsolidateVAppTemplate() throws Exception {
final Task task = vAppTemplateClient.consolidateVm(vm.getHref());
final Task task = vAppTemplateApi.consolidateVm(vm.getHref());
assertTaskSucceedsLong(task);
// TODO Need assertion that command had effect
@ -469,7 +469,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
.datastore(dataStore)
.build();
final Task task = vAppTemplateClient.relocateVm(vAppTemplateURI, relocateParams);
final Task task = vAppTemplateApi.relocateVm(vAppTemplateURI, relocateParams);
assertTaskSucceedsLong(task);
// TODO Need assertion that command had effect
@ -478,7 +478,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
// NOTE This will fail unless we can relocate a template to another datastore
@Test(description = "GET /vAppTemplate/{id}/shadowVms", dependsOnMethods = { "testRelocateVAppTemplate" })
public void testGetShadowVms() {
References references = vAppTemplateClient.getShadowVms(vAppTemplateURI);
References references = vAppTemplateApi.getShadowVms(vAppTemplateURI);
Checks.checkReferences(references);
}
@ -488,12 +488,12 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "test completed task not included in vAppTemplate")
public void testCompletedTaskNotIncludedInVAppTemplate() throws Exception {
// Kick off a task, and wait for it to complete
vAppTemplateClient.disableDownload(vAppTemplateURI);
final Task task = vAppTemplateClient.enableDownload(vAppTemplateURI);
vAppTemplateApi.disableDownload(vAppTemplateURI);
final Task task = vAppTemplateApi.enableDownload(vAppTemplateURI);
assertTaskDoneEventually(task);
// Ask the VAppTemplate for its tasks, and the status of the matching task if it exists
VAppTemplate vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
VAppTemplate vAppTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
List<Task> tasks = vAppTemplate.getTasks();
for (Task contender : tasks) {
if (task.getId().equals(contender.getId())) {

View File

@ -46,18 +46,18 @@ import org.jclouds.vcloud.director.v1_5.domain.params.CloneVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.domain.params.ComposeVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.params.InstantiateVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.domain.params.UploadVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Allows us to test a client via its side effects.
* Allows us to test a api via its side effects.
*
* @author danikov
*/
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "VdcClientExpectTest")
public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "VdcApiExpectTest")
public class VdcApiExpectTest extends VCloudDirectorAdminApiExpectTest {
private URI vdcURI;
@ -69,7 +69,7 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test
public void testGetVdc() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f")
.acceptAnyMedia()
@ -80,13 +80,13 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Vdc expected = getVdc();
assertEquals(client.getVdcClient().getVdc(vdcURI), expected);
assertEquals(api.getVdcApi().getVdc(vdcURI), expected);
}
@Test
public void testResponse400ForInvalidVdcId() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/NOTAUUID")
.acceptAnyMedia()
@ -102,7 +102,7 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
try {
client.getVdcClient().getVdc(URI.create(endpoint + "/vdc/NOTAUUID"));
api.getVdcApi().getVdc(URI.create(endpoint + "/vdc/NOTAUUID"));
fail("Should give HTTP 400 error");
} catch (VCloudDirectorException vde) {
assertEquals(vde.getError(), expected);
@ -112,7 +112,7 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test
public void testResponse403ForFakeVdcId() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
.acceptAnyMedia()
@ -121,12 +121,12 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.xmlFilePayload("/vdc/error403-fake.xml", VCloudDirectorMediaType.ERROR)
.httpResponseBuilder().statusCode(403).build());
assertNull(client.getVdcClient().getVdc(URI.create(endpoint + "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")));
assertNull(api.getVdcApi().getVdc(URI.create(endpoint + "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")));
}
@Test(enabled = false)
public void testCaptureVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp")
.xmlFilePayload("/vdc/params/captureVApp.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@ -143,12 +143,12 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
assertEquals(client.getVdcClient().captureVApp(vdcURI, params), expected);
assertEquals(api.getVdcApi().captureVApp(vdcURI, params), expected);
}
@Test(enabled = false)
public void testResponse4xxForCaptureVAppNoParams() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp")
.xmlFilePayload("/vdc/params/captureVApp.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@ -165,7 +165,7 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
try {
client.getVdcClient().captureVApp(vdcURI, null);
api.getVdcApi().captureVApp(vdcURI, null);
fail("Should give HTTP 400 error");
} catch (VCloudDirectorException vde) {
assertEquals(vde.getError(), expected);
@ -174,7 +174,7 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(enabled = false)
public void testCloneVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate")
.xmlFilePayload("/vdc/params/cloneVApp.xml", VCloudDirectorMediaType.CLONE_VAPP_PARAMS)
@ -191,12 +191,12 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
assertEquals(client.getVdcClient().cloneVApp(vdcURI, params), expected);
assertEquals(api.getVdcApi().cloneVApp(vdcURI, params), expected);
}
@Test(enabled = false)
public void testCloneVAppTemplate() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate")
.xmlFilePayload("/vdc/params/cloneVAppTemplate.xml", VCloudDirectorMediaType.CLONE_VAPP_TEMPLATE_PARAMS)
@ -213,12 +213,12 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
assertEquals(client.getVdcClient().cloneVAppTemplate(vdcURI, params), expected);
assertEquals(api.getVdcApi().cloneVAppTemplate(vdcURI, params), expected);
}
@Test(enabled = false)
public void testComposeVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/composeVApp")
.xmlFilePayload("/vdc/params/composeVApp.xml", VCloudDirectorMediaType.COMPOSE_VAPP_PARAMS)
@ -235,12 +235,12 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
assertEquals(client.getVdcClient().composeVApp(vdcURI, params), expected);
assertEquals(api.getVdcApi().composeVApp(vdcURI, params), expected);
}
@Test(enabled = false)
public void testInstantiateVAppTemplate() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/instantiateVAppTemplate")
.xmlFilePayload("/vdc/params/instantiateVAppTemplate.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@ -257,12 +257,12 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
assertEquals(client.getVdcClient().instantiateVApp(vdcURI, params), expected);
assertEquals(api.getVdcApi().instantiateVApp(vdcURI, params), expected);
}
@Test(enabled = false)
public void testUploadVAppTemplate() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/uploadVAppTemplate")
.xmlFilePayload("/vdc/params/uploadVAppTemplate.xml", VCloudDirectorMediaType.UPLOAD_VAPP_TEMPLATE_PARAMS)
@ -279,14 +279,14 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build();
assertEquals(client.getVdcClient().uploadVAppTemplate(vdcURI, params), expected);
assertEquals(api.getVdcApi().uploadVAppTemplate(vdcURI, params), expected);
}
@Test
public void testCreateMedia() {
URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media")
.acceptMedia(VCloudDirectorMediaType.MEDIA)
@ -303,16 +303,16 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.type("application/vnd.vmware.vcloud.media+xml")
.description("Test media generated by testCreateMedia()")
.build();
Media expected = MediaClientExpectTest.createMedia();
Media expected = MediaApiExpectTest.createMedia();
assertEquals(client.getVdcClient().createMedia(vdcUri, source), expected);
assertEquals(api.getVdcApi().createMedia(vdcUri, source), expected);
}
@Test
public void testCloneMedia() {
URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia")
.acceptMedia(VCloudDirectorMediaType.MEDIA)
@ -333,16 +333,16 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.build())
.isSourceDelete(false)
.build();
Media expected = MediaClientExpectTest.cloneMedia();
Media expected = MediaApiExpectTest.cloneMedia();
assertEquals(client.getVdcClient().cloneMedia(vdcUri, params), expected);
assertEquals(api.getVdcApi().cloneMedia(vdcUri, params), expected);
}
@Test(enabled = false)
public void testGetMetadata() {
URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata")
.acceptAnyMedia()
@ -353,14 +353,14 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Metadata expected = metadata();
assertEquals(client.getVdcClient().getMetadataClient().getMetadata(vdcUri), expected);
assertEquals(api.getVdcApi().getMetadataApi().getMetadata(vdcUri), expected);
}
@Test(enabled = false)
public void testGetMetadataValue() {
URI vdcUri = URI.create("https://vcloudbeta.bluelock.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata/key")
.acceptAnyMedia()
@ -371,7 +371,7 @@ public class VdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
MetadataValue expected = metadataValue();
assertEquals(client.getVdcClient().getMetadataClient().getMetadataValue(vdcUri, "key"), expected);
assertEquals(api.getVdcApi().getMetadataApi().getMetadataValue(vdcUri, "key"), expected);
}
public static Vdc getVdc() {

View File

@ -51,7 +51,7 @@ import org.jclouds.vcloud.director.v1_5.domain.params.InstantiateVAppTemplatePar
import org.jclouds.vcloud.director.v1_5.domain.params.InstantiationParams;
import org.jclouds.vcloud.director.v1_5.domain.params.UploadVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -62,21 +62,21 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
/**
* Tests behavior of {@link VdcClient}
* Tests behavior of {@link VdcApi}
*
* @author danikov
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VdcClientLiveTest")
public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VdcApiLiveTest")
public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public static final String VDC = "vdc";
/*
* Convenience reference to API client.
* Convenience reference to API api.
*/
protected VdcClient vdcClient;
protected VAppTemplateClient vappTemplateClient;
protected VAppClient vappClient;
protected VdcApi vdcApi;
protected VAppTemplateApi vappTemplateApi;
protected VAppApi vappApi;
private VApp instantiatedVApp;
private VApp clonedVApp;
@ -88,10 +88,10 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() {
vdcClient = context.getApi().getVdcClient();
vappTemplateClient = context.getApi().getVAppTemplateClient();
vappClient = context.getApi().getVAppClient();
public void setupRequiredApis() {
vdcApi = context.getApi().getVdcApi();
vappTemplateApi = context.getApi().getVAppTemplateApi();
vappApi = context.getApi().getVAppApi();
assertNotNull(vdcURI, String.format(REF_REQ_LIVE, VDC));
}
@ -119,7 +119,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
if (metadataSet) {
try {
Task delete = adminContext.getApi().getVdcClient().getMetadataClient().deleteMetadataEntry(toAdminUri(vdcURI), "key");
Task delete = adminContext.getApi().getVdcApi().getMetadataApi().deleteMetadataEntry(toAdminUri(vdcURI), "key");
taskDoneEventually(delete);
} catch (Exception e) {
logger.warn(e, "Error deleting metadata entry");
@ -129,7 +129,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /vdc/{id}")
public void testGetVdc() {
Vdc vdc = vdcClient.getVdc(vdcURI);
Vdc vdc = vdcApi.getVdc(vdcURI);
assertNotNull(vdc, String.format(OBJ_REQ_LIVE, VDC));
assertTrue(!vdc.getDescription().equals("DO NOT USE"), "vDC isn't to be used for testing");
@ -148,7 +148,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
//.sections(sections) // TODO: ovf sections
.build();
capturedVAppTemplate = vdcClient.captureVApp(vdcURI, captureVappParams);
capturedVAppTemplate = vdcApi.captureVApp(vdcURI, captureVappParams);
Task task = Iterables.getFirst(capturedVAppTemplate.getTasks(), null);
assertTaskSucceedsLong(task);
@ -178,10 +178,10 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
//.linkedClone(true)
.build();
clonedVApp = vdcClient.cloneVApp(vdcURI, cloneVappParams);
clonedVApp = vdcApi.cloneVApp(vdcURI, cloneVappParams);
Task task = Iterables.getFirst(clonedVApp.getTasks(), null);
assertNotNull(task, "vdcClient.cloneVApp returned VApp that did not contain any tasks");
assertNotNull(task, "vdcApi.cloneVApp returned VApp that did not contain any tasks");
assertTaskSucceedsLong(task);
Checks.checkVApp(clonedVApp);
@ -189,12 +189,12 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "POST /vdc/{id}/action/cloneVAppTemplate")
public void testCloneVAppTemplate() {
clonedVAppTemplate = vdcClient.cloneVAppTemplate(vdcURI, CloneVAppTemplateParams.builder()
clonedVAppTemplate = vdcApi.cloneVAppTemplate(vdcURI, CloneVAppTemplateParams.builder()
.source(vAppTemplateURI)
.build());
Task task = Iterables.getFirst(clonedVAppTemplate.getTasks(), null);
assertNotNull(task, "vdcClient.cloneVAppTemplate returned VAppTemplate that did not contain any tasks");
assertNotNull(task, "vdcApi.cloneVAppTemplate returned VAppTemplate that did not contain any tasks");
assertTaskSucceedsLong(task);
Checks.checkVAppTemplate(clonedVAppTemplate);
@ -204,7 +204,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public void testComposeVApp() {
String name = name("composed-");
composedVApp = vdcClient.composeVApp(vdcURI, ComposeVAppParams.builder()
composedVApp = vdcApi.composeVApp(vdcURI, ComposeVAppParams.builder()
.name(name)
// TODO: test optional params
//.sourcedItem(SourcedCompositionItemParam.builder()
@ -223,7 +223,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build());
Task task = Iterables.getFirst(composedVApp.getTasks(), null);
assertNotNull(task, "vdcClient.composeVApp returned VApp that did not contain any tasks");
assertNotNull(task, "vdcApi.composeVApp returned VApp that did not contain any tasks");
assertTaskSucceedsLong(task);
Checks.checkVApp(composedVApp);
@ -231,10 +231,10 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
String.format(OBJ_FIELD_EQ, "VApp", "name", name, composedVApp.getName()));
}
// TODO Duplicates code in VAppClientLiveTest
// TODO Duplicates code in VAppApiLiveTest
@Test(description = "POST /vdc/{id}/action/instantiateVAppTemplate")
public void testInstantiateVAppTemplate() {
Vdc vdc = vdcClient.getVdc(vdcURI);
Vdc vdc = vdcApi.getVdc(vdcURI);
Set<Reference> networks = vdc.getAvailableNetworks();
Optional<Reference> parentNetwork = Iterables.tryFind(
@ -276,7 +276,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.source(vAppTemplateURI)
.build();
instantiatedVApp = vdcClient.instantiateVApp(vdcURI, instantiate);
instantiatedVApp = vdcApi.instantiateVApp(vdcURI, instantiate);
Task instantiationTask = Iterables.getFirst(instantiatedVApp.getTasks(), null);
assertTaskSucceedsLong(instantiationTask);
@ -301,7 +301,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
//.manifestRequired(true)
.build();
uploadedVAppTemplate = vdcClient.uploadVAppTemplate(vdcURI, uploadVAppTemplateParams);
uploadedVAppTemplate = vdcApi.uploadVAppTemplate(vdcURI, uploadVAppTemplateParams);
Checks.checkVAppTemplateWhenNotReady(uploadedVAppTemplate);
@ -316,7 +316,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
}
private void setupMetadata() {
adminContext.getApi().getVdcClient().getMetadataClient().setMetadata(toAdminUri(vdcURI),
adminContext.getApi().getVdcApi().getMetadataApi().setMetadata(toAdminUri(vdcURI),
"key", MetadataValue.builder().value("value").build());
metadataSet = true;
}
@ -327,7 +327,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
setupMetadata();
}
Metadata metadata = vdcClient.getMetadataClient().getMetadata(vdcURI);
Metadata metadata = vdcApi.getMetadataApi().getMetadata(vdcURI);
// required for testing
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
@ -339,12 +339,12 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /vdc/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" } )
public void testGetMetadataValue() {
// First find a key
Metadata metadata = vdcClient.getMetadataClient().getMetadata(vdcURI);
Metadata metadata = vdcApi.getMetadataApi().getMetadata(vdcURI);
Map<String, String> metadataMap = Checks.metadataToMap(metadata);
String key = Iterables.getFirst(metadataMap.keySet(), "MadeUpKey!");
String value = metadataMap.get(key);
MetadataValue metadataValue = vdcClient.getMetadataClient().getMetadataValue(vdcURI, key);
MetadataValue metadataValue = vdcApi.getMetadataApi().getMetadataValue(vdcURI, key);
Checks.checkMetadataValueFor(VDC, metadataValue, value);
}

View File

@ -49,8 +49,8 @@ import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection;
import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.internal.annotations.Sets;
@ -59,12 +59,12 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multimaps;
/**
* Allows us to test the {@link VmClient} via its side effects.
* Allows us to test the {@link VmApi} via its side effects.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "VmClientExpectTest")
public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "VmApiExpectTest")
public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
private String vmId = "vm-d0e2b6b9-4381-4ddc-9572-cdfae54059be";
private URI vmURI = URI.create(endpoint + vmId);
@ -75,7 +75,7 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(enabled = false)//TODO
public void testGetVm() {
VCloudDirectorClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId)
.acceptMedia(VCloudDirectorMediaType.VM)
@ -86,12 +86,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Vm expected = getVm();
assertEquals(client.getVmClient().getVm(vmURI), expected);
assertEquals(api.getVmApi().getVm(vmURI), expected);
}
@Test(enabled = false)
public void testModifyVm() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId)
.xmlFilePayload("/vm/modifyVm.xml", VCloudDirectorMediaType.VM)
@ -107,12 +107,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyVmTask();
assertEquals(client.getVmClient().modifyVm(vmURI, modified), expected);
assertEquals(api.getVmApi().modifyVm(vmURI, modified), expected);
}
@Test(enabled = false)
public void testDeleteVm() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("DELETE", vmId)
.acceptAnyMedia()
@ -123,12 +123,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = deleteVmTask();
assertEquals(client.getVmClient().deleteVm(vmURI), expected);
assertEquals(api.getVmApi().deleteVm(vmURI), expected);
}
@Test(enabled = false)
public void testConsolidateVm() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/action/consolidate")
.acceptAnyMedia()
@ -139,12 +139,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = consolidateVmTask();
assertEquals(client.getVmClient().consolidateVm(vmURI), expected);
assertEquals(api.getVmApi().consolidateVm(vmURI), expected);
}
@Test(enabled = false)
public void testDeploy() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/action/deploy")
.xmlFilePayload("/vm/deployParams.xml", VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS)
@ -159,12 +159,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = deployTask();
assertEquals(client.getVmClient().deploy(vmURI, params), expected);
assertEquals(api.getVmApi().deploy(vmURI, params), expected);
}
@Test(enabled = false)
public void testDiscardSuspendedState() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/action/discardSuspendedState")
.acceptAnyMedia()
@ -175,12 +175,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = discardSuspendedStateTask();
assertEquals(client.getVmClient().discardSuspendedState(vmURI), expected);
assertEquals(api.getVmApi().discardSuspendedState(vmURI), expected);
}
@Test(enabled = false)
public void testInstallVMwareTools() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/action/installVMwareTools")
.acceptAnyMedia()
@ -191,12 +191,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = installVMwareToolsTask();
assertEquals(client.getVmClient().installVMwareTools(vmURI), expected);
assertEquals(api.getVmApi().installVMwareTools(vmURI), expected);
}
@Test(enabled = false)
public void testRelocate() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/action/relocate")
.xmlFilePayload("/vApp/relocateParams.xml", VCloudDirectorMediaType.RELOCATE_VM_PARAMS)
@ -211,12 +211,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = relocateTask();
assertEquals(client.getVmClient().relocateVm(vmURI, params), expected);
assertEquals(api.getVmApi().relocateVm(vmURI, params), expected);
}
@Test(enabled = false)
public void testUndeploy() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/action/undeploy")
.xmlFilePayload("/vApp/undeployParams.xml", VCloudDirectorMediaType.UNDEPLOY_VAPP_PARAMS)
@ -231,12 +231,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = undeployTask();
assertEquals(client.getVmClient().undeploy(vmURI, params), expected);
assertEquals(api.getVmApi().undeploy(vmURI, params), expected);
}
@Test(enabled = false)
public void testUpgradeHardwareVersion() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/action/upgradeHardwareVersion")
.acceptAnyMedia()
@ -247,12 +247,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = upgradeHardwareVersionTask();
assertEquals(client.getVmClient().upgradeHardwareVersion(vmURI), expected);
assertEquals(api.getVmApi().upgradeHardwareVersion(vmURI), expected);
}
@Test(enabled = false)
public void testPowerOff() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/power/action/powerOff")
.acceptAnyMedia()
@ -263,12 +263,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = powerOffTask();
assertEquals(client.getVmClient().powerOff(vmURI), expected);
assertEquals(api.getVmApi().powerOff(vmURI), expected);
}
@Test(enabled = false)
public void testPowerOn() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/power/action/powerOn")
.acceptAnyMedia()
@ -279,12 +279,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = powerOnTask();
assertEquals(client.getVmClient().powerOn(vmURI), expected);
assertEquals(api.getVmApi().powerOn(vmURI), expected);
}
@Test(enabled = false)
public void testReboot() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/power/action/reboot")
.acceptAnyMedia()
@ -295,12 +295,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = rebootTask();
assertEquals(client.getVmClient().reboot(vmURI), expected);
assertEquals(api.getVmApi().reboot(vmURI), expected);
}
@Test(enabled = false)
public void testReset() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/power/action/reset")
.acceptAnyMedia()
@ -311,12 +311,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = resetTask();
assertEquals(client.getVmClient().reset(vmURI), expected);
assertEquals(api.getVmApi().reset(vmURI), expected);
}
@Test(enabled = false)
public void testShutdown() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/power/action/shutdown")
.acceptAnyMedia()
@ -327,12 +327,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = shutdownTask();
assertEquals(client.getVmClient().shutdown(vmURI), expected);
assertEquals(api.getVmApi().shutdown(vmURI), expected);
}
@Test(enabled = false)
public void testSuspend() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/power/action/suspend")
.acceptAnyMedia()
@ -343,12 +343,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = suspendTask();
assertEquals(client.getVmClient().suspend(vmURI), expected);
assertEquals(api.getVmApi().suspend(vmURI), expected);
}
@Test(enabled = false)
public void testGetGuestCustomizationSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/guestCustomizationSection")
.acceptAnyMedia()
@ -359,12 +359,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
GuestCustomizationSection expected = getGuestCustomizationSection();
assertEquals(client.getVmClient().getGuestCustomizationSection(vmURI), expected);
assertEquals(api.getVmApi().getGuestCustomizationSection(vmURI), expected);
}
@Test(enabled = false)
public void testModifyGuestCustomizationSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/guestCustomizationSection")
.xmlFilePayload("/vApp/modifyGuestCustomizationSection.xml", VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION)
@ -379,12 +379,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyGuestCustomizationSectionTask();
assertEquals(client.getVmClient().modifyGuestCustomizationSection(vmURI, section), expected);
assertEquals(api.getVmApi().modifyGuestCustomizationSection(vmURI, section), expected);
}
@Test(enabled = false)
public void testEjectMedia() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/media/action/ejectMedia")
.xmlFilePayload("/vApp/ejectMediaParams.xml", VCloudDirectorMediaType.MEDIA_PARAMS)
@ -399,12 +399,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = ejectMediaTask();
assertEquals(client.getVmClient().ejectMedia(vmURI, params), expected);
assertEquals(api.getVmApi().ejectMedia(vmURI, params), expected);
}
@Test(enabled = false)
public void testInsertMedia() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/media/action/insertMedia")
.xmlFilePayload("/vApp/insertMediaParams.xml", VCloudDirectorMediaType.MEDIA_PARAMS)
@ -419,12 +419,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = insertMediaTask();
assertEquals(client.getVmClient().insertMedia(vmURI, params), expected);
assertEquals(api.getVmApi().insertMedia(vmURI, params), expected);
}
@Test(enabled = false)
public void testGetNetworkConnectionSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/networkConnectionSection")
.acceptAnyMedia()
@ -435,12 +435,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
NetworkConnectionSection expected = getNetworkConnectionSection();
assertEquals(client.getVmClient().getNetworkConnectionSection(vmURI), expected);
assertEquals(api.getVmApi().getNetworkConnectionSection(vmURI), expected);
}
@Test(enabled = false)
public void testModifyNetworkConnectionSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/networkConnectionSection")
.xmlFilePayload("/vApp/modifyNetworkConnectionSection.xml", VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION)
@ -455,12 +455,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyNetworkConnectionSectionTask();
assertEquals(client.getVmClient().modifyNetworkConnectionSection(vmURI, section), expected);
assertEquals(api.getVmApi().modifyNetworkConnectionSection(vmURI, section), expected);
}
@Test(enabled = false)
public void testGetOperatingSystemSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/operatingSystemSection")
.acceptAnyMedia()
@ -471,12 +471,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
OperatingSystemSection expected = getOperatingSystemSection();
assertEquals(client.getVmClient().getOperatingSystemSection(vmURI), expected);
assertEquals(api.getVmApi().getOperatingSystemSection(vmURI), expected);
}
@Test(enabled = false)
public void testModifyOperatingSystemSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/operatingSystemSection")
.xmlFilePayload("/vApp/modifyOperatingSystemSection.xml", VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION)
@ -491,12 +491,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyOperatingSystemSectionTask();
assertEquals(client.getVmClient().modifyOperatingSystemSection(vmURI, section), expected);
assertEquals(api.getVmApi().modifyOperatingSystemSection(vmURI, section), expected);
}
@Test(enabled = false)
public void testGetProductSections() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/productSections")
.acceptAnyMedia()
@ -507,12 +507,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
ProductSectionList expected = getProductSections();
assertEquals(client.getVmClient().getProductSections(vmURI), expected);
assertEquals(api.getVmApi().getProductSections(vmURI), expected);
}
@Test(enabled = false)
public void testModifyProductSections() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/productSections")
.xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST)
@ -524,12 +524,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyProductSectionsTask();
assertEquals(client.getVmClient().modifyProductSections(vmURI, null), expected);
assertEquals(api.getVmApi().modifyProductSections(vmURI, null), expected);
}
@Test(enabled = false)
public void testGetPendingQuestion() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/question")
.acceptAnyMedia()
@ -540,12 +540,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
VmPendingQuestion expected = getPendingQuestion();
assertEquals(client.getVmClient().getPendingQuestion(vmURI), expected);
assertEquals(api.getVmApi().getPendingQuestion(vmURI), expected);
}
@Test(enabled = false)
public void testAnswerQuestion() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/question/action/answer")
.xmlFilePayload("/vApp/answerQuestion.xml", VCloudDirectorMediaType.VM_PENDING_ANSWER)
@ -557,12 +557,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
VmQuestionAnswer answer = null; // = VmQuestionAnswer.builder();
// .build;
client.getVmClient().answerQuestion(vmURI, answer);
api.getVmApi().answerQuestion(vmURI, answer);
}
@Test(enabled = false)
public void testGetRuntimeInfoSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/runtimeInfoSection")
.acceptAnyMedia()
@ -573,12 +573,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
RuntimeInfoSection expected = getRuntimeInfoSection();
assertEquals(client.getVmClient().getRuntimeInfoSection(vmURI), expected);
assertEquals(api.getVmApi().getRuntimeInfoSection(vmURI), expected);
}
@Test(enabled = false)
public void testGetScreenImage() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/screen")
.acceptMedia(VCloudDirectorMediaType.ANY_IMAGE)
@ -591,12 +591,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
byte[] expected = getScreenImage();
assertEquals(client.getVmClient().getScreenImage(vmURI), expected);
assertEquals(api.getVmApi().getScreenImage(vmURI), expected);
}
@Test(enabled = false)
public void testGetScreenTicket() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", vmId + "/screen/action/acquireTicket")
.acceptAnyMedia()
@ -607,12 +607,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
ScreenTicket expected = getScreenTicket();
assertEquals(client.getVmClient().getScreenTicket(vmURI), expected);
assertEquals(api.getVmApi().getScreenTicket(vmURI), expected);
}
@Test(enabled = false)
public void testGetVirtualHardwareSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/virtualHardwareSection")
.acceptAnyMedia()
@ -623,12 +623,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
VirtualHardwareSection expected = getVirtualHardwareSection();
assertEquals(client.getVmClient().getVirtualHardwareSection(vmURI), expected);
assertEquals(api.getVmApi().getVirtualHardwareSection(vmURI), expected);
}
@Test(enabled = false)
public void testModifyVirtualHardwareSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/virtualHardwareSection")
.xmlFilePayload("/vApp/modifyVirtualHardwareSection.xml", VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION)
@ -643,12 +643,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyVirtualHardwareSectionTask();
assertEquals(client.getVmClient().modifyVirtualHardwareSection(vmURI, section), expected);
assertEquals(api.getVmApi().modifyVirtualHardwareSection(vmURI, section), expected);
}
@Test(enabled = false)
public void testGetVirtualHardwareSectionCpu() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/virtualHardwareSection/cpu")
.acceptAnyMedia()
@ -659,12 +659,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
RasdItem expected = getVirtualHardwareSectionCpu();
assertEquals(client.getVmClient().getVirtualHardwareSectionCpu(vmURI), expected);
assertEquals(api.getVmApi().getVirtualHardwareSectionCpu(vmURI), expected);
}
@Test(enabled = false)
public void testModifyVirtualHardwareSectionCpu() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("", vmId + "/virtualHardwareSection/cpu")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM)
@ -679,12 +679,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyVirtualHardwareSectionCpuTask();
assertEquals(client.getVmClient().modifyVirtualHardwareSectionCpu(vmURI, cpu), expected);
assertEquals(api.getVmApi().modifyVirtualHardwareSectionCpu(vmURI, cpu), expected);
}
@Test(enabled = false)
public void testGetVirtualHardwareSectionDisks() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/virtualHardwareSection/disks")
.acceptAnyMedia()
@ -695,12 +695,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
RasdItemsList expected = getVirtualHardwareSectionDisks();
assertEquals(client.getVmClient().getVirtualHardwareSectionDisks(vmURI), expected);
assertEquals(api.getVmApi().getVirtualHardwareSectionDisks(vmURI), expected);
}
@Test(enabled = false)
public void testModifyVirtualHardwareSectionDisks() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/virtualHardwareSection/disks")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionDisks.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
@ -715,12 +715,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyVirtualHardwareSectionDisksTask();
assertEquals(client.getVmClient().modifyVirtualHardwareSectionDisks(vmURI, disks), expected);
assertEquals(api.getVmApi().modifyVirtualHardwareSectionDisks(vmURI, disks), expected);
}
@Test(enabled = false)
public void testGetVirtualHardwareSectionMedia() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/virtualHardwareSection/media")
.acceptAnyMedia()
@ -731,12 +731,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
RasdItemsList expected = getVirtualHardwareSectionMedia();
assertEquals(client.getVmClient().getVirtualHardwareSectionMedia(vmURI), expected);
assertEquals(api.getVmApi().getVirtualHardwareSectionMedia(vmURI), expected);
}
@Test(enabled = false)
public void testGetVirtualHardwareSectionMemory() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/virtualHardwareSection/memory")
.acceptAnyMedia()
@ -747,12 +747,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
RasdItem expected = getVirtualHardwareSectionMemory();
assertEquals(client.getVmClient().getVirtualHardwareSectionMemory(vmURI), expected);
assertEquals(api.getVmApi().getVirtualHardwareSectionMemory(vmURI), expected);
}
@Test(enabled = false)
public void testModifyVirtualHardwareSectionMemory() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/virtualHardwareSection/memory")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.VAPP)
@ -767,12 +767,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyVirtualHardwareSectionMemoryTask();
assertEquals(client.getVmClient().modifyVirtualHardwareSectionMemory(vmURI, memory), expected);
assertEquals(api.getVmApi().modifyVirtualHardwareSectionMemory(vmURI, memory), expected);
}
@Test(enabled = false)
public void testGetVirtualHardwareSectionNetworkCards() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/virtualHardwareSection/networkCards")
.acceptAnyMedia()
@ -783,12 +783,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
RasdItemsList expected = getVirtualHardwareSectionNetworkCards();
assertEquals(client.getVmClient().getVirtualHardwareSectionNetworkCards(vmURI), expected);
assertEquals(api.getVmApi().getVirtualHardwareSectionNetworkCards(vmURI), expected);
}
@Test(enabled = false)
public void testModifyVirtualHardwareSectionNetworkCards() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/virtualHardwareSection/networkCards")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionNetworkCards.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
@ -803,12 +803,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyVirtualHardwareSectionNetworkCardsTask();
assertEquals(client.getVmClient().modifyVirtualHardwareSectionNetworkCards(vmURI, networkCards), expected);
assertEquals(api.getVmApi().modifyVirtualHardwareSectionNetworkCards(vmURI, networkCards), expected);
}
@Test(enabled = false)
public void testGetVirtualHardwareSectionSerialPorts() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vmId + "/virtualHardwareSection/serialPorts")
.acceptAnyMedia()
@ -819,12 +819,12 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
RasdItemsList expected = getVirtualHardwareSectionSerialPorts();
assertEquals(client.getVmClient().getVirtualHardwareSectionSerialPorts(vmURI), expected);
assertEquals(api.getVmApi().getVirtualHardwareSectionSerialPorts(vmURI), expected);
}
@Test(enabled = false)
public void testModifyVirtualHardwareSectionSerialPorts() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/virtualHardwareSection/serialPorts")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionSerialPorts.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
@ -839,7 +839,7 @@ public class VmClientExpectTest extends VCloudDirectorAdminClientExpectTest {
Task expected = modifyVirtualHardwareSectionSerialPortsTask();
assertEquals(client.getVmClient().modifyVirtualHardwareSectionSerialPorts(vmURI, serialPorts), expected);
assertEquals(api.getVmApi().modifyVirtualHardwareSectionSerialPorts(vmURI, serialPorts), expected);
}
public static Vm getVm() {

View File

@ -64,7 +64,7 @@ import org.jclouds.dmtf.cim.ResourceAllocationSettingData;
import org.jclouds.dmtf.ovf.MsgType;
import org.jclouds.dmtf.ovf.ProductSection;
import org.jclouds.io.Payloads;
import org.jclouds.vcloud.director.v1_5.AbstractVAppClientLiveTest;
import org.jclouds.vcloud.director.v1_5.AbstractVAppApiLiveTest;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Checks;
import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -108,12 +108,12 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
/**
* Tests behavior of the {@link VmClient}.
* Tests behavior of the {@link VmApi}.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VmClientLiveTest")
public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VmApiLiveTest")
public class VmApiLiveTest extends AbstractVAppApiLiveTest {
private MetadataValue metadataValue;
private String key;
@ -121,9 +121,9 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
private boolean mediaCreated = false;
private boolean testUserCreated = false;
@BeforeClass(alwaysRun = true, dependsOnMethods = { "setupRequiredClients" })
@BeforeClass(alwaysRun = true, dependsOnMethods = { "setupRequiredApis" })
protected void setupRequiredEntities() {
Set<Link> links = vdcClient.getVdc(vdcURI).getLinks();
Set<Link> links = vdcApi.getVdc(vdcURI).getLinks();
if (mediaURI == null) {
Predicate<Link> addMediaLink = and(relEquals(Link.Rel.ADD), typeEquals(VCloudDirectorMediaType.MEDIA));
@ -137,21 +137,21 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.name(name("media"))
.size(iso.length)
.imageType(Media.ImageType.ISO)
.description("Test media generated by VmClientLiveTest")
.description("Test media generated by VmApiLiveTest")
.build();
Media media = context.getApi().getMediaClient().createMedia(addMedia.getHref(), sourceMedia);
Media media = context.getApi().getMediaApi().createMedia(addMedia.getHref(), sourceMedia);
Link uploadLink = getFirst(getFirst(media.getFiles(), null).getLinks(), null);
context.getApi().getUploadClient().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
media = context.getApi().getMediaClient().getMedia(media.getHref());
media = context.getApi().getMediaApi().getMedia(media.getHref());
if (media.getTasks().size() == 1) {
Task uploadTask = Iterables.getOnlyElement(media.getTasks());
Checks.checkTask(uploadTask);
assertEquals(uploadTask.getStatus(), Task.Status.RUNNING);
assertTrue(retryTaskSuccess.apply(uploadTask), String.format(TASK_COMPLETE_TIMELY, "uploadTask"));
media = context.getApi().getMediaClient().getMedia(media.getHref());
media = context.getApi().getMediaApi().getMedia(media.getHref());
}
mediaURI = media.getHref();
@ -161,7 +161,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
if (adminContext != null) {
Link orgLink = find(links, and(relEquals("up"), typeEquals(VCloudDirectorMediaType.ORG)));
testUserURI = adminContext.getApi().getUserClient().createUser(toAdminUri(orgLink), randomTestUser("VAppAccessTest")).getHref();
testUserURI = adminContext.getApi().getUserApi().createUser(toAdminUri(orgLink), randomTestUser("VAppAccessTest")).getHref();
} else {
testUserURI = userURI;
}
@ -171,7 +171,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
public void cleanUp() {
if (adminContext != null && mediaCreated && mediaURI != null) {
try {
Task delete = context.getApi().getMediaClient().deleteMedia(mediaURI);
Task delete = context.getApi().getMediaApi().deleteMedia(mediaURI);
taskDoneEventually(delete);
} catch (Exception e) {
logger.warn("Error when deleting media: %s", e.getMessage());
@ -179,7 +179,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
}
if (adminContext != null && testUserCreated && testUserURI != null) {
try {
adminContext.getApi().getUserClient().deleteUser(testUserURI);
adminContext.getApi().getUserApi().deleteUser(testUserURI);
} catch (Exception e) {
logger.warn("Error when deleting user: %s", e.getMessage());
}
@ -187,12 +187,12 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
}
/**
* @see VmClient#getVm(URI)
* @see VmApi#getVm(URI)
*/
@Test(description = "GET /vApp/{id}")
public void testGetVm() {
// The method under test
vm = vmClient.getVm(vmURI);
vm = vmApi.getVm(vmURI);
// Check the retrieved object is well formed
checkVm(vm);
@ -205,7 +205,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
}
/**
* @see VmClient#modifyVm(URI, Vm)
* @see VmApi#modifyVm(URI, Vm)
*/
@Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVm" })
public void testModifyVm() {
@ -215,11 +215,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task modifyVm = vmClient.modifyVm(vm.getHref(), newVm);
Task modifyVm = vmApi.modifyVm(vm.getHref(), newVm);
assertTrue(retryTaskSuccess.apply(modifyVm), String.format(TASK_COMPLETE_TIMELY, "modifyVm"));
// Get the updated Vm
vm = vmClient.getVm(vm.getHref());
vm = vmApi.getVm(vm.getHref());
// Check the required fields are set
assertEquals(vm.getName(), newVm.getName(), String.format(OBJ_FIELD_EQ, VM, "Name", newVm.getName(), vm.getName()));
@ -235,11 +235,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task deployVm = vmClient.deploy(vm.getHref(), params);
Task deployVm = vmApi.deploy(vm.getHref(), params);
assertTrue(retryTaskSuccessLong.apply(deployVm), String.format(TASK_COMPLETE_TIMELY, "deployVm"));
// Get the updated Vm
vm = vmClient.getVm(vm.getHref());
vm = vmApi.getVm(vm.getHref());
// Check the required fields are set
assertTrue(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VM, "deployed", "TRUE", vm.isDeployed().toString()));
@ -254,11 +254,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOffVm(vm.getHref());
// The method under test
Task powerOnVm = vmClient.powerOn(vm.getHref());
Task powerOnVm = vmApi.powerOn(vm.getHref());
assertTaskSucceedsLong(powerOnVm);
// Get the updated Vm
vm = vmClient.getVm(vm.getHref());
vm = vmApi.getVm(vm.getHref());
// Check status
assertVmStatus(vm.getHref(), Status.POWERED_ON);
@ -270,11 +270,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOnVm(vm.getHref());
// The method under test
Task reboot = vmClient.reboot(vm.getHref());
Task reboot = vmApi.reboot(vm.getHref());
assertTaskSucceedsLong(reboot);
// Get the updated Vm
vm = vmClient.getVm(vm.getHref());
vm = vmApi.getVm(vm.getHref());
// Check status
assertVmStatus(vmURI, Status.POWERED_OFF);
@ -286,11 +286,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOnVm(vm.getHref());
// The method under test
Task shutdown = vmClient.shutdown(vmURI);
Task shutdown = vmApi.shutdown(vmURI);
assertTaskSucceedsLong(shutdown);
// Get the updated Vm
vm = vmClient.getVm(vmURI);
vm = vmApi.getVm(vmURI);
// Check status
assertVmStatus(vmURI, Status.POWERED_OFF);
@ -305,11 +305,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOnVm(vm.getHref());
// The method under test
Task suspend = vmClient.suspend(vmURI);
Task suspend = vmApi.suspend(vmURI);
assertTaskSucceedsLong(suspend);
// Get the updated Vm
vm = vmClient.getVm(vm.getHref());
vm = vmApi.getVm(vm.getHref());
// Check status
assertVmStatus(vmURI, Status.SUSPENDED);
@ -324,11 +324,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOnVm(vm.getHref());
// The method under test
Task reset = vmClient.reset(vmURI);
Task reset = vmApi.reset(vmURI);
assertTaskSucceedsLong(reset);
// Get the updated Vm
vm = vmClient.getVm(vm.getHref());
vm = vmApi.getVm(vm.getHref());
// Check status
assertVmStatus(vmURI, Status.POWERED_ON);
@ -342,11 +342,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
UndeployVAppParams params = UndeployVAppParams.builder().build();
// The method under test
Task undeploy = vmClient.undeploy(vm.getHref(), params);
Task undeploy = vmApi.undeploy(vm.getHref(), params);
assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
// Get the updated Vm
vm = vmClient.getVm(vm.getHref());
vm = vmApi.getVm(vm.getHref());
// Check status
assertFalse(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VM, "deployed", "FALSE", vm.isDeployed().toString()));
@ -359,11 +359,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOnVm(vm.getHref());
// The method under test
Task powerOffVm = vmClient.powerOff(vm.getHref());
Task powerOffVm = vmApi.powerOff(vm.getHref());
assertTrue(retryTaskSuccess.apply(powerOffVm), String.format(TASK_COMPLETE_TIMELY, "powerOffVm"));
// Get the updated Vm
vm = vmClient.getVm(vmURI);
vm = vmApi.getVm(vmURI);
// Check status
assertVmStatus(vmURI, Status.POWERED_OFF);
@ -375,7 +375,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOnVm(vm.getHref());
// The method under test
Task consolidateVm = vmClient.consolidateVm(vm.getHref());
Task consolidateVm = vmApi.consolidateVm(vm.getHref());
assertTrue(retryTaskSuccess.apply(consolidateVm), String.format(TASK_COMPLETE_TIMELY, "consolidateVm"));
}
@ -385,7 +385,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = suspendVm(vm.getHref());
// The method under test
Task discardSuspendedState = vmClient.discardSuspendedState(vm.getHref());
Task discardSuspendedState = vmApi.discardSuspendedState(vm.getHref());
assertTrue(retryTaskSuccess.apply(discardSuspendedState), String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
}
@ -395,7 +395,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOnVm(vm.getHref());
// The method under test
Task installVMwareTools = vmClient.installVMwareTools(vm.getHref());
Task installVMwareTools = vmApi.installVMwareTools(vm.getHref());
assertTrue(retryTaskSuccess.apply(installVMwareTools), String.format(TASK_COMPLETE_TIMELY, "installVMwareTools"));
}
@ -403,12 +403,12 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "POST /vApp/{id}/action/relocate", dependsOnMethods = { "testGetVm" })
public void testRelocate() {
// Relocate to the last of the available datastores
QueryResultRecords records = context.getApi().getQueryClient().queryAll("datastore");
QueryResultRecords records = context.getApi().getQueryApi().queryAll("datastore");
QueryResultRecordType datastore = Iterables.getLast(records.getRecords());
RelocateParams params = RelocateParams.builder().datastore(Reference.builder().href(datastore.getHref()).build()).build();
// The method under test
Task relocate = vmClient.relocateVm(vm.getHref(), params);
Task relocate = vmApi.relocateVm(vm.getHref(), params);
assertTrue(retryTaskSuccess.apply(relocate), String.format(TASK_COMPLETE_TIMELY, "relocate"));
}
@ -418,7 +418,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOffVm(vm.getHref());
// The method under test
Task upgradeHardwareVersion = vmClient.upgradeHardwareVersion(vm.getHref());
Task upgradeHardwareVersion = vmApi.upgradeHardwareVersion(vm.getHref());
assertTrue(retryTaskSuccess.apply(upgradeHardwareVersion), String.format(TASK_COMPLETE_TIMELY, "upgradeHardwareVersion"));
}
@ -427,7 +427,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
getGuestCustomizationSection(new Function<URI, GuestCustomizationSection>() {
@Override
public GuestCustomizationSection apply(URI uri) {
return vmClient.getGuestCustomizationSection(uri);
return vmApi.getGuestCustomizationSection(uri);
}
});
}
@ -435,7 +435,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" })
public void testModifyGuestCustomizationSection() {
// Copy existing section and update fields
GuestCustomizationSection oldSection = vmClient.getGuestCustomizationSection(vm.getHref());
GuestCustomizationSection oldSection = vmApi.getGuestCustomizationSection(vm.getHref());
GuestCustomizationSection newSection = oldSection.toBuilder()
.computerName(name("n"))
.enabled(Boolean.FALSE)
@ -443,11 +443,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task modifyGuestCustomizationSection = vmClient.modifyGuestCustomizationSection(vm.getHref(), newSection);
Task modifyGuestCustomizationSection = vmApi.modifyGuestCustomizationSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyGuestCustomizationSection), String.format(TASK_COMPLETE_TIMELY, "modifyGuestCustomizationSection"));
// Retrieve the modified section
GuestCustomizationSection modified = vmClient.getGuestCustomizationSection(vm.getHref());
GuestCustomizationSection modified = vmApi.getGuestCustomizationSection(vm.getHref());
// Check the retrieved object is well formed
checkGuestCustomizationSection(modified);
@ -472,7 +472,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task insertMedia = vmClient.insertMedia(vm.getHref(), params);
Task insertMedia = vmApi.insertMedia(vm.getHref(), params);
assertTrue(retryTaskSuccess.apply(insertMedia), String.format(TASK_COMPLETE_TIMELY, "insertMedia"));
}
@ -484,7 +484,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task ejectMedia = vmClient.ejectMedia(vm.getHref(), params);
Task ejectMedia = vmApi.ejectMedia(vm.getHref(), params);
assertTrue(retryTaskSuccess.apply(ejectMedia), String.format(TASK_COMPLETE_TIMELY, "ejectMedia"));
}
@ -493,7 +493,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
getNetworkConnectionSection(new Function<URI, NetworkConnectionSection>() {
@Override
public NetworkConnectionSection apply(URI uri) {
return vmClient.getNetworkConnectionSection(uri);
return vmApi.getNetworkConnectionSection(uri);
}
});
}
@ -506,7 +506,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
Reference network = Iterables.getLast(networks);
// Copy existing section and update fields
NetworkConnectionSection oldSection = vmClient.getNetworkConnectionSection(vm.getHref());
NetworkConnectionSection oldSection = vmApi.getNetworkConnectionSection(vm.getHref());
NetworkConnectionSection newSection = oldSection.toBuilder()
.networkConnection(NetworkConnection.builder()
.ipAddressAllocationMode(IpAddressAllocationMode.DHCP.toString())
@ -515,11 +515,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task modifyNetworkConnectionSection = vmClient.modifyNetworkConnectionSection(vm.getHref(), newSection);
Task modifyNetworkConnectionSection = vmApi.modifyNetworkConnectionSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyNetworkConnectionSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConnectionSection"));
// Retrieve the modified section
NetworkConnectionSection modified = vmClient.getNetworkConnectionSection(vm.getHref());
NetworkConnectionSection modified = vmApi.getNetworkConnectionSection(vm.getHref());
// Check the retrieved object is well formed
checkNetworkConnectionSection(modified);
@ -534,7 +534,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetVm" })
public void testGetOperatingSystemSection() {
// The method under test
OperatingSystemSection section = vmClient.getOperatingSystemSection(vm.getHref());
OperatingSystemSection section = vmApi.getOperatingSystemSection(vm.getHref());
// Check the retrieved object is well formed
checkOperatingSystemSection(section);
@ -550,11 +550,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task modifyOperatingSystemSection = vmClient.modifyOperatingSystemSection(vm.getHref(), newSection);
Task modifyOperatingSystemSection = vmApi.modifyOperatingSystemSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyOperatingSystemSection), String.format(TASK_COMPLETE_TIMELY, "modifyOperatingSystemSection"));
// Retrieve the modified section
OperatingSystemSection modified = vmClient.getOperatingSystemSection(vm.getHref());
OperatingSystemSection modified = vmApi.getOperatingSystemSection(vm.getHref());
// Check the retrieved object is well formed
checkOperatingSystemSection(modified);
@ -566,7 +566,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/productSections", dependsOnMethods = { "testGetVm" })
public void testGetProductSections() {
// The method under test
ProductSectionList sectionList = vmClient.getProductSections(vm.getHref());
ProductSectionList sectionList = vmApi.getProductSections(vm.getHref());
// Check the retrieved object is well formed
checkProductSectionList(sectionList);
@ -575,7 +575,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
public void testModifyProductSections() {
// Copy existing section and update fields
ProductSectionList oldSections = vmClient.getProductSections(vm.getHref());
ProductSectionList oldSections = vmApi.getProductSections(vm.getHref());
ProductSectionList newSections = oldSections.toBuilder()
.productSection(ProductSection.builder()
.info("Information about the installed software") // Default ovf:Info text
@ -587,11 +587,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task modifyProductSections = vmClient.modifyProductSections(vm.getHref(), newSections);
Task modifyProductSections = vmApi.modifyProductSections(vm.getHref(), newSections);
assertTrue(retryTaskSuccess.apply(modifyProductSections), String.format(TASK_COMPLETE_TIMELY, "modifyProductSections"));
// Retrieve the modified section
ProductSectionList modified = vmClient.getProductSections(vm.getHref());
ProductSectionList modified = vmApi.getProductSections(vm.getHref());
// Check the retrieved object is well formed
checkProductSectionList(modified);
@ -612,7 +612,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
// TODO how to test?
// The method under test
VmPendingQuestion question = vmClient.getPendingQuestion(vm.getHref());
VmPendingQuestion question = vmApi.getPendingQuestion(vm.getHref());
// Check the retrieved object is well formed
checkVmPendingQuestion(question);
@ -623,7 +623,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
// TODO check that the question has been answered (e.g. asking for getPendingQuestion does not
// include our answered question).
VmPendingQuestion question = vmClient.getPendingQuestion(vm.getHref());
VmPendingQuestion question = vmApi.getPendingQuestion(vm.getHref());
List<VmQuestionAnswerChoice> answerChoices = question.getChoices();
VmQuestionAnswerChoice answerChoice = Iterables.getFirst(answerChoices, null);
assertNotNull(answerChoice, "Question "+question+" must have at least once answer-choice");
@ -633,13 +633,13 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.questionId(question.getQuestionId())
.build();
vmClient.answerQuestion(vm.getHref(), answer);
vmApi.answerQuestion(vm.getHref(), answer);
}
@Test(description = "GET /vApp/{id}/runtimeInfoSection", dependsOnMethods = { "testGetVm" })
public void testGetRuntimeInfoSection() {
// The method under test
RuntimeInfoSection section = vmClient.getRuntimeInfoSection(vm.getHref());
RuntimeInfoSection section = vmApi.getRuntimeInfoSection(vm.getHref());
// Check the retrieved object is well formed
checkRuntimeInfoSection(section);
@ -652,7 +652,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOnVm(vm.getHref());
// The method under test
byte[] image = vmClient.getScreenImage(vm.getHref());
byte[] image = vmApi.getScreenImage(vm.getHref());
// Check returned bytes against PNG header magic number
byte[] pngHeaderBytes = new byte[] { (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
@ -669,7 +669,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOnVm(vm.getHref());
// The method under test
ScreenTicket ticket = vmClient.getScreenTicket(vm.getHref());
ScreenTicket ticket = vmApi.getScreenTicket(vm.getHref());
// Check the retrieved object is well formed
checkScreenTicket(ticket);
@ -678,7 +678,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVm" })
public void testGetVirtualHardwareSection() {
// Method under test
VirtualHardwareSection hardware = vmClient.getVirtualHardwareSection(vm.getHref());
VirtualHardwareSection hardware = vmApi.getVirtualHardwareSection(vm.getHref());
// Check the retrieved object is well formed
checkVirtualHardwareSection(hardware);
@ -690,7 +690,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
vm = powerOffVm(vm.getHref());
// Copy existing section and update fields
VirtualHardwareSection oldSection = vmClient.getVirtualHardwareSection(vm.getHref());
VirtualHardwareSection oldSection = vmApi.getVirtualHardwareSection(vm.getHref());
Set<? extends ResourceAllocationSettingData> oldItems = oldSection.getItems();
Set<ResourceAllocationSettingData> newItems = Sets.newLinkedHashSet(oldItems);
ResourceAllocationSettingData oldMemory = Iterables.find(oldItems, new Predicate<ResourceAllocationSettingData>() {
@ -710,11 +710,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.build();
// The method under test
Task modifyVirtualHardwareSection = vmClient.modifyVirtualHardwareSection(vm.getHref(), newSection);
Task modifyVirtualHardwareSection = vmApi.modifyVirtualHardwareSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSection), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSection"));
// Retrieve the modified section
VirtualHardwareSection modifiedSection = vmClient.getVirtualHardwareSection(vm.getHref());
VirtualHardwareSection modifiedSection = vmApi.getVirtualHardwareSection(vm.getHref());
// Check the retrieved object is well formed
checkVirtualHardwareSection(modifiedSection);
@ -735,7 +735,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSection" })
public void testGetVirtualHardwareSectionCpu() {
// Method under test
RasdItem rasd = vmClient.getVirtualHardwareSectionCpu(vm.getHref());
RasdItem rasd = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
// Check the retrieved object is well formed
checkResourceAllocationSettingData(rasd);
@ -744,18 +744,18 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" })
public void testModifyVirtualHardwareSectionCpu() {
// Copy existing section and update fields
RasdItem oldItem = vmClient.getVirtualHardwareSectionCpu(vm.getHref());
RasdItem oldItem = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
RasdItem newItem = oldItem.toBuilder()
.elementName("2 virtual CPU(s)")
.virtualQuantity(new BigInteger("2"))
.build();
// Method under test
Task modifyVirtualHardwareSectionCpu = vmClient.modifyVirtualHardwareSectionCpu(vm.getHref(), newItem);
Task modifyVirtualHardwareSectionCpu = vmApi.modifyVirtualHardwareSectionCpu(vm.getHref(), newItem);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu"));
// Retrieve the modified section
RasdItem modified = vmClient.getVirtualHardwareSectionCpu(vm.getHref());
RasdItem modified = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
// Check the retrieved object
checkResourceAllocationSettingData(modified);
@ -769,7 +769,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSection" })
public void testGetVirtualHardwareSectionDisks() {
// Method under test
RasdItemsList rasdItems = vmClient.getVirtualHardwareSectionDisks(vm.getHref());
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
// Check the retrieved object is well formed
checkRasdItemsList(rasdItems);
@ -778,15 +778,15 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSectionDisks" })
public void testModifyVirtualHardwareSectionDisks() {
// Copy the existing items list and modify the name of an item
RasdItemsList oldSection = vmClient.getVirtualHardwareSectionDisks(vm.getHref());
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
RasdItemsList newSection = oldSection.toBuilder().build();
// Method under test
Task modifyVirtualHardwareSectionDisks = vmClient.modifyVirtualHardwareSectionDisks(vm.getHref(), newSection);
Task modifyVirtualHardwareSectionDisks = vmApi.modifyVirtualHardwareSectionDisks(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionDisks), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionDisks"));
// Retrieve the modified section
RasdItemsList modified = vmClient.getVirtualHardwareSectionDisks(vm.getHref());
RasdItemsList modified = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
// Check the retrieved object is well formed
checkRasdItemsList(modified);
@ -814,7 +814,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/virtualHardwareSection/media", dependsOnMethods = { "testGetVirtualHardwareSection" })
public void testGetVirtualHardwareSectionMedia() {
// Method under test
RasdItemsList rasdItems = vmClient.getVirtualHardwareSectionMedia(vm.getHref());
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionMedia(vm.getHref());
// Check the retrieved object is well formed
checkRasdItemsList(rasdItems);
@ -823,7 +823,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSection" })
public void testGetVirtualHardwareSectionMemory() {
// Method under test
RasdItem rasd = vmClient.getVirtualHardwareSectionCpu(vm.getHref());
RasdItem rasd = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
// Check the retrieved object is well formed
checkResourceAllocationSettingData(rasd);
@ -831,18 +831,18 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" })
public void testModifyVirtualHardwareSectionMemory() {
RasdItem origItem = vmClient.getVirtualHardwareSectionMemory(vm.getHref());
RasdItem origItem = vmApi.getVirtualHardwareSectionMemory(vm.getHref());
RasdItem newItem = origItem.toBuilder()
.elementName("1024 MB of memory")
.virtualQuantity(new BigInteger("1024"))
.build();
// Method under test
Task modifyVirtualHardwareSectionMemory = vmClient.modifyVirtualHardwareSectionMemory(vm.getHref(), newItem);
Task modifyVirtualHardwareSectionMemory = vmApi.modifyVirtualHardwareSectionMemory(vm.getHref(), newItem);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionMemory), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionMemory"));
// Retrieve the modified section
RasdItem modified = vmClient.getVirtualHardwareSectionMemory(vm.getHref());
RasdItem modified = vmApi.getVirtualHardwareSectionMemory(vm.getHref());
// Check the retrieved object
checkResourceAllocationSettingData(modified);
@ -856,7 +856,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSection" })
public void testGetVirtualHardwareSectionNetworkCards() {
// Method under test
RasdItemsList rasdItems = vmClient.getVirtualHardwareSectionNetworkCards(vm.getHref());
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
// Check the retrieved object is well formed
checkRasdItemsList(rasdItems);
@ -864,15 +864,15 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSectionNetworkCards" })
public void testModifyVirtualHardwareSectionNetworkCards() {
RasdItemsList oldSection = vmClient.getVirtualHardwareSectionNetworkCards(vm.getHref());
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
RasdItemsList newSection = oldSection.toBuilder().build();
// Method under test
Task modifyVirtualHardwareSectionNetworkCards = vmClient.modifyVirtualHardwareSectionNetworkCards(vm.getHref(), newSection);
Task modifyVirtualHardwareSectionNetworkCards = vmApi.modifyVirtualHardwareSectionNetworkCards(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionNetworkCards), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionNetworkCards"));
// Retrieve the modified section
RasdItemsList modified = vmClient.getVirtualHardwareSectionNetworkCards(vm.getHref());
RasdItemsList modified = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
// Check the retrieved object is well formed
checkRasdItemsList(modified);
@ -885,7 +885,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSection" })
public void testGetVirtualHardwareSectionSerialPorts() {
// Method under test
RasdItemsList rasdItems = vmClient.getVirtualHardwareSectionSerialPorts(vm.getHref());
RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
// Check the retrieved object is well formed
checkRasdItemsList(rasdItems);
@ -893,15 +893,15 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSectionSerialPorts" })
public void testModifyVirtualHardwareSectionSerialPorts() {
RasdItemsList oldSection = vmClient.getVirtualHardwareSectionSerialPorts(vm.getHref());
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
RasdItemsList newSection = oldSection.toBuilder().build();
// Method under test
Task modifyVirtualHardwareSectionSerialPorts = vmClient.modifyVirtualHardwareSectionSerialPorts(vm.getHref(), newSection);
Task modifyVirtualHardwareSectionSerialPorts = vmApi.modifyVirtualHardwareSectionSerialPorts(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionSerialPorts), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionSerialPorts"));
// Retrieve the modified section
RasdItemsList modified = vmClient.getVirtualHardwareSectionSerialPorts(vm.getHref());
RasdItemsList modified = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
// Check the retrieved object is well formed
checkRasdItemsList(modified);
@ -916,10 +916,10 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
key = name("key-");
String value = name("value-");
metadataValue = MetadataValue.builder().value(value).build();
vmClient.getMetadataClient().setMetadata(vm.getHref(), key, metadataValue);
vmApi.getMetadataApi().setMetadata(vm.getHref(), key, metadataValue);
// Retrieve the value, and assert it was set correctly
MetadataValue newMetadataValue = vmClient.getMetadataClient().getMetadataValue(vm.getHref(), key);
MetadataValue newMetadataValue = vmApi.getMetadataApi().getMetadataValue(vm.getHref(), key);
// Check the retrieved object is well formed
checkMetadataValueFor(VM, newMetadataValue, value);
@ -928,7 +928,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" })
public void testGetMetadata() {
// Call the method being tested
Metadata metadata = vmClient.getMetadataClient().getMetadata(vm.getHref());
Metadata metadata = vmApi.getMetadataApi().getMetadata(vm.getHref());
checkMetadata(metadata);
@ -939,7 +939,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "GET /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
public void testGetOrgMetadataValue() {
// Call the method being tested
MetadataValue value = vmClient.getMetadataClient().getMetadataValue(vm.getHref(), key);
MetadataValue value = vmApi.getMetadataApi().getMetadataValue(vm.getHref(), key);
String expected = metadataValue.getValue();
@ -950,11 +950,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
public void testDeleteMetadataEntry() {
// Delete the entry
Task task = vmClient.getMetadataClient().deleteMetadataEntry(vm.getHref(), key);
Task task = vmApi.getMetadataApi().deleteMetadataEntry(vm.getHref(), key);
retryTaskSuccess.apply(task);
// Confirm the entry has been deleted
Metadata newMetadata = vmClient.getMetadataClient().getMetadata(vm.getHref());
Metadata newMetadata = vmApi.getMetadataApi().getMetadata(vm.getHref());
// Check the retrieved object is well formed
checkMetadataKeyAbsentFor(VM, newMetadata, key);
@ -962,7 +962,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
@Test(description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
public void testMergeMetadata() {
Metadata oldMetadata = vmClient.getMetadataClient().getMetadata(vm.getHref());
Metadata oldMetadata = vmApi.getMetadataApi().getMetadata(vm.getHref());
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
// Store a value, to be deleted
@ -971,11 +971,11 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
Metadata addedMetadata = Metadata.builder()
.entry(MetadataEntry.builder().key(key).value(value).build())
.build();
Task task = vmClient.getMetadataClient().mergeMetadata(vm.getHref(), addedMetadata);
Task task = vmApi.getMetadataApi().mergeMetadata(vm.getHref(), addedMetadata);
retryTaskSuccess.apply(task);
// Confirm the entry contains everything that was there, and everything that was being added
Metadata newMetadata = vmClient.getMetadataClient().getMetadata(vm.getHref());
Metadata newMetadata = vmApi.getMetadataApi().getMetadata(vm.getHref());
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String>builder()
.putAll(oldMetadataMap)
.put(key, value)
@ -986,7 +986,7 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
}
/**
* @see VmClient#deleteVm(URI)
* @see VmApi#deleteVm(URI)
*/
@Test(description = "DELETE /vApp/{id}")
public void testDeleteVm() {
@ -997,21 +997,21 @@ public class VmClientLiveTest extends AbstractVAppClientLiveTest {
.notForceCustomization()
.powerOn()
.build();
Task deployVApp = vAppClient.deploy(delete.getHref(), params);
Task deployVApp = vAppApi.deploy(delete.getHref(), params);
assertTaskSucceedsLong(deployVApp);
// Get the updated VApp and the Vm
delete = vAppClient.getVApp(delete.getHref());
delete = vAppApi.getVApp(delete.getHref());
Vm temp = Iterables.getOnlyElement(delete.getChildren().getVms());
// Power off the Vm
temp = powerOffVm(temp.getHref());
// The method under test
Task deleteVm = vmClient.deleteVm(temp.getHref());
Task deleteVm = vmApi.deleteVm(temp.getHref());
assertTrue(retryTaskSuccess.apply(deleteVm), String.format(TASK_COMPLETE_TIMELY, "deleteVm"));
Vm deleted = vmClient.getVm(temp.getHref());
Vm deleted = vmApi.getVm(temp.getHref());
assertNull(deleted, "The Vm "+temp.getName()+" should have been deleted");
}
}

View File

@ -23,25 +23,25 @@ import static org.testng.Assert.assertEquals;
import java.net.URI;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* Test the {@link AdminCatalogClient} by observing its side effects.
* Test the {@link AdminCatalogApi} by observing its side effects.
*
* @author grkvlt@apache.org
*/
@Test(groups = { "unit", "admin" }, singleThreaded = true, testName = "CatalogClientExpectTest")
public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "admin" }, singleThreaded = true, testName = "CatalogApiExpectTest")
public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest {
private Reference catalogRef = Reference.builder()
.type("application/vnd.vmware.vcloud.catalog+xml")
@ -51,7 +51,7 @@ public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpec
@Test
public void testCreateCatalog() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogs")
.xmlFilePayload("/catalog/admin/createCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG)
@ -64,7 +64,7 @@ public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpec
AdminCatalog source = createCatalogSource();
AdminCatalog expected = createCatalog();
assertEquals(client.getCatalogClient().createCatalog(catalogRef.getHref(), source), expected);
assertEquals(api.getCatalogApi().createCatalog(catalogRef.getHref(), source), expected);
}
// FIXME disabled due to intermittent JXB error: javax.xml.bind.UnmarshalException:
@ -76,7 +76,7 @@ public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpec
// <{http://www.vmware.com/vcloud/v1.5}VAppReference>
@Test(enabled = false)
public void testGetCatalog() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")
.acceptAnyMedia()
@ -87,7 +87,7 @@ public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpec
AdminCatalog expected = catalog();
AdminCatalog actual = client.getCatalogClient().getCatalog(catalogRef.getHref());
AdminCatalog actual = api.getCatalogApi().getCatalog(catalogRef.getHref());
assertEquals(actual.getHref(), expected.getHref());
assertEquals(actual.getLinks(), expected.getLinks());
assertEquals(actual.getTasks(), expected.getTasks());
@ -101,12 +101,12 @@ public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpec
assertEquals(actual.getOwner(), expected.getOwner());
assertEquals(client.getCatalogClient().getCatalog(catalogRef.getHref()), expected);
assertEquals(api.getCatalogApi().getCatalog(catalogRef.getHref()), expected);
}
@Test
public void testModifyCatalog() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")
.xmlFilePayload("/catalog/admin/updateCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG)
@ -118,12 +118,12 @@ public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpec
AdminCatalog expected = modifyCatalog();
assertEquals(client.getCatalogClient().updateCatalog(catalogRef.getHref(), expected), expected);
assertEquals(api.getCatalogApi().updateCatalog(catalogRef.getHref(), expected), expected);
}
@Test
public void testGetOwner() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner")
.acceptAnyMedia()
@ -145,12 +145,12 @@ public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpec
.build())
.build();
assertEquals(client.getCatalogClient().getOwner(catalogRef.getHref()), expected);
assertEquals(api.getCatalogApi().getOwner(catalogRef.getHref()), expected);
}
@Test
public void testSetOwner() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner")
.xmlFilePayload("/catalog/admin/updateOwnerSource.xml", VCloudDirectorMediaType.OWNER)
@ -168,12 +168,12 @@ public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpec
.build())
.build();
client.getCatalogClient().setOwner(catalogRef.getHref(), newOwner);
api.getCatalogApi().setOwner(catalogRef.getHref(), newOwner);
}
@Test
public void testPublishCatalog() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/action/publish")
.xmlFilePayload("/catalog/admin/publishCatalogParams.xml", VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS)
@ -186,12 +186,12 @@ public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpec
.isPublished(true)
.build();
client.getCatalogClient().publishCatalog(catalogRef.getHref(), params);
api.getCatalogApi().publishCatalog(catalogRef.getHref(), params);
}
@Test
public void testDeleteCatalog() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("DELETE", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")
.acceptAnyMedia()
@ -199,7 +199,7 @@ public class AdminCatalogClientExpectTest extends VCloudDirectorAdminClientExpec
new VcloudHttpResponsePrimer()
.httpResponseBuilder().statusCode(204).build());
client.getCatalogClient().deleteCatalog(catalogRef.getHref());
api.getCatalogApi().deleteCatalog(catalogRef.getHref());
}
public static final AdminCatalog createCatalogSource() {

View File

@ -36,7 +36,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.User;
import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -44,20 +44,20 @@ import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
/**
* Tests live behavior of {@link AdminCatalogClient}.
* Tests live behavior of {@link AdminCatalogApi}.
*
* @author danikov
*/
@Test(groups = { "live", "admin" }, singleThreaded = true, testName = "CatalogClientLiveTest")
public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "admin" }, singleThreaded = true, testName = "CatalogApiLiveTest")
public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public static final String CATALOG = "admin catalog";
/*
* Convenience references to API clients.
* Convenience references to API apis.
*/
private AdminCatalogClient catalogClient;
private AdminCatalogApi catalogApi;
/*
* Shared state between dependant tests.
@ -69,16 +69,16 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
@Override
@BeforeClass(alwaysRun = true)
protected void setupRequiredClients() {
catalogClient = adminContext.getApi().getCatalogClient();
orgRef = Iterables.getFirst(context.getApi().getOrgClient().getOrgList().getOrgs(), null).toAdminReference(endpoint);
protected void setupRequiredApis() {
catalogApi = adminContext.getApi().getCatalogApi();
orgRef = Iterables.getFirst(context.getApi().getOrgApi().getOrgList().getOrgs(), null).toAdminReference(endpoint);
}
@AfterClass(alwaysRun = true)
protected void tidyUp() {
if (catalog != null) {
try {
catalogClient.deleteCatalog(catalog.getHref());
catalogApi.deleteCatalog(catalog.getHref());
} catch (Exception e) {
logger.warn(e, "Error deleting admin catalog '%s'", catalog.getName());
}
@ -91,7 +91,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
.name(name("Test Catalog "))
.description("created by testCreateCatalog()")
.build();
catalog = catalogClient.createCatalog(orgRef.getHref(), newCatalog);
catalog = catalogApi.createCatalog(orgRef.getHref(), newCatalog);
Checks.checkAdminCatalog(catalog);
@ -100,21 +100,21 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
@Test(description = "GET /admin/catalog/{id}", dependsOnMethods = { "testCreateCatalog" })
public void testGetCatalog() {
catalog = catalogClient.getCatalog(catalog.getHref());
catalog = catalogApi.getCatalog(catalog.getHref());
Checks.checkAdminCatalog(catalog);
}
@Test(description = "GET /admin/catalog/{id}/owner", dependsOnMethods = { "testGetCatalog" })
public void testGetCatalogOwner() {
owner = catalogClient.getOwner(catalog.getHref());
owner = catalogApi.getOwner(catalog.getHref());
Checks.checkOwner(owner);
}
@Test(description = "PUT /admin/catalog/{id}/owner", dependsOnMethods = { "testGetCatalog" })
public void updateCatalogOwner() {
User newOwnerUser = randomTestUser("testUpdateCatalogOwner");
newOwnerUser = adminContext.getApi().getUserClient().createUser(orgRef.getHref(), newOwnerUser);
newOwnerUser = adminContext.getApi().getUserApi().createUser(orgRef.getHref(), newOwnerUser);
assertNotNull(newOwnerUser, "failed to create temp user to test updateCatalogOwner");
Owner oldOwner = owner;
@ -124,16 +124,16 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
.build();
try {
catalogClient.setOwner(catalog.getHref(), newOwner);
owner = catalogClient.getOwner(catalog.getHref());
catalogApi.setOwner(catalog.getHref(), newOwner);
owner = catalogApi.getOwner(catalog.getHref());
Checks.checkOwner(owner);
assertTrue(equal(owner.toBuilder().links(Collections.<Link>emptySet()).build(),
newOwner.toBuilder().user(newOwner.getUser().toBuilder().id(null).build()).build()),
String.format(OBJ_FIELD_UPDATABLE, CATALOG, "owner"));
} finally {
catalogClient.setOwner(catalog.getHref(), oldOwner);
owner = catalogClient.getOwner(catalog.getHref());
adminContext.getApi().getUserClient().deleteUser(newOwnerUser.getHref());
catalogApi.setOwner(catalog.getHref(), oldOwner);
owner = catalogApi.getOwner(catalog.getHref());
adminContext.getApi().getUserApi().deleteUser(newOwnerUser.getHref());
}
}
@ -154,7 +154,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
// .catalogItems(newCatalogItems)
.build();
catalog = catalogClient.updateCatalog(catalog.getHref(), catalog);
catalog = catalogApi.updateCatalog(catalog.getHref(), catalog);
assertTrue(equal(catalog.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, CATALOG, "name"));
assertTrue(equal(catalog.getDescription(), newDescription),
@ -171,7 +171,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
// .catalogItems(oldCatalogItems)
.build();
catalog = catalogClient.updateCatalog(catalog.getHref(), catalog);
catalog = catalogApi.updateCatalog(catalog.getHref(), catalog);
}
}
@ -186,8 +186,8 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
.isPublished(true)
.build();
catalogClient.publishCatalog(catalog.getHref(), params);
catalog = catalogClient.getCatalog(catalog.getHref());
catalogApi.publishCatalog(catalog.getHref(), params);
catalog = catalogApi.getCatalog(catalog.getHref());
assertTrue(catalog.isPublished(), String.format(OBJ_FIELD_EQ,
CATALOG, "isPublished", true, catalog.isPublished()));
@ -202,10 +202,10 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
.name(name("Test Catalog "))
.description("created by testCreateCatalog()")
.build();
deleteCatalog = catalogClient.createCatalog(orgRef.getHref(), deleteCatalog);
catalogClient.deleteCatalog(deleteCatalog.getHref());
deleteCatalog = catalogApi.createCatalog(orgRef.getHref(), deleteCatalog);
catalogApi.deleteCatalog(deleteCatalog.getHref());
deleteCatalog = catalogClient.getCatalog(deleteCatalog.getHref());
deleteCatalog = catalogApi.getCatalog(deleteCatalog.getHref());
assertNull(deleteCatalog, String.format(OBJ_DEL, CATALOG, deleteCatalog != null ? deleteCatalog.toString() : ""));
}
}

View File

@ -23,24 +23,24 @@ import static org.testng.Assert.assertEquals;
import java.net.URI;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.features.NetworkClientExpectTest;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.features.NetworkApiExpectTest;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* Test the {@link AdminNetworkClient} by observing its side effects.
* Test the {@link AdminNetworkApi} by observing its side effects.
*
* @author danikov
*/
@Test(groups = { "unit", "admin" }, singleThreaded = true, testName = "AdminNetworkClientExpectTest")
public class AdminNetworkClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "admin" }, singleThreaded = true, testName = "AdminNetworkApiExpectTest")
public class AdminNetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest {
Reference networkRef = Reference.builder()
.href(URI.create(endpoint+"/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1"))
@ -48,7 +48,7 @@ public class AdminNetworkClientExpectTest extends VCloudDirectorAdminClientExpec
@Test
public void testGetNetworkWithOrgNetwork() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1")
.acceptAnyMedia()
@ -59,12 +59,12 @@ public class AdminNetworkClientExpectTest extends VCloudDirectorAdminClientExpec
OrgNetwork expected = orgNetwork();
assertEquals(client.getNetworkClient().getNetwork(networkRef.getHref()), expected);
assertEquals(api.getNetworkApi().getNetwork(networkRef.getHref()), expected);
}
@Test
public void testUpdateNetwork() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1")
.xmlFilePayload("/network/admin/updateNetworkSource.xml", VCloudDirectorMediaType.ORG_NETWORK)
@ -76,12 +76,12 @@ public class AdminNetworkClientExpectTest extends VCloudDirectorAdminClientExpec
Task expected = updateNetworkTask();
assertEquals(client.getNetworkClient().updateNetwork(networkRef.getHref(), updateNetwork()), expected);
assertEquals(api.getNetworkApi().updateNetwork(networkRef.getHref(), updateNetwork()), expected);
}
@Test(enabled = false)
public void testResetNetwork() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1/action/reset")
.acceptMedia(VCloudDirectorMediaType.TASK)
@ -92,12 +92,12 @@ public class AdminNetworkClientExpectTest extends VCloudDirectorAdminClientExpec
Task expected = resetNetworkTask();
assertEquals(client.getNetworkClient().resetNetwork(networkRef.getHref()), expected);
assertEquals(api.getNetworkApi().resetNetwork(networkRef.getHref()), expected);
}
public final OrgNetwork orgNetwork() {
return NetworkClientExpectTest.orgNetwork().toBuilder()
.href(toAdminUri(NetworkClientExpectTest.orgNetwork().getHref()))
return NetworkApiExpectTest.orgNetwork().toBuilder()
.href(toAdminUri(NetworkApiExpectTest.orgNetwork().getHref()))
.links(ImmutableSet.of(
Link.builder()
.rel("alternate")

View File

@ -41,24 +41,24 @@ import org.jclouds.vcloud.director.v1_5.domain.network.NetworkFeatures;
import org.jclouds.vcloud.director.v1_5.domain.network.RouterInfo;
import org.jclouds.vcloud.director.v1_5.domain.network.SyslogServerSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Tests live behavior of {@link AdminNetworkClient}.
* Tests live behavior of {@link AdminNetworkApi}.
*
* @author danikov
*/
@Test(groups = { "live", "admin" }, singleThreaded = true, testName = "AdminNetworkLiveTest")
public class AdminNetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public class AdminNetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public static final String NETWORK = "AdminNetwork";
/*
* Convenience references to API clients.
* Convenience references to API apis.
*/
private AdminNetworkClient networkClient;
private AdminNetworkApi networkApi;
/*
* Shared state between dependant tests.
@ -68,8 +68,8 @@ public class AdminNetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest
@Override
@BeforeClass(alwaysRun = true)
protected void setupRequiredClients() {
networkClient = adminContext.getApi().getNetworkClient();
protected void setupRequiredApis() {
networkApi = adminContext.getApi().getNetworkApi();
networkRef = Reference.builder().href(networkURI).build().toAdminReference(endpoint);
}
@ -77,7 +77,7 @@ public class AdminNetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest
public void testGetNetwork() {
//TODO: test both org and external networks
assertNotNull(networkRef, String.format(OBJ_REQ_LIVE, NETWORK));
network = networkClient.getNetwork(networkRef.getHref());
network = networkApi.getNetwork(networkRef.getHref());
if(network instanceof ExternalNetwork) {
Checks.checkExternalNetwork(Network.<ExternalNetwork>toSubType(network));
@ -103,10 +103,10 @@ public class AdminNetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest
OrgNetwork updateNetwork = getMutatedOrgNetwork(oldNetwork);
try {
Task updateNetworkTask = networkClient.updateNetwork(network.getHref(), updateNetwork);
Task updateNetworkTask = networkApi.updateNetwork(network.getHref(), updateNetwork);
Checks.checkTask(updateNetworkTask);
assertTrue(retryTaskSuccess.apply(updateNetworkTask), String.format(TASK_COMPLETE_TIMELY, "updateNetworkTask"));
network = networkClient.getNetwork(network.getHref());
network = networkApi.getNetwork(network.getHref());
Checks.checkOrgNetwork(Network.<OrgNetwork>toSubType(network));
@ -140,20 +140,20 @@ public class AdminNetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest
// updateNetwork.getAllowedExternalIpAddresses()),
// String.format(OBJ_FIELD_UPDATABLE, NETWORK, "allowedExternalIpAddresses"));
} finally {
Task updateNetworkTask = networkClient.updateNetwork(network.getHref(), oldNetwork);
Task updateNetworkTask = networkApi.updateNetwork(network.getHref(), oldNetwork);
Checks.checkTask(updateNetworkTask);
assertTrue(retryTaskSuccess.apply(updateNetworkTask), String.format(TASK_COMPLETE_TIMELY, "updateNetworkTask"));
network = networkClient.getNetwork(network.getHref());
network = networkApi.getNetwork(network.getHref());
}
}
@Test(description = "POST /admin/network/{id}/action/reset")
public void testResetNetwork() {
// TODO assert that network is deployed somehow
Task resetNetworkTask = networkClient.resetNetwork(networkRef.getHref());
Task resetNetworkTask = networkApi.resetNetwork(networkRef.getHref());
Checks.checkTask(resetNetworkTask);
assertTrue(retryTaskSuccess.apply(resetNetworkTask), String.format(TASK_COMPLETE_TIMELY, "resetNetworkTask"));
network = networkClient.getNetwork(network.getHref());
network = networkApi.getNetwork(network.getHref());
Checks.checkOrgNetwork(Network.<OrgNetwork>toSubType(network));
// TODO: other assertions about the reset? that network is deployed when task is complete, for example

View File

@ -23,7 +23,7 @@ import static org.testng.Assert.assertEquals;
import java.net.URI;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.network.SmtpServerSettings;
@ -35,16 +35,16 @@ import org.jclouds.vcloud.director.v1_5.domain.org.OrgLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgVAppTemplateLeaseSettings;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.testng.annotations.Test;
/**
* Test the {@link AdminOrgClient} by observing its side effects.
* Test the {@link AdminOrgApi} by observing its side effects.
*
* @author danikov
*/
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "AdminOrgClientExpectTest")
public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "AdminOrgApiExpectTest")
public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
private Reference orgRef = Reference.builder()
.href(URI.create(endpoint + "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
@ -52,7 +52,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test
public void testGetOrg() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")
.acceptAnyMedia()
@ -64,7 +64,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
AdminOrg expected = adminOrg();
assertEquals(client.getOrgClient().getOrg(orgRef.getHref()), expected);
assertEquals(api.getOrgApi().getOrg(orgRef.getHref()), expected);
}
public static final AdminOrg adminOrg() {
@ -186,7 +186,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test(enabled = false)
public void testGetSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/")
.acceptAnyMedia()
@ -198,12 +198,12 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgSettings expected = settings();
assertEquals(client.getOrgClient().getSettings(orgRef.getHref()), expected);
assertEquals(api.getOrgApi().getSettings(orgRef.getHref()), expected);
}
@Test(enabled = false)
public void testUpdateSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/")
.xmlFilePayload("/org/admin/updateSettingsSource.xml",
@ -217,12 +217,12 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgSettings expected = updateSettings();
assertEquals(client.getOrgClient().updateSettings(orgRef.getHref(), expected), expected);
assertEquals(api.getOrgApi().updateSettings(orgRef.getHref(), expected), expected);
}
@Test
public void testGetEmailSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email")
.acceptAnyMedia()
@ -234,12 +234,12 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgEmailSettings expected = emailSettings();
assertEquals(client.getOrgClient().getEmailSettings(orgRef.getHref()), expected);
assertEquals(api.getOrgApi().getEmailSettings(orgRef.getHref()), expected);
}
@Test
public void testUpdateEmailSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email")
.xmlFilePayload("/org/admin/updateEmailSettingsSource.xml",
@ -253,12 +253,12 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgEmailSettings expected = updateEmailSettings();
assertEquals(client.getOrgClient().updateEmailSettings(orgRef.getHref(), expected), expected);
assertEquals(api.getOrgApi().updateEmailSettings(orgRef.getHref(), expected), expected);
}
@Test(enabled = false)
public void testGetGeneralSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general")
.acceptAnyMedia()
@ -270,7 +270,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgGeneralSettings expected = generalSettings();
assertEquals(client.getOrgClient().getGeneralSettings(orgRef.getHref()), expected);
assertEquals(api.getOrgApi().getGeneralSettings(orgRef.getHref()), expected);
}
public static final OrgGeneralSettings generalSettings() {
@ -292,7 +292,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test(enabled = false)
public void testUpdateGeneralSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general")
.xmlFilePayload("/org/admin/updateGeneralSettingsSource.xml",
@ -306,7 +306,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgGeneralSettings expected = updateGeneralSettings();
assertEquals(client.getOrgClient().updateGeneralSettings(orgRef.getHref(), expected), expected);
assertEquals(api.getOrgApi().updateGeneralSettings(orgRef.getHref(), expected), expected);
}
public static final OrgGeneralSettings updateGeneralSettings() {
@ -317,7 +317,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test
public void testGetLdapSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap")
.acceptAnyMedia()
@ -329,7 +329,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgLdapSettings expected = ldapSettings();
assertEquals(client.getOrgClient().getLdapSettings(orgRef.getHref()), expected);
assertEquals(api.getOrgApi().getLdapSettings(orgRef.getHref()), expected);
}
public static final OrgLdapSettings ldapSettings() {
@ -342,7 +342,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test
public void testGetPasswordPolicy() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy")
.acceptAnyMedia()
@ -354,7 +354,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgPasswordPolicySettings expected = passwordPolicy();
assertEquals(client.getOrgClient().getPasswordPolicy(orgRef.getHref()), expected);
assertEquals(api.getOrgApi().getPasswordPolicy(orgRef.getHref()), expected);
}
public static final OrgPasswordPolicySettings passwordPolicy() {
@ -374,7 +374,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test
public void testUpdatePasswordPolicy() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy")
.xmlFilePayload("/org/admin/updatePasswordPolicySource.xml",
@ -388,7 +388,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgPasswordPolicySettings expected = updateOrgPasswordPolicy();
assertEquals(client.getOrgClient().updatePasswordPolicy(orgRef.getHref(), expected), expected);
assertEquals(api.getOrgApi().updatePasswordPolicy(orgRef.getHref(), expected), expected);
}
public static final OrgPasswordPolicySettings updateOrgPasswordPolicy() {
@ -401,7 +401,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test(enabled = false)
public void testGetVAppLeaseSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings")
.acceptAnyMedia()
@ -413,7 +413,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgLeaseSettings expected = vAppLeaseSettings();
assertEquals(client.getOrgClient().getVAppLeaseSettings(orgRef.getHref()), expected);
assertEquals(api.getOrgApi().getVAppLeaseSettings(orgRef.getHref()), expected);
}
public static final OrgLeaseSettings vAppLeaseSettings() {
@ -433,7 +433,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test(enabled = false)
public void testUpdateOrgVAppLeaseSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings")
.xmlFilePayload("/org/admin/updateVAppLeaseSettingsSource.xml",
@ -447,7 +447,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgLeaseSettings expected = updateVAppLeaseSettings();
assertEquals(client.getOrgClient().updateVAppLeaseSettings(orgRef.getHref(), expected), expected);
assertEquals(api.getOrgApi().updateVAppLeaseSettings(orgRef.getHref(), expected), expected);
}
public static final OrgLeaseSettings updateVAppLeaseSettings() {
@ -458,7 +458,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test(enabled = false)
public void testGetVAppTemplateLeaseSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings")
.acceptAnyMedia()
@ -470,7 +470,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgVAppTemplateLeaseSettings expected = vAppTemplateLeaseSettings();
assertEquals(client.getOrgClient().getVAppTemplateLeaseSettings(orgRef.getHref()), expected);
assertEquals(api.getOrgApi().getVAppTemplateLeaseSettings(orgRef.getHref()), expected);
}
public static final OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings() {
@ -489,7 +489,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test(enabled = false)
public void testUpdateOrgVAppTemplateLeaseSettings() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings")
.xmlFilePayload("/org/admin/updateVAppLeaseSettingsSource.xml",
@ -503,7 +503,7 @@ public class AdminOrgClientExpectTest extends VCloudDirectorAdminClientExpectTes
OrgVAppTemplateLeaseSettings expected = updateVAppTemplateLeaseSettings();
assertEquals(client.getOrgClient().updateVAppTemplateLeaseSettings(orgRef.getHref(), expected), expected);
assertEquals(api.getOrgApi().updateVAppTemplateLeaseSettings(orgRef.getHref(), expected), expected);
}
public static final OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings() {

View File

@ -35,27 +35,27 @@ import org.jclouds.vcloud.director.v1_5.domain.org.OrgLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgSettings;
import org.jclouds.vcloud.director.v1_5.domain.org.OrgVAppTemplateLeaseSettings;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
/**
* Tests live behavior of {@link AdminGroupClient}.
* Tests live behavior of {@link AdminGroupApi}.
*
* @author danikov
*/
@Test(groups = { "live", "admin" }, singleThreaded = true, testName = "AdminOrgClientLiveTest")
public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "admin" }, singleThreaded = true, testName = "AdminOrgApiLiveTest")
public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public static final String ORG = "admin org";
/*
* Convenience references to API clients.
* Convenience references to API apis.
*/
private AdminOrgClient orgClient;
private AdminOrgApi orgApi;
/*
* Shared state between dependant tests.
@ -71,22 +71,22 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() {
orgClient = adminContext.getApi().getOrgClient();
orgRef = Iterables.getFirst(orgClient.getOrgList().getOrgs(), null).toAdminReference(endpoint);
public void setupRequiredApis() {
orgApi = adminContext.getApi().getOrgApi();
orgRef = Iterables.getFirst(orgApi.getOrgList().getOrgs(), null).toAdminReference(endpoint);
assertNotNull(orgRef, String.format(REF_REQ_LIVE, "admin org"));
}
@Test(description = "GET /admin/org/{id}")
public void testGetAdminOrg() {
AdminOrg adminOrg = orgClient.getOrg(orgRef.getHref());
AdminOrg adminOrg = orgApi.getOrg(orgRef.getHref());
Checks.checkAdminOrg(adminOrg);
}
@Test(description = "GET /admin/org/{id}/settings/email")
public void testGetEmailSettings() {
emailSettings = orgClient.getEmailSettings(orgRef.getHref());
emailSettings = orgApi.getEmailSettings(orgRef.getHref());
Checks.checkEmailSettings(emailSettings);
}
@ -119,7 +119,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.smtpServerSettings(newSmtpServerSettings)
.build();
emailSettings = orgClient.updateEmailSettings(
emailSettings = orgApi.updateEmailSettings(
orgRef.getHref(), newEmailSettings);
assertTrue(equal(emailSettings.isDefaultSmtpServer(), !isDefaultSmtpServer),
@ -154,14 +154,14 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.smtpServerSettings(oldSmtpServerSettings)
.build();
emailSettings = orgClient.updateEmailSettings(
emailSettings = orgApi.updateEmailSettings(
orgRef.getHref(), emailSettings);
}
}
@Test(description = "GET /admin/org/{id}/settings/general")
public void testGetGeneralSettings() {
generalSettings = orgClient.getGeneralSettings(orgRef.getHref());
generalSettings = orgApi.getGeneralSettings(orgRef.getHref());
Checks.checkGeneralSettings(generalSettings);
}
@ -185,7 +185,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.delayAfterPowerOnSeconds(delayAfterPowerOnSeconds+1)
.build();
generalSettings = orgClient.updateGeneralSettings(
generalSettings = orgApi.updateGeneralSettings(
orgRef.getHref(), newGeneralSettings);
// assertTrue(equal(generalSettings.canPublishCatalogs(), !canPublishCatalogs),
@ -216,21 +216,21 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.delayAfterPowerOnSeconds(delayAfterPowerOnSeconds)
.build();
generalSettings = orgClient.updateGeneralSettings(
generalSettings = orgApi.updateGeneralSettings(
orgRef.getHref(), generalSettings);
}
}
@Test(description = "GET /admin/org/{id}/settings/ldap")
public void testGetLdapSettings() {
ldapSettings = orgClient.getLdapSettings(orgRef.getHref());
ldapSettings = orgApi.getLdapSettings(orgRef.getHref());
Checks.checkLdapSettings(ldapSettings);
}
@Test(description = "GET /admin/org/{id}/settings/passwordPolicy")
public void testGetPasswordPolicy() {
passwordPolicy = orgClient.getPasswordPolicy(orgRef.getHref());
passwordPolicy = orgApi.getPasswordPolicy(orgRef.getHref());
Checks.checkPasswordPolicySettings(passwordPolicy);
}
@ -249,7 +249,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.accountLockoutIntervalMinutes(accountLockoutIntervalMinutes+1)
.build();
passwordPolicy = orgClient.updatePasswordPolicy(
passwordPolicy = orgApi.updatePasswordPolicy(
orgRef.getHref(), newPasswordPolicy);
assertTrue(equal(passwordPolicy.isAccountLockoutEnabled(), !accountLockoutEnabled),
@ -272,14 +272,14 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.accountLockoutIntervalMinutes(accountLockoutIntervalMinutes)
.build();
passwordPolicy = orgClient.updatePasswordPolicy(
passwordPolicy = orgApi.updatePasswordPolicy(
orgRef.getHref(), passwordPolicy);
}
}
@Test(description = "GET /admin/org/{id}/settings/vAppLeaseSettings")
public void testGetVAppLeaseSettings() {
vAppLeaseSettings = orgClient.getVAppLeaseSettings(orgRef.getHref());
vAppLeaseSettings = orgApi.getVAppLeaseSettings(orgRef.getHref());
Checks.checkVAppLeaseSettings(vAppLeaseSettings);
}
@ -298,7 +298,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.deploymentLeaseSeconds(deploymentLeaseSeconds+1)
.build();
vAppLeaseSettings = orgClient.updateVAppLeaseSettings(
vAppLeaseSettings = orgApi.updateVAppLeaseSettings(
orgRef.getHref(), newVAppLeaseSettings);
assertTrue(equal(vAppLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration),
@ -321,14 +321,14 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.deploymentLeaseSeconds(deploymentLeaseSeconds)
.build();
vAppLeaseSettings = orgClient.updateVAppLeaseSettings(
vAppLeaseSettings = orgApi.updateVAppLeaseSettings(
orgRef.getHref(), vAppLeaseSettings);
}
}
@Test(description = "GET /admin/org/{id}/settings/vAppTemplateLeaseSettings")
public void testGetVAppTemplateLeaseSettings() {
vAppTemplateLeaseSettings = orgClient.getVAppTemplateLeaseSettings(orgRef.getHref());
vAppTemplateLeaseSettings = orgApi.getVAppTemplateLeaseSettings(orgRef.getHref());
Checks.checkVAppTemplateLeaseSettings(vAppTemplateLeaseSettings);
}
@ -345,7 +345,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.storageLeaseSeconds(storageLeaseSeconds+1)
.build();
vAppTemplateLeaseSettings = orgClient.updateVAppTemplateLeaseSettings(
vAppTemplateLeaseSettings = orgApi.updateVAppTemplateLeaseSettings(
orgRef.getHref(), newVAppTemplateLeaseSettings);
assertTrue(equal(vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration),
@ -364,14 +364,14 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.storageLeaseSeconds(storageLeaseSeconds)
.build();
vAppTemplateLeaseSettings = orgClient.updateVAppTemplateLeaseSettings(
vAppTemplateLeaseSettings = orgApi.updateVAppTemplateLeaseSettings(
orgRef.getHref(), vAppTemplateLeaseSettings);
}
}
@Test(description = "GET /admin/org/{id}/settings")
public void testGetSettings() {
settings = orgClient.getSettings(orgRef.getHref());
settings = orgApi.getSettings(orgRef.getHref());
Checks.checkOrgSettings(settings);
}
@ -387,7 +387,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.emailSettings(emailSettings.toBuilder().fromEmailAddress(newFromEmailAddress).build())
.build();
OrgSettings modified = orgClient.updateSettings(
OrgSettings modified = orgApi.updateSettings(
orgRef.getHref(), newSettings);
Checks.checkOrgSettings(settings);
@ -403,7 +403,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.emailSettings(emailSettings)
.build();
settings = orgClient.updateSettings(
settings = orgApi.updateSettings(
orgRef.getHref(), restorableSettings);
} catch (Exception e) {
if (exception != null) {

View File

@ -25,20 +25,20 @@ import java.net.URI;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRoleRecord;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.testng.annotations.Test;
/**
* Test the {@link AdminQueryClient} by observing its side effects.
* Test the {@link AdminQueryApi} by observing its side effects.
*
* @author Aled Sage
*/
@Test(groups = { "unit", "admin" }, singleThreaded = true, testName = "AdminQueryClientExpectTest")
public class AdminQueryClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "admin" }, singleThreaded = true, testName = "AdminQueryApiExpectTest")
public class AdminQueryApiExpectTest extends VCloudDirectorAdminApiExpectTest {
// TODO Write expect tests for all other admin-query operations
@ -59,7 +59,7 @@ public class AdminQueryClientExpectTest extends VCloudDirectorAdminClientExpectT
.payload(payloadFromResourceWithContentType("/query/admin/allGroups.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5"))
.build();
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
QueryResultRecords expected = QueryResultRecords.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/groups/query?page=1&pageSize=25&format=records"))
@ -80,7 +80,7 @@ public class AdminQueryClientExpectTest extends VCloudDirectorAdminClientExpectT
.build())
.build();
assertEquals(client.getQueryClient().groupsQueryAll(), expected);
assertEquals(api.getQueryApi().groupsQueryAll(), expected);
}
// <?xml version="1.0" encoding="UTF-8"?>
@ -105,7 +105,7 @@ public class AdminQueryClientExpectTest extends VCloudDirectorAdminClientExpectT
.payload(payloadFromResourceWithContentType("/query/admin/allRoles.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5"))
.build();
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
QueryResultRecords expected = QueryResultRecords.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/roles/query?page=1&pageSize=25&format=records"))
@ -131,7 +131,7 @@ public class AdminQueryClientExpectTest extends VCloudDirectorAdminClientExpectT
.build())
.build();
assertEquals(client.getQueryClient().rolesQueryAll(), expected);
assertEquals(api.getQueryApi().rolesQueryAll(), expected);
}
}

View File

@ -30,34 +30,34 @@ import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRightRecord;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRoleRecord;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultStrandedUserRecord;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Tests live behavior of {@link AdminQueryClient}.
* Tests live behavior of {@link AdminQueryApi}.
*
* @author Aled Sage
*/
@Test(groups = { "live", "admin" }, singleThreaded = true, testName = "AdminQueryClientLiveTest")
public class AdminQueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "admin" }, singleThreaded = true, testName = "AdminQueryApiLiveTest")
public class AdminQueryApiLiveTest extends BaseVCloudDirectorApiLiveTest {
/*
* Convenience references to API clients.
* Convenience references to API apis.
*/
private AdminQueryClient queryClient;
private AdminQueryApi queryApi;
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() {
queryClient = adminContext.getApi().getQueryClient();
public void setupRequiredApis() {
queryApi = adminContext.getApi().getQueryApi();
}
@Test(description = "GET /admin/groups/query")
public void testQueryAllGroups() {
// TODO Ensure there will be at least one record, for asserting result
QueryResultRecords resultRecords = queryClient.groupsQueryAll();
QueryResultRecords resultRecords = queryApi.groupsQueryAll();
for (QueryResultRecordType record : resultRecords.getRecords()) {
Checks.checkQueryResultRecord(record);
@ -67,7 +67,7 @@ public class AdminQueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /admin/orgs/query")
public void testQueryAllOrgs() {
// TODO Ensure there will be at least one record, for asserting result
QueryResultRecords resultRecords = queryClient.orgsQueryAll();
QueryResultRecords resultRecords = queryApi.orgsQueryAll();
for (QueryResultRecordType record : resultRecords.getRecords()) {
Checks.checkQueryResultRecord(record);
@ -77,7 +77,7 @@ public class AdminQueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /admin/rights/query")
public void testQueryAllRights() {
// TODO Ensure there will be at least one record, for asserting result
QueryResultRecords resultRecords = queryClient.rightsQueryAll();
QueryResultRecords resultRecords = queryApi.rightsQueryAll();
for (QueryResultRecordType record : resultRecords.getRecords()) {
Checks.checkQueryResultRecord(record);
@ -88,14 +88,14 @@ public class AdminQueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /admin/roles/query")
public void testQueryAllRoles() {
// TODO Ensure there will be at least one record, for asserting result
QueryResultRecords resultRecords = queryClient.rolesQueryAll();
QueryResultRecords resultRecords = queryApi.rolesQueryAll();
for (QueryResultRecordType record : resultRecords.getRecords()) {
Checks.checkQueryResultRecord(record);
assertEquals(record.getClass(), QueryResultRoleRecord.class, "incorrect record type admin query");
}
RoleReferences roleRefs = queryClient.roleReferencesQueryAll();
RoleReferences roleRefs = queryApi.roleReferencesQueryAll();
for (Reference ref : roleRefs.getReferences()) {
Checks.checkReferenceType(ref);
@ -105,7 +105,7 @@ public class AdminQueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /admin/strandedUsers/query")
public void testQueryAllStrandedUsers() {
// TODO Ensure there will be at least one record, for asserting result
QueryResultRecords resultRecords = queryClient.strandedUsersQueryAll();
QueryResultRecords resultRecords = queryApi.strandedUsersQueryAll();
for (QueryResultRecordType record : resultRecords.getRecords()) {
Checks.checkQueryResultRecord(record);
@ -116,7 +116,7 @@ public class AdminQueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /admin/users/query")
public void testQueryAllUsers() {
// TODO Ensure there will be at least one record, for asserting result
QueryResultRecords resultRecords = queryClient.usersQueryAll();
QueryResultRecords resultRecords = queryApi.usersQueryAll();
for (QueryResultRecordType record : resultRecords.getRecords()) {
Checks.checkQueryResultRecord(record);
@ -127,7 +127,7 @@ public class AdminQueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /admin/vdcs/query")
public void testQueryAllVdc() {
// TODO Ensure there will be at least one record, for asserting result
QueryResultRecords resultRecords = queryClient.vdcsQueryAll();
QueryResultRecords resultRecords = queryApi.vdcsQueryAll();
for (QueryResultRecordType record : resultRecords.getRecords()) {
Checks.checkQueryResultRecord(record);

View File

@ -23,20 +23,20 @@ import static org.testng.Assert.assertEquals;
import java.net.URI;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
import org.jclouds.vcloud.director.v1_5.domain.AdminVdc;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.features.VdcClientExpectTest;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminClientExpectTest;
import org.jclouds.vcloud.director.v1_5.features.VdcApiExpectTest;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.testng.annotations.Test;
/**
* Test the {@link AdminVdcClient} by observing its side effects.
* Test the {@link AdminVdcApi} by observing its side effects.
*
* @author danikov
*/
@Test(groups = { "unit", "admin" }, singleThreaded = true, testName = "AdminVdcClientExpectTest")
public class AdminVdcClientExpectTest extends VCloudDirectorAdminClientExpectTest {
@Test(groups = { "unit", "admin" }, singleThreaded = true, testName = "AdminVdcApiExpectTest")
public class AdminVdcApiExpectTest extends VCloudDirectorAdminApiExpectTest {
private Reference vdcRef = Reference.builder()
.href(URI.create(endpoint + "???"))
@ -44,7 +44,7 @@ public class AdminVdcClientExpectTest extends VCloudDirectorAdminClientExpectTes
@Test( enabled = false )
public void testGetVdc() {
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/vdc/???")
.acceptAnyMedia()
@ -56,11 +56,11 @@ public class AdminVdcClientExpectTest extends VCloudDirectorAdminClientExpectTes
AdminVdc expected = adminVdc();
assertEquals(client.getVdcClient().getVdc(vdcRef.getHref()), expected);
assertEquals(api.getVdcApi().getVdc(vdcRef.getHref()), expected);
}
public static final AdminVdc adminVdc() {
return AdminVdc.builder().fromVdc(VdcClientExpectTest.getVdc())
return AdminVdc.builder().fromVdc(VdcApiExpectTest.getVdc())
.build();
}

View File

@ -33,28 +33,28 @@ import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.features.MetadataClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
import org.jclouds.vcloud.director.v1_5.features.VdcApi;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Tests behavior of {@link VdcClient}
* Tests behavior of {@link VdcApi}
*
* @author danikov
*/
@Test(groups = { "live", "admin" }, singleThreaded = true, testName = "AdminVdcClientLiveTest")
public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(groups = { "live", "admin" }, singleThreaded = true, testName = "AdminVdcApiLiveTest")
public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public static final String VDC = "admin vdc";
/*
* Convenience reference to API client.
* Convenience reference to API api.
*/
protected AdminVdcClient vdcClient;
protected MetadataClient.Writeable metadataClient;
protected AdminVdcApi vdcApi;
protected MetadataApi.Writeable metadataApi;
protected URI adminVdcUri;
@ -63,9 +63,9 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Override
@BeforeClass(alwaysRun = true)
public void setupRequiredClients() {
vdcClient = adminContext.getApi().getVdcClient();
metadataClient = vdcClient.getMetadataClient();
public void setupRequiredApis() {
vdcApi = adminContext.getApi().getVdcApi();
metadataApi = vdcApi.getMetadataApi();
assertNotNull(vdcURI, String.format(REF_REQ_LIVE, VDC));
adminVdcUri = toAdminUri(vdcURI);
}
@ -74,7 +74,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public void cleanUp() throws Exception {
if (metadataKey != null) {
try {
Task task = metadataClient.deleteMetadataEntry(adminVdcUri, metadataKey);
Task task = metadataApi.deleteMetadataEntry(adminVdcUri, metadataKey);
taskDoneEventually(task);
} catch (VCloudDirectorException e) {
logger.warn(e, "Error deleting metadata-value (perhaps it doesn't exist?); continuing...");
@ -84,7 +84,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /admin/vdc/{id}")
public void testGetVdc() {
AdminVdc vdc = vdcClient.getVdc(adminVdcUri);
AdminVdc vdc = vdcApi.getVdc(adminVdcUri);
assertNotNull(vdc, String.format(OBJ_REQ_LIVE, VDC));
// parent type
@ -94,7 +94,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
// TODO insufficient permissions to test
@Test(description = "PUT /admin/vdc/{id}", enabled=false)
public void testEditVdc() throws Exception {
String origName = vdcClient.getVdc(adminVdcUri).getName();
String origName = vdcApi.getVdc(adminVdcUri).getName();
String newName = name("a");
Exception exception = null;
@ -103,10 +103,10 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build();
try {
Task task = vdcClient.editVdc(adminVdcUri, vdc);
Task task = vdcApi.editVdc(adminVdcUri, vdc);
assertTaskSucceeds(task);
AdminVdc modified = vdcClient.getVdc(adminVdcUri);
AdminVdc modified = vdcApi.getVdc(adminVdcUri);
assertEquals(modified.getName(), newName);
// parent type
@ -116,7 +116,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
} finally {
try {
AdminVdc restorableVdc = AdminVdc.builder().name(origName).build();
Task task = vdcClient.editVdc(adminVdcUri, restorableVdc);
Task task = vdcApi.editVdc(adminVdcUri, restorableVdc);
assertTaskSucceeds(task);
} catch (Exception e) {
if (exception != null) {
@ -133,11 +133,11 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "DELETE /admin/vdc/{id}", enabled=false)
public void testDeleteVdc() throws Exception {
// TODO Need to have a VDC that we're happy to delete!
Task task = vdcClient.deleteVdc(adminVdcUri);
Task task = vdcApi.deleteVdc(adminVdcUri);
assertTaskSucceeds(task);
try {
vdcClient.getVdc(adminVdcUri);
vdcApi.getVdc(adminVdcUri);
} catch (VCloudDirectorException e) {
// success; unreachable because it has been deleted
}
@ -150,12 +150,12 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
Exception exception = null;
try {
vdcClient.disableVdc(adminVdcUri);
vdcApi.disableVdc(adminVdcUri);
} catch (Exception e) {
exception = e;
} finally {
try {
vdcClient.enableVdc(adminVdcUri);
vdcApi.enableVdc(adminVdcUri);
} catch (Exception e) {
if (exception != null) {
logger.warn(e, "Error resetting adminVdc.name; rethrowing original test exception...");
@ -169,7 +169,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(description = "GET /admin/vdc/{id}/metadata")
public void testGetMetadata() throws Exception {
Metadata metadata = metadataClient.getMetadata(adminVdcUri);
Metadata metadata = metadataApi.getMetadata(adminVdcUri);
Checks.checkMetadata(metadata);
}
@ -183,10 +183,10 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.entry(MetadataEntry.builder().entry(metadataKey, metadataValue).build())
.build();
Task task = metadataClient.mergeMetadata(adminVdcUri, metadata);
Task task = metadataApi.mergeMetadata(adminVdcUri, metadata);
assertTaskSucceeds(task);
MetadataValue modified = metadataClient.getMetadataValue(adminVdcUri, metadataKey);
MetadataValue modified = metadataApi.getMetadataValue(adminVdcUri, metadataKey);
Checks.checkMetadataValueFor("AdminVdc", modified, metadataValue);
Checks.checkMetadata(metadata);
}
@ -194,7 +194,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
// TODO insufficient permissions to test
@Test(description = "GET /admin/vdc/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadata" }, enabled=false)
public void testGetMetadataValue() throws Exception {
MetadataValue retrievedMetadataValue = metadataClient.getMetadataValue(adminVdcUri, metadataKey);
MetadataValue retrievedMetadataValue = metadataApi.getMetadataValue(adminVdcUri, metadataKey);
Checks.checkMetadataValueFor("AdminVdc", retrievedMetadataValue, metadataValue);
}
@ -205,10 +205,10 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
metadataValue = name("value-");
MetadataValue newV = MetadataValue.builder().value(metadataValue).build();
Task task = metadataClient.setMetadata(adminVdcUri, metadataKey, newV);
Task task = metadataApi.setMetadata(adminVdcUri, metadataKey, newV);
assertTaskSucceeds(task);
MetadataValue retrievedMetadataValue = metadataClient.getMetadataValue(adminVdcUri, metadataKey);
MetadataValue retrievedMetadataValue = metadataApi.getMetadataValue(adminVdcUri, metadataKey);
Checks.checkMetadataValueFor("AdminVdc", retrievedMetadataValue, metadataValue);
}
@ -217,11 +217,11 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public void testDeleteMetadataValue() throws Exception {
// TODO Remove dependency on other tests; make cleanUp delete a list of metadata entries?
Task task = metadataClient.deleteMetadataEntry(adminVdcUri, metadataKey);
Task task = metadataApi.deleteMetadataEntry(adminVdcUri, metadataKey);
assertTaskSucceeds(task);
try {
metadataClient.getMetadataValue(adminVdcUri, metadataKey);
metadataApi.getMetadataValue(adminVdcUri, metadataKey);
fail("Retrieval of metadata value "+metadataKey+" should have fail after deletion");
} catch (VCloudDirectorException e) {
// success; should not be accessible

Some files were not shown because too many files have changed in this diff Show More