Issue 830: renamed Api methods to be in accordance with vCloud relationship links

This commit is contained in:
Adrian Cole 2012-08-19 16:46:02 -07:00
parent cb844928c0
commit cd0aa72ae1
85 changed files with 1232 additions and 1252 deletions

View File

@ -225,6 +225,6 @@ public class VCloudDirectorMediaType {
TEXT_XML, ADMIN_VDC, NETWORK_POOL, ADMIN_ORG, ENTITY, ADMIN TEXT_XML, ADMIN_VDC, NETWORK_POOL, ADMIN_ORG, ENTITY, ADMIN
); );
// NOTE These lists must be updated whenever a new media type constant is added. // NOTE These lists must be edited whenever a new media type constant is added.
} }

View File

@ -167,7 +167,7 @@ public class ControlAccessParams {
/** /**
* The access settings to be applied if {@link #isSharedToEveryone()} is false. * The access settings to be applied if {@link #isSharedToEveryone()} is false.
* *
* Required on create and modify if {@link #isSharedToEveryone()} is false. * Required on create and edit if {@link #isSharedToEveryone()} is false.
*/ */
public List<AccessSetting> getAccessSettings() { public List<AccessSetting> getAccessSettings() {
return accessSettings == null ? Collections.<AccessSetting>emptyList() : accessSettings; return accessSettings == null ? Collections.<AccessSetting>emptyList() : accessSettings;

View File

@ -69,7 +69,7 @@ public class RecomposeVAppParams extends ComposeVAppParams {
public static abstract class Builder<B extends Builder<B>> extends ComposeVAppParams.Builder<B> { public static abstract class Builder<B extends Builder<B>> extends ComposeVAppParams.Builder<B> {
private List<Vm> createItem; private List<Vm> createItem;
private List<Reference> deleteItem; private List<Reference> removeItem;
/** /**
* @see RecomposeVAppParams#getCreateItem() * @see RecomposeVAppParams#getCreateItem()
@ -82,8 +82,8 @@ public class RecomposeVAppParams extends ComposeVAppParams {
/** /**
* @see RecomposeVAppParams#getDeleteItem() * @see RecomposeVAppParams#getDeleteItem()
*/ */
public B deleteItem(List<Reference> deleteItem) { public B removeItem(List<Reference> removeItem) {
this.deleteItem = deleteItem; this.removeItem = removeItem;
return self(); return self();
} }
@ -93,7 +93,7 @@ public class RecomposeVAppParams extends ComposeVAppParams {
} }
public B fromRecomposeVAppParams(RecomposeVAppParams in) { public B fromRecomposeVAppParams(RecomposeVAppParams in) {
return fromComposeVAppParams(in).createItem(in.getCreateItem()).deleteItem(in.getDeleteItem()); return fromComposeVAppParams(in).createItem(in.getCreateItem()).removeItem(in.getDeleteItem());
} }
} }
@ -104,13 +104,13 @@ public class RecomposeVAppParams extends ComposeVAppParams {
private RecomposeVAppParams(Builder<?> builder) { private RecomposeVAppParams(Builder<?> builder) {
super(builder); super(builder);
this.createItem = builder.createItem; this.createItem = builder.createItem;
this.deleteItem = builder.deleteItem; this.removeItem = builder.removeItem;
} }
@XmlElement(name = "CreateItem") @XmlElement(name = "CreateItem")
protected List<Vm> createItem; protected List<Vm> createItem;
@XmlElement(name = "DeleteItem") @XmlElement(name = "DeleteItem")
protected List<Reference> deleteItem; protected List<Reference> removeItem;
/** /**
* Gets the value of the createItem property. * Gets the value of the createItem property.
@ -123,13 +123,13 @@ public class RecomposeVAppParams extends ComposeVAppParams {
} }
/** /**
* Gets the value of the deleteItem property. * Gets the value of the removeItem property.
*/ */
public List<Reference> getDeleteItem() { public List<Reference> getDeleteItem() {
if (deleteItem == null) { if (removeItem == null) {
deleteItem = new ArrayList<Reference>(); removeItem = new ArrayList<Reference>();
} }
return this.deleteItem; return this.removeItem;
} }
@Override @Override
@ -140,17 +140,17 @@ public class RecomposeVAppParams extends ComposeVAppParams {
return false; return false;
RecomposeVAppParams that = RecomposeVAppParams.class.cast(o); RecomposeVAppParams that = RecomposeVAppParams.class.cast(o);
return super.equals(that) && return super.equals(that) &&
equal(this.createItem, that.createItem) && equal(this.deleteItem, that.deleteItem); equal(this.createItem, that.createItem) && equal(this.removeItem, that.removeItem);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(super.hashCode(), createItem, deleteItem); return Objects.hashCode(super.hashCode(), createItem, removeItem);
} }
@Override @Override
public ToStringHelper string() { public ToStringHelper string() {
return super.string().add("createItem", createItem).add("deleteItem", deleteItem); return super.string().add("createItem", createItem).add("removeItem", removeItem);
} }
} }

View File

@ -61,8 +61,8 @@ public interface CatalogApi {
* @param catalogUri * @param catalogUri
* the URI of the catalog * the URI of the catalog
* @param item * @param item
* the catalog item to create * the catalog item to add
* @return the created catalog item * @return the addd catalog item
*/ */
CatalogItem addItem(String catalogUrn, CatalogItem item); CatalogItem addItem(String catalogUrn, CatalogItem item);
@ -94,11 +94,11 @@ public interface CatalogApi {
* the reference for the catalog item * the reference for the catalog item
* @param catalogItem * @param catalogItem
* the catalog item * the catalog item
* @return the updated catalog item * @return the edited catalog item
*/ */
CatalogItem updateItem(String catalogItemUrn, CatalogItem catalogItem); CatalogItem editItem(String catalogItemUrn, CatalogItem catalogItem);
CatalogItem updateItem(URI catalogItemHref, CatalogItem catalogItem); CatalogItem editItem(URI catalogItemHref, CatalogItem catalogItem);
/** /**
* Deletes a catalog item. * Deletes a catalog item.
@ -110,9 +110,9 @@ public interface CatalogApi {
* @param catalogItemRef * @param catalogItemRef
* the reference for the catalog item * the reference for the catalog item
*/ */
void deleteItem(String catalogItemUrn); void removeItem(String catalogItemUrn);
void deleteItem(URI catalogItemHref); void removeItem(URI catalogItemHref);
/** /**
* @return synchronous access to {@link Metadata.Readable} features * @return synchronous access to {@link Metadata.Readable} features

View File

@ -83,22 +83,22 @@ public interface CatalogAsyncApi {
ListenableFuture<CatalogItem> getItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn); ListenableFuture<CatalogItem> getItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
/** /**
* @see CatalogApi#updateItem(String, CatalogItem) * @see CatalogApi#editItem(String, CatalogItem)
*/ */
@PUT @PUT
@Consumes(VCloudDirectorMediaType.CATALOG_ITEM) @Consumes(VCloudDirectorMediaType.CATALOG_ITEM)
@Produces(VCloudDirectorMediaType.CATALOG_ITEM) @Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<CatalogItem> updateItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn, ListenableFuture<CatalogItem> editItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem); @BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/** /**
* @see CatalogApi#deleteItem(String) * @see CatalogApi#removeItem(String)
*/ */
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> deleteItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn); ListenableFuture<Void> removeItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
/** /**
* @see CatalogApi#get(URI) * @see CatalogApi#get(URI)
@ -130,22 +130,22 @@ public interface CatalogAsyncApi {
ListenableFuture<CatalogItem> getItem(@EndpointParam URI catalogItemHref); ListenableFuture<CatalogItem> getItem(@EndpointParam URI catalogItemHref);
/** /**
* @see CatalogApi#updateItem(URI, CatalogItem) * @see CatalogApi#editItem(URI, CatalogItem)
*/ */
@PUT @PUT
@Consumes(VCloudDirectorMediaType.CATALOG_ITEM) @Consumes(VCloudDirectorMediaType.CATALOG_ITEM)
@Produces(VCloudDirectorMediaType.CATALOG_ITEM) @Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<CatalogItem> updateItem(@EndpointParam URI catalogItemHref, ListenableFuture<CatalogItem> editItem(@EndpointParam URI catalogItemHref,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem); @BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/** /**
* @see CatalogApi#deleteItem(URI) * @see CatalogApi#removeItem(URI)
*/ */
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> deleteItem(@EndpointParam URI catalogItemHref); ListenableFuture<Void> removeItem(@EndpointParam URI catalogItemHref);
/** /**
* @return asynchronous access to {@link Metadata.Readable} features * @return asynchronous access to {@link Metadata.Readable} features

View File

@ -49,7 +49,7 @@ public interface MediaApi {
* *
* @return The response will return a link to transfer site to be able to continue with uploading the media. * @return The response will return a link to transfer site to be able to continue with uploading the media.
*/ */
Media createMedia(URI uploadLink, Media media); Media addMedia(URI uploadLink, Media media);
/** /**
* Clones a media into new one. * Clones a media into new one.
@ -66,12 +66,12 @@ public interface MediaApi {
* @return a task. This operation is asynchronous and the user should monitor the returned * @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed. * task status in order to check when it is completed.
*/ */
Task updateMedia(URI mediaUri, Media media); Task editMedia(URI mediaUri, Media media);
/** /**
* Deletes a media. * Deletes a media.
*/ */
Task deleteMedia(URI mediaUri); Task removeMedia(URI mediaUri);
/** /**
* Retrieves an owner. * Retrieves an owner.

View File

@ -62,13 +62,13 @@ public interface MediaAsyncApi {
ListenableFuture<Media> getMedia(@EndpointParam URI uri); ListenableFuture<Media> getMedia(@EndpointParam URI uri);
/** /**
* @see MediaApi#createMedia(URI, Media) * @see MediaApi#addMedia(URI, Media)
*/ */
@POST @POST
@Consumes(VCloudDirectorMediaType.MEDIA) @Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.MEDIA) @Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Media> createMedia(@EndpointParam URI link, ListenableFuture<Media> addMedia(@EndpointParam URI link,
@BinderParam(BindToXMLPayload.class) Media media); @BinderParam(BindToXMLPayload.class) Media media);
@ -84,21 +84,21 @@ public interface MediaAsyncApi {
@BinderParam(BindToXMLPayload.class) CloneMediaParams params); @BinderParam(BindToXMLPayload.class) CloneMediaParams params);
/** /**
* @see MediaApi#updateMedia(URI, Media)) * @see MediaApi#editMedia(URI, Media))
*/ */
@PUT @PUT
@Consumes(VCloudDirectorMediaType.TASK) @Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.MEDIA) @Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> updateMedia(@EndpointParam URI uri, @BinderParam(BindToXMLPayload.class) Media media); ListenableFuture<Task> editMedia(@EndpointParam URI uri, @BinderParam(BindToXMLPayload.class) Media media);
/** /**
* @see MediaApi#deleteMedia(URI)) * @see MediaApi#removeMedia(URI))
*/ */
@DELETE @DELETE
@Consumes(VCloudDirectorMediaType.TASK) @Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> deleteMedia(@EndpointParam URI uri); ListenableFuture<Task> removeMedia(@EndpointParam URI uri);
/** /**
* @see MediaApi#getOwner(URI) * @see MediaApi#getOwner(URI)

View File

@ -77,7 +77,7 @@ public interface MetadataApi {
* @return a task. This operation is asynchronous and the user should monitor the returned * @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed. * task status in order to check when it is completed.
*/ */
Task deleteEntry(URI uri, String key); Task removeEntry(URI uri, String key);
} }
} }

View File

@ -103,13 +103,13 @@ public interface MetadataAsyncApi {
@BinderParam(BindToXMLPayload.class) MetadataValue metadataValue); @BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
/** /**
* @see MetadataApi.Writable#deleteEntry(URI, String)) * @see MetadataApi.Writable#removeEntry(URI, String))
*/ */
@DELETE @DELETE
@Path("/metadata/{key}") @Path("/metadata/{key}")
@Consumes(VCloudDirectorMediaType.TASK) @Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> deleteEntry(@EndpointParam URI metaDataUri, @PathParam("key") String key); ListenableFuture<Task> removeEntry(@EndpointParam URI metaDataUri, @PathParam("key") String key);
} }
} }

View File

@ -53,7 +53,7 @@ public interface VAppApi {
* The {@link VApp} could be in one of these statuses: * The {@link VApp} could be in one of these statuses:
* <ul> * <ul>
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION FAILED_CREATION(-1)} - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION FAILED_CREATION(-1)} -
* Transient entity state, e.g., model object is created but the corresponding VC backing does not * Transient entity state, e.g., model object is addd but the corresponding VC backing does not
* exist yet. This is further sub-categorized in the respective entities. * exist yet. This is further sub-categorized in the respective entities.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED UNRESOLVED(0)} - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED UNRESOLVED(0)} -
* Entity is whole, e.g., VM creation is complete and all the required model objects and VC backings are * Entity is whole, e.g., VM creation is complete and all the required model objects and VC backings are
@ -98,7 +98,7 @@ public interface VAppApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyVApp(URI vAppURI, VApp vApp); Task editVApp(URI vAppURI, VApp vApp);
/** /**
* Deletes a {@link VApp}. * Deletes a {@link VApp}.
@ -109,7 +109,7 @@ public interface VAppApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task deleteVApp(URI vAppURI); Task removeVApp(URI vAppURI);
/** /**
* Modifies the control access of a {@link VApp}. * Modifies the control access of a {@link VApp}.
@ -120,7 +120,7 @@ public interface VAppApi {
* *
* @since 0.9 * @since 0.9
*/ */
ControlAccessParams modifyControlAccess(URI vAppURI, ControlAccessParams params); ControlAccessParams editControlAccess(URI vAppURI, ControlAccessParams params);
/** /**
* Deploys a {@link VApp}. * Deploys a {@link VApp}.
@ -217,7 +217,7 @@ public interface VAppApi {
* Retrieves the control access information for a {@link VApp}. * Retrieves the control access information for a {@link VApp}.
* *
* The vApp could be shared to everyone or could be shared to specific user, * The vApp could be shared to everyone or could be shared to specific user,
* by modifying the control access values. * by editing the control access values.
* *
* <pre> * <pre>
* GET /vApp/{id}/controlAccess * GET /vApp/{id}/controlAccess
@ -330,7 +330,7 @@ public interface VAppApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section); Task editLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section);
/** /**
* Retrieves the network config section of a {@link VApp}. * Retrieves the network config section of a {@link VApp}.
@ -352,7 +352,7 @@ public interface VAppApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyNetworkConfigSection(URI vAppURI, NetworkConfigSection section); Task editNetworkConfigSection(URI vAppURI, NetworkConfigSection section);
/** /**
* Retrieves the network section of a {@link VApp}. * Retrieves the network section of a {@link VApp}.
@ -385,7 +385,7 @@ public interface VAppApi {
* *
* @since 1.5 * @since 1.5
*/ */
void modifyOwner(URI vAppURI, Owner owner); void editOwner(URI vAppURI, Owner owner);
/** /**
* Retrieves {@link VApp} product sections. * Retrieves {@link VApp} product sections.
@ -407,7 +407,7 @@ public interface VAppApi {
* *
* @since 1.5 * @since 1.5
*/ */
Task modifyProductSections(URI vAppURI, ProductSectionList sectionList); Task editProductSections(URI vAppURI, ProductSectionList sectionList);
/** /**
* Retrieves the startup section of a {@link VApp}. * Retrieves the startup section of a {@link VApp}.
@ -429,7 +429,7 @@ public interface VAppApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyStartupSection(URI vAppURI, StartupSection section); Task editStartupSection(URI vAppURI, StartupSection section);
/** /**
* Synchronous access to {@link VApp} {@link Metadata} features. * Synchronous access to {@link VApp} {@link Metadata} features.

View File

@ -81,32 +81,32 @@ public interface VAppAsyncApi {
ListenableFuture<VApp> getVApp(@EndpointParam URI vAppURI); ListenableFuture<VApp> getVApp(@EndpointParam URI vAppURI);
/** /**
* @see VAppApi#modifyVApp(URI, VApp) * @see VAppApi#editVApp(URI, VApp)
*/ */
@PUT @PUT
@Produces(VAPP) @Produces(VAPP)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyVApp(@EndpointParam URI vAppURI, ListenableFuture<Task> editVApp(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) VApp vApp); @BinderParam(BindToXMLPayload.class) VApp vApp);
/** /**
* @see VAppApi#deleteVApp(URI) * @see VAppApi#removeVApp(URI)
*/ */
@DELETE @DELETE
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> deleteVApp(@EndpointParam URI vAppURI); ListenableFuture<Task> removeVApp(@EndpointParam URI vAppURI);
/** /**
* @see VAppApi#modifyControlAccess(URI, ControlAccessParams) * @see VAppApi#editControlAccess(URI, ControlAccessParams)
*/ */
@POST @POST
@Path("/action/controlAccess") @Path("/action/controlAccess")
@Produces(CONTROL_ACCESS) @Produces(CONTROL_ACCESS)
@Consumes(CONTROL_ACCESS) @Consumes(CONTROL_ACCESS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<ControlAccessParams> modifyControlAccess(@EndpointParam URI vAppURI, ListenableFuture<ControlAccessParams> editControlAccess(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) ControlAccessParams params); @BinderParam(BindToXMLPayload.class) ControlAccessParams params);
/** /**
@ -244,14 +244,14 @@ public interface VAppAsyncApi {
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI vAppURI); ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI vAppURI);
/** /**
* @see VAppApi#modifyLeaseSettingsSection(URI, LeaseSettingsSection) * @see VAppApi#editLeaseSettingsSection(URI, LeaseSettingsSection)
*/ */
@PUT @PUT
@Path("/leaseSettingsSection") @Path("/leaseSettingsSection")
@Produces(LEASE_SETTINGS_SECTION) @Produces(LEASE_SETTINGS_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyLeaseSettingsSection(@EndpointParam URI vAppURI, ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection section); @BinderParam(BindToXMLPayload.class) LeaseSettingsSection section);
/** /**
@ -265,14 +265,14 @@ public interface VAppAsyncApi {
ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI vAppURI); ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI vAppURI);
/** /**
* @see VAppApi#modifyNetworkConfigSection(URI, NetworkConfigSection) * @see VAppApi#editNetworkConfigSection(URI, NetworkConfigSection)
*/ */
@PUT @PUT
@Path("/networkConfigSection") @Path("/networkConfigSection")
@Produces(NETWORK_CONFIG_SECTION) @Produces(NETWORK_CONFIG_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyNetworkConfigSection(@EndpointParam URI vAppURI, ListenableFuture<Task> editNetworkConfigSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section); @BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
/** /**
@ -296,14 +296,14 @@ public interface VAppAsyncApi {
ListenableFuture<Owner> getOwner(@EndpointParam URI vAppURI); ListenableFuture<Owner> getOwner(@EndpointParam URI vAppURI);
/** /**
* @see VAppApi#modifyOwner(URI, Owner) * @see VAppApi#editOwner(URI, Owner)
*/ */
@PUT @PUT
@Path("/owner") @Path("/owner")
@Produces(OWNER) @Produces(OWNER)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> modifyOwner(@EndpointParam URI vAppURI, ListenableFuture<Void> editOwner(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) Owner owner); @BinderParam(BindToXMLPayload.class) Owner owner);
/** /**
@ -317,14 +317,14 @@ public interface VAppAsyncApi {
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vAppURI); ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vAppURI);
/** /**
* @see VAppApi#modifyProductSections(URI, ProductSectionList) * @see VAppApi#editProductSections(URI, ProductSectionList)
*/ */
@PUT @PUT
@Path("/productSections") @Path("/productSections")
@Produces(PRODUCT_SECTION_LIST) @Produces(PRODUCT_SECTION_LIST)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyProductSections(@EndpointParam URI vAppURI, ListenableFuture<Task> editProductSections(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
@ -339,14 +339,14 @@ public interface VAppAsyncApi {
ListenableFuture<StartupSection> getStartupSection(@EndpointParam URI vAppURI); ListenableFuture<StartupSection> getStartupSection(@EndpointParam URI vAppURI);
/** /**
* @see VAppApi#modifyStartupSection(URI, StartupSection) * @see VAppApi#editStartupSection(URI, StartupSection)
*/ */
@PUT @PUT
@Path("/startupSection") @Path("/startupSection")
@Produces(STARTUP_SECTION) @Produces(STARTUP_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyStartupSection(@EndpointParam URI vAppURI, ListenableFuture<Task> editStartupSection(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) StartupSection section); @BinderParam(BindToXMLPayload.class) StartupSection section);
/** /**

View File

@ -52,10 +52,10 @@ public interface VAppTemplateApi {
* The vApp could be in one of these statues: * The vApp could be in one of these statues:
* <ul> * <ul>
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION FAILED_CREATION(-1)} - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION FAILED_CREATION(-1)} -
* Transient entity state, e.g., model object is created but the corresponding VC backing does not exist yet. This * Transient entity state, e.g., model object is addd but the corresponding VC backing does not exist yet. This
* is further sub-categorized in the respective entities. * is further sub-categorized in the respective entities.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED UNRESOLVED(0)} - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED UNRESOLVED(0)} -
* Entity is whole, e.g., VM creation is complete and all the required model objects and VC backings are created. * Entity is whole, e.g., VM creation is complete and all the required model objects and VC backings are addd.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#RESOLVED RESOLVED(1)} - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#RESOLVED RESOLVED(1)} -
* Entity is resolved. * Entity is resolved.
* <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNKNOWN UNKNOWN(6)} - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNKNOWN UNKNOWN(6)} -
@ -87,7 +87,7 @@ public interface VAppTemplateApi {
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned * @return the task performing the action. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed. * task status in order to check when it is completed.
*/ */
Task modifyVAppTemplate(URI templateUri, VAppTemplate template); Task editVAppTemplate(URI templateUri, VAppTemplate template);
/** /**
* Deletes a vApp template. * Deletes a vApp template.
@ -100,7 +100,7 @@ public interface VAppTemplateApi {
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned * @return the task performing the action. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed. * task status in order to check when it is completed.
*/ */
Task deleteVappTemplate(URI templateUri); Task removeVappTemplate(URI templateUri);
/** /**
* Consolidates a VM * Consolidates a VM
@ -189,7 +189,7 @@ public interface VAppTemplateApi {
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned * @return the task performing the action. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed. * task status in order to check when it is completed.
*/ */
Task modifyGuestCustomizationSection(URI templateUri, GuestCustomizationSection section); Task editGuestCustomizationSection(URI templateUri, GuestCustomizationSection section);
/** /**
* Retrieves the lease settings section of a vApp or vApp template * Retrieves the lease settings section of a vApp or vApp template
@ -215,7 +215,7 @@ public interface VAppTemplateApi {
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned * @return the task performing the action. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed. * task status in order to check when it is completed.
*/ */
Task modifyLeaseSettingsSection(URI templateUri, LeaseSettingsSection section); Task editLeaseSettingsSection(URI templateUri, LeaseSettingsSection section);
/** /**
* Retrieves the network config section of a vApp or vApp template. * Retrieves the network config section of a vApp or vApp template.
@ -304,7 +304,7 @@ public interface VAppTemplateApi {
* @return the task performing the action. This operation is asynchronous and the user should monitor the returned * @return the task performing the action. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed. * task status in order to check when it is completed.
*/ */
Task modifyProductSections(URI templateUri, ProductSectionList sections); Task editProductSections(URI templateUri, ProductSectionList sections);
/** /**
* <pre> * <pre>

View File

@ -83,22 +83,22 @@ public interface VAppTemplateAsyncApi {
/** /**
* @see VAppTemplateApi#modifyVAppTemplate(URI, VAppTemplate) * @see VAppTemplateApi#editVAppTemplate(URI, VAppTemplate)
*/ */
@PUT @PUT
@Produces(VAPP_TEMPLATE) @Produces(VAPP_TEMPLATE)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyVAppTemplate(@EndpointParam URI templateURI, ListenableFuture<Task> editVAppTemplate(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) VAppTemplate template); @BinderParam(BindToXMLPayload.class) VAppTemplate template);
/** /**
* @see VAppTemplateApi#deleteVappTemplate(URI) * @see VAppTemplateApi#removeVappTemplate(URI)
*/ */
@DELETE @DELETE
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> deleteVappTemplate(@EndpointParam URI templateUri); ListenableFuture<Task> removeVappTemplate(@EndpointParam URI templateUri);
/** /**
* @see VAppTemplateApi#consolidateVm(URI) * @see VAppTemplateApi#consolidateVm(URI)
@ -158,14 +158,14 @@ public interface VAppTemplateAsyncApi {
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI templateURI); ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI templateURI);
/** /**
* @see VAppTemplateApi#modifyGuestCustomizationSection(URI, org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection) * @see VAppTemplateApi#editGuestCustomizationSection(URI, org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection)
*/ */
@PUT @PUT
@Produces(GUEST_CUSTOMIZATION_SECTION) @Produces(GUEST_CUSTOMIZATION_SECTION)
@Consumes(TASK) @Consumes(TASK)
@Path("/guestCustomizationSection") @Path("/guestCustomizationSection")
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyGuestCustomizationSection(@EndpointParam URI templateURI, ListenableFuture<Task> editGuestCustomizationSection(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section); @BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
/** /**
@ -179,14 +179,14 @@ public interface VAppTemplateAsyncApi {
ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI templateURI); ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI templateURI);
/** /**
* @see VAppTemplateApi#modifyLeaseSettingsSection(URI, LeaseSettingsSection) * @see VAppTemplateApi#editLeaseSettingsSection(URI, LeaseSettingsSection)
*/ */
@PUT @PUT
@Produces(LEASE_SETTINGS_SECTION) @Produces(LEASE_SETTINGS_SECTION)
@Consumes(TASK) @Consumes(TASK)
@Path("/leaseSettingsSection") @Path("/leaseSettingsSection")
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyLeaseSettingsSection(@EndpointParam URI templateURI, ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection); @BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection);
/** /**
@ -260,14 +260,14 @@ public interface VAppTemplateAsyncApi {
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI templateURI); ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI templateURI);
/** /**
* @see VAppTemplateApi#modifyProductSections(URI, ProductSectionList) * @see VAppTemplateApi#editProductSections(URI, ProductSectionList)
*/ */
@PUT @PUT
@Produces(PRODUCT_SECTION_LIST) @Produces(PRODUCT_SECTION_LIST)
@Consumes(TASK) @Consumes(TASK)
@Path("/productSections") @Path("/productSections")
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyProductSections(@EndpointParam URI templateURI, ListenableFuture<Task> editProductSections(@EndpointParam URI templateURI,
@BinderParam(BindToXMLPayload.class) ProductSectionList sections); @BinderParam(BindToXMLPayload.class) ProductSectionList sections);
/** /**

View File

@ -188,9 +188,9 @@ public interface VdcApi {
* *
* @return The response will return a link to transfer site to be able to continue with uploading the media. * @return The response will return a link to transfer site to be able to continue with uploading the media.
*/ */
Media createMedia(String vdcUrn, Media media); Media addMedia(String vdcUrn, Media media);
Media createMedia(URI vdcHref, Media media); Media addMedia(URI vdcHref, Media media);
/** /**
* @return synchronous access to {@link Metadata.Readable} features * @return synchronous access to {@link Metadata.Readable} features

View File

@ -147,14 +147,14 @@ public interface VdcAsyncApi {
@BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params); @BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params);
/** /**
* @see VdcApi#createMedia(String, Media) * @see VdcApi#addMedia(String, Media)
*/ */
@POST @POST
@Path("/media") @Path("/media")
@Consumes(VCloudDirectorMediaType.MEDIA) @Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.MEDIA) @Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Media> createMedia(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn, ListenableFuture<Media> addMedia(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) Media media); @BinderParam(BindToXMLPayload.class) Media media);
/** /**
@ -245,14 +245,14 @@ public interface VdcAsyncApi {
@BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params); @BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params);
/** /**
* @see VdcApi#createMedia(URI, Media) * @see VdcApi#addMedia(URI, Media)
*/ */
@POST @POST
@Path("/media") @Path("/media")
@Consumes(VCloudDirectorMediaType.MEDIA) @Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.MEDIA) @Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Media> createMedia(@EndpointParam URI vdcHref, @BinderParam(BindToXMLPayload.class) Media media); ListenableFuture<Media> addMedia(@EndpointParam URI vdcHref, @BinderParam(BindToXMLPayload.class) Media media);
/** /**
* @return asynchronous access to {@link Metadata.Readable} features * @return asynchronous access to {@link Metadata.Readable} features

View File

@ -58,23 +58,23 @@ public interface VmApi {
* @since 0.9 * @since 0.9
* @see VAppApi#getVApp(URI) * @see VAppApi#getVApp(URI)
*/ */
Vm getVm(URI vmURI); Vm get(URI vmURI);
/** /**
* Modifies the name/description of a {@link Vm}. * Modifies the name/description of a {@link Vm}.
* *
* @since 0.9 * @since 0.9
* @see VAppApi#modifyVApp(URI, VApp) * @see VAppApi#editVApp(URI, VApp)
*/ */
Task modifyVm(URI vmURI, Vm vm); Task edit(URI vmURI, Vm vm);
/** /**
* Deletes a {@link Vm}. * Deletes a {@link Vm}.
* *
* @since 0.9 * @since 0.9
* @see VAppApi#deleteVApp(URI) * @see VAppApi#removeVApp(URI)
*/ */
Task deleteVm(URI vmURI); Task remove(URI vmURI);
/** /**
* Consolidates a {@link Vm}. * Consolidates a {@link Vm}.
@ -85,7 +85,7 @@ public interface VmApi {
* *
* @since 1.5 * @since 1.5
*/ */
Task consolidateVm(URI vmURI); Task consolidate(URI vmURI);
/** /**
* Deploys a {@link Vm}. * Deploys a {@link Vm}.
@ -125,7 +125,7 @@ public interface VmApi {
* *
* @since 1.5 * @since 1.5
*/ */
Task relocateVm(URI vmURI, RelocateParams params); Task relocate(URI vmURI, RelocateParams params);
/** /**
* Undeploy a {@link Vm}. * Undeploy a {@link Vm}.
@ -216,7 +216,7 @@ public interface VmApi {
* *
* @since 1.0 * @since 1.0
*/ */
Task modifyGuestCustomizationSection(URI vmURI, GuestCustomizationSection section); Task editGuestCustomizationSection(URI vmURI, GuestCustomizationSection section);
/** /**
* Ejects media from a {@link Vm}. * Ejects media from a {@link Vm}.
@ -260,7 +260,7 @@ public interface VmApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyNetworkConnectionSection(URI vmURI, NetworkConnectionSection section); Task editNetworkConnectionSection(URI vmURI, NetworkConnectionSection section);
/** /**
* Retrieves the operating system section of a {@link Vm}. * Retrieves the operating system section of a {@link Vm}.
@ -282,7 +282,7 @@ public interface VmApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyOperatingSystemSection(URI vmURI, OperatingSystemSection section); Task editOperatingSystemSection(URI vmURI, OperatingSystemSection section);
/** /**
* Retrieves {@link Vm} product sections. * Retrieves {@link Vm} product sections.
@ -296,9 +296,9 @@ public interface VmApi {
* Modifies the product section information of a {@link Vm}. * Modifies the product section information of a {@link Vm}.
* *
* @since 1.5 * @since 1.5
* @see VAppApi#modifyProductSections(URI, ProductSectionList) * @see VAppApi#editProductSections(URI, ProductSectionList)
*/ */
Task modifyProductSections(URI vmURI, ProductSectionList sectionList); Task editProductSections(URI vmURI, ProductSectionList sectionList);
/** /**
* Retrieves a pending question for a {@link Vm}. * Retrieves a pending question for a {@link Vm}.
@ -387,7 +387,7 @@ public interface VmApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyVirtualHardwareSection(URI vmURI, VirtualHardwareSection section); Task editVirtualHardwareSection(URI vmURI, VirtualHardwareSection section);
/** /**
* Retrieves the CPU properties in virtual hardware section of a {@link Vm}. * Retrieves the CPU properties in virtual hardware section of a {@link Vm}.
@ -409,7 +409,7 @@ public interface VmApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyVirtualHardwareSectionCpu(URI vmURI, RasdItem rasd); Task editVirtualHardwareSectionCpu(URI vmURI, RasdItem rasd);
/** /**
* Retrieves a list of items for disks from virtual hardware section of a {@link Vm}. * Retrieves a list of items for disks from virtual hardware section of a {@link Vm}.
@ -431,7 +431,7 @@ public interface VmApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyVirtualHardwareSectionDisks(URI vmURI, RasdItemsList rasdItemsList); Task editVirtualHardwareSectionDisks(URI vmURI, RasdItemsList rasdItemsList);
/** /**
* Retrieves the list of items that represents the floppies and CD/DVD drives in a {@link Vm}. * Retrieves the list of items that represents the floppies and CD/DVD drives in a {@link Vm}.
@ -464,7 +464,7 @@ public interface VmApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyVirtualHardwareSectionMemory(URI vmURI, RasdItem rasd); Task editVirtualHardwareSectionMemory(URI vmURI, RasdItem rasd);
/** /**
* Retrieves a list of items for network cards from virtual hardware section of a {@link Vm}. * Retrieves a list of items for network cards from virtual hardware section of a {@link Vm}.
@ -486,7 +486,7 @@ public interface VmApi {
* *
* @since 0.9 * @since 0.9
*/ */
Task modifyVirtualHardwareSectionNetworkCards(URI vmURI, RasdItemsList rasdItemsList); Task editVirtualHardwareSectionNetworkCards(URI vmURI, RasdItemsList rasdItemsList);
/** /**
* Retrieves a list of items for serial ports from virtual hardware section of a {@link Vm}. * Retrieves a list of items for serial ports from virtual hardware section of a {@link Vm}.
@ -508,7 +508,7 @@ public interface VmApi {
* *
* @since 1.5 * @since 1.5
*/ */
Task modifyVirtualHardwareSectionSerialPorts(URI vmURI, RasdItemsList rasdItemsList); Task editVirtualHardwareSectionSerialPorts(URI vmURI, RasdItemsList rasdItemsList);
/** /**
* Synchronous access to {@link Vm} {@link Metadata} features. * Synchronous access to {@link Vm} {@link Metadata} features.

View File

@ -83,7 +83,7 @@ import com.google.common.util.concurrent.ListenableFuture;
public interface VmAsyncApi { public interface VmAsyncApi {
/** /**
* @see VmApi#getVm(URI) * @see VmApi#get(URI)
*/ */
@GET @GET
@Consumes(VM) @Consumes(VM)
@ -92,25 +92,25 @@ public interface VmAsyncApi {
ListenableFuture<Vm> getVm(@EndpointParam URI vmURI); ListenableFuture<Vm> getVm(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyVm(URI, Vm) * @see VmApi#edit(URI, Vm)
*/ */
@PUT @PUT
@Produces(VM) @Produces(VM)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyVm(@EndpointParam URI vmURI, ListenableFuture<Task> editVm(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) Vm vApp); @BinderParam(BindToXMLPayload.class) Vm vApp);
/** /**
* @see VmApi#deleteVm(URI) * @see VmApi#remove(URI)
*/ */
@DELETE @DELETE
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> deleteVm(@EndpointParam URI vmURI); ListenableFuture<Task> removeVm(@EndpointParam URI vmURI);
/** /**
* @see VmApi#consolidateVm(URI) * @see VmApi#consolidate(URI)
*/ */
@POST @POST
@Path("/action/consolidate") @Path("/action/consolidate")
@ -148,7 +148,7 @@ public interface VmAsyncApi {
ListenableFuture<Task> installVMwareTools(@EndpointParam URI vmURI); ListenableFuture<Task> installVMwareTools(@EndpointParam URI vmURI);
/** /**
* @see VmApi#relocateVm(URI, RelocateParams) * @see VmApi#relocate(URI, RelocateParams)
*/ */
@POST @POST
@Path("/action/relocate") @Path("/action/relocate")
@ -243,14 +243,14 @@ public interface VmAsyncApi {
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmURI); ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyGuestCustomizationSection(URI, GuestCustomizationSection) * @see VmApi#editGuestCustomizationSection(URI, GuestCustomizationSection)
*/ */
@PUT @PUT
@Path("/guestCustomizationSection") @Path("/guestCustomizationSection")
@Produces(GUEST_CUSTOMIZATION_SECTION) @Produces(GUEST_CUSTOMIZATION_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyGuestCustomizationSection(@EndpointParam URI vmURI, ListenableFuture<Task> editGuestCustomizationSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section); @BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
/** /**
@ -286,14 +286,14 @@ public interface VmAsyncApi {
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmURI); ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyNetworkConnectionSection(URI, NetworkConnectionSection) * @see VmApi#editNetworkConnectionSection(URI, NetworkConnectionSection)
*/ */
@PUT @PUT
@Path("/networkConnectionSection") @Path("/networkConnectionSection")
@Produces(NETWORK_CONNECTION_SECTION) @Produces(NETWORK_CONNECTION_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyNetworkConnectionSection(@EndpointParam URI vmURI, ListenableFuture<Task> editNetworkConnectionSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section); @BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
/** /**
@ -307,14 +307,14 @@ public interface VmAsyncApi {
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmURI); ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyOperatingSystemSection(URI, OperatingSystemSection) * @see VmApi#editOperatingSystemSection(URI, OperatingSystemSection)
*/ */
@PUT @PUT
@Path("/operatingSystemSection") @Path("/operatingSystemSection")
@Produces(OPERATING_SYSTEM_SECTION) @Produces(OPERATING_SYSTEM_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyOperatingSystemSection(@EndpointParam URI vmURI, ListenableFuture<Task> editOperatingSystemSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section); @BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
/** /**
@ -328,14 +328,14 @@ public interface VmAsyncApi {
ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vmURI); ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyProductSections(URI, ProductSectionList) * @see VmApi#editProductSections(URI, ProductSectionList)
*/ */
@PUT @PUT
@Path("/productSections") @Path("/productSections")
@Produces(PRODUCT_SECTION_LIST) @Produces(PRODUCT_SECTION_LIST)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyProductSections(@EndpointParam URI vmURI, ListenableFuture<Task> editProductSections(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList);
/** /**
@ -400,14 +400,14 @@ public interface VmAsyncApi {
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmURI); ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyVirtualHardwareSection(URI, VirtualHardwareSection) * @see VmApi#editVirtualHardwareSection(URI, VirtualHardwareSection)
*/ */
@PUT @PUT
@Path("/virtualHardwareSection") @Path("/virtualHardwareSection")
@Produces(VIRTUAL_HARDWARE_SECTION) @Produces(VIRTUAL_HARDWARE_SECTION)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSection(@EndpointParam URI vmURI, ListenableFuture<Task> editVirtualHardwareSection(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section); @BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
/** /**
@ -421,14 +421,14 @@ public interface VmAsyncApi {
ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam URI vmURI); ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData) * @see VmApi#editVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData)
*/ */
@PUT @PUT
@Path("/virtualHardwareSection/cpu") @Path("/virtualHardwareSection/cpu")
@Produces(OVF_RASD_ITEM) @Produces(OVF_RASD_ITEM)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionCpu(@EndpointParam URI vmURI, ListenableFuture<Task> editVirtualHardwareSectionCpu(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItem rasd); @BinderParam(BindToXMLPayload.class) RasdItem rasd);
/** /**
@ -442,14 +442,14 @@ public interface VmAsyncApi {
ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(@EndpointParam URI vmURI); ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyVirtualHardwareSectionDisks(URI, RasdItemsList) * @see VmApi#editVirtualHardwareSectionDisks(URI, RasdItemsList)
*/ */
@PUT @PUT
@Path("/virtualHardwareSection/disks") @Path("/virtualHardwareSection/disks")
@Produces(OVF_RASD_ITEMS_LIST) @Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionDisks(@EndpointParam URI vmURI, ListenableFuture<Task> editVirtualHardwareSectionDisks(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/** /**
@ -473,14 +473,14 @@ public interface VmAsyncApi {
ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam URI vmURI); ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData) * @see VmApi#editVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData)
*/ */
@PUT @PUT
@Path("/virtualHardwareSection/memory") @Path("/virtualHardwareSection/memory")
@Produces(OVF_RASD_ITEM) @Produces(OVF_RASD_ITEM)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionMemory(@EndpointParam URI vmURI, ListenableFuture<Task> editVirtualHardwareSectionMemory(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItem rasd); @BinderParam(BindToXMLPayload.class) RasdItem rasd);
/** /**
@ -494,14 +494,14 @@ public interface VmAsyncApi {
ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI); ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyVirtualHardwareSectionNetworkCards(URI, RasdItemsList) * @see VmApi#editVirtualHardwareSectionNetworkCards(URI, RasdItemsList)
*/ */
@PUT @PUT
@Path("/virtualHardwareSection/networkCards") @Path("/virtualHardwareSection/networkCards")
@Produces(OVF_RASD_ITEMS_LIST) @Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI, ListenableFuture<Task> editVirtualHardwareSectionNetworkCards(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/** /**
@ -515,14 +515,14 @@ public interface VmAsyncApi {
ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI); ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI);
/** /**
* @see VmApi#modifyVirtualHardwareSectionSerialPorts(URI, RasdItemsList) * @see VmApi#editVirtualHardwareSectionSerialPorts(URI, RasdItemsList)
*/ */
@PUT @PUT
@Path("/virtualHardwareSection/serialPorts") @Path("/virtualHardwareSection/serialPorts")
@Produces(OVF_RASD_ITEMS_LIST) @Produces(OVF_RASD_ITEMS_LIST)
@Consumes(TASK) @Consumes(TASK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> modifyVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI, ListenableFuture<Task> editVirtualHardwareSectionSerialPorts(@EndpointParam URI vmURI,
@BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList);
/** /**

View File

@ -41,7 +41,7 @@ import org.jclouds.vcloud.director.v1_5.features.MetadataApi;
public interface AdminCatalogApi extends CatalogApi { public interface AdminCatalogApi extends CatalogApi {
/** /**
* Creates a catalog in an organization. The catalog will always be created in unpublished state. * Creates a catalog in an organization. The catalog will always be addd in unpublished state.
* *
* <pre> * <pre>
* POST /admin/org/{id}/catalogs * POST /admin/org/{id}/catalogs
@ -51,9 +51,9 @@ public interface AdminCatalogApi extends CatalogApi {
* the urn for the org * the urn for the org
* @return contains a , which will point to the running asynchronous creation operation. * @return contains a , which will point to the running asynchronous creation operation.
*/ */
AdminCatalog createCatalogInOrg(AdminCatalog catalog, String orgUrn); AdminCatalog addCatalogToOrg(AdminCatalog catalog, String orgUrn);
AdminCatalog createCatalogInOrg(AdminCatalog catalog, URI catalogAdminHref); AdminCatalog addCatalogToOrg(AdminCatalog catalog, URI catalogAdminHref);
/** /**
* Retrieves a catalog. * Retrieves a catalog.
@ -81,22 +81,22 @@ public interface AdminCatalogApi extends CatalogApi {
* PUT /admin/catalog/{id} * PUT /admin/catalog/{id}
* </pre> * </pre>
* *
* @return the updated catalog * @return the edited catalog
*/ */
AdminCatalog update(String catalogUrn, AdminCatalog catalog); AdminCatalog edit(String catalogUrn, AdminCatalog catalog);
AdminCatalog update(URI catalogAdminHref, AdminCatalog catalog); AdminCatalog edit(URI catalogAdminHref, AdminCatalog catalog);
/** /**
* Deletes a catalog. The catalog could be deleted if it is either published or unpublished. * Deletes a catalog. The catalog could be removed if it is either published or unpublished.
* *
* <pre> * <pre>
* DELETE /admin/catalog/{id} * DELETE /admin/catalog/{id}
* </pre> * </pre>
*/ */
void delete(String catalogUrn); void remove(String catalogUrn);
void delete(URI catalogAdminHref); void remove(URI catalogAdminHref);
/** /**
* Retrieves the owner of a catalog. * Retrieves the owner of a catalog.
@ -144,9 +144,9 @@ public interface AdminCatalogApi extends CatalogApi {
* *
* @return the control access information * @return the control access information
*/ */
ControlAccessParams modifyAccessControl(String catalogUrn, ControlAccessParams params); ControlAccessParams editAccessControl(String catalogUrn, ControlAccessParams params);
ControlAccessParams modifyAccessControl(URI catalogAdminHref, ControlAccessParams params); ControlAccessParams editAccessControl(URI catalogAdminHref, ControlAccessParams params);
/** /**
* Retrieves the catalog control access information. * Retrieves the catalog control access information.

View File

@ -60,25 +60,25 @@ import com.google.common.util.concurrent.ListenableFuture;
public interface AdminCatalogAsyncApi extends CatalogAsyncApi { public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
/** /**
* @see AdminCatalogApi#createCatalogInOrg(AdminCatalog, String) * @see AdminCatalogApi#addCatalogToOrg(AdminCatalog, String)
*/ */
@POST @POST
@Path("/catalogs") @Path("/catalogs")
@Consumes(VCloudDirectorMediaType.ADMIN_CATALOG) @Consumes(VCloudDirectorMediaType.ADMIN_CATALOG)
@Produces(VCloudDirectorMediaType.ADMIN_CATALOG) @Produces(VCloudDirectorMediaType.ADMIN_CATALOG)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<AdminCatalog> createCatalogInOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog, ListenableFuture<AdminCatalog> addCatalogToOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog,
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
/** /**
* @see AdminCatalogApi#createCatalogInOrg(AdminCatalog, URI) * @see AdminCatalogApi#addCatalogToOrg(AdminCatalog, URI)
*/ */
@POST @POST
@Path("/catalogs") @Path("/catalogs")
@Consumes(VCloudDirectorMediaType.ADMIN_CATALOG) @Consumes(VCloudDirectorMediaType.ADMIN_CATALOG)
@Produces(VCloudDirectorMediaType.ADMIN_CATALOG) @Produces(VCloudDirectorMediaType.ADMIN_CATALOG)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<AdminCatalog> createCatalogInOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog, ListenableFuture<AdminCatalog> addCatalogToOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog,
@EndpointParam URI orgHref); @EndpointParam URI orgHref);
/** /**
@ -102,40 +102,40 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
ListenableFuture<AdminCatalog> get(@EndpointParam URI orgHref); ListenableFuture<AdminCatalog> get(@EndpointParam URI orgHref);
/** /**
* @see AdminCatalogApi#update(String, AdminCatalog) * @see AdminCatalogApi#edit(String, AdminCatalog)
*/ */
@PUT @PUT
@Consumes(VCloudDirectorMediaType.ADMIN_CATALOG) @Consumes(VCloudDirectorMediaType.ADMIN_CATALOG)
@Produces(VCloudDirectorMediaType.ADMIN_CATALOG) @Produces(VCloudDirectorMediaType.ADMIN_CATALOG)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<AdminCatalog> update(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn, ListenableFuture<AdminCatalog> edit(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn,
@BinderParam(BindToXMLPayload.class) AdminCatalog catalog); @BinderParam(BindToXMLPayload.class) AdminCatalog catalog);
/** /**
* @see AdminCatalogApi#update(URI, AdminCatalog) * @see AdminCatalogApi#edit(URI, AdminCatalog)
*/ */
@PUT @PUT
@Consumes(VCloudDirectorMediaType.ADMIN_CATALOG) @Consumes(VCloudDirectorMediaType.ADMIN_CATALOG)
@Produces(VCloudDirectorMediaType.ADMIN_CATALOG) @Produces(VCloudDirectorMediaType.ADMIN_CATALOG)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<AdminCatalog> update(@EndpointParam URI catalogAdminHref, ListenableFuture<AdminCatalog> edit(@EndpointParam URI catalogAdminHref,
@BinderParam(BindToXMLPayload.class) AdminCatalog catalog); @BinderParam(BindToXMLPayload.class) AdminCatalog catalog);
/** /**
* @see AdminCatalogApi#delete(String) * @see AdminCatalogApi#remove(String)
*/ */
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> delete(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn); ListenableFuture<Void> remove(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn);
/** /**
* @see AdminCatalogApi#delete(URI) * @see AdminCatalogApi#remove(URI)
*/ */
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> delete(@EndpointParam URI catalogAdminHref); ListenableFuture<Void> remove(@EndpointParam URI catalogAdminHref);
/** /**
* @see AdminCatalogApi#getOwner(String) * @see AdminCatalogApi#getOwner(String)
@ -202,25 +202,25 @@ public interface AdminCatalogAsyncApi extends CatalogAsyncApi {
@BinderParam(BindToXMLPayload.class) PublishCatalogParams params); @BinderParam(BindToXMLPayload.class) PublishCatalogParams params);
/** /**
* @see AdminCatalogApi#modifyAccessControl(String, ControlAccessParams) * @see AdminCatalogApi#editAccessControl(String, ControlAccessParams)
*/ */
@POST @POST
@Path("/action/controlAccess") @Path("/action/controlAccess")
@Produces(CONTROL_ACCESS) @Produces(CONTROL_ACCESS)
@Consumes(CONTROL_ACCESS) @Consumes(CONTROL_ACCESS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<ControlAccessParams> modifyAccessControl(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn, ListenableFuture<ControlAccessParams> editAccessControl(@EndpointParam(parser = CatalogURNToAdminHref.class) String catalogUrn,
@BinderParam(BindToXMLPayload.class) ControlAccessParams params); @BinderParam(BindToXMLPayload.class) ControlAccessParams params);
/** /**
* @see AdminCatalogApi#modifyAccessControl(URI, ControlAccessParams) * @see AdminCatalogApi#editAccessControl(URI, ControlAccessParams)
*/ */
@POST @POST
@Path("/action/controlAccess") @Path("/action/controlAccess")
@Produces(CONTROL_ACCESS) @Produces(CONTROL_ACCESS)
@Consumes(CONTROL_ACCESS) @Consumes(CONTROL_ACCESS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<ControlAccessParams> modifyAccessControl(@EndpointParam URI catalogAdminHref, ListenableFuture<ControlAccessParams> editAccessControl(@EndpointParam URI catalogAdminHref,
@BinderParam(BindToXMLPayload.class) ControlAccessParams params); @BinderParam(BindToXMLPayload.class) ControlAccessParams params);
/** /**

View File

@ -66,13 +66,13 @@ public interface AdminNetworkApi extends NetworkApi {
* @param networkUrn * @param networkUrn
* the reference for the network * the reference for the network
* @param network * @param network
* the updated network * the edited network
* @return a task. This operation is asynchronous and the user should monitor the returned task * @return a task. This operation is asynchronous and the user should monitor the returned task
* status in order to check when it is completed. * status in order to check when it is completed.
*/ */
Task update(String networkUrn, OrgNetwork network); Task edit(String networkUrn, OrgNetwork network);
Task update(URI networkAdminHref, OrgNetwork network); Task edit(URI networkAdminHref, OrgNetwork network);
/** /**
* Reset(undeploy & redeploy) networking services on a logical network. The reset operation can * Reset(undeploy & redeploy) networking services on a logical network. The reset operation can

View File

@ -74,23 +74,23 @@ public interface AdminNetworkAsyncApi extends NetworkAsyncApi {
ListenableFuture<? extends Network> get(@EndpointParam URI networkAdminHref); ListenableFuture<? extends Network> get(@EndpointParam URI networkAdminHref);
/** /**
* @see AdminNetworkApi#update(String, OrgNetwork) * @see AdminNetworkApi#edit(String, OrgNetwork)
*/ */
@PUT @PUT
@Consumes(VCloudDirectorMediaType.TASK) @Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK) @Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> update(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn, ListenableFuture<Task> edit(@EndpointParam(parser = NetworkURNToAdminHref.class) String networkUrn,
@BinderParam(BindToXMLPayload.class) OrgNetwork network); @BinderParam(BindToXMLPayload.class) OrgNetwork network);
/** /**
* @see AdminNetworkApi#update(URI, OrgNetwork) * @see AdminNetworkApi#edit(URI, OrgNetwork)
*/ */
@PUT @PUT
@Consumes(VCloudDirectorMediaType.TASK) @Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK) @Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> update(@EndpointParam URI networkAdminHref, ListenableFuture<Task> edit(@EndpointParam URI networkAdminHref,
@BinderParam(BindToXMLPayload.class) OrgNetwork network); @BinderParam(BindToXMLPayload.class) OrgNetwork network);
/** /**

View File

@ -87,12 +87,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn * @param orgUrn
* the reference for the admin org * the reference for the admin org
* @param newSettings * @param newSettings
* the requested updated settings * the requested edited settings
* @return the resultant settings * @return the resultant settings
*/ */
OrgSettings updateSettings(String orgUrn, OrgSettings newSettings); OrgSettings editSettings(String orgUrn, OrgSettings newSettings);
OrgSettings updateSettings(URI orgAdminHref, OrgSettings newSettings); OrgSettings editSettings(URI orgAdminHref, OrgSettings newSettings);
/** /**
* Retrieves email settings for an organization. * Retrieves email settings for an organization.
@ -119,12 +119,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn * @param orgUrn
* the reference for the admin org * the reference for the admin org
* @param newSettings * @param newSettings
* the requested updated settings * the requested edited settings
* @return the resultant settings * @return the resultant settings
*/ */
OrgEmailSettings updateEmailSettings(String orgUrn, OrgEmailSettings newSettings); OrgEmailSettings editEmailSettings(String orgUrn, OrgEmailSettings newSettings);
OrgEmailSettings updateEmailSettings(URI orgAdminHref, OrgEmailSettings newSettings); OrgEmailSettings editEmailSettings(URI orgAdminHref, OrgEmailSettings newSettings);
/** /**
* Gets general organization settings. * Gets general organization settings.
@ -151,12 +151,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn * @param orgUrn
* the reference for the admin org * the reference for the admin org
* @param newSettings * @param newSettings
* the requested updated settings * the requested edited settings
* @return the resultant settings * @return the resultant settings
*/ */
OrgGeneralSettings updateGeneralSettings(String orgUrn, OrgGeneralSettings newSettings); OrgGeneralSettings editGeneralSettings(String orgUrn, OrgGeneralSettings newSettings);
OrgGeneralSettings updateGeneralSettings(URI orgAdminHref, OrgGeneralSettings newSettings); OrgGeneralSettings editGeneralSettings(URI orgAdminHref, OrgGeneralSettings newSettings);
/** /**
* Retrieves LDAP settings for an organization. * Retrieves LDAP settings for an organization.
@ -198,12 +198,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn * @param orgUrn
* the reference for the admin org * the reference for the admin org
* @param newSettings * @param newSettings
* the requested updated settings * the requested edited settings
* @return the resultant settings * @return the resultant settings
*/ */
OrgPasswordPolicySettings updatePasswordPolicy(String orgUrn, OrgPasswordPolicySettings newSettings); OrgPasswordPolicySettings editPasswordPolicy(String orgUrn, OrgPasswordPolicySettings newSettings);
OrgPasswordPolicySettings updatePasswordPolicy(URI orgAdminHref, OrgPasswordPolicySettings newSettings); OrgPasswordPolicySettings editPasswordPolicy(URI orgAdminHref, OrgPasswordPolicySettings newSettings);
/** /**
* Gets organization resource cleanup settings on the level of vApp. * Gets organization resource cleanup settings on the level of vApp.
@ -230,12 +230,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn * @param orgUrn
* the reference for the admin org * the reference for the admin org
* @param newSettings * @param newSettings
* the requested updated settings * the requested edited settings
* @return the resultant settings * @return the resultant settings
*/ */
OrgLeaseSettings updateVAppLeaseSettings(String orgUrn, OrgLeaseSettings newSettings); OrgLeaseSettings editVAppLeaseSettings(String orgUrn, OrgLeaseSettings newSettings);
OrgLeaseSettings updateVAppLeaseSettings(URI orgAdminHref, OrgLeaseSettings newSettings); OrgLeaseSettings editVAppLeaseSettings(URI orgAdminHref, OrgLeaseSettings newSettings);
/** /**
* Retrieves expiration and storage policy for vApp templates in an organization. * Retrieves expiration and storage policy for vApp templates in an organization.
@ -262,12 +262,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn * @param orgUrn
* the reference for the admin org * the reference for the admin org
* @param newSettings * @param newSettings
* the requested updated settings * the requested edited settings
* @return the resultant settings * @return the resultant settings
*/ */
OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings(String orgUrn, OrgVAppTemplateLeaseSettings newSettings); OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(String orgUrn, OrgVAppTemplateLeaseSettings newSettings);
OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings(URI orgAdminHref, OrgVAppTemplateLeaseSettings newSettings); OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(URI orgAdminHref, OrgVAppTemplateLeaseSettings newSettings);
/** /**
* @return synchronous access to admin {@link MetadataApi.Writeable} features * @return synchronous access to admin {@link MetadataApi.Writeable} features

View File

@ -98,25 +98,25 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgSettings> getSettings(@EndpointParam URI adminOrgHref); ListenableFuture<OrgSettings> getSettings(@EndpointParam URI adminOrgHref);
/** /**
* @see AdminOrgApi#updateSettings(String, OrgSettings) * @see AdminOrgApi#editSettings(String, OrgSettings)
*/ */
@PUT @PUT
@Path("/settings") @Path("/settings")
@Consumes(VCloudDirectorMediaType.ORG_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgSettings> updateSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, ListenableFuture<OrgSettings> editSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgSettings settings); @BinderParam(BindToXMLPayload.class) OrgSettings settings);
/** /**
* @see AdminOrgApi#updateSettings(URI, OrgSettings) * @see AdminOrgApi#editSettings(URI, OrgSettings)
*/ */
@PUT @PUT
@Path("/settings") @Path("/settings")
@Consumes(VCloudDirectorMediaType.ORG_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgSettings> updateSettings(@EndpointParam URI adminOrgHref, ListenableFuture<OrgSettings> editSettings(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgSettings settings); @BinderParam(BindToXMLPayload.class) OrgSettings settings);
/** /**
@ -140,26 +140,26 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgEmailSettings> getEmailSettings(@EndpointParam URI adminOrgHref); ListenableFuture<OrgEmailSettings> getEmailSettings(@EndpointParam URI adminOrgHref);
/** /**
* @see AdminOrgApi#updateEmailSettings(String, OrgEmailSettings) * @see AdminOrgApi#editEmailSettings(String, OrgEmailSettings)
*/ */
@PUT @PUT
@Path("/settings/email") @Path("/settings/email")
@Consumes(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgEmailSettings> updateEmailSettings( ListenableFuture<OrgEmailSettings> editEmailSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgEmailSettings settings); @BinderParam(BindToXMLPayload.class) OrgEmailSettings settings);
/** /**
* @see AdminOrgApi#updateEmailSettings(URI, OrgEmailSettings) * @see AdminOrgApi#editEmailSettings(URI, OrgEmailSettings)
*/ */
@PUT @PUT
@Path("/settings/email") @Path("/settings/email")
@Consumes(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgEmailSettings> updateEmailSettings(@EndpointParam URI adminOrgHref, ListenableFuture<OrgEmailSettings> editEmailSettings(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgEmailSettings settings); @BinderParam(BindToXMLPayload.class) OrgEmailSettings settings);
/** /**
@ -184,26 +184,26 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgGeneralSettings> getGeneralSettings(@EndpointParam URI adminOrgHref); ListenableFuture<OrgGeneralSettings> getGeneralSettings(@EndpointParam URI adminOrgHref);
/** /**
* @see AdminOrgApi#updateGeneralSettings(String, OrgGeneralSettings) * @see AdminOrgApi#editGeneralSettings(String, OrgGeneralSettings)
*/ */
@PUT @PUT
@Path("/settings/general") @Path("/settings/general")
@Consumes(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgGeneralSettings> updateGeneralSettings( ListenableFuture<OrgGeneralSettings> editGeneralSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings); @BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings);
/** /**
* @see AdminOrgApi#updateGeneralSettings(URI, OrgGeneralSettings) * @see AdminOrgApi#editGeneralSettings(URI, OrgGeneralSettings)
*/ */
@PUT @PUT
@Path("/settings/general") @Path("/settings/general")
@Consumes(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgGeneralSettings> updateGeneralSettings(@EndpointParam URI adminOrgHref, ListenableFuture<OrgGeneralSettings> editGeneralSettings(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings); @BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings);
/** /**
@ -248,26 +248,26 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy(@EndpointParam URI adminOrgHref); ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy(@EndpointParam URI adminOrgHref);
/** /**
* @see AdminOrgApi#updatePasswordPolicy(String, OrgPasswordPolicySettings) * @see AdminOrgApi#editPasswordPolicy(String, OrgPasswordPolicySettings)
*/ */
@PUT @PUT
@Path("/settings/passwordPolicy") @Path("/settings/passwordPolicy")
@Consumes(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgPasswordPolicySettings> updatePasswordPolicy( ListenableFuture<OrgPasswordPolicySettings> editPasswordPolicy(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings); @BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings);
/** /**
* @see AdminOrgApi#updatePasswordPolicy(URI, OrgPasswordPolicySettings) * @see AdminOrgApi#editPasswordPolicy(URI, OrgPasswordPolicySettings)
*/ */
@PUT @PUT
@Path("/settings/passwordPolicy") @Path("/settings/passwordPolicy")
@Consumes(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgPasswordPolicySettings> updatePasswordPolicy(@EndpointParam URI adminOrgHref, ListenableFuture<OrgPasswordPolicySettings> editPasswordPolicy(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings); @BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings);
/** /**
@ -292,26 +292,26 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings(@EndpointParam URI adminOrgHref); ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings(@EndpointParam URI adminOrgHref);
/** /**
* @see AdminOrgApi#updateVAppLeaseSettings(String, OrgVAppLeaseSettings) * @see AdminOrgApi#editVAppLeaseSettings(String, OrgVAppLeaseSettings)
*/ */
@PUT @PUT
@Path("/settings/vAppLeaseSettings") @Path("/settings/vAppLeaseSettings")
@Consumes(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgLeaseSettings> updateVAppLeaseSettings( ListenableFuture<OrgLeaseSettings> editVAppLeaseSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings); @BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings);
/** /**
* @see AdminOrgApi#updateVAppLeaseSettings(URI, OrgVAppLeaseSettings) * @see AdminOrgApi#editVAppLeaseSettings(URI, OrgVAppLeaseSettings)
*/ */
@PUT @PUT
@Path("/settings/vAppLeaseSettings") @Path("/settings/vAppLeaseSettings")
@Consumes(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgLeaseSettings> updateVAppLeaseSettings(@EndpointParam URI adminOrgHref, ListenableFuture<OrgLeaseSettings> editVAppLeaseSettings(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings); @BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings);
/** /**
@ -336,26 +336,26 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref); ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref);
/** /**
* @see AdminOrgApi#updateVAppTemplateLeaseSettings(String, OrgVAppTemplateLeaseSettings) * @see AdminOrgApi#editVAppTemplateLeaseSettings(String, OrgVAppTemplateLeaseSettings)
*/ */
@PUT @PUT
@Path("/settings/vAppTemplateLeaseSettings") @Path("/settings/vAppTemplateLeaseSettings")
@Consumes(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgVAppTemplateLeaseSettings> updateVAppTemplateLeaseSettings( ListenableFuture<OrgVAppTemplateLeaseSettings> editVAppTemplateLeaseSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn, @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings); @BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings);
/** /**
* @see AdminOrgApi#updateVAppTemplateLeaseSettings(URI, OrgVAppTemplateLeaseSettings) * @see AdminOrgApi#editVAppTemplateLeaseSettings(URI, OrgVAppTemplateLeaseSettings)
*/ */
@PUT @PUT
@Path("/settings/vAppTemplateLeaseSettings") @Path("/settings/vAppTemplateLeaseSettings")
@Consumes(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) @Consumes(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) @Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<OrgVAppTemplateLeaseSettings> updateVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref, ListenableFuture<OrgVAppTemplateLeaseSettings> editVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings); @BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings);
/** /**

View File

@ -42,8 +42,8 @@ public interface AdminVdcApi extends VdcApi {
* Retrieves an admin view of virtual data center. The redwood admin can disable an * Retrieves an admin view of virtual data center. The redwood admin can disable an
* organization vDC. This will prevent any further allocation to be used by the organization. * organization vDC. This will prevent any further allocation to be used by the organization.
* Changing the state will not affect allocations already used. For example, if an organization * Changing the state will not affect allocations already used. For example, if an organization
* vDC is disabled, an organization user cannot deploy or create a new virtual machine in the * vDC is disabled, an organization user cannot deploy or add a new virtual machine in the
* vDC (deploy uses memory and cpu allocations, and create uses storage allocation). * vDC (deploy uses memory and cpu allocations, and add uses storage allocation).
* *
* @return the admin vDC or null if not found * @return the admin vDC or null if not found
*/ */
@ -58,18 +58,18 @@ public interface AdminVdcApi extends VdcApi {
* Additionally it could have one of these states FAILED_CREATION(-1), NOT_READY(0), * Additionally it could have one of these states FAILED_CREATION(-1), NOT_READY(0),
* READY(1), UNKNOWN(1) and UNRECOGNIZED(3). * READY(1), UNKNOWN(1) and UNRECOGNIZED(3).
*/ */
Task update(String vdcUrn, AdminVdc vdc); Task edit(String vdcUrn, AdminVdc vdc);
Task update(URI vdcHref, AdminVdc vdc); Task edit(URI vdcHref, AdminVdc vdc);
/** /**
* Deletes a Virtual Data Center. The Virtual Data Center should be disabled when delete is issued. * Deletes a Virtual Data Center. The Virtual Data Center should be disabled when remove is issued.
* Otherwise error code 400 Bad Request is returned. * Otherwise error code 400 Bad Request is returned.
*/ */
// TODO Saw what exception, instead of 400 // TODO Saw what exception, instead of 400
Task delete(String vdcUrn); Task remove(String vdcUrn);
Task delete(URI vdcHref); Task remove(URI vdcHref);
/** /**
* Enables a Virtual Data Center. This operation enables disabled Virtual Data Center. * Enables a Virtual Data Center. This operation enables disabled Virtual Data Center.

View File

@ -62,21 +62,21 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
ListenableFuture<AdminVdc> get(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn); ListenableFuture<AdminVdc> get(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
/** /**
* @see AdminVdcApi#update(String, AdminVdc) * @see AdminVdcApi#edit(String, AdminVdc)
*/ */
@PUT @PUT
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.ADMIN_VDC) @Produces(VCloudDirectorMediaType.ADMIN_VDC)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> update(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn, AdminVdc vdc); ListenableFuture<Task> edit(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn, AdminVdc vdc);
/** /**
* @see AdminVdcApi#delete(String) * @see AdminVdcApi#remove(String)
*/ */
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> delete(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn); ListenableFuture<Task> remove(@EndpointParam(parser = VdcURNToAdminHref.class) String vdcUrn);
/** /**
* @see AdminVdcApi#enable(String) * @see AdminVdcApi#enable(String)
@ -107,21 +107,21 @@ public interface AdminVdcAsyncApi extends VdcAsyncApi {
ListenableFuture<AdminVdc> get(@EndpointParam URI vdcHref); ListenableFuture<AdminVdc> get(@EndpointParam URI vdcHref);
/** /**
* @see AdminVdcApi#update(URI, AdminVdc) * @see AdminVdcApi#edit(URI, AdminVdc)
*/ */
@PUT @PUT
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.ADMIN_VDC) @Produces(VCloudDirectorMediaType.ADMIN_VDC)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> update(@EndpointParam URI vdcHref, AdminVdc vdc); ListenableFuture<Task> edit(@EndpointParam URI vdcHref, AdminVdc vdc);
/** /**
* @see AdminVdcApi#delete(URI) * @see AdminVdcApi#remove(URI)
*/ */
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Task> delete(@EndpointParam URI vdcHref); ListenableFuture<Task> remove(@EndpointParam URI vdcHref);
/** /**
* @see AdminVdcApi#enable(URI) * @see AdminVdcApi#enable(URI)

View File

@ -40,10 +40,10 @@ public interface GroupApi {
* POST /admin/org/{id}/groups * POST /admin/org/{id}/groups
* </pre> * </pre>
* *
* @param orgUri the admin org to create the group in * @param orgUri the admin org to add the group in
* @return the created group * @return the addd group
*/ */
Group createGroup(URI adminOrgUri, Group group); Group addGroup(URI adminOrgUri, Group group);
/** /**
* Retrieves a group. * Retrieves a group.
@ -64,9 +64,9 @@ public interface GroupApi {
* PUT /admin/group/{id} * PUT /admin/group/{id}
* </pre> * </pre>
* *
* @return the updated group * @return the edited group
*/ */
Group updateGroup(URI groupRef, Group group); Group editGroup(URI groupRef, Group group);
/** /**
* Deletes a group. * Deletes a group.
@ -75,5 +75,5 @@ public interface GroupApi {
* DELETE /admin/group/{id} * DELETE /admin/group/{id}
* </pre> * </pre>
*/ */
void deleteGroup(URI groupRef); void removeGroup(URI groupRef);
} }

View File

@ -53,7 +53,7 @@ public interface GroupAsyncApi {
@Consumes(VCloudDirectorMediaType.GROUP) @Consumes(VCloudDirectorMediaType.GROUP)
@Produces(VCloudDirectorMediaType.GROUP) @Produces(VCloudDirectorMediaType.GROUP)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Group> createGroup(@EndpointParam URI adminOrgUri, ListenableFuture<Group> addGroup(@EndpointParam URI adminOrgUri,
@BinderParam(BindToXMLPayload.class) Group group); @BinderParam(BindToXMLPayload.class) Group group);
/** /**
@ -66,20 +66,20 @@ public interface GroupAsyncApi {
ListenableFuture<Group> getGroup(@EndpointParam URI groupUri); ListenableFuture<Group> getGroup(@EndpointParam URI groupUri);
/** /**
* @see GroupApi#updateGroup(URI, Group) * @see GroupApi#editGroup(URI, Group)
*/ */
@PUT @PUT
@Consumes(VCloudDirectorMediaType.GROUP) @Consumes(VCloudDirectorMediaType.GROUP)
@Produces(VCloudDirectorMediaType.GROUP) @Produces(VCloudDirectorMediaType.GROUP)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Group> updateGroup(@EndpointParam URI groupRef, ListenableFuture<Group> editGroup(@EndpointParam URI groupRef,
@BinderParam(BindToXMLPayload.class) Group group); @BinderParam(BindToXMLPayload.class) Group group);
/** /**
* @see GroupApi#deleteGroup(URI) * @see GroupApi#removeGroup(URI)
*/ */
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> deleteGroup(@EndpointParam URI groupRef); ListenableFuture<Void> removeGroup(@EndpointParam URI groupRef);
} }

View File

@ -42,11 +42,11 @@ public interface UserApi {
* *
* @param orgUrn * @param orgUrn
* the urn for the org * the urn for the org
* @return the created user * @return the addd user
*/ */
User createUserInOrg(User user, String orgUrn); User addUserToOrg(User user, String orgUrn);
User createUserInOrg(User user, URI orgAdminHref); User addUserToOrg(User user, URI orgAdminHref);
/** /**
* Retrieves a user. This entity could be enabled or disabled. * Retrieves a user. This entity could be enabled or disabled.
@ -75,20 +75,20 @@ public interface UserApi {
* the reference for the user * the reference for the user
* @return the modified user * @return the modified user
*/ */
User update(String userUrn, User user); User edit(String userUrn, User user);
User update(URI userHref, User user); User edit(URI userHref, User user);
/** /**
* Deletes a user. Enabled and disabled users could be deleted. * Deletes a user. Enabled and disabled users could be removed.
* *
* <pre> * <pre>
* DELETE /admin/catalog/{id} * DELETE /admin/catalog/{id}
* </pre> * </pre>
*/ */
void delete(String userUrn); void remove(String userUrn);
void delete(URI userHref); void remove(URI userHref);
/** /**
* Unlocks a user. * Unlocks a user.

View File

@ -51,25 +51,25 @@ import com.google.common.util.concurrent.ListenableFuture;
public interface UserAsyncApi { public interface UserAsyncApi {
/** /**
* @see UserApi#createUserInOrg(User, String) * @see UserApi#addUserToOrg(User, String)
*/ */
@POST @POST
@Path("/users") @Path("/users")
@Consumes(VCloudDirectorMediaType.USER) @Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER) @Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<User> createUserInOrg(@BinderParam(BindToXMLPayload.class) User user, ListenableFuture<User> addUserToOrg(@BinderParam(BindToXMLPayload.class) User user,
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn); @EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
/** /**
* @see UserApi#createUserInOrg(User, URI) * @see UserApi#addUserToOrg(User, URI)
*/ */
@POST @POST
@Path("/users") @Path("/users")
@Consumes(VCloudDirectorMediaType.USER) @Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER) @Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<User> createUserInOrg(@BinderParam(BindToXMLPayload.class) User user, ListenableFuture<User> addUserToOrg(@BinderParam(BindToXMLPayload.class) User user,
@EndpointParam URI orgAdminHref); @EndpointParam URI orgAdminHref);
/** /**
@ -91,39 +91,39 @@ public interface UserAsyncApi {
ListenableFuture<User> get(@EndpointParam URI userHref); ListenableFuture<User> get(@EndpointParam URI userHref);
/** /**
* @see UserApi#update(String, User) * @see UserApi#edit(String, User)
*/ */
@PUT @PUT
@Consumes(VCloudDirectorMediaType.USER) @Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER) @Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<User> update(@EndpointParam(parser = UserURNToHref.class) String userUrn, ListenableFuture<User> edit(@EndpointParam(parser = UserURNToHref.class) String userUrn,
@BinderParam(BindToXMLPayload.class) User user); @BinderParam(BindToXMLPayload.class) User user);
/** /**
* @see UserApi#update(URI, User) * @see UserApi#edit(URI, User)
*/ */
@PUT @PUT
@Consumes(VCloudDirectorMediaType.USER) @Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER) @Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<User> update(@EndpointParam URI userHref, @BinderParam(BindToXMLPayload.class) User user); ListenableFuture<User> edit(@EndpointParam URI userHref, @BinderParam(BindToXMLPayload.class) User user);
/** /**
* @see UserApi#delete(String) * @see UserApi#remove(String)
*/ */
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> delete(@EndpointParam(parser = UserURNToHref.class) String userUrn); ListenableFuture<Void> remove(@EndpointParam(parser = UserURNToHref.class) String userUrn);
/** /**
* @see UserApi#delete(URI) * @see UserApi#remove(URI)
*/ */
@DELETE @DELETE
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
ListenableFuture<Void> delete(@EndpointParam URI userHref); ListenableFuture<Void> remove(@EndpointParam URI userHref);
/** /**
* @see UserApi#unlock(String) * @see UserApi#unlock(String)

View File

@ -189,7 +189,7 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
} }
} }
@AfterClass(alwaysRun = true, description = "Cleans up the environment by deleting created VApps") @AfterClass(alwaysRun = true, description = "Cleans up the environment by deleting addd VApps")
protected void cleanUpEnvironment() { protected void cleanUpEnvironment() {
vdc = vdcApi.get(vdcUrn); // Refresh vdc = vdcApi.get(vdcUrn); // Refresh
@ -197,7 +197,7 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
Iterable<Reference> vApps = Iterables.filter(vdc.getResourceEntities(), Iterable<Reference> vApps = Iterables.filter(vdc.getResourceEntities(),
Predicates.and(ReferencePredicates.<Reference> typeEquals(VCloudDirectorMediaType.VAPP), ReferencePredicates.<Reference> nameIn(vAppNames))); Predicates.and(ReferencePredicates.<Reference> typeEquals(VCloudDirectorMediaType.VAPP), ReferencePredicates.<Reference> nameIn(vAppNames)));
// If we found any references, delete the VApp they point to // If we found any references, remove the VApp they point to
if (!Iterables.isEmpty(vApps)) { if (!Iterables.isEmpty(vApps)) {
for (Reference ref : vApps) { for (Reference ref : vApps) {
cleanUpVApp(ref.getHref()); // NOTE may fail, but should continue deleting cleanUpVApp(ref.getHref()); // NOTE may fail, but should continue deleting
@ -264,13 +264,13 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
* Power on a {@link Vm}. * Power on a {@link Vm}.
*/ */
protected Vm powerOnVm(final URI testVmURI) { protected Vm powerOnVm(final URI testVmURI) {
Vm test = vmApi.getVm(testVmURI); Vm test = vmApi.get(testVmURI);
Status status = test.getStatus(); Status status = test.getStatus();
if (status != Status.POWERED_ON) { if (status != Status.POWERED_ON) {
Task powerOn = vmApi.powerOn(vm.getHref()); Task powerOn = vmApi.powerOn(vm.getHref());
assertTaskSucceedsLong(powerOn); assertTaskSucceedsLong(powerOn);
} }
test = vmApi.getVm(testVmURI); test = vmApi.get(testVmURI);
assertStatus(VM, test, Status.POWERED_ON); assertStatus(VM, test, Status.POWERED_ON);
return test; return test;
} }
@ -294,14 +294,14 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
* Power off a {@link Vm}. * Power off a {@link Vm}.
*/ */
protected Vm powerOffVm(final URI testVmURI) { protected Vm powerOffVm(final URI testVmURI) {
Vm test = vmApi.getVm(testVmURI); Vm test = vmApi.get(testVmURI);
Status status = test.getStatus(); Status status = test.getStatus();
if (status != Status.POWERED_OFF || test.isDeployed()) { if (status != Status.POWERED_OFF || test.isDeployed()) {
UndeployVAppParams undeployParams = UndeployVAppParams.builder().build(); UndeployVAppParams undeployParams = UndeployVAppParams.builder().build();
Task shutdownVapp = vAppApi.undeploy(test.getHref(), undeployParams); Task shutdownVapp = vAppApi.undeploy(test.getHref(), undeployParams);
assertTaskSucceedsLong(shutdownVapp); assertTaskSucceedsLong(shutdownVapp);
} }
test = vmApi.getVm(testVmURI); test = vmApi.get(testVmURI);
assertStatus(VM, test, Status.POWERED_OFF); assertStatus(VM, test, Status.POWERED_OFF);
return test; return test;
} }
@ -325,13 +325,13 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
* Suspend a {@link Vm}. * Suspend a {@link Vm}.
*/ */
protected Vm suspendVm(final URI testVmURI) { protected Vm suspendVm(final URI testVmURI) {
Vm test = vmApi.getVm(testVmURI); Vm test = vmApi.get(testVmURI);
Status status = test.getStatus(); Status status = test.getStatus();
if (status != Status.SUSPENDED) { if (status != Status.SUSPENDED) {
Task suspend = vmApi.suspend(vm.getHref()); Task suspend = vmApi.suspend(vm.getHref());
assertTaskSucceedsLong(suspend); assertTaskSucceedsLong(suspend);
} }
test = vmApi.getVm(testVmURI); test = vmApi.get(testVmURI);
assertStatus(VM, test, Status.SUSPENDED); assertStatus(VM, test, Status.SUSPENDED);
return test; return test;
} }
@ -348,7 +348,7 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
* Check the {@link Vm}s current status. * Check the {@link Vm}s current status.
*/ */
protected void assertVmStatus(final URI testVmURI, final Status status) { protected void assertVmStatus(final URI testVmURI, final Status status) {
Vm testVm = vmApi.getVm(testVmURI); Vm testVm = vmApi.get(testVmURI);
assertStatus(VM, testVm, status); assertStatus(VM, testVm, status);
} }

View File

@ -115,7 +115,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
HttpResponse addResponse = HttpResponse.builder() HttpResponse addResponse = HttpResponse.builder()
.statusCode(200) .statusCode(200)
.payload(payloadFromResourceWithContentType("/catalog/createdCatalogItem.xml", CATALOG_ITEM + ";version=1.5")) .payload(payloadFromResourceWithContentType("/catalog/adddCatalogItem.xml", CATALOG_ITEM + ";version=1.5"))
.build(); .build();
CatalogItem newItem = CatalogItem.builder() CatalogItem newItem = CatalogItem.builder()
@ -127,13 +127,13 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
@Test @Test
public void testAddCatalogItemHref() { public void testAddCatalogItemHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, add, addResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, add, addResponse);
assertEquals(api.getCatalogApi().addItem(catalogHref, newItem), createdCatalogItem()); assertEquals(api.getCatalogApi().addItem(catalogHref, newItem), adddCatalogItem());
} }
@Test @Test
public void testAddCatalogItemUrn() { public void testAddCatalogItemUrn() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, resolveCatalog, resolveCatalogResponse, add, addResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, resolveCatalog, resolveCatalogResponse, add, addResponse);
assertEquals(api.getCatalogApi().addItem(catalogUrn, newItem), createdCatalogItem()); assertEquals(api.getCatalogApi().addItem(catalogUrn, newItem), adddCatalogItem());
} }
HttpRequest getMetadata = HttpRequest.builder() HttpRequest getMetadata = HttpRequest.builder()
@ -233,53 +233,53 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
assertEquals(api.getCatalogApi().getItem(itemUrn), catalogItem()); assertEquals(api.getCatalogApi().getItem(itemUrn), catalogItem());
} }
HttpRequest updateItem = HttpRequest.builder() HttpRequest editItem = HttpRequest.builder()
.method("PUT") .method("PUT")
.endpoint(endpoint + "/catalogItem/" + item) .endpoint(endpoint + "/catalogItem/" + item)
.addHeader("Accept", "application/vnd.vmware.vcloud.catalogItem+xml") .addHeader("Accept", "application/vnd.vmware.vcloud.catalogItem+xml")
.addHeader("x-vcloud-authorization", token) .addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token) .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/catalog/updateCatalogItem.xml", CATALOG_ITEM)) .payload(payloadFromResourceWithContentType("/catalog/editCatalogItem.xml", CATALOG_ITEM))
.build(); .build();
HttpResponse updateItemResponse = HttpResponse.builder() HttpResponse editItemResponse = HttpResponse.builder()
.statusCode(200) .statusCode(200)
.payload(payloadFromResourceWithContentType("/catalog/updateCatalogItem.xml", CATALOG_ITEM + ";version=1.5")) .payload(payloadFromResourceWithContentType("/catalog/editCatalogItem.xml", CATALOG_ITEM + ";version=1.5"))
.build(); .build();
@Test @Test
public void testUpdateCatalogItemHref() { public void testEditCatalogItemHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, updateItem, updateItemResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, editItem, editItemResponse);
assertEquals(api.getCatalogApi().updateItem(itemHref, catalogItem()), catalogItem()); assertEquals(api.getCatalogApi().editItem(itemHref, catalogItem()), catalogItem());
} }
@Test @Test
public void testUpdateCatalogItemUrn() { public void testEditCatalogItemUrn() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, resolveItem, resolveItemResponse, updateItem, updateItemResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, resolveItem, resolveItemResponse, editItem, editItemResponse);
assertEquals(api.getCatalogApi().updateItem(itemUrn, catalogItem()), catalogItem()); assertEquals(api.getCatalogApi().editItem(itemUrn, catalogItem()), catalogItem());
} }
HttpRequest deleteItem = HttpRequest.builder() HttpRequest removeItem = HttpRequest.builder()
.method("DELETE") .method("DELETE")
.endpoint(endpoint + "/catalogItem/" + item) .endpoint(endpoint + "/catalogItem/" + item)
.addHeader("Accept", "*/*") .addHeader("Accept", "*/*")
.addHeader("x-vcloud-authorization", token) .addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token).build(); .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token).build();
HttpResponse deleteItemResponse = HttpResponse.builder() HttpResponse removeItemResponse = HttpResponse.builder()
.statusCode(200) .statusCode(200)
.build(); .build();
@Test @Test
public void testDeleteCatalogItemHref() { public void testRemoveCatalogItemHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, deleteItem, deleteItemResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, removeItem, removeItemResponse);
api.getCatalogApi().deleteItem(itemHref); api.getCatalogApi().removeItem(itemHref);
} }
@Test @Test
public void testDeleteCatalogItemUrn() { public void testRemoveCatalogItemUrn() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, resolveItem, resolveItemResponse, deleteItem, deleteItemResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, resolveItem, resolveItemResponse, removeItem, removeItemResponse);
api.getCatalogApi().deleteItem(itemUrn); api.getCatalogApi().removeItem(itemUrn);
} }
HttpRequest getItemMetadata = HttpRequest.builder() HttpRequest getItemMetadata = HttpRequest.builder()
@ -371,22 +371,22 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
assertEquals(api.getCatalogApi().getItemMetadataApi().putEntry(itemHref, "KEY", MetadataValue.builder().value("KITTENS").build()), setMetadataValueTask()); assertEquals(api.getCatalogApi().getItemMetadataApi().putEntry(itemHref, "KEY", MetadataValue.builder().value("KITTENS").build()), setMetadataValueTask());
} }
HttpRequest deleteItemMetadataEntry = HttpRequest.builder() HttpRequest removeItemMetadataEntry = HttpRequest.builder()
.method("DELETE") .method("DELETE")
.endpoint(endpoint + "/catalogItem/" + item + "/metadata/KEY") .endpoint(endpoint + "/catalogItem/" + item + "/metadata/KEY")
.addHeader("Accept", "application/vnd.vmware.vcloud.task+xml") .addHeader("Accept", "application/vnd.vmware.vcloud.task+xml")
.addHeader("x-vcloud-authorization", token) .addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token).build(); .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token).build();
HttpResponse deleteItemMetadataEntryResponse = HttpResponse.builder() HttpResponse removeItemMetadataEntryResponse = HttpResponse.builder()
.statusCode(200) .statusCode(200)
.payload(payloadFromResourceWithContentType("/catalog/deleteMetadataEntryTask.xml", TASK)) .payload(payloadFromResourceWithContentType("/catalog/removeMetadataEntryTask.xml", TASK))
.build(); .build();
@Test @Test
public void testDeleteCatalogItemMetadataEntryHref() { public void testRemoveCatalogItemMetadataEntryHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, deleteItemMetadataEntry, deleteItemMetadataEntryResponse); VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, removeItemMetadataEntry, removeItemMetadataEntryResponse);
assertEquals(api.getCatalogApi().getItemMetadataApi().deleteEntry(itemHref, "KEY"), deleteEntryTask()); assertEquals(api.getCatalogApi().getItemMetadataApi().removeEntry(itemHref, "KEY"), removeEntryTask());
} }
public static final Catalog catalog() { public static final Catalog catalog() {
@ -425,7 +425,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
.build(); .build();
} }
public static CatalogItem createdCatalogItem() { public static CatalogItem adddCatalogItem() {
return CatalogItem.builder() return CatalogItem.builder()
.name("newCatalogItem") .name("newCatalogItem")
.id("urn:vcloud:catalogitem:" + item) .id("urn:vcloud:catalogitem:" + item)
@ -607,7 +607,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
.build(); .build();
} }
public static Task deleteEntryTask() { public static Task removeEntryTask() {
return Task.builder() return Task.builder()
.name("task") .name("task")
.id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c") .id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c")

View File

@ -88,7 +88,7 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.description("created by CatalogApiLiveTest").build(); .description("created by CatalogApiLiveTest").build();
AdminCatalogApi adminCatalogApi = adminContext.getApi().getCatalogApi(); AdminCatalogApi adminCatalogApi = adminContext.getApi().getCatalogApi();
adminCatalog = adminCatalogApi.createCatalogInOrg(newCatalog, org.getId()); adminCatalog = adminCatalogApi.addCatalogToOrg(newCatalog, org.getId());
catalogUrn = catalogApi.get( catalogUrn = catalogApi.get(
find(adminCatalog.getLinks(), find(adminCatalog.getLinks(),
and(relEquals("alternate"), typeEquals(VCloudDirectorMediaType.CATALOG))).getHref()).getId(); and(relEquals("alternate"), typeEquals(VCloudDirectorMediaType.CATALOG))).getHref()).getId();
@ -107,22 +107,22 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void tearDown() { public void tearDown() {
if (catalogItem != null) { if (catalogItem != null) {
try { try {
catalogApi.deleteItem(catalogItem.getId()); catalogApi.removeItem(catalogItem.getId());
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting catalog item '%s'", catalogItem.getName()); logger.warn(e, "Error when deleting catalog item '%s'", catalogItem.getName());
} }
} }
if (media != null) { if (media != null) {
try { try {
Task delete = context.getApi().getMediaApi().deleteMedia(media.getHref()); Task remove = context.getApi().getMediaApi().removeMedia(media.getHref());
taskDoneEventually(delete); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting media '%s'", media.getName()); logger.warn(e, "Error when deleting media '%s'", media.getName());
} }
} }
if (adminContext != null && adminCatalog != null) { if (adminContext != null && adminCatalog != null) {
try { try {
adminContext.getApi().getCatalogApi().delete(adminCatalog.getId()); adminContext.getApi().getCatalogApi().remove(adminCatalog.getId());
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting catalog '%s'", adminCatalog.getName()); logger.warn(e, "Error when deleting catalog '%s'", adminCatalog.getName());
} }
@ -152,8 +152,8 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
Link addMedia = find(vdc.getLinks(), and(relEquals("add"), typeEquals(VCloudDirectorMediaType.MEDIA))); Link addMedia = find(vdc.getLinks(), and(relEquals("add"), typeEquals(VCloudDirectorMediaType.MEDIA)));
Media sourceMedia = Media.builder().type(VCloudDirectorMediaType.MEDIA).name("Test media 1").size(iso.length) Media sourceMedia = Media.builder().type(VCloudDirectorMediaType.MEDIA).name("Test media 1").size(iso.length)
.imageType(Media.ImageType.ISO).description("Test media generated by testCreateMedia()").build(); .imageType(Media.ImageType.ISO).description("Test media generated by testAddMedia()").build();
media = context.getApi().getMediaApi().createMedia(addMedia.getHref(), sourceMedia); media = context.getApi().getMediaApi().addMedia(addMedia.getHref(), sourceMedia);
Checks.checkMediaFor(VCloudDirectorMediaType.MEDIA, media); Checks.checkMediaFor(VCloudDirectorMediaType.MEDIA, media);
@ -167,17 +167,17 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "PUT /catalogItem/{id}", dependsOnMethods = "testAddCatalogItem") @Test(description = "PUT /catalogItem/{id}", dependsOnMethods = "testAddCatalogItem")
public void testUpdateCatalogItem() { public void testEditCatalogItem() {
CatalogItem updatedCatalogItem = CatalogItem.builder().fromCatalogItem(catalogItem).name("UPDATEDNAME").build(); CatalogItem editedCatalogItem = CatalogItem.builder().fromCatalogItem(catalogItem).name("UPDATEDNAME").build();
catalogItem = catalogApi.updateItem(catalogItem.getId(), updatedCatalogItem); catalogItem = catalogApi.editItem(catalogItem.getId(), editedCatalogItem);
checkCatalogItem(catalogItem); checkCatalogItem(catalogItem);
assertEquals(catalogItem.getName(), "UPDATEDNAME"); assertEquals(catalogItem.getName(), "UPDATEDNAME");
} }
// Note this runs after all the metadata tests // Note this runs after all the metadata tests
@Test(description = "DELETE /catalogItem/{id}", dependsOnMethods = "testDeleteCatalogItemMetadataValue") @Test(description = "DELETE /catalogItem/{id}", dependsOnMethods = "testRemoveCatalogItemMetadataValue")
public void testDeleteCatalogItem() { public void testRemoveCatalogItem() {
catalogApi.deleteItem(catalogItem.getId()); catalogApi.removeItem(catalogItem.getId());
catalogItem = catalogApi.getItem(catalogItem.getId()); catalogItem = catalogApi.getItem(catalogItem.getId());
assertNull(catalogItem); assertNull(catalogItem);
} }
@ -254,20 +254,20 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
assertTrue(retryTaskSuccess.apply(setCatalogItemMetadataValue), assertTrue(retryTaskSuccess.apply(setCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "setCatalogItemMetadataValue")); String.format(TASK_COMPLETE_TIMELY, "setCatalogItemMetadataValue"));
MetadataValue updatedMetadataValue = catalogApi.getItemMetadataApi().getValue(catalogItem.getHref(), "KEY"); MetadataValue editedMetadataValue = catalogApi.getItemMetadataApi().getValue(catalogItem.getHref(), "KEY");
assertEquals(updatedMetadataValue.getValue(), newMetadataValue.getValue(), String.format( assertEquals(editedMetadataValue.getValue(), newMetadataValue.getValue(), String.format(
CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", newMetadataValue.getValue(), CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", newMetadataValue.getValue(),
updatedMetadataValue.getValue())); editedMetadataValue.getValue()));
checkMetadataValue(updatedMetadataValue); checkMetadataValue(editedMetadataValue);
} }
@Test(description = "DELETE /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testGetCatalogItemMetadataValue") @Test(description = "DELETE /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testGetCatalogItemMetadataValue")
public void testDeleteCatalogItemMetadataValue() { public void testRemoveCatalogItemMetadataValue() {
Task deleteCatalogItemMetadataValue = catalogApi.getItemMetadataApi().deleteEntry(catalogItem.getHref(), "KEY"); Task removeCatalogItemMetadataValue = catalogApi.getItemMetadataApi().removeEntry(catalogItem.getHref(), "KEY");
checkTask(deleteCatalogItemMetadataValue); checkTask(removeCatalogItemMetadataValue);
assertTrue(retryTaskSuccess.apply(deleteCatalogItemMetadataValue), assertTrue(retryTaskSuccess.apply(removeCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "deleteCatalogItemMetadataValue")); String.format(TASK_COMPLETE_TIMELY, "removeCatalogItemMetadataValue"));
MetadataValue deleted = catalogApi.getMetadataApi().getValue(catalogItem.getHref(), "KEY"); MetadataValue removed = catalogApi.getMetadataApi().getValue(catalogItem.getHref(), "KEY");
assertNull(deleted); assertNull(removed);
} }
} }

View File

@ -53,17 +53,17 @@ import com.google.common.collect.ImmutableSet;
public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest { public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
@Test @Test
public void testCreateMedia() { public void testAddMedia() {
URI uploadLink = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media"); URI uploadLink = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media");
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media")
.acceptMedia(VCloudDirectorMediaType.MEDIA) .acceptMedia(VCloudDirectorMediaType.MEDIA)
.xmlFilePayload("/media/createMediaSource.xml", VCloudDirectorMediaType.MEDIA) .xmlFilePayload("/media/addMediaSource.xml", VCloudDirectorMediaType.MEDIA)
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/media/createMedia.xml", VCloudDirectorMediaType.MEDIA) .xmlFilePayload("/media/addMedia.xml", VCloudDirectorMediaType.MEDIA)
.httpResponseBuilder().statusCode(201).build()); .httpResponseBuilder().statusCode(201).build());
Media source = Media.builder() Media source = Media.builder()
@ -73,9 +73,9 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.type("application/vnd.vmware.vcloud.media+xml") .type("application/vnd.vmware.vcloud.media+xml")
.description("Test media generated by testCreateMedia()") .description("Test media generated by testCreateMedia()")
.build(); .build();
Media expected = createMedia(); Media expected = addMedia();
assertEquals(api.getMediaApi().createMedia(uploadLink, source), expected); assertEquals(api.getMediaApi().addMedia(uploadLink, source), expected);
} }
@Test @Test
@ -186,27 +186,27 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test @Test
public void testUpdateMedia() { public void testEditMedia() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1") .apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1")
.xmlFilePayload("/media/updateMedia.xml", VCloudDirectorMediaType.MEDIA) .xmlFilePayload("/media/editMedia.xml", VCloudDirectorMediaType.MEDIA)
.acceptMedia(VCloudDirectorMediaType.TASK) .acceptMedia(VCloudDirectorMediaType.TASK)
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/media/updateMediaTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/media/editMediaTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
Media update = updateMedia(); Media edit = editMedia();
Task expected = updateMediaTask(); Task expected = editMediaTask();
assertEquals(api.getMediaApi().updateMedia(mediaUri, update), expected); assertEquals(api.getMediaApi().editMedia(mediaUri, edit), expected);
} }
@Test @Test
public void testDeleteMedia() { public void testRemoveMedia() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
@ -215,12 +215,12 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.acceptMedia(VCloudDirectorMediaType.TASK) .acceptMedia(VCloudDirectorMediaType.TASK)
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/media/deleteMediaTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/media/removeMediaTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
Task expected = deleteMediaTask(); Task expected = removeMediaTask();
assertEquals(api.getMediaApi().deleteMedia(mediaUri), expected); assertEquals(api.getMediaApi().removeMedia(mediaUri), expected);
} }
@Test @Test
@ -302,7 +302,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test @Test
public void testDeleteMetadataValue() { public void testRemoveMetadataValue() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
@ -311,12 +311,12 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.acceptMedia(VCloudDirectorMediaType.TASK) .acceptMedia(VCloudDirectorMediaType.TASK)
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/media/deleteMetadataEntryTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/media/removeMetadataEntryTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
Task expectedTask = deleteEntryTask(); Task expectedTask = removeEntryTask();
assertEquals(api.getMediaApi().getMetadataApi().deleteEntry(mediaUri, "key"), expectedTask); assertEquals(api.getMediaApi().getMetadataApi().removeEntry(mediaUri, "key"), expectedTask);
} }
@Test @Test
@ -343,7 +343,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
assertEquals(api.getMediaApi().getOwner(mediaUri), expected); assertEquals(api.getMediaApi().getOwner(mediaUri), expected);
} }
static Media createMedia() { static Media addMedia() {
return Media.builder() return Media.builder()
.size(0) .size(0)
.imageType(ImageType.ISO) .imageType(ImageType.ISO)
@ -351,6 +351,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.name("Test media 1") .name("Test media 1")
.id("urn:vcloud:media:d51b0b9d-099c-499f-97f8-4fbe40ba06d7") .id("urn:vcloud:media:d51b0b9d-099c-499f-97f8-4fbe40ba06d7")
.type("application/vnd.vmware.vcloud.media+xml") .type("application/vnd.vmware.vcloud.media+xml")
.description("Test media generated by testCreateMedia()")
.href(URI.create("https://mycloud.greenhousedata.com/api/media/d51b0b9d-099c-499f-97f8-4fbe40ba06d7")) .href(URI.create("https://mycloud.greenhousedata.com/api/media/d51b0b9d-099c-499f-97f8-4fbe40ba06d7"))
.link(Link.builder() .link(Link.builder()
.rel("up") .rel("up")
@ -361,7 +362,6 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.rel("remove") .rel("remove")
.href(URI.create("https://mycloud.greenhousedata.com/api/media/d51b0b9d-099c-499f-97f8-4fbe40ba06d7")) .href(URI.create("https://mycloud.greenhousedata.com/api/media/d51b0b9d-099c-499f-97f8-4fbe40ba06d7"))
.build()) .build())
.description("Test media generated by testCreateMedia()")
.files(ImmutableSet.of(File.builder() .files(ImmutableSet.of(File.builder()
.size(0l) .size(0l)
.bytesTransferred(0l) .bytesTransferred(0l)
@ -473,7 +473,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.build(); .build();
} }
private static Media updateMedia() { private static Media editMedia() {
return Media.builder() return Media.builder()
.size(175163392) .size(175163392)
.imageType(ImageType.ISO) .imageType(ImageType.ISO)
@ -523,7 +523,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.build(); .build();
} }
private static Task updateMediaTask() { private static Task editMediaTask() {
return Task.builder() return Task.builder()
.name("task") .name("task")
.id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c") .id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c")
@ -556,7 +556,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.build(); .build();
} }
public static Task deleteMediaTask() { public static Task removeMediaTask() {
return Task.builder() return Task.builder()
.name("task") .name("task")
.id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c") .id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c")
@ -722,7 +722,7 @@ public class MediaApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.build(); .build();
} }
public static Task deleteEntryTask() { public static Task removeEntryTask() {
return Task.builder() return Task.builder()
.name("task") .name("task")
.id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c") .id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c")

View File

@ -109,16 +109,16 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
protected void tidyUp() { protected void tidyUp() {
if (media != null) { if (media != null) {
try { try {
Task delete = mediaApi.deleteMedia(media.getHref()); Task remove = mediaApi.removeMedia(media.getHref());
taskDoneEventually(delete); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting media '%s': %s", media.getName()); logger.warn(e, "Error when deleting media '%s': %s", media.getName());
} }
} }
if (oldMedia != null) { if (oldMedia != null) {
try { try {
Task delete = mediaApi.deleteMedia(oldMedia.getHref()); Task remove = mediaApi.removeMedia(oldMedia.getHref());
taskDoneEventually(delete); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting media '%s': %s", oldMedia.getName()); logger.warn(e, "Error when deleting media '%s': %s", oldMedia.getName());
} }
@ -126,7 +126,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "POST /vdc/{id}/media") @Test(description = "POST /vdc/{id}/media")
public void testCreateMedia() throws URISyntaxException { public void testAddMedia() throws URISyntaxException {
Vdc vdc = lazyGetVdc(); Vdc vdc = lazyGetVdc();
Link addMedia = find(vdc.getLinks(), and(relEquals("add"), typeEquals(VCloudDirectorMediaType.MEDIA))); Link addMedia = find(vdc.getLinks(), and(relEquals("add"), typeEquals(VCloudDirectorMediaType.MEDIA)));
@ -138,9 +138,9 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.name("Test media "+random.nextInt()) .name("Test media "+random.nextInt())
.size(iso.length) .size(iso.length)
.imageType(Media.ImageType.ISO) .imageType(Media.ImageType.ISO)
.description("Test media generated by testCreateMedia()") .description("Test media generated by testAddMedia()")
.build(); .build();
media = mediaApi.createMedia(addMedia.getHref(), sourceMedia); media = mediaApi.addMedia(addMedia.getHref(), sourceMedia);
Checks.checkMediaFor(MEDIA, media); Checks.checkMediaFor(MEDIA, media);
@ -171,7 +171,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
} }
@Test(description = "GET /media/{id}", dependsOnMethods = { "testCreateMedia" }) @Test(description = "GET /media/{id}", dependsOnMethods = { "testAddMedia" })
public void testGetMedia() { public void testGetMedia() {
media = mediaApi.getMedia(media.getHref()); media = mediaApi.getMedia(media.getHref());
assertNotNull(media, String.format(OBJ_REQ_LIVE, MEDIA)); assertNotNull(media, String.format(OBJ_REQ_LIVE, MEDIA));
@ -258,9 +258,9 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
String newDescription = "new "+oldDescription; String newDescription = "new "+oldDescription;
media = media.toBuilder().name(newName).description(newDescription).build(); media = media.toBuilder().name(newName).description(newDescription).build();
Task updateMedia = mediaApi.updateMedia(media.getHref(), media); Task editMedia = mediaApi.editMedia(media.getHref(), media);
Checks.checkTask(updateMedia); Checks.checkTask(editMedia);
assertTrue(retryTaskSuccess.apply(updateMedia), String.format(TASK_COMPLETE_TIMELY, "updateMedia")); assertTrue(retryTaskSuccess.apply(editMedia), String.format(TASK_COMPLETE_TIMELY, "editMedia"));
media = mediaApi.getMedia(media.getHref()); media = mediaApi.getMedia(media.getHref());
assertTrue(equal(media.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, MEDIA, "name")); assertTrue(equal(media.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, MEDIA, "name"));
@ -273,9 +273,9 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
media = media.toBuilder().name(oldName).description(oldDescription).build(); media = media.toBuilder().name(oldName).description(oldDescription).build();
updateMedia = mediaApi.updateMedia(media.getHref(), media); editMedia = mediaApi.editMedia(media.getHref(), media);
Checks.checkTask(updateMedia); Checks.checkTask(editMedia);
assertTrue(retryTaskSuccess.apply(updateMedia), String.format(TASK_COMPLETE_TIMELY, "updateMedia")); assertTrue(retryTaskSuccess.apply(editMedia), String.format(TASK_COMPLETE_TIMELY, "editMedia"));
media = mediaApi.getMedia(media.getHref()); media = mediaApi.getMedia(media.getHref());
} }
@ -307,7 +307,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
media = mediaApi.getMedia(media.getHref()); media = mediaApi.getMedia(media.getHref());
Checks.checkMediaFor(MEDIA, media); Checks.checkMediaFor(MEDIA, media);
// test modify // test edit
inputEntries = ImmutableSet.of(MetadataEntry.builder().entry("testKey", "new testValue").build()); inputEntries = ImmutableSet.of(MetadataEntry.builder().entry("testKey", "new testValue").build());
inputMetadata = Metadata.builder() inputMetadata = Metadata.builder()
.entries(inputEntries) .entries(inputEntries)
@ -315,7 +315,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
mergeMetadata = mediaApi.getMetadataApi().merge(media.getHref(), inputMetadata); mergeMetadata = mediaApi.getMetadataApi().merge(media.getHref(), inputMetadata);
Checks.checkTask(mergeMetadata); Checks.checkTask(mergeMetadata);
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(modify)")); assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(edit)"));
metadata = mediaApi.getMetadataApi().get(media.getHref()); metadata = mediaApi.getMetadataApi().get(media.getHref());
Checks.checkMetadataFor(MEDIA, metadata); Checks.checkMetadataFor(MEDIA, metadata);
checkMetadataContainsEntries(metadata, inputEntries); checkMetadataContainsEntries(metadata, inputEntries);
@ -361,11 +361,11 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "DELETE /media/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata", "testGetMetadataValue" } ) @Test(description = "DELETE /media/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata", "testGetMetadataValue" } )
public void testDeleteMetadata() { public void testRemoveMetadata() {
Task deleteEntry = mediaApi.getMetadataApi().deleteEntry(media.getHref(), "testKey"); Task removeEntry = mediaApi.getMetadataApi().removeEntry(media.getHref(), "testKey");
Checks.checkTask(deleteEntry); Checks.checkTask(removeEntry);
assertTrue(retryTaskSuccess.apply(deleteEntry), assertTrue(retryTaskSuccess.apply(removeEntry),
String.format(TASK_COMPLETE_TIMELY, "deleteEntry")); String.format(TASK_COMPLETE_TIMELY, "removeEntry"));
metadataValue = mediaApi.getMetadataApi().getValue(media.getHref(), "testKey"); metadataValue = mediaApi.getMetadataApi().getValue(media.getHref(), "testKey");
assertNull(metadataValue, String.format(OBJ_FIELD_ATTRB_DEL, MEDIA, assertNull(metadataValue, String.format(OBJ_FIELD_ATTRB_DEL, MEDIA,
@ -379,19 +379,19 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
Checks.checkMediaFor(MEDIA, media); Checks.checkMediaFor(MEDIA, media);
} }
@Test(description = "DELETE /media/{id}", dependsOnMethods = { "testDeleteMetadata" } ) @Test(description = "DELETE /media/{id}", dependsOnMethods = { "testRemoveMetadata" } )
public void testDeleteMedia() { public void testRemoveMedia() {
Task deleteMedia = mediaApi.deleteMedia(media.getHref()); Task removeMedia = mediaApi.removeMedia(media.getHref());
Checks.checkTask(deleteMedia); Checks.checkTask(removeMedia);
assertTrue(retryTaskSuccess.apply(deleteMedia), assertTrue(retryTaskSuccess.apply(removeMedia),
String.format(TASK_COMPLETE_TIMELY, "deleteMedia")); String.format(TASK_COMPLETE_TIMELY, "removeMedia"));
media = mediaApi.getMedia(media.getHref()); media = mediaApi.getMedia(media.getHref());
assertNull(media, String.format(OBJ_DEL, MEDIA, media != null ? media.toString() : "")); assertNull(media, String.format(OBJ_DEL, MEDIA, media != null ? media.toString() : ""));
deleteMedia = mediaApi.deleteMedia(oldMedia.getHref()); removeMedia = mediaApi.removeMedia(oldMedia.getHref());
Checks.checkTask(deleteMedia); Checks.checkTask(removeMedia);
assertTrue(retryTaskSuccess.apply(deleteMedia), String.format(TASK_COMPLETE_TIMELY, "deleteMedia")); assertTrue(retryTaskSuccess.apply(removeMedia), String.format(TASK_COMPLETE_TIMELY, "removeMedia"));
oldMedia = null; oldMedia = null;
} }
} }

View File

@ -73,8 +73,8 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void cleanUp() { public void cleanUp() {
if (metadataSet) { if (metadataSet) {
try { try {
Task delete = adminContext.getApi().getNetworkApi().getMetadataApi().deleteEntry(network.getHref(), "key"); Task remove = adminContext.getApi().getNetworkApi().getMetadataApi().removeEntry(network.getHref(), "key");
taskDoneEventually(delete); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting metadata"); logger.warn(e, "Error when deleting metadata");
} }

View File

@ -70,13 +70,13 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void cleanUp() throws Exception { public void cleanUp() throws Exception {
if (adminMembersSet) { if (adminMembersSet) {
try { try {
Task delete = adminContext.getApi().getOrgApi().getMetadataApi().deleteEntry(toAdminUri(orgURI), "KEY"); Task remove = adminContext.getApi().getOrgApi().getMetadataApi().removeEntry(toAdminUri(orgURI), "KEY");
taskDoneEventually(delete); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting metadata entry"); logger.warn(e, "Error when deleting metadata entry");
} }
try { try {
adminContext.getApi().getCatalogApi().delete(catalogUrn); adminContext.getApi().getCatalogApi().remove(catalogUrn);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting catalog'%s': %s", catalogUrn); logger.warn(e, "Error when deleting catalog'%s': %s", catalogUrn);
} }
@ -90,7 +90,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
private OrgList orgList; private OrgList orgList;
private URI orgURI; private URI orgURI;
private Org org; private Org org;
private boolean adminMembersSet = false; // track if test entities have been created private boolean adminMembersSet = false; // track if test entities have been addd
@Test(description = "GET /org") @Test(description = "GET /org")
public void testGetOrgList() { public void testGetOrgList() {
@ -138,7 +138,7 @@ public class OrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
AdminCatalog newCatalog = AdminCatalog.builder().name("Test Catalog " + getTestDateTimeStamp()) AdminCatalog newCatalog = AdminCatalog.builder().name("Test Catalog " + getTestDateTimeStamp())
.description("created by testOrg()").build(); .description("created by testOrg()").build();
newCatalog = adminContext.getApi().getCatalogApi().createCatalogInOrg(newCatalog, org.getId()); newCatalog = adminContext.getApi().getCatalogApi().addCatalogToOrg(newCatalog, org.getId());
catalogUrn = newCatalog.getId(); catalogUrn = newCatalog.getId();

View File

@ -86,11 +86,11 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyVApp() { public void testEditVApp() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId) .apiCommand("PUT", vAppId)
.xmlFilePayload("/vApp/modifyVApp.xml", VCloudDirectorMediaType.VAPP) .xmlFilePayload("/vApp/editVApp.xml", VCloudDirectorMediaType.VAPP)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
@ -101,25 +101,25 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
modified.setName("new-name"); modified.setName("new-name");
modified.setDescription("New Description"); modified.setDescription("New Description");
Task expected = modifyVAppTask(); Task expected = editVAppTask();
assertEquals(api.getVAppApi().modifyVApp(vAppURI, modified), expected); assertEquals(api.getVAppApi().editVApp(vAppURI, modified), expected);
} }
@Test(enabled = false) @Test(enabled = false)
public void testDeleteVApp() { public void testRemoveVApp() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("DELETE", vAppId) .apiCommand("DELETE", vAppId)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/deleteVAppTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/removeVAppTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
Task expected = deleteVAppTask(); Task expected = removeVAppTask();
assertEquals(api.getVAppApi().deleteVApp(vAppURI), expected); assertEquals(api.getVAppApi().removeVApp(vAppURI), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -138,7 +138,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
ControlAccessParams expected = controlAccessParams(); ControlAccessParams expected = controlAccessParams();
assertEquals(api.getVAppApi().modifyControlAccess(vAppURI, params), expected); assertEquals(api.getVAppApi().editControlAccess(vAppURI, params), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -374,23 +374,23 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyLeaseSettingsSection() { public void testEditLeaseSettingsSection() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/leaseSettingsSection") .apiCommand("PUT", vAppId + "/leaseSettingsSection")
.xmlFilePayload("/vApp/modifyLeaseSettingsSection.xml", VCloudDirectorMediaType.LEASE_SETTINGS_SECTION) .xmlFilePayload("/vApp/editLeaseSettingsSection.xml", VCloudDirectorMediaType.LEASE_SETTINGS_SECTION)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyLeaseSettingsSectionTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editLeaseSettingsSectionTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
LeaseSettingsSection section = getLeaseSettingsSection().toBuilder() LeaseSettingsSection section = getLeaseSettingsSection().toBuilder()
.build(); .build();
Task expected = modifyLeaseSettingsSectionTask(); Task expected = editLeaseSettingsSectionTask();
assertEquals(api.getVAppApi().modifyLeaseSettingsSection(vAppURI, section), expected); assertEquals(api.getVAppApi().editLeaseSettingsSection(vAppURI, section), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -410,23 +410,23 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyNetworkConfigSection() { public void testEditNetworkConfigSection() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/networkConfigSection") .apiCommand("PUT", vAppId + "/networkConfigSection")
.xmlFilePayload("/vApp/modifyNetworkConfigSection.xml", VCloudDirectorMediaType.NETWORK_CONFIG_SECTION) .xmlFilePayload("/vApp/editNetworkConfigSection.xml", VCloudDirectorMediaType.NETWORK_CONFIG_SECTION)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyNetworkConfigSectionTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editNetworkConfigSectionTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
NetworkConfigSection section = getNetworkConfigSection().toBuilder() NetworkConfigSection section = getNetworkConfigSection().toBuilder()
.build(); .build();
Task expected = modifyNetworkConfigSectionTask(); Task expected = editNetworkConfigSectionTask();
assertEquals(api.getVAppApi().modifyNetworkConfigSection(vAppURI, section), expected); assertEquals(api.getVAppApi().editNetworkConfigSection(vAppURI, section), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -462,11 +462,11 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyOwner() { public void testEditOwner() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/owner") .apiCommand("PUT", vAppId + "/owner")
.xmlFilePayload("/vApp/modifyOwner.xml", VCloudDirectorMediaType.OWNER) .xmlFilePayload("/vApp/editOwner.xml", VCloudDirectorMediaType.OWNER)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
@ -475,7 +475,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
Owner owner = Owner.builder() Owner owner = Owner.builder()
.build(); .build();
api.getVAppApi().modifyOwner(vAppURI, owner); api.getVAppApi().editOwner(vAppURI, owner);
} }
@Test(enabled = false) @Test(enabled = false)
@ -495,20 +495,20 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyProductSections() { public void testEditProductSections() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/productSections") .apiCommand("PUT", vAppId + "/productSections")
.xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST) .xmlFilePayload("/vApp/editProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.VAPP) .xmlFilePayload("/vApp/editProductSections.xml", VCloudDirectorMediaType.VAPP)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
Task expected = modifyProductSectionsTask(); Task expected = editProductSectionsTask();
assertEquals(api.getVAppApi().modifyProductSections(vAppURI, null), expected); assertEquals(api.getVAppApi().editProductSections(vAppURI, null), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -528,23 +528,23 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyStartupSection() { public void testEditStartupSection() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/startupSection") .apiCommand("PUT", vAppId + "/startupSection")
.xmlFilePayload("/vApp/modifyStartupSection.xml", VCloudDirectorMediaType.STARTUP_SECTION) .xmlFilePayload("/vApp/editStartupSection.xml", VCloudDirectorMediaType.STARTUP_SECTION)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyStartupSectionTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editStartupSectionTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
StartupSection section = null; // getStartupSection().toBuilder() StartupSection section = null; // getStartupSection().toBuilder()
// .build(); // .build();
Task expected = modifyStartupSectionTask(); Task expected = editStartupSectionTask();
assertEquals(api.getVAppApi().modifyStartupSection(vAppURI, section), expected); assertEquals(api.getVAppApi().editStartupSection(vAppURI, section), expected);
} }
public static VApp getVApp() { public static VApp getVApp() {
@ -571,14 +571,14 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return vApp; return vApp;
} }
public static Task modifyVAppTask() { public static Task editVAppTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
return task; return task;
} }
public static Task deleteVAppTask() { public static Task removeVAppTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -704,7 +704,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyGuestCustomizationSectionTask() { public static Task editGuestCustomizationSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -718,7 +718,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyLeaseSettingsSectionTask() { public static Task editLeaseSettingsSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -746,7 +746,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyNetworkConfigSectionTask() { public static Task editNetworkConfigSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -760,7 +760,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyNetworkConnectionSectionTask() { public static Task editNetworkConnectionSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -781,7 +781,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyOperatingSystemSectionTask() { public static Task editOperatingSystemSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -795,7 +795,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return owner; return owner;
} }
public static Task modifyOwnerTask() { public static Task editOwnerTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -809,7 +809,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return sectionItems; return sectionItems;
} }
public static Task modifyProductSectionsTask() { public static Task editProductSectionsTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -857,7 +857,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyStartupSectionTask() { public static Task editStartupSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -871,7 +871,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyVirtualHardwareSectionTask() { public static Task editVirtualHardwareSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -885,7 +885,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return cpu; return cpu;
} }
public static Task modifyVirtualHardwareSectionCpuTask() { public static Task editVirtualHardwareSectionCpuTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -899,7 +899,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return disks; return disks;
} }
public static Task modifyVirtualHardwareSectionDisksTask() { public static Task editVirtualHardwareSectionDisksTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -920,7 +920,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return memory; return memory;
} }
public static Task modifyVirtualHardwareSectionMemoryTask() { public static Task editVirtualHardwareSectionMemoryTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -934,7 +934,7 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return networkCards; return networkCards;
} }
public static Task modifyVirtualHardwareSectionNetworkCardsTask() { public static Task editVirtualHardwareSectionNetworkCardsTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -948,11 +948,11 @@ public class VAppApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return serialPorts; return serialPorts;
} }
public static Task modifyVirtualHardwareSectionSerialPortsTask() { public static Task editVirtualHardwareSectionSerialPortsTask() {
return task("id", "name", "description", "status", "operation", "operationName", "startTime"); return task("id", "name", "description", "status", "operation", "operationName", "startTime");
} }
/** Used by other methods to create a custom {@link Task} object. */ /** Used by other methods to add a custom {@link Task} object. */
private static Task task(String taskId, String name, String description, String status, String operation, String operationName, String startTime) { private static Task task(String taskId, String name, String description, String status, String operation, String operationName, String startTime) {
Task task = Task.builder() Task task = Task.builder()
.error(Error.builder().build()) .error(Error.builder().build())

View File

@ -110,7 +110,7 @@ import com.google.common.collect.Sets;
/** /**
* Tests behavior of the {@link VAppApi}. * Tests behavior of the {@link VAppApi}.
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VAppApiLiveTest") @Test(groups = { "live", "user" }, singleThreaded = true, testName = "VAppApiLiveTest")
@ -121,32 +121,28 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
private boolean mediaCreated = false; private boolean mediaCreated = false;
private boolean testUserCreated = false; private boolean testUserCreated = false;
private User user; private User user;
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
protected void setupRequiredEntities() { protected void setupRequiredEntities() {
Set<Link> links = lazyGetVdc().getLinks(); Set<Link> links = lazyGetVdc().getLinks();
if (mediaURI == null) { if (mediaURI == null) {
Predicate<Link> addMediaLink = and(relEquals(Link.Rel.ADD), typeEquals(VCloudDirectorMediaType.MEDIA)); Predicate<Link> addMediaLink = and(relEquals(Link.Rel.ADD), typeEquals(VCloudDirectorMediaType.MEDIA));
if (contains(links, addMediaLink)) { if (contains(links, addMediaLink)) {
Link addMedia = find(links, addMediaLink); Link addMedia = find(links, addMediaLink);
byte[] iso = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; byte[] iso = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
Media sourceMedia = Media.builder() Media sourceMedia = Media.builder().type(VCloudDirectorMediaType.MEDIA).name(name("media"))
.type(VCloudDirectorMediaType.MEDIA) .size(iso.length).imageType(Media.ImageType.ISO)
.name(name("media")) .description("Test media generated by VAppApiLiveTest").build();
.size(iso.length) Media media = context.getApi().getMediaApi().addMedia(addMedia.getHref(), sourceMedia);
.imageType(Media.ImageType.ISO)
.description("Test media generated by VAppApiLiveTest")
.build();
Media media = context.getApi().getMediaApi().createMedia(addMedia.getHref(), sourceMedia);
Link uploadLink = getFirst(getFirst(media.getFiles(), null).getLinks(), null); Link uploadLink = getFirst(getFirst(media.getFiles(), null).getLinks(), null);
context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso)); context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
media = context.getApi().getMediaApi().getMedia(media.getHref()); media = context.getApi().getMediaApi().getMedia(media.getHref());
if (media.getTasks().size() == 1) { if (media.getTasks().size() == 1) {
Task uploadTask = Iterables.getOnlyElement(media.getTasks()); Task uploadTask = Iterables.getOnlyElement(media.getTasks());
Checks.checkTask(uploadTask); Checks.checkTask(uploadTask);
@ -154,33 +150,32 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
assertTrue(retryTaskSuccess.apply(uploadTask), String.format(TASK_COMPLETE_TIMELY, "uploadTask")); assertTrue(retryTaskSuccess.apply(uploadTask), String.format(TASK_COMPLETE_TIMELY, "uploadTask"));
media = context.getApi().getMediaApi().getMedia(media.getHref()); media = context.getApi().getMediaApi().getMedia(media.getHref());
} }
mediaURI = media.getHref(); mediaURI = media.getHref();
mediaCreated = true; mediaCreated = true;
} }
} }
if (adminContext != null) { if (adminContext != null) {
Link orgLink = find(links, and(relEquals("up"), typeEquals(VCloudDirectorMediaType.ORG))); userUrn = adminContext.getApi().getUserApi().addUserToOrg(randomTestUser("VAppAccessTest"), org.getId())
userUrn = adminContext.getApi().getUserApi() .getId();
.createUserInOrg(randomTestUser("VAppAccessTest"), toAdminUri(orgLink)).getId();
} }
user = lazyGetUser(); user = lazyGetUser();
} }
@AfterClass(alwaysRun = true, dependsOnMethods = { "cleanUpEnvironment" }) @AfterClass(alwaysRun = true, dependsOnMethods = { "cleanUpEnvironment" })
public void cleanUp() { public void cleanUp() {
if (adminContext != null && mediaCreated && mediaURI != null) { if (adminContext != null && mediaCreated && mediaURI != null) {
try { try {
Task delete = context.getApi().getMediaApi().deleteMedia(mediaURI); Task remove = context.getApi().getMediaApi().removeMedia(mediaURI);
taskDoneEventually(delete); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting media"); logger.warn(e, "Error when deleting media");
} }
} }
if (adminContext != null && testUserCreated && userUrn != null) { if (adminContext != null && testUserCreated && userUrn != null) {
try { try {
adminContext.getApi().getUserApi().delete(userUrn); adminContext.getApi().getUserApi().remove(userUrn);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting user"); logger.warn(e, "Error when deleting user");
} }
@ -199,9 +194,12 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
checkVApp(vApp); checkVApp(vApp);
// Check the required fields are set // Check the required fields are set
assertEquals(vApp.isDeployed(), Boolean.FALSE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString())); assertEquals(vApp.isDeployed(), Boolean.FALSE,
assertTrue(vApp.getName().startsWith("test-vapp-"), String.format(MATCHES_STRING_FMT, "name", "test-vapp-*", vApp.getName())); String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString()));
assertEquals(vApp.getDescription(), "Test VApp", String.format(OBJ_FIELD_EQ, VAPP, "Description", "Test VApp", vApp.getDescription())); assertTrue(vApp.getName().startsWith("test-vapp-"),
String.format(MATCHES_STRING_FMT, "name", "test-vapp-*", vApp.getName()));
assertEquals(vApp.getDescription(), "Test VApp",
String.format(OBJ_FIELD_EQ, VAPP, "Description", "Test VApp", vApp.getDescription()));
// TODO instantiationParams instantiationParams() // TODO instantiationParams instantiationParams()
// TODO source.href vAppTemplateURI // TODO source.href vAppTemplateURI
@ -209,38 +207,36 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
// Check status // Check status
assertVAppStatus(vAppURI, Status.POWERED_OFF); assertVAppStatus(vAppURI, Status.POWERED_OFF);
} }
@Test(description = "POST /vApp/{id}/action/recomposeVApp") @Test(description = "POST /vApp/{id}/action/recomposeVApp")
public void testRecomposeVApp() { public void testRecomposeVApp() {
Set<Vm> vms = getAvailableVMsFromVAppTemplates(); Set<Vm> vms = getAvailableVMsFromVAppTemplates();
VApp composedVApp = vdcApi.composeVApp(vdcUrn, ComposeVAppParams.builder() VApp composedVApp = vdcApi.composeVApp(vdcUrn, ComposeVAppParams.builder().name(name("composed-"))
.name(name("composed-")) .instantiationParams(instantiationParams()).build());
.instantiationParams(instantiationParams())
.build());
// get the first vm to be added to vApp // get the first vm to be added to vApp
Vm toAddVm = Iterables.get(vms, 0); Vm toAddVm = Iterables.get(vms, 0);
RecomposeVAppParams params = createRecomposeParams(composedVApp, toAddVm); RecomposeVAppParams params = addRecomposeParams(composedVApp, toAddVm);
// The method under test // The method under test
Task recomposeVApp = vAppApi.recompose(composedVApp.getHref(), params); Task recomposeVApp = vAppApi.recompose(composedVApp.getHref(), params);
assertTaskSucceedsLong(recomposeVApp); assertTaskSucceedsLong(recomposeVApp);
// add another vm instance to vApp // add another vm instance to vApp
params = createRecomposeParams(composedVApp, toAddVm); params = addRecomposeParams(composedVApp, toAddVm);
recomposeVApp = vAppApi.recompose(composedVApp.getHref(), params); recomposeVApp = vAppApi.recompose(composedVApp.getHref(), params);
assertTaskSucceedsLong(recomposeVApp); assertTaskSucceedsLong(recomposeVApp);
// delete a vm // remove a vm
VApp configured = vAppApi.getVApp(composedVApp.getHref()); VApp configured = vAppApi.getVApp(composedVApp.getHref());
List<Vm> vmsToBeDeleted = configured.getChildren().getVms(); List<Vm> vmsToBeDeleted = configured.getChildren().getVms();
Vm toBeDeleted = Iterables.get(vmsToBeDeleted, 0); Vm toBeDeleted = Iterables.get(vmsToBeDeleted, 0);
Task deleteVm = vmApi.deleteVm(toBeDeleted.getHref()); Task removeVm = vmApi.remove(toBeDeleted.getHref());
assertTaskSucceedsLong(deleteVm); assertTaskSucceedsLong(removeVm);
Task deleteVApp = vAppApi.deleteVApp(composedVApp.getHref()); Task removeVApp = vAppApi.removeVApp(composedVApp.getHref());
assertTaskSucceedsLong(deleteVApp); assertTaskSucceedsLong(removeVApp);
} }
private Set<Vm> getAvailableVMsFromVAppTemplates() { private Set<Vm> getAvailableVMsFromVAppTemplates() {
@ -251,57 +247,52 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
vms.addAll(vAppTemplate.getChildren()); vms.addAll(vAppTemplate.getChildren());
} }
return ImmutableSet.copyOf(Iterables.filter(vms, new Predicate<Vm>() { return ImmutableSet.copyOf(Iterables.filter(vms, new Predicate<Vm>() {
// filter out vms in the vApp template with computer name that contains underscores, dots, or both. // filter out vms in the vApp template with computer name that contains underscores, dots,
// or both.
@Override @Override
public boolean apply(Vm input) { public boolean apply(Vm input) {
GuestCustomizationSection guestCustomizationSection = vmApi.getGuestCustomizationSection(input.getHref()); GuestCustomizationSection guestCustomizationSection = vmApi.getGuestCustomizationSection(input.getHref());
String computerName = guestCustomizationSection.getComputerName(); String computerName = guestCustomizationSection.getComputerName();
String retainComputerName = CharMatcher.inRange('0', '9') String retainComputerName = CharMatcher.inRange('0', '9').or(CharMatcher.inRange('a', 'z'))
.or(CharMatcher.inRange('a', 'z')) .or(CharMatcher.inRange('A', 'Z')).or(CharMatcher.is('-')).retainFrom(computerName);
.or(CharMatcher.inRange('A', 'Z'))
.or(CharMatcher.is('-'))
.retainFrom(computerName);
return computerName.equals(retainComputerName); return computerName.equals(retainComputerName);
} }
})); }));
} }
/** /**
* @see VAppApi#modifyVApp(URI, VApp) * @see VAppApi#editVApp(URI, VApp)
*/ */
@Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVApp" }) @Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVApp" })
public void testModifyVApp() { public void testEditVApp() {
VApp newVApp = VApp.builder() VApp newVApp = VApp.builder().name(name("new-name-")).description("New Description").build();
.name(name("new-name-"))
.description("New Description")
.build();
vAppNames.add(newVApp.getName()); vAppNames.add(newVApp.getName());
// The method under test // The method under test
Task modifyVApp = vAppApi.modifyVApp(vApp.getHref(), newVApp); Task editVApp = vAppApi.editVApp(vApp.getHref(), newVApp);
assertTrue(retryTaskSuccess.apply(modifyVApp), String.format(TASK_COMPLETE_TIMELY, "modifyVApp")); assertTrue(retryTaskSuccess.apply(editVApp), String.format(TASK_COMPLETE_TIMELY, "editVApp"));
// Get the updated VApp // Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref()); vApp = vAppApi.getVApp(vApp.getHref());
// Check the required fields are set // Check the required fields are set
assertEquals(vApp.getName(), newVApp.getName(), String.format(OBJ_FIELD_EQ, VAPP, "Name", newVApp.getName(), vApp.getName())); assertEquals(vApp.getName(), newVApp.getName(),
assertEquals(vApp.getDescription(), newVApp.getDescription(), String.format(OBJ_FIELD_EQ, VAPP, "Description", newVApp.getDescription(), vApp.getDescription())); String.format(OBJ_FIELD_EQ, VAPP, "Name", newVApp.getName(), vApp.getName()));
assertEquals(vApp.getDescription(), newVApp.getDescription(),
String.format(OBJ_FIELD_EQ, VAPP, "Description", newVApp.getDescription(), vApp.getDescription()));
} }
@Test(description = "POST /vApp/{id}/action/deploy", dependsOnMethods = { "testGetVApp" }) @Test(description = "POST /vApp/{id}/action/deploy", dependsOnMethods = { "testGetVApp" })
public void testDeployVApp() { public void testDeployVApp() {
DeployVAppParams params = DeployVAppParams.builder() DeployVAppParams params = DeployVAppParams.builder()
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)) .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
.notForceCustomization() .notPowerOn().build();
.notPowerOn()
.build();
// The method under test // The method under test
Task deployVApp = vAppApi.deploy(vApp.getHref(), params); Task deployVApp = vAppApi.deploy(vApp.getHref(), params);
assertTrue(retryTaskSuccessLong.apply(deployVApp), String.format(TASK_COMPLETE_TIMELY, "deployVApp")); assertTrue(retryTaskSuccessLong.apply(deployVApp), String.format(TASK_COMPLETE_TIMELY, "deployVApp"));
// Get the updated VApp // Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref()); vApp = vAppApi.getVApp(vApp.getHref());
// Check the required fields are set // Check the required fields are set
@ -320,7 +311,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task powerOnVApp = vAppApi.powerOn(vApp.getHref()); Task powerOnVApp = vAppApi.powerOn(vApp.getHref());
assertTaskSucceedsLong(powerOnVApp); assertTaskSucceedsLong(powerOnVApp);
// Get the updated VApp // Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref()); vApp = vAppApi.getVApp(vApp.getHref());
// Check status // Check status
@ -331,12 +322,12 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
public void testReboot() { public void testReboot() {
// Power on VApp // Power on VApp
vApp = powerOnVApp(vApp.getHref()); vApp = powerOnVApp(vApp.getHref());
// The method under test // The method under test
Task reboot = vAppApi.reboot(vApp.getHref()); Task reboot = vAppApi.reboot(vApp.getHref());
assertTaskSucceedsLong(reboot); assertTaskSucceedsLong(reboot);
// Get the updated VApp // Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref()); vApp = vAppApi.getVApp(vApp.getHref());
// Check status // Check status
@ -352,7 +343,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task shutdown = vAppApi.shutdown(vApp.getHref()); Task shutdown = vAppApi.shutdown(vApp.getHref());
assertTaskSucceedsLong(shutdown); assertTaskSucceedsLong(shutdown);
// Get the updated VApp // Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref()); vApp = vAppApi.getVApp(vApp.getHref());
// Check status // Check status
@ -371,7 +362,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task suspend = vAppApi.suspend(vAppURI); Task suspend = vAppApi.suspend(vAppURI);
assertTaskSucceedsLong(suspend); assertTaskSucceedsLong(suspend);
// Get the updated VApp // Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref()); vApp = vAppApi.getVApp(vApp.getHref());
// Check status // Check status
@ -390,7 +381,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task reset = vAppApi.reset(vAppURI); Task reset = vAppApi.reset(vAppURI);
assertTaskSucceedsLong(reset); assertTaskSucceedsLong(reset);
// Get the updated VApp // Get the edited VApp
vApp = vAppApi.getVApp(vAppURI); vApp = vAppApi.getVApp(vAppURI);
// Check status // Check status
@ -408,11 +399,12 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task undeploy = vAppApi.undeploy(vApp.getHref(), params); Task undeploy = vAppApi.undeploy(vApp.getHref(), params);
assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy")); assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
// Get the updated VApp // Get the edited VApp
vApp = vAppApi.getVApp(vAppURI); vApp = vAppApi.getVApp(vAppURI);
// Check status // Check status
assertFalse(vApp.isDeployed(), String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString())); assertFalse(vApp.isDeployed(),
String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString()));
assertVAppStatus(vAppURI, Status.POWERED_OFF); assertVAppStatus(vAppURI, Status.POWERED_OFF);
} }
@ -420,12 +412,12 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
public void testPowerOffVApp() { public void testPowerOffVApp() {
// Power on VApp // Power on VApp
vApp = powerOnVApp(vApp.getHref()); vApp = powerOnVApp(vApp.getHref());
// The method under test // The method under test
Task powerOffVApp = vAppApi.powerOff(vApp.getHref()); Task powerOffVApp = vAppApi.powerOff(vApp.getHref());
assertTrue(retryTaskSuccess.apply(powerOffVApp), String.format(TASK_COMPLETE_TIMELY, "powerOffVApp")); assertTrue(retryTaskSuccess.apply(powerOffVApp), String.format(TASK_COMPLETE_TIMELY, "powerOffVApp"));
// Get the updated VApp // Get the edited VApp
vApp = vAppApi.getVApp(vAppURI); vApp = vAppApi.getVApp(vAppURI);
// Check status // Check status
@ -434,16 +426,16 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
@Test(description = "POST /vApp/{id}/action/controlAccess", dependsOnMethods = { "testGetVApp" }) @Test(description = "POST /vApp/{id}/action/controlAccess", dependsOnMethods = { "testGetVApp" })
public void testControlAccessUser() { public void testControlAccessUser() {
ControlAccessParams params = ControlAccessParams.builder() ControlAccessParams params = ControlAccessParams
.notSharedToEveryone() .builder()
.accessSetting(AccessSetting.builder() .notSharedToEveryone()
.subject(Reference.builder().href(user.getHref()).type(ADMIN_USER).build()) .accessSetting(
.accessLevel("ReadOnly") AccessSetting.builder()
.build()) .subject(Reference.builder().href(user.getHref()).type(ADMIN_USER).build())
.build(); .accessLevel("ReadOnly").build()).build();
// The method under test // The method under test
ControlAccessParams modified = vAppApi.modifyControlAccess(vApp.getHref(), params); ControlAccessParams modified = vAppApi.editControlAccess(vApp.getHref(), params);
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkControlAccessParams(modified); checkControlAccessParams(modified);
@ -453,14 +445,12 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
@Test(description = "POST /vApp/{id}/action/controlAccess", dependsOnMethods = { "testControlAccessUser" }) @Test(description = "POST /vApp/{id}/action/controlAccess", dependsOnMethods = { "testControlAccessUser" })
public void testControlAccessEveryone() { public void testControlAccessEveryone() {
ControlAccessParams params = ControlAccessParams.builder() ControlAccessParams params = ControlAccessParams.builder().sharedToEveryone().everyoneAccessLevel("FullControl")
.sharedToEveryone() .build();
.everyoneAccessLevel("FullControl")
.build();
// The method under test // The method under test
ControlAccessParams modified = vAppApi.modifyControlAccess(vApp.getHref(), params); ControlAccessParams modified = vAppApi.editControlAccess(vApp.getHref(), params);
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkControlAccessParams(modified); checkControlAccessParams(modified);
@ -474,31 +464,31 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
// Power on, then suspend the VApp // Power on, then suspend the VApp
vApp = powerOnVApp(vAppURI); vApp = powerOnVApp(vAppURI);
vApp = suspendVApp(vAppURI); vApp = suspendVApp(vAppURI);
// The method under test // The method under test
Task discardSuspendedState = vAppApi.discardSuspendedState(vApp.getHref()); Task discardSuspendedState = vAppApi.discardSuspendedState(vApp.getHref());
assertTrue(retryTaskSuccess.apply(discardSuspendedState), String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState")); assertTrue(retryTaskSuccess.apply(discardSuspendedState),
String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
} }
@Test(description = "POST /vApp/{id}/action/enterMaintenanceMode", groups = {"systemAdmin"}) @Test(description = "POST /vApp/{id}/action/enterMaintenanceMode", groups = { "systemAdmin" })
public void testEnterMaintenanceMode() { public void testEnterMaintenanceMode() {
// Do this to a new vApp, so don't mess up subsequent tests by making the vApp read-only // Do this to a new vApp, so don't mess up subsequent tests by making the vApp read-only
VApp temp = instantiateVApp(); VApp temp = instantiateVApp();
DeployVAppParams params = DeployVAppParams.builder() DeployVAppParams params = DeployVAppParams.builder()
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)) .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
.notForceCustomization() .notPowerOn().build();
.notPowerOn()
.build();
Task deployVApp = vAppApi.deploy(temp.getHref(), params); Task deployVApp = vAppApi.deploy(temp.getHref(), params);
assertTaskSucceedsLong(deployVApp); assertTaskSucceedsLong(deployVApp);
try { try {
// Method under test // Method under test
vAppApi.enterMaintenanceMode(temp.getHref()); vAppApi.enterMaintenanceMode(temp.getHref());
temp = vAppApi.getVApp(temp.getHref()); temp = vAppApi.getVApp(temp.getHref());
assertTrue(temp.isInMaintenanceMode(), String.format(CONDITION_FMT, "InMaintenanceMode", "TRUE", temp.isInMaintenanceMode())); assertTrue(temp.isInMaintenanceMode(),
String.format(CONDITION_FMT, "InMaintenanceMode", "TRUE", temp.isInMaintenanceMode()));
// Exit maintenance mode // Exit maintenance mode
vAppApi.exitMaintenanceMode(temp.getHref()); vAppApi.exitMaintenanceMode(temp.getHref());
@ -507,27 +497,26 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
} }
} }
@Test(description = "POST /vApp/{id}/action/exitMaintenanceMode", dependsOnMethods = { "testEnterMaintenanceMode" }, groups = {"systemAdmin"}) @Test(description = "POST /vApp/{id}/action/exitMaintenanceMode", dependsOnMethods = { "testEnterMaintenanceMode" }, groups = { "systemAdmin" })
public void testExitMaintenanceMode() { public void testExitMaintenanceMode() {
// Do this to a new vApp, so don't mess up subsequent tests by making the vApp read-only // Do this to a new vApp, so don't mess up subsequent tests by making the vApp read-only
VApp temp = instantiateVApp(); VApp temp = instantiateVApp();
DeployVAppParams params = DeployVAppParams.builder() DeployVAppParams params = DeployVAppParams.builder()
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)) .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
.notForceCustomization() .notPowerOn().build();
.notPowerOn()
.build();
Task deployVApp = vAppApi.deploy(temp.getHref(), params); Task deployVApp = vAppApi.deploy(temp.getHref(), params);
assertTaskSucceedsLong(deployVApp); assertTaskSucceedsLong(deployVApp);
try { try {
// Enter maintenance mode // Enter maintenance mode
vAppApi.enterMaintenanceMode(temp.getHref()); vAppApi.enterMaintenanceMode(temp.getHref());
// Method under test // Method under test
vAppApi.exitMaintenanceMode(temp.getHref()); vAppApi.exitMaintenanceMode(temp.getHref());
temp = vAppApi.getVApp(temp.getHref()); temp = vAppApi.getVApp(temp.getHref());
assertFalse(temp.isInMaintenanceMode(), String.format(CONDITION_FMT, "InMaintenanceMode", "FALSE", temp.isInMaintenanceMode())); assertFalse(temp.isInMaintenanceMode(),
String.format(CONDITION_FMT, "InMaintenanceMode", "FALSE", temp.isInMaintenanceMode()));
} finally { } finally {
cleanUpVApp(temp); cleanUpVApp(temp);
} }
@ -552,17 +541,16 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetLeaseSettingsSection" }) @Test(description = "PUT /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetLeaseSettingsSection" })
public void testModifyLeaseSettingsSection() { public void testEditLeaseSettingsSection() {
// Copy existing section // Copy existing section
LeaseSettingsSection oldSection = vAppApi.getLeaseSettingsSection(vApp.getHref()); LeaseSettingsSection oldSection = vAppApi.getLeaseSettingsSection(vApp.getHref());
Integer twoHours = (int) TimeUnit.SECONDS.convert(2L, TimeUnit.HOURS); Integer twoHours = (int) TimeUnit.SECONDS.convert(2L, TimeUnit.HOURS);
LeaseSettingsSection newSection = oldSection.toBuilder() LeaseSettingsSection newSection = oldSection.toBuilder().deploymentLeaseInSeconds(twoHours).build();
.deploymentLeaseInSeconds(twoHours)
.build();
// The method under test // The method under test
Task modifyLeaseSettingsSection = vAppApi.modifyLeaseSettingsSection(vApp.getHref(), newSection); Task editLeaseSettingsSection = vAppApi.editLeaseSettingsSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyLeaseSettingsSection), String.format(TASK_COMPLETE_TIMELY, "modifyLeaseSettingsSection")); assertTrue(retryTaskSuccess.apply(editLeaseSettingsSection),
String.format(TASK_COMPLETE_TIMELY, "editLeaseSettingsSection"));
// Retrieve the modified section // Retrieve the modified section
LeaseSettingsSection modified = vAppApi.getLeaseSettingsSection(vApp.getHref()); LeaseSettingsSection modified = vAppApi.getLeaseSettingsSection(vApp.getHref());
@ -573,30 +561,27 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
// Check the date fields // Check the date fields
if (modified.getDeploymentLeaseExpiration() != null && newSection.getDeploymentLeaseExpiration() != null) { if (modified.getDeploymentLeaseExpiration() != null && newSection.getDeploymentLeaseExpiration() != null) {
assertTrue(modified.getDeploymentLeaseExpiration().after(newSection.getDeploymentLeaseExpiration()), assertTrue(modified.getDeploymentLeaseExpiration().after(newSection.getDeploymentLeaseExpiration()),
String.format("The new deploymentLeaseExpiration timestamp must be later than the original: %s > %s", String.format("The new deploymentLeaseExpiration timestamp must be later than the original: %s > %s",
dateService.iso8601DateFormat(modified.getDeploymentLeaseExpiration()), dateService.iso8601DateFormat(modified.getDeploymentLeaseExpiration()),
dateService.iso8601DateFormat(newSection.getDeploymentLeaseExpiration()))); dateService.iso8601DateFormat(newSection.getDeploymentLeaseExpiration())));
} }
if (modified.getStorageLeaseExpiration() != null && newSection.getStorageLeaseExpiration() != null) { if (modified.getStorageLeaseExpiration() != null && newSection.getStorageLeaseExpiration() != null) {
assertTrue(modified.getStorageLeaseExpiration().after(newSection.getStorageLeaseExpiration()), assertTrue(modified.getStorageLeaseExpiration().after(newSection.getStorageLeaseExpiration()), String.format(
String.format("The new storageLeaseExpiration timestamp must be later than the original: %s > %s", "The new storageLeaseExpiration timestamp must be later than the original: %s > %s",
dateService.iso8601DateFormat(modified.getStorageLeaseExpiration()), dateService.iso8601DateFormat(modified.getStorageLeaseExpiration()),
dateService.iso8601DateFormat(newSection.getStorageLeaseExpiration()))); dateService.iso8601DateFormat(newSection.getStorageLeaseExpiration())));
} }
// Reset the date fields // Reset the date fields
modified = modified.toBuilder() modified = modified.toBuilder().deploymentLeaseExpiration(null).storageLeaseExpiration(null).build();
.deploymentLeaseExpiration(null) newSection = newSection.toBuilder().deploymentLeaseExpiration(null).storageLeaseExpiration(null).build();
.storageLeaseExpiration(null)
.build();
newSection = newSection.toBuilder()
.deploymentLeaseExpiration(null)
.storageLeaseExpiration(null)
.build();
// Check the section was modified correctly // Check the section was modified correctly
assertEquals(modified.getDeploymentLeaseInSeconds(), twoHours, assertEquals(
String.format(OBJ_FIELD_EQ, "LeaseSettingsSection", "DeploymentLeaseInSeconds", Integer.toString(twoHours), modified.getDeploymentLeaseInSeconds().toString())); modified.getDeploymentLeaseInSeconds(),
twoHours,
String.format(OBJ_FIELD_EQ, "LeaseSettingsSection", "DeploymentLeaseInSeconds",
Integer.toString(twoHours), modified.getDeploymentLeaseInSeconds().toString()));
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "LeaseSettingsSection")); assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "LeaseSettingsSection"));
} }
@ -610,16 +595,16 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/networkConfigSection", dependsOnMethods = { "testGetNetworkConfigSection" }) @Test(description = "PUT /vApp/{id}/networkConfigSection", dependsOnMethods = { "testGetNetworkConfigSection" })
public void testModifyNetworkConfigSection() { public void testEditNetworkConfigSection() {
// Copy existing section and update fields // Copy existing section and edit fields
NetworkConfigSection oldSection = vAppApi.getNetworkConfigSection(vApp.getHref()); NetworkConfigSection oldSection = vAppApi.getNetworkConfigSection(vApp.getHref());
VAppNetworkConfiguration networkConfig = VAppNetworkConfiguration.builder().build(); VAppNetworkConfiguration networkConfig = VAppNetworkConfiguration.builder().build();
NetworkConfigSection newSection = oldSection.toBuilder().networkConfigs(ImmutableSet.of(networkConfig)) NetworkConfigSection newSection = oldSection.toBuilder().networkConfigs(ImmutableSet.of(networkConfig)).build();
.build();
// The method under test // The method under test
Task modifyNetworkConfigSection = vAppApi.modifyNetworkConfigSection(vApp.getHref(), newSection); Task editNetworkConfigSection = vAppApi.editNetworkConfigSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyNetworkConfigSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConfigSection")); assertTrue(retryTaskSuccess.apply(editNetworkConfigSection),
String.format(TASK_COMPLETE_TIMELY, "editNetworkConfigSection"));
// Retrieve the modified section // Retrieve the modified section
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vApp.getHref()); NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vApp.getHref());
@ -628,7 +613,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
checkNetworkConfigSection(modified); checkNetworkConfigSection(modified);
// Check the modified section fields are set correctly // Check the modified section fields are set correctly
// assertEquals(modified.getInfo(), newSection.getInfo()); // assertEquals(modified.getInfo(), newSection.getInfo());
// Check the section was modified correctly // Check the section was modified correctly
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "NetworkConfigSection")); assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "NetworkConfigSection"));
@ -653,11 +638,11 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/owner", dependsOnMethods = { "testGetOwner" }) @Test(description = "PUT /vApp/{id}/owner", dependsOnMethods = { "testGetOwner" })
public void testModifyOwner() { public void testEditOwner() {
Owner newOwner = Owner.builder().user(Reference.builder().href(user.getHref()).type(ADMIN_USER).build()).build(); Owner newOwner = Owner.builder().user(Reference.builder().href(user.getHref()).type(ADMIN_USER).build()).build();
// The method under test // The method under test
vAppApi.modifyOwner(vApp.getHref(), newOwner); vAppApi.editOwner(vApp.getHref(), newOwner);
// Get the new VApp owner // Get the new VApp owner
Owner modified = vAppApi.getOwner(vApp.getHref()); Owner modified = vAppApi.getOwner(vApp.getHref());
@ -679,22 +664,23 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" }) @Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
public void testModifyProductSections() { public void testEditProductSections() {
// Copy existing section and update fields // Copy existing section and edit fields
ProductSectionList oldSections = vAppApi.getProductSections(vApp.getHref()); ProductSectionList oldSections = vAppApi.getProductSections(vApp.getHref());
ProductSectionList newSections = oldSections.toBuilder() ProductSectionList newSections = oldSections
.productSection(ProductSection.builder() .toBuilder()
.info("Information about the installed software") // Default ovf:Info text .productSection(
.required() ProductSection.builder().info("Information about the installed software")
.product(MsgType.builder().value("jclouds").build()) // Default ovf:Info text
.vendor(MsgType.builder().value("jclouds Inc.").build()) .required().product(MsgType.builder().value("jclouds").build())
// NOTE other ProductSection elements not returned by vCloud .vendor(MsgType.builder().value("jclouds Inc.").build())
.build()) // NOTE other ProductSection elements not returned by vCloud
.build(); .build()).build();
// The method under test // The method under test
Task modifyProductSections = vAppApi.modifyProductSections(vApp.getHref(), newSections); Task editProductSections = vAppApi.editProductSections(vApp.getHref(), newSections);
assertTrue(retryTaskSuccess.apply(modifyProductSections), String.format(TASK_COMPLETE_TIMELY, "modifyProductSections")); assertTrue(retryTaskSuccess.apply(editProductSections),
String.format(TASK_COMPLETE_TIMELY, "editProductSections"));
// Retrieve the modified section // Retrieve the modified section
ProductSectionList modified = vAppApi.getProductSections(vApp.getHref()); ProductSectionList modified = vAppApi.getProductSections(vApp.getHref());
@ -719,14 +705,14 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/startupSection", dependsOnMethods = { "testGetStartupSection" }) @Test(description = "PUT /vApp/{id}/startupSection", dependsOnMethods = { "testGetStartupSection" })
public void testModifyStartupSection() { public void testEditStartupSection() {
// Copy existing section and update fields // Copy existing section and edit fields
StartupSection oldSection = vAppApi.getStartupSection(vApp.getHref()); StartupSection oldSection = vAppApi.getStartupSection(vApp.getHref());
StartupSection newSection = oldSection.toBuilder().build(); StartupSection newSection = oldSection.toBuilder().build();
// The method under test // The method under test
Task modifyStartupSection = vAppApi.modifyStartupSection(vApp.getHref(), newSection); Task editStartupSection = vAppApi.editStartupSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyStartupSection), String.format(TASK_COMPLETE_TIMELY, "modifyStartupSection")); assertTrue(retryTaskSuccess.apply(editStartupSection), String.format(TASK_COMPLETE_TIMELY, "editStartupSection"));
// Retrieve the modified section // Retrieve the modified section
StartupSection modified = vAppApi.getStartupSection(vApp.getHref()); StartupSection modified = vAppApi.getStartupSection(vApp.getHref());
@ -752,41 +738,43 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkMetadataValueFor(VAPP, newMetadataValue, value); checkMetadataValueFor(VAPP, newMetadataValue, value);
} }
@Test(description = "GET /vApp/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" }) @Test(description = "GET /vApp/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" })
public void testGetMetadata() { public void testGetMetadata() {
key = name("key-"); key = name("key-");
String value = name("value-"); String value = name("value-");
metadataValue = MetadataValue.builder().value(value).build(); metadataValue = MetadataValue.builder().value(value).build();
vAppApi.getMetadataApi().putEntry(vApp.getHref(), key, metadataValue); vAppApi.getMetadataApi().putEntry(vApp.getHref(), key, metadataValue);
// Call the method being tested // Call the method being tested
Metadata metadata = vAppApi.getMetadataApi().get(vApp.getHref()); Metadata metadata = vAppApi.getMetadataApi().get(vApp.getHref());
checkMetadata(metadata); checkMetadata(metadata);
// Check requirements for this test // Check requirements for this test
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()), String.format(NOT_EMPTY_OBJECT_FMT, "MetadataEntry", "vApp")); assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
String.format(NOT_EMPTY_OBJECT_FMT, "MetadataEntry", "vApp"));
} }
@Test(description = "GET /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" }) @Test(description = "GET /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
public void testGetOrgMetadataValue() { public void testGetOrgMetadataValue() {
// Call the method being tested // Call the method being tested
MetadataValue value = vAppApi.getMetadataApi().getValue(vApp.getHref(), key); MetadataValue value = vAppApi.getMetadataApi().getValue(vApp.getHref(), key);
String expected = metadataValue.getValue(); String expected = metadataValue.getValue();
checkMetadataValue(value); checkMetadataValue(value);
assertEquals(value.getValue(), expected, String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", expected, value.getValue())); assertEquals(value.getValue(), expected,
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", expected, value.getValue()));
} }
@Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }) @Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
public void testDeleteMetadataEntry() { public void testRemoveMetadataEntry() {
// Delete the entry // Delete the entry
Task task = vAppApi.getMetadataApi().deleteEntry(vApp.getHref(), key); Task task = vAppApi.getMetadataApi().removeEntry(vApp.getHref(), key);
retryTaskSuccess.apply(task); retryTaskSuccess.apply(task);
// Confirm the entry has been deleted // Confirm the entry has been removed
Metadata newMetadata = vAppApi.getMetadataApi().get(vApp.getHref()); Metadata newMetadata = vAppApi.getMetadataApi().get(vApp.getHref());
// Check the retrieved object is well formed // Check the retrieved object is well formed
@ -798,51 +786,47 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Metadata oldMetadata = vAppApi.getMetadataApi().get(vApp.getHref()); Metadata oldMetadata = vAppApi.getMetadataApi().get(vApp.getHref());
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata); Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
// Store a value, to be deleted // Store a value, to be removed
String key = name("key-"); String key = name("key-");
String value = name("value-"); String value = name("value-");
Metadata addedMetadata = Metadata.builder() Metadata addedMetadata = Metadata.builder().entry(MetadataEntry.builder().key(key).value(value).build()).build();
.entry(MetadataEntry.builder().key(key).value(value).build())
.build();
Task task = vAppApi.getMetadataApi().merge(vApp.getHref(), addedMetadata); Task task = vAppApi.getMetadataApi().merge(vApp.getHref(), addedMetadata);
retryTaskSuccess.apply(task); retryTaskSuccess.apply(task);
// Confirm the entry contains everything that was there, and everything that was being added // Confirm the entry contains everything that was there, and everything that was being added
Metadata newMetadata = vAppApi.getMetadataApi().get(vApp.getHref()); Metadata newMetadata = vAppApi.getMetadataApi().get(vApp.getHref());
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String>builder() Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
.putAll(oldMetadataMap) .put(key, value).build();
.put(key, value)
.build();
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkMetadataFor(VAPP, newMetadata, expectedMetadataMap); checkMetadataFor(VAPP, newMetadata, expectedMetadataMap);
} }
/** /**
* @see VAppApi#deleteVApp(URI) * @see VAppApi#removeVApp(URI)
*/ */
@Test(description = "DELETE /vApp/{id}") @Test(description = "DELETE /vApp/{id}")
public void testDeleteVApp() { public void testRemoveVApp() {
// Create a temporary VApp to delete // Create a temporary VApp to remove
VApp temp = instantiateVApp(); VApp temp = instantiateVApp();
// The method under test // The method under test
Task deleteVApp = vAppApi.deleteVApp(temp.getHref()); Task removeVApp = vAppApi.removeVApp(temp.getHref());
assertTrue(retryTaskSuccess.apply(deleteVApp), String.format(TASK_COMPLETE_TIMELY, "deleteVApp")); assertTrue(retryTaskSuccess.apply(removeVApp), String.format(TASK_COMPLETE_TIMELY, "removeVApp"));
VApp deleted = vAppApi.getVApp(temp.getHref()); VApp removed = vAppApi.getVApp(temp.getHref());
assertNull(deleted, "The VApp "+temp.getName()+" should have been deleted"); assertNull(removed, "The VApp " + temp.getName() + " should have been removed");
} }
/** /**
* Create the recompose vapp params. * Create the recompose vapp params.
* *
* @param vappTemplateRef * @param vappTemplateRef
* @param vdc * @param vdc
* @return * @return
* @throws VCloudException * @throws VCloudException
*/ */
public RecomposeVAppParams createRecomposeParams(VApp vApp, Vm vm) { public RecomposeVAppParams addRecomposeParams(VApp vApp, Vm vm) {
// creating an item element. this item will contain the vm which should be added to the vapp. // creating an item element. this item will contain the vm which should be added to the vapp.
Reference reference = Reference.builder().name(name("vm-")).href(vm.getHref()).type(vm.getType()).build(); Reference reference = Reference.builder().name(name("vm-")).href(vm.getHref()).type(vm.getType()).build();
@ -852,10 +836,11 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Set<NetworkAssignment> networkAssignments = Sets.newLinkedHashSet(); Set<NetworkAssignment> networkAssignments = Sets.newLinkedHashSet();
// if the vm contains a network connection and the vApp does not contain any configured network // if the vm contains a network connection and the vApp does not contain any configured
// network
if (vmHasNetworkConnectionConfigured(vm)) { if (vmHasNetworkConnectionConfigured(vm)) {
if (!vAppHasNetworkConfigured(vApp)) { if (!vAppHasNetworkConfigured(vApp)) {
// create a new network connection section for the vm. // add a new network connection section for the vm.
NetworkConnectionSection networkConnectionSection = NetworkConnectionSection.builder() NetworkConnectionSection networkConnectionSection = NetworkConnectionSection.builder()
.info("Empty network configuration parameters").build(); .info("Empty network configuration parameters").build();
// adding the network connection section to the instantiation params of the vapp. // adding the network connection section to the instantiation params of the vapp.
@ -904,16 +889,14 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
if (vmInstantiationParams != null) if (vmInstantiationParams != null)
vmItem = SourcedCompositionItemParam.builder().fromSourcedCompositionItemParam(vmItem) vmItem = SourcedCompositionItemParam.builder().fromSourcedCompositionItemParam(vmItem)
.instantiationParams(vmInstantiationParams) .instantiationParams(vmInstantiationParams).build();
.build();
if (networkAssignments != null) if (networkAssignments != null)
vmItem = SourcedCompositionItemParam.builder().fromSourcedCompositionItemParam(vmItem) vmItem = SourcedCompositionItemParam.builder().fromSourcedCompositionItemParam(vmItem)
.networkAssignment(networkAssignments) .networkAssignment(networkAssignments).build();
.build();
return RecomposeVAppParams.builder().name(name("recompose-")) return RecomposeVAppParams.builder().name(name("recompose-"))
// adding the vm item. // adding the vm item.
.sourcedItems(ImmutableList.of(vmItem)).build(); .sourcedItems(ImmutableList.of(vmItem)).build();
} }

View File

@ -79,8 +79,8 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
protected void tidyUp() { protected void tidyUp() {
if (key != null) { if (key != null) {
try { try {
Task delete = vAppTemplateApi.getMetadataApi().deleteEntry(vAppTemplateURI, key); Task remove = vAppTemplateApi.getMetadataApi().removeEntry(vAppTemplateURI, key);
taskDoneEventually(delete); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting metadata entry '%s'", key); logger.warn(e, "Error when deleting metadata entry '%s'", key);
} }
@ -90,7 +90,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
@BeforeClass @BeforeClass
void setUp() { void setUp() {
network = lazyGetNetwork(); network = lazyGetNetwork();
securityGroupToNetworkConfig = createSecurityGroupToNetworkConfiguration(Reference.builder().fromEntity(network).build()); securityGroupToNetworkConfig = addSecurityGroupToNetworkConfiguration(Reference.builder().fromEntity(network).build());
} }
@AfterMethod @AfterMethod
@ -99,9 +99,9 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "Create a vApp Network based on an org network with `default` firewall rules applied") @Test(description = "Create a vApp Network based on an org network with `default` firewall rules applied")
public void testCreateVAppNetworkWithDefaultSecurityGroup() { public void testAddVAppNetworkWithDefaultSecurityGroup() {
ImmutableList<String> securityGroups = ImmutableList.of(DEFAULT_SECURITY_GROUP); ImmutableList<String> securityGroups = ImmutableList.of(DEFAULT_SECURITY_GROUP);
createVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppURI); addVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppURI);
// Retrieve the modified section // Retrieve the modified section
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppURI); NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppURI);
@ -118,9 +118,9 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "Create a vApp Network based on an org network with `http` firewall rules applied") @Test(description = "Create a vApp Network based on an org network with `http` firewall rules applied")
public void testCreateVAppNetworkWithHttpSecurityGroup() { public void testAddVAppNetworkWithHttpSecurityGroup() {
ImmutableList<String> securityGroups = ImmutableList.of(HTTP_SECURITY_GROUP); ImmutableList<String> securityGroups = ImmutableList.of(HTTP_SECURITY_GROUP);
createVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppURI); addVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppURI);
// Retrieve the modified section // Retrieve the modified section
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppURI); NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppURI);
@ -137,9 +137,9 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "Create a vApp Network based on an org network with both `defautl` and `http` firewall rules applied") @Test(description = "Create a vApp Network based on an org network with both `defautl` and `http` firewall rules applied")
public void testCreateVAppNetworkWithDefaultAndHttpSecurityGroup() { public void testAddVAppNetworkWithDefaultAndHttpSecurityGroup() {
ImmutableList<String> securityGroups = ImmutableList.of(DEFAULT_SECURITY_GROUP, HTTP_SECURITY_GROUP); ImmutableList<String> securityGroups = ImmutableList.of(DEFAULT_SECURITY_GROUP, HTTP_SECURITY_GROUP);
createVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppURI); addVAppNetworkWithSecurityGroupOnVApp(securityGroups, vAppURI);
// Retrieve the modified section // Retrieve the modified section
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppURI); NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vAppURI);
@ -155,12 +155,12 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
*/ */
} }
private void createVAppNetworkWithSecurityGroupOnVApp(ImmutableList<String> securityGroups, URI vAppURI) { private void addVAppNetworkWithSecurityGroupOnVApp(ImmutableList<String> securityGroups, URI vAppURI) {
String newVAppNetworkName = generateVAppNetworkName(network.getName(), securityGroups); String newVAppNetworkName = generateVAppNetworkName(network.getName(), securityGroups);
// Create a vAppNetwork with firewall rules // Create a vAppNetwork with firewall rules
NetworkConfigSection newSection = generateNetworkConfigSection(securityGroups, newVAppNetworkName); NetworkConfigSection newSection = generateNetworkConfigSection(securityGroups, newVAppNetworkName);
Task modifyNetworkConfigSection = vAppApi.modifyNetworkConfigSection(vAppURI, newSection); Task editNetworkConfigSection = vAppApi.editNetworkConfigSection(vAppURI, newSection);
assertTrue(retryTaskSuccess.apply(modifyNetworkConfigSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConfigSection")); assertTrue(retryTaskSuccess.apply(editNetworkConfigSection), String.format(TASK_COMPLETE_TIMELY, "editNetworkConfigSection"));
attachVmToVAppNetwork(vm, newVAppNetworkName); attachVmToVAppNetwork(vm, newVAppNetworkName);
} }
@ -172,15 +172,15 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
firewallRules.addAll(securityGroupFirewallRules); firewallRules.addAll(securityGroupFirewallRules);
} }
FirewallService firewallService = createFirewallService(firewallRules); FirewallService firewallService = addFirewallService(firewallRules);
NatService natService = createNatService(); NatService natService = addNatService();
IpScope ipScope = createNewIpScope(); IpScope ipScope = addNewIpScope();
NetworkConfiguration newConfiguration = NetworkConfiguration.builder() NetworkConfiguration newConfiguration = NetworkConfiguration.builder()
.ipScope(ipScope) .ipScope(ipScope)
.parentNetwork(Reference.builder().fromEntity(network).build()) .parentNetwork(Reference.builder().fromEntity(network).build())
.fenceMode(FenceMode.NAT_ROUTED) .fenceMode(FenceMode.NAT_ROUTED)
.retainNetInfoAcrossDeployments(false) .retainNetInfoAcrossDeployments(false)
.features(createNetworkFeatures(ImmutableSet.of(firewallService, natService))) .features(toNetworkFeatures(ImmutableSet.of(firewallService, natService)))
.build(); .build();
VAppNetworkConfiguration newVAppNetworkConfiguration = VAppNetworkConfiguration.builder().networkName(newVAppNetworkName).configuration(newConfiguration).build(); VAppNetworkConfiguration newVAppNetworkConfiguration = VAppNetworkConfiguration.builder().networkName(newVAppNetworkName).configuration(newConfiguration).build();
@ -209,12 +209,12 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
section = section.toBuilder().networkConnection(newNetworkConnection).build(); section = section.toBuilder().networkConnection(newNetworkConnection).build();
} }
Task configureNetwork = vmApi.modifyNetworkConnectionSection(vm.getHref(), section); Task configureNetwork = vmApi.editNetworkConnectionSection(vm.getHref(), section);
assertTaskSucceedsLong(configureNetwork); assertTaskSucceedsLong(configureNetwork);
} }
private IpScope createNewIpScope() { private IpScope addNewIpScope() {
IpRange newIpRange = createIpRange(); IpRange newIpRange = addIpRange();
IpRanges newIpRanges = IpRanges.builder() IpRanges newIpRanges = IpRanges.builder()
.ipRange(newIpRange) .ipRange(newIpRange)
.build(); .build();
@ -225,7 +225,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
.ipRanges(newIpRanges).build(); .ipRanges(newIpRanges).build();
} }
private IpRange createIpRange() { private IpRange addIpRange() {
IpRange newIpRange = IpRange.builder() IpRange newIpRange = IpRange.builder()
.startAddress("192.168.2.100") .startAddress("192.168.2.100")
.endAddress("192.168.2.199") .endAddress("192.168.2.199")
@ -243,7 +243,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
return firewallRules; return firewallRules;
} }
private NetworkFeatures createNetworkFeatures(Set<? extends NetworkServiceType<?>> networkServices) { private NetworkFeatures toNetworkFeatures(Set<? extends NetworkServiceType<?>> networkServices) {
NetworkFeatures networkFeatures = NetworkFeatures.builder() NetworkFeatures networkFeatures = NetworkFeatures.builder()
.services(networkServices) .services(networkServices)
.build(); .build();
@ -251,23 +251,23 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
} }
private Set<FirewallRule> createDefaultFirewallRules() { private Set<FirewallRule> defaultFirewallRules() {
FirewallRuleProtocols protocols = FirewallRuleProtocols.builder() FirewallRuleProtocols protocols = FirewallRuleProtocols.builder()
.any(true) .any(true)
.build(); .build();
FirewallRule egressAll = createFirewallRule(FirewallRuleProtocols.builder().tcp(true).build(), "allow ssh ingoing traffic", -1, 22, "in"); FirewallRule egressAll = addFirewallRule(FirewallRuleProtocols.builder().tcp(true).build(), "allow ssh ingoing traffic", -1, 22, "in");
FirewallRule sshIngoing = createFirewallRule(protocols, "allow all outgoing traffic", -1, -1, "out"); FirewallRule sshIngoing = addFirewallRule(protocols, "allow all outgoing traffic", -1, -1, "out");
return ImmutableSet.of(egressAll, sshIngoing); return ImmutableSet.of(egressAll, sshIngoing);
} }
private Set<FirewallRule> createHttpIngoingFirewallRule() { private Set<FirewallRule> httpIngressFirewallRules() {
FirewallRuleProtocols protocols = FirewallRuleProtocols.builder().tcp(true).build(); FirewallRuleProtocols protocols = FirewallRuleProtocols.builder().tcp(true).build();
FirewallRule httpIngoing = createFirewallRule(protocols , "allow http ingoing traffic", 80, 80, "in"); FirewallRule httpIngoing = addFirewallRule(protocols , "allow http ingoing traffic", 80, 80, "in");
FirewallRule httpsIngoing = createFirewallRule(protocols , "allow https ingoing traffic", 443, 443, "in"); FirewallRule httpsIngoing = addFirewallRule(protocols , "allow https ingoing traffic", 443, 443, "in");
return ImmutableSet.of(httpIngoing, httpsIngoing); return ImmutableSet.of(httpIngoing, httpsIngoing);
} }
private FirewallRule createFirewallRule(FirewallRuleProtocols protocols, String description, int sourcePort, int outPort, String direction) { private FirewallRule addFirewallRule(FirewallRuleProtocols protocols, String description, int sourcePort, int outPort, String direction) {
return FirewallRule.builder() return FirewallRule.builder()
.isEnabled(true) .isEnabled(true)
.description(description) .description(description)
@ -282,7 +282,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
.build(); .build();
} }
private FirewallService createFirewallService(Set<FirewallRule> firewallRules) { private FirewallService addFirewallService(Set<FirewallRule> firewallRules) {
FirewallService firewallService = FirewallService.builder() FirewallService firewallService = FirewallService.builder()
.enabled(true) .enabled(true)
.defaultAction("drop") .defaultAction("drop")
@ -292,7 +292,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
return firewallService; return firewallService;
} }
private NatService createNatService() { private NatService addNatService() {
NatService natService = NatService.builder() NatService natService = NatService.builder()
.enabled(true) .enabled(true)
.natType("ipTranslation") .natType("ipTranslation")
@ -301,28 +301,28 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
return natService; return natService;
} }
private Map<String, NetworkConfiguration> createSecurityGroupToNetworkConfiguration(Reference parentNetworkRef) { private Map<String, NetworkConfiguration> addSecurityGroupToNetworkConfiguration(Reference parentNetworkRef) {
Set<FirewallRule> defaultFirewallRules = createDefaultFirewallRules(); Set<FirewallRule> defaultFirewallRules = defaultFirewallRules();
Set<FirewallRule> httpFirewallRules = createHttpIngoingFirewallRule(); Set<FirewallRule> httpFirewallRules = httpIngressFirewallRules();
Map<String, NetworkConfiguration> securityGroupToNetworkConfigurations = Maps.newHashMap(); Map<String, NetworkConfiguration> securityGroupToNetworkConfigurations = Maps.newHashMap();
securityGroupToNetworkConfigurations.put(DEFAULT_SECURITY_GROUP, createNetworkConfiguration(parentNetworkRef, defaultFirewallRules)); securityGroupToNetworkConfigurations.put(DEFAULT_SECURITY_GROUP, addNetworkConfiguration(parentNetworkRef, defaultFirewallRules));
securityGroupToNetworkConfigurations.put(HTTP_SECURITY_GROUP, createNetworkConfiguration(parentNetworkRef, httpFirewallRules)); securityGroupToNetworkConfigurations.put(HTTP_SECURITY_GROUP, addNetworkConfiguration(parentNetworkRef, httpFirewallRules));
return securityGroupToNetworkConfigurations; return securityGroupToNetworkConfigurations;
} }
private NetworkConfiguration createNetworkConfiguration(Reference parentNetworkRef, Set<FirewallRule> newFirewallRules) { private NetworkConfiguration addNetworkConfiguration(Reference parentNetworkRef, Set<FirewallRule> newFirewallRules) {
FirewallService firewallService = createFirewallService(newFirewallRules); FirewallService firewallService = addFirewallService(newFirewallRules);
IpScope ipScope = createNewIpScope(); IpScope ipScope = addNewIpScope();
NetworkConfiguration newConfiguration = NetworkConfiguration.builder() NetworkConfiguration newConfiguration = NetworkConfiguration.builder()
.ipScope(ipScope) .ipScope(ipScope)
.parentNetwork(parentNetworkRef) .parentNetwork(parentNetworkRef)
.fenceMode(FenceMode.NAT_ROUTED) .fenceMode(FenceMode.NAT_ROUTED)
.retainNetInfoAcrossDeployments(false) .retainNetInfoAcrossDeployments(false)
.features(createNetworkFeatures(ImmutableSet.of(firewallService))) .features(toNetworkFeatures(ImmutableSet.of(firewallService)))
.build(); .build();
return newConfiguration; return newConfiguration;
} }
@ -350,7 +350,7 @@ public class VAppNetworksLiveTest extends AbstractVAppApiLiveTest {
.build()) .build())
.build(); .build();
} }
Task cleanUpNetworks = vmApi.modifyNetworkConnectionSection(vm.getHref(), section); Task cleanUpNetworks = vmApi.editNetworkConnectionSection(vm.getHref(), section);
assertTaskSucceedsLong(cleanUpNetworks); assertTaskSucceedsLong(cleanUpNetworks);
} }

View File

@ -90,10 +90,10 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
assertEquals(template, exampleTemplate()); assertEquals(template, exampleTemplate());
Task task = api.modifyVAppTemplate(uri, exampleTemplate()); Task task = api.editVAppTemplate(uri, exampleTemplate());
assertNotNull(task); assertNotNull(task);
task = api.deleteVappTemplate(uri); task = api.removeVappTemplate(uri);
assertNotNull(task); assertNotNull(task);
} }
@ -118,11 +118,11 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId).xmlFilePayload("/vapptemplate/vAppTemplate.xml", VAPP_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(), 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()).getVAppTemplateApi(); new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
api.modifyVAppTemplate(uri, exampleTemplate()); api.editVAppTemplate(uri, exampleTemplate());
} }
@Test(expectedExceptions = VCloudDirectorException.class) @Test(expectedExceptions = VCloudDirectorException.class)
public void testDeleteMissingVAppTemplate() { public void testRemoveMissingVAppTemplate() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId); URI uri = URI.create(endpoint + templateId);
@ -130,7 +130,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId).acceptMedia(TASK).httpRequestBuilder().build(), new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi(); new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
api.deleteVappTemplate(uri); api.removeVappTemplate(uri);
} }
public void testConsolidateVAppTemplate() { public void testConsolidateVAppTemplate() {
@ -270,7 +270,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
assertEquals(section, exampleGuestCustomizationSection()); assertEquals(section, exampleGuestCustomizationSection());
Task task = api.modifyGuestCustomizationSection(uri, exampleGuestCustomizationSection()); Task task = api.editGuestCustomizationSection(uri, exampleGuestCustomizationSection());
assertNotNull(task); assertNotNull(task);
} }
@ -295,7 +295,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/guestCustomizationSection").xmlFilePayload("/vapptemplate/guestCustomizationSection.xml", GUEST_CUSTOMIZATION_SECTION).acceptMedia(TASK).httpRequestBuilder().build(), 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()).getVAppTemplateApi(); new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateApi();
api.modifyGuestCustomizationSection(uri, exampleGuestCustomizationSection()); api.editGuestCustomizationSection(uri, exampleGuestCustomizationSection());
} }
public void testLeaseSettingsSection() throws ParseException { public void testLeaseSettingsSection() throws ParseException {
@ -314,7 +314,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
assertEquals(section, exampleLeaseSettingsSection()); assertEquals(section, exampleLeaseSettingsSection());
Task task = api.modifyLeaseSettingsSection(uri, exampleLeaseSettingsSection()); Task task = api.editLeaseSettingsSection(uri, exampleLeaseSettingsSection());
assertNotNull(task); assertNotNull(task);
} }
@ -338,7 +338,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
new VcloudHttpRequestPrimer().apiCommand("PUT", templateId + "/leaseSettingsSection").xmlFilePayload("/vapptemplate/leaseSettingsSection.xml", LEASE_SETTINGS_SECTION).acceptMedia(TASK).httpRequestBuilder().build(), 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()).getVAppTemplateApi(); new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
api.modifyLeaseSettingsSection(uri, exampleLeaseSettingsSection()); api.editLeaseSettingsSection(uri, exampleLeaseSettingsSection());
} }
public void testVappTemplateMetadata() { public void testVappTemplateMetadata() {
@ -406,7 +406,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
Task task = api.getMetadataApi().putEntry(uri, "12345", exampleMetadataValue()); Task task = api.getMetadataApi().putEntry(uri, "12345", exampleMetadataValue());
assertNotNull(task); assertNotNull(task);
task = api.getMetadataApi().deleteEntry(uri, "12345"); task = api.getMetadataApi().removeEntry(uri, "12345");
assertNotNull(task); assertNotNull(task);
} }
@ -434,7 +434,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
} }
@Test(expectedExceptions = ResourceNotFoundException.class) @Test(expectedExceptions = ResourceNotFoundException.class)
public void testDeleteMissingMetadataValue() { public void testRemoveMissingMetadataValue() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId); URI uri = URI.create(endpoint + templateId);
@ -442,7 +442,7 @@ public class VAppTemplateApiExpectTest extends VCloudDirectorAdminApiExpectTest
new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId + "/metadata/12345").acceptMedia(TASK).httpRequestBuilder().build(), new VcloudHttpRequestPrimer().apiCommand("DELETE", templateId + "/metadata/12345").acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi(); new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error403.xml", ERROR).httpResponseBuilder().statusCode(403).build()).getVAppTemplateApi();
api.getMetadataApi().deleteEntry(uri, "12345"); api.getMetadataApi().removeEntry(uri, "12345");
} }
@Test(expectedExceptions = VCloudDirectorException.class) @Test(expectedExceptions = VCloudDirectorException.class)

View File

@ -91,8 +91,8 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
protected void tidyUp() { protected void tidyUp() {
if (key != null) { if (key != null) {
try { try {
Task delete = vAppTemplateApi.getMetadataApi().deleteEntry(vAppTemplateURI, key); Task remove = vAppTemplateApi.getMetadataApi().removeEntry(vAppTemplateURI, key);
taskDoneEventually(delete); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error when deleting metadata entry '%s'", key); logger.warn(e, "Error when deleting metadata entry '%s'", key);
} }
@ -152,7 +152,7 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
ProductSectionList origSections = vAppTemplateApi.getProductSections(vApp.getHref()); ProductSectionList origSections = vAppTemplateApi.getProductSections(vApp.getHref());
ProductSectionList newSections = origSections.toBuilder().build(); ProductSectionList newSections = origSections.toBuilder().build();
Task task = vAppTemplateApi.modifyProductSections(vApp.getHref(), newSections); Task task = vAppTemplateApi.editProductSections(vApp.getHref(), newSections);
assertTaskSucceeds(task); assertTaskSucceeds(task);
ProductSectionList modified = vAppTemplateApi.getProductSections(vApp.getHref()); ProductSectionList modified = vAppTemplateApi.getProductSections(vApp.getHref());
@ -183,7 +183,7 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
checkMetadata(metadata); checkMetadata(metadata);
} }
// implicitly tested by testEditVAppTemplateMetadataValue, which first creates the metadata entry; otherwise no entry may exist // implicitly tested by testEditVAppTemplateMetadataValue, which first adds the metadata entry; otherwise no entry may exist
@Test(description = "GET /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetVAppTemplateMetadata" }) @Test(description = "GET /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetVAppTemplateMetadata" })
public void testGetMetadataValue() { public void testGetMetadataValue() {
Metadata metadata = vAppTemplateApi.getMetadataApi().get(vAppTemplateURI); Metadata metadata = vAppTemplateApi.getMetadataApi().get(vAppTemplateURI);
@ -235,7 +235,7 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
.description(description) .description(description)
.build(); .build();
final Task task = vAppTemplateApi.modifyVAppTemplate(vAppTemplateURI, template); final Task task = vAppTemplateApi.editVAppTemplate(vAppTemplateURI, template);
assertTaskSucceeds(task); assertTaskSucceeds(task);
VAppTemplate newTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI); VAppTemplate newTemplate = vAppTemplateApi.getVAppTemplate(vAppTemplateURI);
@ -277,8 +277,8 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "DELETE /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadataValue" }) @Test(description = "DELETE /vAppTemplate/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadataValue" })
public void testDeleteVAppTemplateMetadataValue() { public void testRemoveVAppTemplateMetadataValue() {
final Task deletionTask = vAppTemplateApi.getMetadataApi().deleteEntry(vAppTemplateURI, key); final Task deletionTask = vAppTemplateApi.getMetadataApi().removeEntry(vAppTemplateURI, key);
assertTaskSucceeds(deletionTask); assertTaskSucceeds(deletionTask);
Metadata newMetadata = vAppTemplateApi.getMetadataApi().get(vAppTemplateURI); Metadata newMetadata = vAppTemplateApi.getMetadataApi().get(vAppTemplateURI);
@ -294,7 +294,7 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
.computerName(computerName) .computerName(computerName)
.build(); .build();
final Task task = vAppTemplateApi.modifyGuestCustomizationSection(vm.getHref(), newSection); final Task task = vAppTemplateApi.editGuestCustomizationSection(vm.getHref(), newSection);
assertTaskSucceeds(task); assertTaskSucceeds(task);
GuestCustomizationSection modified = vAppTemplateApi.getGuestCustomizationSection(vm.getHref()); GuestCustomizationSection modified = vAppTemplateApi.getGuestCustomizationSection(vm.getHref());
@ -314,7 +314,7 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
.storageLeaseInSeconds(storageLeaseInSeconds) .storageLeaseInSeconds(storageLeaseInSeconds)
.build(); .build();
final Task task = vAppTemplateApi.modifyLeaseSettingsSection(vAppTemplateURI, leaseSettingSection); final Task task = vAppTemplateApi.editLeaseSettingsSection(vAppTemplateURI, leaseSettingSection);
assertTaskSucceeds(task); assertTaskSucceeds(task);
LeaseSettingsSection newLeaseSettingsSection = vAppTemplateApi.getLeaseSettingsSection(vAppTemplateURI); LeaseSettingsSection newLeaseSettingsSection = vAppTemplateApi.getLeaseSettingsSection(vAppTemplateURI);
@ -322,20 +322,20 @@ public class VAppTemplateApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "DELETE /vAppTemplate/{id}", dependsOnMethods = { "testGetVAppTemplate" }) @Test(description = "DELETE /vAppTemplate/{id}", dependsOnMethods = { "testGetVAppTemplate" })
public void testDeleteVAppTemplate() throws Exception { public void testRemoveVAppTemplate() throws Exception {
VAppTemplate clonedVappTemplate = cloneVAppTemplate(true); VAppTemplate clonedVappTemplate = cloneVAppTemplate(true);
// Confirm that "get" works pre-delete // Confirm that "get" works pre-remove
VAppTemplate vAppTemplatePreDelete = vAppTemplateApi.getVAppTemplate(clonedVappTemplate.getHref()); VAppTemplate vAppTemplatePreDelete = vAppTemplateApi.getVAppTemplate(clonedVappTemplate.getHref());
checkVAppTemplate(vAppTemplatePreDelete); checkVAppTemplate(vAppTemplatePreDelete);
// Delete the template // Delete the template
final Task task = vAppTemplateApi.deleteVappTemplate(clonedVappTemplate.getHref()); final Task task = vAppTemplateApi.removeVappTemplate(clonedVappTemplate.getHref());
assertTaskSucceeds(task); assertTaskSucceeds(task);
// Confirm that can't access post-delete, i.e. template has been deleted // Confirm that can't access post-remove, i.e. template has been removed
VAppTemplate deleted = vAppTemplateApi.getVAppTemplate(clonedVappTemplate.getHref()); VAppTemplate removed = vAppTemplateApi.getVAppTemplate(clonedVappTemplate.getHref());
assertNull(deleted); assertNull(removed);
} }
@Test(description = "POST /vAppTemplate/{id}/action/disableDownload") @Test(description = "POST /vAppTemplate/{id}/action/disableDownload")

View File

@ -286,17 +286,17 @@ public class VdcApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test @Test
public void testCreateMedia() { public void testAddMedia() {
URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media")
.acceptMedia(VCloudDirectorMediaType.MEDIA) .acceptMedia(VCloudDirectorMediaType.MEDIA)
.xmlFilePayload("/media/createMediaSource.xml", VCloudDirectorMediaType.MEDIA) .xmlFilePayload("/media/addMediaSource.xml", VCloudDirectorMediaType.MEDIA)
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/media/createMedia.xml", VCloudDirectorMediaType.MEDIA) .xmlFilePayload("/media/addMedia.xml", VCloudDirectorMediaType.MEDIA)
.httpResponseBuilder().statusCode(201).build()); .httpResponseBuilder().statusCode(201).build());
Media source = Media.builder() Media source = Media.builder()
@ -306,9 +306,9 @@ public class VdcApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.type("application/vnd.vmware.vcloud.media+xml") .type("application/vnd.vmware.vcloud.media+xml")
.description("Test media generated by testCreateMedia()") .description("Test media generated by testCreateMedia()")
.build(); .build();
Media expected = MediaApiExpectTest.createMedia(); Media expected = MediaApiExpectTest.addMedia();
assertEquals(api.getVdcApi().createMedia(vdcUri, source), expected); assertEquals(api.getVdcApi().addMedia(vdcUri, source), expected);
} }
@Test @Test

View File

@ -121,8 +121,8 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
if (metadataSet) { if (metadataSet) {
try { try {
Task delete = adminContext.getApi().getVdcApi().getMetadataApi().deleteEntry(lazyGetVdc().getHref(), "key"); Task remove = adminContext.getApi().getVdcApi().getMetadataApi().removeEntry(lazyGetVdc().getHref(), "key");
taskDoneEventually(delete); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error deleting metadata entry"); logger.warn(e, "Error deleting metadata entry");
} }

View File

@ -86,15 +86,15 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
Vm expected = getVm(); Vm expected = getVm();
assertEquals(api.getVmApi().getVm(vmURI), expected); assertEquals(api.getVmApi().get(vmURI), expected);
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyVm() { public void testEditVm() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId) .apiCommand("PUT", vmId)
.xmlFilePayload("/vm/modifyVm.xml", VCloudDirectorMediaType.VM) .xmlFilePayload("/vm/editVm.xml", VCloudDirectorMediaType.VM)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
@ -105,25 +105,25 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
modified.setName("new-name"); modified.setName("new-name");
modified.setDescription("New Description"); modified.setDescription("New Description");
Task expected = modifyVmTask(); Task expected = editVmTask();
assertEquals(api.getVmApi().modifyVm(vmURI, modified), expected); assertEquals(api.getVmApi().edit(vmURI, modified), expected);
} }
@Test(enabled = false) @Test(enabled = false)
public void testDeleteVm() { public void testRemoveVm() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("DELETE", vmId) .apiCommand("DELETE", vmId)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vm/deleteVmTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vm/removeVmTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
Task expected = deleteVmTask(); Task expected = removeVmTask();
assertEquals(api.getVmApi().deleteVm(vmURI), expected); assertEquals(api.getVmApi().remove(vmURI), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -139,7 +139,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
Task expected = consolidateVmTask(); Task expected = consolidateVmTask();
assertEquals(api.getVmApi().consolidateVm(vmURI), expected); assertEquals(api.getVmApi().consolidate(vmURI), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -211,7 +211,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
Task expected = relocateTask(); Task expected = relocateTask();
assertEquals(api.getVmApi().relocateVm(vmURI, params), expected); assertEquals(api.getVmApi().relocate(vmURI, params), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -363,23 +363,23 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyGuestCustomizationSection() { public void testEditGuestCustomizationSection() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/guestCustomizationSection") .apiCommand("PUT", vmId + "/guestCustomizationSection")
.xmlFilePayload("/vApp/modifyGuestCustomizationSection.xml", VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION) .xmlFilePayload("/vApp/editGuestCustomizationSection.xml", VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyGuestCustomizationSectionTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editGuestCustomizationSectionTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
GuestCustomizationSection section = getGuestCustomizationSection().toBuilder() GuestCustomizationSection section = getGuestCustomizationSection().toBuilder()
.build(); .build();
Task expected = modifyGuestCustomizationSectionTask(); Task expected = editGuestCustomizationSectionTask();
assertEquals(api.getVmApi().modifyGuestCustomizationSection(vmURI, section), expected); assertEquals(api.getVmApi().editGuestCustomizationSection(vmURI, section), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -439,23 +439,23 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyNetworkConnectionSection() { public void testEditNetworkConnectionSection() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/networkConnectionSection") .apiCommand("PUT", vmId + "/networkConnectionSection")
.xmlFilePayload("/vApp/modifyNetworkConnectionSection.xml", VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION) .xmlFilePayload("/vApp/editNetworkConnectionSection.xml", VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyNetworkConnectionSectionTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editNetworkConnectionSectionTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
NetworkConnectionSection section = getNetworkConnectionSection().toBuilder() NetworkConnectionSection section = getNetworkConnectionSection().toBuilder()
.build(); .build();
Task expected = modifyNetworkConnectionSectionTask(); Task expected = editNetworkConnectionSectionTask();
assertEquals(api.getVmApi().modifyNetworkConnectionSection(vmURI, section), expected); assertEquals(api.getVmApi().editNetworkConnectionSection(vmURI, section), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -475,23 +475,23 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyOperatingSystemSection() { public void testEditOperatingSystemSection() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/operatingSystemSection") .apiCommand("PUT", vmId + "/operatingSystemSection")
.xmlFilePayload("/vApp/modifyOperatingSystemSection.xml", VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION) .xmlFilePayload("/vApp/editOperatingSystemSection.xml", VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyOperatingSystemSectionTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editOperatingSystemSectionTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
OperatingSystemSection section = getOperatingSystemSection().toBuilder() OperatingSystemSection section = getOperatingSystemSection().toBuilder()
.build(); .build();
Task expected = modifyOperatingSystemSectionTask(); Task expected = editOperatingSystemSectionTask();
assertEquals(api.getVmApi().modifyOperatingSystemSection(vmURI, section), expected); assertEquals(api.getVmApi().editOperatingSystemSection(vmURI, section), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -511,20 +511,20 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyProductSections() { public void testEditProductSections() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/productSections") .apiCommand("PUT", vmId + "/productSections")
.xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST) .xmlFilePayload("/vApp/editProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.VAPP) .xmlFilePayload("/vApp/editProductSections.xml", VCloudDirectorMediaType.VAPP)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
Task expected = modifyProductSectionsTask(); Task expected = editProductSectionsTask();
assertEquals(api.getVmApi().modifyProductSections(vmURI, null), expected); assertEquals(api.getVmApi().editProductSections(vmURI, null), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -627,23 +627,23 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSection() { public void testEditVirtualHardwareSection() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/virtualHardwareSection") .apiCommand("PUT", vmId + "/virtualHardwareSection")
.xmlFilePayload("/vApp/modifyVirtualHardwareSection.xml", VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION) .xmlFilePayload("/vApp/editVirtualHardwareSection.xml", VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editVirtualHardwareSectionTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
VirtualHardwareSection section = getVirtualHardwareSection().toBuilder() VirtualHardwareSection section = getVirtualHardwareSection().toBuilder()
.build(); .build();
Task expected = modifyVirtualHardwareSectionTask(); Task expected = editVirtualHardwareSectionTask();
assertEquals(api.getVmApi().modifyVirtualHardwareSection(vmURI, section), expected); assertEquals(api.getVmApi().editVirtualHardwareSection(vmURI, section), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -663,23 +663,23 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSectionCpu() { public void testEditVirtualHardwareSectionCpu() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("", vmId + "/virtualHardwareSection/cpu") .apiCommand("", vmId + "/virtualHardwareSection/cpu")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM) .xmlFilePayload("/vApp/editVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionCpuTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editVirtualHardwareSectionCpuTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
RasdItem cpu = getVirtualHardwareSectionCpu(); // .toBuilder(); RasdItem cpu = getVirtualHardwareSectionCpu(); // .toBuilder();
// .build(); // .build();
Task expected = modifyVirtualHardwareSectionCpuTask(); Task expected = editVirtualHardwareSectionCpuTask();
assertEquals(api.getVmApi().modifyVirtualHardwareSectionCpu(vmURI, cpu), expected); assertEquals(api.getVmApi().editVirtualHardwareSectionCpu(vmURI, cpu), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -699,23 +699,23 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSectionDisks() { public void testEditVirtualHardwareSectionDisks() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/virtualHardwareSection/disks") .apiCommand("PUT", vmId + "/virtualHardwareSection/disks")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionDisks.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST) .xmlFilePayload("/vApp/editVirtualHardwareSectionDisks.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionDisksTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editVirtualHardwareSectionDisksTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
RasdItemsList disks = getVirtualHardwareSectionDisks().toBuilder() RasdItemsList disks = getVirtualHardwareSectionDisks().toBuilder()
.build(); .build();
Task expected = modifyVirtualHardwareSectionDisksTask(); Task expected = editVirtualHardwareSectionDisksTask();
assertEquals(api.getVmApi().modifyVirtualHardwareSectionDisks(vmURI, disks), expected); assertEquals(api.getVmApi().editVirtualHardwareSectionDisks(vmURI, disks), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -751,23 +751,23 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSectionMemory() { public void testEditVirtualHardwareSectionMemory() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/virtualHardwareSection/memory") .apiCommand("PUT", vmId + "/virtualHardwareSection/memory")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.VAPP) .xmlFilePayload("/vApp/editVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.VAPP)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionMemoryTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editVirtualHardwareSectionMemoryTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
RasdItem memory = getVirtualHardwareSectionCpu(); // .toBuilder(); RasdItem memory = getVirtualHardwareSectionCpu(); // .toBuilder();
// .build(); // .build();
Task expected = modifyVirtualHardwareSectionMemoryTask(); Task expected = editVirtualHardwareSectionMemoryTask();
assertEquals(api.getVmApi().modifyVirtualHardwareSectionMemory(vmURI, memory), expected); assertEquals(api.getVmApi().editVirtualHardwareSectionMemory(vmURI, memory), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -787,23 +787,23 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSectionNetworkCards() { public void testEditVirtualHardwareSectionNetworkCards() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/virtualHardwareSection/networkCards") .apiCommand("PUT", vmId + "/virtualHardwareSection/networkCards")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionNetworkCards.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST) .xmlFilePayload("/vApp/editVirtualHardwareSectionNetworkCards.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionNetworkCardsTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editVirtualHardwareSectionNetworkCardsTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
RasdItemsList networkCards = getVirtualHardwareSectionNetworkCards().toBuilder() RasdItemsList networkCards = getVirtualHardwareSectionNetworkCards().toBuilder()
.build(); .build();
Task expected = modifyVirtualHardwareSectionNetworkCardsTask(); Task expected = editVirtualHardwareSectionNetworkCardsTask();
assertEquals(api.getVmApi().modifyVirtualHardwareSectionNetworkCards(vmURI, networkCards), expected); assertEquals(api.getVmApi().editVirtualHardwareSectionNetworkCards(vmURI, networkCards), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -823,23 +823,23 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSectionSerialPorts() { public void testEditVirtualHardwareSectionSerialPorts() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vmId + "/virtualHardwareSection/serialPorts") .apiCommand("PUT", vmId + "/virtualHardwareSection/serialPorts")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionSerialPorts.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST) .xmlFilePayload("/vApp/editVirtualHardwareSectionSerialPorts.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionSerialPortsTask.xml", VCloudDirectorMediaType.TASK) .xmlFilePayload("/vApp/editVirtualHardwareSectionSerialPortsTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
RasdItemsList serialPorts = getVirtualHardwareSectionSerialPorts().toBuilder() RasdItemsList serialPorts = getVirtualHardwareSectionSerialPorts().toBuilder()
.build(); .build();
Task expected = modifyVirtualHardwareSectionSerialPortsTask(); Task expected = editVirtualHardwareSectionSerialPortsTask();
assertEquals(api.getVmApi().modifyVirtualHardwareSectionSerialPorts(vmURI, serialPorts), expected); assertEquals(api.getVmApi().editVirtualHardwareSectionSerialPorts(vmURI, serialPorts), expected);
} }
public static Vm getVm() { public static Vm getVm() {
@ -866,14 +866,14 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return vm; return vm;
} }
public static Task modifyVmTask() { public static Task editVmTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
return task; return task;
} }
public static Task deleteVmTask() { public static Task removeVmTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -999,7 +999,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyGuestCustomizationSectionTask() { public static Task editGuestCustomizationSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1013,7 +1013,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyLeaseSettingsSectionTask() { public static Task editLeaseSettingsSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1041,7 +1041,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyNetworkConfigSectionTask() { public static Task editNetworkConfigSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1055,7 +1055,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyNetworkConnectionSectionTask() { public static Task editNetworkConnectionSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1076,7 +1076,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyOperatingSystemSectionTask() { public static Task editOperatingSystemSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1090,7 +1090,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return owner; return owner;
} }
public static Task modifyOwnerTask() { public static Task editOwnerTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1104,7 +1104,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return sectionItems; return sectionItems;
} }
public static Task modifyProductSectionsTask() { public static Task editProductSectionsTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1152,7 +1152,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyStartupSectionTask() { public static Task editStartupSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1166,7 +1166,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return section; return section;
} }
public static Task modifyVirtualHardwareSectionTask() { public static Task editVirtualHardwareSectionTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1180,7 +1180,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return cpu; return cpu;
} }
public static Task modifyVirtualHardwareSectionCpuTask() { public static Task editVirtualHardwareSectionCpuTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1194,7 +1194,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return disks; return disks;
} }
public static Task modifyVirtualHardwareSectionDisksTask() { public static Task editVirtualHardwareSectionDisksTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1215,7 +1215,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return memory; return memory;
} }
public static Task modifyVirtualHardwareSectionMemoryTask() { public static Task editVirtualHardwareSectionMemoryTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1229,7 +1229,7 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return networkCards; return networkCards;
} }
public static Task modifyVirtualHardwareSectionNetworkCardsTask() { public static Task editVirtualHardwareSectionNetworkCardsTask() {
Task task = Task.builder() Task task = Task.builder()
.build(); .build();
@ -1243,11 +1243,11 @@ public class VmApiExpectTest extends VCloudDirectorAdminApiExpectTest {
return serialPorts; return serialPorts;
} }
public static Task modifyVirtualHardwareSectionSerialPortsTask() { public static Task editVirtualHardwareSectionSerialPortsTask() {
return task("id", "name", "description", "status", "operation", "operationName", "startTime"); return task("id", "name", "description", "status", "operation", "operationName", "startTime");
} }
/** Used by other methods to create a custom {@link Task} object. */ /** Used by other methods to add a custom {@link Task} object. */
private static Task task(String taskId, String name, String description, String status, String operation, String operationName, String startTime) { private static Task task(String taskId, String name, String description, String status, String operation, String operationName, String startTime) {
Task task = Task.builder() Task task = Task.builder()
.error(Error.builder().build()) .error(Error.builder().build())

View File

@ -109,7 +109,7 @@ import com.google.common.collect.Sets;
/** /**
* Tests behavior of the {@link VmApi}. * Tests behavior of the {@link VmApi}.
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VmApiLiveTest") @Test(groups = { "live", "user" }, singleThreaded = true, testName = "VmApiLiveTest")
@ -119,32 +119,28 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
private String key; private String key;
private boolean mediaCreated = false; private boolean mediaCreated = false;
private boolean testUserCreated = false; private boolean testUserCreated = false;
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
protected void setupRequiredEntities() { protected void setupRequiredEntities() {
Set<Link> links = vdcApi.get(vdcUrn).getLinks(); Set<Link> links = vdcApi.get(vdcUrn).getLinks();
if (mediaURI == null) { if (mediaURI == null) {
Predicate<Link> addMediaLink = and(relEquals(Link.Rel.ADD), typeEquals(VCloudDirectorMediaType.MEDIA)); Predicate<Link> addMediaLink = and(relEquals(Link.Rel.ADD), typeEquals(VCloudDirectorMediaType.MEDIA));
if (contains(links, addMediaLink)) { if (contains(links, addMediaLink)) {
Link addMedia = find(links, addMediaLink); Link addMedia = find(links, addMediaLink);
byte[] iso = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; byte[] iso = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
Media sourceMedia = Media.builder() Media sourceMedia = Media.builder().type(VCloudDirectorMediaType.MEDIA).name(name("media"))
.type(VCloudDirectorMediaType.MEDIA) .size(iso.length).imageType(Media.ImageType.ISO)
.name(name("media")) .description("Test media generated by VmApiLiveTest").build();
.size(iso.length) Media media = context.getApi().getMediaApi().addMedia(addMedia.getHref(), sourceMedia);
.imageType(Media.ImageType.ISO)
.description("Test media generated by VmApiLiveTest")
.build();
Media media = context.getApi().getMediaApi().createMedia(addMedia.getHref(), sourceMedia);
Link uploadLink = getFirst(getFirst(media.getFiles(), null).getLinks(), null); Link uploadLink = getFirst(getFirst(media.getFiles(), null).getLinks(), null);
context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso)); context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
media = context.getApi().getMediaApi().getMedia(media.getHref()); media = context.getApi().getMediaApi().getMedia(media.getHref());
if (media.getTasks().size() == 1) { if (media.getTasks().size() == 1) {
Task uploadTask = Iterables.getOnlyElement(media.getTasks()); Task uploadTask = Iterables.getOnlyElement(media.getTasks());
Checks.checkTask(uploadTask); Checks.checkTask(uploadTask);
@ -152,32 +148,31 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
assertTrue(retryTaskSuccess.apply(uploadTask), String.format(TASK_COMPLETE_TIMELY, "uploadTask")); assertTrue(retryTaskSuccess.apply(uploadTask), String.format(TASK_COMPLETE_TIMELY, "uploadTask"));
media = context.getApi().getMediaApi().getMedia(media.getHref()); media = context.getApi().getMediaApi().getMedia(media.getHref());
} }
mediaURI = media.getHref(); mediaURI = media.getHref();
mediaCreated = true; mediaCreated = true;
} }
} }
if (adminContext != null) { if (adminContext != null) {
Link orgLink = find(links, and(relEquals("up"), typeEquals(VCloudDirectorMediaType.ORG))); userUrn = adminContext.getApi().getUserApi().addUserToOrg(randomTestUser("VAppAccessTest"), org.getId())
userUrn = adminContext.getApi().getUserApi() .getId();
.createUserInOrg(randomTestUser("VAppAccessTest"), toAdminUri(orgLink)).getId();
} }
} }
@AfterClass(alwaysRun = true, dependsOnMethods = { "cleanUpEnvironment" }) @AfterClass(alwaysRun = true, dependsOnMethods = { "cleanUpEnvironment" })
public void cleanUp() { public void cleanUp() {
if (adminContext != null && mediaCreated && mediaURI != null) { if (adminContext != null && mediaCreated && mediaURI != null) {
try { try {
Task delete = context.getApi().getMediaApi().deleteMedia(mediaURI); Task remove = context.getApi().getMediaApi().removeMedia(mediaURI);
taskDoneEventually(delete); taskDoneEventually(remove);
} catch (Exception e) { } catch (Exception e) {
logger.warn("Error when deleting media: %s", e.getMessage()); logger.warn("Error when deleting media: %s", e.getMessage());
} }
} }
if (adminContext != null && testUserCreated && userUrn != null) { if (adminContext != null && testUserCreated && userUrn != null) {
try { try {
adminContext.getApi().getUserApi().delete(userUrn); adminContext.getApi().getUserApi().remove(userUrn);
} catch (Exception e) { } catch (Exception e) {
logger.warn("Error when deleting user: %s", e.getMessage()); logger.warn("Error when deleting user: %s", e.getMessage());
} }
@ -185,59 +180,57 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
} }
/** /**
* @see VmApi#getVm(URI) * @see VmApi#get(URI)
*/ */
@Test(description = "GET /vApp/{id}") @Test(description = "GET /vApp/{id}")
public void testGetVm() { public void testGetVm() {
// The method under test // The method under test
vm = vmApi.getVm(vmURI); vm = vmApi.get(vmURI);
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkVm(vm); checkVm(vm);
// Check the required fields are set // Check the required fields are set
assertEquals(vm.isDeployed(), Boolean.FALSE, String.format(OBJ_FIELD_EQ, VM, "deployed", "FALSE", vm.isDeployed().toString())); assertEquals(vm.isDeployed(), Boolean.FALSE,
String.format(OBJ_FIELD_EQ, VM, "deployed", "FALSE", vm.isDeployed().toString()));
// Check status // Check status
assertVmStatus(vm.getHref(), Status.POWERED_OFF); assertVmStatus(vm.getHref(), Status.POWERED_OFF);
} }
/** /**
* @see VmApi#modifyVm(URI, Vm) * @see VmApi#edit(URI, Vm)
*/ */
@Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVm" }) @Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVm" })
public void testModifyVm() { public void testEditVm() {
Vm newVm = Vm.builder() Vm newVm = Vm.builder().name(name("new-name-")).description("New Description").build();
.name(name("new-name-"))
.description("New Description")
.build();
// The method under test // The method under test
Task modifyVm = vmApi.modifyVm(vm.getHref(), newVm); Task editVm = vmApi.edit(vm.getHref(), newVm);
assertTrue(retryTaskSuccess.apply(modifyVm), String.format(TASK_COMPLETE_TIMELY, "modifyVm")); assertTrue(retryTaskSuccess.apply(editVm), String.format(TASK_COMPLETE_TIMELY, "editVm"));
// Get the updated Vm // Get the edited Vm
vm = vmApi.getVm(vm.getHref()); vm = vmApi.get(vm.getHref());
// Check the required fields are set // Check the required fields are set
assertEquals(vm.getName(), newVm.getName(), String.format(OBJ_FIELD_EQ, VM, "Name", newVm.getName(), vm.getName())); assertEquals(vm.getName(), newVm.getName(),
assertEquals(vm.getDescription(), newVm.getDescription(), String.format(OBJ_FIELD_EQ, VM, "Description", newVm.getDescription(), vm.getDescription())); String.format(OBJ_FIELD_EQ, VM, "Name", newVm.getName(), vm.getName()));
assertEquals(vm.getDescription(), newVm.getDescription(),
String.format(OBJ_FIELD_EQ, VM, "Description", newVm.getDescription(), vm.getDescription()));
} }
@Test(description = "POST /vApp/{id}/action/deploy", dependsOnMethods = { "testGetVm" }) @Test(description = "POST /vApp/{id}/action/deploy", dependsOnMethods = { "testGetVm" })
public void testDeployVm() { public void testDeployVm() {
DeployVAppParams params = DeployVAppParams.builder() DeployVAppParams params = DeployVAppParams.builder()
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)) .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
.notForceCustomization() .notPowerOn().build();
.notPowerOn()
.build();
// The method under test // The method under test
Task deployVm = vmApi.deploy(vm.getHref(), params); Task deployVm = vmApi.deploy(vm.getHref(), params);
assertTrue(retryTaskSuccessLong.apply(deployVm), String.format(TASK_COMPLETE_TIMELY, "deployVm")); assertTrue(retryTaskSuccessLong.apply(deployVm), String.format(TASK_COMPLETE_TIMELY, "deployVm"));
// Get the updated Vm // Get the edited Vm
vm = vmApi.getVm(vm.getHref()); vm = vmApi.get(vm.getHref());
// Check the required fields are set // Check the required fields are set
assertTrue(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VM, "deployed", "TRUE", vm.isDeployed().toString())); assertTrue(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VM, "deployed", "TRUE", vm.isDeployed().toString()));
@ -255,8 +248,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task powerOnVm = vmApi.powerOn(vm.getHref()); Task powerOnVm = vmApi.powerOn(vm.getHref());
assertTaskSucceedsLong(powerOnVm); assertTaskSucceedsLong(powerOnVm);
// Get the updated Vm // Get the edited Vm
vm = vmApi.getVm(vm.getHref()); vm = vmApi.get(vm.getHref());
// Check status // Check status
assertVmStatus(vm.getHref(), Status.POWERED_ON); assertVmStatus(vm.getHref(), Status.POWERED_ON);
@ -266,13 +259,13 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
public void testReboot() { public void testReboot() {
// Power on Vm // Power on Vm
vm = powerOnVm(vm.getHref()); vm = powerOnVm(vm.getHref());
// The method under test // The method under test
Task reboot = vmApi.reboot(vm.getHref()); Task reboot = vmApi.reboot(vm.getHref());
assertTaskSucceedsLong(reboot); assertTaskSucceedsLong(reboot);
// Get the updated Vm // Get the edited Vm
vm = vmApi.getVm(vm.getHref()); vm = vmApi.get(vm.getHref());
// Check status // Check status
assertVmStatus(vmURI, Status.POWERED_OFF); assertVmStatus(vmURI, Status.POWERED_OFF);
@ -287,8 +280,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task shutdown = vmApi.shutdown(vm.getHref()); Task shutdown = vmApi.shutdown(vm.getHref());
assertTaskSucceedsLong(shutdown); assertTaskSucceedsLong(shutdown);
// Get the updated Vm // Get the edited Vm
vm = vmApi.getVm(vm.getHref()); vm = vmApi.get(vm.getHref());
// Check status // Check status
assertVmStatus(vm.getHref(), Status.POWERED_OFF); assertVmStatus(vm.getHref(), Status.POWERED_OFF);
@ -303,8 +296,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task suspend = vmApi.suspend(vmURI); Task suspend = vmApi.suspend(vmURI);
assertTaskSucceedsLong(suspend); assertTaskSucceedsLong(suspend);
// Get the updated Vm // Get the edited Vm
vm = vmApi.getVm(vm.getHref()); vm = vmApi.get(vm.getHref());
// Check status // Check status
assertVmStatus(vmURI, Status.SUSPENDED); assertVmStatus(vmURI, Status.SUSPENDED);
@ -322,8 +315,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task reset = vmApi.reset(vmURI); Task reset = vmApi.reset(vmURI);
assertTaskSucceedsLong(reset); assertTaskSucceedsLong(reset);
// Get the updated Vm // Get the edited Vm
vm = vmApi.getVm(vm.getHref()); vm = vmApi.get(vm.getHref());
// Check status // Check status
assertVmStatus(vmURI, Status.POWERED_ON); assertVmStatus(vmURI, Status.POWERED_ON);
@ -340,8 +333,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task undeploy = vmApi.undeploy(vm.getHref(), params); Task undeploy = vmApi.undeploy(vm.getHref(), params);
assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy")); assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
// Get the updated Vm // Get the edited Vm
vm = vmApi.getVm(vm.getHref()); vm = vmApi.get(vm.getHref());
// Check status // Check status
assertFalse(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VM, "deployed", "FALSE", vm.isDeployed().toString())); assertFalse(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VM, "deployed", "FALSE", vm.isDeployed().toString()));
@ -352,14 +345,14 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
public void testPowerOffVm() { public void testPowerOffVm() {
// Power on Vm // Power on Vm
vm = powerOnVm(vm.getHref()); vm = powerOnVm(vm.getHref());
// The method under test // The method under test
// NB this will put the vm in partially powered off state // NB this will put the vm in partially powered off state
Task powerOffVm = vmApi.powerOff(vm.getHref()); Task powerOffVm = vmApi.powerOff(vm.getHref());
assertTrue(retryTaskSuccess.apply(powerOffVm), String.format(TASK_COMPLETE_TIMELY, "powerOffVm")); assertTrue(retryTaskSuccess.apply(powerOffVm), String.format(TASK_COMPLETE_TIMELY, "powerOffVm"));
// Get the updated Vm // Get the edited Vm
vm = vmApi.getVm(vmURI); vm = vmApi.get(vmURI);
// Check status // Check status
assertVmStatus(vmURI, Status.POWERED_OFF); assertVmStatus(vmURI, Status.POWERED_OFF);
@ -371,7 +364,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
vm = powerOnVm(vm.getHref()); vm = powerOnVm(vm.getHref());
// The method under test // The method under test
Task consolidateVm = vmApi.consolidateVm(vm.getHref()); Task consolidateVm = vmApi.consolidate(vm.getHref());
assertTrue(retryTaskSuccess.apply(consolidateVm), String.format(TASK_COMPLETE_TIMELY, "consolidateVm")); assertTrue(retryTaskSuccess.apply(consolidateVm), String.format(TASK_COMPLETE_TIMELY, "consolidateVm"));
} }
@ -379,16 +372,17 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
public void testDiscardSuspendedState() { public void testDiscardSuspendedState() {
// Suspend the Vm // Suspend the Vm
vm = suspendVm(vm.getHref()); vm = suspendVm(vm.getHref());
// The method under test // The method under test
Task discardSuspendedState = vmApi.discardSuspendedState(vm.getHref()); Task discardSuspendedState = vmApi.discardSuspendedState(vm.getHref());
assertTrue(retryTaskSuccess.apply(discardSuspendedState), String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState")); assertTrue(retryTaskSuccess.apply(discardSuspendedState),
String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
} }
@Test(description = "POST /vApp/{id}/action/installVMwareTools", dependsOnMethods = { "testDeployVm" }) @Test(description = "POST /vApp/{id}/action/installVMwareTools", dependsOnMethods = { "testDeployVm" })
public void testInstallVMwareTools() { public void testInstallVMwareTools() {
// First ensure the vApp is powered on // First ensure the vApp is powered on
vm = powerOnVm(vm.getHref()); vm = powerOnVm(vm.getHref());
// The method under test // The method under test
Task installVMwareTools = vmApi.installVMwareTools(vm.getHref()); Task installVMwareTools = vmApi.installVMwareTools(vm.getHref());
@ -401,10 +395,11 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
// Relocate to the last of the available datastores // Relocate to the last of the available datastores
QueryResultRecords records = context.getApi().getQueryApi().queryAll("datastore"); QueryResultRecords records = context.getApi().getQueryApi().queryAll("datastore");
QueryResultRecordType datastore = Iterables.getLast(records.getRecords()); QueryResultRecordType datastore = Iterables.getLast(records.getRecords());
RelocateParams params = RelocateParams.builder().datastore(Reference.builder().href(datastore.getHref()).build()).build(); RelocateParams params = RelocateParams.builder().datastore(Reference.builder().href(datastore.getHref()).build())
.build();
// The method under test // The method under test
Task relocate = vmApi.relocateVm(vm.getHref(), params); Task relocate = vmApi.relocate(vm.getHref(), params);
assertTrue(retryTaskSuccess.apply(relocate), String.format(TASK_COMPLETE_TIMELY, "relocate")); assertTrue(retryTaskSuccess.apply(relocate), String.format(TASK_COMPLETE_TIMELY, "relocate"));
} }
@ -415,8 +410,9 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
// The method under test // The method under test
Task upgradeHardwareVersion = vmApi.upgradeHardwareVersion(vm.getHref()); Task upgradeHardwareVersion = vmApi.upgradeHardwareVersion(vm.getHref());
assertTrue(retryTaskSuccess.apply(upgradeHardwareVersion), String.format(TASK_COMPLETE_TIMELY, "upgradeHardwareVersion")); assertTrue(retryTaskSuccess.apply(upgradeHardwareVersion),
String.format(TASK_COMPLETE_TIMELY, "upgradeHardwareVersion"));
// Power on the Vm again // Power on the Vm again
vm = powerOnVm(vm.getHref()); vm = powerOnVm(vm.getHref());
} }
@ -432,18 +428,17 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" }) @Test(description = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" })
public void testModifyGuestCustomizationSection() { public void testEditGuestCustomizationSection() {
// Copy existing section and update fields // Copy existing section and edit fields
GuestCustomizationSection oldSection = vmApi.getGuestCustomizationSection(vm.getHref()); GuestCustomizationSection oldSection = vmApi.getGuestCustomizationSection(vm.getHref());
GuestCustomizationSection newSection = oldSection.toBuilder() GuestCustomizationSection newSection = oldSection.toBuilder().computerName(name("n")).enabled(Boolean.TRUE)
.computerName(name("n")) .adminPassword(null) // Not allowed
.enabled(Boolean.TRUE) .build();
.adminPassword(null) // Not allowed
.build();
// The method under test // The method under test
Task modifyGuestCustomizationSection = vmApi.modifyGuestCustomizationSection(vm.getHref(), newSection); Task editGuestCustomizationSection = vmApi.editGuestCustomizationSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyGuestCustomizationSection), String.format(TASK_COMPLETE_TIMELY, "modifyGuestCustomizationSection")); assertTrue(retryTaskSuccess.apply(editGuestCustomizationSection),
String.format(TASK_COMPLETE_TIMELY, "editGuestCustomizationSection"));
// Retrieve the modified section // Retrieve the modified section
GuestCustomizationSection modified = vmApi.getGuestCustomizationSection(vm.getHref()); GuestCustomizationSection modified = vmApi.getGuestCustomizationSection(vm.getHref());
@ -462,13 +457,13 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "GuestCustomizationSection")); assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "GuestCustomizationSection"));
} }
// FIXME "Error: The requested operation on media "com.vmware.vcloud.entity.media:abfcb4b7-809f-4b50-a0aa-8c97bf09a5b0" is not supported in the current state." // FIXME
// "Error: The requested operation on media "com.vmware.vcloud.entity.media:abfcb4b7-809f-4b50-a0aa-8c97bf09a5b0" is not supported in the current state."
@Test(description = "PUT /vApp/{id}/media/action/insertMedia", dependsOnMethods = { "testGetVm" }) @Test(description = "PUT /vApp/{id}/media/action/insertMedia", dependsOnMethods = { "testGetVm" })
public void testInsertMedia() { public void testInsertMedia() {
// Setup media params from configured media id // Setup media params from configured media id
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder() MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
.media(Reference.builder().href(mediaURI).type(MEDIA).build()) .media(Reference.builder().href(mediaURI).type(MEDIA).build()).build();
.build();
// The method under test // The method under test
Task insertMedia = vmApi.insertMedia(vm.getHref(), params); Task insertMedia = vmApi.insertMedia(vm.getHref(), params);
@ -479,8 +474,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
public void testEjectMedia() { public void testEjectMedia() {
// Setup media params from configured media id // Setup media params from configured media id
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder() MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
.media(Reference.builder().href(mediaURI).type(MEDIA).build()) .media(Reference.builder().href(mediaURI).type(MEDIA).build()).build();
.build();
// The method under test // The method under test
Task ejectMedia = vmApi.ejectMedia(vm.getHref(), params); Task ejectMedia = vmApi.ejectMedia(vm.getHref(), params);
@ -498,25 +492,25 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
} }
// FIXME "Task error: Unable to perform this action. Contact your cloud administrator." // FIXME "Task error: Unable to perform this action. Contact your cloud administrator."
@Test(description = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testModifyGuestCustomizationSection" }) @Test(description = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testEditGuestCustomizationSection" })
public void testModifyNetworkConnectionSection() { public void testEditNetworkConnectionSection() {
powerOffVm(vm.getHref()); powerOffVm(vm.getHref());
// Look up a network in the Vdc // Look up a network in the Vdc
Set<Reference> networks = vdc.getAvailableNetworks(); Set<Reference> networks = vdc.getAvailableNetworks();
Reference network = Iterables.getLast(networks); Reference network = Iterables.getLast(networks);
// Copy existing section and update fields // Copy existing section and edit fields
NetworkConnectionSection oldSection = vmApi.getNetworkConnectionSection(vm.getHref()); NetworkConnectionSection oldSection = vmApi.getNetworkConnectionSection(vm.getHref());
NetworkConnectionSection newSection = oldSection.toBuilder() NetworkConnectionSection newSection = oldSection
.networkConnection(NetworkConnection.builder() .toBuilder()
.ipAddressAllocationMode(IpAddressAllocationMode.DHCP.toString()) .networkConnection(
.network(network.getName()) NetworkConnection.builder().ipAddressAllocationMode(IpAddressAllocationMode.DHCP.toString())
.build()) .network(network.getName()).build()).build();
.build();
// The method under test // The method under test
Task modifyNetworkConnectionSection = vmApi.modifyNetworkConnectionSection(vm.getHref(), newSection); Task editNetworkConnectionSection = vmApi.editNetworkConnectionSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyNetworkConnectionSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConnectionSection")); assertTrue(retryTaskSuccess.apply(editNetworkConnectionSection),
String.format(TASK_COMPLETE_TIMELY, "editNetworkConnectionSection"));
// Retrieve the modified section // Retrieve the modified section
NetworkConnectionSection modified = vmApi.getNetworkConnectionSection(vm.getHref()); NetworkConnectionSection modified = vmApi.getNetworkConnectionSection(vm.getHref());
@ -540,18 +534,19 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
checkOperatingSystemSection(section); checkOperatingSystemSection(section);
} }
@Test(description = "PUT /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetOperatingSystemSection", "testModifyVirtualHardwareSection" }) @Test(description = "PUT /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetOperatingSystemSection",
public void testModifyOperatingSystemSection() { "testEditVirtualHardwareSection" })
public void testEditOperatingSystemSection() {
// Create new OperatingSystemSection // Create new OperatingSystemSection
OperatingSystemSection newSection = OperatingSystemSection.builder() OperatingSystemSection newSection = OperatingSystemSection.builder().info("") // NOTE Required
.info("") // NOTE Required OVF field, ignored // OVF field,
.id(OSType.RHEL_64.getCode()) // ignored
.osType("rhel5_64Guest") .id(OSType.RHEL_64.getCode()).osType("rhel5_64Guest").build();
.build();
// The method under test // The method under test
Task modifyOperatingSystemSection = vmApi.modifyOperatingSystemSection(vm.getHref(), newSection); Task editOperatingSystemSection = vmApi.editOperatingSystemSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyOperatingSystemSection), String.format(TASK_COMPLETE_TIMELY, "modifyOperatingSystemSection")); assertTrue(retryTaskSuccess.apply(editOperatingSystemSection),
String.format(TASK_COMPLETE_TIMELY, "editOperatingSystemSection"));
// Retrieve the modified section // Retrieve the modified section
OperatingSystemSection modified = vmApi.getOperatingSystemSection(vm.getHref()); OperatingSystemSection modified = vmApi.getOperatingSystemSection(vm.getHref());
@ -573,23 +568,24 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" }) @Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
public void testModifyProductSections() { public void testEditProductSections() {
powerOffVm(vm.getHref()); powerOffVm(vm.getHref());
// Copy existing section and update fields // Copy existing section and edit fields
ProductSectionList oldSections = vmApi.getProductSections(vm.getHref()); ProductSectionList oldSections = vmApi.getProductSections(vm.getHref());
ProductSectionList newSections = oldSections.toBuilder() ProductSectionList newSections = oldSections
.productSection(ProductSection.builder() .toBuilder()
.info("Information about the installed software") // Default ovf:Info text .productSection(
.required() ProductSection.builder().info("Information about the installed software")
.product(MsgType.builder().value("jclouds").build()) // Default ovf:Info text
.vendor(MsgType.builder().value("jclouds Inc.").build()) .required().product(MsgType.builder().value("jclouds").build())
// NOTE other ProductSection elements not returned by vCloud .vendor(MsgType.builder().value("jclouds Inc.").build())
.build()) // NOTE other ProductSection elements not returned by vCloud
.build(); .build()).build();
// The method under test // The method under test
Task modifyProductSections = vmApi.modifyProductSections(vm.getHref(), newSections); Task editProductSections = vmApi.editProductSections(vm.getHref(), newSections);
assertTrue(retryTaskSuccess.apply(modifyProductSections), String.format(TASK_COMPLETE_TIMELY, "modifyProductSections")); assertTrue(retryTaskSuccess.apply(editProductSections),
String.format(TASK_COMPLETE_TIMELY, "editProductSections"));
// Retrieve the modified section // Retrieve the modified section
ProductSectionList modified = vmApi.getProductSections(vm.getHref()); ProductSectionList modified = vmApi.getProductSections(vm.getHref());
@ -627,13 +623,11 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
VmPendingQuestion question = vmApi.getPendingQuestion(vm.getHref()); VmPendingQuestion question = vmApi.getPendingQuestion(vm.getHref());
List<VmQuestionAnswerChoice> answerChoices = question.getChoices(); List<VmQuestionAnswerChoice> answerChoices = question.getChoices();
VmQuestionAnswerChoice answerChoice = Iterables.getFirst(answerChoices, null); VmQuestionAnswerChoice answerChoice = Iterables.getFirst(answerChoices, null);
assertNotNull(answerChoice, "Question "+question+" must have at least once answer-choice"); assertNotNull(answerChoice, "Question " + question + " must have at least once answer-choice");
VmQuestionAnswer answer = VmQuestionAnswer.builder() VmQuestionAnswer answer = VmQuestionAnswer.builder().choiceId(answerChoice.getId())
.choiceId(answerChoice.getId()) .questionId(question.getQuestionId()).build();
.questionId(question.getQuestionId())
.build();
vmApi.answerQuestion(vm.getHref(), answer); vmApi.answerQuestion(vm.getHref(), answer);
} }
@ -651,7 +645,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
public void testGetScreenImage() { public void testGetScreenImage() {
// Power on Vm // Power on Vm
vm = powerOnVm(vm.getHref()); vm = powerOnVm(vm.getHref());
// The method under test // The method under test
byte[] image = vmApi.getScreenImage(vm.getHref()); byte[] image = vmApi.getScreenImage(vm.getHref());
@ -660,7 +654,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
assertNotNull(image); assertNotNull(image);
assertTrue(image.length > pngHeaderBytes.length); assertTrue(image.length > pngHeaderBytes.length);
for (int i = 0; i < pngHeaderBytes.length; i++) { for (int i = 0; i < pngHeaderBytes.length; i++) {
assertEquals(image[i], pngHeaderBytes[i], String.format("Image differs from PNG format at byte %d of header", i)); assertEquals(image[i], pngHeaderBytes[i],
String.format("Image differs from PNG format at byte %d of header", i));
} }
} }
@ -668,7 +663,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
public void testGetScreenTicket() { public void testGetScreenTicket() {
// Power on Vm // Power on Vm
vm = powerOnVm(vm.getHref()); vm = powerOnVm(vm.getHref());
// The method under test // The method under test
ScreenTicket ticket = vmApi.getScreenTicket(vm.getHref()); ScreenTicket ticket = vmApi.getScreenTicket(vm.getHref());
@ -686,33 +681,31 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVirtualHardwareSection" }) @Test(description = "PUT /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVirtualHardwareSection" })
public void testModifyVirtualHardwareSection() { public void testEditVirtualHardwareSection() {
// Power off Vm // Power off Vm
vm = powerOffVm(vm.getHref()); vm = powerOffVm(vm.getHref());
// Copy existing section and update fields // Copy existing section and edit fields
VirtualHardwareSection oldSection = vmApi.getVirtualHardwareSection(vm.getHref()); VirtualHardwareSection oldSection = vmApi.getVirtualHardwareSection(vm.getHref());
Set<? extends ResourceAllocationSettingData> oldItems = oldSection.getItems(); Set<? extends ResourceAllocationSettingData> oldItems = oldSection.getItems();
Set<ResourceAllocationSettingData> newItems = Sets.newLinkedHashSet(oldItems); Set<ResourceAllocationSettingData> newItems = Sets.newLinkedHashSet(oldItems);
ResourceAllocationSettingData oldMemory = Iterables.find(oldItems, new Predicate<ResourceAllocationSettingData>() { ResourceAllocationSettingData oldMemory = Iterables.find(oldItems,
@Override new Predicate<ResourceAllocationSettingData>() {
public boolean apply(ResourceAllocationSettingData rasd) { @Override
return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY; public boolean apply(ResourceAllocationSettingData rasd) {
} return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
}); }
ResourceAllocationSettingData newMemory = oldMemory.toBuilder() });
.elementName("1024 MB of memory") ResourceAllocationSettingData newMemory = oldMemory.toBuilder().elementName("1024 MB of memory")
.virtualQuantity(new BigInteger("1024")) .virtualQuantity(new BigInteger("1024")).build();
.build();
newItems.remove(oldMemory); newItems.remove(oldMemory);
newItems.add(newMemory); newItems.add(newMemory);
VirtualHardwareSection newSection = oldSection.toBuilder() VirtualHardwareSection newSection = oldSection.toBuilder().items(newItems).build();
.items(newItems)
.build();
// The method under test // The method under test
Task modifyVirtualHardwareSection = vmApi.modifyVirtualHardwareSection(vm.getHref(), newSection); Task editVirtualHardwareSection = vmApi.editVirtualHardwareSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSection), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSection")); assertTrue(retryTaskSuccess.apply(editVirtualHardwareSection),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSection"));
// Retrieve the modified section // Retrieve the modified section
VirtualHardwareSection modifiedSection = vmApi.getVirtualHardwareSection(vm.getHref()); VirtualHardwareSection modifiedSection = vmApi.getVirtualHardwareSection(vm.getHref());
@ -722,12 +715,12 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
// Check the modified section fields are set correctly // Check the modified section fields are set correctly
ResourceAllocationSettingData modifiedMemory = Iterables.find(modifiedSection.getItems(), ResourceAllocationSettingData modifiedMemory = Iterables.find(modifiedSection.getItems(),
new Predicate<ResourceAllocationSettingData>() { new Predicate<ResourceAllocationSettingData>() {
@Override @Override
public boolean apply(ResourceAllocationSettingData rasd) { public boolean apply(ResourceAllocationSettingData rasd) {
return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY; return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
} }
}); });
assertEquals(modifiedMemory.getVirtualQuantity(), new BigInteger("1024")); assertEquals(modifiedMemory.getVirtualQuantity(), new BigInteger("1024"));
assertEquals(modifiedMemory, newMemory); assertEquals(modifiedMemory, newMemory);
assertEquals(modifiedSection, newSection); assertEquals(modifiedSection, newSection);
@ -743,27 +736,26 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" }) @Test(description = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" })
public void testModifyVirtualHardwareSectionCpu() { public void testEditVirtualHardwareSectionCpu() {
// Copy existing section and update fields // Copy existing section and edit fields
RasdItem oldItem = vmApi.getVirtualHardwareSectionCpu(vm.getHref()); RasdItem oldItem = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
RasdItem newItem = oldItem.toBuilder() RasdItem newItem = oldItem.toBuilder().elementName("2 virtual CPU(s)").virtualQuantity(new BigInteger("2"))
.elementName("2 virtual CPU(s)") .build();
.virtualQuantity(new BigInteger("2"))
.build();
// Method under test // Method under test
Task modifyVirtualHardwareSectionCpu = vmApi.modifyVirtualHardwareSectionCpu(vm.getHref(), newItem); Task editVirtualHardwareSectionCpu = vmApi.editVirtualHardwareSectionCpu(vm.getHref(), newItem);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu")); assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionCpu),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionCpu"));
// Retrieve the modified section // Retrieve the modified section
RasdItem modified = vmApi.getVirtualHardwareSectionCpu(vm.getHref()); RasdItem modified = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
// Check the retrieved object // Check the retrieved object
checkResourceAllocationSettingData(modified); checkResourceAllocationSettingData(modified);
// Check modified item // Check modified item
assertEquals(modified.getVirtualQuantity(), new BigInteger("2"), assertEquals(modified.getVirtualQuantity(), new BigInteger("2"), String.format(OBJ_FIELD_EQ,
String.format(OBJ_FIELD_EQ, "ResourceAllocationSettingData", "VirtualQuantity", "2", modified.getVirtualQuantity().toString())); "ResourceAllocationSettingData", "VirtualQuantity", "2", modified.getVirtualQuantity().toString()));
assertEquals(modified, newItem); assertEquals(modified, newItem);
} }
@ -777,39 +769,44 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSectionDisks" }) @Test(description = "PUT /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSectionDisks" })
public void testModifyVirtualHardwareSectionDisks() { public void testEditVirtualHardwareSectionDisks() {
// Copy the existing items list and modify the name of an item // Copy the existing items list and edit the name of an item
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionDisks(vm.getHref()); RasdItemsList oldSection = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
RasdItemsList newSection = oldSection.toBuilder().build(); RasdItemsList newSection = oldSection.toBuilder().build();
// Method under test // Method under test
Task modifyVirtualHardwareSectionDisks = vmApi.modifyVirtualHardwareSectionDisks(vm.getHref(), newSection); Task editVirtualHardwareSectionDisks = vmApi.editVirtualHardwareSectionDisks(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionDisks), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionDisks")); assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionDisks),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionDisks"));
// Retrieve the modified section // Retrieve the modified section
RasdItemsList modified = vmApi.getVirtualHardwareSectionDisks(vm.getHref()); RasdItemsList modified = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkRasdItemsList(modified); checkRasdItemsList(modified);
// TODO What is modifiable? What can we change, so we can assert the change took effect? // TODO What is modifiable? What can we change, so we can assert the change took effect?
// I tried changing "elementName" of one of the items, but it continued to have the old value when looked up post-modify. // I tried changing "elementName" of one of the items, but it continued to have the old value
// when looked up post-edit.
// //
// List<ResourceAllocationSettingData> newItems = new ArrayList<ResourceAllocationSettingData>(oldSection.getItems()); // List<ResourceAllocationSettingData> newItems = new
// ArrayList<ResourceAllocationSettingData>(oldSection.getItems());
// ResourceAllocationSettingData item0 = newItems.get(0); // ResourceAllocationSettingData item0 = newItems.get(0);
// String item0InstanceId = item0.getInstanceID().getValue(); // String item0InstanceId = item0.getInstanceID().getValue();
// String item0ElementName = item0.getElementName().getValue()+"-"+random.nextInt(Integer.MAX_VALUE); // String item0ElementName =
// item0.getElementName().getValue()+"-"+random.nextInt(Integer.MAX_VALUE);
// newItems.set(0, item0.toBuilder().elementName(newCimString(item0ElementName)).build()); // newItems.set(0, item0.toBuilder().elementName(newCimString(item0ElementName)).build());
// RasdItemsList newSection = oldSection.toBuilder() // RasdItemsList newSection = oldSection.toBuilder()
// .items(newItems) // .items(newItems)
// .build(); // .build();
// ... // ...
// long weight = random.nextInt(Integer.MAX_VALUE); // long weight = random.nextInt(Integer.MAX_VALUE);
// ResourceAllocationSettingData newSection = origSection.toBuilder() // ResourceAllocationSettingData newSection = origSection.toBuilder()
// .weight(newCimUnsignedInt(weight)) // .weight(newCimUnsignedInt(weight))
// .build(); // .build();
// ... // ...
// checkHasMatchingItem("virtualHardwareSection/disk", modified, item0InstanceId, item0ElementName); // checkHasMatchingItem("virtualHardwareSection/disk", modified, item0InstanceId,
// item0ElementName);
} }
@Test(description = "GET /vApp/{id}/virtualHardwareSection/media", dependsOnMethods = { "testGetVirtualHardwareSection" }) @Test(description = "GET /vApp/{id}/virtualHardwareSection/media", dependsOnMethods = { "testGetVirtualHardwareSection" })
@ -831,26 +828,25 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" }) @Test(description = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" })
public void testModifyVirtualHardwareSectionMemory() { public void testEditVirtualHardwareSectionMemory() {
RasdItem origItem = vmApi.getVirtualHardwareSectionMemory(vm.getHref()); RasdItem origItem = vmApi.getVirtualHardwareSectionMemory(vm.getHref());
RasdItem newItem = origItem.toBuilder() RasdItem newItem = origItem.toBuilder().elementName("1024 MB of memory").virtualQuantity(new BigInteger("1024"))
.elementName("1024 MB of memory") .build();
.virtualQuantity(new BigInteger("1024"))
.build();
// Method under test // Method under test
Task modifyVirtualHardwareSectionMemory = vmApi.modifyVirtualHardwareSectionMemory(vm.getHref(), newItem); Task editVirtualHardwareSectionMemory = vmApi.editVirtualHardwareSectionMemory(vm.getHref(), newItem);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionMemory), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionMemory")); assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionMemory),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionMemory"));
// Retrieve the modified section // Retrieve the modified section
RasdItem modified = vmApi.getVirtualHardwareSectionMemory(vm.getHref()); RasdItem modified = vmApi.getVirtualHardwareSectionMemory(vm.getHref());
// Check the retrieved object // Check the retrieved object
checkResourceAllocationSettingData(modified); checkResourceAllocationSettingData(modified);
// Check modified item // Check modified item
assertEquals(modified.getVirtualQuantity(), new BigInteger("1024"), assertEquals(modified.getVirtualQuantity(), new BigInteger("1024"), String.format(OBJ_FIELD_EQ,
String.format(OBJ_FIELD_EQ, "ResourceAllocationSettingData", "VirtualQuantity", "1024", modified.getVirtualQuantity().toString())); "ResourceAllocationSettingData", "VirtualQuantity", "1024", modified.getVirtualQuantity().toString()));
assertEquals(modified, newItem); assertEquals(modified, newItem);
} }
@ -864,23 +860,26 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSectionNetworkCards" }) @Test(description = "PUT /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSectionNetworkCards" })
public void testModifyVirtualHardwareSectionNetworkCards() { public void testEditVirtualHardwareSectionNetworkCards() {
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref()); RasdItemsList oldSection = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
RasdItemsList newSection = oldSection.toBuilder().build(); RasdItemsList newSection = oldSection.toBuilder().build();
// Method under test // Method under test
Task modifyVirtualHardwareSectionNetworkCards = vmApi.modifyVirtualHardwareSectionNetworkCards(vm.getHref(), newSection); Task editVirtualHardwareSectionNetworkCards = vmApi.editVirtualHardwareSectionNetworkCards(vm.getHref(),
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionNetworkCards), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionNetworkCards")); newSection);
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionNetworkCards),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionNetworkCards"));
// Retrieve the modified section // Retrieve the modified section
RasdItemsList modified = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref()); RasdItemsList modified = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkRasdItemsList(modified); checkRasdItemsList(modified);
// TODO What is modifiable? What can we change, so we can assert the change took effect? // TODO What is modifiable? What can we change, so we can assert the change took effect?
// I tried changing "elementName" of one of the items, but it continued to have the old value when looked up post-modify. // I tried changing "elementName" of one of the items, but it continued to have the old value
// See the description in testModifyVirtualHardwareSectionDisks // when looked up post-edit.
// See the description in testEditVirtualHardwareSectionDisks
} }
@Test(description = "GET /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSection" }) @Test(description = "GET /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSection" })
@ -893,23 +892,26 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
} }
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSectionSerialPorts" }) @Test(description = "PUT /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSectionSerialPorts" })
public void testModifyVirtualHardwareSectionSerialPorts() { public void testEditVirtualHardwareSectionSerialPorts() {
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref()); RasdItemsList oldSection = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
RasdItemsList newSection = oldSection.toBuilder().build(); RasdItemsList newSection = oldSection.toBuilder().build();
// Method under test // Method under test
Task modifyVirtualHardwareSectionSerialPorts = vmApi.modifyVirtualHardwareSectionSerialPorts(vm.getHref(), newSection); Task editVirtualHardwareSectionSerialPorts = vmApi
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionSerialPorts), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionSerialPorts")); .editVirtualHardwareSectionSerialPorts(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionSerialPorts),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionSerialPorts"));
// Retrieve the modified section // Retrieve the modified section
RasdItemsList modified = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref()); RasdItemsList modified = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkRasdItemsList(modified); checkRasdItemsList(modified);
// TODO What is modifiable? What can we change, so we can assert the change took effect? // TODO What is modifiable? What can we change, so we can assert the change took effect?
// I tried changing "elementName" of one of the items, but it continued to have the old value when looked up post-modify. // I tried changing "elementName" of one of the items, but it continued to have the old value
// See the description in testModifyVirtualHardwareSectionDisks // when looked up post-edit.
// See the description in testEditVirtualHardwareSectionDisks
} }
@Test(description = "PUT /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetVm" }) @Test(description = "PUT /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetVm" })
@ -925,41 +927,43 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkMetadataValueFor(VM, newMetadataValue, value); checkMetadataValueFor(VM, newMetadataValue, value);
} }
@Test(description = "GET /vApp/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" }) @Test(description = "GET /vApp/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" })
public void testGetMetadata() { public void testGetMetadata() {
// Call the method being tested // Call the method being tested
Metadata metadata = vmApi.getMetadataApi().get(vm.getHref()); Metadata metadata = vmApi.getMetadataApi().get(vm.getHref());
checkMetadata(metadata); checkMetadata(metadata);
// Check requirements for this test // Check requirements for this test
assertTrue(Iterables.isEmpty(metadata.getMetadataEntries()), String.format(NOT_EMPTY_OBJECT_FMT, "MetadataEntry", "vm")); assertTrue(Iterables.isEmpty(metadata.getMetadataEntries()),
String.format(NOT_EMPTY_OBJECT_FMT, "MetadataEntry", "vm"));
} }
@Test(description = "GET /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" }) @Test(description = "GET /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
public void testGetOrgMetadataValue() { public void testGetOrgMetadataValue() {
key = name("key-"); key = name("key-");
String value = name("value-"); String value = name("value-");
metadataValue = MetadataValue.builder().value(value).build(); metadataValue = MetadataValue.builder().value(value).build();
vmApi.getMetadataApi().putEntry(vm.getHref(), key, metadataValue); vmApi.getMetadataApi().putEntry(vm.getHref(), key, metadataValue);
// Call the method being tested // Call the method being tested
MetadataValue metadataValue = vmApi.getMetadataApi().getValue(vm.getHref(), key); MetadataValue metadataValue = vmApi.getMetadataApi().getValue(vm.getHref(), key);
String expected = metadataValue.getValue(); String expected = metadataValue.getValue();
checkMetadataValue(metadataValue); checkMetadataValue(metadataValue);
assertEquals(metadataValue.getValue(), expected, String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", expected, metadataValue.getValue())); assertEquals(metadataValue.getValue(), expected,
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", expected, metadataValue.getValue()));
} }
@Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }) @Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
public void testDeleteMetadataEntry() { public void testRemoveMetadataEntry() {
// Delete the entry // Delete the entry
Task task = vmApi.getMetadataApi().deleteEntry(vm.getHref(), key); Task task = vmApi.getMetadataApi().removeEntry(vm.getHref(), key);
retryTaskSuccess.apply(task); retryTaskSuccess.apply(task);
// Confirm the entry has been deleted // Confirm the entry has been removed
Metadata newMetadata = vmApi.getMetadataApi().get(vm.getHref()); Metadata newMetadata = vmApi.getMetadataApi().get(vm.getHref());
// Check the retrieved object is well formed // Check the retrieved object is well formed
@ -971,59 +975,53 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Metadata oldMetadata = vmApi.getMetadataApi().get(vm.getHref()); Metadata oldMetadata = vmApi.getMetadataApi().get(vm.getHref());
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata); Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
// Store a value, to be deleted // Store a value, to be removed
String key = name("key-"); String key = name("key-");
String value = name("value-"); String value = name("value-");
Metadata addedMetadata = Metadata.builder() Metadata addedMetadata = Metadata.builder().entry(MetadataEntry.builder().key(key).value(value).build()).build();
.entry(MetadataEntry.builder().key(key).value(value).build())
.build();
Task task = vmApi.getMetadataApi().merge(vm.getHref(), addedMetadata); Task task = vmApi.getMetadataApi().merge(vm.getHref(), addedMetadata);
retryTaskSuccess.apply(task); retryTaskSuccess.apply(task);
// Confirm the entry contains everything that was there, and everything that was being added // Confirm the entry contains everything that was there, and everything that was being added
Metadata newMetadata = vmApi.getMetadataApi().get(vm.getHref()); Metadata newMetadata = vmApi.getMetadataApi().get(vm.getHref());
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String>builder() Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
.putAll(oldMetadataMap) .put(key, value).build();
.put(key, value)
.build();
// Check the retrieved object is well formed // Check the retrieved object is well formed
checkMetadataFor(VM, newMetadata, expectedMetadataMap); checkMetadataFor(VM, newMetadata, expectedMetadataMap);
} }
/** /**
* @see VmApi#deleteVm(URI) * @see VmApi#remove(URI)
*/ */
@Test(description = "DELETE /vApp/{id}") @Test(description = "DELETE /vApp/{id}")
public void testDeleteVm() { public void testRemoveVm() {
// Create a temporary VApp to delete // Create a temporary VApp to remove
VApp delete = instantiateVApp(); VApp remove = instantiateVApp();
DeployVAppParams params = DeployVAppParams.builder() DeployVAppParams params = DeployVAppParams.builder()
.deploymentLeaseSeconds((int)TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)) .deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
.notForceCustomization() .powerOn().build();
.powerOn() Task deployVApp = vAppApi.deploy(remove.getHref(), params);
.build();
Task deployVApp = vAppApi.deploy(delete.getHref(), params);
assertTaskSucceedsLong(deployVApp); assertTaskSucceedsLong(deployVApp);
// Get the updated VApp and the Vm // Get the edited VApp and the Vm
delete = vAppApi.getVApp(delete.getHref()); remove = vAppApi.getVApp(remove.getHref());
List<Vm> vms = delete.getChildren().getVms(); List<Vm> vms = remove.getChildren().getVms();
Vm temp = Iterables.get(vms, 0); Vm temp = Iterables.get(vms, 0);
// otherwise it's impossible to stop a running vApp with no vms // otherwise it's impossible to stop a running vApp with no vms
if(vms.size() == 1) { if (vms.size() == 1) {
UndeployVAppParams undeployParams = UndeployVAppParams.builder().build(); UndeployVAppParams undeployParams = UndeployVAppParams.builder().build();
Task shutdownVapp = vAppApi.undeploy(delete.getHref(), undeployParams); Task shutdownVapp = vAppApi.undeploy(remove.getHref(), undeployParams);
assertTaskSucceedsLong(shutdownVapp); assertTaskSucceedsLong(shutdownVapp);
} else { } else {
powerOffVm(temp.getHref()); powerOffVm(temp.getHref());
} }
// The method under test // The method under test
Task deleteVm = vmApi.deleteVm(temp.getHref()); Task removeVm = vmApi.remove(temp.getHref());
assertTrue(retryTaskSuccess.apply(deleteVm), String.format(TASK_COMPLETE_TIMELY, "deleteVm")); assertTrue(retryTaskSuccess.apply(removeVm), String.format(TASK_COMPLETE_TIMELY, "removeVm"));
Vm deleted = vmApi.getVm(temp.getHref()); Vm removed = vmApi.get(temp.getHref());
assertNull(deleted, "The Vm "+temp.getName()+" should have been deleted"); assertNull(removed, "The Vm " + temp.getName() + " should have been removed");
} }
} }

View File

@ -109,24 +109,24 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
static URI orgHref = URI.create(endpoint + "/org/" + org); static URI orgHref = URI.create(endpoint + "/org/" + org);
static URI orgAdminHref = URI.create(endpoint + "/admin/org/" + org); static URI orgAdminHref = URI.create(endpoint + "/admin/org/" + org);
HttpRequest create = HttpRequest.builder() HttpRequest add = HttpRequest.builder()
.method("POST") .method("POST")
.endpoint(orgAdminHref + "/catalogs") .endpoint(orgAdminHref + "/catalogs")
.addHeader("Accept", ADMIN_CATALOG) .addHeader("Accept", ADMIN_CATALOG)
.addHeader("x-vcloud-authorization", token) .addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token) .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/catalog/admin/createCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG)) .payload(payloadFromResourceWithContentType("/catalog/admin/addCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG))
.build(); .build();
HttpResponse createResponse = HttpResponse.builder() HttpResponse addResponse = HttpResponse.builder()
.statusCode(200) .statusCode(200)
.payload(payloadFromResourceWithContentType("/catalog/admin/createCatalog.xml", ADMIN_CATALOG + ";version=1.5")) .payload(payloadFromResourceWithContentType("/catalog/admin/addCatalog.xml", ADMIN_CATALOG + ";version=1.5"))
.build(); .build();
@Test @Test
public void testCreateCatalogHref() { public void testAddCatalogHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, create, createResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, add, addResponse);
assertEquals(api.getCatalogApi().createCatalogInOrg(createCatalogInOrgSource(), orgAdminHref), createCatalogInOrg()); assertEquals(api.getCatalogApi().addCatalogToOrg(addCatalogToOrgSource(), orgAdminHref), addCatalogToOrg());
} }
HttpRequest resolveOrg = HttpRequest.builder() HttpRequest resolveOrg = HttpRequest.builder()
@ -151,35 +151,35 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
.build(); .build();
@Test @Test
public void testCreateCatalogUrn() { public void testAddCatalogUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveOrg, resolveOrgResponse, create, createResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveOrg, resolveOrgResponse, add, addResponse);
assertEquals(api.getCatalogApi().createCatalogInOrg(createCatalogInOrgSource(), orgUrn), createCatalogInOrg()); assertEquals(api.getCatalogApi().addCatalogToOrg(addCatalogToOrgSource(), orgUrn), addCatalogToOrg());
} }
HttpRequest update = HttpRequest.builder() HttpRequest edit = HttpRequest.builder()
.method("PUT") .method("PUT")
.endpoint(catalogAdminHref) .endpoint(catalogAdminHref)
.addHeader("Accept", ADMIN_CATALOG) .addHeader("Accept", ADMIN_CATALOG)
.addHeader("x-vcloud-authorization", token) .addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token) .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/catalog/admin/updateCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG)) .payload(payloadFromResourceWithContentType("/catalog/admin/editCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG))
.build(); .build();
HttpResponse updateResponse = HttpResponse.builder() HttpResponse editResponse = HttpResponse.builder()
.statusCode(200) .statusCode(200)
.payload(payloadFromResourceWithContentType("/catalog/admin/updateCatalog.xml", ADMIN_CATALOG + ";version=1.5")) .payload(payloadFromResourceWithContentType("/catalog/admin/editCatalog.xml", ADMIN_CATALOG + ";version=1.5"))
.build(); .build();
@Test @Test
public void testUpdateCatalogHref() { public void testEditCatalogHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, update, updateResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, edit, editResponse);
assertEquals(api.getCatalogApi().update(catalogAdminHref, updateCatalog()), updateCatalog()); assertEquals(api.getCatalogApi().edit(catalogAdminHref, editCatalog()), editCatalog());
} }
@Test @Test
public void testUpdateCatalogUrn() { public void testEditCatalogUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveCatalog, resolveCatalogResponse, update, updateResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveCatalog, resolveCatalogResponse, edit, editResponse);
assertEquals(api.getCatalogApi().update(catalogUrn, updateCatalog()), updateCatalog()); assertEquals(api.getCatalogApi().edit(catalogUrn, editCatalog()), editCatalog());
} }
HttpRequest getOwner = HttpRequest.builder() HttpRequest getOwner = HttpRequest.builder()
@ -226,7 +226,7 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
.addHeader("Accept", "*/*") .addHeader("Accept", "*/*")
.addHeader("x-vcloud-authorization", token) .addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token) .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/catalog/admin/updateOwnerSource.xml", OWNER + ";version=1.5")) .payload(payloadFromResourceWithContentType("/catalog/admin/editOwnerSource.xml", OWNER + ";version=1.5"))
.build(); .build();
HttpResponse setOwnerResponse = HttpResponse.builder() HttpResponse setOwnerResponse = HttpResponse.builder()
@ -282,7 +282,7 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
} }
HttpRequest deleteCatalog = HttpRequest.builder() HttpRequest removeCatalog = HttpRequest.builder()
.method("DELETE") .method("DELETE")
.endpoint(catalogAdminHref) .endpoint(catalogAdminHref)
.addHeader("Accept", "*/*") .addHeader("Accept", "*/*")
@ -290,34 +290,34 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token) .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.build(); .build();
HttpResponse deleteCatalogResponse = HttpResponse.builder() HttpResponse removeCatalogResponse = HttpResponse.builder()
.statusCode(204) .statusCode(204)
.build(); .build();
@Test @Test
public void testDeleteCatalogHref() { public void testRemoveCatalogHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, deleteCatalog, VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, removeCatalog,
deleteCatalogResponse); removeCatalogResponse);
api.getCatalogApi().delete(catalogAdminHref); api.getCatalogApi().remove(catalogAdminHref);
} }
@Test @Test
public void testDeleteCatalogUrn() { public void testRemoveCatalogUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveCatalog, VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveCatalog,
resolveCatalogResponse, deleteCatalog, deleteCatalogResponse); resolveCatalogResponse, removeCatalog, removeCatalogResponse);
api.getCatalogApi().delete(catalogUrn); api.getCatalogApi().remove(catalogUrn);
} }
//TODO: tests for access control! //TODO: tests for access control!
public static final AdminCatalog createCatalogInOrgSource() { public static final AdminCatalog addCatalogToOrgSource() {
return AdminCatalog.builder() return AdminCatalog.builder()
.name("Test Catalog") .name("Test Catalog")
.description("created by testCreateCatalog()") .description("created by testCreateCatalog()")
.build(); .build();
} }
public static final AdminCatalog createCatalogInOrg() { public static final AdminCatalog addCatalogToOrg() {
return AdminCatalog.builder() return AdminCatalog.builder()
.name("Test Catalog") .name("Test Catalog")
.id("urn:vcloud:catalog:c56d9159-7838-446f-bb35-9ee12dfbbef3") .id("urn:vcloud:catalog:c56d9159-7838-446f-bb35-9ee12dfbbef3")
@ -358,7 +358,6 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
.type("application/vnd.vmware.vcloud.metadata+xml") .type("application/vnd.vmware.vcloud.metadata+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/metadata")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/metadata"))
.build()) .build())
.description("created by testCreateCatalog()")
.tasks(ImmutableSet.<Task>builder() .tasks(ImmutableSet.<Task>builder()
.add(Task.builder() .add(Task.builder()
.status("running") .status("running")
@ -472,7 +471,7 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
.build(); .build();
} }
public static final AdminCatalog updateCatalog() { public static final AdminCatalog editCatalog() {
return catalog().toBuilder() return catalog().toBuilder()
.name("new QunyingTestCatalog") .name("new QunyingTestCatalog")
.description("new Testing") .description("new Testing")

View File

@ -81,7 +81,7 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
protected void tidyUp() { protected void tidyUp() {
if (catalog != null) { if (catalog != null) {
try { try {
catalogApi.delete(catalog.getId()); catalogApi.remove(catalog.getId());
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error deleting admin catalog '%s'", catalog.getName()); logger.warn(e, "Error deleting admin catalog '%s'", catalog.getName());
} }
@ -89,17 +89,17 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "POST /admin/org/{id}/catalogs") @Test(description = "POST /admin/org/{id}/catalogs")
public void testCreateCatalog() { public void testAddCatalog() {
AdminCatalog newCatalog = AdminCatalog.builder().name(name("Test Catalog ")) AdminCatalog newCatalog = AdminCatalog.builder().name(name("Test Catalog "))
.description("created by testCreateCatalog()").build(); .description("created by testAddCatalog()").build();
catalog = catalogApi.createCatalogInOrg(newCatalog, org.getId()); catalog = catalogApi.addCatalogToOrg(newCatalog, org.getId());
Checks.checkAdminCatalog(catalog); Checks.checkAdminCatalog(catalog);
// FIXME: documentation suggests we should wait for a task here // FIXME: documentation suggests we should wait for a task here
} }
@Test(description = "GET /admin/catalog/{id}", dependsOnMethods = { "testCreateCatalog" }) @Test(description = "GET /admin/catalog/{id}", dependsOnMethods = { "testAddCatalog" })
public void testGetCatalog() { public void testGetCatalog() {
catalog = catalogApi.get(catalog.getId()); catalog = catalogApi.get(catalog.getId());
@ -113,10 +113,10 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "PUT /admin/catalog/{id}/owner", dependsOnMethods = { "testGetCatalog" }) @Test(description = "PUT /admin/catalog/{id}/owner", dependsOnMethods = { "testGetCatalog" })
public void updateCatalogOwner() { public void editCatalogOwner() {
User newOwnerUser = randomTestUser("testUpdateCatalogOwner"); User newOwnerUser = randomTestUser("testEditCatalogOwner");
newOwnerUser = adminContext.getApi().getUserApi().createUserInOrg(newOwnerUser, org.getId()); newOwnerUser = adminContext.getApi().getUserApi().addUserToOrg(newOwnerUser, org.getId());
assertNotNull(newOwnerUser, "failed to create temp user to test updateCatalogOwner"); assertNotNull(newOwnerUser, "failed to add temp user to test editCatalogOwner");
Owner oldOwner = owner; Owner oldOwner = owner;
Owner newOwner = Owner.builder().type("application/vnd.vmware.vcloud.owner+xml") Owner newOwner = Owner.builder().type("application/vnd.vmware.vcloud.owner+xml")
@ -133,17 +133,17 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} finally { } finally {
catalogApi.setOwner(catalog.getId(), oldOwner); catalogApi.setOwner(catalog.getId(), oldOwner);
owner = catalogApi.getOwner(catalog.getId()); owner = catalogApi.getOwner(catalog.getId());
adminContext.getApi().getUserApi().delete(newOwnerUser.getHref()); adminContext.getApi().getUserApi().remove(newOwnerUser.getHref());
} }
} }
@Test(description = "PUT /admin/catalog/{id}", dependsOnMethods = { "testGetCatalogOwner" }) @Test(description = "PUT /admin/catalog/{id}", dependsOnMethods = { "testGetCatalogOwner" })
public void testUpdateCatalog() { public void testEditCatalog() {
String oldName = catalog.getName(); String oldName = catalog.getName();
String newName = "new " + oldName; String newName = "new " + oldName;
String oldDescription = catalog.getDescription(); String oldDescription = catalog.getDescription();
String newDescription = "new " + oldDescription; String newDescription = "new " + oldDescription;
// TODO: can we update/manage catalogItems directly like this? or does it just do a merge // TODO: can we edit/manage catalogItems directly like this? or does it just do a merge
// (like metadata) // (like metadata)
// CatalogItems oldCatalogItems = catalog.getCatalogItems(); // CatalogItems oldCatalogItems = catalog.getCatalogItems();
// CatalogItems newCatalogItems = CatalogItems.builder().build(); // CatalogItems newCatalogItems = CatalogItems.builder().build();
@ -153,7 +153,7 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// .catalogItems(newCatalogItems) // .catalogItems(newCatalogItems)
.build(); .build();
catalog = catalogApi.update(catalog.getId(), catalog); catalog = catalogApi.edit(catalog.getId(), catalog);
assertTrue(equal(catalog.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, CATALOG, "name")); assertTrue(equal(catalog.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, CATALOG, "name"));
assertTrue(equal(catalog.getDescription(), newDescription), assertTrue(equal(catalog.getDescription(), newDescription),
@ -169,12 +169,12 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// .catalogItems(oldCatalogItems) // .catalogItems(oldCatalogItems)
.build(); .build();
catalog = catalogApi.update(catalog.getId(), catalog); catalog = catalogApi.edit(catalog.getId(), catalog);
} }
} }
// FIXME fails with a 403 // FIXME fails with a 403
@Test(description = "POST /admin/catalog/{id}/action/publish", dependsOnMethods = { "testUpdateCatalog" }) @Test(description = "POST /admin/catalog/{id}/action/publish", dependsOnMethods = { "testEditCatalog" })
public void testPublishCatalog() { public void testPublishCatalog() {
assertNotNull(catalog, String.format(NOT_NULL_OBJ_FMT, "Catalog")); assertNotNull(catalog, String.format(NOT_NULL_OBJ_FMT, "Catalog"));
assertTrue(!catalog.isPublished(), assertTrue(!catalog.isPublished(),
@ -189,7 +189,7 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
String.format(OBJ_FIELD_EQ, CATALOG, "isPublished", true, catalog.isPublished())); String.format(OBJ_FIELD_EQ, CATALOG, "isPublished", true, catalog.isPublished()));
} }
@Test(description = "GET /org/{id}/catalog/{catalogId}/controlAccess", dependsOnMethods = { "testCreateCatalog" }) @Test(description = "GET /org/{id}/catalog/{catalogId}/controlAccess", dependsOnMethods = { "testAddCatalog" })
public void testGetControlAccessControl() { public void testGetControlAccessControl() {
// Call the method being tested // Call the method being tested
ControlAccessParams params = catalogApi.getAccessControl(catalog.getId()); ControlAccessParams params = catalogApi.getAccessControl(catalog.getId());
@ -198,30 +198,30 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
checkControlAccessParams(params); checkControlAccessParams(params);
} }
@Test(description = "POST /org/{id}/catalog/{catalogId}/action/controlAccess", dependsOnMethods = { "testCreateCatalog" }) @Test(description = "POST /org/{id}/catalog/{catalogId}/action/controlAccess", dependsOnMethods = { "testAddCatalog" })
public void testModifyAccessControl() { public void testEditAccessControl() {
// Setup params // Setup params
ControlAccessParams params = catalogApi.getAccessControl(catalog.getId()); ControlAccessParams params = catalogApi.getAccessControl(catalog.getId());
// Call the method being tested // Call the method being tested
ControlAccessParams modified = catalogApi.modifyAccessControl(catalog.getId(), params); ControlAccessParams modified = catalogApi.editAccessControl(catalog.getId(), params);
// Check params are well formed // Check params are well formed
checkControlAccessParams(modified); checkControlAccessParams(modified);
} }
@Test(description = "DELETE /admin/catalog/{id}", dependsOnMethods = { "testCreateCatalog" }) @Test(description = "DELETE /admin/catalog/{id}", dependsOnMethods = { "testAddCatalog" })
public void testDeleteCatalog() { public void testRemoveCatalog() {
// assertEquals(catalog.getCatalogItems().getCatalogItems().size(), 0, // assertEquals(catalog.getCatalogItems().getCatalogItems().size(), 0,
// String.format(OBJ_FIELD_EMPTY_TO_DELETE, "Catalog", "CatalogItems", // String.format(OBJ_FIELD_EMPTY_TO_DELETE, "Catalog", "CatalogItems",
// catalog.getCatalogItems().getCatalogItems().toString())); // catalog.getCatalogItems().getCatalogItems().toString()));
AdminCatalog deleteCatalog = AdminCatalog.builder().name(name("Test Catalog ")) AdminCatalog removeCatalog = AdminCatalog.builder().name(name("Test Catalog "))
.description("created by testCreateCatalog()").build(); .description("created by testAddCatalog()").build();
deleteCatalog = catalogApi.createCatalogInOrg(deleteCatalog, org.getId()); removeCatalog = catalogApi.addCatalogToOrg(removeCatalog, org.getId());
catalogApi.delete(deleteCatalog.getId()); catalogApi.remove(removeCatalog.getId());
deleteCatalog = catalogApi.get(deleteCatalog.getId()); removeCatalog = catalogApi.get(removeCatalog.getId());
assertNull(deleteCatalog, String.format(OBJ_DEL, CATALOG, deleteCatalog != null ? deleteCatalog.toString() : "")); assertNull(removeCatalog, String.format(OBJ_DEL, CATALOG, removeCatalog != null ? removeCatalog.toString() : ""));
} }

View File

@ -108,30 +108,30 @@ public class AdminNetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest
assertEquals(api.getNetworkApi().get(networkUrn), network()); assertEquals(api.getNetworkApi().get(networkUrn), network());
} }
HttpRequest update = HttpRequest.builder() HttpRequest edit = HttpRequest.builder()
.method("PUT") .method("PUT")
.endpoint(networkAdminHref ) .endpoint(networkAdminHref )
.addHeader("Accept", TASK) .addHeader("Accept", TASK)
.addHeader("x-vcloud-authorization", token) .addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token) .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/network/admin/updateNetworkSource.xml", ORG_NETWORK)) .payload(payloadFromResourceWithContentType("/network/admin/editNetworkSource.xml", ORG_NETWORK))
.build(); .build();
HttpResponse updateResponse = HttpResponse.builder() HttpResponse editResponse = HttpResponse.builder()
.statusCode(200) .statusCode(200)
.payload(payloadFromResourceWithContentType("/network/admin/updateNetworkTask.xml", TASK)) .payload(payloadFromResourceWithContentType("/network/admin/editNetworkTask.xml", TASK))
.build(); .build();
@Test @Test
public void testUpdateNetworkHref() { public void testEditNetworkHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, update, updateResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, edit, editResponse);
assertEquals(api.getNetworkApi().update(networkAdminHref, updateNetwork()), updateNetworkTask()); assertEquals(api.getNetworkApi().edit(networkAdminHref, editNetwork()), editNetworkTask());
} }
@Test @Test
public void testUpdateNetworkUrn() { public void testEditNetworkUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveNetwork, resolveNetworkResponse, update, updateResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveNetwork, resolveNetworkResponse, edit, editResponse);
assertEquals(api.getNetworkApi().update(networkUrn, updateNetwork()), updateNetworkTask()); assertEquals(api.getNetworkApi().edit(networkUrn, editNetwork()), editNetworkTask());
} }
HttpRequest reset = HttpRequest.builder() HttpRequest reset = HttpRequest.builder()
@ -209,7 +209,7 @@ public class AdminNetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest
.build(); .build();
} }
public final OrgNetwork updateNetwork() { public final OrgNetwork editNetwork() {
return network().toBuilder() return network().toBuilder()
.build(); .build();
@ -248,7 +248,7 @@ public class AdminNetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest
.build(); .build();
} }
public final Task updateNetworkTask() { public final Task editNetworkTask() {
return Task.builder() return Task.builder()
.status("running") .status("running")
.startTime(dateService.iso8601DateParse("2012-03-14T12:39:23.720-04:00")) .startTime(dateService.iso8601DateParse("2012-03-14T12:39:23.720-04:00"))

View File

@ -83,7 +83,7 @@ public class AdminNetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// TODO: this test is far from exhaustive // TODO: this test is far from exhaustive
@Test(description = "PUT /admin/network/{id}" ) @Test(description = "PUT /admin/network/{id}" )
public void testUpdateNetwork() { public void testEditNetwork() {
//TODO: ensure network instanceof OrgNetwork, may require queries //TODO: ensure network instanceof OrgNetwork, may require queries
assertTrue(network instanceof OrgNetwork, String.format(URN_REQ_LIVE, "OrgNetwork")); assertTrue(network instanceof OrgNetwork, String.format(URN_REQ_LIVE, "OrgNetwork"));
@ -92,49 +92,49 @@ public class AdminNetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.tasks(Collections.<Task>emptySet()) .tasks(Collections.<Task>emptySet())
.build(); .build();
OrgNetwork updateNetwork = getMutatedOrgNetwork(oldNetwork); OrgNetwork editNetwork = getMutatedOrgNetwork(oldNetwork);
try { try {
Task updateNetworkTask = networkApi.update(networkUrn, updateNetwork); Task editNetworkTask = networkApi.edit(networkUrn, editNetwork);
Checks.checkTask(updateNetworkTask); Checks.checkTask(editNetworkTask);
assertTrue(retryTaskSuccess.apply(updateNetworkTask), String.format(TASK_COMPLETE_TIMELY, "updateNetworkTask")); assertTrue(retryTaskSuccess.apply(editNetworkTask), String.format(TASK_COMPLETE_TIMELY, "editNetworkTask"));
network = networkApi.get(networkUrn); network = networkApi.get(networkUrn);
Checks.checkOrgNetwork(Network.<OrgNetwork>toSubType(network)); Checks.checkOrgNetwork(Network.<OrgNetwork>toSubType(network));
assertTrue(equal(network.getConfiguration().getIpScope(), assertTrue(equal(network.getConfiguration().getIpScope(),
updateNetwork.getConfiguration().getIpScope()), editNetwork.getConfiguration().getIpScope()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "ipScope")); String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "ipScope"));
assertTrue(equal(network.getConfiguration().getParentNetwork(), assertTrue(equal(network.getConfiguration().getParentNetwork(),
updateNetwork.getConfiguration().getParentNetwork()), editNetwork.getConfiguration().getParentNetwork()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "parentNetwork")); String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "parentNetwork"));
assertTrue(equal(network.getConfiguration().getFenceMode(), assertTrue(equal(network.getConfiguration().getFenceMode(),
updateNetwork.getConfiguration().getFenceMode()), editNetwork.getConfiguration().getFenceMode()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "fenceMode")); String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "fenceMode"));
assertTrue(equal(network.getConfiguration().retainNetInfoAcrossDeployments(), assertTrue(equal(network.getConfiguration().retainNetInfoAcrossDeployments(),
updateNetwork.getConfiguration().retainNetInfoAcrossDeployments()), editNetwork.getConfiguration().retainNetInfoAcrossDeployments()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "retainNetInfoAcrossDeployments")); String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "retainNetInfoAcrossDeployments"));
assertTrue(equal(network.getConfiguration().getNetworkFeatures(), assertTrue(equal(network.getConfiguration().getNetworkFeatures(),
updateNetwork.getConfiguration().getNetworkFeatures()), editNetwork.getConfiguration().getNetworkFeatures()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "networkFeatures")); String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "networkFeatures"));
assertTrue(equal(network.getConfiguration().getSyslogServerSettings(), assertTrue(equal(network.getConfiguration().getSyslogServerSettings(),
updateNetwork.getConfiguration().getSyslogServerSettings()), editNetwork.getConfiguration().getSyslogServerSettings()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "syslogServerSettings")); String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "syslogServerSettings"));
assertTrue(equal(network.getConfiguration().getRouterInfo(), assertTrue(equal(network.getConfiguration().getRouterInfo(),
updateNetwork.getConfiguration().getRouterInfo()), editNetwork.getConfiguration().getRouterInfo()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "routerInfo")); String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "routerInfo"));
// FIXME: fails // FIXME: fails
// assertTrue(equal(Network.<OrgNetwork>toSubType(network).getNetworkPool(), // assertTrue(equal(Network.<OrgNetwork>toSubType(network).getNetworkPool(),
// updateNetwork.getNetworkPool()), // editNetwork.getNetworkPool()),
// String.format(OBJ_FIELD_UPDATABLE, NETWORK, "networkPool")); // String.format(OBJ_FIELD_UPDATABLE, NETWORK, "networkPool"));
// assertTrue(equal(Network.<OrgNetwork>toSubType(network).getAllowedExternalIpAddresses(), // assertTrue(equal(Network.<OrgNetwork>toSubType(network).getAllowedExternalIpAddresses(),
// updateNetwork.getAllowedExternalIpAddresses()), // editNetwork.getAllowedExternalIpAddresses()),
// String.format(OBJ_FIELD_UPDATABLE, NETWORK, "allowedExternalIpAddresses")); // String.format(OBJ_FIELD_UPDATABLE, NETWORK, "allowedExternalIpAddresses"));
} finally { } finally {
Task updateNetworkTask = networkApi.update(networkUrn, oldNetwork); Task editNetworkTask = networkApi.edit(networkUrn, oldNetwork);
Checks.checkTask(updateNetworkTask); Checks.checkTask(editNetworkTask);
assertTrue(retryTaskSuccess.apply(updateNetworkTask), String.format(TASK_COMPLETE_TIMELY, "updateNetworkTask")); assertTrue(retryTaskSuccess.apply(editNetworkTask), String.format(TASK_COMPLETE_TIMELY, "editNetworkTask"));
network = networkApi.get(networkUrn); network = networkApi.get(networkUrn);
} }
} }

View File

@ -219,21 +219,21 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testUpdateSettings() { public void testEditSettings() {
VCloudDirectorAdminApi api = requestsSendResponses( VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest, loginRequest,
sessionResponse, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/") .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/")
.xmlFilePayload("/org/admin/updateSettingsSource.xml", VCloudDirectorMediaType.ORG_SETTINGS) .xmlFilePayload("/org/admin/editSettingsSource.xml", VCloudDirectorMediaType.ORG_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_SETTINGS).httpRequestBuilder().build(), .acceptMedia(VCloudDirectorMediaType.ORG_SETTINGS).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateSettings.xml", VCloudDirectorMediaType.ORG_SETTINGS) .xmlFilePayload("/org/admin/editSettings.xml", VCloudDirectorMediaType.ORG_SETTINGS)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
OrgSettings expected = updateSettings(); OrgSettings expected = editSettings();
assertEquals(api.getOrgApi().updateSettings(orgRef.getHref(), expected), expected); assertEquals(api.getOrgApi().editSettings(orgRef.getHref(), expected), expected);
} }
@Test @Test
@ -254,22 +254,22 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test @Test
public void testUpdateEmailSettings() { public void testEditEmailSettings() {
VCloudDirectorAdminApi api = requestsSendResponses( VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest, loginRequest,
sessionResponse, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email") .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email")
.xmlFilePayload("/org/admin/updateEmailSettingsSource.xml", .xmlFilePayload("/org/admin/editEmailSettingsSource.xml",
VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS).httpRequestBuilder().build(), .acceptMedia(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateEmailSettings.xml", .xmlFilePayload("/org/admin/editEmailSettings.xml",
VCloudDirectorMediaType.ORG_EMAIL_SETTINGS).httpResponseBuilder().build()); VCloudDirectorMediaType.ORG_EMAIL_SETTINGS).httpResponseBuilder().build());
OrgEmailSettings expected = updateEmailSettings(); OrgEmailSettings expected = editEmailSettings();
assertEquals(api.getOrgApi().updateEmailSettings(orgRef.getHref(), expected), expected); assertEquals(api.getOrgApi().editEmailSettings(orgRef.getHref(), expected), expected);
} }
@Test(enabled = false) @Test(enabled = false)
@ -304,25 +304,25 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testUpdateGeneralSettings() { public void testEditGeneralSettings() {
VCloudDirectorAdminApi api = requestsSendResponses( VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest, loginRequest,
sessionResponse, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general") .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general")
.xmlFilePayload("/org/admin/updateGeneralSettingsSource.xml", .xmlFilePayload("/org/admin/editGeneralSettingsSource.xml",
VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS).httpRequestBuilder().build(), .acceptMedia(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateGeneralSettings.xml", .xmlFilePayload("/org/admin/editGeneralSettings.xml",
VCloudDirectorMediaType.ORG_GENERAL_SETTINGS).httpResponseBuilder().build()); VCloudDirectorMediaType.ORG_GENERAL_SETTINGS).httpResponseBuilder().build());
OrgGeneralSettings expected = updateGeneralSettings(); OrgGeneralSettings expected = editGeneralSettings();
assertEquals(api.getOrgApi().updateGeneralSettings(orgRef.getHref(), expected), expected); assertEquals(api.getOrgApi().editGeneralSettings(orgRef.getHref(), expected), expected);
} }
public static final OrgGeneralSettings updateGeneralSettings() { public static final OrgGeneralSettings editGeneralSettings() {
return generalSettings().toBuilder() return generalSettings().toBuilder()
.build(); .build();
@ -385,25 +385,25 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test @Test
public void testUpdatePasswordPolicy() { public void testEditPasswordPolicy() {
VCloudDirectorAdminApi api = requestsSendResponses( VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest, loginRequest,
sessionResponse, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy") .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy")
.xmlFilePayload("/org/admin/updatePasswordPolicySource.xml", .xmlFilePayload("/org/admin/editPasswordPolicySource.xml",
VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS).httpRequestBuilder().build(), .acceptMedia(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updatePasswordPolicy.xml", .xmlFilePayload("/org/admin/editPasswordPolicy.xml",
VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS).httpResponseBuilder().build()); VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS).httpResponseBuilder().build());
OrgPasswordPolicySettings expected = updateOrgPasswordPolicy(); OrgPasswordPolicySettings expected = editOrgPasswordPolicy();
assertEquals(api.getOrgApi().updatePasswordPolicy(orgRef.getHref(), expected), expected); assertEquals(api.getOrgApi().editPasswordPolicy(orgRef.getHref(), expected), expected);
} }
public static final OrgPasswordPolicySettings updateOrgPasswordPolicy() { public static final OrgPasswordPolicySettings editOrgPasswordPolicy() {
return passwordPolicy().toBuilder().accountLockoutEnabled(true).invalidLoginsBeforeLockout(6) return passwordPolicy().toBuilder().accountLockoutEnabled(true).invalidLoginsBeforeLockout(6)
.accountLockoutIntervalMinutes(11).build(); .accountLockoutIntervalMinutes(11).build();
} }
@ -440,25 +440,25 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testUpdateOrgVAppLeaseSettings() { public void testEditOrgVAppLeaseSettings() {
VCloudDirectorAdminApi api = requestsSendResponses( VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest, loginRequest,
sessionResponse, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings") .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings")
.xmlFilePayload("/org/admin/updateVAppLeaseSettingsSource.xml", .xmlFilePayload("/org/admin/editVAppLeaseSettingsSource.xml",
VCloudDirectorMediaType.ORG_LEASE_SETTINGS) VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_LEASE_SETTINGS).httpRequestBuilder().build(), .acceptMedia(VCloudDirectorMediaType.ORG_LEASE_SETTINGS).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateVAppLeaseSettings.xml", .xmlFilePayload("/org/admin/editVAppLeaseSettings.xml",
VCloudDirectorMediaType.ORG_LEASE_SETTINGS).httpResponseBuilder().build()); VCloudDirectorMediaType.ORG_LEASE_SETTINGS).httpResponseBuilder().build());
OrgLeaseSettings expected = updateVAppLeaseSettings(); OrgLeaseSettings expected = editVAppLeaseSettings();
assertEquals(api.getOrgApi().updateVAppLeaseSettings(orgRef.getHref(), expected), expected); assertEquals(api.getOrgApi().editVAppLeaseSettings(orgRef.getHref(), expected), expected);
} }
public static final OrgLeaseSettings updateVAppLeaseSettings() { public static final OrgLeaseSettings editVAppLeaseSettings() {
return vAppLeaseSettings().toBuilder() return vAppLeaseSettings().toBuilder()
.build(); .build();
@ -497,28 +497,28 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testUpdateOrgVAppTemplateLeaseSettings() { public void testEditOrgVAppTemplateLeaseSettings() {
VCloudDirectorAdminApi api = requestsSendResponses( VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest, loginRequest,
sessionResponse, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", .apiCommand("PUT",
"/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings") "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings")
.xmlFilePayload("/org/admin/updateVAppLeaseSettingsSource.xml", .xmlFilePayload("/org/admin/editVAppLeaseSettingsSource.xml",
VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS).httpRequestBuilder() .acceptMedia(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS).httpRequestBuilder()
.build(), .build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateVAppLeaseSettings.xml", .xmlFilePayload("/org/admin/editVAppLeaseSettings.xml",
VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS).httpResponseBuilder() VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS).httpResponseBuilder()
.build()); .build());
OrgVAppTemplateLeaseSettings expected = updateVAppTemplateLeaseSettings(); OrgVAppTemplateLeaseSettings expected = editVAppTemplateLeaseSettings();
assertEquals(api.getOrgApi().updateVAppTemplateLeaseSettings(orgRef.getHref(), expected), expected); assertEquals(api.getOrgApi().editVAppTemplateLeaseSettings(orgRef.getHref(), expected), expected);
} }
public static final OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings() { public static final OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings() {
return vAppTemplateLeaseSettings().toBuilder() return vAppTemplateLeaseSettings().toBuilder()
.build(); .build();
@ -576,7 +576,7 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test @Test
public static final OrgSettings updateSettings() { public static final OrgSettings editSettings() {
return settings().toBuilder().build(); return settings().toBuilder().build();
} }
@ -602,7 +602,7 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test @Test
public static final OrgEmailSettings updateEmailSettings() { public static final OrgEmailSettings editEmailSettings() {
return emailSettings() return emailSettings()
.toBuilder() .toBuilder()
.isDefaultSmtpServer(false) .isDefaultSmtpServer(false)

View File

@ -84,7 +84,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "PUT /admin/org/{id}/settings/email", dependsOnMethods = { "testGetEmailSettings" }) @Test(description = "PUT /admin/org/{id}/settings/email", dependsOnMethods = { "testGetEmailSettings" })
public void testUpdateEmailSettings() { public void testEditEmailSettings() {
boolean isDefaultSmtpServer = emailSettings.isDefaultSmtpServer(); boolean isDefaultSmtpServer = emailSettings.isDefaultSmtpServer();
boolean isDefaultOrgEmail = emailSettings.isDefaultOrgEmail(); boolean isDefaultOrgEmail = emailSettings.isDefaultOrgEmail();
String oldFromEmailAddress = emailSettings.getFromEmailAddress(); String oldFromEmailAddress = emailSettings.getFromEmailAddress();
@ -104,7 +104,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.defaultSubjectPrefix(newDefaultSubjectPrefix).isAlertEmailToAllAdmins(!isAlertEmailToAllAdmins) .defaultSubjectPrefix(newDefaultSubjectPrefix).isAlertEmailToAllAdmins(!isAlertEmailToAllAdmins)
.smtpServerSettings(newSmtpServerSettings).build(); .smtpServerSettings(newSmtpServerSettings).build();
emailSettings = orgApi.updateEmailSettings(org.getId(), newEmailSettings); emailSettings = orgApi.editEmailSettings(org.getId(), newEmailSettings);
assertTrue(equal(emailSettings.isDefaultSmtpServer(), !isDefaultSmtpServer), assertTrue(equal(emailSettings.isDefaultSmtpServer(), !isDefaultSmtpServer),
String.format(OBJ_FIELD_UPDATABLE, "emailSettings", "isDefaultSmtpServer")); String.format(OBJ_FIELD_UPDATABLE, "emailSettings", "isDefaultSmtpServer"));
@ -128,7 +128,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.defaultSubjectPrefix(oldDefaultSubjectPrefix).isAlertEmailToAllAdmins(isAlertEmailToAllAdmins) .defaultSubjectPrefix(oldDefaultSubjectPrefix).isAlertEmailToAllAdmins(isAlertEmailToAllAdmins)
.smtpServerSettings(oldSmtpServerSettings).build(); .smtpServerSettings(oldSmtpServerSettings).build();
emailSettings = orgApi.updateEmailSettings(org.getId(), emailSettings); emailSettings = orgApi.editEmailSettings(org.getId(), emailSettings);
} }
} }
@ -140,8 +140,8 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "PUT /admin/org/{id}/settings/general", dependsOnMethods = { "testGetGeneralSettings" }) @Test(description = "PUT /admin/org/{id}/settings/general", dependsOnMethods = { "testGetGeneralSettings" })
public void testUpdateGeneralSettings() { public void testEditGeneralSettings() {
// FIXME: canPublishCatalogs does not update // FIXME: canPublishCatalogs does not edit
// boolean canPublishCatalogs = generalSettings.canPublishCatalogs(); // boolean canPublishCatalogs = generalSettings.canPublishCatalogs();
Integer deployedVMQuota = generalSettings.getDeployedVMQuota(); Integer deployedVMQuota = generalSettings.getDeployedVMQuota();
Integer storedVmQuota = generalSettings.getStoredVmQuota(); Integer storedVmQuota = generalSettings.getStoredVmQuota();
@ -156,7 +156,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.useServerBootSequence(!useServerBootSequence).delayAfterPowerOnSeconds(delayAfterPowerOnSeconds + 1) .useServerBootSequence(!useServerBootSequence).delayAfterPowerOnSeconds(delayAfterPowerOnSeconds + 1)
.build(); .build();
generalSettings = orgApi.updateGeneralSettings(org.getId(), newGeneralSettings); generalSettings = orgApi.editGeneralSettings(org.getId(), newGeneralSettings);
// assertTrue(equal(generalSettings.canPublishCatalogs(), !canPublishCatalogs), // assertTrue(equal(generalSettings.canPublishCatalogs(), !canPublishCatalogs),
// String.format(OBJ_FIELD_UPDATABLE, // String.format(OBJ_FIELD_UPDATABLE,
@ -181,7 +181,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.useServerBootSequence(useServerBootSequence).delayAfterPowerOnSeconds(delayAfterPowerOnSeconds) .useServerBootSequence(useServerBootSequence).delayAfterPowerOnSeconds(delayAfterPowerOnSeconds)
.build(); .build();
generalSettings = orgApi.updateGeneralSettings(org.getId(), generalSettings); generalSettings = orgApi.editGeneralSettings(org.getId(), generalSettings);
} }
} }
@ -200,7 +200,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "PUT /admin/org/{id}/settings/passwordPolicy", dependsOnMethods = { "testGetPasswordPolicy" }) @Test(description = "PUT /admin/org/{id}/settings/passwordPolicy", dependsOnMethods = { "testGetPasswordPolicy" })
public void testUpdatePasswordPolicy() { public void testEditPasswordPolicy() {
boolean accountLockoutEnabled = passwordPolicy.isAccountLockoutEnabled(); boolean accountLockoutEnabled = passwordPolicy.isAccountLockoutEnabled();
Integer invalidLoginsBeforeLockout = passwordPolicy.getInvalidLoginsBeforeLockout(); Integer invalidLoginsBeforeLockout = passwordPolicy.getInvalidLoginsBeforeLockout();
Integer accountLockoutIntervalMinutes = passwordPolicy.getAccountLockoutIntervalMinutes(); Integer accountLockoutIntervalMinutes = passwordPolicy.getAccountLockoutIntervalMinutes();
@ -211,7 +211,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.invalidLoginsBeforeLockout(invalidLoginsBeforeLockout + 1) .invalidLoginsBeforeLockout(invalidLoginsBeforeLockout + 1)
.accountLockoutIntervalMinutes(accountLockoutIntervalMinutes + 1).build(); .accountLockoutIntervalMinutes(accountLockoutIntervalMinutes + 1).build();
passwordPolicy = orgApi.updatePasswordPolicy(org.getId(), newPasswordPolicy); passwordPolicy = orgApi.editPasswordPolicy(org.getId(), newPasswordPolicy);
assertTrue(equal(passwordPolicy.isAccountLockoutEnabled(), !accountLockoutEnabled), assertTrue(equal(passwordPolicy.isAccountLockoutEnabled(), !accountLockoutEnabled),
String.format(OBJ_FIELD_UPDATABLE, "PasswordPolicySettings", "deleteOnStorageLeaseExpiration")); String.format(OBJ_FIELD_UPDATABLE, "PasswordPolicySettings", "deleteOnStorageLeaseExpiration"));
@ -228,7 +228,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.invalidLoginsBeforeLockout(invalidLoginsBeforeLockout) .invalidLoginsBeforeLockout(invalidLoginsBeforeLockout)
.accountLockoutIntervalMinutes(accountLockoutIntervalMinutes).build(); .accountLockoutIntervalMinutes(accountLockoutIntervalMinutes).build();
passwordPolicy = orgApi.updatePasswordPolicy(org.getId(), passwordPolicy); passwordPolicy = orgApi.editPasswordPolicy(org.getId(), passwordPolicy);
} }
} }
@ -241,7 +241,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@Test(description = "PUT /admin/org/{id}/settings/vAppLeaseSettings", dependsOnMethods = { "testGetVAppLeaseSettings" }) @Test(description = "PUT /admin/org/{id}/settings/vAppLeaseSettings", dependsOnMethods = { "testGetVAppLeaseSettings" })
// FIXME: fails with 403 forbidden // FIXME: fails with 403 forbidden
public void testUpdateVAppLeaseSettings() { public void testEditVAppLeaseSettings() {
boolean deleteOnStorageLeaseExpiration = vAppLeaseSettings.deleteOnStorageLeaseExpiration(); boolean deleteOnStorageLeaseExpiration = vAppLeaseSettings.deleteOnStorageLeaseExpiration();
Integer storageLeaseSeconds = vAppLeaseSettings.getStorageLeaseSeconds(); Integer storageLeaseSeconds = vAppLeaseSettings.getStorageLeaseSeconds();
Integer deploymentLeaseSeconds = vAppLeaseSettings.getDeploymentLeaseSeconds(); Integer deploymentLeaseSeconds = vAppLeaseSettings.getDeploymentLeaseSeconds();
@ -252,7 +252,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.storageLeaseSeconds(storageLeaseSeconds + 1).deploymentLeaseSeconds(deploymentLeaseSeconds + 1) .storageLeaseSeconds(storageLeaseSeconds + 1).deploymentLeaseSeconds(deploymentLeaseSeconds + 1)
.build(); .build();
vAppLeaseSettings = orgApi.updateVAppLeaseSettings(org.getId(), newVAppLeaseSettings); vAppLeaseSettings = orgApi.editVAppLeaseSettings(org.getId(), newVAppLeaseSettings);
assertTrue(equal(vAppLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration), assertTrue(equal(vAppLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration),
String.format(OBJ_FIELD_UPDATABLE, "vAppLeaseSettings", "deleteOnStorageLeaseExpiration")); String.format(OBJ_FIELD_UPDATABLE, "vAppLeaseSettings", "deleteOnStorageLeaseExpiration"));
@ -269,7 +269,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.deleteOnStorageLeaseExpiration(deleteOnStorageLeaseExpiration) .deleteOnStorageLeaseExpiration(deleteOnStorageLeaseExpiration)
.storageLeaseSeconds(storageLeaseSeconds).deploymentLeaseSeconds(deploymentLeaseSeconds).build(); .storageLeaseSeconds(storageLeaseSeconds).deploymentLeaseSeconds(deploymentLeaseSeconds).build();
vAppLeaseSettings = orgApi.updateVAppLeaseSettings(org.getId(), vAppLeaseSettings); vAppLeaseSettings = orgApi.editVAppLeaseSettings(org.getId(), vAppLeaseSettings);
} }
} }
@ -282,7 +282,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
@Test(description = "PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings", dependsOnMethods = { "testGetVAppTemplateLeaseSettings" }) @Test(description = "PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings", dependsOnMethods = { "testGetVAppTemplateLeaseSettings" })
// FIXME: fails with 403 forbidden // FIXME: fails with 403 forbidden
public void testUpdateVAppTemplateLeaseSettings() { public void testEditVAppTemplateLeaseSettings() {
boolean deleteOnStorageLeaseExpiration = vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration(); boolean deleteOnStorageLeaseExpiration = vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration();
Integer storageLeaseSeconds = vAppTemplateLeaseSettings.getStorageLeaseSeconds(); Integer storageLeaseSeconds = vAppTemplateLeaseSettings.getStorageLeaseSeconds();
@ -291,7 +291,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.deleteOnStorageLeaseExpiration(!deleteOnStorageLeaseExpiration) .deleteOnStorageLeaseExpiration(!deleteOnStorageLeaseExpiration)
.storageLeaseSeconds(storageLeaseSeconds + 1).build(); .storageLeaseSeconds(storageLeaseSeconds + 1).build();
vAppTemplateLeaseSettings = orgApi.updateVAppTemplateLeaseSettings(org.getId(), newVAppTemplateLeaseSettings); vAppTemplateLeaseSettings = orgApi.editVAppTemplateLeaseSettings(org.getId(), newVAppTemplateLeaseSettings);
assertTrue(equal(vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration), assertTrue(equal(vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration),
String.format(OBJ_FIELD_UPDATABLE, "vAppTemplateLeaseSettings", "deleteOnStorageLeaseExpiration")); String.format(OBJ_FIELD_UPDATABLE, "vAppTemplateLeaseSettings", "deleteOnStorageLeaseExpiration"));
@ -306,7 +306,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.deleteOnStorageLeaseExpiration(deleteOnStorageLeaseExpiration) .deleteOnStorageLeaseExpiration(deleteOnStorageLeaseExpiration)
.storageLeaseSeconds(storageLeaseSeconds).build(); .storageLeaseSeconds(storageLeaseSeconds).build();
vAppTemplateLeaseSettings = orgApi.updateVAppTemplateLeaseSettings(org.getId(), vAppTemplateLeaseSettings); vAppTemplateLeaseSettings = orgApi.editVAppTemplateLeaseSettings(org.getId(), vAppTemplateLeaseSettings);
} }
} }
@ -318,7 +318,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "PUT /admin/org/{id}/settings", dependsOnMethods = { "testGetEmailSettings" }) @Test(description = "PUT /admin/org/{id}/settings", dependsOnMethods = { "testGetEmailSettings" })
public void testUpdateSettings() throws Exception { public void testEditSettings() throws Exception {
String newFromEmailAddress = "test" + random.nextInt(Integer.MAX_VALUE) + "@test.com"; String newFromEmailAddress = "test" + random.nextInt(Integer.MAX_VALUE) + "@test.com";
Exception exception = null; Exception exception = null;
@ -326,7 +326,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
OrgSettings newSettings = OrgSettings.builder() OrgSettings newSettings = OrgSettings.builder()
.emailSettings(emailSettings.toBuilder().fromEmailAddress(newFromEmailAddress).build()).build(); .emailSettings(emailSettings.toBuilder().fromEmailAddress(newFromEmailAddress).build()).build();
OrgSettings modified = orgApi.updateSettings(org.getId(), newSettings); OrgSettings modified = orgApi.editSettings(org.getId(), newSettings);
Checks.checkOrgSettings(settings); Checks.checkOrgSettings(settings);
assertTrue(equal(modified.getEmailSettings().getFromEmailAddress(), newFromEmailAddress), assertTrue(equal(modified.getEmailSettings().getFromEmailAddress(), newFromEmailAddress),
@ -338,7 +338,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
try { try {
OrgSettings restorableSettings = OrgSettings.builder().emailSettings(emailSettings).build(); OrgSettings restorableSettings = OrgSettings.builder().emailSettings(emailSettings).build();
settings = orgApi.updateSettings(org.getId(), restorableSettings); settings = orgApi.editSettings(org.getId(), restorableSettings);
} catch (Exception e) { } catch (Exception e) {
if (exception != null) { if (exception != null) {
logger.warn(e, "Error resetting settings; rethrowing original test exception..."); logger.warn(e, "Error resetting settings; rethrowing original test exception...");

View File

@ -67,7 +67,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void cleanUp() throws Exception { public void cleanUp() throws Exception {
if (metadataKey != null) { if (metadataKey != null) {
try { try {
Task task = metadataApi.deleteEntry(lazyGetVdc().getHref(), metadataKey); Task task = metadataApi.removeEntry(lazyGetVdc().getHref(), metadataKey);
taskDoneEventually(task); taskDoneEventually(task);
} catch (VCloudDirectorException e) { } catch (VCloudDirectorException e) {
logger.warn(e, "Error deleting metadata-value (perhaps it doesn't exist?); continuing..."); logger.warn(e, "Error deleting metadata-value (perhaps it doesn't exist?); continuing...");
@ -94,7 +94,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
AdminVdc vdc = AdminVdc.builder().name(newName).build(); AdminVdc vdc = AdminVdc.builder().name(newName).build();
try { try {
Task task = vdcApi.update(vdcUrn, vdc); Task task = vdcApi.edit(vdcUrn, vdc);
assertTaskSucceeds(task); assertTaskSucceeds(task);
AdminVdc modified = vdcApi.get(vdcUrn); AdminVdc modified = vdcApi.get(vdcUrn);
@ -107,7 +107,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} finally { } finally {
try { try {
AdminVdc restorableVdc = AdminVdc.builder().name(origName).build(); AdminVdc restorableVdc = AdminVdc.builder().name(origName).build();
Task task = vdcApi.update(vdcUrn, restorableVdc); Task task = vdcApi.edit(vdcUrn, restorableVdc);
assertTaskSucceeds(task); assertTaskSucceeds(task);
} catch (Exception e) { } catch (Exception e) {
if (exception != null) { if (exception != null) {
@ -122,15 +122,15 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// TODO insufficient permissions to test // TODO insufficient permissions to test
@Test(description = "DELETE /admin/vdc/{id}", enabled = false) @Test(description = "DELETE /admin/vdc/{id}", enabled = false)
public void testDeleteVdc() throws Exception { public void testRemoveVdc() throws Exception {
// TODO Need to have a VDC that we're happy to delete! // TODO Need to have a VDC that we're happy to remove!
Task task = vdcApi.delete(vdcUrn); Task task = vdcApi.remove(vdcUrn);
assertTaskSucceeds(task); assertTaskSucceeds(task);
try { try {
vdcApi.get(vdcUrn); vdcApi.get(vdcUrn);
} catch (VCloudDirectorException e) { } catch (VCloudDirectorException e) {
// success; unreachable because it has been deleted // success; unreachable because it has been removed
// TODO: ^^ wrong. this should return null // TODO: ^^ wrong. this should return null
} }
} }
@ -138,7 +138,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// TODO insufficient permissions to test // TODO insufficient permissions to test
@Test(description = "DISABLE/ENABLE /admin/vdc/{id}", enabled = false) @Test(description = "DISABLE/ENABLE /admin/vdc/{id}", enabled = false)
public void testDisableAndEnableVdc() throws Exception { public void testDisableAndEnableVdc() throws Exception {
// TODO Need to have a VDC that we're happy to delete! // TODO Need to have a VDC that we're happy to remove!
Exception exception = null; Exception exception = null;
try { try {
@ -205,10 +205,10 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// TODO insufficient permissions to test // TODO insufficient permissions to test
@Test(description = "DELETE /admin/vdc/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }, enabled = false) @Test(description = "DELETE /admin/vdc/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }, enabled = false)
public void testDeleteMetadataValue() throws Exception { public void testRemoveMetadataValue() throws Exception {
// TODO Remove dependency on other tests; make cleanUp delete a list of metadata entries? // TODO Remove dependency on other tests; make cleanUp remove a list of metadata entries?
Task task = metadataApi.deleteEntry(lazyGetVdc().getHref(), metadataKey); Task task = metadataApi.removeEntry(lazyGetVdc().getHref(), metadataKey);
assertTaskSucceeds(task); assertTaskSucceeds(task);
try { try {

View File

@ -66,28 +66,28 @@ public class GroupApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
@Test(enabled = false) @Test(enabled = false)
public void testUpdateGroup() { public void testEditGroup() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/group/???") .apiCommand("PUT", "/admin/group/???")
.xmlFilePayload("/group/updateGroupSource.xml", VCloudDirectorMediaType.GROUP) .xmlFilePayload("/group/editGroupSource.xml", VCloudDirectorMediaType.GROUP)
.acceptMedia(VCloudDirectorMediaType.GROUP) .acceptMedia(VCloudDirectorMediaType.GROUP)
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/group/updateGroup.xml", VCloudDirectorMediaType.GROUP) .xmlFilePayload("/group/editGroup.xml", VCloudDirectorMediaType.GROUP)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
Group expected = updateGroup(); Group expected = editGroup();
assertEquals(api.getGroupApi().updateGroup(groupRef.getHref(), expected), expected); assertEquals(api.getGroupApi().editGroup(groupRef.getHref(), expected), expected);
} }
public static Group updateGroup() { public static Group editGroup() {
return null; // TODO chain onto group() then toBuilder() and modify? return null; // TODO chain onto group() then toBuilder() and edit?
} }
@Test @Test
public void testDeleteGroup() { public void testRemoveGroup() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("DELETE", "/admin/group/???") .apiCommand("DELETE", "/admin/group/???")
@ -96,6 +96,6 @@ public class GroupApiExpectTest extends VCloudDirectorAdminApiExpectTest {
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.httpResponseBuilder().statusCode(204).build()); .httpResponseBuilder().statusCode(204).build());
api.getGroupApi().deleteGroup(groupRef.getHref()); api.getGroupApi().removeGroup(groupRef.getHref());
} }
} }

View File

@ -65,11 +65,11 @@ public class GroupApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// OrgLdapSettings newLdapSettings = oldLdapSettings.toBuilder() // OrgLdapSettings newLdapSettings = oldLdapSettings.toBuilder()
// .ldapMode(OrgLdapSettings.LdapMode.SYSTEM) // .ldapMode(OrgLdapSettings.LdapMode.SYSTEM)
// .build(); // .build();
// context.getApi().getAdminOrgApi().updateLdapSettings(newLdapSettings); // context.getApi().getAdminOrgApi().editLdapSettings(newLdapSettings);
} }
@Test(description = "POST /admin/org/{id}/groups") @Test(description = "POST /admin/org/{id}/groups")
public void testCreateGroup() { public void testAddGroup() {
fail("LDAP not configured, group api isn't currently testable."); fail("LDAP not configured, group api isn't currently testable.");
// group = groupApi.createGroup(orgUri, Group.builder() // group = groupApi.createGroup(orgUri, Group.builder()
// .build(); // .build();
@ -77,7 +77,7 @@ public class GroupApiLiveTest extends BaseVCloudDirectorApiLiveTest {
Checks.checkGroup(group); Checks.checkGroup(group);
} }
@Test(description = "GET /admin/group/{id}", dependsOnMethods = { "testCreateGroup" }) @Test(description = "GET /admin/group/{id}", dependsOnMethods = { "testAddGroup" })
public void testGetGroup() { public void testGetGroup() {
group = groupApi.getGroup(groupRef.getHref()); group = groupApi.getGroup(groupRef.getHref());
@ -85,7 +85,7 @@ public class GroupApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "PUT /admin/group/{id}", dependsOnMethods = { "testGetGroup" } ) @Test(description = "PUT /admin/group/{id}", dependsOnMethods = { "testGetGroup" } )
public void testUpdateGroup() { public void testEditGroup() {
String oldName = group.getName(); String oldName = group.getName();
String newName = "new "+oldName; String newName = "new "+oldName;
String oldDescription = group.getDescription(); String oldDescription = group.getDescription();
@ -98,7 +98,7 @@ public class GroupApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.description(newDescription) .description(newDescription)
.build(); .build();
group = groupApi.updateGroup(group.getHref(), group); group = groupApi.editGroup(group.getHref(), group);
assertTrue(equal(group.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, GROUP, "name")); assertTrue(equal(group.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, GROUP, "name"));
assertTrue(equal(group.getDescription(), newDescription), assertTrue(equal(group.getDescription(), newDescription),
@ -113,13 +113,13 @@ public class GroupApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.description(oldDescription) .description(oldDescription)
.build(); .build();
group = groupApi.updateGroup(group.getHref(), group); group = groupApi.editGroup(group.getHref(), group);
} }
} }
@Test(description = "DELETE /admin/group/{id}", dependsOnMethods = { "testUpdateGroup" } ) @Test(description = "DELETE /admin/group/{id}", dependsOnMethods = { "testEditGroup" } )
public void testDeleteGroup() { public void testRemoveGroup() {
groupApi.deleteGroup(groupRef.getHref()); groupApi.removeGroup(groupRef.getHref());
// TODO stronger assertion of error expected // TODO stronger assertion of error expected
// Error expected = Error.builder() // Error expected = Error.builder()

View File

@ -58,24 +58,24 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
private static URI orgHref = URI.create(endpoint + "/org/" + org); private static URI orgHref = URI.create(endpoint + "/org/" + org);
private static URI orgAdminHref = URI.create(endpoint + "/admin/org/" + org); private static URI orgAdminHref = URI.create(endpoint + "/admin/org/" + org);
private HttpRequest create = HttpRequest.builder() private HttpRequest add = HttpRequest.builder()
.method("POST") .method("POST")
.endpoint(orgAdminHref + "/users") .endpoint(orgAdminHref + "/users")
.addHeader("Accept", USER) .addHeader("Accept", USER)
.addHeader("x-vcloud-authorization", token) .addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token) .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/user/createUserSource.xml", VCloudDirectorMediaType.USER)) .payload(payloadFromResourceWithContentType("/user/addUserSource.xml", VCloudDirectorMediaType.USER))
.build(); .build();
private HttpResponse createResponse = HttpResponse.builder() private HttpResponse addResponse = HttpResponse.builder()
.statusCode(200) .statusCode(200)
.payload(payloadFromResourceWithContentType("/user/createUser.xml", USER + ";version=1.5")) .payload(payloadFromResourceWithContentType("/user/addUser.xml", USER + ";version=1.5"))
.build(); .build();
@Test @Test
public void testCreateUserHref() { public void testAddUserHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, create, createResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, add, addResponse);
assertEquals(api.getUserApi().createUserInOrg(createUserSource(), orgAdminHref), createUser()); assertEquals(api.getUserApi().addUserToOrg(addUserSource(), orgAdminHref), addUser());
} }
private HttpRequest resolveOrg = HttpRequest.builder() private HttpRequest resolveOrg = HttpRequest.builder()
@ -100,9 +100,9 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.build(); .build();
@Test @Test
public void testCreateUserUrn() { public void testAddUserUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveOrg, resolveOrgResponse, create, createResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveOrg, resolveOrgResponse, add, addResponse);
assertEquals(api.getUserApi().createUserInOrg(createUserSource(), orgUrn), createUser()); assertEquals(api.getUserApi().addUserToOrg(addUserSource(), orgUrn), addUser());
} }
HttpRequest get = HttpRequest.builder() HttpRequest get = HttpRequest.builder()
@ -150,30 +150,30 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
assertEquals(api.getUserApi().get(userUrn), user()); assertEquals(api.getUserApi().get(userUrn), user());
} }
HttpRequest update = HttpRequest.builder() HttpRequest edit = HttpRequest.builder()
.method("PUT") .method("PUT")
.endpoint(userHref) .endpoint(userHref)
.addHeader("Accept", USER) .addHeader("Accept", USER)
.addHeader("x-vcloud-authorization", token) .addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token) .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/user/updateUserSource.xml", USER)) .payload(payloadFromResourceWithContentType("/user/editUserSource.xml", USER))
.build(); .build();
HttpResponse updateResponse = HttpResponse.builder() HttpResponse editResponse = HttpResponse.builder()
.statusCode(200) .statusCode(200)
.payload(payloadFromResourceWithContentType("/user/updateUser.xml", USER)) .payload(payloadFromResourceWithContentType("/user/editUser.xml", USER))
.build(); .build();
@Test @Test
public void testUpdateUserHref() { public void testEditUserHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, update, updateResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, edit, editResponse);
assertEquals(api.getUserApi().update(userHref, updateUserSource()), updateUser()); assertEquals(api.getUserApi().edit(userHref, editUserSource()), editUser());
} }
@Test @Test
public void testUpdateUserUrn() { public void testEditUserUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveUser, resolveUserResponse, update, updateResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveUser, resolveUserResponse, edit, editResponse);
assertEquals(api.getUserApi().update(userUrn, updateUserSource()), updateUser()); assertEquals(api.getUserApi().edit(userUrn, editUserSource()), editUser());
} }
HttpRequest unlock = HttpRequest.builder() HttpRequest unlock = HttpRequest.builder()
@ -209,30 +209,30 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
api.getUserApi().unlock(userUrn); api.getUserApi().unlock(userUrn);
} }
HttpRequest delete = HttpRequest.builder() HttpRequest remove = HttpRequest.builder()
.method("DELETE") .method("DELETE")
.endpoint(userHref) .endpoint(userHref)
.addHeader("Accept", "*/*") .addHeader("Accept", "*/*")
.addHeader("x-vcloud-authorization", token) .addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token).build(); .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token).build();
HttpResponse deleteResponse = HttpResponse.builder() HttpResponse removeResponse = HttpResponse.builder()
.statusCode(200) .statusCode(200)
.build(); .build();
@Test @Test
public void testDeleteUserHref() { public void testRemoveUserHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, delete, deleteResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, remove, removeResponse);
api.getUserApi().delete(userHref); api.getUserApi().remove(userHref);
} }
@Test @Test
public void testDeleteUserUrn() { public void testRemoveUserUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveUser, resolveUserResponse, delete, deleteResponse); VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveUser, resolveUserResponse, remove, removeResponse);
api.getUserApi().delete(userUrn); api.getUserApi().remove(userUrn);
} }
public static final User createUserSource() { public static final User addUserSource() {
return User.builder() return User.builder()
.name("test") .name("test")
.fullName("testFullName") .fullName("testFullName")
@ -255,8 +255,8 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.build(); .build();
} }
public static final User createUser() { public static final User addUser() {
return createUserSource().toBuilder() return addUserSource().toBuilder()
.id("urn:vcloud:user:b37223f3-8792-477a-820f-334998f61cd6") .id("urn:vcloud:user:b37223f3-8792-477a-820f-334998f61cd6")
.type("application/vnd.vmware.admin.user+xml") .type("application/vnd.vmware.admin.user+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/b37223f3-8792-477a-820f-334998f61cd6")) .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/b37223f3-8792-477a-820f-334998f61cd6"))
@ -278,12 +278,12 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
} }
public static final User user() { public static final User user() {
return createUser().toBuilder() return addUser().toBuilder()
.nameInSource("test") .nameInSource("test")
.build(); .build();
} }
public static final User updateUserSource() { public static final User editUserSource() {
return user().toBuilder() return user().toBuilder()
.fullName("new"+user().getFullName()) .fullName("new"+user().getFullName())
.emailAddress("new"+user().getEmailAddress()) .emailAddress("new"+user().getEmailAddress())
@ -299,8 +299,8 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.build(); .build();
} }
public static final User updateUser() { public static final User editUser() {
return updateUserSource().toBuilder() return editUserSource().toBuilder()
.password(null) .password(null)
.build(); .build();
} }

View File

@ -70,7 +70,7 @@ public class UserApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void cleanUp() throws Exception { public void cleanUp() throws Exception {
if (user != null) { if (user != null) {
try { try {
userApi.delete(user.getHref()); userApi.remove(user.getHref());
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error deleting user '%s'", user.getName()); logger.warn(e, "Error deleting user '%s'", user.getName());
} }
@ -78,13 +78,13 @@ public class UserApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "POST /admin/org/{id}/users") @Test(description = "POST /admin/org/{id}/users")
public void testCreateUser() { public void testAddUser() {
User newUser = randomTestUser("testCreateUser"); User newUser = randomTestUser("testAddUser");
user = userApi.createUserInOrg(newUser, org.getId()); user = userApi.addUserToOrg(newUser, org.getId());
checkUser(newUser); checkUser(newUser);
} }
@Test(description = "GET /admin/user/{id}", dependsOnMethods = { "testCreateUser" }) @Test(description = "GET /admin/user/{id}", dependsOnMethods = { "testAddUser" })
public void testGetUser() { public void testGetUser() {
user = userApi.get(user.getHref()); user = userApi.get(user.getHref());
@ -92,7 +92,7 @@ public class UserApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} }
@Test(description = "PUT /admin/user/{id}", dependsOnMethods = { "testGetUser" }) @Test(description = "PUT /admin/user/{id}", dependsOnMethods = { "testGetUser" })
public void testUpdateUser() { public void testEditUser() {
User oldUser = user.toBuilder().build(); User oldUser = user.toBuilder().build();
User newUser = user.toBuilder() User newUser = user.toBuilder()
.fullName("new"+oldUser.getFullName()) .fullName("new"+oldUser.getFullName())
@ -111,7 +111,7 @@ public class UserApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.role(getRoleReferenceFor(DefaultRoles.AUTHOR.value())) .role(getRoleReferenceFor(DefaultRoles.AUTHOR.value()))
.build(); .build();
userApi.update(user.getHref(), newUser); userApi.edit(user.getHref(), newUser);
user = userApi.get(user.getHref()); user = userApi.get(user.getHref());
checkUser(user); checkUser(user);
@ -148,7 +148,7 @@ public class UserApiLiveTest extends BaseVCloudDirectorApiLiveTest {
sessionApi.logoutSessionWithToken(sessionWithToken.getSession().getHref(), sessionWithToken.getToken()); sessionApi.logoutSessionWithToken(sessionWithToken.getSession().getHref(), sessionWithToken.getToken());
} }
@Test(description = "POST /admin/user/{id}/action/unlock", dependsOnMethods = { "testUpdateUser" }) @Test(description = "POST /admin/user/{id}/action/unlock", dependsOnMethods = { "testEditUser" })
public void testUnlockUser() { public void testUnlockUser() {
// Need to know how many times to fail login to lock account // Need to know how many times to fail login to lock account
AdminOrgApi adminOrgApi = adminContext.getApi().getOrgApi(); AdminOrgApi adminOrgApi = adminContext.getApi().getOrgApi();
@ -164,7 +164,7 @@ public class UserApiLiveTest extends BaseVCloudDirectorApiLiveTest {
if (!settings.isAccountLockoutEnabled()) { if (!settings.isAccountLockoutEnabled()) {
settingsToRevertTo = settings; settingsToRevertTo = settings;
settings = settings.toBuilder().accountLockoutEnabled(true).invalidLoginsBeforeLockout(5).build(); settings = settings.toBuilder().accountLockoutEnabled(true).invalidLoginsBeforeLockout(5).build();
settings = adminOrgApi.updatePasswordPolicy(org.getId(), settings); settings = adminOrgApi.editPasswordPolicy(org.getId(), settings);
} }
assertTrue(settings.isAccountLockoutEnabled()); assertTrue(settings.isAccountLockoutEnabled());
@ -202,21 +202,21 @@ public class UserApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// Return account settings to the previous values, if necessary // Return account settings to the previous values, if necessary
if (settingsToRevertTo != null) { if (settingsToRevertTo != null) {
adminOrgApi.updatePasswordPolicy(org.getId(), settingsToRevertTo); adminOrgApi.editPasswordPolicy(org.getId(), settingsToRevertTo);
} }
} }
@Test(description = "DELETE /admin/user/{id}", dependsOnMethods = { "testCreateUser" }) @Test(description = "DELETE /admin/user/{id}", dependsOnMethods = { "testAddUser" })
public void testDeleteUser() { public void testRemoveUser() {
// Create a user to be deleted (so we remove dependencies on test ordering) // Create a user to be removed (so we remove dependencies on test ordering)
User newUser = randomTestUser("testDeleteUser"+getTestDateTimeStamp()); User newUser = randomTestUser("testRemoveUser"+getTestDateTimeStamp());
User userToBeDeleted = userApi.createUserInOrg(newUser, org.getId()); User userToBeDeleted = userApi.addUserToOrg(newUser, org.getId());
// Delete the user // Delete the user
userApi.delete(userToBeDeleted.getHref()); userApi.remove(userToBeDeleted.getHref());
// Confirm cannot no longer be accessed // Confirm cannot no longer be accessed
User deleted = userApi.get(userToBeDeleted.getHref()); User removed = userApi.get(userToBeDeleted.getHref());
assertNull(deleted); assertNull(removed);
} }
} }

View File

@ -481,7 +481,7 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
protected void cleanUpVAppTemplate(VAppTemplate vAppTemplate) { protected void cleanUpVAppTemplate(VAppTemplate vAppTemplate) {
VAppTemplateApi vappTemplateApi = context.getApi().getVAppTemplateApi(); VAppTemplateApi vappTemplateApi = context.getApi().getVAppTemplateApi();
try { try {
Task task = vappTemplateApi.deleteVappTemplate(vAppTemplate.getHref()); Task task = vappTemplateApi.removeVappTemplate(vAppTemplate.getHref());
taskDoneEventually(task); taskDoneEventually(task);
} catch (Exception e) { } catch (Exception e) {
logger.warn(e, "Error deleting template '%s'", vAppTemplate.getName()); logger.warn(e, "Error deleting template '%s'", vAppTemplate.getName());
@ -499,12 +499,12 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
VApp vApp = vAppApi.getVApp(vAppURI); // Refresh VApp vApp = vAppApi.getVApp(vAppURI); // Refresh
if (vApp == null) { if (vApp == null) {
logger.info("Cannot find VApp at %s", vAppURI.getPath()); logger.info("Cannot find VApp at %s", vAppURI.getPath());
return; // Presumably vApp has already been deleted. Ignore. return; // Presumably vApp has already been removed. Ignore.
} }
logger.debug("Deleting VApp %s (%s)", vApp.getName(), vAppURI.getPath()); logger.debug("Deleting VApp %s (%s)", vApp.getName(), vAppURI.getPath());
// Wait for busy tasks to complete (don't care if it's failed or successful) // Wait for busy tasks to complete (don't care if it's failed or successful)
// Otherwise, get error on delete "entity is busy completing an operation. // Otherwise, get error on remove "entity is busy completing an operation.
if (vApp.getTasks() != null) { if (vApp.getTasks() != null) {
for (Task task : vApp.getTasks()) { for (Task task : vApp.getTasks()) {
if (!taskDoneEventually(task)) { if (!taskDoneEventually(task)) {
@ -539,7 +539,7 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
} }
try { try {
Task task = vAppApi.deleteVApp(vAppURI); Task task = vAppApi.removeVApp(vAppURI);
taskDoneEventually(task); taskDoneEventually(task);
vAppNames.remove(vApp.getName()); vAppNames.remove(vApp.getName());
logger.info("Deleted VApp %s", vApp.getName()); logger.info("Deleted VApp %s", vApp.getName());