You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/11/17 17:21:14 UTC

[07/32] jclouds-labs git commit: JCLOUDS-780 Remove vcloud-director.

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java
deleted file mode 100644
index c4f2425..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java
+++ /dev/null
@@ -1,947 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.features;
-
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CORRECT_VALUE_OBJECT_FMT;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_EQUAL;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.TASK_COMPLETE_TIMELY;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.MEDIA;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkGuestCustomizationSection;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadata;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataFor;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataKeyAbsentFor;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkConnectionSection;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOperatingSystemSection;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkProductSectionList;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRasdItemsList;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkResourceAllocationSettingData;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRuntimeInfoSection;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkScreenTicket;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVirtualHardwareSection;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVm;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVmPendingQuestion;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertSame;
-import static org.testng.Assert.assertTrue;
-
-import java.math.BigInteger;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.dmtf.cim.OSType;
-import org.jclouds.dmtf.cim.ResourceAllocationSettingData;
-import org.jclouds.dmtf.ovf.MsgType;
-import org.jclouds.dmtf.ovf.ProductSection;
-import org.jclouds.vcloud.director.v1_5.AbstractVAppApiLiveTest;
-import org.jclouds.vcloud.director.v1_5.domain.Checks;
-import org.jclouds.vcloud.director.v1_5.domain.Metadata;
-import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList;
-import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList;
-import org.jclouds.vcloud.director.v1_5.domain.Reference;
-import org.jclouds.vcloud.director.v1_5.domain.ResourceEntity.Status;
-import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket;
-import org.jclouds.vcloud.director.v1_5.domain.Task;
-import org.jclouds.vcloud.director.v1_5.domain.VApp;
-import org.jclouds.vcloud.director.v1_5.domain.Vm;
-import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
-import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
-import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswerChoice;
-import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem;
-import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection;
-import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection.IpAddressAllocationMode;
-import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams;
-import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams;
-import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
-import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-@Test(groups = { "live", "user" }, singleThreaded = true, testName = "VmApiLiveTest")
-public class VmApiLiveTest extends AbstractVAppApiLiveTest {
-
-   private String metadataValue;
-   private String key;
-   private boolean testUserCreated = false;
-
-   @BeforeClass(alwaysRun = true)
-   protected void setupRequiredEntities() {
-
-      if (adminContext != null) {
-         userId = adminContext.getApi().getUserApi().addUserToOrg(randomTestUser("VAppAccessTest"), org.getHref())
-                  .getId();
-      }
-   }
-
-   @AfterClass(alwaysRun = true, dependsOnMethods = { "cleanUpEnvironment" })
-   public void cleanUp() {
-      if (adminContext != null && testUserCreated && userId != null) {
-         try {
-            adminContext.getApi().getUserApi().remove(context.resolveIdToAdminHref(userId));
-         } catch (Exception e) {
-            logger.warn("Error when deleting user: %s", e.getMessage());
-         }
-      }
-   }
-
-   /**
-    * @see VmApi#get(String)
-    */
-   @Test(description = "GET /vApp/{id}")
-   public void testGetVm() {
-      // The method under test
-      vm = vmApi.get(context.resolveIdToHref(vmId));
-
-      // 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()));
-      String vAppNetworkName = context.getApi().getNetworkApi().get(context.resolveIdToHref(networkId)).getName();
-      attachVmToVAppNetwork(vm, vAppNetworkName);
-
-      // Check status
-      assertVmStatus(vm.getHref(), Status.POWERED_OFF);
-   }
-
-   /**
-    * @see VmApi#edit(String, Vm)
-    */
-   @Test(description = "PUT /vApp/{id}", dependsOnMethods = { "testGetVm" })
-   public void testEditVm() {
-      Vm newVm = Vm.builder().name(name("new-name-")).description("New Description").build();
-
-      // The method under test
-      Task editVm = vmApi.edit(vm.getHref(), newVm);
-      assertTrue(retryTaskSuccess.apply(editVm), String.format(TASK_COMPLETE_TIMELY, "editVm"));
-
-      // 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()));
-   }
-
-   @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();
-
-      // The method under test
-      Task deployVm = vmApi.deploy(vm.getHref(), params);
-      assertTrue(retryTaskSuccessLong.apply(deployVm), String.format(TASK_COMPLETE_TIMELY, "deployVm"));
-
-      // 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()));
-
-      // Check status
-      assertVmStatus(vm.getHref(), Status.POWERED_OFF);
-   }
-
-   @Test(description = "POST /vApp/{id}/power/action/powerOn", dependsOnMethods = { "testDeployVm" })
-   public void testPowerOnVm() {
-      // Power off Vm
-      vm = powerOffVm(vm.getHref());
-
-      // The method under test
-      Task powerOnVm = vmApi.powerOn(vm.getHref());
-      assertTaskSucceedsLong(powerOnVm);
-
-      // Get the edited Vm
-      vm = vmApi.get(vm.getHref());
-
-      // Check status
-      assertVmStatus(vm.getHref(), Status.POWERED_ON);
-   }
-
-   @Test(description = "POST /vApp/{id}/power/action/reboot", dependsOnMethods = { "testDeployVm" })
-   public void testReboot() {
-      // Power on Vm
-      vm = powerOnVm(vm.getHref());
-
-      // The method under test
-      Task reboot = vmApi.reboot(vm.getHref());
-       assertTaskSucceedsLong(reboot);
-
-      // Get the edited Vm
-      vm = vmApi.get(vm.getHref());
-
-      // Check status
-      assertVmStatus(vm.getHref(), Status.POWERED_OFF);
-   }
-
-   @Test(description = "POST /vApp/{id}/power/action/shutdown", dependsOnMethods = { "testInstallVMwareTools" })
-   public void testShutdown() {
-      // Power on Vm
-      vm = powerOnVm(vm.getHref());
-      
-      // The method under test
-      Task shutdown = vmApi.shutdown(vm.getHref());
-      assertTaskSucceedsLong(shutdown);
-
-      // Get the edited Vm
-      vm = vmApi.get(vm.getHref());
-
-      // Check status
-      assertVmStatus(vm.getHref(), Status.POWERED_OFF);
-   }
-
-   @Test(description = "POST /vApp/{id}/power/action/suspend", dependsOnMethods = { "testDeployVm" })
-   public void testSuspend() {
-      // Power on Vm
-      vm = powerOnVm(vm.getHref());
-
-      // The method under test
-      Task suspend = vmApi.suspend(vm.getHref());
-      assertTaskSucceedsLong(suspend);
-
-      // Get the edited Vm
-      vm = vmApi.get(vm.getHref());
-
-      // Check status
-      assertVmStatus(vm.getHref(), Status.SUSPENDED);
-
-      // Power on the Vm again
-      vm = powerOnVm(vm.getHref());
-   }
-
-   @Test(description = "POST /vApp/{id}/power/action/reset", dependsOnMethods = { "testDeployVm" })
-   public void testReset() {
-      // Power on Vm
-      vm = powerOnVm(vm.getHref());
-
-      // The method under test
-      Task reset = vmApi.reset(vm.getHref());
-      assertTaskSucceedsLong(reset);
-
-      // Get the edited Vm
-      vm = vmApi.get(vm.getHref());
-
-      // Check status
-      assertVmStatus(vm.getHref(), Status.POWERED_ON);
-   }
-
-   @Test(description = "POST /vApp/{id}/action/undeploy", dependsOnMethods = { "testDeployVm" })
-   public void testUndeployVm() {
-      // Power on Vm
-      vm = powerOnVm(vm.getHref());
-
-      UndeployVAppParams params = UndeployVAppParams.builder().build();
-
-      // The method under test
-      Task undeploy = vmApi.undeploy(vm.getHref(), params);
-      assertTrue(retryTaskSuccess.apply(undeploy), String.format(TASK_COMPLETE_TIMELY, "undeploy"));
-
-      // 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()));
-      assertVmStatus(vm.getHref(), Status.POWERED_OFF);
-   }
-
-   @Test(description = "POST /vApp/{id}/power/action/powerOff", dependsOnMethods = { "testUndeployVm" })
-   public void testPowerOffVm() {
-      // Power on Vm
-      vm = powerOnVm(vm.getHref());
-      
-      // The method under test
-      // NB this will put the vm in partially powered off state
-      Task powerOffVm = vmApi.powerOff(vm.getHref());
-      assertTrue(retryTaskSuccess.apply(powerOffVm), String.format(TASK_COMPLETE_TIMELY, "powerOffVm"));
-
-      // Get the edited Vm
-      vm = vmApi.get(vm.getHref());
-
-      // Check status
-      assertVmStatus(vm.getHref(), Status.POWERED_OFF);
-   }
-
-   @Test(description = "POST /vApp/{id}/action/discardSuspendedState", dependsOnMethods = { "testDeployVm" })
-   public void testDiscardSuspendedState() {
-      // Suspend the Vm
-      vm = suspendVm(vm.getHref());
-
-      // The method under test
-      Task discardSuspendedState = vmApi.discardSuspendedState(vm.getHref());
-      assertTrue(retryTaskSuccess.apply(discardSuspendedState),
-               String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
-   }
-
-   @Test(description = "POST /vApp/{id}/action/installVMwareTools", dependsOnMethods = { "testDeployVm" })
-   public void testInstallVMwareTools() {
-      // First ensure the vApp is powered on
-      vm = powerOnVm(vm.getHref());
-
-      // The method under test
-      Task installVMwareTools = vmApi.installVMwareTools(vm.getHref());
-      assertTrue(retryTaskSuccess.apply(installVMwareTools), String.format(TASK_COMPLETE_TIMELY, "installVMwareTools"));
-   }
-
-   @Test(description = "POST /vApp/{id}/action/upgradeHardwareVersion", dependsOnMethods = { "testGetVm" })
-   public void testUpgradeHardwareVersion() {
-      // Power off Vm
-      vm = powerOffVm(vm.getHref());
-
-      // The method under test
-      Task upgradeHardwareVersion = vmApi.upgradeHardwareVersion(vm.getHref());
-      assertTrue(retryTaskSuccess.apply(upgradeHardwareVersion),
-               String.format(TASK_COMPLETE_TIMELY, "upgradeHardwareVersion"));
-
-      // Power on the Vm again
-      vm = powerOnVm(vm.getHref());
-   }
-
-   @Test(description = "GET /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetVm" })
-   public void testGetGuestCustomizationSection() {
-      getGuestCustomizationSection(new Function<URI, GuestCustomizationSection>() {
-         @Override
-         public GuestCustomizationSection apply(URI uri) {
-            return vmApi.getGuestCustomizationSection(uri);
-         }
-      });
-   }
-
-   @Test(description = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" })
-   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)
-               .adminPassword(null) // Not allowed
-               .build();
-
-      // The method under test
-      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());
-
-      // Check the retrieved object is well formed
-      checkGuestCustomizationSection(modified);
-
-      // Check the modified section fields are set correctly
-      assertEquals(modified.getComputerName(), newSection.getComputerName());
-      assertTrue(modified.isEnabled());
-
-      // Reset the admin password in the retrieved GuestCustomizationSection for equality check
-      modified = modified.toBuilder().adminPassword(null).build();
-
-      // Check the section was modified correctly
-      assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "GuestCustomizationSection"));
-   }
-
-	@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(lazyGetMedia().getHref())
-						.type(MEDIA).build()).build();
-
-		// The method under test
-		Task insertMediaTask = vmApi.insertMedia(vm.getHref(), params);
-		assertTrue(retryTaskSuccess.apply(insertMediaTask),
-				String.format(TASK_COMPLETE_TIMELY, "insertMedia"));
-	}
-
-   @Test(description = "PUT /vApp/{id}/media/action/ejectMedia", dependsOnMethods = { "testInsertMedia" })
-   public void testEjectMedia() {
-	   
-      // Setup media params from configured media id
-      MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
-               .media(Reference.builder()
-            		   .href(lazyGetMedia().getHref()).type(MEDIA).build()).build();
-
-      // The method under test
-      Task ejectMedia = vmApi.ejectMedia(vm.getHref(), params);
-      assertTrue(retryTaskSuccess.apply(ejectMedia), String.format(TASK_COMPLETE_TIMELY, "ejectMedia"));
-   }
-
-   @Test(description = "GET /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetVm" })
-   public void testGetNetworkConnectionSection() {
-      getNetworkConnectionSection(new Function<URI, NetworkConnectionSection>() {
-         @Override
-         public NetworkConnectionSection apply(URI uri) {
-            return vmApi.getNetworkConnectionSection(uri);
-         }
-      });
-   }
-
-   @Test(description = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testEditGuestCustomizationSection" })
-	public void testEditNetworkConnectionSection() {
-
-		// Look up a network in the Vdc
-		Set<Reference> networks = vdc.getAvailableNetworks();
-		Reference network = Iterables.getLast(networks);
-
-		// Copy existing section and edit fields
-		NetworkConnectionSection oldSection = vmApi
-				.getNetworkConnectionSection(vm.getHref());
-		NetworkConnection newNetworkConnection = NetworkConnection.builder()
-				.network(network.getName()).networkConnectionIndex(1)
-				.ipAddressAllocationMode(IpAddressAllocationMode.DHCP).build();
-		NetworkConnectionSection newSection = oldSection.toBuilder()
-				.networkConnection(newNetworkConnection).build();
-
-		// The method under test
-		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());
-
-		// Check the retrieved object is well formed
-		checkNetworkConnectionSection(modified);
-
-		// Check the section was modified correctly
-		for (NetworkConnection connection : modified.getNetworkConnections()) {
-			if (connection.getNetwork().equals(
-					newNetworkConnection.getNetwork())) {
-				assertEquals(connection.getIpAddressAllocationMode(),
-						newNetworkConnection.getIpAddressAllocationMode());
-				assertSame(connection.getNetworkConnectionIndex(), newNetworkConnection
-						.getNetworkConnectionIndex());
-			}
-		}
-	}
-
-   @Test(description = "GET /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetVm" })
-   public void testGetOperatingSystemSection() {
-      // The method under test
-      OperatingSystemSection section = vmApi.getOperatingSystemSection(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkOperatingSystemSection(section);
-   }
-
-   @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();
-
-      // The method under test
-      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());
-
-      // Check the retrieved object is well formed
-      checkOperatingSystemSection(modified);
-
-      // Check the modified section fields are set correctly
-      assertEquals(modified.getHref(), newSection.getHref());
-   }
-
-   @Test(description = "GET /vApp/{id}/productSections", dependsOnMethods = { "testGetVm" })
-   public void testGetProductSections() {
-      // The method under test
-      ProductSectionList sectionList = vmApi.getProductSections(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkProductSectionList(sectionList);
-   }
-
-   @Test(description = "PUT /vApp/{id}/productSections", dependsOnMethods = { "testGetProductSections" })
-   public void testEditProductSections() {
-      powerOffVm(vm.getHref());
-      // 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())
-                                 .vendor(MsgType.builder().value("jclouds Inc.").build())
-                                 // NOTE other ProductSection elements not returned by vCloud
-                                 .build()).build();
-
-      // The method under test
-      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());
-
-      // Check the retrieved object is well formed
-      checkProductSectionList(modified);
-
-      // Check the modified object has an extra ProductSection
-      assertEquals(modified.getProductSections().size(), oldSections.getProductSections().size() + 1);
-
-      // Check the section was modified correctly
-      assertEquals(modified, newSections);
-   }
-
-   // FIXME How do we force it to ask a question?
-   @Test(description = "GET /vApp/{id}/question", dependsOnMethods = { "testDeployVm" })
-   public void testGetPendingQuestion() {
-      // Power on Vm
-      vm = powerOnVm(vm.getHref());
-
-      // TODO how to test?
-
-      // The method under test
-      VmPendingQuestion question = vmApi.getPendingQuestion(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkVmPendingQuestion(question);
-   }
-
-   @Test(description = "POST /vApp/{id}/question/action/answer", dependsOnMethods = { "testGetPendingQuestion" })
-   public void testAnswerQuestion() {
-      // TODO check that the question has been answered (e.g. asking for getPendingQuestion does not
-      // include our answered question).
-
-      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");
-
-      VmQuestionAnswer answer = VmQuestionAnswer.builder().choiceId(answerChoice.getId())
-               .questionId(question.getQuestionId()).build();
-
-      vmApi.answerQuestion(vm.getHref(), answer);
-   }
-
-   @Test(description = "GET /vApp/{id}/runtimeInfoSection", dependsOnMethods = { "testGetVm" })
-   public void testGetRuntimeInfoSection() {
-      // The method under test
-      RuntimeInfoSection section = vmApi.getRuntimeInfoSection(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkRuntimeInfoSection(section);
-   }
-
-   @Test(description = "GET /vApp/{id}/screen", dependsOnMethods = { "testInstallVMwareTools" })
-   public void testGetScreenImage() {
-      // Power on Vm
-      vm = powerOnVm(vm.getHref()); // we need to have a way to wait for complete bootstrap
-
-      // The method under test
-      byte[] image = vmApi.getScreenImage(vm.getHref());
-
-      // Check returned bytes against PNG header magic number
-      byte[] pngHeaderBytes = new byte[] { (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
-      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));
-      }
-   }
-
-   @Test(description = "POST /vApp/{id}/screen/action/acquireTicket", dependsOnMethods = { "testDeployVm" })
-   public void testGetScreenTicket() {
-      // Power on Vm
-      vm = powerOnVm(vm.getHref());
-
-      // The method under test
-      ScreenTicket ticket = vmApi.getScreenTicket(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkScreenTicket(ticket);
-   }
-
-   @Test(description = "GET /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVm" })
-   public void testGetVirtualHardwareSection() {
-      // Method under test
-      VirtualHardwareSection hardware = vmApi.getVirtualHardwareSection(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkVirtualHardwareSection(hardware);
-   }
-
-   @Test(description = "PUT /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVirtualHardwareSection" })
-   public void testEditVirtualHardwareSection() {
-      // Power off Vm
-      vm = powerOffVm(vm.getHref());
-
-      // 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>() {
-                  @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();
-      newItems.remove(oldMemory);
-      newItems.add(newMemory);
-      VirtualHardwareSection newSection = oldSection.toBuilder().items(newItems).build();
-
-      // The method under test
-      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());
-
-      // Check the retrieved object is well formed
-      checkVirtualHardwareSection(modifiedSection);
-
-      // Check the modified section fields are set correctly
-      ResourceAllocationSettingData modifiedMemory = Iterables.find(modifiedSection.getItems(),
-               new Predicate<ResourceAllocationSettingData>() {
-                  @Override
-                  public boolean apply(ResourceAllocationSettingData rasd) {
-                     return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
-                  }
-               });
-      assertEquals(modifiedMemory.getVirtualQuantity(), new BigInteger("1024"));
-      assertEquals(modifiedMemory, newMemory);
-      assertEquals(modifiedSection, newSection);
-   }
-
-   @Test(description = "GET /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSection" })
-   public void testGetVirtualHardwareSectionCpu() {
-      // Method under test
-      RasdItem rasd = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkResourceAllocationSettingData(rasd);
-   }
-
-   @Test(description = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" })
-   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"))
-               .build();
-
-      // Method under test
-      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());
-
-      // Check the retrieved object
-      checkResourceAllocationSettingData(modified);
-
-      // Check modified item
-      assertEquals(modified.getVirtualQuantity(), new BigInteger("2"), String.format(OBJ_FIELD_EQ,
-               "ResourceAllocationSettingData", "VirtualQuantity", "2", modified.getVirtualQuantity().toString()));
-      assertEquals(modified, newItem);
-   }
-
-   @Test(description = "GET /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSection" })
-   public void testGetVirtualHardwareSectionDisks() {
-      // Method under test
-      RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionDisks(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkRasdItemsList(rasdItems);
-   }
-
-   @Test(description = "PUT /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSectionDisks" })
-   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 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());
-
-      // Check the retrieved object is well formed
-      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-edit.
-      //
-      // 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);
-      // newItems.set(0, item0.toBuilder().elementName(newCimString(item0ElementName)).build());
-      // RasdItemsList newSection = oldSection.toBuilder()
-      // .items(newItems)
-      // .build();
-      // ...
-      // long weight = random.nextInt(Integer.MAX_VALUE);
-      // ResourceAllocationSettingData newSection = origSection.toBuilder()
-      // .weight(newCimUnsignedInt(weight))
-      // .build();
-      // ...
-      // checkHasMatchingItem("virtualHardwareSection/disk", modified, item0InstanceId,
-      // item0ElementName);
-   }
-
-   @Test(description = "GET /vApp/{id}/virtualHardwareSection/media", dependsOnMethods = { "testGetVirtualHardwareSection" })
-   public void testGetVirtualHardwareSectionMedia() {
-      // Method under test
-      RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionMedia(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkRasdItemsList(rasdItems);
-   }
-
-   @Test(description = "GET /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSection" })
-   public void testGetVirtualHardwareSectionMemory() {
-      // Method under test
-      RasdItem rasd = vmApi.getVirtualHardwareSectionCpu(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkResourceAllocationSettingData(rasd);
-   }
-
-   @Test(description = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" })
-   public void testEditVirtualHardwareSectionMemory() {
-      RasdItem origItem = vmApi.getVirtualHardwareSectionMemory(vm.getHref());
-      RasdItem newItem = origItem.toBuilder().elementName("1024 MB of memory").virtualQuantity(new BigInteger("1024"))
-               .build();
-
-      // Method under test
-      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());
-
-      // Check the retrieved object
-      checkResourceAllocationSettingData(modified);
-
-      // Check modified item
-      assertEquals(modified.getVirtualQuantity(), new BigInteger("1024"), String.format(OBJ_FIELD_EQ,
-               "ResourceAllocationSettingData", "VirtualQuantity", "1024", modified.getVirtualQuantity().toString()));
-      assertEquals(modified, newItem);
-   }
-
-   @Test(description = "GET /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSection" })
-   public void testGetVirtualHardwareSectionNetworkCards() {
-      // Method under test
-      RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkRasdItemsList(rasdItems);
-   }
-
-   @Test(description = "PUT /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSectionNetworkCards" })
-   public void testEditVirtualHardwareSectionNetworkCards() {
-      RasdItemsList oldSection = vmApi.getVirtualHardwareSectionNetworkCards(vm.getHref());
-      RasdItemsList newSection = oldSection.toBuilder().build();
-
-      // Method under test
-      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());
-
-      // Check the retrieved object is well formed
-      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-edit.
-      // See the description in testEditVirtualHardwareSectionDisks
-   }
-
-   @Test(description = "GET /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSection" })
-   public void testGetVirtualHardwareSectionSerialPorts() {
-      // Method under test
-      RasdItemsList rasdItems = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
-
-      // Check the retrieved object is well formed
-      checkRasdItemsList(rasdItems);
-   }
-
-   @Test(description = "PUT /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSectionSerialPorts" })
-   public void testEditVirtualHardwareSectionSerialPorts() {
-      RasdItemsList oldSection = vmApi.getVirtualHardwareSectionSerialPorts(vm.getHref());
-      RasdItemsList newSection = oldSection.toBuilder().build();
-
-      // Method under test
-      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());
-
-      // Check the retrieved object is well formed
-      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-edit.
-      // See the description in testEditVirtualHardwareSectionDisks
-   }
-
-   @Test(description = "PUT /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetVm" })
-   public void testSetMetadataValue() {
-      key = name("key-");
-      metadataValue = name("value-");
-      //TODO: block!!
-      context.getApi().getMetadataApi(vm.getHref()).put(key, metadataValue);
-
-      // Retrieve the value, and assert it was set correctly
-      String newMetadataValue = context.getApi().getMetadataApi(vm.getHref()).get(key);
-
-      // Check the retrieved object is well formed
-      assertEquals(newMetadataValue, metadataValue,
-            String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", metadataValue, newMetadataValue));
-   }
-
-	@Test(description = "GET /vApp/{id}/metadata", dependsOnMethods = { "testSetMetadataValue" })
-	public void testGetMetadata() {
-
-		key = name("key-");
-		metadataValue = name("value-");
-
-		context.getApi().getMetadataApi(vm.getHref()).put(key, metadataValue);
-		// Call the method being tested
-		Metadata metadata = context.getApi().getMetadataApi(vm.getHref()).get();
-
-		checkMetadata(metadata);
-		
-		// Check requirements for this test
-		assertTrue(metadata.containsValue(metadataValue), String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", metadata.get(key), metadataValue));
-	}
-
-   @Test(description = "GET /vApp/{id}/metadata/{key}", dependsOnMethods = { "testGetMetadata" })
-   public void testGetOrgMetadataValue() {
-      key = name("key-");
-      metadataValue = name("value-");
-
-      //TODO: block!!
-      context.getApi().getMetadataApi(vm.getHref()).put(key, metadataValue);
-
-      // Call the method being tested
-      String newMetadataValue = context.getApi().getMetadataApi(vm.getHref()).get(key);
-      
-      assertEquals(newMetadataValue, metadataValue,
-            String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", metadataValue, newMetadataValue));
-   }
-
-   @Test(description = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetMetadataValue" })
-   public void testRemoveMetadataEntry() {
-      // Delete the entry
-      Task task = context.getApi().getMetadataApi(vm.getHref()).remove(key);
-      retryTaskSuccess.apply(task);
-
-      // Confirm the entry has been removed
-      Metadata newMetadata = context.getApi().getMetadataApi(vm.getHref()).get();
-
-      // Check the retrieved object is well formed
-      checkMetadataKeyAbsentFor(VM, newMetadata, key);
-   }
-
-   @Test(description = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
-   public void testMergeMetadata() {
-      Metadata oldMetadata = context.getApi().getMetadataApi(vm.getHref()).get();
-      Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
-
-      // Store a value, to be removed
-      String key = name("key-");
-      String value = name("value-");
-      Task task = context.getApi().getMetadataApi(vm.getHref()).putAll(ImmutableMap.of(key, value));
-      retryTaskSuccess.apply(task);
-
-      // Confirm the entry contains everything that was there, and everything that was being added
-      Metadata newMetadata = context.getApi().getMetadataApi(vm.getHref()).get();
-      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);
-   }
-
-   @Test(description = "DELETE /vApp/{id}")
-   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(remove.getHref(), params);
-      assertTaskSucceedsLong(deployVApp);
-
-      // Get the edited VApp and the Vm
-      remove = vAppApi.get(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) {
-         UndeployVAppParams undeployParams = UndeployVAppParams.builder().build();
-         Task shutdownVapp = vAppApi.undeploy(remove.getHref(), undeployParams);
-         assertTaskSucceedsLong(shutdownVapp);
-      } else {
-         powerOffVm(temp.getHref());
-      }
-      // The method under test
-      Task removeVm = vmApi.remove(temp.getHref());
-      assertTrue(retryTaskSuccess.apply(removeVm), String.format(TASK_COMPLETE_TIMELY, "removeVm"));
-
-      Vm removed = vmApi.get(temp.getHref());
-      assertNull(removed, "The Vm " + temp.getName() + " should have been removed");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiExpectTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiExpectTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiExpectTest.java
deleted file mode 100644
index ad64c64..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiExpectTest.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.features.admin;
-
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ADMIN_CATALOG;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OWNER;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS;
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
-import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
-import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
-import org.jclouds.vcloud.director.v1_5.domain.Link;
-import org.jclouds.vcloud.director.v1_5.domain.Owner;
-import org.jclouds.vcloud.director.v1_5.domain.Reference;
-import org.jclouds.vcloud.director.v1_5.domain.Task;
-import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams;
-import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.net.HttpHeaders;
-
-@Test(groups = { "unit", "admin" }, singleThreaded = true, testName = "AdminCatalogApiExpectTest")
-public class AdminCatalogApiExpectTest extends VCloudDirectorAdminApiExpectTest {
-   
-   static String catalog = "7212e451-76e1-4631-b2de-ba1dfd8080e4";
-   static URI catalogAdminHref = URI.create(endpoint + "/admin/catalog/" + catalog);
-
-   HttpRequest get = HttpRequest.builder()
-            .method("GET")
-            .endpoint(catalogAdminHref)
-            .addHeader("Accept", "*/*")
-            .addHeader("x-vcloud-authorization", token)
-            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
-            .build();
-
-    HttpResponse getResponse = HttpResponse.builder()
-            .statusCode(200)
-            .payload(payloadFromResourceWithContentType("/catalog/admin/catalog.xml", ADMIN_CATALOG + ";version=1.5"))
-            .build();
-    
-   @Test
-   public void testGetCatalogHref() {
-      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, get, getResponse);
-      assertEquals(api.getCatalogApi().get(catalogAdminHref), catalog());
-   }
-
-   static String org = "7212e451-76e1-4631-b2de-asdasdasd";
-   static URI orgAdminHref = URI.create(endpoint + "/admin/org/" + org);
-   
-   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/addCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG))
-            .build();
-
-    HttpResponse addResponse = HttpResponse.builder()
-            .statusCode(200)
-            .payload(payloadFromResourceWithContentType("/catalog/admin/addCatalog.xml", ADMIN_CATALOG + ";version=1.5"))
-            .build();
-    
-   @Test
-   public void testAddCatalogHref() {
-      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, add, addResponse);
-      assertEquals(api.getCatalogApi().addCatalogToOrg(addCatalogToOrgSource(), orgAdminHref), addCatalogToOrg());
-   }
-   
-   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/editCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG))
-            .build();
-
-    HttpResponse editResponse = HttpResponse.builder()
-            .statusCode(200)
-            .payload(payloadFromResourceWithContentType("/catalog/admin/editCatalog.xml", ADMIN_CATALOG + ";version=1.5"))
-            .build();
-    
-   @Test
-   public void testEditCatalogHref() {
-      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, edit, editResponse);
-      assertEquals(api.getCatalogApi().edit(catalogAdminHref, editCatalog()), editCatalog());
-   }
-   
-   HttpRequest getOwner = HttpRequest.builder()
-            .method("GET")
-            .endpoint(catalogAdminHref + "/owner")
-            .addHeader("Accept", "*/*")
-            .addHeader("x-vcloud-authorization", token)
-            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
-            .build();
-
-    HttpResponse getOwnerResponse = HttpResponse.builder()
-            .statusCode(200)
-            .payload(payloadFromResourceWithContentType("/catalog/admin/owner.xml", OWNER + ";version=1.5"))
-            .build();
-    
-    Owner expectedGetOwner = owner().toBuilder()
-             .link(Link.builder()
-                      .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
-                      .type("application/vnd.vmware.vcloud.catalog+xml")
-                      .rel("up")
-                      .build())
-             .link(Link.builder()
-                      .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"))
-                      .type("application/vnd.vmware.vcloud.owner+xml")
-                      .rel("edit")
-                      .build())
-             .build();
-    
-   @Test
-   public void testGetCatalogOwnerHref() {
-      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, getOwner, getOwnerResponse);
-      assertEquals(api.getCatalogApi().getOwner(catalogAdminHref), expectedGetOwner);
-   }
-   
-   HttpRequest setOwner = HttpRequest.builder()
-            .method("PUT")
-            .endpoint(catalogAdminHref + "/owner")
-            .addHeader("Accept", "*/*")
-            .addHeader("x-vcloud-authorization", token)
-            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
-            .payload(payloadFromResourceWithContentType("/catalog/admin/editOwnerSource.xml", OWNER + ";version=1.5"))
-            .build();
-
-   HttpResponse setOwnerResponse = HttpResponse.builder()
-            .statusCode(204)
-            .build();
-   
-   Owner ownerToSet = Owner.builder()
-            .type("application/vnd.vmware.vcloud.owner+xml")
-            .user(Reference.builder()
-                  .type("application/vnd.vmware.admin.user+xml")
-                  .name("adk@cloudsoftcorp.com")
-                  .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9"))
-                  .build())
-            .build();
-   
-   @Test
-   public void testSetCatalogOwnerHref() {
-      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, setOwner, setOwnerResponse);
-      api.getCatalogApi().setOwner(catalogAdminHref, ownerToSet);
-   }
-
-   HttpRequest publishCatalog = HttpRequest.builder()
-            .method("POST")
-            .endpoint(catalogAdminHref + "/action/publish")
-            .addHeader("Accept", "*/*")
-            .addHeader("x-vcloud-authorization", token)
-            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
-            .payload(payloadFromResourceWithContentType("/catalog/admin/publishCatalogParams.xml", PUBLISH_CATALOG_PARAMS + ";version=1.5"))
-            .build();
-
-   HttpResponse publishCatalogResponse = HttpResponse.builder()
-            .statusCode(204)
-            .build();
-   
-   @Test
-   public void testPublishCatalogHref() {
-      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, publishCatalog,
-               publishCatalogResponse);
-      api.getCatalogApi().publish(catalogAdminHref, PublishCatalogParams.builder().isPublished(true).build());
-   }
-   
-   HttpRequest removeCatalog = HttpRequest.builder()
-            .method("DELETE")
-            .endpoint(catalogAdminHref)
-            .addHeader("Accept", "*/*")
-            .addHeader("x-vcloud-authorization", token)
-            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
-            .build();
-
-   HttpResponse removeCatalogResponse = HttpResponse.builder()
-            .statusCode(204)
-            .build();
-   
-   @Test
-   public void testRemoveCatalogHref() {
-      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, removeCatalog,
-               removeCatalogResponse);
-      api.getCatalogApi().remove(catalogAdminHref);
-   }
-
-   //TODO: tests for access control!
-   
-   public static final AdminCatalog addCatalogToOrgSource() {
-      return AdminCatalog.builder()
-         .name("Test Catalog")
-         .description("created by testCreateCatalog()")
-         .build();
-   }
-   
-   public static final AdminCatalog addCatalogToOrg() {
-      return AdminCatalog.builder()
-         .name("Test Catalog")
-         .id("urn:vcloud:catalog:c56d9159-7838-446f-bb35-9ee12dfbbef3")
-         .type("application/vnd.vmware.admin.catalog+xml")
-         .description("created by testCreateCatalog()")
-         .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"))
-         .link(Link.builder()
-            .rel("up")
-            .type("application/vnd.vmware.admin.organization+xml")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
-            .build())
-         .link(Link.builder()
-            .rel("alternate")
-            .type("application/vnd.vmware.vcloud.catalog+xml")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"))
-            .build())
-         .link(Link.builder()
-            .rel("down")
-            .type("application/vnd.vmware.vcloud.owner+xml")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/owner"))
-            .build())
-         .link(Link.builder()
-            .rel("add")
-            .type("application/vnd.vmware.vcloud.catalogItem+xml")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/catalogItems"))
-            .build())
-         .link(Link.builder()
-            .rel("edit")
-            .type("application/vnd.vmware.admin.catalog+xml")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"))
-            .build())
-         .link(Link.builder()
-            .rel("remove")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"))
-            .build())
-         .link(Link.builder()
-            .rel("down")
-            .type("application/vnd.vmware.vcloud.metadata+xml")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/metadata"))
-            .build())
-         .tasks(ImmutableSet.<Task>builder()
-            .add(Task.builder()
-               .status("running")
-               .startTime(dateService.iso8601DateParse("2012-03-11T18:43:02.429-04:00"))
-               .operationName("catalogCreateCatalog")
-               .operation("Creating Catalog Test Catalog(c56d9159-7838-446f-bb35-9ee12dfbbef3)")
-               .expiryTime(dateService.iso8601DateParse("2012-06-09T18:43:02.429-04:00"))
-               .name("task")
-               .id("urn:vcloud:task:20f556f9-9125-4090-9092-0da9f72bedf4")
-               .type("application/vnd.vmware.vcloud.task+xml")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/task/20f556f9-9125-4090-9092-0da9f72bedf4"))
-               .link(Link.builder()
-                  .rel("task:cancel")
-                  .href(URI.create("https://vcloudbeta.bluelock.com/api/task/20f556f9-9125-4090-9092-0da9f72bedf4/action/cancel"))
-                  .build())
-               .owner(Reference.builder()
-                  .type("application/vnd.vmware.vcloud.catalog+xml")
-                  .name("Test Catalog")
-                  .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"))
-                  .build())
-               .user(Reference.builder()
-                  .type("application/vnd.vmware.admin.user+xml")
-                  .name("dan@cloudsoftcorp.com")
-                  .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/ae75edd2-12de-414c-8e85-e6ea10442c08"))
-                  .build())
-               .org(Reference.builder()
-                  .type("application/vnd.vmware.vcloud.org+xml")
-                  .name("JClouds")
-                  .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
-                  .build())
-               .build())
-            .build())
-            .isPublished(false)
-         .build();
-   }
-   
-   public static final AdminCatalog catalog() {
-      return AdminCatalog.builder()
-         .name("QunyingTestCatalog")
-         .id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4")
-         .type("application/vnd.vmware.admin.catalog+xml")
-         .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
-         .link(Link.builder()
-               .rel("up")
-               .type("application/vnd.vmware.admin.organization+xml")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
-               .build())
-         .link(Link.builder()
-               .rel("alternate")
-               .type("application/vnd.vmware.vcloud.catalog+xml")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
-               .build())
-         .link(Link.builder()
-               .rel("down")
-               .type("application/vnd.vmware.vcloud.owner+xml")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"))
-               .build())
-         .link(Link.builder()
-               .rel("add")
-               .type("application/vnd.vmware.vcloud.catalogItem+xml")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"))
-               .build())
-         .link(Link.builder()
-               .rel("edit")
-               .type("application/vnd.vmware.admin.catalog+xml")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
-               .build())
-         .link(Link.builder()
-               .rel("remove")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
-               .build())
-         .link(Link.builder()
-               .rel("down")
-               .type("application/vnd.vmware.vcloud.metadata+xml")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
-               .build())
-         .description("Testing")
-         .owner(owner())
-         .item(Reference.builder()
-               .type("application/vnd.vmware.vcloud.catalogItem+xml")
-               .name("image")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f"))
-               .build())
-         .item(Reference.builder()
-               .type("application/vnd.vmware.vcloud.catalogItem+xml")
-               .name("ubuntu10")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
-               .build())
-         .item(Reference.builder()
-               .type("application/vnd.vmware.vcloud.catalogItem+xml")
-               .name("imageTesting")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"))
-               .build())
-         .item(Reference.builder()
-               .type("application/vnd.vmware.vcloud.catalogItem+xml")
-               .name("TestCase")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/f7598606-aea4-41d7-8f67-2090e28e7876"))
-               .build())
-         .isPublished(false)
-         .build();
-   }
-
-   private static Owner owner() {
-      return Owner.builder()
-         .type("application/vnd.vmware.vcloud.owner+xml")
-         .user(Reference.builder()
-               .type("application/vnd.vmware.admin.user+xml")
-               .name("qunying.huang@enstratus.com")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"))
-               .build())
-         .build();
-   }
-   
-   public static final AdminCatalog editCatalog() {
-      return catalog().toBuilder()
-         .name("new QunyingTestCatalog")
-         .description("new Testing")
-         .build();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiLiveTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiLiveTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiLiveTest.java
deleted file mode 100644
index bb686b3..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiLiveTest.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.features.admin;
-
-import static com.google.common.base.Objects.equal;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_NULL_OBJ_FMT;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_DEL;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_UPDATABLE;
-import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkControlAccessParams;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
-import org.jclouds.vcloud.director.v1_5.domain.Checks;
-import org.jclouds.vcloud.director.v1_5.domain.Link;
-import org.jclouds.vcloud.director.v1_5.domain.Owner;
-import org.jclouds.vcloud.director.v1_5.domain.Reference;
-import org.jclouds.vcloud.director.v1_5.domain.User;
-import org.jclouds.vcloud.director.v1_5.domain.org.Org;
-import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams;
-import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams;
-import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorApiLiveTest;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-@Test(groups = { "live", "admin" }, singleThreaded = true, testName = "CatalogApiLiveTest")
-public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
-
-   public static final String CATALOG = "admin catalog";
-
-   /*
-    * Convenience references to API apis.
-    */
-
-   private AdminCatalogApi catalogApi;
-
-   /*
-    * Shared state between dependant tests.
-    */
-
-   private Org org;
-   private AdminCatalog catalog;
-   private Owner owner;
-
-   @Override
-   @BeforeClass(alwaysRun = true)
-   protected void setupRequiredApis() {
-      catalogApi = adminContext.getApi().getCatalogApi();
-      org = context.getApi().getOrgApi().get(Iterables.get(context.getApi().getOrgApi().list(), 0).getHref());
-   }
-
-   @AfterClass(alwaysRun = true)
-   protected void tidyUp() {
-      if (catalog != null) {
-         try {
-            catalogApi.remove(catalog.getHref());
-         } catch (Exception e) {
-            logger.warn(e, "Error deleting admin catalog '%s'", catalog.getName());
-         }
-      }
-   }
-
-   @Test(description = "POST /admin/org/{id}/catalogs")
-   public void testAddCatalog() {
-      AdminCatalog newCatalog = AdminCatalog.builder().name(name("Test Catalog "))
-               .description("created by testAddCatalog()").build();
-      catalog = catalogApi.addCatalogToOrg(newCatalog, org.getHref());
-
-      Checks.checkAdminCatalog(catalog);
-
-      // FIXME: documentation suggests we should wait for a task here
-   }
-
-   @Test(description = "GET /admin/catalog/{id}", dependsOnMethods = { "testAddCatalog" })
-   public void testGetCatalog() {
-      catalog = catalogApi.get(catalog.getHref());
-
-      Checks.checkAdminCatalog(catalog);
-   }
-
-   @Test(description = "GET /admin/catalog/{id}/owner", dependsOnMethods = { "testGetCatalog" })
-   public void testGetCatalogOwner() {
-      owner = catalogApi.getOwner(catalog.getHref());
-      Checks.checkOwner(owner);
-   }
-
-   @Test(description = "PUT /admin/catalog/{id}/owner", dependsOnMethods = { "testGetCatalog" })
-   public void editCatalogOwner() {
-      User newOwnerUser = randomTestUser("testEditCatalogOwner");
-      newOwnerUser = adminContext.getApi().getUserApi().addUserToOrg(newOwnerUser, org.getHref());
-      assertNotNull(newOwnerUser, "failed to add temp user to test editCatalogOwner");
-
-      Owner oldOwner = owner;
-      Owner newOwner = Owner.builder().type("application/vnd.vmware.vcloud.owner+xml")
-               .user(Reference.builder().fromEntity(newOwnerUser).build()).build();
-
-      try {
-         catalogApi.setOwner(catalog.getHref(), newOwner);
-         owner = catalogApi.getOwner(catalog.getHref());
-         Checks.checkOwner(owner);
-         assertTrue(
-                  equal(owner.toBuilder().links(ImmutableSet.<Link> of()).build(),
-                           newOwner.toBuilder().user(newOwner.getUser()).build()),
-                  String.format(OBJ_FIELD_UPDATABLE, CATALOG, "owner"));
-      } finally {
-         catalogApi.setOwner(catalog.getHref(), oldOwner);
-         owner = catalogApi.getOwner(catalog.getHref());
-         adminContext.getApi().getUserApi().remove(newOwnerUser.getHref());
-      }
-   }
-
-   @Test(description = "PUT /admin/catalog/{id}", dependsOnMethods = { "testGetCatalogOwner" })
-   public void testEditCatalog() {
-      String oldName = catalog.getName();
-      String newName = "new " + oldName;
-      String oldDescription = catalog.getDescription();
-      String newDescription = "new " + oldDescription;
-      // 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();
-
-      try {
-         catalog = catalog.toBuilder().name(newName).description(newDescription)
-         // .catalogItems(newCatalogItems)
-                  .build();
-
-         catalog = catalogApi.edit(catalog.getHref(), catalog);
-
-         assertTrue(equal(catalog.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, CATALOG, "name"));
-         assertTrue(equal(catalog.getDescription(), newDescription),
-                  String.format(OBJ_FIELD_UPDATABLE, CATALOG, "description"));
-         // assertTrue(equal(catalog.getCatalogItems(), newCatalogItems),
-         // String.format(OBJ_FIELD_UPDATABLE, CATALOG, "catalogItems"));
-
-         // TODO negative tests?
-
-         Checks.checkAdminCatalog(catalog);
-      } finally {
-         catalog = catalog.toBuilder().name(oldName).description(oldDescription)
-         // .catalogItems(oldCatalogItems)
-                  .build();
-
-         catalog = catalogApi.edit(catalog.getHref(), catalog);
-      }
-   }
-
-   // FIXME fails with a 403
-   @Test(description = "POST /admin/catalog/{id}/action/publish", dependsOnMethods = { "testEditCatalog" })
-   public void testPublishCatalog() {
-      assertNotNull(catalog, String.format(NOT_NULL_OBJ_FMT, "Catalog"));
-      assertFalse(catalog.isPublished(),
-               String.format(OBJ_FIELD_EQ, CATALOG, "isPublished", false, catalog.isPublished()));
-
-      PublishCatalogParams params = PublishCatalogParams.builder().isPublished(true).build();
-
-      catalogApi.publish(catalog.getHref(), params);
-      catalog = catalogApi.get(catalog.getHref());
-
-      assertTrue(catalog.isPublished(),
-               String.format(OBJ_FIELD_EQ, CATALOG, "isPublished", true, catalog.isPublished()));
-   }
-
-   @Test(description = "GET /org/{id}/catalog/{catalogId}/controlAccess", dependsOnMethods = { "testAddCatalog" })
-   public void testGetControlAccessControl() {
-      // Call the method being tested
-      ControlAccessParams params = catalogApi.getAccessControl(catalog.getHref());
-
-      // Check params are well formed
-      checkControlAccessParams(params);
-   }
-
-   @Test(description = "POST /org/{id}/catalog/{catalogId}/action/controlAccess", dependsOnMethods = { "testAddCatalog" })
-   public void testEditAccessControl() {
-      // Setup params
-      ControlAccessParams params = catalogApi.getAccessControl(catalog.getHref());
-
-      // Call the method being tested
-      ControlAccessParams modified = catalogApi.editAccessControl(catalog.getHref(), params);
-
-      // Check params are well formed
-      checkControlAccessParams(modified);
-   }
-   
-   @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 removeCatalog = AdminCatalog.builder().name(name("Test Catalog "))
-               .description("created by testAddCatalog()").build();
-      removeCatalog = catalogApi.addCatalogToOrg(removeCatalog, org.getHref());
-      catalogApi.remove(removeCatalog.getHref());
-
-      removeCatalog = catalogApi.get(removeCatalog.getHref());
-      assertNull(removeCatalog, String.format(OBJ_DEL, CATALOG, removeCatalog != null ? removeCatalog.toString() : ""));
-   }
-   
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApiExpectTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApiExpectTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApiExpectTest.java
deleted file mode 100644
index 2a23d83..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApiExpectTest.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.features.admin;
-
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ORG;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ORG_NETWORK;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK;
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
-import org.jclouds.vcloud.director.v1_5.domain.Link;
-import org.jclouds.vcloud.director.v1_5.domain.Reference;
-import org.jclouds.vcloud.director.v1_5.domain.Task;
-import org.jclouds.vcloud.director.v1_5.domain.network.DhcpService;
-import org.jclouds.vcloud.director.v1_5.domain.network.IpAddresses;
-import org.jclouds.vcloud.director.v1_5.domain.network.IpRange;
-import org.jclouds.vcloud.director.v1_5.domain.network.IpRanges;
-import org.jclouds.vcloud.director.v1_5.domain.network.IpScope;
-import org.jclouds.vcloud.director.v1_5.domain.network.Network.FenceMode;
-import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConfiguration;
-import org.jclouds.vcloud.director.v1_5.domain.network.NetworkFeatures;
-import org.jclouds.vcloud.director.v1_5.domain.network.SyslogServerSettings;
-import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork;
-import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.net.HttpHeaders;
-
-@Test(groups = { "unit", "admin" }, singleThreaded = true, testName = "AdminNetworkApiExpectTest")
-public class AdminNetworkApiExpectTest extends VCloudDirectorAdminApiExpectTest {
-
-   static String network = "55a677cf-ab3f-48ae-b880-fab90421980c";
-   static URI networkAdminHref = URI.create(endpoint + "/admin/network/" + network);
-   
-   HttpRequest get = HttpRequest.builder()
-            .method("GET")
-            .endpoint(networkAdminHref)
-            .addHeader("Accept", "*/*")
-            .addHeader("x-vcloud-authorization", token)
-            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
-            .build();
-
-    HttpResponse getResponse = HttpResponse.builder()
-            .statusCode(200)
-            .payload(payloadFromResourceWithContentType("/network/network.xml", ORG + ";version=1.5"))
-            .build();
-    
-   @Test
-   public void testGetNetworkHref() {
-      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, get, getResponse);
-      assertEquals(api.getNetworkApi().get(networkAdminHref), network());
-   }
-
-   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/editNetworkSource.xml", ORG_NETWORK))
-            .build();
-
-   HttpResponse editResponse = HttpResponse.builder()
-            .statusCode(200)
-            .payload(payloadFromResourceWithContentType("/network/admin/editNetworkTask.xml", TASK))
-            .build();
-
-   @Test
-   public void testEditNetworkHref() {
-      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, edit, editResponse);
-      assertEquals(api.getNetworkApi().edit(networkAdminHref, editNetwork()), editNetworkTask());
-   }
-
-   HttpRequest reset = HttpRequest.builder()
-            .method("POST")
-            .endpoint(networkAdminHref + "/action/reset")
-            .addHeader("Accept", "*/*")
-            .addHeader("x-vcloud-authorization", token)
-            .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + token)
-            .build();
-
-   HttpResponse resetResponse = HttpResponse.builder()
-            .statusCode(200)
-            .payload(payloadFromResourceWithContentType("/network/admin/resetNetworkTask.xml", TASK))
-            .build();
-
-   @Test
-   public void testResetNetworkHref() {
-      VCloudDirectorAdminApi api = requestsSendResponses(loginRequest, sessionResponse, reset, resetResponse);
-      assertEquals(api.getNetworkApi().reset(networkAdminHref), resetNetworkTask());
-   }
-   
-   public static OrgNetwork network() {
-      return OrgNetwork.builder()
-         .name("ilsolation01-Jclouds")
-         .id("urn:vcloud:network:f3ba8256-6f48-4512-aad6-600e85b4dc38")
-         .type("application/vnd.vmware.vcloud.orgNetwork+xml")
-         .href(URI.create("https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"))
-         .link(Link.builder()
-            .rel("up")
-            .type("application/vnd.vmware.vcloud.org+xml")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
-            .build())
-         .link(Link.builder()
-            .rel("down")
-            .type("application/vnd.vmware.vcloud.metadata+xml")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38/metadata"))
-            .build())
-         .description("")
-         .configuration(NetworkConfiguration.builder()
-            .ipScope(IpScope.builder()
-               .isInherited(false)
-               .gateway("192.168.1.1")
-               .netmask("255.255.255.0")
-               .dns1("173.240.111.52")
-               .dns2("173.240.111.53")
-               .ipRanges(IpRanges.builder()
-                     .ipRange(IpRange.builder()
-                           .startAddress("192.168.1.100")
-                           .endAddress("192.168.1.199")
-                           .build())
-                     .build())
-               .build())
-            .fenceMode(FenceMode.ISOLATED)
-            .retainNetInfoAcrossDeployments(false)
-            .features(NetworkFeatures.builder()
-               .service(DhcpService.builder()
-                  .enabled(false)
-                  .defaultLeaseTime(3600)
-                  .maxLeaseTime(7200)
-                  .ipRange(IpRange.builder()
-                     .startAddress("192.168.1.2")
-                     .endAddress("192.168.1.99")
-                     .build())
-                  .build())
-               .build())
-            .syslogServerSettings(SyslogServerSettings.builder().build())
-            .build())
-         .allowedExternalIpAddresses(IpAddresses.builder().build())
-         .build();
-   }
-   
-   public final OrgNetwork editNetwork() {
-      return network().toBuilder()
-            
-         .build();
-   }
-   
-   public final Task resetNetworkTask() {
-      return Task.builder()
-               .status("running")
-               .startTime(dateService.iso8601DateParse("2012-03-14T12:39:23.720-04:00"))
-               .operationName("networkResetNetwork")
-               .operation("Resetting Network ilsolation01-Jclouds(f3ba8256-6f48-4512-aad6-600e85b4dc38)")
-               .expiryTime(dateService.iso8601DateParse("2012-06-12T12:39:23.720-04:00"))
-               .name("task")
-               .id("urn:vcloud:task:49d2e180-7921-4902-ac39-b4ff5406bb94")
-               .type("application/vnd.vmware.vcloud.task+xml")
-               .href(URI.create("https://vcloudbeta.bluelock.com/api/task/49d2e180-7921-4902-ac39-b4ff5406bb94"))
-               .link(Link.builder()
-                  .rel("task:cancel")
-                  .href(URI.create("https://vcloudbeta.bluelock.com/api/task/49d2e180-7921-4902-ac39-b4ff5406bb94/action/cancel"))
-                  .build())
-               .owner(Reference.builder()
-                  .type("application/vnd.vmware.vcloud.network+xml")
-                  .name("ilsolation01-Jclouds")
-                  .href(URI.create("https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"))
-                  .build())
-               .user(Reference.builder()
-                  .type("application/vnd.vmware.admin.user+xml")
-                  .name("dan@cloudsoftcorp.com")
-                  .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/ae75edd2-12de-414c-8e85-e6ea10442c08"))
-                  .build())
-               .org(Reference.builder()
-                  .type("application/vnd.vmware.vcloud.org+xml")
-                  .name("JClouds")
-                  .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
-                  .build())
-               .build();
-   }
-   
-   public final Task editNetworkTask() {
-      return Task.builder()
-         .status("running")
-         .startTime(dateService.iso8601DateParse("2012-03-14T12:39:23.720-04:00"))
-         .operationName("networkUpdateNetwork")
-         .operation("Updating Network ilsolation01-Jclouds(f3ba8256-6f48-4512-aad6-600e85b4dc38)")
-         .expiryTime(dateService.iso8601DateParse("2012-06-12T12:39:23.720-04:00"))
-         .name("task")
-         .id("urn:vcloud:task:49d2e180-7921-4902-ac39-b4ff5406bb94")
-         .type("application/vnd.vmware.vcloud.task+xml")
-         .href(URI.create("https://vcloudbeta.bluelock.com/api/task/49d2e180-7921-4902-ac39-b4ff5406bb94"))
-         .link(Link.builder()
-            .rel("task:cancel")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/task/49d2e180-7921-4902-ac39-b4ff5406bb94/action/cancel"))
-            .build())
-         .owner(Reference.builder()
-            .type("application/vnd.vmware.vcloud.network+xml")
-            .name("ilsolation01-Jclouds")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"))
-            .build())
-         .user(Reference.builder()
-            .type("application/vnd.vmware.admin.user+xml")
-            .name("dan@cloudsoftcorp.com")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/ae75edd2-12de-414c-8e85-e6ea10442c08"))
-            .build())
-         .org(Reference.builder()
-            .type("application/vnd.vmware.vcloud.org+xml")
-            .name("JClouds")
-            .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
-            .build())
-         .build();
-   }
-}