mirror of https://github.com/apache/jclouds.git
Merge pull request #501 from danikov/vclouds-director-bugfixes-3
Issue 830: vCloud director Bugfix
This commit is contained in:
commit
092533c3dd
|
@ -23,7 +23,9 @@ import java.net.URI;
|
|||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
|
@ -46,6 +48,15 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
@RequestFilters(AddVCloudAuthorizationToRequest.class)
|
||||
public interface GroupAsyncClient {
|
||||
|
||||
@POST
|
||||
@Path("/groups")
|
||||
@Consumes(VCloudDirectorMediaType.GROUP)
|
||||
@Produces(VCloudDirectorMediaType.GROUP)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Group> createGroup(@EndpointParam URI adminOrgUri,
|
||||
@BinderParam(BindToXMLPayload.class) Group group);
|
||||
|
||||
/**
|
||||
* @see GroupClient#getGroup(URI)
|
||||
*/
|
||||
|
|
|
@ -33,6 +33,18 @@ import org.jclouds.vcloud.director.v1_5.domain.Group;
|
|||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface GroupClient {
|
||||
|
||||
/**
|
||||
* Imports a group in an organization.
|
||||
*
|
||||
* <pre>
|
||||
* POST /admin/org/{id}/groups
|
||||
* </pre>
|
||||
*
|
||||
* @param orgUri the admin org to create the group in
|
||||
* @return the created group
|
||||
*/
|
||||
Group createGroup(URI adminOrgUri, Group group);
|
||||
|
||||
/**
|
||||
* Retrieves a group.
|
||||
*
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.jclouds.vcloud.director.v1_5.domain.CustomizationSection;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||
|
@ -49,6 +48,18 @@ public interface VAppTemplateClient {
|
|||
|
||||
/**
|
||||
* Retrieves a vApp template (can be used also to retrieve a VM from a vApp Template).
|
||||
* The vApp could be in one of these statues: FAILED_CREATION(-1) - Transient entity state,
|
||||
* e.g., model object is created but the corresponding VC backing does not exist yet. This
|
||||
* is further sub-categorized in the respective entities. UNRESOLVED(0) - Entity is whole,
|
||||
* e.g., VM creation is complete and all the required model objects and VC backings are created.
|
||||
* RESOLVED(1) - Entity is resolved. UNKNOWN(6) - Entity state could not be retrieved from
|
||||
* the inventory, e.g., VM power state is null. POWERED_OFF(8) - All VMs of the vApp template
|
||||
* are powered off. MIXED(10) - vApp template status is set to MIXED when the VMs in the
|
||||
* vApp are in different power states.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the requested template
|
||||
|
@ -58,123 +69,201 @@ public interface VAppTemplateClient {
|
|||
/**
|
||||
* Modifies only the name/description of a vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vAppTemplate/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param template the template containing the new name and/or description
|
||||
* @return the task performing the action
|
||||
* @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 editVAppTemplate(URI templateUri, VAppTemplate template);
|
||||
|
||||
/**
|
||||
* Deletes a vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* DELETE /vAppTemplate/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
*
|
||||
* <pre>
|
||||
* POST /vAppTemplate/{id}/action/consolidate
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
* @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 consolidateVappTemplate(URI templateUri);
|
||||
|
||||
/**
|
||||
* Disables the download link to the ovf of a vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vAppTemplate/{id}/action/disableDownload
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
void disableDownloadVappTemplate(URI templateUri);
|
||||
|
||||
/**
|
||||
* Enables downloading of the ovf of a vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vAppTemplate/{id}/action/enableDownload
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
* @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 enableDownloadVappTemplate(URI templateUri);
|
||||
|
||||
/**
|
||||
* Relocates a virtual machine in a vApp template to a different datastore. *
|
||||
* Relocates a virtual machine in a vApp template to a different datastore.
|
||||
*
|
||||
* <pre>
|
||||
* POST /vAppTemplate/{id}/action/relocate
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param params contains the reference to the new datastore
|
||||
* @return the task performing the action
|
||||
* @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 relocateVappTemplate(URI templateUri, RelocateParams params);
|
||||
|
||||
/**
|
||||
* Retrieves the customization section of a vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/customizationSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
* @return the customization section
|
||||
*/
|
||||
CustomizationSection getVAppTemplateCustomizationSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Modifies the vApp template customization information.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vAppTemplate/{id}/customizationSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param section the new configuration to apply
|
||||
* @return the task performing the action
|
||||
* @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 editVAppTemplateCustomizationSection(URI templateUri, CustomizationSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the Guest Customization Section of a VM
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/guestCustomizationSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
* @return the guest customization section
|
||||
*/
|
||||
GuestCustomizationSection getVAppTemplateGuestCustomizationSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
* Modifies the guest customization options of a VM.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vAppTemplate/{id}/guestCustomizationSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param section the new configuration to apply
|
||||
* @return the task performing the action
|
||||
* @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 editVAppTemplateGuestCustomizationSection(URI templateUri, GuestCustomizationSection section);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
* Retrieves the lease settings section of a vApp or vApp template
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/leaseSettingsSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
* @return the lease settings
|
||||
*/
|
||||
LeaseSettingsSection getVappTemplateLeaseSettingsSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
* Modifies the lease settings section of a vApp or vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vAppTemplate/{id}/leaseSettingsSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param section the new configuration to apply
|
||||
* @return the task performing the action
|
||||
* @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 editVappTemplateLeaseSettingsSection(URI templateUri, LeaseSettingsSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the network config section of a vApp or vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/networkConfigSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the network config section requested
|
||||
*/
|
||||
NetworkConfigSection getVAppTemplateNetworkConfigSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Modifies the network config section of a vApp or vApp template.
|
||||
* Modifies the network config section of a vApp. There are three general types of vApp
|
||||
* networks which could be configured from this section. They are specified by the element
|
||||
* value in /. isolated - this is a vApp network which is not connected to any external
|
||||
* organization network and is used only to connect VMs internally in a vApp. In this
|
||||
* network you could configure only its element of /. bridged - this is a vApp network
|
||||
* which is directly connected to an external organization network. In this network you
|
||||
* should configure only the element of /. In this case the element is inherit from the
|
||||
* parent network. natRouted - this is a vApp network which is NAT routed to an external
|
||||
* organization network. In this network you could configure the and also you should
|
||||
* specify and the element of /. When the network is NAT routed you could specify DHCP,
|
||||
* firewall rules and NAT rules, for fine-grained configuration of your network.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vAppTemplate/{id}/networkConfigSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param section the new configuration to apply
|
||||
* @return the task performing the action
|
||||
* @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 editVAppTemplateNetworkConfigSection(URI templateUri, NetworkConfigSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the network connection section of a vApp or vApp template.
|
||||
* Retrieves the network connection section of a VM
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/networkConnectionSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the network connection section requested
|
||||
|
@ -182,33 +271,54 @@ public interface VAppTemplateClient {
|
|||
NetworkConnectionSection getVAppTemplateNetworkConnectionSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Modifies the network connection section of a vApp or vApp template.
|
||||
* Modifies the network connection section of a VM.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vAppTemplate/{id}/networkConnectionSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @param section the new configuration to apply
|
||||
* @return the task performing the action
|
||||
* @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 editVAppTemplateNetworkConnectionSection(URI templateUri, NetworkConnectionSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the network section of a vApp or vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/networkSection
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the network section requested
|
||||
*/
|
||||
NetworkSection getVAppTemplateNetworkSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Retrieves an OVF descriptor of a vApp template.
|
||||
* Retrieves an OVF descriptor of a vApp template. This OVF represents the vApp
|
||||
* template as it is, with all vCloud specific information (like mac address,
|
||||
* parent networks, etc). The OVF which could be downloaded by enabling for
|
||||
* download will not contain this information. There no specific states bound
|
||||
* to this entity.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/ovf
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
* @return the ovf envelope
|
||||
*/
|
||||
Envelope getVAppTemplateOvf(URI templateUri);
|
||||
|
||||
/**
|
||||
* Retrieves vApp template owner.
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/owner
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the owner of the vApp template
|
||||
*/
|
||||
|
@ -217,6 +327,10 @@ public interface VAppTemplateClient {
|
|||
/**
|
||||
* Retrieves VAppTemplate/VM product sections
|
||||
*
|
||||
* <pre>
|
||||
* GET /vAppTemplate/{id}/productSections
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the product sections
|
||||
*/
|
||||
|
@ -225,8 +339,13 @@ public interface VAppTemplateClient {
|
|||
/**
|
||||
* Modifies the product sections of a vApp or vApp template.
|
||||
*
|
||||
* <pre>
|
||||
* PUT /vAppTemplate/{id}/productSections
|
||||
* </pre>
|
||||
*
|
||||
* @param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
* @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 editProductSectionsForVAppTemplate(URI templateUri, ProductSectionList sections);
|
||||
|
||||
|
|
|
@ -31,10 +31,7 @@ import java.io.IOException;
|
|||
import java.math.BigInteger;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection;
|
||||
|
@ -64,7 +61,6 @@ import com.google.common.base.Predicates;
|
|||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Shared code to test the behaviour of {@link VAppClient} and {@link VAppTemplateClient}.
|
||||
|
|
|
@ -147,7 +147,7 @@ public class AdminNetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest
|
|||
@Test(testName = "POST /admin/network/{id}/action/reset")
|
||||
public void testResetNetwork() {
|
||||
// TODO assert that network is deployed somehow
|
||||
Task resetNetworkTask = networkClient.resetNetwork(network.getHref());
|
||||
Task resetNetworkTask = networkClient.resetNetwork(networkRef.getHref());
|
||||
Checks.checkTask(resetNetworkTask);
|
||||
assertTrue(retryTaskSuccess.apply(resetNetworkTask), String.format(TASK_COMPLETE_TIMELY, "resetNetworkTask"));
|
||||
network = networkClient.getNetwork(network.getHref());
|
||||
|
|
|
@ -369,14 +369,14 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test(testName = "GET /admin/org/{id}/settings/settings")
|
||||
@Test(testName = "GET /admin/org/{id}/settings")
|
||||
public void testGetSettings() {
|
||||
settings = orgClient.getSettings(orgRef.getHref());
|
||||
|
||||
Checks.checkOrgSettings(settings);
|
||||
}
|
||||
|
||||
@Test(testName = "PUT /admin/org/{id}/settings/settings",
|
||||
@Test(testName = "PUT /admin/org/{id}/settings",
|
||||
dependsOnMethods = { "testGetEmailSettings" } )
|
||||
public void testUpdateSettings() throws Exception {
|
||||
String newFromEmailAddress = "test"+random.nextInt(Integer.MAX_VALUE)+"@test.com";
|
||||
|
|
|
@ -165,7 +165,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test(testName = "PUT /admin/vdc/{id}/metadata")
|
||||
@Test(testName = "GET /admin/vdc/{id}/metadata")
|
||||
public void testGetMetadata() throws Exception {
|
||||
Metadata metadata = metadataClient.getMetadata(adminVdcUri);
|
||||
|
||||
|
@ -190,7 +190,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
|
||||
// TODO insufficient permissions to test
|
||||
@Test(testName = "PUT /admin/vdc/{id}/metadata", dependsOnMethods = { "testSetMetadata" }, enabled=false)
|
||||
@Test(testName = "GET /admin/vdc/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadata" }, enabled=false)
|
||||
public void testGetMetadataValue() throws Exception {
|
||||
MetadataValue retrievedMetadataValue = metadataClient.getMetadataValue(adminVdcUri, metadataKey);
|
||||
|
||||
|
@ -198,7 +198,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
|
||||
// TODO insufficient permissions to test
|
||||
@Test(testName = "PUT /admin/vdc/{id}/metadata", dependsOnMethods = { "testGetMetadataValue" }, enabled=false )
|
||||
@Test(testName = "PUT /admin/vdc/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadataValue" }, enabled=false )
|
||||
public void testSetMetadataValue() throws Exception {
|
||||
metadataValue = name("value-");
|
||||
MetadataValue newV = MetadataValue.builder().value(metadataValue).build();
|
||||
|
@ -211,7 +211,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
|
||||
// TODO insufficient permissions to test
|
||||
@Test(testName = "PUT /admin/vdc/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" }, enabled=false )
|
||||
@Test(testName = "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?
|
||||
|
||||
|
|
|
@ -20,13 +20,9 @@ package org.jclouds.vcloud.director.v1_5.features;
|
|||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_UPDATABLE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Group;
|
||||
|
@ -61,14 +57,19 @@ public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
@BeforeClass(inheritGroups = true)
|
||||
public void setupRequiredClients() {
|
||||
groupClient = context.getApi().getGroupClient();
|
||||
groupRef = Reference.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/group/???"))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test(testName = "GET /admin/group/{id}")
|
||||
@Test(testName = "POST /admin/org/{id}/groups")
|
||||
public void testCreateGroup() {
|
||||
fail("LDAP not configured, group client isn't currently testable.");
|
||||
// group = groupClient.createGroup(orgUri, Group.builder()
|
||||
// .build();
|
||||
|
||||
Checks.checkGroup(group);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /admin/group/{id}", dependsOnMethods = { "testCreateGroup" })
|
||||
public void testGetGroup() {
|
||||
assertNotNull(groupRef, String.format(REF_REQ_LIVE, "Group"));
|
||||
group = groupClient.getGroup(groupRef.getHref());
|
||||
|
||||
Checks.checkGroup(group);
|
||||
|
@ -108,7 +109,7 @@ public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
|
||||
@Test(testName = "DELETE /admin/group/{id}", dependsOnMethods = { "testUpdateGroup" } )
|
||||
public void testDeleteCatalog() {
|
||||
public void testDeleteGroup() {
|
||||
groupClient.deleteGroup(groupRef.getHref());
|
||||
|
||||
// TODO stronger assertion of error expected
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
|
|
@ -110,7 +110,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
checkOrg(org);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = { "testGetOrg" })
|
||||
@Test(testName = "orgClient admin metadata setup", dependsOnMethods = { "testGetOrg" })
|
||||
public void testSetupMetadata() {
|
||||
context.getApi().getAdminOrgClient().getMetadataClient().setMetadata(toAdminUri(orgURI),
|
||||
"KEY", MetadataValue.builder().value("VALUE").build());
|
||||
|
|
|
@ -113,7 +113,7 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
// FIXME cancelTask complains "This task can not be canceled"
|
||||
// However, when I do this through the UI, I can cancel the task for instantiating a vApp.
|
||||
@Test(testName = "GET /task/{id}/metadata/", dependsOnMethods = { "testGetTask" })
|
||||
@Test(testName = "POST /task/{id}/action/cancel", dependsOnMethods = { "testGetTask" })
|
||||
public void testCancelTask() {
|
||||
vApp = instantiateVApp();
|
||||
|
||||
|
|
|
@ -41,9 +41,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.RoleReferences;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.User;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRoleRecord;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.jclouds.vcloud.director.v1_5.login.SessionClient;
|
||||
import org.testng.annotations.AfterClass;
|
||||
|
@ -99,50 +96,6 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
Checks.checkUser(newUser);
|
||||
}
|
||||
|
||||
public static Reference vAppUserRole(RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context) {
|
||||
RoleReferences roles = context.getApi().getAdminQueryClient().roleReferencesQueryAll();
|
||||
for (Reference role : roles.getReferences()) {
|
||||
if (equal(role.getName(), "vApp User")) {
|
||||
return Reference.builder().fromReference(role).build();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Reference nonVAppUserRole(RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context) {
|
||||
RoleReferences roles = context.getApi().getAdminQueryClient().roleReferencesQueryAll();
|
||||
for (Reference role : roles.getReferences()) {
|
||||
if (!equal(role.getName(), "vApp User")) {
|
||||
return Reference.builder().fromReference(role).build();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static User randomTestUser(String prefix, RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context) {
|
||||
return randomTestUser(prefix, vAppUserRole(context));
|
||||
}
|
||||
|
||||
public static User randomTestUser(String prefix, Reference role) {
|
||||
return User.builder()
|
||||
.name(name(prefix))
|
||||
.fullName("testFullName")
|
||||
.emailAddress("test@test.com")
|
||||
.telephone("555-1234")
|
||||
.isEnabled(false)
|
||||
.im("testIM")
|
||||
.isAlertEnabled(false)
|
||||
.alertEmailPrefix("testPrefix")
|
||||
.alertEmail("testAlert@test.com")
|
||||
.isExternal(false)
|
||||
.isGroupRole(false)
|
||||
.role(role)
|
||||
.password("password")
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test(testName = "GET /admin/user/{id}",
|
||||
dependsOnMethods = { "testCreateUser" })
|
||||
public void testGetUser() {
|
||||
|
@ -296,4 +249,48 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
assertEquals(vde.getError(), expected);
|
||||
}
|
||||
}
|
||||
|
||||
public static Reference vAppUserRole(RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context) {
|
||||
RoleReferences roles = context.getApi().getAdminQueryClient().roleReferencesQueryAll();
|
||||
for (Reference role : roles.getReferences()) {
|
||||
if (equal(role.getName(), "vApp User")) {
|
||||
return Reference.builder().fromReference(role).build();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Reference nonVAppUserRole(RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context) {
|
||||
RoleReferences roles = context.getApi().getAdminQueryClient().roleReferencesQueryAll();
|
||||
for (Reference role : roles.getReferences()) {
|
||||
if (!equal(role.getName(), "vApp User")) {
|
||||
return Reference.builder().fromReference(role).build();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static User randomTestUser(String prefix, RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context) {
|
||||
return randomTestUser(prefix, vAppUserRole(context));
|
||||
}
|
||||
|
||||
public static User randomTestUser(String prefix, Reference role) {
|
||||
return User.builder()
|
||||
.name(name(prefix)+random.nextInt(999999))
|
||||
.fullName("testFullName")
|
||||
.emailAddress("test@test.com")
|
||||
.telephone("555-1234")
|
||||
.isEnabled(false)
|
||||
.im("testIM")
|
||||
.isAlertEnabled(false)
|
||||
.alertEmailPrefix("testPrefix")
|
||||
.alertEmail("testAlert@test.com")
|
||||
.isExternal(false)
|
||||
.isGroupRole(false)
|
||||
.role(role)
|
||||
.password("password")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
return clonedVappTemplate;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "GET /vAppTemplate/{id}")
|
||||
public void testGetVAppTemplate() {
|
||||
vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(vAppTemplate.getHref(), vAppTemplateURI);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "GET /vAppTemplate/{id}/owner")
|
||||
public void testGetVAppTemplateOwner() {
|
||||
Owner owner = vAppTemplateClient.getOwnerOfVAppTemplate(vAppTemplateURI);
|
||||
|
||||
|
@ -108,21 +108,21 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(owner.getUser(), vAppTemplateClient.getVAppTemplate(vAppTemplateURI).getOwner().getUser());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "GET /vAppTemplate/{id}/customizationSection")
|
||||
public void testGetCustomizationSection() {
|
||||
CustomizationSection customizationSection = vAppTemplateClient.getVAppTemplateCustomizationSection(vAppTemplateURI);
|
||||
|
||||
checkCustomizationSection(customizationSection);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "GET /vAppTemplate/{id}/productSections")
|
||||
public void testGetProductSections() {
|
||||
ProductSectionList productSectionList = vAppTemplateClient.getProductSectionsForVAppTemplate(vAppTemplateURI);
|
||||
|
||||
checkProductSectionList(productSectionList);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "PUT /vAppTemplate/{id}/productSections")
|
||||
public void testEditProductSections() {
|
||||
// TODO make a real modification
|
||||
|
||||
|
@ -146,7 +146,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "GET /vAppTemplate/{id}/leaseSettingsSection")
|
||||
public void testGetLeaseSettingsSection() {
|
||||
// FIXME Wrong case for Vapp
|
||||
LeaseSettingsSection leaseSettingsSection = vAppTemplateClient.getVappTemplateLeaseSettingsSection(vAppTemplateURI);
|
||||
|
@ -154,14 +154,15 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
checkLeaseSettingsSection(leaseSettingsSection);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "GET /vAppTemplate/{id}/metadata")
|
||||
public void testGetVAppTemplateMetadata() {
|
||||
Metadata metadata = vAppTemplateClient.getMetadataClient().getMetadata(vAppTemplateURI);
|
||||
|
||||
checkMetadata(metadata);
|
||||
}
|
||||
|
||||
@Test // implicitly tested by testEditVAppTemplateMetadataValue, which first creates the metadata entry; otherwise no entry may exist
|
||||
// implicitly tested by testEditVAppTemplateMetadataValue, which first creates the metadata entry; otherwise no entry may exist
|
||||
@Test(testName = "GET /vAppTemplate/{id}/metadata/{key}")
|
||||
public void testGetMetadataValue() {
|
||||
Metadata metadata = vAppTemplateClient.getMetadataClient().getMetadata(vAppTemplateURI);
|
||||
MetadataEntry entry = Iterables.get(metadata.getMetadataEntries(), 0);
|
||||
|
@ -172,7 +173,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(val.getValue(), entry.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "GET /vAppTemplate/{id}/networkConfigSection")
|
||||
public void testGetVAppTemplateNetworkConfigSection() {
|
||||
NetworkConfigSection networkConfigSection = vAppTemplateClient.getVAppTemplateNetworkConfigSection(vAppTemplateURI);
|
||||
|
||||
|
@ -189,21 +190,21 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "GET /vAppTemplate/{id}/networkSection")
|
||||
public void testGetVAppTemplateNetworkSection() {
|
||||
NetworkSection networkSection = vAppTemplateClient.getVAppTemplateNetworkSection(vAppTemplateURI);
|
||||
|
||||
checkOvfNetworkSection(networkSection);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "GET /vAppTemplate/{id}/ovf")
|
||||
public void testGetVAppTemplateOvf() {
|
||||
Envelope envelope = vAppTemplateClient.getVAppTemplateOvf(vAppTemplateURI);
|
||||
|
||||
checkOvfEnvelope(envelope);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "PUT /vAppTemplate/{id}")
|
||||
public void testEditVAppTemplate() {
|
||||
String name = name("myname-");
|
||||
String description = name("Description ");
|
||||
|
@ -220,7 +221,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(newTemplate.getDescription(), description);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "POST /vAppTemplate/{id}/metadata")
|
||||
public void testEditMetadata() {
|
||||
// TODO Cleanup after ourselves..
|
||||
|
||||
|
@ -243,7 +244,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
checkMetadataFor("vAppTemplate", newMetadata, expectedMetadataMap);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "PUT /vAppTemplate/{id}/metadata/{key}")
|
||||
public void testEditMetadataValue() {
|
||||
// TODO Cleanup after ourselves..
|
||||
|
||||
|
@ -258,7 +259,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(newMetadataValue.getValue(), metadataValue.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "DELETE /vAppTemplate/{id}/metadata/{key}")
|
||||
public void testDeleteVAppTemplateMetadataValue() {
|
||||
// First store a value
|
||||
String key = name("key-");
|
||||
|
@ -275,7 +276,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
checkMetadataKeyAbsentFor("vAppTemplate", newMetadata, key);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "PUT /vAppTemplate/{id}/guestCustomizationSection")
|
||||
public void testEditGuestCustomizationSection() {
|
||||
String computerName = name("server-");
|
||||
GuestCustomizationSection newSection = GuestCustomizationSection.builder()
|
||||
|
@ -292,7 +293,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(modified.getComputerName(), computerName);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "PUT /vAppTemplate/{id}/customizationSection")
|
||||
public void testEditCustomizationSection() {
|
||||
boolean oldVal = vAppTemplateClient.getVAppTemplateCustomizationSection(vAppTemplateURI).isCustomizeOnInstantiate();
|
||||
boolean newVal = !oldVal;
|
||||
|
@ -310,7 +311,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
}
|
||||
|
||||
// FIXME deploymentLeaseInSeconds returned is null
|
||||
@Test
|
||||
@Test(testName = "PUT /vAppTemplate/{id}/leaseSettingsSection")
|
||||
public void testEditLeaseSettingsSection() throws Exception {
|
||||
int deploymentLeaseInSeconds = random.nextInt(10000)+1;
|
||||
|
||||
|
@ -330,7 +331,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertEquals(newLeaseSettingsSection.getDeploymentLeaseInSeconds(), (Integer)deploymentLeaseInSeconds);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "PUT /vAppTemplate/{id}/networkConfigSection")
|
||||
public void testEditNetworkConfigSection() {
|
||||
// TODO What to modify?
|
||||
|
||||
|
@ -363,7 +364,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
// assertEquals(newVAppNetworkConfig.getNetworkName(), networkName);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "PUT /vAppTemplate/{id}/networkConnectionSection")
|
||||
public void testEditNetworkConnectionSection() {
|
||||
// TODO Modify a field so can assert that the change really took effect
|
||||
|
||||
|
@ -378,7 +379,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
checkNetworkConnectionSection(modified);
|
||||
}
|
||||
|
||||
@Test // FIXME cloneVAppTemplate is giving back 500 error
|
||||
@Test(testName = "DELETE /vAppTemplate/{id}") // FIXME cloneVAppTemplate is giving back 500 error
|
||||
public void testDeleteVAppTemplate() throws Exception {
|
||||
VAppTemplate clonedVappTemplate = cloneVAppTemplate(true);
|
||||
|
||||
|
@ -398,7 +399,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "POST /vAppTemplate/{id}/action/disableDownload")
|
||||
public void testDisableVAppTemplateDownload() throws Exception {
|
||||
vAppTemplateClient.disableDownloadVappTemplate(vAppTemplateURI);
|
||||
|
||||
|
@ -412,7 +413,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
// assertFalse(hasLinkMatchingRel(links, "download.*"), "Should not offer download link after disabling download: "+vAppTemplate);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "POST /vAppTemplate/{id}/action/enableDownload")
|
||||
public void testEnableVAppTemplateDownload() throws Exception {
|
||||
// First disable so that enable really has some work to do...
|
||||
vAppTemplateClient.disableDownloadVappTemplate(vAppTemplateURI);
|
||||
|
@ -439,7 +440,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(testName = "POST /vAppTemplate/{id}/action/consolidate")
|
||||
public void testConsolidateVAppTemplate() throws Exception {
|
||||
// TODO Need assertion that command had effect
|
||||
|
||||
|
@ -448,7 +449,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
assertTaskSucceedsLong(task);
|
||||
}
|
||||
|
||||
@Test // FIXME Need a datastore reference
|
||||
@Test(testName = "POST /vAppTemplate/{id}/action/relocate") // FIXME Need a datastore reference
|
||||
public void testRelocateVAppTemplate() throws Exception {
|
||||
// TODO Need assertion that command had effect
|
||||
Reference dataStore = null; // FIXME
|
||||
|
@ -462,7 +463,7 @@ public class VAppTemplateClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
|
||||
// This failed previously, but is passing now.
|
||||
// However, it's not part of the official API so not necessary to assert it.
|
||||
@Test
|
||||
@Test(testName = "test completed task not included in vAppTemplate")
|
||||
public void testCompletedTaskNotIncludedInVAppTemplate() throws Exception {
|
||||
// Kick off a task, and wait for it to complete
|
||||
vAppTemplateClient.disableDownloadVappTemplate(vAppTemplateURI);
|
||||
|
|
|
@ -307,13 +307,13 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = { "testGetVdc" } )
|
||||
@Test(testName = "vdcClient admin metadata configuration", dependsOnMethods = { "testGetVdc" } )
|
||||
public void testSetupMetadata() {
|
||||
context.getApi().getAdminVdcClient().getMetadataClient().setMetadata(toAdminUri(vdcURI),
|
||||
"key", MetadataValue.builder().value("value").build());
|
||||
}
|
||||
|
||||
@Test(testName = "GET /network/{id}/metadata", dependsOnMethods = { "testSetupMetadata" } )
|
||||
@Test(testName = "GET /vdc/{id}/metadata", dependsOnMethods = { "testSetupMetadata" } )
|
||||
public void testGetMetadata() {
|
||||
Metadata metadata = vdcClient.getMetadataClient().getMetadata(vdcURI);
|
||||
|
||||
|
@ -324,7 +324,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
Checks.checkMetadataFor(VDC, metadata);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /network/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" } )
|
||||
@Test(testName = "GET /vdc/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" } )
|
||||
public void testGetMetadataValue() {
|
||||
// First find a key
|
||||
Metadata metadata = vdcClient.getMetadataClient().getMetadata(vdcURI);
|
||||
|
|
Loading…
Reference in New Issue