You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/03/12 11:39:27 UTC

[09/10] jclouds-labs git commit: [JCLOUDS-664] Fixing live test execution

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/compute/AzureComputeServiceContextLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/compute/AzureComputeServiceContextLiveTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/compute/AzureComputeServiceContextLiveTest.java
index 9136cbb..990fba6 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/compute/AzureComputeServiceContextLiveTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/compute/AzureComputeServiceContextLiveTest.java
@@ -16,7 +16,11 @@
  */
 package org.jclouds.azurecompute.compute;
 
+import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.jclouds.util.Predicates2.retry;
+
+import com.google.common.base.Predicate;
 import java.util.Random;
 import java.util.Set;
 
@@ -27,53 +31,136 @@ import org.jclouds.compute.domain.NodeMetadata;
 import org.jclouds.compute.domain.Template;
 import org.jclouds.compute.domain.TemplateBuilder;
 import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
-import org.jclouds.scriptbuilder.statements.login.AdminAccess;
 import org.jclouds.ssh.SshClient;
 import org.jclouds.sshj.config.SshjSshClientModule;
-import org.testng.annotations.Test;
 
 import com.google.common.collect.Iterables;
+import com.google.common.reflect.TypeToken;
 import com.google.inject.Module;
+import java.util.Arrays;
+import java.util.List;
+import org.jclouds.azurecompute.AzureComputeApi;
+import org.jclouds.azurecompute.compute.config.AzureComputeServiceContextModule;
+import org.jclouds.azurecompute.domain.Role;
+import org.jclouds.azurecompute.internal.BaseAzureComputeApiLiveTest;
+import org.jclouds.azurecompute.util.ConflictManagementPredicate;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
 
 @Test(groups = "live", testName = "AzureComputeServiceContextLiveTest")
 public class AzureComputeServiceContextLiveTest extends BaseComputeServiceContextLiveTest {
 
+   private static final int RAND = new Random().nextInt(999);
+
+   private AzureComputeApi api;
+
+   private Predicate<String> operationSucceeded;
+
+   private String storageServiceName = null;
+
+   protected String getStorageServiceName() {
+      if (storageServiceName == null) {
+         storageServiceName = String.format("%3.24s",
+                 System.getProperty("user.name") + RAND + this.getClass().getSimpleName()).toLowerCase();
+      }
+      return storageServiceName;
+   }
+
+   @BeforeClass
+   public void setup() {
+      api = newBuilder().
+              modules(setupModules()).
+              overrides(setupProperties()).
+              buildApi(new TypeToken<AzureComputeApi>(getClass()) {
+
+                 private static final long serialVersionUID = 309104475566522958L;
+
+              });
+
+      operationSucceeded = retry(
+              new AzureComputeServiceContextModule.OperationSucceededPredicate(api), 600, 5, 5, SECONDS);
+   }
+
+   @AfterClass(alwaysRun = true)
+   public void tearDown() {
+      retry(new ConflictManagementPredicate(operationSucceeded) {
+
+         @Override
+         protected String operation() {
+            return api.getStorageAccountApi().delete(getStorageServiceName());
+         }
+      }, 600, 5, 5, SECONDS).apply(getStorageServiceName());
+   }
+
    @Override
    protected Module getSshModule() {
       return new SshjSshClientModule();
    }
 
    public AzureComputeServiceContextLiveTest() {
+      super();
+
       provider = "azurecompute";
    }
 
+   /**
+    * Functionally equivalent to
+    * {@link AzureComputeServiceAdapterLiveTest#testCreateNodeWithGroupEncodedIntoNameThenStoreCredentials}.
+    *
+    * @throws RunNodesException
+    */
    @Test
    public void testLaunchNode() throws RunNodesException {
-      final String group = "node" + new Random().nextLong();
+      final String groupName = String.format("%s%d-group-acsclt",
+              System.getProperty("user.name"),
+              new Random(999).nextInt());
+
+      final String name = String.format("%1.5s%dacsclt", System.getProperty("user.name"), new Random(999).nextInt());
 
-      TemplateBuilder templateBuilder = view.getComputeService().templateBuilder();
-      templateBuilder.imageId("b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20150123-en-us-30GB");
-      templateBuilder.hardwareId("BASIC_A2");
-      templateBuilder.locationId("West Europe");
-      Template template = templateBuilder.build();
+      final TemplateBuilder templateBuilder = view.getComputeService().templateBuilder();
+      templateBuilder.imageId(BaseAzureComputeApiLiveTest.IMAGE_NAME);
+      templateBuilder.hardwareId("BASIC_A0");
+      templateBuilder.locationId(BaseAzureComputeApiLiveTest.LOCATION);
+      Template tmp = templateBuilder.build();
 
       // test passing custom options
-      AzureComputeTemplateOptions options = template.getOptions().as(AzureComputeTemplateOptions.class);
+      final AzureComputeTemplateOptions options = tmp.getOptions().as(AzureComputeTemplateOptions.class);
       options.inboundPorts(22);
-      options.runScript(AdminAccess.standard());
+      options.storageAccountName(getStorageServiceName());
+      options.virtualNetworkName(BaseAzureComputeApiLiveTest.VIRTUAL_NETWORK_NAME);
+      options.subnetName(BaseAzureComputeApiLiveTest.DEFAULT_SUBNET_NAME);
+      options.addressSpaceAddressPrefix(BaseAzureComputeApiLiveTest.DEFAULT_ADDRESS_SPACE);
+      options.subnetAddressPrefix(BaseAzureComputeApiLiveTest.DEFAULT_SUBNET_ADDRESS_SPACE);
+      options.nodeNames(Arrays.asList(name));
 
       NodeMetadata node = null;
       try {
-         Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup(group, 1, template);
+         final Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup(groupName, 1, tmp);
          node = Iterables.getOnlyElement(nodes);
 
-         SshClient client = view.utils().sshForNode().apply(node);
+         final SshClient client = view.utils().sshForNode().apply(node);
          client.connect();
-         ExecResponse hello = client.exec("echo hello");
+         final ExecResponse hello = client.exec("echo hello");
          assertThat(hello.getOutput().trim()).isEqualTo("hello");
       } finally {
          if (node != null) {
+            final List<Role> roles = api.getDeploymentApiForService(node.getId()).get(node.getId()).roles();
+
             view.getComputeService().destroyNode(node.getId());
+
+            for (Role role : roles) {
+               final Role.OSVirtualHardDisk disk = role.osVirtualHardDisk();
+               if (disk != null) {
+                  retry(new ConflictManagementPredicate(operationSucceeded) {
+
+                     @Override
+                     protected String operation() {
+                        return api.getDiskApi().delete(disk.diskName());
+                     }
+                  }, 600, 30, 30, SECONDS).apply(disk.diskName());
+               }
+            }
          }
       }
    }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/compute/extensions/AzureComputeSecurityGroupExtensionLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/compute/extensions/AzureComputeSecurityGroupExtensionLiveTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/compute/extensions/AzureComputeSecurityGroupExtensionLiveTest.java
index f026a11..b5bc3a5 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/compute/extensions/AzureComputeSecurityGroupExtensionLiveTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/compute/extensions/AzureComputeSecurityGroupExtensionLiveTest.java
@@ -30,6 +30,7 @@ import com.google.inject.Module;
 public class AzureComputeSecurityGroupExtensionLiveTest extends BaseSecurityGroupExtensionLiveTest {
 
    public AzureComputeSecurityGroupExtensionLiveTest() {
+      super();
       provider = "azurecompute";
    }
 
@@ -38,6 +39,7 @@ public class AzureComputeSecurityGroupExtensionLiveTest extends BaseSecurityGrou
       return ImmutableSet.of(getLoggingModule(), credentialStoreModule, getSshModule());
    }
 
+   @Override
    protected Module getSshModule() {
       return new SshjSshClientModule();
    }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/compute/functions/OSImageToImageTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/compute/functions/OSImageToImageTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/compute/functions/OSImageToImageTest.java
index 2d10f1f..a8f6fc2 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/compute/functions/OSImageToImageTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/compute/functions/OSImageToImageTest.java
@@ -36,51 +36,52 @@ import org.testng.annotations.Test;
 
 @Test(groups = "unit", testName = "OSImageToImageTest")
 public class OSImageToImageTest {
+
    public void testImageTransform() {
       OSImageToImage imageToImage = new OSImageToImage(new JustProvider("azurecompute", Suppliers
-            .ofInstance(URI.create("foo")), ImmutableSet.<String>of()));
+              .ofInstance(URI.create("foo")), ImmutableSet.<String>of()));
       // OSImage OSImage = createOSImage();
-      for (OSImage OSImage : createOSImage()) {
-         org.jclouds.compute.domain.Image transformed = imageToImage.apply(OSImage);
-         OperatingSystem os = OSImageToImage.osFamily().apply(OSImage).build();
-         assertNotNull(OSImage.label());
+      for (OSImage osImage : createOSImage()) {
+         org.jclouds.compute.domain.Image transformed = imageToImage.apply(osImage);
+         OperatingSystem os = OSImageToImage.osFamily().apply(osImage).build();
+         assertNotNull(osImage.label());
          assertNotNull(transformed.getId());
-         assertEquals(transformed.getId(), OSImage.name());
-         assertEquals(transformed.getName(), OSImage.label());
+         assertEquals(transformed.getId(), osImage.name());
+         assertEquals(transformed.getName(), osImage.label());
          assertEquals(transformed.getOperatingSystem().getFamily(), os.getFamily());
          assertEquals(transformed.getOperatingSystem().getVersion(), os.getVersion());
-         assertEquals(transformed.getProviderId(), OSImage.name());
+         assertEquals(transformed.getProviderId(), osImage.name());
          Location location = transformed.getLocation();
          if (location != null) {
-            assertEquals(location.getId(), OSImage.location());
+            assertEquals(location.getId(), osImage.location());
          }
       }
    }
 
    public void testOperatingSystem() {
       ImmutableList<String> version = ImmutableList.of(
-            "13.1",
-            "12.04 LTS",
-            "Windows Server 2008 R2 SP1, June 2012",
-            "Microsoft SQL Server 2012 Evaluation Edition",
-            "Windows Server 2012 Release Candidate, July 2012",
-            "Windows Server 2008 R2 SP1, July 2012",
-            "OpenLogic CentOS 6.2",
-            "12.1",
-            "Linux Enterprise Server",
-            "RightImage-CentOS-6.4-x64-v13.4"
+              "13.1",
+              "12.04 LTS",
+              "Windows Server 2008 R2 SP1, June 2012",
+              "Microsoft SQL Server 2012 Evaluation Edition",
+              "Windows Server 2012 Release Candidate, July 2012",
+              "Windows Server 2008 R2 SP1, July 2012",
+              "OpenLogic CentOS 6.2",
+              "12.1",
+              "Linux Enterprise Server",
+              "RightImage-CentOS-6.4-x64-v13.4"
       );
       ImmutableList<OsFamily> osFamily = ImmutableList.of(
-            OsFamily.SUSE,
-            OsFamily.UBUNTU,
-            OsFamily.WINDOWS,
-            OsFamily.WINDOWS,
-            OsFamily.WINDOWS,
-            OsFamily.WINDOWS,
-            OsFamily.CENTOS,
-            OsFamily.SUSE,
-            OsFamily.SUSE,
-            OsFamily.CENTOS
+              OsFamily.SUSE,
+              OsFamily.UBUNTU,
+              OsFamily.WINDOWS,
+              OsFamily.WINDOWS,
+              OsFamily.WINDOWS,
+              OsFamily.WINDOWS,
+              OsFamily.CENTOS,
+              OsFamily.SUSE,
+              OsFamily.SUSE,
+              OsFamily.CENTOS
       );
 
       List<OSImage> images = createOSImage();
@@ -94,140 +95,140 @@ public class OSImageToImageTest {
 
    private static ImmutableList<OSImage> createOSImage() {
       return ImmutableList.of(
-            OSImage.create(
-                  "SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd", // name
-                  "Central US", // location
-                  null, // affinityGroup
-                  "openSUSE 13.1", // label
+              OSImage.create(
+                      "SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd", // name
+                      "Central US", // location
+                      null, // affinityGroup
+                      "openSUSE 13.1", // label
                   "openSUSE 13.1 brings updated desktop environments and software, lot of polishing, a brand new KDE theme, "
-                        + "complete systemd integration and many other features.", // description
-                  "MSDN", // category
-                  OSImage.Type.WINDOWS, // os
-                  "SUSE", // publisherName
-                  URI.create("http://example.blob.core.windows.net/disks/myimage.vhd"), // mediaLink
-                  30, // logicalSizeInGB
-                  Arrays.asList("http://www.ubuntu.com/project/about-ubuntu/licensing")// eula
-            ),
-            OSImage.create(
-                  "CANONICAL__Canonical-Ubuntu-12-04-amd64-server-20120528.1.3-en-us-30GB.vhd", // name
-                  null, // locations
-                  null, // affinityGroup
-                  "Ubuntu Server 12.04 LTS", // label
-                  "Ubuntu Server 12.04 LTS amd64 20120528 Cloud Image", //description
-                  "Canonical", // category
-                  OSImage.Type.LINUX, // os
-                  "Canonical", // publisherName
-                  null, // mediaLink
-                  30, // logicalSizeInGB
-                  Arrays.asList("http://www.ubuntu.com/project/about-ubuntu/licensing") // eula
-            ),
-            OSImage.create( //
-                  "MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd", // name
-                  "North Europe", // locations
-                  null, // affinityGroup
-                  "Windows Server 2008 R2 SP1, June 2012", // label
-                  "Windows Server 2008 R2 is a multi-purpose server.", //description
-                  "Microsoft", // category
-                  OSImage.Type.WINDOWS, // os
-                  "Microsoft", //publisherName
+                      + "complete systemd integration and many other features.", // description
+                      "MSDN", // category
+                      OSImage.Type.WINDOWS, // os
+                      "SUSE", // publisherName
+                      URI.create("http://example.blob.core.windows.net/disks/myimage.vhd"), // mediaLink
+                      30, // logicalSizeInGB
+                      Arrays.asList("http://www.ubuntu.com/project/about-ubuntu/licensing")// eula
+              ),
+              OSImage.create(
+                      "CANONICAL__Canonical-Ubuntu-12-04-amd64-server-20120528.1.3-en-us-30GB.vhd", // name
+                      null, // locations
+                      null, // affinityGroup
+                      "Ubuntu Server 12.04 LTS", // label
+                      "Ubuntu Server 12.04 LTS amd64 20120528 Cloud Image", //description
+                      "Canonical", // category
+                      OSImage.Type.LINUX, // os
+                      "Canonical", // publisherName
+                      null, // mediaLink
+                      30, // logicalSizeInGB
+                      Arrays.asList("http://www.ubuntu.com/project/about-ubuntu/licensing") // eula
+              ),
+              OSImage.create( //
+                      "MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd", // name
+                      "North Europe", // locations
+                      null, // affinityGroup
+                      "Windows Server 2008 R2 SP1, June 2012", // label
+                      "Windows Server 2008 R2 is a multi-purpose server.", //description
+                      "Microsoft", // category
+                      OSImage.Type.WINDOWS, // os
+                      "Microsoft", //publisherName
                   URI.create("http://blobs/disks/mydeployment/MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd"),
-                  // mediaLink
-                  30, // logicalSizeInGB
-                  Collections.<String>emptyList() // eula
-            ),
-            OSImage.create( //
-                  "MSFT__Sql-Server-11EVAL-11.0.2215.0-05152012-en-us-30GB.vhd", // name
-                  null, // locations
-                  null, // affinityGroup
-                  "Microsoft SQL Server 2012 Evaluation Edition", // label
-                  "SQL Server 2012 Evaluation Edition (64-bit).", //description
-                  "Microsoft", // category
-                  OSImage.Type.WINDOWS, // os
-                  "Microsoft", //publisherName
-                  null, // mediaLink
-                  30, // logicalSizeInGB
-                  Arrays.asList("http://go.microsoft.com/fwlink/?LinkID=251820",
-                        "http://go.microsoft.com/fwlink/?LinkID=131004") // eula
-            ),
-            OSImage.create( //
-                  "MSFT__Win2K12RC-Datacenter-201207.02-en.us-30GB.vhd", // name
-                  null, // locations
-                  null, // affinityGroup
-                  "Windows Server 2012 Release Candidate, July 2012", // label
-                  "Windows Server 2012 incorporates Microsoft's experience building.", //description
-                  "Microsoft", // category
-                  OSImage.Type.WINDOWS, // os
-                  "Microsoft", //publisherName
-                  null, // mediaLink
-                  30, // logicalSizeInGB
-                  Collections.<String>emptyList() // eula
-            ),
-            OSImage.create( //
-                  "MSFT__Win2K8R2SP1-Datacenter-201207.01-en.us-30GB.vhd", // name
-                  null, // locations
-                  null, // affinityGroup
-                  "Windows Server 2008 R2 SP1, July 2012", // label
-                  "Windows Server 2008 R2 is a multi-purpose server.", //description
-                  "Microsoft", // category
-                  OSImage.Type.WINDOWS, // os
-                  "Microsoft", //publisherName
-                  null, // mediaLink
-                  30, // logicalSizeInGB
-                  Collections.<String>emptyList() // eula
-            ),
-            OSImage.create( //
-                  "OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd", // name
-                  null, // locations
-                  null, // affinityGroup
-                  "OpenLogic CentOS 6.2", // label
-                  "This distribution of Linux is based on CentOS.", //description
-                  "OpenLogic", // category
-                  OSImage.Type.LINUX, // os
-                  "openLogic", //publisherName
+                      // mediaLink
+                      30, // logicalSizeInGB
+                      Collections.<String>emptyList() // eula
+              ),
+              OSImage.create( //
+                      "MSFT__Sql-Server-11EVAL-11.0.2215.0-05152012-en-us-30GB.vhd", // name
+                      null, // locations
+                      null, // affinityGroup
+                      "Microsoft SQL Server 2012 Evaluation Edition", // label
+                      "SQL Server 2012 Evaluation Edition (64-bit).", //description
+                      "Microsoft", // category
+                      OSImage.Type.WINDOWS, // os
+                      "Microsoft", //publisherName
+                      null, // mediaLink
+                      30, // logicalSizeInGB
+                      Arrays.asList("http://go.microsoft.com/fwlink/?LinkID=251820",
+                              "http://go.microsoft.com/fwlink/?LinkID=131004") // eula
+              ),
+              OSImage.create( //
+                      "MSFT__Win2K12RC-Datacenter-201207.02-en.us-30GB.vhd", // name
+                      null, // locations
+                      null, // affinityGroup
+                      "Windows Server 2012 Release Candidate, July 2012", // label
+                      "Windows Server 2012 incorporates Microsoft's experience building.", //description
+                      "Microsoft", // category
+                      OSImage.Type.WINDOWS, // os
+                      "Microsoft", //publisherName
+                      null, // mediaLink
+                      30, // logicalSizeInGB
+                      Collections.<String>emptyList() // eula
+              ),
+              OSImage.create( //
+                      "MSFT__Win2K8R2SP1-Datacenter-201207.01-en.us-30GB.vhd", // name
+                      null, // locations
+                      null, // affinityGroup
+                      "Windows Server 2008 R2 SP1, July 2012", // label
+                      "Windows Server 2008 R2 is a multi-purpose server.", //description
+                      "Microsoft", // category
+                      OSImage.Type.WINDOWS, // os
+                      "Microsoft", //publisherName
+                      null, // mediaLink
+                      30, // logicalSizeInGB
+                      Collections.<String>emptyList() // eula
+              ),
+              OSImage.create( //
+                      "OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd", // name
+                      null, // locations
+                      null, // affinityGroup
+                      "OpenLogic CentOS 6.2", // label
+                      "This distribution of Linux is based on CentOS.", //description
+                      "OpenLogic", // category
+                      OSImage.Type.LINUX, // os
+                      "openLogic", //publisherName
                   URI.create("http://blobs/disks/mydeployment/OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd"),
-                  // mediaLink
-                  30, //logicalSizeInGB
-                  Arrays.asList("http://www.openlogic.com/azure/service-agreement/") // eula
-            ),
-            OSImage.create( //
-                  "SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd", // name
-                  null, // locations
-                  null, // affinityGroup
-                  "openSUSE 12.1", // label
-                  "openSUSE is a free and Linux-based operating system!", //description
-                  "SUSE", // category
-                  OSImage.Type.LINUX, // os
-                  "SUSE", //publisherName
-                  null, // mediaLink
-                  30, // logicalSizeInGB
-                  Arrays.asList("http://opensuse.org/") // eula
-            ),
-            OSImage.create( //
-                  "SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120601-en-us-30GB.vhd", // name
-                  null, // locations
-                  null, // affinityGroup
-                  "SUSE Linux Enterprise Server", // label
-                  "SUSE Linux Enterprise Server is a highly reliable value.", //description
-                  "SUSE", // category
-                  OSImage.Type.LINUX, // os
-                  "SUSE", //publisherName
-                  null, // mediaLink
-                  30, // logicalSizeInGB
-                  Arrays.asList("http://www.novell.com/licensing/eula/") // eula
-            ),
-            OSImage.create( //
-                  "0b11de9248dd4d87b18621318e037d37__RightImage-CentOS-6.4-x64-v13.4", // name
-                  null, // locations
-                  null, // affinityGroup
-                  "RightImage-CentOS-6.4-x64-v13.4", // label
-                  null, //description
-                  "RightScale with Linux", // category
-                  OSImage.Type.LINUX, // os
-                  "RightScale with Linux",
-                  null, // mediaLink
-                  10, // logicalSizeInGB
-                  Collections.<String>emptyList() // No EULA, as RightScale stuffed ';' into the field.
-            )
+                      // mediaLink
+                      30, //logicalSizeInGB
+                      Arrays.asList("http://www.openlogic.com/azure/service-agreement/") // eula
+              ),
+              OSImage.create( //
+                      "SUSE__openSUSE-12-1-20120603-en-us-30GB.vhd", // name
+                      null, // locations
+                      null, // affinityGroup
+                      "openSUSE 12.1", // label
+                      "openSUSE is a free and Linux-based operating system!", //description
+                      "SUSE", // category
+                      OSImage.Type.LINUX, // os
+                      "SUSE", //publisherName
+                      null, // mediaLink
+                      30, // logicalSizeInGB
+                      Arrays.asList("http://opensuse.org/") // eula
+              ),
+              OSImage.create( //
+                      "SUSE__SUSE-Linux-Enterprise-Server-11SP2-20120601-en-us-30GB.vhd", // name
+                      null, // locations
+                      null, // affinityGroup
+                      "SUSE Linux Enterprise Server", // label
+                      "SUSE Linux Enterprise Server is a highly reliable value.", //description
+                      "SUSE", // category
+                      OSImage.Type.LINUX, // os
+                      "SUSE", //publisherName
+                      null, // mediaLink
+                      30, // logicalSizeInGB
+                      Arrays.asList("http://www.novell.com/licensing/eula/") // eula
+              ),
+              OSImage.create( //
+                      "0b11de9248dd4d87b18621318e037d37__RightImage-CentOS-6.4-x64-v13.4", // name
+                      null, // locations
+                      null, // affinityGroup
+                      "RightImage-CentOS-6.4-x64-v13.4", // label
+                      null, //description
+                      "RightScale with Linux", // category
+                      OSImage.Type.LINUX, // os
+                      "RightScale with Linux",
+                      null, // mediaLink
+                      10, // logicalSizeInGB
+                      Collections.<String>emptyList() // No EULA, as RightScale stuffed ';' into the field.
+              )
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/CloudServiceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/CloudServiceApiLiveTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/CloudServiceApiLiveTest.java
index fcb83b2..b0dcbd8 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/CloudServiceApiLiveTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/CloudServiceApiLiveTest.java
@@ -24,6 +24,7 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
+
 import java.util.List;
 import java.util.logging.Logger;
 
@@ -35,24 +36,32 @@ import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 import com.google.common.base.Predicate;
+import java.util.logging.Level;
 
 @Test(groups = "live", testName = "CloudServiceApiLiveTest", singleThreaded = true)
 public class CloudServiceApiLiveTest extends BaseAzureComputeApiLiveTest {
 
-   private static final String CLOUD_SERVICE = (System.getProperty("user.name") + "cloudservice").toLowerCase();
+   private static final String CLOUD_SERVICE = String.format("%s%d-%s",
+           System.getProperty("user.name"), RAND, CloudServiceApiLiveTest.class.getSimpleName()).toLowerCase();
 
    private Predicate<CloudService> cloudServiceCreated;
+
    private Predicate<CloudService> cloudServiceGone;
 
-   @BeforeClass(groups = { "integration", "live" })
+   @BeforeClass(groups = {"integration", "live"})
+   @Override
    public void setup() {
       super.setup();
       cloudServiceCreated = retry(new Predicate<CloudService>() {
+
+         @Override
          public boolean apply(CloudService input) {
             return api().get(input.name()).status() == Status.CREATED;
          }
       }, 600, 5, 5, SECONDS);
       cloudServiceGone = retry(new Predicate<CloudService>() {
+
+         @Override
          public boolean apply(CloudService input) {
             return api().get(input.name()) == null;
          }
@@ -62,13 +71,12 @@ public class CloudServiceApiLiveTest extends BaseAzureComputeApiLiveTest {
    private CloudService cloudService;
 
    public void testCreate() {
-
-      String requestId = api().createWithLabelInLocation(CLOUD_SERVICE, CLOUD_SERVICE, location);
+      String requestId = api().createWithLabelInLocation(CLOUD_SERVICE, CLOUD_SERVICE, LOCATION);
       assertTrue(operationSucceeded.apply(requestId), requestId);
-      Logger.getAnonymousLogger().info("operation succeeded: " + requestId);
+      Logger.getAnonymousLogger().log(Level.INFO, "operation succeeded: {0}", requestId);
 
       cloudService = api().get(CLOUD_SERVICE);
-      Logger.getAnonymousLogger().info("created cloudService: " + cloudService);
+      Logger.getAnonymousLogger().log(Level.INFO, "created cloudService: {0}", cloudService);
 
       assertEquals(cloudService.name(), CLOUD_SERVICE);
 
@@ -76,7 +84,7 @@ public class CloudServiceApiLiveTest extends BaseAzureComputeApiLiveTest {
 
       assertTrue(cloudServiceCreated.apply(cloudService), cloudService.toString());
       cloudService = api().get(cloudService.name());
-      Logger.getAnonymousLogger().info("cloudService available: " + cloudService);
+      Logger.getAnonymousLogger().log(Level.INFO, "cloudService available: {0}", cloudService);
 
    }
 
@@ -90,13 +98,14 @@ public class CloudServiceApiLiveTest extends BaseAzureComputeApiLiveTest {
    public void testDelete() {
       String requestId = api().delete(cloudService.name());
       assertTrue(operationSucceeded.apply(requestId), requestId);
-      Logger.getAnonymousLogger().info("operation succeeded: " + requestId);
+      Logger.getAnonymousLogger().log(Level.INFO, "operation succeeded: {0}", requestId);
 
       assertTrue(cloudServiceGone.apply(cloudService), cloudService.toString());
-      Logger.getAnonymousLogger().info("cloudService deleted: " + cloudService);
+      Logger.getAnonymousLogger().log(Level.INFO, "cloudService deleted: {0}", cloudService);
    }
 
-   @Override @AfterClass(groups = "live", alwaysRun = true)
+   @Override
+   @AfterClass(groups = "live", alwaysRun = true)
    protected void tearDown() {
       String requestId = api().delete(CLOUD_SERVICE);
       if (requestId != null) {
@@ -109,20 +118,20 @@ public class CloudServiceApiLiveTest extends BaseAzureComputeApiLiveTest {
    public void testList() {
       List<CloudService> response = api().list();
 
-      for (CloudService cloudService : response) {
-         checkHostedService(cloudService);
+      for (CloudService cs : response) {
+         checkHostedService(cs);
       }
 
       if (!response.isEmpty()) {
-         CloudService cloudService = response.iterator().next();
-         assertEquals(api().get(cloudService.name()), cloudService);
+         CloudService cs = response.iterator().next();
+         assertEquals(api().get(cs.name()), cs);
       }
    }
 
    private void checkHostedService(CloudService cloudService) {
       assertNotNull(cloudService.name(), "ServiceName cannot be null for " + cloudService);
       assertTrue(cloudService.location() != null || cloudService.affinityGroup() != null,
-            "Location or AffinityGroup must be present for " + cloudService);
+              "Location or AffinityGroup must be present for " + cloudService);
       assertNotNull(cloudService.label(), "Label cannot be null for " + cloudService);
       assertNotNull(cloudService.status(), "Status cannot be null for " + cloudService);
       assertNotEquals(cloudService.status(), UNRECOGNIZED, "Status cannot be UNRECOGNIZED for " + cloudService);

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/CloudServiceApiMockTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/CloudServiceApiMockTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/CloudServiceApiMockTest.java
index 5e3028d..a929fff 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/CloudServiceApiMockTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/CloudServiceApiMockTest.java
@@ -17,18 +17,21 @@
 package org.jclouds.azurecompute.features;
 
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
 
 import org.jclouds.azurecompute.internal.BaseAzureComputeApiMockTest;
 import org.jclouds.azurecompute.xml.CloudServiceHandlerTest;
 import org.jclouds.azurecompute.xml.ListCloudServicesHandlerTest;
 import org.testng.annotations.Test;
 
+import com.squareup.okhttp.mockwebserver.MockResponse;
 import com.squareup.okhttp.mockwebserver.MockWebServer;
 
 @Test(groups = "unit", testName = "CloudServiceApiMockTest")
 public class CloudServiceApiMockTest extends BaseAzureComputeApiMockTest {
 
-   public void testList() throws Exception {
+   public void listWhenFound() throws Exception {
       MockWebServer server = mockAzureManagementServer();
       server.enqueue(xmlResponse("/hostedservices.xml"));
 
@@ -43,7 +46,22 @@ public class CloudServiceApiMockTest extends BaseAzureComputeApiMockTest {
       }
    }
 
-   public void testGet() throws Exception {
+   public void listWhenNotFound() throws Exception {
+      MockWebServer server = mockAzureManagementServer();
+      server.enqueue(new MockResponse().setResponseCode(404));
+
+      try {
+         CloudServiceApi api = api(server.getUrl("/")).getCloudServiceApi();
+
+         assertTrue(api.list().isEmpty());
+
+         assertSent(server, "GET", "/services/hostedservices?embed-detail=true");
+      } finally {
+         server.shutdown();
+      }
+   }
+
+   public void getWhenFound() throws Exception {
       MockWebServer server = mockAzureManagementServer();
       server.enqueue(xmlResponse("/hostedservice.xml"));
 
@@ -58,7 +76,22 @@ public class CloudServiceApiMockTest extends BaseAzureComputeApiMockTest {
       }
    }
 
-   public void testCreateWithLabelInLocation() throws Exception {
+   public void getWhenNotFound() throws Exception {
+      MockWebServer server = mockAzureManagementServer();
+      server.enqueue(new MockResponse().setResponseCode(404));
+
+      try {
+         CloudServiceApi api = api(server.getUrl("/")).getCloudServiceApi();
+
+         assertNull(api.get("myservice"));
+
+         assertSent(server, "GET", "/services/hostedservices/myservice?embed-detail=true");
+      } finally {
+         server.shutdown();
+      }
+   }
+
+   public void createWithLabelInLocation() throws Exception {
       MockWebServer server = mockAzureManagementServer();
       server.enqueue(requestIdResponse("request-1"));
 
@@ -73,7 +106,7 @@ public class CloudServiceApiMockTest extends BaseAzureComputeApiMockTest {
       }
    }
 
-   public void testDelete() throws Exception {
+   public void deleteWhenFound() throws Exception {
       MockWebServer server = mockAzureManagementServer();
       server.enqueue(requestIdResponse("request-1"));
 
@@ -88,4 +121,18 @@ public class CloudServiceApiMockTest extends BaseAzureComputeApiMockTest {
       }
    }
 
+   public void deleteWhenNotFound() throws Exception {
+      MockWebServer server = mockAzureManagementServer();
+      server.enqueue(new MockResponse().setResponseCode(404));
+
+      try {
+         CloudServiceApi api = api(server.getUrl("/")).getCloudServiceApi();
+
+         assertNull(api.delete("myservice"));
+
+         assertSent(server, "DELETE", "/services/hostedservices/myservice");
+      } finally {
+         server.shutdown();
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/DeploymentApiLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/DeploymentApiLiveTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/DeploymentApiLiveTest.java
index 9b47cd7..7c8d865 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/DeploymentApiLiveTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/DeploymentApiLiveTest.java
@@ -21,6 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.jclouds.util.Predicates2.retry;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
+
 import java.util.logging.Logger;
 
 import org.jclouds.azurecompute.compute.AzureComputeServiceAdapter;
@@ -36,31 +37,47 @@ import org.testng.annotations.Test;
 
 import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
+import java.util.List;
+import java.util.logging.Level;
+import org.jclouds.azurecompute.domain.Role;
+import org.jclouds.azurecompute.util.ConflictManagementPredicate;
 
 @Test(groups = "live", testName = "DeploymentApiLiveTest", singleThreaded = true)
 public class DeploymentApiLiveTest extends BaseAzureComputeApiLiveTest {
 
-   private static final String CLOUD_SERVICE = (System.getProperty("user.name") + "cloudservice").toLowerCase();
-   private static final String DEPLOYMENT = DeploymentApiLiveTest.class.getSimpleName().toLowerCase();
+   private static final String CLOUD_SERVICE = String.format("%s%d-%s",
+           System.getProperty("user.name"), RAND, DeploymentApiLiveTest.class.getSimpleName()).toLowerCase();
+
+   private static final String DEPLOYMENT = String.format("%s%d-%s",
+           System.getProperty("user.name"), RAND, DeploymentApiLiveTest.class.getSimpleName()).toLowerCase();
 
    private Predicate<Deployment> deploymentCreated;
+
    private Predicate<Deployment> deploymentGone;
 
    private Deployment deployment;
+
    private CloudService cloudService;
 
-   @BeforeClass(groups = { "integration", "live" })
+   @BeforeClass(groups = {"integration", "live"})
+   @Override
    public void setup() {
       super.setup();
-      cloudService = getOrCreateCloudService(CLOUD_SERVICE, location);
+
+      cloudService = getOrCreateCloudService(CLOUD_SERVICE, LOCATION);
 
       deploymentCreated = retry(new Predicate<Deployment>() {
-         public boolean apply(Deployment input) {
+
+         @Override
+         public boolean apply(final Deployment input) {
             return api().get(input.name()).status() == Deployment.Status.RUNNING;
          }
       }, 600, 5, 5, SECONDS);
+
       deploymentGone = retry(new Predicate<Deployment>() {
-         public boolean apply(Deployment input) {
+
+         @Override
+         public boolean apply(final Deployment input) {
             return api().get(input.name()) == null;
          }
       }, 600, 5, 5, SECONDS);
@@ -70,7 +87,7 @@ public class DeploymentApiLiveTest extends BaseAzureComputeApiLiveTest {
       final DeploymentParams params = DeploymentParams.builder()
               .name(DEPLOYMENT)
               .os(OSImage.Type.LINUX)
-              .sourceImageName("b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20150123-en-us-30GB")
+              .sourceImageName(DeploymentApiLiveTest.IMAGE_NAME)
               .mediaLink(AzureComputeServiceAdapter.createMediaLink(storageService.serviceName(), DEPLOYMENT))
               .username("test")
               .password("supersecurePassword1!")
@@ -103,27 +120,45 @@ public class DeploymentApiLiveTest extends BaseAzureComputeApiLiveTest {
 
    @Test(dependsOnMethods = "testGet")
    public void testDelete() {
-      String requestId = api().delete(deployment.name());
-      assertTrue(operationSucceeded.apply(requestId), requestId);
-      Logger.getAnonymousLogger().info("operation succeeded: " + requestId);
+      final List<Role> roles = api.getDeploymentApiForService(cloudService.name()).get(DEPLOYMENT).roles();
+
+      retry(new ConflictManagementPredicate(operationSucceeded) {
+
+         @Override
+         protected String operation() {
+            return api().delete(deployment.name());
+         }
+      }, 600, 30, 30, SECONDS).apply(deployment.name());
 
       assertTrue(deploymentGone.apply(deployment), deployment.toString());
-      Logger.getAnonymousLogger().info("deployment deleted: " + deployment);
+      Logger.getAnonymousLogger().log(Level.INFO, "deployment deleted: {0}", deployment);
+
+      retry(new ConflictManagementPredicate(operationSucceeded) {
+
+         @Override
+         protected String operation() {
+            return api.getCloudServiceApi().delete(cloudService.name());
+         }
+      }, 600, 30, 30, SECONDS).apply(cloudService.name());
+
+      for (Role r : roles) {
+         final Role.OSVirtualHardDisk disk = r.osVirtualHardDisk();
+         if (disk != null) {
+            retry(new ConflictManagementPredicate(operationSucceeded) {
+
+               @Override
+               protected String operation() {
+                  return api.getDiskApi().delete(disk.diskName());
+               }
+            }, 600, 30, 30, SECONDS).apply(disk.diskName());
+         }
+      }
    }
 
-   @Override @AfterClass(groups = "live", alwaysRun = true)
+   @Override
+   @AfterClass(groups = "live", alwaysRun = true)
    protected void tearDown() {
       super.tearDown();
-      if (api().get(DEPLOYMENT) != null) {
-         String requestId = api().delete(deployment.name());
-         operationSucceeded.apply(requestId);
-         Logger.getAnonymousLogger().info("deployment deleted: " + deployment);
-      }
-      if (api.getCloudServiceApi().get(CLOUD_SERVICE) != null) {
-         String requestId = api.getCloudServiceApi().delete(CLOUD_SERVICE);
-         assertTrue(operationSucceeded.apply(requestId), requestId);
-         Logger.getAnonymousLogger().info("cloudservice deleted: " + CLOUD_SERVICE);
-      }
    }
 
    private DeploymentApi api() {

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/DiskApiLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/DiskApiLiveTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/DiskApiLiveTest.java
index e943878..e987482 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/DiskApiLiveTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/DiskApiLiveTest.java
@@ -34,19 +34,25 @@ import com.google.common.collect.ImmutableSet;
 public class DiskApiLiveTest extends BaseAzureComputeApiLiveTest {
 
    private ImmutableSet<String> locations;
+
    private ImmutableSet<String> images;
 
-   @BeforeClass(groups = { "integration", "live" })
+   @BeforeClass(groups = {"integration", "live"})
+   @Override
    public void setup() {
       super.setup();
 
       locations = ImmutableSet.copyOf(transform(api.getLocationApi().list(),
-               new Function<Location, String>() {
-                  public String apply(Location in) {
-                     return in.name();
-                  }
-               }));
+              new Function<Location, String>() {
+
+                 @Override
+                 public String apply(Location in) {
+                    return in.name();
+                 }
+              }));
       images = ImmutableSet.copyOf(transform(api.getOSImageApi().list(), new Function<OSImage, String>() {
+
+         @Override
          public String apply(OSImage in) {
             return in.name();
          }
@@ -60,7 +66,6 @@ public class DiskApiLiveTest extends BaseAzureComputeApiLiveTest {
    }
 
    // TODO testDeleteDisk, if we will need testCreateDisk
-
    private void checkDisk(Disk disk) {
       assertNotNull(disk.name(), "Name cannot be null for: " + disk);
 
@@ -74,7 +79,7 @@ public class DiskApiLiveTest extends BaseAzureComputeApiLiveTest {
 
       if (disk.mediaLink() != null) {
          assertTrue(ImmutableSet.of("http", "https").contains(disk.mediaLink().getScheme()),
-               "MediaLink should be an http(s) url" + disk);
+                 "MediaLink should be an http(s) url" + disk);
       }
 
       if (disk.location() != null) {

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/LocationApiLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/LocationApiLiveTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/LocationApiLiveTest.java
index d270442..e73b995 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/LocationApiLiveTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/LocationApiLiveTest.java
@@ -30,9 +30,10 @@ import org.testng.annotations.Test;
 public class LocationApiLiveTest extends BaseAzureComputeApiLiveTest {
 
    private static final List<String> KNOWN_SERVICES = Arrays
-         .asList("Compute", "Storage", "PersistentVMRole", "HighMemory");
+           .asList("Compute", "Storage", "PersistentVMRole", "HighMemory");
 
-   @Test public void testList() {
+   @Test
+   public void testList() {
       for (Location location : api().list()) {
          checkLocation(location);
       }
@@ -43,7 +44,7 @@ public class LocationApiLiveTest extends BaseAzureComputeApiLiveTest {
       assertNotNull(location.displayName(), "DisplayName cannot be null for: " + location);
       assertNotNull(location.availableServices(), "AvailableServices cannot be null for: " + location.name());
       assertTrue(KNOWN_SERVICES.containsAll(location.availableServices()),
-            "AvailableServices in " + location + " didn't match: " + KNOWN_SERVICES);
+              "AvailableServices in " + location + " didn't match: " + KNOWN_SERVICES);
    }
 
    private LocationApi api() {

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiLiveTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiLiveTest.java
index e965a21..07d3dba 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiLiveTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiLiveTest.java
@@ -22,6 +22,8 @@ import static org.testng.Assert.assertNotEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
+import java.util.List;
+
 import org.jclouds.azurecompute.domain.Location;
 import org.jclouds.azurecompute.domain.OSImage;
 import org.jclouds.azurecompute.internal.BaseAzureComputeApiLiveTest;
@@ -29,6 +31,7 @@ import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 import com.google.common.base.Function;
+import com.google.common.base.Splitter;
 import com.google.common.collect.ImmutableSet;
 
 @Test(groups = "live", testName = "OSImageApiLiveTest")
@@ -36,43 +39,47 @@ public class OSImageApiLiveTest extends BaseAzureComputeApiLiveTest {
 
    private ImmutableSet<String> locations;
 
-   @BeforeClass(groups = { "integration", "live" })
+   @BeforeClass(groups = {"integration", "live"})
+   @Override
    public void setup() {
       super.setup();
 
       locations = ImmutableSet.copyOf(transform(api.getLocationApi().list(), new Function<Location, String>() {
-         public String apply(Location in) {
+
+         @Override
+         public String apply(final Location in) {
             return in.name();
          }
       }));
    }
 
    public void testList() {
-      for (OSImage OSImage : api().list()) {
-         checkOSImage(OSImage);
+      for (OSImage osImage : api().list()) {
+         checkOSImage(osImage);
       }
    }
 
-   private void checkOSImage(OSImage OSImage) {
-      assertNotNull(OSImage.label(), "Label cannot be null for " + OSImage);
-      assertNotNull(OSImage.name(), "Name cannot be null for " + OSImage);
-      assertNotNull(OSImage.os(), "OS cannot be null for " + OSImage);
-      assertTrue(OSImage.logicalSizeInGB() > 0, "LogicalSizeInGB should be positive, if set" + OSImage);
+   private void checkOSImage(final OSImage osImage) {
+      assertNotNull(osImage.label(), "Label cannot be null for " + osImage);
+      assertNotNull(osImage.name(), "Name cannot be null for " + osImage);
+      assertNotNull(osImage.os(), "OS cannot be null for " + osImage);
+      assertTrue(osImage.logicalSizeInGB() > 0, "LogicalSizeInGB should be positive, if set" + osImage);
 
-      if (OSImage.category() != null) {
-         assertNotEquals("", OSImage.category().trim(), "Invalid Category for " + OSImage);
+      if (osImage.category() != null) {
+         assertNotEquals("", osImage.category().trim(), "Invalid Category for " + osImage);
       }
 
-      if (OSImage.mediaLink() != null) {
-         assertTrue(ImmutableSet.of("http", "https").contains(OSImage.mediaLink().getScheme()),
-               "MediaLink should be an http(s) url" + OSImage);
+      if (osImage.mediaLink() != null) {
+         assertTrue(ImmutableSet.of("http", "https").contains(osImage.mediaLink().getScheme()),
+                 "MediaLink should be an http(s) url" + osImage);
       }
 
-      assertTrue(locations.contains(OSImage.location()), "Locations not in " + locations + " :" + OSImage);
+      List<String> osImageLocations = Splitter.on(';').splitToList(osImage.location());
+      assertTrue(locations.containsAll(osImageLocations), "Locations not in " + locations + " :" + osImageLocations);
 
       // Ex. Dirty data in RightScale eula field comes out as an empty string.
-      assertFalse(OSImage.eula().contains(""));
-      if (OSImage.affinityGroup() != null) {
+      assertFalse(osImage.eula().contains(""));
+      if (osImage.affinityGroup() != null) {
          // TODO: list getAffinityGroups and check if there
       }
    }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiMockTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiMockTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiMockTest.java
index 3f2b196..2483ce4 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiMockTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/OSImageApiMockTest.java
@@ -53,7 +53,7 @@ public class OSImageApiMockTest extends BaseAzureComputeApiMockTest {
          OSImageApi api = api(server.getUrl("/")).getOSImageApi();
 
          OSImageParams params = OSImageParams.builder().name("myimage").label("foo").os(OSImage.Type.LINUX)
-               .mediaLink(URI.create("http://example.blob.core.windows.net/disks/mydisk.vhd")).build();
+                 .mediaLink(URI.create("http://example.blob.core.windows.net/disks/mydisk.vhd")).build();
 
          assertEquals(api.add(params), "request-1");
 
@@ -71,7 +71,7 @@ public class OSImageApiMockTest extends BaseAzureComputeApiMockTest {
          OSImageApi api = api(server.getUrl("/")).getOSImageApi();
 
          OSImageParams params = OSImageParams.builder().name("myimage").label("foo").os(OSImage.Type.LINUX)
-               .mediaLink(URI.create("http://example.blob.core.windows.net/disks/mydisk.vhd")).build();
+                 .mediaLink(URI.create("http://example.blob.core.windows.net/disks/mydisk.vhd")).build();
 
          assertEquals(api.update(params), "request-1");
 

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/OperationApiMockTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/OperationApiMockTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/OperationApiMockTest.java
index e3f2814..f155f33 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/OperationApiMockTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/OperationApiMockTest.java
@@ -28,14 +28,12 @@ import com.squareup.okhttp.mockwebserver.MockWebServer;
 public class OperationApiMockTest extends BaseAzureComputeApiMockTest {
 
    public void testGet() throws Exception {
-      MockWebServer server = mockAzureManagementServer();
+      final MockWebServer server = mockAzureManagementServer();
       server.enqueue(xmlResponse("/operation.xml"));
 
       try {
-         OperationApi api = api(server.getUrl("/")).getOperationApi();
-
+         final OperationApi api = api(server.getUrl("/")).getOperationApi();
          assertEquals(api.get("request-id"), OperationHandlerTest.expected());
-
          assertSent(server, "GET", "/operations/request-id");
       } finally {
          server.shutdown();

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/SubscriptionApiLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/SubscriptionApiLiveTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/SubscriptionApiLiveTest.java
index 0bbbdb2..a0a29a6 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/SubscriptionApiLiveTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/SubscriptionApiLiveTest.java
@@ -24,7 +24,8 @@ import org.testng.annotations.Test;
 @Test(groups = "live", testName = "SubscriptionApiLiveTest")
 public class SubscriptionApiLiveTest extends BaseAzureComputeApiLiveTest {
 
-   @Test public void testList() {
+   @Test
+   public void testList() {
       for (RoleSize roleSize : api().listRoleSizes()) {
          checkLocation(roleSize);
       }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualMachineApiLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualMachineApiLiveTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualMachineApiLiveTest.java
index d61f085..76bd2b7 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualMachineApiLiveTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualMachineApiLiveTest.java
@@ -20,6 +20,12 @@ import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.jclouds.azurecompute.domain.Deployment.InstanceStatus.READY_ROLE;
 import static org.jclouds.util.Predicates2.retry;
 import static org.testng.Assert.assertTrue;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+import java.util.List;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.jclouds.azurecompute.compute.AzureComputeServiceAdapter;
@@ -31,30 +37,36 @@ import org.jclouds.azurecompute.domain.OSImage;
 import org.jclouds.azurecompute.domain.Role;
 import org.jclouds.azurecompute.domain.RoleSize;
 import org.jclouds.azurecompute.internal.BaseAzureComputeApiLiveTest;
+import org.jclouds.azurecompute.util.ConflictManagementPredicate;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-
 @Test(groups = "live", testName = "VirtualMachineApiLiveTest", singleThreaded = true)
 public class VirtualMachineApiLiveTest extends BaseAzureComputeApiLiveTest {
 
-   private static final String CLOUD_SERVICE = (System.getProperty("user.name") + "-jclouds-cloudService").toLowerCase();
-   private static final String DEPLOYMENT = DeploymentApiLiveTest.class.getSimpleName().toLowerCase();
+   private static final String CLOUD_SERVICE = String.format("%s%d-%s",
+           System.getProperty("user.name"), RAND, VirtualMachineApiLiveTest.class.getSimpleName()).toLowerCase();
+
+   private static final String DEPLOYMENT = String.format("%s%d-%s",
+           System.getProperty("user.name"), RAND, VirtualMachineApiLiveTest.class.getSimpleName()).toLowerCase();
 
    private String roleName;
+
    private Predicate<String> roleInstanceReady;
+
    private Predicate<String> roleInstanceStopped;
+
    private CloudService cloudService;
 
-   @BeforeClass(groups = { "integration", "live" })
+   @BeforeClass(groups = {"integration", "live"})
+   @Override
    public void setup() {
       super.setup();
-      cloudService = getOrCreateCloudService(CLOUD_SERVICE, location);
+      cloudService = getOrCreateCloudService(CLOUD_SERVICE, LOCATION);
 
       roleInstanceReady = retry(new Predicate<String>() {
+
          @Override
          public boolean apply(String input) {
             RoleInstance roleInstance = getFirstRoleInstanceInDeployment(input);
@@ -63,6 +75,7 @@ public class VirtualMachineApiLiveTest extends BaseAzureComputeApiLiveTest {
       }, 600, 5, 5, SECONDS);
 
       roleInstanceStopped = retry(new Predicate<String>() {
+
          @Override
          public boolean apply(String input) {
             RoleInstance roleInstance = getFirstRoleInstanceInDeployment(input);
@@ -73,7 +86,7 @@ public class VirtualMachineApiLiveTest extends BaseAzureComputeApiLiveTest {
       final DeploymentParams params = DeploymentParams.builder()
               .name(DEPLOYMENT)
               .os(OSImage.Type.LINUX)
-              .sourceImageName("b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20150123-en-us-30GB")
+              .sourceImageName(BaseAzureComputeApiLiveTest.IMAGE_NAME)
               .mediaLink(AzureComputeServiceAdapter.createMediaLink(storageService.serviceName(), DEPLOYMENT))
               .username("test")
               .password("supersecurePassword1!")
@@ -89,64 +102,95 @@ public class VirtualMachineApiLiveTest extends BaseAzureComputeApiLiveTest {
    }
 
    public void testUpdate() {
-      Role role = api().getRole(roleName);
-      String requestId = api().updateRole(roleName,
-              Role.create(
-                      role.roleName(),
-                      role.roleType(),
-                      role.vmImage(),
-                      role.mediaLocation(),
-                      role.configurationSets(),
-                      role.resourceExtensionReferences(),
-                      role.availabilitySetName(),
-                      role.dataVirtualHardDisks(),
-                      role.osVirtualHardDisk(),
-                      role.roleSize(),
-                      role.provisionGuestAgent(),
-                      role.defaultWinRmCertificateThumbprint()));
-      assertTrue(operationSucceeded.apply(requestId), requestId);
-      Logger.getAnonymousLogger().info("operation succeeded: " + requestId);
+      final Role role = api().getRole(roleName);
+      retry(new ConflictManagementPredicate(operationSucceeded) {
+
+         @Override
+         protected String operation() {
+            return api().updateRole(roleName,
+                    Role.create(
+                            role.roleName(),
+                            role.roleType(),
+                            role.vmImage(),
+                            role.mediaLocation(),
+                            role.configurationSets(),
+                            role.resourceExtensionReferences(),
+                            role.availabilitySetName(),
+                            role.dataVirtualHardDisks(),
+                            role.osVirtualHardDisk(),
+                            role.roleSize(),
+                            role.provisionGuestAgent(),
+                            role.defaultWinRmCertificateThumbprint()));
+         }
+      }, 600, 30, 30, SECONDS).apply(role.roleName());
    }
 
    @Test(dependsOnMethods = "testUpdate")
    public void testShutdown() {
       String requestId = api().shutdown(roleName);
       assertTrue(operationSucceeded.apply(requestId), requestId);
-      Logger.getAnonymousLogger().info("operation succeeded: " + requestId);
+      Logger.getAnonymousLogger().log(Level.INFO, "operation succeeded: {0}", requestId);
 
       RoleInstance roleInstance = getFirstRoleInstanceInDeployment(DEPLOYMENT);
       assertTrue(roleInstanceStopped.apply(DEPLOYMENT), roleInstance.toString());
-      Logger.getAnonymousLogger().info("roleInstance stopped: " + roleInstance);
+      Logger.getAnonymousLogger().log(Level.INFO, "roleInstance stopped: {0}", roleInstance);
    }
 
    @Test(dependsOnMethods = "testShutdown")
    public void testStart() {
       String requestId = api().start(roleName);
       assertTrue(operationSucceeded.apply(requestId), requestId);
-      Logger.getAnonymousLogger().info("operation succeeded: " + requestId);
+      Logger.getAnonymousLogger().log(Level.INFO, "operation succeeded: {0}", requestId);
 
       RoleInstance roleInstance = getFirstRoleInstanceInDeployment(DEPLOYMENT);
       assertTrue(roleInstanceReady.apply(DEPLOYMENT), roleInstance.toString());
-      Logger.getAnonymousLogger().info("roleInstance started: " + roleInstance);
+      Logger.getAnonymousLogger().log(Level.INFO, "roleInstance started: {0}", roleInstance);
    }
 
    @Test(dependsOnMethods = "testStart")
    public void testRestart() {
-      String requestId = api().restart(roleName);
+      final String requestId = api().restart(roleName);
       assertTrue(operationSucceeded.apply(requestId), requestId);
-      Logger.getAnonymousLogger().info("operation succeeded: " + requestId);
+      Logger.getAnonymousLogger().log(Level.INFO, "operation succeeded: {0}", requestId);
 
-      RoleInstance roleInstance = getFirstRoleInstanceInDeployment(DEPLOYMENT);
+      final RoleInstance roleInstance = getFirstRoleInstanceInDeployment(DEPLOYMENT);
       assertTrue(roleInstanceReady.apply(DEPLOYMENT), roleInstance.toString());
-      Logger.getAnonymousLogger().info("roleInstance restarted: " + roleInstance);
+      Logger.getAnonymousLogger().log(Level.INFO, "roleInstance restarted: {0}", roleInstance);
    }
 
    @AfterClass(alwaysRun = true)
    public void cleanup() {
-      if (api.getDeploymentApiForService(cloudService.name()).get(DEPLOYMENT) != null) {
-         String requestId = api.getDeploymentApiForService(cloudService.name()).delete(DEPLOYMENT);
-         operationSucceeded.apply(requestId);
-         Logger.getAnonymousLogger().info("deployment deleted: " + DEPLOYMENT);
+      if (cloudService != null && api.getDeploymentApiForService(cloudService.name()).get(DEPLOYMENT) != null) {
+         final List<Role> roles = api.getDeploymentApiForService(cloudService.name()).get(DEPLOYMENT).roles();
+
+         retry(new ConflictManagementPredicate(operationSucceeded) {
+
+            @Override
+            protected String operation() {
+               return api.getDeploymentApiForService(cloudService.name()).delete(DEPLOYMENT);
+            }
+         }, 600, 30, 30, SECONDS).apply(DEPLOYMENT);
+
+         retry(new ConflictManagementPredicate(operationSucceeded) {
+
+            @Override
+            protected String operation() {
+               return api.getCloudServiceApi().delete(cloudService.name());
+            }
+         }, 600, 30, 30, SECONDS).apply(cloudService.name());
+
+         for (Role r : roles) {
+            final Role.OSVirtualHardDisk disk = r.osVirtualHardDisk();
+            if (disk != null) {
+               retry(new ConflictManagementPredicate(operationSucceeded) {
+
+                  @Override
+                  protected String operation() {
+                     return api.getDiskApi().delete(disk.diskName());
+                  }
+               }, 600, 30, 30, SECONDS).apply(disk.diskName());
+            }
+         }
       }
    }
 
@@ -155,7 +199,8 @@ public class VirtualMachineApiLiveTest extends BaseAzureComputeApiLiveTest {
    }
 
    private RoleInstance getFirstRoleInstanceInDeployment(String deployment) {
-      return Iterables.getOnlyElement(api.getDeploymentApiForService(cloudService.name()).get(deployment).roleInstanceList());
+      return Iterables.getOnlyElement(api.getDeploymentApiForService(cloudService.name()).get(deployment).
+              roleInstanceList());
    }
 
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualMachineApiMockTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualMachineApiMockTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualMachineApiMockTest.java
index 6c1cc65..f6529d4 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualMachineApiMockTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualMachineApiMockTest.java
@@ -38,8 +38,8 @@ public class VirtualMachineApiMockTest extends BaseAzureComputeApiMockTest {
          assertThat(api.start("myvm")).isEqualTo("request-1");
 
          assertSent(server, "POST",
-               "/services/hostedservices/my-service/deployments/mydeployment/roleinstances/myvm/Operations",
-               "/startrolepayload.xml");
+                 "/services/hostedservices/my-service/deployments/mydeployment/roleinstances/myvm/Operations",
+                 "/startrolepayload.xml");
       } finally {
          server.shutdown();
       }
@@ -55,8 +55,8 @@ public class VirtualMachineApiMockTest extends BaseAzureComputeApiMockTest {
          assertThat(api.restart("myvm")).isEqualTo("request-1");
 
          assertSent(server, "POST",
-               "/services/hostedservices/my-service/deployments/mydeployment/roleinstances/myvm/Operations",
-               "/restartrolepayload.xml");
+                 "/services/hostedservices/my-service/deployments/mydeployment/roleinstances/myvm/Operations",
+                 "/restartrolepayload.xml");
       } finally {
          server.shutdown();
       }
@@ -72,8 +72,8 @@ public class VirtualMachineApiMockTest extends BaseAzureComputeApiMockTest {
          assertThat(api.shutdown("myvm")).isEqualTo("request-1");
 
          assertSent(server, "POST",
-               "/services/hostedservices/my-service/deployments/mydeployment/roleinstances/myvm/Operations",
-               "/shutdownrolepayload.xml");
+                 "/services/hostedservices/my-service/deployments/mydeployment/roleinstances/myvm/Operations",
+                 "/shutdownrolepayload.xml");
       } finally {
          server.shutdown();
       }
@@ -89,8 +89,8 @@ public class VirtualMachineApiMockTest extends BaseAzureComputeApiMockTest {
          assertThat(api.capture("myvm", "myImageName", "myImageLabel")).isEqualTo("request-1");
 
          assertSent(server, "POST",
-               "/services/hostedservices/my-service/deployments/mydeployment/roleinstances/myvm/Operations",
-               "/capturerolepayload.xml");
+                 "/services/hostedservices/my-service/deployments/mydeployment/roleinstances/myvm/Operations",
+                 "/capturerolepayload.xml");
       } finally {
          server.shutdown();
       }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualNetworkApiLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualNetworkApiLiveTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualNetworkApiLiveTest.java
index 601ea8b..06e1ab9 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualNetworkApiLiveTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualNetworkApiLiveTest.java
@@ -16,57 +16,79 @@
  */
 package org.jclouds.azurecompute.features;
 
-import static com.google.common.base.CaseFormat.LOWER_UNDERSCORE;
-import static com.google.common.base.CaseFormat.UPPER_CAMEL;
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.jclouds.azurecompute.internal.BaseAzureComputeApiLiveTest.VIRTUAL_NETWORK_NAME;
 import static org.jclouds.util.Predicates2.retry;
 import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.logging.Logger;
 
+import com.google.common.base.Predicates;
 import org.jclouds.azurecompute.domain.NetworkConfiguration;
-import org.jclouds.azurecompute.domain.NetworkConfiguration.VirtualNetworkConfiguration;
 import org.jclouds.azurecompute.domain.NetworkConfiguration.VirtualNetworkSite;
-import org.jclouds.azurecompute.domain.Operation;
 import org.jclouds.azurecompute.internal.BaseAzureComputeApiLiveTest;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Predicate;
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.jclouds.azurecompute.AzureTestUtils;
+import org.jclouds.azurecompute.util.ConflictManagementPredicate;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
 
 @Test(groups = "live", testName = "VirtualNetworkApiLiveTest", singleThreaded = true)
 public class VirtualNetworkApiLiveTest extends BaseAzureComputeApiLiveTest {
 
-   private NetworkConfiguration originalNetworkConfiguration;
-   private Predicate<String> operationSucceeded;
+   @BeforeSuite
+   @Override
+   public void setup() {
+      super.setup();
 
-   @BeforeClass
-   public void init() {
-      operationSucceeded = retry(new Predicate<String>() {
-         public boolean apply(String input) {
-            return api.getOperationApi().get(input).status() == Operation.Status.SUCCEEDED;
-         }
-      }, 600, 5, 5, SECONDS);
+      final List<VirtualNetworkSite> virtualNetworkSites = Lists.newArrayList(Iterables.filter(
+              AzureTestUtils.getVirtualNetworkSite(api),
+              new AzureTestUtils.SameVirtualNetworkSiteNamePredicate(VIRTUAL_NETWORK_NAME)));
+
+      final NetworkConfiguration.AddressSpace addressSpace = NetworkConfiguration.AddressSpace.create(
+              DEFAULT_ADDRESS_SPACE);
+
+      final ImmutableList<NetworkConfiguration.Subnet> subnets = ImmutableList.of(NetworkConfiguration.Subnet.create(
+              DEFAULT_SUBNET_NAME, DEFAULT_SUBNET_ADDRESS_SPACE, null));
 
-      originalNetworkConfiguration = api().getNetworkConfiguration();
+      final NetworkConfiguration networkConfiguration = api().getNetworkConfiguration();
+      assertThat(networkConfiguration.virtualNetworkConfiguration().dns()).isEqualTo(
+              networkConfiguration.virtualNetworkConfiguration().dns());
+
+      assertThat(virtualNetworkSites.size()).isEqualTo(1);
+      assertThat(virtualNetworkSites.get(0).name()).isEqualTo(VIRTUAL_NETWORK_NAME);
+      assertThat(virtualNetworkSites.get(0).location()).isEqualTo(LOCATION);
+      assertThat(virtualNetworkSites.get(0).addressSpace()).isEqualTo(addressSpace);
+      assertThat(virtualNetworkSites.get(0).subnets()).isEqualTo(subnets);
    }
 
-   @AfterClass(alwaysRun = true)
-   public void cleanup() {
-      if (originalNetworkConfiguration != null) {
-         api().set(originalNetworkConfiguration);
-      } else {
-         api().set(NetworkConfiguration.create(VirtualNetworkConfiguration.create(null, ImmutableList.<VirtualNetworkSite>of())));
-      }
+   @AfterSuite
+   @Override
+   protected void tearDown() {
+      super.tearDown();
+
+      final List<VirtualNetworkSite> virtualNetworkSites = Lists.newArrayList(Iterables.filter(api.
+              getVirtualNetworkApi().list(),
+              Predicates.not(new AzureTestUtils.SameVirtualNetworkSiteNamePredicate(VIRTUAL_NETWORK_NAME))));
+
+      retry(new ConflictManagementPredicate(operationSucceeded) {
+
+         @Override
+         protected String operation() {
+            return api.getVirtualNetworkApi().set(NetworkConfiguration.create(
+                    NetworkConfiguration.VirtualNetworkConfiguration.create(null, virtualNetworkSites)));
+         }
+      }, 600, 30, 30, SECONDS).apply(VIRTUAL_NETWORK_NAME);
    }
 
-   @Test public void testList() {
-      for (VirtualNetworkSite virtualNetworkSite : api().list()) {
-         checkVirtualNetworkSite(virtualNetworkSite);
+   @Test
+   public void testList() {
+      for (VirtualNetworkSite vns : api().list()) {
+         checkVirtualNetworkSite(vns);
       }
    }
 
@@ -76,32 +98,12 @@ public class VirtualNetworkApiLiveTest extends BaseAzureComputeApiLiveTest {
       assertNotNull(virtualNetworkSite.subnets(), "Subnets cannot be null for: " + virtualNetworkSite);
    }
 
-   @Test public void testSet() {
-      String id = "39d0d14b-fc1d-496f-8928-b5a13a6f4123";
-      final String name = UPPER_CAMEL.to(LOWER_UNDERSCORE, getClass().getSimpleName());
-      final String location = "West Europe";
-      final NetworkConfiguration.AddressSpace addressSpace = NetworkConfiguration.AddressSpace.create("10.0.0.1/20");
-      final ImmutableList<NetworkConfiguration.Subnet> subnets = ImmutableList.of(NetworkConfiguration.Subnet.create("Subnet-jclouds", "10.0.0.1/23", null));
-      final VirtualNetworkSite virtualNetworkSite = VirtualNetworkSite.create(id, name, location, addressSpace, subnets);
-      String requestId = api().set(NetworkConfiguration.create(VirtualNetworkConfiguration.create(null, ImmutableList.of(virtualNetworkSite))));
-      assertTrue(operationSucceeded.apply(requestId), requestId);
-      Logger.getAnonymousLogger().info("operation succeeded: " + requestId);
-
-      final NetworkConfiguration networkConfiguration = api().getNetworkConfiguration();
-      assertThat(networkConfiguration.virtualNetworkConfiguration().dns()).isEqualTo(networkConfiguration.virtualNetworkConfiguration().dns());
-      assertThat(networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites().size()).isEqualTo(1);
-      assertThat(networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites().get(0).name()).isEqualTo(name);
-      assertThat(networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites().get(0).location()).isEqualTo(location);
-      assertThat(networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites().get(0).addressSpace()).isEqualTo(addressSpace);
-      assertThat(networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites().get(0).subnets()).isEqualTo(subnets);
-   }
-
-   @Test(dependsOnMethods = "testSet")
+   @Test
    public void testGetNetworkConfiguration() {
       final NetworkConfiguration networkConfiguration = api().getNetworkConfiguration();
       assertThat(networkConfiguration).isNotNull();
-      for (VirtualNetworkSite virtualNetworkSite : networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites()) {
-         assertThat(virtualNetworkSite.name()).isNotEqualTo("not-existing");
+      for (VirtualNetworkSite vns : networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites()) {
+         assertThat(vns.name()).isNotEqualTo("not-existing");
       }
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/c80d40a5/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualNetworkApiMockTest.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualNetworkApiMockTest.java b/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualNetworkApiMockTest.java
index c55884d..85f13af 100644
--- a/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualNetworkApiMockTest.java
+++ b/azurecompute/src/test/java/org/jclouds/azurecompute/features/VirtualNetworkApiMockTest.java
@@ -58,13 +58,13 @@ public class VirtualNetworkApiMockTest extends BaseAzureComputeApiMockTest {
          assertThat(api.set(NetworkConfiguration.create(
                  VirtualNetworkConfiguration.create(null,
                          ImmutableList.of(NetworkConfiguration.VirtualNetworkSite.create(
-                                 UUID.randomUUID().toString(),
-                                 "jclouds-virtual-network",
-                                 "West Europe",
-                                 NetworkConfiguration.AddressSpace.create("10.0.0.0/20"),
-                                 ImmutableList.of(NetworkConfiguration.Subnet.create("jclouds-1", "10.0.0.0/23",
-                                         null)))))))
-                 ).isEqualTo("request-1");
+                                         UUID.randomUUID().toString(),
+                                         "jclouds-virtual-network",
+                                         "West Europe",
+                                         NetworkConfiguration.AddressSpace.create("10.0.0.0/20"),
+                                         ImmutableList.of(NetworkConfiguration.Subnet.create("jclouds-1", "10.0.0.0/23",
+                                                         null)))))))
+         ).isEqualTo("request-1");
 
          assertSent(server, "PUT", "/services/networking/media");
       } finally {
@@ -88,7 +88,6 @@ public class VirtualNetworkApiMockTest extends BaseAzureComputeApiMockTest {
       }
    }
 
-
    private VirtualNetworkApi virtualNetworkApi(MockWebServer server) {
       return api(server.getUrl("/")).getVirtualNetworkApi();
    }