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
);
// 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.
*
* Required on create and modify if {@link #isSharedToEveryone()} is false.
* Required on create and edit if {@link #isSharedToEveryone()} is false.
*/
public List<AccessSetting> getAccessSettings() {
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> {
private List<Vm> createItem;
private List<Reference> deleteItem;
private List<Reference> removeItem;
/**
* @see RecomposeVAppParams#getCreateItem()
@ -82,8 +82,8 @@ public class RecomposeVAppParams extends ComposeVAppParams {
/**
* @see RecomposeVAppParams#getDeleteItem()
*/
public B deleteItem(List<Reference> deleteItem) {
this.deleteItem = deleteItem;
public B removeItem(List<Reference> removeItem) {
this.removeItem = removeItem;
return self();
}
@ -93,7 +93,7 @@ public class RecomposeVAppParams extends ComposeVAppParams {
}
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) {
super(builder);
this.createItem = builder.createItem;
this.deleteItem = builder.deleteItem;
this.removeItem = builder.removeItem;
}
@XmlElement(name = "CreateItem")
protected List<Vm> createItem;
@XmlElement(name = "DeleteItem")
protected List<Reference> deleteItem;
protected List<Reference> removeItem;
/**
* 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() {
if (deleteItem == null) {
deleteItem = new ArrayList<Reference>();
if (removeItem == null) {
removeItem = new ArrayList<Reference>();
}
return this.deleteItem;
return this.removeItem;
}
@Override
@ -140,17 +140,17 @@ public class RecomposeVAppParams extends ComposeVAppParams {
return false;
RecomposeVAppParams that = RecomposeVAppParams.class.cast(o);
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
public int hashCode() {
return Objects.hashCode(super.hashCode(), createItem, deleteItem);
return Objects.hashCode(super.hashCode(), createItem, removeItem);
}
@Override
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
* the URI of the catalog
* @param item
* the catalog item to create
* @return the created catalog item
* the catalog item to add
* @return the addd catalog item
*/
CatalogItem addItem(String catalogUrn, CatalogItem item);
@ -94,11 +94,11 @@ public interface CatalogApi {
* the reference for the catalog item
* @param catalogItem
* 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.
@ -110,9 +110,9 @@ public interface CatalogApi {
* @param catalogItemRef
* 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

View File

@ -83,22 +83,22 @@ public interface CatalogAsyncApi {
ListenableFuture<CatalogItem> getItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
/**
* @see CatalogApi#updateItem(String, CatalogItem)
* @see CatalogApi#editItem(String, CatalogItem)
*/
@PUT
@Consumes(VCloudDirectorMediaType.CATALOG_ITEM)
@Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser
ListenableFuture<CatalogItem> updateItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn,
ListenableFuture<CatalogItem> editItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/**
* @see CatalogApi#deleteItem(String)
* @see CatalogApi#removeItem(String)
*/
@DELETE
@Consumes
@JAXBResponseParser
ListenableFuture<Void> deleteItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
ListenableFuture<Void> removeItem(@EndpointParam(parser = CatalogItemURNToHref.class) String catalogItemUrn);
/**
* @see CatalogApi#get(URI)
@ -130,22 +130,22 @@ public interface CatalogAsyncApi {
ListenableFuture<CatalogItem> getItem(@EndpointParam URI catalogItemHref);
/**
* @see CatalogApi#updateItem(URI, CatalogItem)
* @see CatalogApi#editItem(URI, CatalogItem)
*/
@PUT
@Consumes(VCloudDirectorMediaType.CATALOG_ITEM)
@Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser
ListenableFuture<CatalogItem> updateItem(@EndpointParam URI catalogItemHref,
ListenableFuture<CatalogItem> editItem(@EndpointParam URI catalogItemHref,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/**
* @see CatalogApi#deleteItem(URI)
* @see CatalogApi#removeItem(URI)
*/
@DELETE
@Consumes
@JAXBResponseParser
ListenableFuture<Void> deleteItem(@EndpointParam URI catalogItemHref);
ListenableFuture<Void> removeItem(@EndpointParam URI catalogItemHref);
/**
* @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.
*/
Media createMedia(URI uploadLink, Media media);
Media addMedia(URI uploadLink, Media media);
/**
* 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
* 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.
*/
Task deleteMedia(URI mediaUri);
Task removeMedia(URI mediaUri);
/**
* Retrieves an owner.

View File

@ -62,13 +62,13 @@ public interface MediaAsyncApi {
ListenableFuture<Media> getMedia(@EndpointParam URI uri);
/**
* @see MediaApi#createMedia(URI, Media)
* @see MediaApi#addMedia(URI, Media)
*/
@POST
@Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser
ListenableFuture<Media> createMedia(@EndpointParam URI link,
ListenableFuture<Media> addMedia(@EndpointParam URI link,
@BinderParam(BindToXMLPayload.class) Media media);
@ -84,21 +84,21 @@ public interface MediaAsyncApi {
@BinderParam(BindToXMLPayload.class) CloneMediaParams params);
/**
* @see MediaApi#updateMedia(URI, Media))
* @see MediaApi#editMedia(URI, Media))
*/
@PUT
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.MEDIA)
@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
@Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser
ListenableFuture<Task> deleteMedia(@EndpointParam URI uri);
ListenableFuture<Task> removeMedia(@EndpointParam URI 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
* 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);
/**
* @see MetadataApi.Writable#deleteEntry(URI, String))
* @see MetadataApi.Writable#removeEntry(URI, String))
*/
@DELETE
@Path("/metadata/{key}")
@Consumes(VCloudDirectorMediaType.TASK)
@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:
* <ul>
* <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.
* <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
@ -98,7 +98,7 @@ public interface VAppApi {
*
* @since 0.9
*/
Task modifyVApp(URI vAppURI, VApp vApp);
Task editVApp(URI vAppURI, VApp vApp);
/**
* Deletes a {@link VApp}.
@ -109,7 +109,7 @@ public interface VAppApi {
*
* @since 0.9
*/
Task deleteVApp(URI vAppURI);
Task removeVApp(URI vAppURI);
/**
* Modifies the control access of a {@link VApp}.
@ -120,7 +120,7 @@ public interface VAppApi {
*
* @since 0.9
*/
ControlAccessParams modifyControlAccess(URI vAppURI, ControlAccessParams params);
ControlAccessParams editControlAccess(URI vAppURI, ControlAccessParams params);
/**
* Deploys a {@link VApp}.
@ -217,7 +217,7 @@ public interface VAppApi {
* Retrieves the control access information for a {@link VApp}.
*
* 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>
* GET /vApp/{id}/controlAccess
@ -330,7 +330,7 @@ public interface VAppApi {
*
* @since 0.9
*/
Task modifyLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section);
Task editLeaseSettingsSection(URI vAppURI, LeaseSettingsSection section);
/**
* Retrieves the network config section of a {@link VApp}.
@ -352,7 +352,7 @@ public interface VAppApi {
*
* @since 0.9
*/
Task modifyNetworkConfigSection(URI vAppURI, NetworkConfigSection section);
Task editNetworkConfigSection(URI vAppURI, NetworkConfigSection section);
/**
* Retrieves the network section of a {@link VApp}.
@ -385,7 +385,7 @@ public interface VAppApi {
*
* @since 1.5
*/
void modifyOwner(URI vAppURI, Owner owner);
void editOwner(URI vAppURI, Owner owner);
/**
* Retrieves {@link VApp} product sections.
@ -407,7 +407,7 @@ public interface VAppApi {
*
* @since 1.5
*/
Task modifyProductSections(URI vAppURI, ProductSectionList sectionList);
Task editProductSections(URI vAppURI, ProductSectionList sectionList);
/**
* Retrieves the startup section of a {@link VApp}.
@ -429,7 +429,7 @@ public interface VAppApi {
*
* @since 0.9
*/
Task modifyStartupSection(URI vAppURI, StartupSection section);
Task editStartupSection(URI vAppURI, StartupSection section);
/**
* Synchronous access to {@link VApp} {@link Metadata} features.

View File

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

View File

@ -52,10 +52,10 @@ public interface VAppTemplateApi {
* The vApp could be in one of these statues:
* <ul>
* <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.
* <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)} -
* Entity is resolved.
* <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
* 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.
@ -100,7 +100,7 @@ public interface VAppTemplateApi {
* @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 deleteVappTemplate(URI templateUri);
Task removeVappTemplate(URI templateUri);
/**
* 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
* 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
@ -215,7 +215,7 @@ public interface VAppTemplateApi {
* @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 modifyLeaseSettingsSection(URI templateUri, LeaseSettingsSection section);
Task editLeaseSettingsSection(URI templateUri, LeaseSettingsSection section);
/**
* 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
* task status in order to check when it is completed.
*/
Task modifyProductSections(URI templateUri, ProductSectionList sections);
Task editProductSections(URI templateUri, ProductSectionList sections);
/**
* <pre>

View File

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

View File

@ -147,14 +147,14 @@ public interface VdcAsyncApi {
@BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params);
/**
* @see VdcApi#createMedia(String, Media)
* @see VdcApi#addMedia(String, Media)
*/
@POST
@Path("/media")
@Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser
ListenableFuture<Media> createMedia(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
ListenableFuture<Media> addMedia(@EndpointParam(parser = VdcURNToHref.class) String vdcUrn,
@BinderParam(BindToXMLPayload.class) Media media);
/**
@ -245,14 +245,14 @@ public interface VdcAsyncApi {
@BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params);
/**
* @see VdcApi#createMedia(URI, Media)
* @see VdcApi#addMedia(URI, Media)
*/
@POST
@Path("/media")
@Consumes(VCloudDirectorMediaType.MEDIA)
@Produces(VCloudDirectorMediaType.MEDIA)
@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

View File

@ -58,23 +58,23 @@ public interface VmApi {
* @since 0.9
* @see VAppApi#getVApp(URI)
*/
Vm getVm(URI vmURI);
Vm get(URI vmURI);
/**
* Modifies the name/description of a {@link Vm}.
*
* @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}.
*
* @since 0.9
* @see VAppApi#deleteVApp(URI)
* @see VAppApi#removeVApp(URI)
*/
Task deleteVm(URI vmURI);
Task remove(URI vmURI);
/**
* Consolidates a {@link Vm}.
@ -85,7 +85,7 @@ public interface VmApi {
*
* @since 1.5
*/
Task consolidateVm(URI vmURI);
Task consolidate(URI vmURI);
/**
* Deploys a {@link Vm}.
@ -125,7 +125,7 @@ public interface VmApi {
*
* @since 1.5
*/
Task relocateVm(URI vmURI, RelocateParams params);
Task relocate(URI vmURI, RelocateParams params);
/**
* Undeploy a {@link Vm}.
@ -216,7 +216,7 @@ public interface VmApi {
*
* @since 1.0
*/
Task modifyGuestCustomizationSection(URI vmURI, GuestCustomizationSection section);
Task editGuestCustomizationSection(URI vmURI, GuestCustomizationSection section);
/**
* Ejects media from a {@link Vm}.
@ -260,7 +260,7 @@ public interface VmApi {
*
* @since 0.9
*/
Task modifyNetworkConnectionSection(URI vmURI, NetworkConnectionSection section);
Task editNetworkConnectionSection(URI vmURI, NetworkConnectionSection section);
/**
* Retrieves the operating system section of a {@link Vm}.
@ -282,7 +282,7 @@ public interface VmApi {
*
* @since 0.9
*/
Task modifyOperatingSystemSection(URI vmURI, OperatingSystemSection section);
Task editOperatingSystemSection(URI vmURI, OperatingSystemSection section);
/**
* Retrieves {@link Vm} product sections.
@ -296,9 +296,9 @@ public interface VmApi {
* Modifies the product section information of a {@link Vm}.
*
* @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}.
@ -387,7 +387,7 @@ public interface VmApi {
*
* @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}.
@ -409,7 +409,7 @@ public interface VmApi {
*
* @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}.
@ -431,7 +431,7 @@ public interface VmApi {
*
* @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}.
@ -464,7 +464,7 @@ public interface VmApi {
*
* @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}.
@ -486,7 +486,7 @@ public interface VmApi {
*
* @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}.
@ -508,7 +508,7 @@ public interface VmApi {
*
* @since 1.5
*/
Task modifyVirtualHardwareSectionSerialPorts(URI vmURI, RasdItemsList rasdItemsList);
Task editVirtualHardwareSectionSerialPorts(URI vmURI, RasdItemsList rasdItemsList);
/**
* Synchronous access to {@link Vm} {@link Metadata} features.

View File

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

View File

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

View File

@ -66,13 +66,13 @@ public interface AdminNetworkApi extends NetworkApi {
* @param networkUrn
* the reference for the network
* @param network
* the updated network
* the edited network
* @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 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

View File

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

View File

@ -87,12 +87,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn
* the reference for the admin org
* @param newSettings
* the requested updated settings
* the requested edited 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.
@ -119,12 +119,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn
* the reference for the admin org
* @param newSettings
* the requested updated settings
* the requested edited 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.
@ -151,12 +151,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn
* the reference for the admin org
* @param newSettings
* the requested updated settings
* the requested edited 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.
@ -198,12 +198,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn
* the reference for the admin org
* @param newSettings
* the requested updated settings
* the requested edited 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.
@ -230,12 +230,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn
* the reference for the admin org
* @param newSettings
* the requested updated settings
* the requested edited 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.
@ -262,12 +262,12 @@ public interface AdminOrgApi extends OrgApi {
* @param orgUrn
* the reference for the admin org
* @param newSettings
* the requested updated settings
* the requested edited 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

View File

@ -98,25 +98,25 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgSettings> getSettings(@EndpointParam URI adminOrgHref);
/**
* @see AdminOrgApi#updateSettings(String, OrgSettings)
* @see AdminOrgApi#editSettings(String, OrgSettings)
*/
@PUT
@Path("/settings")
@Consumes(VCloudDirectorMediaType.ORG_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgSettings> updateSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
ListenableFuture<OrgSettings> editSettings(@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgSettings settings);
/**
* @see AdminOrgApi#updateSettings(URI, OrgSettings)
* @see AdminOrgApi#editSettings(URI, OrgSettings)
*/
@PUT
@Path("/settings")
@Consumes(VCloudDirectorMediaType.ORG_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgSettings> updateSettings(@EndpointParam URI adminOrgHref,
ListenableFuture<OrgSettings> editSettings(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgSettings settings);
/**
@ -140,26 +140,26 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgEmailSettings> getEmailSettings(@EndpointParam URI adminOrgHref);
/**
* @see AdminOrgApi#updateEmailSettings(String, OrgEmailSettings)
* @see AdminOrgApi#editEmailSettings(String, OrgEmailSettings)
*/
@PUT
@Path("/settings/email")
@Consumes(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgEmailSettings> updateEmailSettings(
ListenableFuture<OrgEmailSettings> editEmailSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgEmailSettings settings);
/**
* @see AdminOrgApi#updateEmailSettings(URI, OrgEmailSettings)
* @see AdminOrgApi#editEmailSettings(URI, OrgEmailSettings)
*/
@PUT
@Path("/settings/email")
@Consumes(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgEmailSettings> updateEmailSettings(@EndpointParam URI adminOrgHref,
ListenableFuture<OrgEmailSettings> editEmailSettings(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgEmailSettings settings);
/**
@ -184,26 +184,26 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgGeneralSettings> getGeneralSettings(@EndpointParam URI adminOrgHref);
/**
* @see AdminOrgApi#updateGeneralSettings(String, OrgGeneralSettings)
* @see AdminOrgApi#editGeneralSettings(String, OrgGeneralSettings)
*/
@PUT
@Path("/settings/general")
@Consumes(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgGeneralSettings> updateGeneralSettings(
ListenableFuture<OrgGeneralSettings> editGeneralSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings);
/**
* @see AdminOrgApi#updateGeneralSettings(URI, OrgGeneralSettings)
* @see AdminOrgApi#editGeneralSettings(URI, OrgGeneralSettings)
*/
@PUT
@Path("/settings/general")
@Consumes(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgGeneralSettings> updateGeneralSettings(@EndpointParam URI adminOrgHref,
ListenableFuture<OrgGeneralSettings> editGeneralSettings(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings);
/**
@ -248,26 +248,26 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy(@EndpointParam URI adminOrgHref);
/**
* @see AdminOrgApi#updatePasswordPolicy(String, OrgPasswordPolicySettings)
* @see AdminOrgApi#editPasswordPolicy(String, OrgPasswordPolicySettings)
*/
@PUT
@Path("/settings/passwordPolicy")
@Consumes(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgPasswordPolicySettings> updatePasswordPolicy(
ListenableFuture<OrgPasswordPolicySettings> editPasswordPolicy(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings);
/**
* @see AdminOrgApi#updatePasswordPolicy(URI, OrgPasswordPolicySettings)
* @see AdminOrgApi#editPasswordPolicy(URI, OrgPasswordPolicySettings)
*/
@PUT
@Path("/settings/passwordPolicy")
@Consumes(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgPasswordPolicySettings> updatePasswordPolicy(@EndpointParam URI adminOrgHref,
ListenableFuture<OrgPasswordPolicySettings> editPasswordPolicy(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings);
/**
@ -292,26 +292,26 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings(@EndpointParam URI adminOrgHref);
/**
* @see AdminOrgApi#updateVAppLeaseSettings(String, OrgVAppLeaseSettings)
* @see AdminOrgApi#editVAppLeaseSettings(String, OrgVAppLeaseSettings)
*/
@PUT
@Path("/settings/vAppLeaseSettings")
@Consumes(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgLeaseSettings> updateVAppLeaseSettings(
ListenableFuture<OrgLeaseSettings> editVAppLeaseSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings);
/**
* @see AdminOrgApi#updateVAppLeaseSettings(URI, OrgVAppLeaseSettings)
* @see AdminOrgApi#editVAppLeaseSettings(URI, OrgVAppLeaseSettings)
*/
@PUT
@Path("/settings/vAppLeaseSettings")
@Consumes(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgLeaseSettings> updateVAppLeaseSettings(@EndpointParam URI adminOrgHref,
ListenableFuture<OrgLeaseSettings> editVAppLeaseSettings(@EndpointParam URI adminOrgHref,
@BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings);
/**
@ -336,26 +336,26 @@ public interface AdminOrgAsyncApi extends OrgAsyncApi {
ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref);
/**
* @see AdminOrgApi#updateVAppTemplateLeaseSettings(String, OrgVAppTemplateLeaseSettings)
* @see AdminOrgApi#editVAppTemplateLeaseSettings(String, OrgVAppTemplateLeaseSettings)
*/
@PUT
@Path("/settings/vAppTemplateLeaseSettings")
@Consumes(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgVAppTemplateLeaseSettings> updateVAppTemplateLeaseSettings(
ListenableFuture<OrgVAppTemplateLeaseSettings> editVAppTemplateLeaseSettings(
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn,
@BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings);
/**
* @see AdminOrgApi#updateVAppTemplateLeaseSettings(URI, OrgVAppTemplateLeaseSettings)
* @see AdminOrgApi#editVAppTemplateLeaseSettings(URI, OrgVAppTemplateLeaseSettings)
*/
@PUT
@Path("/settings/vAppTemplateLeaseSettings")
@Consumes(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@JAXBResponseParser
ListenableFuture<OrgVAppTemplateLeaseSettings> updateVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref,
ListenableFuture<OrgVAppTemplateLeaseSettings> editVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref,
@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
* 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
* vDC is disabled, an organization user cannot deploy or create a new virtual machine in the
* vDC (deploy uses memory and cpu allocations, and create uses storage allocation).
* vDC is disabled, an organization user cannot deploy or add a new virtual machine in the
* vDC (deploy uses memory and cpu allocations, and add uses storage allocation).
*
* @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),
* 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.
*/
// 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.

View File

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

View File

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

View File

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

View File

@ -42,11 +42,11 @@ public interface UserApi {
*
* @param orgUrn
* 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.
@ -75,20 +75,20 @@ public interface UserApi {
* the reference for the 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>
* DELETE /admin/catalog/{id}
* </pre>
*/
void delete(String userUrn);
void remove(String userUrn);
void delete(URI userHref);
void remove(URI userHref);
/**
* Unlocks a user.

View File

@ -51,25 +51,25 @@ import com.google.common.util.concurrent.ListenableFuture;
public interface UserAsyncApi {
/**
* @see UserApi#createUserInOrg(User, String)
* @see UserApi#addUserToOrg(User, String)
*/
@POST
@Path("/users")
@Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser
ListenableFuture<User> createUserInOrg(@BinderParam(BindToXMLPayload.class) User user,
ListenableFuture<User> addUserToOrg(@BinderParam(BindToXMLPayload.class) User user,
@EndpointParam(parser = OrgURNToAdminHref.class) String orgUrn);
/**
* @see UserApi#createUserInOrg(User, URI)
* @see UserApi#addUserToOrg(User, URI)
*/
@POST
@Path("/users")
@Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser
ListenableFuture<User> createUserInOrg(@BinderParam(BindToXMLPayload.class) User user,
ListenableFuture<User> addUserToOrg(@BinderParam(BindToXMLPayload.class) User user,
@EndpointParam URI orgAdminHref);
/**
@ -91,39 +91,39 @@ public interface UserAsyncApi {
ListenableFuture<User> get(@EndpointParam URI userHref);
/**
* @see UserApi#update(String, User)
* @see UserApi#edit(String, User)
*/
@PUT
@Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER)
@JAXBResponseParser
ListenableFuture<User> update(@EndpointParam(parser = UserURNToHref.class) String userUrn,
ListenableFuture<User> edit(@EndpointParam(parser = UserURNToHref.class) String userUrn,
@BinderParam(BindToXMLPayload.class) User user);
/**
* @see UserApi#update(URI, User)
* @see UserApi#edit(URI, User)
*/
@PUT
@Consumes(VCloudDirectorMediaType.USER)
@Produces(VCloudDirectorMediaType.USER)
@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
@Consumes
@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
@Consumes
@JAXBResponseParser
ListenableFuture<Void> delete(@EndpointParam URI userHref);
ListenableFuture<Void> remove(@EndpointParam URI userHref);
/**
* @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() {
vdc = vdcApi.get(vdcUrn); // Refresh
@ -197,7 +197,7 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
Iterable<Reference> vApps = Iterables.filter(vdc.getResourceEntities(),
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)) {
for (Reference ref : vApps) {
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}.
*/
protected Vm powerOnVm(final URI testVmURI) {
Vm test = vmApi.getVm(testVmURI);
Vm test = vmApi.get(testVmURI);
Status status = test.getStatus();
if (status != Status.POWERED_ON) {
Task powerOn = vmApi.powerOn(vm.getHref());
assertTaskSucceedsLong(powerOn);
}
test = vmApi.getVm(testVmURI);
test = vmApi.get(testVmURI);
assertStatus(VM, test, Status.POWERED_ON);
return test;
}
@ -294,14 +294,14 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
* Power off a {@link Vm}.
*/
protected Vm powerOffVm(final URI testVmURI) {
Vm test = vmApi.getVm(testVmURI);
Vm test = vmApi.get(testVmURI);
Status status = test.getStatus();
if (status != Status.POWERED_OFF || test.isDeployed()) {
UndeployVAppParams undeployParams = UndeployVAppParams.builder().build();
Task shutdownVapp = vAppApi.undeploy(test.getHref(), undeployParams);
assertTaskSucceedsLong(shutdownVapp);
}
test = vmApi.getVm(testVmURI);
test = vmApi.get(testVmURI);
assertStatus(VM, test, Status.POWERED_OFF);
return test;
}
@ -325,13 +325,13 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
* Suspend a {@link Vm}.
*/
protected Vm suspendVm(final URI testVmURI) {
Vm test = vmApi.getVm(testVmURI);
Vm test = vmApi.get(testVmURI);
Status status = test.getStatus();
if (status != Status.SUSPENDED) {
Task suspend = vmApi.suspend(vm.getHref());
assertTaskSucceedsLong(suspend);
}
test = vmApi.getVm(testVmURI);
test = vmApi.get(testVmURI);
assertStatus(VM, test, Status.SUSPENDED);
return test;
}
@ -348,7 +348,7 @@ public abstract class AbstractVAppApiLiveTest extends BaseVCloudDirectorApiLiveT
* Check the {@link Vm}s current status.
*/
protected void assertVmStatus(final URI testVmURI, final Status status) {
Vm testVm = vmApi.getVm(testVmURI);
Vm testVm = vmApi.get(testVmURI);
assertStatus(VM, testVm, status);
}

View File

@ -115,7 +115,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
HttpResponse addResponse = HttpResponse.builder()
.statusCode(200)
.payload(payloadFromResourceWithContentType("/catalog/createdCatalogItem.xml", CATALOG_ITEM + ";version=1.5"))
.payload(payloadFromResourceWithContentType("/catalog/adddCatalogItem.xml", CATALOG_ITEM + ";version=1.5"))
.build();
CatalogItem newItem = CatalogItem.builder()
@ -127,13 +127,13 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
@Test
public void testAddCatalogItemHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, add, addResponse);
assertEquals(api.getCatalogApi().addItem(catalogHref, newItem), createdCatalogItem());
assertEquals(api.getCatalogApi().addItem(catalogHref, newItem), adddCatalogItem());
}
@Test
public void testAddCatalogItemUrn() {
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()
@ -233,53 +233,53 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
assertEquals(api.getCatalogApi().getItem(itemUrn), catalogItem());
}
HttpRequest updateItem = HttpRequest.builder()
HttpRequest editItem = HttpRequest.builder()
.method("PUT")
.endpoint(endpoint + "/catalogItem/" + item)
.addHeader("Accept", "application/vnd.vmware.vcloud.catalogItem+xml")
.addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/catalog/updateCatalogItem.xml", CATALOG_ITEM))
.payload(payloadFromResourceWithContentType("/catalog/editCatalogItem.xml", CATALOG_ITEM))
.build();
HttpResponse updateItemResponse = HttpResponse.builder()
HttpResponse editItemResponse = HttpResponse.builder()
.statusCode(200)
.payload(payloadFromResourceWithContentType("/catalog/updateCatalogItem.xml", CATALOG_ITEM + ";version=1.5"))
.payload(payloadFromResourceWithContentType("/catalog/editCatalogItem.xml", CATALOG_ITEM + ";version=1.5"))
.build();
@Test
public void testUpdateCatalogItemHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, updateItem, updateItemResponse);
assertEquals(api.getCatalogApi().updateItem(itemHref, catalogItem()), catalogItem());
public void testEditCatalogItemHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, editItem, editItemResponse);
assertEquals(api.getCatalogApi().editItem(itemHref, catalogItem()), catalogItem());
}
@Test
public void testUpdateCatalogItemUrn() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, resolveItem, resolveItemResponse, updateItem, updateItemResponse);
assertEquals(api.getCatalogApi().updateItem(itemUrn, catalogItem()), catalogItem());
public void testEditCatalogItemUrn() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, resolveItem, resolveItemResponse, editItem, editItemResponse);
assertEquals(api.getCatalogApi().editItem(itemUrn, catalogItem()), catalogItem());
}
HttpRequest deleteItem = HttpRequest.builder()
HttpRequest removeItem = HttpRequest.builder()
.method("DELETE")
.endpoint(endpoint + "/catalogItem/" + item)
.addHeader("Accept", "*/*")
.addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token).build();
HttpResponse deleteItemResponse = HttpResponse.builder()
HttpResponse removeItemResponse = HttpResponse.builder()
.statusCode(200)
.build();
@Test
public void testDeleteCatalogItemHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, deleteItem, deleteItemResponse);
api.getCatalogApi().deleteItem(itemHref);
public void testRemoveCatalogItemHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, removeItem, removeItemResponse);
api.getCatalogApi().removeItem(itemHref);
}
@Test
public void testDeleteCatalogItemUrn() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, resolveItem, resolveItemResponse, deleteItem, deleteItemResponse);
api.getCatalogApi().deleteItem(itemUrn);
public void testRemoveCatalogItemUrn() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, resolveItem, resolveItemResponse, removeItem, removeItemResponse);
api.getCatalogApi().removeItem(itemUrn);
}
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());
}
HttpRequest deleteItemMetadataEntry = HttpRequest.builder()
HttpRequest removeItemMetadataEntry = HttpRequest.builder()
.method("DELETE")
.endpoint(endpoint + "/catalogItem/" + item + "/metadata/KEY")
.addHeader("Accept", "application/vnd.vmware.vcloud.task+xml")
.addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token).build();
HttpResponse deleteItemMetadataEntryResponse = HttpResponse.builder()
HttpResponse removeItemMetadataEntryResponse = HttpResponse.builder()
.statusCode(200)
.payload(payloadFromResourceWithContentType("/catalog/deleteMetadataEntryTask.xml", TASK))
.payload(payloadFromResourceWithContentType("/catalog/removeMetadataEntryTask.xml", TASK))
.build();
@Test
public void testDeleteCatalogItemMetadataEntryHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, deleteItemMetadataEntry, deleteItemMetadataEntryResponse);
assertEquals(api.getCatalogApi().getItemMetadataApi().deleteEntry(itemHref, "KEY"), deleteEntryTask());
public void testRemoveCatalogItemMetadataEntryHref() {
VCloudDirectorApi api = requestsSendResponses(loginRequest, sessionResponse, removeItemMetadataEntry, removeItemMetadataEntryResponse);
assertEquals(api.getCatalogApi().getItemMetadataApi().removeEntry(itemHref, "KEY"), removeEntryTask());
}
public static final Catalog catalog() {
@ -425,7 +425,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
.build();
}
public static CatalogItem createdCatalogItem() {
public static CatalogItem adddCatalogItem() {
return CatalogItem.builder()
.name("newCatalogItem")
.id("urn:vcloud:catalogitem:" + item)
@ -607,7 +607,7 @@ public class CatalogApiExpectTest extends VCloudDirectorApiExpectTest {
.build();
}
public static Task deleteEntryTask() {
public static Task removeEntryTask() {
return Task.builder()
.name("task")
.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();
AdminCatalogApi adminCatalogApi = adminContext.getApi().getCatalogApi();
adminCatalog = adminCatalogApi.createCatalogInOrg(newCatalog, org.getId());
adminCatalog = adminCatalogApi.addCatalogToOrg(newCatalog, org.getId());
catalogUrn = catalogApi.get(
find(adminCatalog.getLinks(),
and(relEquals("alternate"), typeEquals(VCloudDirectorMediaType.CATALOG))).getHref()).getId();
@ -107,22 +107,22 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void tearDown() {
if (catalogItem != null) {
try {
catalogApi.deleteItem(catalogItem.getId());
catalogApi.removeItem(catalogItem.getId());
} catch (Exception e) {
logger.warn(e, "Error when deleting catalog item '%s'", catalogItem.getName());
}
}
if (media != null) {
try {
Task delete = context.getApi().getMediaApi().deleteMedia(media.getHref());
taskDoneEventually(delete);
Task remove = context.getApi().getMediaApi().removeMedia(media.getHref());
taskDoneEventually(remove);
} catch (Exception e) {
logger.warn(e, "Error when deleting media '%s'", media.getName());
}
}
if (adminContext != null && adminCatalog != null) {
try {
adminContext.getApi().getCatalogApi().delete(adminCatalog.getId());
adminContext.getApi().getCatalogApi().remove(adminCatalog.getId());
} catch (Exception e) {
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)));
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();
media = context.getApi().getMediaApi().createMedia(addMedia.getHref(), sourceMedia);
.imageType(Media.ImageType.ISO).description("Test media generated by testAddMedia()").build();
media = context.getApi().getMediaApi().addMedia(addMedia.getHref(), sourceMedia);
Checks.checkMediaFor(VCloudDirectorMediaType.MEDIA, media);
@ -167,17 +167,17 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
}
@Test(description = "PUT /catalogItem/{id}", dependsOnMethods = "testAddCatalogItem")
public void testUpdateCatalogItem() {
CatalogItem updatedCatalogItem = CatalogItem.builder().fromCatalogItem(catalogItem).name("UPDATEDNAME").build();
catalogItem = catalogApi.updateItem(catalogItem.getId(), updatedCatalogItem);
public void testEditCatalogItem() {
CatalogItem editedCatalogItem = CatalogItem.builder().fromCatalogItem(catalogItem).name("UPDATEDNAME").build();
catalogItem = catalogApi.editItem(catalogItem.getId(), editedCatalogItem);
checkCatalogItem(catalogItem);
assertEquals(catalogItem.getName(), "UPDATEDNAME");
}
// Note this runs after all the metadata tests
@Test(description = "DELETE /catalogItem/{id}", dependsOnMethods = "testDeleteCatalogItemMetadataValue")
public void testDeleteCatalogItem() {
catalogApi.deleteItem(catalogItem.getId());
@Test(description = "DELETE /catalogItem/{id}", dependsOnMethods = "testRemoveCatalogItemMetadataValue")
public void testRemoveCatalogItem() {
catalogApi.removeItem(catalogItem.getId());
catalogItem = catalogApi.getItem(catalogItem.getId());
assertNull(catalogItem);
}
@ -254,20 +254,20 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
assertTrue(retryTaskSuccess.apply(setCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "setCatalogItemMetadataValue"));
MetadataValue updatedMetadataValue = catalogApi.getItemMetadataApi().getValue(catalogItem.getHref(), "KEY");
assertEquals(updatedMetadataValue.getValue(), newMetadataValue.getValue(), String.format(
MetadataValue editedMetadataValue = catalogApi.getItemMetadataApi().getValue(catalogItem.getHref(), "KEY");
assertEquals(editedMetadataValue.getValue(), newMetadataValue.getValue(), String.format(
CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", newMetadataValue.getValue(),
updatedMetadataValue.getValue()));
checkMetadataValue(updatedMetadataValue);
editedMetadataValue.getValue()));
checkMetadataValue(editedMetadataValue);
}
@Test(description = "DELETE /catalogItem/{id}/metadata/{key}", dependsOnMethods = "testGetCatalogItemMetadataValue")
public void testDeleteCatalogItemMetadataValue() {
Task deleteCatalogItemMetadataValue = catalogApi.getItemMetadataApi().deleteEntry(catalogItem.getHref(), "KEY");
checkTask(deleteCatalogItemMetadataValue);
assertTrue(retryTaskSuccess.apply(deleteCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "deleteCatalogItemMetadataValue"));
MetadataValue deleted = catalogApi.getMetadataApi().getValue(catalogItem.getHref(), "KEY");
assertNull(deleted);
public void testRemoveCatalogItemMetadataValue() {
Task removeCatalogItemMetadataValue = catalogApi.getItemMetadataApi().removeEntry(catalogItem.getHref(), "KEY");
checkTask(removeCatalogItemMetadataValue);
assertTrue(retryTaskSuccess.apply(removeCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "removeCatalogItemMetadataValue"));
MetadataValue removed = catalogApi.getMetadataApi().getValue(catalogItem.getHref(), "KEY");
assertNull(removed);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -133,14 +133,10 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
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 };
Media sourceMedia = Media.builder()
.type(VCloudDirectorMediaType.MEDIA)
.name(name("media"))
.size(iso.length)
.imageType(Media.ImageType.ISO)
.description("Test media generated by VAppApiLiveTest")
.build();
Media media = context.getApi().getMediaApi().createMedia(addMedia.getHref(), sourceMedia);
Media sourceMedia = Media.builder().type(VCloudDirectorMediaType.MEDIA).name(name("media"))
.size(iso.length).imageType(Media.ImageType.ISO)
.description("Test media generated by VAppApiLiveTest").build();
Media media = context.getApi().getMediaApi().addMedia(addMedia.getHref(), sourceMedia);
Link uploadLink = getFirst(getFirst(media.getFiles(), null).getLinks(), null);
context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
@ -161,9 +157,8 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
}
if (adminContext != null) {
Link orgLink = find(links, and(relEquals("up"), typeEquals(VCloudDirectorMediaType.ORG)));
userUrn = adminContext.getApi().getUserApi()
.createUserInOrg(randomTestUser("VAppAccessTest"), toAdminUri(orgLink)).getId();
userUrn = adminContext.getApi().getUserApi().addUserToOrg(randomTestUser("VAppAccessTest"), org.getId())
.getId();
}
user = lazyGetUser();
}
@ -172,15 +167,15 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
public void cleanUp() {
if (adminContext != null && mediaCreated && mediaURI != null) {
try {
Task delete = context.getApi().getMediaApi().deleteMedia(mediaURI);
taskDoneEventually(delete);
Task remove = context.getApi().getMediaApi().removeMedia(mediaURI);
taskDoneEventually(remove);
} catch (Exception e) {
logger.warn(e, "Error when deleting media");
}
}
if (adminContext != null && testUserCreated && userUrn != null) {
try {
adminContext.getApi().getUserApi().delete(userUrn);
adminContext.getApi().getUserApi().remove(userUrn);
} catch (Exception e) {
logger.warn(e, "Error when deleting user");
}
@ -199,9 +194,12 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
checkVApp(vApp);
// Check the required fields are set
assertEquals(vApp.isDeployed(), Boolean.FALSE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString()));
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()));
assertEquals(vApp.isDeployed(), Boolean.FALSE,
String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString()));
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 source.href vAppTemplateURI
@ -214,33 +212,31 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
public void testRecomposeVApp() {
Set<Vm> vms = getAvailableVMsFromVAppTemplates();
VApp composedVApp = vdcApi.composeVApp(vdcUrn, ComposeVAppParams.builder()
.name(name("composed-"))
.instantiationParams(instantiationParams())
.build());
VApp composedVApp = vdcApi.composeVApp(vdcUrn, ComposeVAppParams.builder().name(name("composed-"))
.instantiationParams(instantiationParams()).build());
// get the first vm to be added to vApp
Vm toAddVm = Iterables.get(vms, 0);
RecomposeVAppParams params = createRecomposeParams(composedVApp, toAddVm);
RecomposeVAppParams params = addRecomposeParams(composedVApp, toAddVm);
// The method under test
Task recomposeVApp = vAppApi.recompose(composedVApp.getHref(), params);
assertTaskSucceedsLong(recomposeVApp);
// add another vm instance to vApp
params = createRecomposeParams(composedVApp, toAddVm);
params = addRecomposeParams(composedVApp, toAddVm);
recomposeVApp = vAppApi.recompose(composedVApp.getHref(), params);
assertTaskSucceedsLong(recomposeVApp);
// delete a vm
// remove a vm
VApp configured = vAppApi.getVApp(composedVApp.getHref());
List<Vm> vmsToBeDeleted = configured.getChildren().getVms();
Vm toBeDeleted = Iterables.get(vmsToBeDeleted, 0);
Task deleteVm = vmApi.deleteVm(toBeDeleted.getHref());
assertTaskSucceedsLong(deleteVm);
Task removeVm = vmApi.remove(toBeDeleted.getHref());
assertTaskSucceedsLong(removeVm);
Task deleteVApp = vAppApi.deleteVApp(composedVApp.getHref());
assertTaskSucceedsLong(deleteVApp);
Task removeVApp = vAppApi.removeVApp(composedVApp.getHref());
assertTaskSucceedsLong(removeVApp);
}
private Set<Vm> getAvailableVMsFromVAppTemplates() {
@ -251,57 +247,52 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
vms.addAll(vAppTemplate.getChildren());
}
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
public boolean apply(Vm input) {
GuestCustomizationSection guestCustomizationSection = vmApi.getGuestCustomizationSection(input.getHref());
String computerName = guestCustomizationSection.getComputerName();
String retainComputerName = CharMatcher.inRange('0', '9')
.or(CharMatcher.inRange('a', 'z'))
.or(CharMatcher.inRange('A', 'Z'))
.or(CharMatcher.is('-'))
.retainFrom(computerName);
String retainComputerName = CharMatcher.inRange('0', '9').or(CharMatcher.inRange('a', 'z'))
.or(CharMatcher.inRange('A', 'Z')).or(CharMatcher.is('-')).retainFrom(computerName);
return computerName.equals(retainComputerName);
}
}));
}
/**
* @see VAppApi#modifyVApp(URI, VApp)
* @see VAppApi#editVApp(URI, VApp)
*/
@Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVApp" })
public void testModifyVApp() {
VApp newVApp = VApp.builder()
.name(name("new-name-"))
.description("New Description")
.build();
public void testEditVApp() {
VApp newVApp = VApp.builder().name(name("new-name-")).description("New Description").build();
vAppNames.add(newVApp.getName());
// The method under test
Task modifyVApp = vAppApi.modifyVApp(vApp.getHref(), newVApp);
assertTrue(retryTaskSuccess.apply(modifyVApp), String.format(TASK_COMPLETE_TIMELY, "modifyVApp"));
Task editVApp = vAppApi.editVApp(vApp.getHref(), newVApp);
assertTrue(retryTaskSuccess.apply(editVApp), String.format(TASK_COMPLETE_TIMELY, "editVApp"));
// Get the updated VApp
// Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref());
// Check the required fields are set
assertEquals(vApp.getName(), newVApp.getName(), String.format(OBJ_FIELD_EQ, VAPP, "Name", newVApp.getName(), vApp.getName()));
assertEquals(vApp.getDescription(), newVApp.getDescription(), String.format(OBJ_FIELD_EQ, VAPP, "Description", newVApp.getDescription(), vApp.getDescription()));
assertEquals(vApp.getName(), newVApp.getName(),
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" })
public void testDeployVApp() {
DeployVAppParams params = DeployVAppParams.builder()
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS))
.notForceCustomization()
.notPowerOn()
.build();
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
.notPowerOn().build();
// The method under test
Task deployVApp = vAppApi.deploy(vApp.getHref(), params);
assertTrue(retryTaskSuccessLong.apply(deployVApp), String.format(TASK_COMPLETE_TIMELY, "deployVApp"));
// Get the updated VApp
// Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref());
// Check the required fields are set
@ -320,7 +311,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task powerOnVApp = vAppApi.powerOn(vApp.getHref());
assertTaskSucceedsLong(powerOnVApp);
// Get the updated VApp
// Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref());
// Check status
@ -336,7 +327,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task reboot = vAppApi.reboot(vApp.getHref());
assertTaskSucceedsLong(reboot);
// Get the updated VApp
// Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref());
// Check status
@ -352,7 +343,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task shutdown = vAppApi.shutdown(vApp.getHref());
assertTaskSucceedsLong(shutdown);
// Get the updated VApp
// Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref());
// Check status
@ -371,7 +362,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task suspend = vAppApi.suspend(vAppURI);
assertTaskSucceedsLong(suspend);
// Get the updated VApp
// Get the edited VApp
vApp = vAppApi.getVApp(vApp.getHref());
// Check status
@ -390,7 +381,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task reset = vAppApi.reset(vAppURI);
assertTaskSucceedsLong(reset);
// Get the updated VApp
// Get the edited VApp
vApp = vAppApi.getVApp(vAppURI);
// Check status
@ -408,11 +399,12 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task undeploy = vAppApi.undeploy(vApp.getHref(), params);
assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
// Get the updated VApp
// Get the edited VApp
vApp = vAppApi.getVApp(vAppURI);
// 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);
}
@ -425,7 +417,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Task powerOffVApp = vAppApi.powerOff(vApp.getHref());
assertTrue(retryTaskSuccess.apply(powerOffVApp), String.format(TASK_COMPLETE_TIMELY, "powerOffVApp"));
// Get the updated VApp
// Get the edited VApp
vApp = vAppApi.getVApp(vAppURI);
// Check status
@ -434,16 +426,16 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
@Test(description = "POST /vApp/{id}/action/controlAccess", dependsOnMethods = { "testGetVApp" })
public void testControlAccessUser() {
ControlAccessParams params = ControlAccessParams.builder()
ControlAccessParams params = ControlAccessParams
.builder()
.notSharedToEveryone()
.accessSetting(AccessSetting.builder()
.accessSetting(
AccessSetting.builder()
.subject(Reference.builder().href(user.getHref()).type(ADMIN_USER).build())
.accessLevel("ReadOnly")
.build())
.build();
.accessLevel("ReadOnly").build()).build();
// 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
checkControlAccessParams(modified);
@ -454,13 +446,11 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
@Test(description = "POST /vApp/{id}/action/controlAccess", dependsOnMethods = { "testControlAccessUser" })
public void testControlAccessEveryone() {
ControlAccessParams params = ControlAccessParams.builder()
.sharedToEveryone()
.everyoneAccessLevel("FullControl")
ControlAccessParams params = ControlAccessParams.builder().sharedToEveryone().everyoneAccessLevel("FullControl")
.build();
// 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
checkControlAccessParams(modified);
@ -477,19 +467,18 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
// The method under test
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() {
// Do this to a new vApp, so don't mess up subsequent tests by making the vApp read-only
VApp temp = instantiateVApp();
DeployVAppParams params = DeployVAppParams.builder()
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS))
.notForceCustomization()
.notPowerOn()
.build();
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
.notPowerOn().build();
Task deployVApp = vAppApi.deploy(temp.getHref(), params);
assertTaskSucceedsLong(deployVApp);
@ -498,7 +487,8 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
vAppApi.enterMaintenanceMode(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
vAppApi.exitMaintenanceMode(temp.getHref());
@ -507,15 +497,13 @@ 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() {
// Do this to a new vApp, so don't mess up subsequent tests by making the vApp read-only
VApp temp = instantiateVApp();
DeployVAppParams params = DeployVAppParams.builder()
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS))
.notForceCustomization()
.notPowerOn()
.build();
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
.notPowerOn().build();
Task deployVApp = vAppApi.deploy(temp.getHref(), params);
assertTaskSucceedsLong(deployVApp);
@ -527,7 +515,8 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
vAppApi.exitMaintenanceMode(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 {
cleanUpVApp(temp);
}
@ -552,17 +541,16 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetLeaseSettingsSection" })
public void testModifyLeaseSettingsSection() {
public void testEditLeaseSettingsSection() {
// Copy existing section
LeaseSettingsSection oldSection = vAppApi.getLeaseSettingsSection(vApp.getHref());
Integer twoHours = (int) TimeUnit.SECONDS.convert(2L, TimeUnit.HOURS);
LeaseSettingsSection newSection = oldSection.toBuilder()
.deploymentLeaseInSeconds(twoHours)
.build();
LeaseSettingsSection newSection = oldSection.toBuilder().deploymentLeaseInSeconds(twoHours).build();
// The method under test
Task modifyLeaseSettingsSection = vAppApi.modifyLeaseSettingsSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyLeaseSettingsSection), String.format(TASK_COMPLETE_TIMELY, "modifyLeaseSettingsSection"));
Task editLeaseSettingsSection = vAppApi.editLeaseSettingsSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(editLeaseSettingsSection),
String.format(TASK_COMPLETE_TIMELY, "editLeaseSettingsSection"));
// Retrieve the modified section
LeaseSettingsSection modified = vAppApi.getLeaseSettingsSection(vApp.getHref());
@ -578,25 +566,22 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
dateService.iso8601DateFormat(newSection.getDeploymentLeaseExpiration())));
}
if (modified.getStorageLeaseExpiration() != null && newSection.getStorageLeaseExpiration() != null) {
assertTrue(modified.getStorageLeaseExpiration().after(newSection.getStorageLeaseExpiration()),
String.format("The new storageLeaseExpiration timestamp must be later than the original: %s > %s",
assertTrue(modified.getStorageLeaseExpiration().after(newSection.getStorageLeaseExpiration()), String.format(
"The new storageLeaseExpiration timestamp must be later than the original: %s > %s",
dateService.iso8601DateFormat(modified.getStorageLeaseExpiration()),
dateService.iso8601DateFormat(newSection.getStorageLeaseExpiration())));
}
// Reset the date fields
modified = modified.toBuilder()
.deploymentLeaseExpiration(null)
.storageLeaseExpiration(null)
.build();
newSection = newSection.toBuilder()
.deploymentLeaseExpiration(null)
.storageLeaseExpiration(null)
.build();
modified = modified.toBuilder().deploymentLeaseExpiration(null).storageLeaseExpiration(null).build();
newSection = newSection.toBuilder().deploymentLeaseExpiration(null).storageLeaseExpiration(null).build();
// Check the section was modified correctly
assertEquals(modified.getDeploymentLeaseInSeconds(), twoHours,
String.format(OBJ_FIELD_EQ, "LeaseSettingsSection", "DeploymentLeaseInSeconds", Integer.toString(twoHours), modified.getDeploymentLeaseInSeconds().toString()));
assertEquals(
modified.getDeploymentLeaseInSeconds(),
twoHours,
String.format(OBJ_FIELD_EQ, "LeaseSettingsSection", "DeploymentLeaseInSeconds",
Integer.toString(twoHours), modified.getDeploymentLeaseInSeconds().toString()));
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" })
public void testModifyNetworkConfigSection() {
// Copy existing section and update fields
public void testEditNetworkConfigSection() {
// Copy existing section and edit fields
NetworkConfigSection oldSection = vAppApi.getNetworkConfigSection(vApp.getHref());
VAppNetworkConfiguration networkConfig = VAppNetworkConfiguration.builder().build();
NetworkConfigSection newSection = oldSection.toBuilder().networkConfigs(ImmutableSet.of(networkConfig))
.build();
NetworkConfigSection newSection = oldSection.toBuilder().networkConfigs(ImmutableSet.of(networkConfig)).build();
// The method under test
Task modifyNetworkConfigSection = vAppApi.modifyNetworkConfigSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyNetworkConfigSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConfigSection"));
Task editNetworkConfigSection = vAppApi.editNetworkConfigSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(editNetworkConfigSection),
String.format(TASK_COMPLETE_TIMELY, "editNetworkConfigSection"));
// Retrieve the modified section
NetworkConfigSection modified = vAppApi.getNetworkConfigSection(vApp.getHref());
@ -628,7 +613,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
checkNetworkConfigSection(modified);
// Check the modified section fields are set correctly
// assertEquals(modified.getInfo(), newSection.getInfo());
// assertEquals(modified.getInfo(), newSection.getInfo());
// Check the section was modified correctly
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" })
public void testModifyOwner() {
public void testEditOwner() {
Owner newOwner = Owner.builder().user(Reference.builder().href(user.getHref()).type(ADMIN_USER).build()).build();
// The method under test
vAppApi.modifyOwner(vApp.getHref(), newOwner);
vAppApi.editOwner(vApp.getHref(), newOwner);
// Get the new VApp owner
Owner modified = vAppApi.getOwner(vApp.getHref());
@ -679,22 +664,23 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
public void testModifyProductSections() {
// Copy existing section and update fields
public void testEditProductSections() {
// Copy existing section and edit fields
ProductSectionList oldSections = vAppApi.getProductSections(vApp.getHref());
ProductSectionList newSections = oldSections.toBuilder()
.productSection(ProductSection.builder()
.info("Information about the installed software") // Default ovf:Info text
.required()
.product(MsgType.builder().value("jclouds").build())
ProductSectionList newSections = oldSections
.toBuilder()
.productSection(
ProductSection.builder().info("Information about the installed software")
// Default ovf:Info text
.required().product(MsgType.builder().value("jclouds").build())
.vendor(MsgType.builder().value("jclouds Inc.").build())
// NOTE other ProductSection elements not returned by vCloud
.build())
.build();
.build()).build();
// The method under test
Task modifyProductSections = vAppApi.modifyProductSections(vApp.getHref(), newSections);
assertTrue(retryTaskSuccess.apply(modifyProductSections), String.format(TASK_COMPLETE_TIMELY, "modifyProductSections"));
Task editProductSections = vAppApi.editProductSections(vApp.getHref(), newSections);
assertTrue(retryTaskSuccess.apply(editProductSections),
String.format(TASK_COMPLETE_TIMELY, "editProductSections"));
// Retrieve the modified section
ProductSectionList modified = vAppApi.getProductSections(vApp.getHref());
@ -719,14 +705,14 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/startupSection", dependsOnMethods = { "testGetStartupSection" })
public void testModifyStartupSection() {
// Copy existing section and update fields
public void testEditStartupSection() {
// Copy existing section and edit fields
StartupSection oldSection = vAppApi.getStartupSection(vApp.getHref());
StartupSection newSection = oldSection.toBuilder().build();
// The method under test
Task modifyStartupSection = vAppApi.modifyStartupSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyStartupSection), String.format(TASK_COMPLETE_TIMELY, "modifyStartupSection"));
Task editStartupSection = vAppApi.editStartupSection(vApp.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(editStartupSection), String.format(TASK_COMPLETE_TIMELY, "editStartupSection"));
// Retrieve the modified section
StartupSection modified = vAppApi.getStartupSection(vApp.getHref());
@ -766,7 +752,8 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
checkMetadata(metadata);
// 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" })
@ -777,16 +764,17 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
String expected = metadataValue.getValue();
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" })
public void testDeleteMetadataEntry() {
public void testRemoveMetadataEntry() {
// Delete the entry
Task task = vAppApi.getMetadataApi().deleteEntry(vApp.getHref(), key);
Task task = vAppApi.getMetadataApi().removeEntry(vApp.getHref(), key);
retryTaskSuccess.apply(task);
// Confirm the entry has been deleted
// Confirm the entry has been removed
Metadata newMetadata = vAppApi.getMetadataApi().get(vApp.getHref());
// Check the retrieved object is well formed
@ -798,40 +786,36 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
Metadata oldMetadata = vAppApi.getMetadataApi().get(vApp.getHref());
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
// Store a value, to be deleted
// Store a value, to be removed
String key = name("key-");
String value = name("value-");
Metadata addedMetadata = Metadata.builder()
.entry(MetadataEntry.builder().key(key).value(value).build())
.build();
Metadata addedMetadata = Metadata.builder().entry(MetadataEntry.builder().key(key).value(value).build()).build();
Task task = vAppApi.getMetadataApi().merge(vApp.getHref(), addedMetadata);
retryTaskSuccess.apply(task);
// Confirm the entry contains everything that was there, and everything that was being added
Metadata newMetadata = vAppApi.getMetadataApi().get(vApp.getHref());
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String>builder()
.putAll(oldMetadataMap)
.put(key, value)
.build();
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
.put(key, value).build();
// Check the retrieved object is well formed
checkMetadataFor(VAPP, newMetadata, expectedMetadataMap);
}
/**
* @see VAppApi#deleteVApp(URI)
* @see VAppApi#removeVApp(URI)
*/
@Test(description = "DELETE /vApp/{id}")
public void testDeleteVApp() {
// Create a temporary VApp to delete
public void testRemoveVApp() {
// Create a temporary VApp to remove
VApp temp = instantiateVApp();
// The method under test
Task deleteVApp = vAppApi.deleteVApp(temp.getHref());
assertTrue(retryTaskSuccess.apply(deleteVApp), String.format(TASK_COMPLETE_TIMELY, "deleteVApp"));
Task removeVApp = vAppApi.removeVApp(temp.getHref());
assertTrue(retryTaskSuccess.apply(removeVApp), String.format(TASK_COMPLETE_TIMELY, "removeVApp"));
VApp deleted = vAppApi.getVApp(temp.getHref());
assertNull(deleted, "The VApp "+temp.getName()+" should have been deleted");
VApp removed = vAppApi.getVApp(temp.getHref());
assertNull(removed, "The VApp " + temp.getName() + " should have been removed");
}
/**
@ -842,7 +826,7 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
* @return
* @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.
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();
// 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 (!vAppHasNetworkConfigured(vApp)) {
// create a new network connection section for the vm.
// add a new network connection section for the vm.
NetworkConnectionSection networkConnectionSection = NetworkConnectionSection.builder()
.info("Empty network configuration parameters").build();
// adding the network connection section to the instantiation params of the vapp.
@ -904,13 +889,11 @@ public class VAppApiLiveTest extends AbstractVAppApiLiveTest {
if (vmInstantiationParams != null)
vmItem = SourcedCompositionItemParam.builder().fromSourcedCompositionItemParam(vmItem)
.instantiationParams(vmInstantiationParams)
.build();
.instantiationParams(vmInstantiationParams).build();
if (networkAssignments != null)
vmItem = SourcedCompositionItemParam.builder().fromSourcedCompositionItemParam(vmItem)
.networkAssignment(networkAssignments)
.build();
.networkAssignment(networkAssignments).build();
return RecomposeVAppParams.builder().name(name("recompose-"))
// adding the vm item.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -131,14 +131,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
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 };
Media sourceMedia = Media.builder()
.type(VCloudDirectorMediaType.MEDIA)
.name(name("media"))
.size(iso.length)
.imageType(Media.ImageType.ISO)
.description("Test media generated by VmApiLiveTest")
.build();
Media media = context.getApi().getMediaApi().createMedia(addMedia.getHref(), sourceMedia);
Media sourceMedia = Media.builder().type(VCloudDirectorMediaType.MEDIA).name(name("media"))
.size(iso.length).imageType(Media.ImageType.ISO)
.description("Test media generated by VmApiLiveTest").build();
Media media = context.getApi().getMediaApi().addMedia(addMedia.getHref(), sourceMedia);
Link uploadLink = getFirst(getFirst(media.getFiles(), null).getLinks(), null);
context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newByteArrayPayload(iso));
@ -159,9 +155,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
}
if (adminContext != null) {
Link orgLink = find(links, and(relEquals("up"), typeEquals(VCloudDirectorMediaType.ORG)));
userUrn = adminContext.getApi().getUserApi()
.createUserInOrg(randomTestUser("VAppAccessTest"), toAdminUri(orgLink)).getId();
userUrn = adminContext.getApi().getUserApi().addUserToOrg(randomTestUser("VAppAccessTest"), org.getId())
.getId();
}
}
@ -169,15 +164,15 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
public void cleanUp() {
if (adminContext != null && mediaCreated && mediaURI != null) {
try {
Task delete = context.getApi().getMediaApi().deleteMedia(mediaURI);
taskDoneEventually(delete);
Task remove = context.getApi().getMediaApi().removeMedia(mediaURI);
taskDoneEventually(remove);
} catch (Exception e) {
logger.warn("Error when deleting media: %s", e.getMessage());
}
}
if (adminContext != null && testUserCreated && userUrn != null) {
try {
adminContext.getApi().getUserApi().delete(userUrn);
adminContext.getApi().getUserApi().remove(userUrn);
} catch (Exception e) {
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}")
public void testGetVm() {
// The method under test
vm = vmApi.getVm(vmURI);
vm = vmApi.get(vmURI);
// Check the retrieved object is well formed
checkVm(vm);
// 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
assertVmStatus(vm.getHref(), Status.POWERED_OFF);
}
/**
* @see VmApi#modifyVm(URI, Vm)
* @see VmApi#edit(URI, Vm)
*/
@Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVm" })
public void testModifyVm() {
Vm newVm = Vm.builder()
.name(name("new-name-"))
.description("New Description")
.build();
public void testEditVm() {
Vm newVm = Vm.builder().name(name("new-name-")).description("New Description").build();
// The method under test
Task modifyVm = vmApi.modifyVm(vm.getHref(), newVm);
assertTrue(retryTaskSuccess.apply(modifyVm), String.format(TASK_COMPLETE_TIMELY, "modifyVm"));
Task editVm = vmApi.edit(vm.getHref(), newVm);
assertTrue(retryTaskSuccess.apply(editVm), String.format(TASK_COMPLETE_TIMELY, "editVm"));
// Get the updated Vm
vm = vmApi.getVm(vm.getHref());
// Get the edited Vm
vm = vmApi.get(vm.getHref());
// Check the required fields are set
assertEquals(vm.getName(), newVm.getName(), 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()));
assertEquals(vm.getName(), newVm.getName(),
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" })
public void testDeployVm() {
DeployVAppParams params = DeployVAppParams.builder()
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS))
.notForceCustomization()
.notPowerOn()
.build();
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
.notPowerOn().build();
// The method under test
Task deployVm = vmApi.deploy(vm.getHref(), params);
assertTrue(retryTaskSuccessLong.apply(deployVm), String.format(TASK_COMPLETE_TIMELY, "deployVm"));
// Get the updated Vm
vm = vmApi.getVm(vm.getHref());
// Get the edited Vm
vm = vmApi.get(vm.getHref());
// Check the required fields are set
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());
assertTaskSucceedsLong(powerOnVm);
// Get the updated Vm
vm = vmApi.getVm(vm.getHref());
// Get the edited Vm
vm = vmApi.get(vm.getHref());
// Check status
assertVmStatus(vm.getHref(), Status.POWERED_ON);
@ -271,8 +264,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task reboot = vmApi.reboot(vm.getHref());
assertTaskSucceedsLong(reboot);
// Get the updated Vm
vm = vmApi.getVm(vm.getHref());
// Get the edited Vm
vm = vmApi.get(vm.getHref());
// Check status
assertVmStatus(vmURI, Status.POWERED_OFF);
@ -287,8 +280,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task shutdown = vmApi.shutdown(vm.getHref());
assertTaskSucceedsLong(shutdown);
// Get the updated Vm
vm = vmApi.getVm(vm.getHref());
// Get the edited Vm
vm = vmApi.get(vm.getHref());
// Check status
assertVmStatus(vm.getHref(), Status.POWERED_OFF);
@ -303,8 +296,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task suspend = vmApi.suspend(vmURI);
assertTaskSucceedsLong(suspend);
// Get the updated Vm
vm = vmApi.getVm(vm.getHref());
// Get the edited Vm
vm = vmApi.get(vm.getHref());
// Check status
assertVmStatus(vmURI, Status.SUSPENDED);
@ -322,8 +315,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task reset = vmApi.reset(vmURI);
assertTaskSucceedsLong(reset);
// Get the updated Vm
vm = vmApi.getVm(vm.getHref());
// Get the edited Vm
vm = vmApi.get(vm.getHref());
// Check status
assertVmStatus(vmURI, Status.POWERED_ON);
@ -340,8 +333,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task undeploy = vmApi.undeploy(vm.getHref(), params);
assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
// Get the updated Vm
vm = vmApi.getVm(vm.getHref());
// Get the edited Vm
vm = vmApi.get(vm.getHref());
// Check status
assertFalse(vm.isDeployed(), String.format(OBJ_FIELD_EQ, VM, "deployed", "FALSE", vm.isDeployed().toString()));
@ -358,8 +351,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Task powerOffVm = vmApi.powerOff(vm.getHref());
assertTrue(retryTaskSuccess.apply(powerOffVm), String.format(TASK_COMPLETE_TIMELY, "powerOffVm"));
// Get the updated Vm
vm = vmApi.getVm(vmURI);
// Get the edited Vm
vm = vmApi.get(vmURI);
// Check status
assertVmStatus(vmURI, Status.POWERED_OFF);
@ -371,7 +364,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
vm = powerOnVm(vm.getHref());
// 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"));
}
@ -382,7 +375,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
// The method under test
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" })
@ -401,10 +395,11 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
// Relocate to the last of the available datastores
QueryResultRecords records = context.getApi().getQueryApi().queryAll("datastore");
QueryResultRecordType datastore = Iterables.getLast(records.getRecords());
RelocateParams params = RelocateParams.builder().datastore(Reference.builder().href(datastore.getHref()).build()).build();
RelocateParams params = RelocateParams.builder().datastore(Reference.builder().href(datastore.getHref()).build())
.build();
// 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"));
}
@ -415,7 +410,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
// The method under test
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
vm = powerOnVm(vm.getHref());
@ -432,18 +428,17 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" })
public void testModifyGuestCustomizationSection() {
// Copy existing section and update fields
public void testEditGuestCustomizationSection() {
// Copy existing section and edit fields
GuestCustomizationSection oldSection = vmApi.getGuestCustomizationSection(vm.getHref());
GuestCustomizationSection newSection = oldSection.toBuilder()
.computerName(name("n"))
.enabled(Boolean.TRUE)
GuestCustomizationSection newSection = oldSection.toBuilder().computerName(name("n")).enabled(Boolean.TRUE)
.adminPassword(null) // Not allowed
.build();
// The method under test
Task modifyGuestCustomizationSection = vmApi.modifyGuestCustomizationSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyGuestCustomizationSection), String.format(TASK_COMPLETE_TIMELY, "modifyGuestCustomizationSection"));
Task editGuestCustomizationSection = vmApi.editGuestCustomizationSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(editGuestCustomizationSection),
String.format(TASK_COMPLETE_TIMELY, "editGuestCustomizationSection"));
// Retrieve the modified section
GuestCustomizationSection modified = vmApi.getGuestCustomizationSection(vm.getHref());
@ -462,13 +457,13 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
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" })
public void testInsertMedia() {
// Setup media params from configured media id
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
.media(Reference.builder().href(mediaURI).type(MEDIA).build())
.build();
.media(Reference.builder().href(mediaURI).type(MEDIA).build()).build();
// The method under test
Task insertMedia = vmApi.insertMedia(vm.getHref(), params);
@ -479,8 +474,7 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
public void testEjectMedia() {
// Setup media params from configured media id
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
.media(Reference.builder().href(mediaURI).type(MEDIA).build())
.build();
.media(Reference.builder().href(mediaURI).type(MEDIA).build()).build();
// The method under test
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."
@Test(description = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testModifyGuestCustomizationSection" })
public void testModifyNetworkConnectionSection() {
@Test(description = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testEditGuestCustomizationSection" })
public void testEditNetworkConnectionSection() {
powerOffVm(vm.getHref());
// Look up a network in the Vdc
Set<Reference> networks = vdc.getAvailableNetworks();
Reference network = Iterables.getLast(networks);
// Copy existing section and update fields
// Copy existing section and edit fields
NetworkConnectionSection oldSection = vmApi.getNetworkConnectionSection(vm.getHref());
NetworkConnectionSection newSection = oldSection.toBuilder()
.networkConnection(NetworkConnection.builder()
.ipAddressAllocationMode(IpAddressAllocationMode.DHCP.toString())
.network(network.getName())
.build())
.build();
NetworkConnectionSection newSection = oldSection
.toBuilder()
.networkConnection(
NetworkConnection.builder().ipAddressAllocationMode(IpAddressAllocationMode.DHCP.toString())
.network(network.getName()).build()).build();
// The method under test
Task modifyNetworkConnectionSection = vmApi.modifyNetworkConnectionSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyNetworkConnectionSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConnectionSection"));
Task editNetworkConnectionSection = vmApi.editNetworkConnectionSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(editNetworkConnectionSection),
String.format(TASK_COMPLETE_TIMELY, "editNetworkConnectionSection"));
// Retrieve the modified section
NetworkConnectionSection modified = vmApi.getNetworkConnectionSection(vm.getHref());
@ -540,18 +534,19 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
checkOperatingSystemSection(section);
}
@Test(description = "PUT /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetOperatingSystemSection", "testModifyVirtualHardwareSection" })
public void testModifyOperatingSystemSection() {
@Test(description = "PUT /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetOperatingSystemSection",
"testEditVirtualHardwareSection" })
public void testEditOperatingSystemSection() {
// Create new OperatingSystemSection
OperatingSystemSection newSection = OperatingSystemSection.builder()
.info("") // NOTE Required OVF field, ignored
.id(OSType.RHEL_64.getCode())
.osType("rhel5_64Guest")
.build();
OperatingSystemSection newSection = OperatingSystemSection.builder().info("") // NOTE Required
// OVF field,
// ignored
.id(OSType.RHEL_64.getCode()).osType("rhel5_64Guest").build();
// The method under test
Task modifyOperatingSystemSection = vmApi.modifyOperatingSystemSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyOperatingSystemSection), String.format(TASK_COMPLETE_TIMELY, "modifyOperatingSystemSection"));
Task editOperatingSystemSection = vmApi.editOperatingSystemSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(editOperatingSystemSection),
String.format(TASK_COMPLETE_TIMELY, "editOperatingSystemSection"));
// Retrieve the modified section
OperatingSystemSection modified = vmApi.getOperatingSystemSection(vm.getHref());
@ -573,23 +568,24 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
public void testModifyProductSections() {
public void testEditProductSections() {
powerOffVm(vm.getHref());
// Copy existing section and update fields
// Copy existing section and edit fields
ProductSectionList oldSections = vmApi.getProductSections(vm.getHref());
ProductSectionList newSections = oldSections.toBuilder()
.productSection(ProductSection.builder()
.info("Information about the installed software") // Default ovf:Info text
.required()
.product(MsgType.builder().value("jclouds").build())
ProductSectionList newSections = oldSections
.toBuilder()
.productSection(
ProductSection.builder().info("Information about the installed software")
// Default ovf:Info text
.required().product(MsgType.builder().value("jclouds").build())
.vendor(MsgType.builder().value("jclouds Inc.").build())
// NOTE other ProductSection elements not returned by vCloud
.build())
.build();
.build()).build();
// The method under test
Task modifyProductSections = vmApi.modifyProductSections(vm.getHref(), newSections);
assertTrue(retryTaskSuccess.apply(modifyProductSections), String.format(TASK_COMPLETE_TIMELY, "modifyProductSections"));
Task editProductSections = vmApi.editProductSections(vm.getHref(), newSections);
assertTrue(retryTaskSuccess.apply(editProductSections),
String.format(TASK_COMPLETE_TIMELY, "editProductSections"));
// Retrieve the modified section
ProductSectionList modified = vmApi.getProductSections(vm.getHref());
@ -627,12 +623,10 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
VmPendingQuestion question = vmApi.getPendingQuestion(vm.getHref());
List<VmQuestionAnswerChoice> answerChoices = question.getChoices();
VmQuestionAnswerChoice answerChoice = Iterables.getFirst(answerChoices, null);
assertNotNull(answerChoice, "Question "+question+" must have at least once answer-choice");
assertNotNull(answerChoice, "Question " + question + " must have at least once answer-choice");
VmQuestionAnswer answer = VmQuestionAnswer.builder()
.choiceId(answerChoice.getId())
.questionId(question.getQuestionId())
.build();
VmQuestionAnswer answer = VmQuestionAnswer.builder().choiceId(answerChoice.getId())
.questionId(question.getQuestionId()).build();
vmApi.answerQuestion(vm.getHref(), answer);
}
@ -660,7 +654,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
assertNotNull(image);
assertTrue(image.length > pngHeaderBytes.length);
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));
}
}
@ -686,33 +681,31 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVirtualHardwareSection" })
public void testModifyVirtualHardwareSection() {
public void testEditVirtualHardwareSection() {
// Power off Vm
vm = powerOffVm(vm.getHref());
// Copy existing section and update fields
// Copy existing section and edit fields
VirtualHardwareSection oldSection = vmApi.getVirtualHardwareSection(vm.getHref());
Set<? extends ResourceAllocationSettingData> oldItems = oldSection.getItems();
Set<ResourceAllocationSettingData> newItems = Sets.newLinkedHashSet(oldItems);
ResourceAllocationSettingData oldMemory = Iterables.find(oldItems, new Predicate<ResourceAllocationSettingData>() {
ResourceAllocationSettingData oldMemory = Iterables.find(oldItems,
new Predicate<ResourceAllocationSettingData>() {
@Override
public boolean apply(ResourceAllocationSettingData rasd) {
return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
}
});
ResourceAllocationSettingData newMemory = oldMemory.toBuilder()
.elementName("1024 MB of memory")
.virtualQuantity(new BigInteger("1024"))
.build();
ResourceAllocationSettingData newMemory = oldMemory.toBuilder().elementName("1024 MB of memory")
.virtualQuantity(new BigInteger("1024")).build();
newItems.remove(oldMemory);
newItems.add(newMemory);
VirtualHardwareSection newSection = oldSection.toBuilder()
.items(newItems)
.build();
VirtualHardwareSection newSection = oldSection.toBuilder().items(newItems).build();
// The method under test
Task modifyVirtualHardwareSection = vmApi.modifyVirtualHardwareSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSection), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSection"));
Task editVirtualHardwareSection = vmApi.editVirtualHardwareSection(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSection),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSection"));
// Retrieve the modified section
VirtualHardwareSection modifiedSection = vmApi.getVirtualHardwareSection(vm.getHref());
@ -743,17 +736,16 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" })
public void testModifyVirtualHardwareSectionCpu() {
// Copy existing section and update fields
public void testEditVirtualHardwareSectionCpu() {
// Copy existing section and edit fields
RasdItem oldItem = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
RasdItem newItem = oldItem.toBuilder()
.elementName("2 virtual CPU(s)")
.virtualQuantity(new BigInteger("2"))
RasdItem newItem = oldItem.toBuilder().elementName("2 virtual CPU(s)").virtualQuantity(new BigInteger("2"))
.build();
// Method under test
Task modifyVirtualHardwareSectionCpu = vmApi.modifyVirtualHardwareSectionCpu(vm.getHref(), newItem);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu"));
Task editVirtualHardwareSectionCpu = vmApi.editVirtualHardwareSectionCpu(vm.getHref(), newItem);
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionCpu),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionCpu"));
// Retrieve the modified section
RasdItem modified = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
@ -762,8 +754,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
checkResourceAllocationSettingData(modified);
// Check modified item
assertEquals(modified.getVirtualQuantity(), new BigInteger("2"),
String.format(OBJ_FIELD_EQ, "ResourceAllocationSettingData", "VirtualQuantity", "2", modified.getVirtualQuantity().toString()));
assertEquals(modified.getVirtualQuantity(), new BigInteger("2"), String.format(OBJ_FIELD_EQ,
"ResourceAllocationSettingData", "VirtualQuantity", "2", modified.getVirtualQuantity().toString()));
assertEquals(modified, newItem);
}
@ -777,14 +769,15 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSectionDisks" })
public void testModifyVirtualHardwareSectionDisks() {
// Copy the existing items list and modify the name of an item
public void testEditVirtualHardwareSectionDisks() {
// Copy the existing items list and edit the name of an item
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
RasdItemsList newSection = oldSection.toBuilder().build();
// Method under test
Task modifyVirtualHardwareSectionDisks = vmApi.modifyVirtualHardwareSectionDisks(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionDisks), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionDisks"));
Task editVirtualHardwareSectionDisks = vmApi.editVirtualHardwareSectionDisks(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionDisks),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionDisks"));
// Retrieve the modified section
RasdItemsList modified = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
@ -793,12 +786,15 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
checkRasdItemsList(modified);
// 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);
// 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());
// RasdItemsList newSection = oldSection.toBuilder()
// .items(newItems)
@ -809,7 +805,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
// .weight(newCimUnsignedInt(weight))
// .build();
// ...
// checkHasMatchingItem("virtualHardwareSection/disk", modified, item0InstanceId, item0ElementName);
// checkHasMatchingItem("virtualHardwareSection/disk", modified, item0InstanceId,
// item0ElementName);
}
@Test(description = "GET /vApp/{id}/virtualHardwareSection/media", dependsOnMethods = { "testGetVirtualHardwareSection" })
@ -831,16 +828,15 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" })
public void testModifyVirtualHardwareSectionMemory() {
public void testEditVirtualHardwareSectionMemory() {
RasdItem origItem = vmApi.getVirtualHardwareSectionMemory(vm.getHref());
RasdItem newItem = origItem.toBuilder()
.elementName("1024 MB of memory")
.virtualQuantity(new BigInteger("1024"))
RasdItem newItem = origItem.toBuilder().elementName("1024 MB of memory").virtualQuantity(new BigInteger("1024"))
.build();
// Method under test
Task modifyVirtualHardwareSectionMemory = vmApi.modifyVirtualHardwareSectionMemory(vm.getHref(), newItem);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionMemory), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionMemory"));
Task editVirtualHardwareSectionMemory = vmApi.editVirtualHardwareSectionMemory(vm.getHref(), newItem);
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionMemory),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionMemory"));
// Retrieve the modified section
RasdItem modified = vmApi.getVirtualHardwareSectionMemory(vm.getHref());
@ -849,8 +845,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
checkResourceAllocationSettingData(modified);
// Check modified item
assertEquals(modified.getVirtualQuantity(), new BigInteger("1024"),
String.format(OBJ_FIELD_EQ, "ResourceAllocationSettingData", "VirtualQuantity", "1024", modified.getVirtualQuantity().toString()));
assertEquals(modified.getVirtualQuantity(), new BigInteger("1024"), String.format(OBJ_FIELD_EQ,
"ResourceAllocationSettingData", "VirtualQuantity", "1024", modified.getVirtualQuantity().toString()));
assertEquals(modified, newItem);
}
@ -864,13 +860,15 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSectionNetworkCards" })
public void testModifyVirtualHardwareSectionNetworkCards() {
public void testEditVirtualHardwareSectionNetworkCards() {
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
RasdItemsList newSection = oldSection.toBuilder().build();
// Method under test
Task modifyVirtualHardwareSectionNetworkCards = vmApi.modifyVirtualHardwareSectionNetworkCards(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionNetworkCards), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionNetworkCards"));
Task editVirtualHardwareSectionNetworkCards = vmApi.editVirtualHardwareSectionNetworkCards(vm.getHref(),
newSection);
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionNetworkCards),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionNetworkCards"));
// Retrieve the modified section
RasdItemsList modified = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
@ -879,8 +877,9 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
checkRasdItemsList(modified);
// 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.
// See the description in testModifyVirtualHardwareSectionDisks
// I tried changing "elementName" of one of the items, but it continued to have the old value
// when looked up post-edit.
// See the description in testEditVirtualHardwareSectionDisks
}
@Test(description = "GET /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSection" })
@ -893,13 +892,15 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
}
@Test(description = "PUT /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSectionSerialPorts" })
public void testModifyVirtualHardwareSectionSerialPorts() {
public void testEditVirtualHardwareSectionSerialPorts() {
RasdItemsList oldSection = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
RasdItemsList newSection = oldSection.toBuilder().build();
// Method under test
Task modifyVirtualHardwareSectionSerialPorts = vmApi.modifyVirtualHardwareSectionSerialPorts(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionSerialPorts), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionSerialPorts"));
Task editVirtualHardwareSectionSerialPorts = vmApi
.editVirtualHardwareSectionSerialPorts(vm.getHref(), newSection);
assertTrue(retryTaskSuccess.apply(editVirtualHardwareSectionSerialPorts),
String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionSerialPorts"));
// Retrieve the modified section
RasdItemsList modified = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
@ -908,8 +909,9 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
checkRasdItemsList(modified);
// 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.
// See the description in testModifyVirtualHardwareSectionDisks
// I tried changing "elementName" of one of the items, but it continued to have the old value
// when looked up post-edit.
// See the description in testEditVirtualHardwareSectionDisks
}
@Test(description = "PUT /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetVm" })
@ -934,7 +936,8 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
checkMetadata(metadata);
// 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" })
@ -950,16 +953,17 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
String expected = metadataValue.getValue();
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" })
public void testDeleteMetadataEntry() {
public void testRemoveMetadataEntry() {
// Delete the entry
Task task = vmApi.getMetadataApi().deleteEntry(vm.getHref(), key);
Task task = vmApi.getMetadataApi().removeEntry(vm.getHref(), key);
retryTaskSuccess.apply(task);
// Confirm the entry has been deleted
// Confirm the entry has been removed
Metadata newMetadata = vmApi.getMetadataApi().get(vm.getHref());
// Check the retrieved object is well formed
@ -971,59 +975,53 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
Metadata oldMetadata = vmApi.getMetadataApi().get(vm.getHref());
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
// Store a value, to be deleted
// Store a value, to be removed
String key = name("key-");
String value = name("value-");
Metadata addedMetadata = Metadata.builder()
.entry(MetadataEntry.builder().key(key).value(value).build())
.build();
Metadata addedMetadata = Metadata.builder().entry(MetadataEntry.builder().key(key).value(value).build()).build();
Task task = vmApi.getMetadataApi().merge(vm.getHref(), addedMetadata);
retryTaskSuccess.apply(task);
// Confirm the entry contains everything that was there, and everything that was being added
Metadata newMetadata = vmApi.getMetadataApi().get(vm.getHref());
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String>builder()
.putAll(oldMetadataMap)
.put(key, value)
.build();
Map<String, String> expectedMetadataMap = ImmutableMap.<String, String> builder().putAll(oldMetadataMap)
.put(key, value).build();
// Check the retrieved object is well formed
checkMetadataFor(VM, newMetadata, expectedMetadataMap);
}
/**
* @see VmApi#deleteVm(URI)
* @see VmApi#remove(URI)
*/
@Test(description = "DELETE /vApp/{id}")
public void testDeleteVm() {
// Create a temporary VApp to delete
VApp delete = instantiateVApp();
public void testRemoveVm() {
// Create a temporary VApp to remove
VApp remove = instantiateVApp();
DeployVAppParams params = DeployVAppParams.builder()
.deploymentLeaseSeconds((int)TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS))
.notForceCustomization()
.powerOn()
.build();
Task deployVApp = vAppApi.deploy(delete.getHref(), params);
.deploymentLeaseSeconds((int) TimeUnit.SECONDS.convert(1L, TimeUnit.HOURS)).notForceCustomization()
.powerOn().build();
Task deployVApp = vAppApi.deploy(remove.getHref(), params);
assertTaskSucceedsLong(deployVApp);
// Get the updated VApp and the Vm
delete = vAppApi.getVApp(delete.getHref());
List<Vm> vms = delete.getChildren().getVms();
// Get the edited VApp and the Vm
remove = vAppApi.getVApp(remove.getHref());
List<Vm> vms = remove.getChildren().getVms();
Vm temp = Iterables.get(vms, 0);
// 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();
Task shutdownVapp = vAppApi.undeploy(delete.getHref(), undeployParams);
Task shutdownVapp = vAppApi.undeploy(remove.getHref(), undeployParams);
assertTaskSucceedsLong(shutdownVapp);
} else {
powerOffVm(temp.getHref());
}
// The method under test
Task deleteVm = vmApi.deleteVm(temp.getHref());
assertTrue(retryTaskSuccess.apply(deleteVm), String.format(TASK_COMPLETE_TIMELY, "deleteVm"));
Task removeVm = vmApi.remove(temp.getHref());
assertTrue(retryTaskSuccess.apply(removeVm), String.format(TASK_COMPLETE_TIMELY, "removeVm"));
Vm deleted = vmApi.getVm(temp.getHref());
assertNull(deleted, "The Vm "+temp.getName()+" should have been deleted");
Vm removed = vmApi.get(temp.getHref());
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 orgAdminHref = URI.create(endpoint + "/admin/org/" + org);
HttpRequest create = HttpRequest.builder()
HttpRequest add = HttpRequest.builder()
.method("POST")
.endpoint(orgAdminHref + "/catalogs")
.addHeader("Accept", ADMIN_CATALOG)
.addHeader("x-vcloud-authorization", 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();
HttpResponse createResponse = HttpResponse.builder()
HttpResponse addResponse = HttpResponse.builder()
.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();
@Test
public void testCreateCatalogHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, create, createResponse);
assertEquals(api.getCatalogApi().createCatalogInOrg(createCatalogInOrgSource(), orgAdminHref), createCatalogInOrg());
public void testAddCatalogHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, add, addResponse);
assertEquals(api.getCatalogApi().addCatalogToOrg(addCatalogToOrgSource(), orgAdminHref), addCatalogToOrg());
}
HttpRequest resolveOrg = HttpRequest.builder()
@ -151,35 +151,35 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
.build();
@Test
public void testCreateCatalogUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveOrg, resolveOrgResponse, create, createResponse);
assertEquals(api.getCatalogApi().createCatalogInOrg(createCatalogInOrgSource(), orgUrn), createCatalogInOrg());
public void testAddCatalogUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveOrg, resolveOrgResponse, add, addResponse);
assertEquals(api.getCatalogApi().addCatalogToOrg(addCatalogToOrgSource(), orgUrn), addCatalogToOrg());
}
HttpRequest update = HttpRequest.builder()
HttpRequest edit = HttpRequest.builder()
.method("PUT")
.endpoint(catalogAdminHref)
.addHeader("Accept", ADMIN_CATALOG)
.addHeader("x-vcloud-authorization", 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();
HttpResponse updateResponse = HttpResponse.builder()
HttpResponse editResponse = HttpResponse.builder()
.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();
@Test
public void testUpdateCatalogHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, update, updateResponse);
assertEquals(api.getCatalogApi().update(catalogAdminHref, updateCatalog()), updateCatalog());
public void testEditCatalogHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, edit, editResponse);
assertEquals(api.getCatalogApi().edit(catalogAdminHref, editCatalog()), editCatalog());
}
@Test
public void testUpdateCatalogUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveCatalog, resolveCatalogResponse, update, updateResponse);
assertEquals(api.getCatalogApi().update(catalogUrn, updateCatalog()), updateCatalog());
public void testEditCatalogUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveCatalog, resolveCatalogResponse, edit, editResponse);
assertEquals(api.getCatalogApi().edit(catalogUrn, editCatalog()), editCatalog());
}
HttpRequest getOwner = HttpRequest.builder()
@ -226,7 +226,7 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
.addHeader("Accept", "*/*")
.addHeader("x-vcloud-authorization", 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();
HttpResponse setOwnerResponse = HttpResponse.builder()
@ -282,7 +282,7 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
}
HttpRequest deleteCatalog = HttpRequest.builder()
HttpRequest removeCatalog = HttpRequest.builder()
.method("DELETE")
.endpoint(catalogAdminHref)
.addHeader("Accept", "*/*")
@ -290,34 +290,34 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.build();
HttpResponse deleteCatalogResponse = HttpResponse.builder()
HttpResponse removeCatalogResponse = HttpResponse.builder()
.statusCode(204)
.build();
@Test
public void testDeleteCatalogHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, deleteCatalog,
deleteCatalogResponse);
api.getCatalogApi().delete(catalogAdminHref);
public void testRemoveCatalogHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, removeCatalog,
removeCatalogResponse);
api.getCatalogApi().remove(catalogAdminHref);
}
@Test
public void testDeleteCatalogUrn() {
public void testRemoveCatalogUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveCatalog,
resolveCatalogResponse, deleteCatalog, deleteCatalogResponse);
api.getCatalogApi().delete(catalogUrn);
resolveCatalogResponse, removeCatalog, removeCatalogResponse);
api.getCatalogApi().remove(catalogUrn);
}
//TODO: tests for access control!
public static final AdminCatalog createCatalogInOrgSource() {
public static final AdminCatalog addCatalogToOrgSource() {
return AdminCatalog.builder()
.name("Test Catalog")
.description("created by testCreateCatalog()")
.build();
}
public static final AdminCatalog createCatalogInOrg() {
public static final AdminCatalog addCatalogToOrg() {
return AdminCatalog.builder()
.name("Test Catalog")
.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")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/metadata"))
.build())
.description("created by testCreateCatalog()")
.tasks(ImmutableSet.<Task>builder()
.add(Task.builder()
.status("running")
@ -472,7 +471,7 @@ public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest
.build();
}
public static final AdminCatalog updateCatalog() {
public static final AdminCatalog editCatalog() {
return catalog().toBuilder()
.name("new QunyingTestCatalog")
.description("new Testing")

View File

@ -81,7 +81,7 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
protected void tidyUp() {
if (catalog != null) {
try {
catalogApi.delete(catalog.getId());
catalogApi.remove(catalog.getId());
} catch (Exception e) {
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")
public void testCreateCatalog() {
public void testAddCatalog() {
AdminCatalog newCatalog = AdminCatalog.builder().name(name("Test Catalog "))
.description("created by testCreateCatalog()").build();
catalog = catalogApi.createCatalogInOrg(newCatalog, org.getId());
.description("created by testAddCatalog()").build();
catalog = catalogApi.addCatalogToOrg(newCatalog, org.getId());
Checks.checkAdminCatalog(catalog);
// 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() {
catalog = catalogApi.get(catalog.getId());
@ -113,10 +113,10 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
}
@Test(description = "PUT /admin/catalog/{id}/owner", dependsOnMethods = { "testGetCatalog" })
public void updateCatalogOwner() {
User newOwnerUser = randomTestUser("testUpdateCatalogOwner");
newOwnerUser = adminContext.getApi().getUserApi().createUserInOrg(newOwnerUser, org.getId());
assertNotNull(newOwnerUser, "failed to create temp user to test updateCatalogOwner");
public void editCatalogOwner() {
User newOwnerUser = randomTestUser("testEditCatalogOwner");
newOwnerUser = adminContext.getApi().getUserApi().addUserToOrg(newOwnerUser, org.getId());
assertNotNull(newOwnerUser, "failed to add temp user to test editCatalogOwner");
Owner oldOwner = owner;
Owner newOwner = Owner.builder().type("application/vnd.vmware.vcloud.owner+xml")
@ -133,17 +133,17 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} finally {
catalogApi.setOwner(catalog.getId(), oldOwner);
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" })
public void testUpdateCatalog() {
public void testEditCatalog() {
String oldName = catalog.getName();
String newName = "new " + oldName;
String oldDescription = catalog.getDescription();
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)
// CatalogItems oldCatalogItems = catalog.getCatalogItems();
// CatalogItems newCatalogItems = CatalogItems.builder().build();
@ -153,7 +153,7 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// .catalogItems(newCatalogItems)
.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.getDescription(), newDescription),
@ -169,12 +169,12 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// .catalogItems(oldCatalogItems)
.build();
catalog = catalogApi.update(catalog.getId(), catalog);
catalog = catalogApi.edit(catalog.getId(), catalog);
}
}
// 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() {
assertNotNull(catalog, String.format(NOT_NULL_OBJ_FMT, "Catalog"));
assertTrue(!catalog.isPublished(),
@ -189,7 +189,7 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
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() {
// Call the method being tested
ControlAccessParams params = catalogApi.getAccessControl(catalog.getId());
@ -198,30 +198,30 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
checkControlAccessParams(params);
}
@Test(description = "POST /org/{id}/catalog/{catalogId}/action/controlAccess", dependsOnMethods = { "testCreateCatalog" })
public void testModifyAccessControl() {
@Test(description = "POST /org/{id}/catalog/{catalogId}/action/controlAccess", dependsOnMethods = { "testAddCatalog" })
public void testEditAccessControl() {
// Setup params
ControlAccessParams params = catalogApi.getAccessControl(catalog.getId());
// Call the method being tested
ControlAccessParams modified = catalogApi.modifyAccessControl(catalog.getId(), params);
ControlAccessParams modified = catalogApi.editAccessControl(catalog.getId(), params);
// Check params are well formed
checkControlAccessParams(modified);
}
@Test(description = "DELETE /admin/catalog/{id}", dependsOnMethods = { "testCreateCatalog" })
public void testDeleteCatalog() {
@Test(description = "DELETE /admin/catalog/{id}", dependsOnMethods = { "testAddCatalog" })
public void testRemoveCatalog() {
// assertEquals(catalog.getCatalogItems().getCatalogItems().size(), 0,
// String.format(OBJ_FIELD_EMPTY_TO_DELETE, "Catalog", "CatalogItems",
// catalog.getCatalogItems().getCatalogItems().toString()));
AdminCatalog deleteCatalog = AdminCatalog.builder().name(name("Test Catalog "))
.description("created by testCreateCatalog()").build();
deleteCatalog = catalogApi.createCatalogInOrg(deleteCatalog, org.getId());
catalogApi.delete(deleteCatalog.getId());
AdminCatalog removeCatalog = AdminCatalog.builder().name(name("Test Catalog "))
.description("created by testAddCatalog()").build();
removeCatalog = catalogApi.addCatalogToOrg(removeCatalog, org.getId());
catalogApi.remove(removeCatalog.getId());
deleteCatalog = catalogApi.get(deleteCatalog.getId());
assertNull(deleteCatalog, String.format(OBJ_DEL, CATALOG, deleteCatalog != null ? deleteCatalog.toString() : ""));
removeCatalog = catalogApi.get(removeCatalog.getId());
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());
}
HttpRequest update = HttpRequest.builder()
HttpRequest edit = HttpRequest.builder()
.method("PUT")
.endpoint(networkAdminHref )
.addHeader("Accept", TASK)
.addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/network/admin/updateNetworkSource.xml", ORG_NETWORK))
.payload(payloadFromResourceWithContentType("/network/admin/editNetworkSource.xml", ORG_NETWORK))
.build();
HttpResponse updateResponse = HttpResponse.builder()
HttpResponse editResponse = HttpResponse.builder()
.statusCode(200)
.payload(payloadFromResourceWithContentType("/network/admin/updateNetworkTask.xml", TASK))
.payload(payloadFromResourceWithContentType("/network/admin/editNetworkTask.xml", TASK))
.build();
@Test
public void testUpdateNetworkHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, update, updateResponse);
assertEquals(api.getNetworkApi().update(networkAdminHref, updateNetwork()), updateNetworkTask());
public void testEditNetworkHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, edit, editResponse);
assertEquals(api.getNetworkApi().edit(networkAdminHref, editNetwork()), editNetworkTask());
}
@Test
public void testUpdateNetworkUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveNetwork, resolveNetworkResponse, update, updateResponse);
assertEquals(api.getNetworkApi().update(networkUrn, updateNetwork()), updateNetworkTask());
public void testEditNetworkUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveNetwork, resolveNetworkResponse, edit, editResponse);
assertEquals(api.getNetworkApi().edit(networkUrn, editNetwork()), editNetworkTask());
}
HttpRequest reset = HttpRequest.builder()
@ -209,7 +209,7 @@ public class AdminNetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest
.build();
}
public final OrgNetwork updateNetwork() {
public final OrgNetwork editNetwork() {
return network().toBuilder()
.build();
@ -248,7 +248,7 @@ public class AdminNetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest
.build();
}
public final Task updateNetworkTask() {
public final Task editNetworkTask() {
return Task.builder()
.status("running")
.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
@Test(description = "PUT /admin/network/{id}" )
public void testUpdateNetwork() {
public void testEditNetwork() {
//TODO: ensure network instanceof OrgNetwork, may require queries
assertTrue(network instanceof OrgNetwork, String.format(URN_REQ_LIVE, "OrgNetwork"));
@ -92,49 +92,49 @@ public class AdminNetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.tasks(Collections.<Task>emptySet())
.build();
OrgNetwork updateNetwork = getMutatedOrgNetwork(oldNetwork);
OrgNetwork editNetwork = getMutatedOrgNetwork(oldNetwork);
try {
Task updateNetworkTask = networkApi.update(networkUrn, updateNetwork);
Checks.checkTask(updateNetworkTask);
assertTrue(retryTaskSuccess.apply(updateNetworkTask), String.format(TASK_COMPLETE_TIMELY, "updateNetworkTask"));
Task editNetworkTask = networkApi.edit(networkUrn, editNetwork);
Checks.checkTask(editNetworkTask);
assertTrue(retryTaskSuccess.apply(editNetworkTask), String.format(TASK_COMPLETE_TIMELY, "editNetworkTask"));
network = networkApi.get(networkUrn);
Checks.checkOrgNetwork(Network.<OrgNetwork>toSubType(network));
assertTrue(equal(network.getConfiguration().getIpScope(),
updateNetwork.getConfiguration().getIpScope()),
editNetwork.getConfiguration().getIpScope()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "ipScope"));
assertTrue(equal(network.getConfiguration().getParentNetwork(),
updateNetwork.getConfiguration().getParentNetwork()),
editNetwork.getConfiguration().getParentNetwork()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "parentNetwork"));
assertTrue(equal(network.getConfiguration().getFenceMode(),
updateNetwork.getConfiguration().getFenceMode()),
editNetwork.getConfiguration().getFenceMode()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "fenceMode"));
assertTrue(equal(network.getConfiguration().retainNetInfoAcrossDeployments(),
updateNetwork.getConfiguration().retainNetInfoAcrossDeployments()),
editNetwork.getConfiguration().retainNetInfoAcrossDeployments()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "retainNetInfoAcrossDeployments"));
assertTrue(equal(network.getConfiguration().getNetworkFeatures(),
updateNetwork.getConfiguration().getNetworkFeatures()),
editNetwork.getConfiguration().getNetworkFeatures()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "networkFeatures"));
assertTrue(equal(network.getConfiguration().getSyslogServerSettings(),
updateNetwork.getConfiguration().getSyslogServerSettings()),
editNetwork.getConfiguration().getSyslogServerSettings()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "syslogServerSettings"));
assertTrue(equal(network.getConfiguration().getRouterInfo(),
updateNetwork.getConfiguration().getRouterInfo()),
editNetwork.getConfiguration().getRouterInfo()),
String.format(OBJ_FIELD_UPDATABLE, NETWORK+".configuration", "routerInfo"));
// FIXME: fails
// assertTrue(equal(Network.<OrgNetwork>toSubType(network).getNetworkPool(),
// updateNetwork.getNetworkPool()),
// editNetwork.getNetworkPool()),
// String.format(OBJ_FIELD_UPDATABLE, NETWORK, "networkPool"));
// assertTrue(equal(Network.<OrgNetwork>toSubType(network).getAllowedExternalIpAddresses(),
// updateNetwork.getAllowedExternalIpAddresses()),
// editNetwork.getAllowedExternalIpAddresses()),
// String.format(OBJ_FIELD_UPDATABLE, NETWORK, "allowedExternalIpAddresses"));
} finally {
Task updateNetworkTask = networkApi.update(networkUrn, oldNetwork);
Checks.checkTask(updateNetworkTask);
assertTrue(retryTaskSuccess.apply(updateNetworkTask), String.format(TASK_COMPLETE_TIMELY, "updateNetworkTask"));
Task editNetworkTask = networkApi.edit(networkUrn, oldNetwork);
Checks.checkTask(editNetworkTask);
assertTrue(retryTaskSuccess.apply(editNetworkTask), String.format(TASK_COMPLETE_TIMELY, "editNetworkTask"));
network = networkApi.get(networkUrn);
}
}

View File

@ -219,21 +219,21 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
}
@Test(enabled = false)
public void testUpdateSettings() {
public void testEditSettings() {
VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest,
sessionResponse,
new VcloudHttpRequestPrimer()
.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(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateSettings.xml", VCloudDirectorMediaType.ORG_SETTINGS)
.xmlFilePayload("/org/admin/editSettings.xml", VCloudDirectorMediaType.ORG_SETTINGS)
.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
@ -254,22 +254,22 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
}
@Test
public void testUpdateEmailSettings() {
public void testEditEmailSettings() {
VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest,
sessionResponse,
new VcloudHttpRequestPrimer()
.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)
.acceptMedia(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateEmailSettings.xml",
.xmlFilePayload("/org/admin/editEmailSettings.xml",
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)
@ -304,25 +304,25 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
}
@Test(enabled = false)
public void testUpdateGeneralSettings() {
public void testEditGeneralSettings() {
VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest,
sessionResponse,
new VcloudHttpRequestPrimer()
.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)
.acceptMedia(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateGeneralSettings.xml",
.xmlFilePayload("/org/admin/editGeneralSettings.xml",
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()
.build();
@ -385,25 +385,25 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
}
@Test
public void testUpdatePasswordPolicy() {
public void testEditPasswordPolicy() {
VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest,
sessionResponse,
new VcloudHttpRequestPrimer()
.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)
.acceptMedia(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updatePasswordPolicy.xml",
.xmlFilePayload("/org/admin/editPasswordPolicy.xml",
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)
.accountLockoutIntervalMinutes(11).build();
}
@ -440,25 +440,25 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
}
@Test(enabled = false)
public void testUpdateOrgVAppLeaseSettings() {
public void testEditOrgVAppLeaseSettings() {
VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest,
sessionResponse,
new VcloudHttpRequestPrimer()
.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)
.acceptMedia(VCloudDirectorMediaType.ORG_LEASE_SETTINGS).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateVAppLeaseSettings.xml",
.xmlFilePayload("/org/admin/editVAppLeaseSettings.xml",
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()
.build();
@ -497,28 +497,28 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
}
@Test(enabled = false)
public void testUpdateOrgVAppTemplateLeaseSettings() {
public void testEditOrgVAppTemplateLeaseSettings() {
VCloudDirectorAdminApi api = requestsSendResponses(
loginRequest,
sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT",
"/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)
.acceptMedia(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS).httpRequestBuilder()
.build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateVAppLeaseSettings.xml",
.xmlFilePayload("/org/admin/editVAppLeaseSettings.xml",
VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS).httpResponseBuilder()
.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()
.build();
@ -576,7 +576,7 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
}
@Test
public static final OrgSettings updateSettings() {
public static final OrgSettings editSettings() {
return settings().toBuilder().build();
}
@ -602,7 +602,7 @@ public class AdminOrgApiExpectTest extends VCloudDirectorAdminApiExpectTest {
}
@Test
public static final OrgEmailSettings updateEmailSettings() {
public static final OrgEmailSettings editEmailSettings() {
return emailSettings()
.toBuilder()
.isDefaultSmtpServer(false)

View File

@ -84,7 +84,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
}
@Test(description = "PUT /admin/org/{id}/settings/email", dependsOnMethods = { "testGetEmailSettings" })
public void testUpdateEmailSettings() {
public void testEditEmailSettings() {
boolean isDefaultSmtpServer = emailSettings.isDefaultSmtpServer();
boolean isDefaultOrgEmail = emailSettings.isDefaultOrgEmail();
String oldFromEmailAddress = emailSettings.getFromEmailAddress();
@ -104,7 +104,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.defaultSubjectPrefix(newDefaultSubjectPrefix).isAlertEmailToAllAdmins(!isAlertEmailToAllAdmins)
.smtpServerSettings(newSmtpServerSettings).build();
emailSettings = orgApi.updateEmailSettings(org.getId(), newEmailSettings);
emailSettings = orgApi.editEmailSettings(org.getId(), newEmailSettings);
assertTrue(equal(emailSettings.isDefaultSmtpServer(), !isDefaultSmtpServer),
String.format(OBJ_FIELD_UPDATABLE, "emailSettings", "isDefaultSmtpServer"));
@ -128,7 +128,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.defaultSubjectPrefix(oldDefaultSubjectPrefix).isAlertEmailToAllAdmins(isAlertEmailToAllAdmins)
.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" })
public void testUpdateGeneralSettings() {
// FIXME: canPublishCatalogs does not update
public void testEditGeneralSettings() {
// FIXME: canPublishCatalogs does not edit
// boolean canPublishCatalogs = generalSettings.canPublishCatalogs();
Integer deployedVMQuota = generalSettings.getDeployedVMQuota();
Integer storedVmQuota = generalSettings.getStoredVmQuota();
@ -156,7 +156,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.useServerBootSequence(!useServerBootSequence).delayAfterPowerOnSeconds(delayAfterPowerOnSeconds + 1)
.build();
generalSettings = orgApi.updateGeneralSettings(org.getId(), newGeneralSettings);
generalSettings = orgApi.editGeneralSettings(org.getId(), newGeneralSettings);
// assertTrue(equal(generalSettings.canPublishCatalogs(), !canPublishCatalogs),
// String.format(OBJ_FIELD_UPDATABLE,
@ -181,7 +181,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.useServerBootSequence(useServerBootSequence).delayAfterPowerOnSeconds(delayAfterPowerOnSeconds)
.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" })
public void testUpdatePasswordPolicy() {
public void testEditPasswordPolicy() {
boolean accountLockoutEnabled = passwordPolicy.isAccountLockoutEnabled();
Integer invalidLoginsBeforeLockout = passwordPolicy.getInvalidLoginsBeforeLockout();
Integer accountLockoutIntervalMinutes = passwordPolicy.getAccountLockoutIntervalMinutes();
@ -211,7 +211,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.invalidLoginsBeforeLockout(invalidLoginsBeforeLockout + 1)
.accountLockoutIntervalMinutes(accountLockoutIntervalMinutes + 1).build();
passwordPolicy = orgApi.updatePasswordPolicy(org.getId(), newPasswordPolicy);
passwordPolicy = orgApi.editPasswordPolicy(org.getId(), newPasswordPolicy);
assertTrue(equal(passwordPolicy.isAccountLockoutEnabled(), !accountLockoutEnabled),
String.format(OBJ_FIELD_UPDATABLE, "PasswordPolicySettings", "deleteOnStorageLeaseExpiration"));
@ -228,7 +228,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.invalidLoginsBeforeLockout(invalidLoginsBeforeLockout)
.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" })
// FIXME: fails with 403 forbidden
public void testUpdateVAppLeaseSettings() {
public void testEditVAppLeaseSettings() {
boolean deleteOnStorageLeaseExpiration = vAppLeaseSettings.deleteOnStorageLeaseExpiration();
Integer storageLeaseSeconds = vAppLeaseSettings.getStorageLeaseSeconds();
Integer deploymentLeaseSeconds = vAppLeaseSettings.getDeploymentLeaseSeconds();
@ -252,7 +252,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.storageLeaseSeconds(storageLeaseSeconds + 1).deploymentLeaseSeconds(deploymentLeaseSeconds + 1)
.build();
vAppLeaseSettings = orgApi.updateVAppLeaseSettings(org.getId(), newVAppLeaseSettings);
vAppLeaseSettings = orgApi.editVAppLeaseSettings(org.getId(), newVAppLeaseSettings);
assertTrue(equal(vAppLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration),
String.format(OBJ_FIELD_UPDATABLE, "vAppLeaseSettings", "deleteOnStorageLeaseExpiration"));
@ -269,7 +269,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.deleteOnStorageLeaseExpiration(deleteOnStorageLeaseExpiration)
.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" })
// FIXME: fails with 403 forbidden
public void testUpdateVAppTemplateLeaseSettings() {
public void testEditVAppTemplateLeaseSettings() {
boolean deleteOnStorageLeaseExpiration = vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration();
Integer storageLeaseSeconds = vAppTemplateLeaseSettings.getStorageLeaseSeconds();
@ -291,7 +291,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.deleteOnStorageLeaseExpiration(!deleteOnStorageLeaseExpiration)
.storageLeaseSeconds(storageLeaseSeconds + 1).build();
vAppTemplateLeaseSettings = orgApi.updateVAppTemplateLeaseSettings(org.getId(), newVAppTemplateLeaseSettings);
vAppTemplateLeaseSettings = orgApi.editVAppTemplateLeaseSettings(org.getId(), newVAppTemplateLeaseSettings);
assertTrue(equal(vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration),
String.format(OBJ_FIELD_UPDATABLE, "vAppTemplateLeaseSettings", "deleteOnStorageLeaseExpiration"));
@ -306,7 +306,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.deleteOnStorageLeaseExpiration(deleteOnStorageLeaseExpiration)
.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" })
public void testUpdateSettings() throws Exception {
public void testEditSettings() throws Exception {
String newFromEmailAddress = "test" + random.nextInt(Integer.MAX_VALUE) + "@test.com";
Exception exception = null;
@ -326,7 +326,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
OrgSettings newSettings = OrgSettings.builder()
.emailSettings(emailSettings.toBuilder().fromEmailAddress(newFromEmailAddress).build()).build();
OrgSettings modified = orgApi.updateSettings(org.getId(), newSettings);
OrgSettings modified = orgApi.editSettings(org.getId(), newSettings);
Checks.checkOrgSettings(settings);
assertTrue(equal(modified.getEmailSettings().getFromEmailAddress(), newFromEmailAddress),
@ -338,7 +338,7 @@ public class AdminOrgApiLiveTest extends BaseVCloudDirectorApiLiveTest {
try {
OrgSettings restorableSettings = OrgSettings.builder().emailSettings(emailSettings).build();
settings = orgApi.updateSettings(org.getId(), restorableSettings);
settings = orgApi.editSettings(org.getId(), restorableSettings);
} catch (Exception e) {
if (exception != null) {
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 {
if (metadataKey != null) {
try {
Task task = metadataApi.deleteEntry(lazyGetVdc().getHref(), metadataKey);
Task task = metadataApi.removeEntry(lazyGetVdc().getHref(), metadataKey);
taskDoneEventually(task);
} catch (VCloudDirectorException e) {
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();
try {
Task task = vdcApi.update(vdcUrn, vdc);
Task task = vdcApi.edit(vdcUrn, vdc);
assertTaskSucceeds(task);
AdminVdc modified = vdcApi.get(vdcUrn);
@ -107,7 +107,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
} finally {
try {
AdminVdc restorableVdc = AdminVdc.builder().name(origName).build();
Task task = vdcApi.update(vdcUrn, restorableVdc);
Task task = vdcApi.edit(vdcUrn, restorableVdc);
assertTaskSucceeds(task);
} catch (Exception e) {
if (exception != null) {
@ -122,15 +122,15 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// TODO insufficient permissions to test
@Test(description = "DELETE /admin/vdc/{id}", enabled = false)
public void testDeleteVdc() throws Exception {
// TODO Need to have a VDC that we're happy to delete!
Task task = vdcApi.delete(vdcUrn);
public void testRemoveVdc() throws Exception {
// TODO Need to have a VDC that we're happy to remove!
Task task = vdcApi.remove(vdcUrn);
assertTaskSucceeds(task);
try {
vdcApi.get(vdcUrn);
} catch (VCloudDirectorException e) {
// success; unreachable because it has been deleted
// success; unreachable because it has been removed
// TODO: ^^ wrong. this should return null
}
}
@ -138,7 +138,7 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// TODO insufficient permissions to test
@Test(description = "DISABLE/ENABLE /admin/vdc/{id}", enabled = false)
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;
try {
@ -205,10 +205,10 @@ public class AdminVdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
// TODO insufficient permissions to test
@Test(description = "DELETE /admin/vdc/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" }, enabled = false)
public void testDeleteMetadataValue() throws Exception {
// TODO Remove dependency on other tests; make cleanUp delete a list of metadata entries?
public void testRemoveMetadataValue() throws Exception {
// 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);
try {

View File

@ -66,28 +66,28 @@ public class GroupApiExpectTest extends VCloudDirectorAdminApiExpectTest {
}
@Test(enabled = false)
public void testUpdateGroup() {
public void testEditGroup() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/group/???")
.xmlFilePayload("/group/updateGroupSource.xml", VCloudDirectorMediaType.GROUP)
.xmlFilePayload("/group/editGroupSource.xml", VCloudDirectorMediaType.GROUP)
.acceptMedia(VCloudDirectorMediaType.GROUP)
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/group/updateGroup.xml", VCloudDirectorMediaType.GROUP)
.xmlFilePayload("/group/editGroup.xml", VCloudDirectorMediaType.GROUP)
.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() {
return null; // TODO chain onto group() then toBuilder() and modify?
public static Group editGroup() {
return null; // TODO chain onto group() then toBuilder() and edit?
}
@Test
public void testDeleteGroup() {
public void testRemoveGroup() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("DELETE", "/admin/group/???")
@ -96,6 +96,6 @@ public class GroupApiExpectTest extends VCloudDirectorAdminApiExpectTest {
new VcloudHttpResponsePrimer()
.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()
// .ldapMode(OrgLdapSettings.LdapMode.SYSTEM)
// .build();
// context.getApi().getAdminOrgApi().updateLdapSettings(newLdapSettings);
// context.getApi().getAdminOrgApi().editLdapSettings(newLdapSettings);
}
@Test(description = "POST /admin/org/{id}/groups")
public void testCreateGroup() {
public void testAddGroup() {
fail("LDAP not configured, group api isn't currently testable.");
// group = groupApi.createGroup(orgUri, Group.builder()
// .build();
@ -77,7 +77,7 @@ public class GroupApiLiveTest extends BaseVCloudDirectorApiLiveTest {
Checks.checkGroup(group);
}
@Test(description = "GET /admin/group/{id}", dependsOnMethods = { "testCreateGroup" })
@Test(description = "GET /admin/group/{id}", dependsOnMethods = { "testAddGroup" })
public void testGetGroup() {
group = groupApi.getGroup(groupRef.getHref());
@ -85,7 +85,7 @@ public class GroupApiLiveTest extends BaseVCloudDirectorApiLiveTest {
}
@Test(description = "PUT /admin/group/{id}", dependsOnMethods = { "testGetGroup" } )
public void testUpdateGroup() {
public void testEditGroup() {
String oldName = group.getName();
String newName = "new "+oldName;
String oldDescription = group.getDescription();
@ -98,7 +98,7 @@ public class GroupApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.description(newDescription)
.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.getDescription(), newDescription),
@ -113,13 +113,13 @@ public class GroupApiLiveTest extends BaseVCloudDirectorApiLiveTest {
.description(oldDescription)
.build();
group = groupApi.updateGroup(group.getHref(), group);
group = groupApi.editGroup(group.getHref(), group);
}
}
@Test(description = "DELETE /admin/group/{id}", dependsOnMethods = { "testUpdateGroup" } )
public void testDeleteGroup() {
groupApi.deleteGroup(groupRef.getHref());
@Test(description = "DELETE /admin/group/{id}", dependsOnMethods = { "testEditGroup" } )
public void testRemoveGroup() {
groupApi.removeGroup(groupRef.getHref());
// TODO stronger assertion of error expected
// 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 orgAdminHref = URI.create(endpoint + "/admin/org/" + org);
private HttpRequest create = HttpRequest.builder()
private HttpRequest add = HttpRequest.builder()
.method("POST")
.endpoint(orgAdminHref + "/users")
.addHeader("Accept", USER)
.addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/user/createUserSource.xml", VCloudDirectorMediaType.USER))
.payload(payloadFromResourceWithContentType("/user/addUserSource.xml", VCloudDirectorMediaType.USER))
.build();
private HttpResponse createResponse = HttpResponse.builder()
private HttpResponse addResponse = HttpResponse.builder()
.statusCode(200)
.payload(payloadFromResourceWithContentType("/user/createUser.xml", USER + ";version=1.5"))
.payload(payloadFromResourceWithContentType("/user/addUser.xml", USER + ";version=1.5"))
.build();
@Test
public void testCreateUserHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, create, createResponse);
assertEquals(api.getUserApi().createUserInOrg(createUserSource(), orgAdminHref), createUser());
public void testAddUserHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, add, addResponse);
assertEquals(api.getUserApi().addUserToOrg(addUserSource(), orgAdminHref), addUser());
}
private HttpRequest resolveOrg = HttpRequest.builder()
@ -100,9 +100,9 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.build();
@Test
public void testCreateUserUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveOrg, resolveOrgResponse, create, createResponse);
assertEquals(api.getUserApi().createUserInOrg(createUserSource(), orgUrn), createUser());
public void testAddUserUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveOrg, resolveOrgResponse, add, addResponse);
assertEquals(api.getUserApi().addUserToOrg(addUserSource(), orgUrn), addUser());
}
HttpRequest get = HttpRequest.builder()
@ -150,30 +150,30 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
assertEquals(api.getUserApi().get(userUrn), user());
}
HttpRequest update = HttpRequest.builder()
HttpRequest edit = HttpRequest.builder()
.method("PUT")
.endpoint(userHref)
.addHeader("Accept", USER)
.addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
.payload(payloadFromResourceWithContentType("/user/updateUserSource.xml", USER))
.payload(payloadFromResourceWithContentType("/user/editUserSource.xml", USER))
.build();
HttpResponse updateResponse = HttpResponse.builder()
HttpResponse editResponse = HttpResponse.builder()
.statusCode(200)
.payload(payloadFromResourceWithContentType("/user/updateUser.xml", USER))
.payload(payloadFromResourceWithContentType("/user/editUser.xml", USER))
.build();
@Test
public void testUpdateUserHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, update, updateResponse);
assertEquals(api.getUserApi().update(userHref, updateUserSource()), updateUser());
public void testEditUserHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, edit, editResponse);
assertEquals(api.getUserApi().edit(userHref, editUserSource()), editUser());
}
@Test
public void testUpdateUserUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveUser, resolveUserResponse, update, updateResponse);
assertEquals(api.getUserApi().update(userUrn, updateUserSource()), updateUser());
public void testEditUserUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveUser, resolveUserResponse, edit, editResponse);
assertEquals(api.getUserApi().edit(userUrn, editUserSource()), editUser());
}
HttpRequest unlock = HttpRequest.builder()
@ -209,30 +209,30 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
api.getUserApi().unlock(userUrn);
}
HttpRequest delete = HttpRequest.builder()
HttpRequest remove = HttpRequest.builder()
.method("DELETE")
.endpoint(userHref)
.addHeader("Accept", "*/*")
.addHeader("x-vcloud-authorization", token)
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token).build();
HttpResponse deleteResponse = HttpResponse.builder()
HttpResponse removeResponse = HttpResponse.builder()
.statusCode(200)
.build();
@Test
public void testDeleteUserHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, delete, deleteResponse);
api.getUserApi().delete(userHref);
public void testRemoveUserHref() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, remove, removeResponse);
api.getUserApi().remove(userHref);
}
@Test
public void testDeleteUserUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveUser, resolveUserResponse, delete, deleteResponse);
api.getUserApi().delete(userUrn);
public void testRemoveUserUrn() {
VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, resolveUser, resolveUserResponse, remove, removeResponse);
api.getUserApi().remove(userUrn);
}
public static final User createUserSource() {
public static final User addUserSource() {
return User.builder()
.name("test")
.fullName("testFullName")
@ -255,8 +255,8 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.build();
}
public static final User createUser() {
return createUserSource().toBuilder()
public static final User addUser() {
return addUserSource().toBuilder()
.id("urn:vcloud:user:b37223f3-8792-477a-820f-334998f61cd6")
.type("application/vnd.vmware.admin.user+xml")
.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() {
return createUser().toBuilder()
return addUser().toBuilder()
.nameInSource("test")
.build();
}
public static final User updateUserSource() {
public static final User editUserSource() {
return user().toBuilder()
.fullName("new"+user().getFullName())
.emailAddress("new"+user().getEmailAddress())
@ -299,8 +299,8 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.build();
}
public static final User updateUser() {
return updateUserSource().toBuilder()
public static final User editUser() {
return editUserSource().toBuilder()
.password(null)
.build();
}

View File

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

View File

@ -481,7 +481,7 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
protected void cleanUpVAppTemplate(VAppTemplate vAppTemplate) {
VAppTemplateApi vappTemplateApi = context.getApi().getVAppTemplateApi();
try {
Task task = vappTemplateApi.deleteVappTemplate(vAppTemplate.getHref());
Task task = vappTemplateApi.removeVappTemplate(vAppTemplate.getHref());
taskDoneEventually(task);
} catch (Exception e) {
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
if (vApp == null) {
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());
// 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) {
for (Task task : vApp.getTasks()) {
if (!taskDoneEventually(task)) {
@ -539,7 +539,7 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
}
try {
Task task = vAppApi.deleteVApp(vAppURI);
Task task = vAppApi.removeVApp(vAppURI);
taskDoneEventually(task);
vAppNames.remove(vApp.getName());
logger.info("Deleted VApp %s", vApp.getName());