Updated Branches:
  refs/heads/1.6.x 4ffff0465 -> bbe80c1e0

JCLOUDS-199. CloudStack live tests against ACS 4.2 simulator cleanup.

- ACS 4.x doesn't like taking SSH pub keys from the filesystem, so
    generate them on the fly.
- vm.getDisplayName() can be null now.
- Add new possible resource limit types.
- Default to looking template=osFamily=CENTOS, since that's the only
    template guaranteed to be there in the simulator.
- Use adminJobComplete instead of jobComplete in admin tests
- Accept capacity/usage/etc of 0.
- Premium configuration category not present in ACS.
- Sleep a bit between deleting a domain and verifying it's not there
    any more. Also expect an IllegalStateException.
- Given that there are issues deleting zones at the moment (through
    the UI, too), use a different zone for pod and zone tests.

Still failing tests:
- pretty much everything that creates a VM and expects to log into it,
    but that's simulator-specific.
- Zone deletion, due to a bug in ACS, apparently.
- Registering and creating templates
- creating volumes from snapshots, and attaching volumes


Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/commit/bbe80c1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/tree/bbe80c1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/diff/bbe80c1e

Branch: refs/heads/1.6.x
Commit: bbe80c1e0b64b72d7fc393a725663f2a904e5dea
Parents: 4ffff04
Author: Andrew Bayer <[email protected]>
Authored: Mon Jul 22 13:15:50 2013 -0700
Committer: Andrew Bayer <[email protected]>
Committed: Mon Jul 22 13:15:50 2013 -0700

----------------------------------------------------------------------
 apis/cloudstack/pom.xml                         |  2 +-
 .../functions/VirtualMachineToNodeMetadata.java |  4 +-
 .../cloudstack/domain/ResourceLimit.java        | 29 ++++++++++++++
 ...CloudStackComputeServiceAdapterLiveTest.java |  4 +-
 .../features/DomainAccountClientLiveTest.java   |  2 +-
 .../features/DomainUserClientLiveTest.java      |  2 +-
 .../features/GlobalAlertClientLiveTest.java     |  2 +-
 .../features/GlobalCapacityClientLiveTest.java  |  4 +-
 .../GlobalConfigurationClientLiveTest.java      |  3 +-
 .../features/GlobalDomainClientLiveTest.java    |  5 ++-
 .../features/GlobalHostClientLiveTest.java      |  1 -
 .../features/GlobalPodClientLiveTest.java       |  6 +--
 .../features/GlobalUsageClientLiveTest.java     |  2 +-
 .../features/GlobalVlanClientLiveTest.java      | 40 ++++++++++----------
 .../features/VirtualMachineClientLiveTest.java  |  3 +-
 .../resources/listresourcelimitsresponse.json   | 10 ++++-
 16 files changed, 79 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/pom.xml
----------------------------------------------------------------------
diff --git a/apis/cloudstack/pom.xml b/apis/cloudstack/pom.xml
index 73af2e5..9b8b1b3 100644
--- a/apis/cloudstack/pom.xml
+++ b/apis/cloudstack/pom.xml
@@ -55,7 +55,7 @@
     <test.cloudstack.domainAdminCredential />
     <test.cloudstack.globalAdminIdentity />
     <test.cloudstack.globalAdminCredential />
-    <test.cloudstack.template />
+    <test.cloudstack.template>osFamily=CENTOS</test.cloudstack.template>
     
<jclouds.osgi.export>org.jclouds.cloudstack*;version="${project.version}"</jclouds.osgi.export>
     <jclouds.osgi.import>
       org.jclouds.compute.internal;version="${project.version}",

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java
 
b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java
index ac0096a..c0c373e 100644
--- 
a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java
+++ 
b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java
@@ -104,7 +104,9 @@ public class VirtualMachineToNodeMetadata implements 
Function<VirtualMachine, No
       // on hosts not started with jclouds
       builder.hostname(from.getDisplayName());
       
builder.location(FluentIterable.from(locations.get()).firstMatch(idEquals(from.getZoneId())).orNull());
-      
builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getDisplayName()));
+      if (from.getDisplayName() != null) {
+         
builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getDisplayName()));
+      }
       Image image = FluentIterable.from(images.get()).firstMatch(new 
Predicate<Image>() {
          @Override
          public boolean apply(Image input) {

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java
 
b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java
index 87af13f..927ca81 100644
--- 
a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java
+++ 
b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/ResourceLimit.java
@@ -60,6 +60,35 @@ public class ResourceLimit {
        * 4 - Template. Number of templates that a user can register/create.
        */
       TEMPLATE(4),
+      /**
+       * 5 - Projects.
+       */
+      PROJECT(5),
+      /**
+       * 6 - Networks.
+       */
+      NETWORK(6),
+      /**
+       * 7 - VPC. Number of VPC the user can own.
+       */
+      VPC(7),
+      /**
+       * 8 - CPU. The number of CPUs the user can allocate.
+       */
+      CPU(8),
+      /**
+       * 9 - Memory. The amount of memory the user can allocate.
+       */
+      MEMORY(9),
+      /**
+       * 10 - Primary storage.
+       */
+      PRIMARY_STORAGE(10),
+      /**
+       * 11 - Secondary storage.
+       */
+      SECONDARY_STORAGE(11),
+
 
       UNRECOGNIZED(Integer.MAX_VALUE);
 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java
index 82efa60..abe0310 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java
@@ -64,7 +64,6 @@ import 
org.jclouds.cloudstack.suppliers.NetworksForCurrentUser;
 import org.jclouds.cloudstack.suppliers.ZoneIdToZoneSupplier;
 import org.jclouds.collect.Memoized;
 import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
-import org.jclouds.compute.ComputeTestUtils;
 import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
 import org.jclouds.compute.domain.NodeMetadata;
 import org.jclouds.compute.domain.Template;
@@ -73,6 +72,7 @@ import 
org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
 import org.jclouds.domain.Credentials;
 import org.jclouds.location.Provider;
 import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
+import org.jclouds.ssh.SshKeys;
 import org.testng.annotations.AfterGroups;
 import org.testng.annotations.BeforeGroups;
 import org.testng.annotations.Test;
@@ -116,7 +116,7 @@ public class CloudStackComputeServiceAdapterLiveTest 
extends BaseCloudStackClien
             CloudStackComputeServiceAdapter.class);
 
       keyPairName = prefix + "-adapter-test-keypair";
-      keyPair = ComputeTestUtils.setupKeyPair();
+      keyPair = SshKeys.generate();
 
       client.getSSHKeyPairClient().deleteSSHKeyPair(keyPairName);
       client.getSSHKeyPairClient().registerSSHKeyPair(keyPairName, 
keyPair.get("public"));

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainAccountClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainAccountClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainAccountClientLiveTest.java
index f4d81f5..9cd8c74 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainAccountClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainAccountClientLiveTest.java
@@ -46,7 +46,7 @@ public class DomainAccountClientLiveTest extends 
BaseCloudStackClientLiveTest {
          AsyncCreateResponse response = domainAdminClient.getAccountClient()
             .disableAccount(testAccount.getName(), testAccount.getDomainId(), 
false);
          assertNotNull(response);
-         assertTrue(jobComplete.apply(response.getJobId()));
+         assertTrue(adminJobComplete.apply(response.getJobId()));
 
          AsyncJob<Account> job = 
domainAdminClient.getAsyncJobClient().getAsyncJob(response.getJobId());
          assertEquals(job.getResult().getState(), Account.State.DISABLED);

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainUserClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainUserClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainUserClientLiveTest.java
index 4873aad..09885ce 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainUserClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/DomainUserClientLiveTest.java
@@ -69,7 +69,7 @@ public class DomainUserClientLiveTest extends 
BaseCloudStackClientLiveTest {
 
          AsyncCreateResponse response = 
domainAdminClient.getUserClient().disableUser(testUser.getId());
          assertNotNull(response);
-         assertTrue(jobComplete.apply(response.getJobId()));
+         assertTrue(adminJobComplete.apply(response.getJobId()));
 
          AsyncJob<User> job = 
domainAdminClient.getAsyncJobClient().getAsyncJob(response.getJobId());
          assertNotNull(job);

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAlertClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAlertClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAlertClientLiveTest.java
index 7119ac5..c5d61bc 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAlertClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalAlertClientLiveTest.java
@@ -39,7 +39,7 @@ public class GlobalAlertClientLiveTest extends 
BaseCloudStackClientLiveTest {
    public void testListAlerts() throws Exception {
       skipIfNotGlobalAdmin();
 
-      final Set<Alert> response = 
globalAdminClient.getAlertClient().listAlerts(ListAlertsOptions.Builder.id("20"));
+      final Set<Alert> response = 
globalAdminClient.getAlertClient().listAlerts();
       assert null != response;
       assertTrue(response.size() >= 0);
       int count = 0;

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalCapacityClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalCapacityClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalCapacityClientLiveTest.java
index 8809b60..cd95642 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalCapacityClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalCapacityClientLiveTest.java
@@ -43,8 +43,8 @@ public class GlobalCapacityClientLiveTest extends 
BaseCloudStackClientLiveTest {
       assertNotEquals(0, response.size());
       int count = 0;
       for (Capacity capacity : response) {
-         assertTrue(capacity.getCapacityTotal() > 0);
-         assertTrue(capacity.getCapacityUsed() > 0);
+         assertTrue(capacity.getCapacityTotal() >= 0);
+         assertTrue(capacity.getCapacityUsed() >= 0);
          assertTrue(capacity.getPercentUsed() >= 0);
          assertNotEquals(Capacity.Type.UNRECOGNIZED, capacity.getType());
          assertNotNull(capacity.getZoneName());

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalConfigurationClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalConfigurationClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalConfigurationClientLiveTest.java
index 00e3b86..bab39c7 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalConfigurationClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalConfigurationClientLiveTest.java
@@ -53,7 +53,7 @@ public class GlobalConfigurationClientLiveTest extends 
BaseCloudStackClientLiveT
          categories.add(entry.getCategory());
       }
 
-      assert categories.containsAll(ImmutableSet.<Object>of("Network", 
"Advanced", "Premium",
+      assert categories.containsAll(ImmutableSet.<Object>of("Network", 
"Advanced",
          "Storage", "Usage", "Snapshots", "Account Defaults", "Console Proxy", 
"Alert"));
    }
 
@@ -82,7 +82,6 @@ public class GlobalConfigurationClientLiveTest extends 
BaseCloudStackClientLiveT
       assertEquals(entry, 
getEntryByName(globalAdminClient.getConfigurationClient()
          .listConfigurationEntries(name(entry.getName())), entry.getName()));
       assert entry.getCategory() != null : entry;
-      assert entry.getDescription() != null : entry;
       assert entry.getName() != null : entry;
    }
 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalDomainClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalDomainClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalDomainClientLiveTest.java
index 8f75404..43f5c6c 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalDomainClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalDomainClientLiveTest.java
@@ -50,8 +50,8 @@ public class GlobalDomainClientLiveTest extends 
BaseCloudStackClientLiveTest {
       });
    }
 
-   @Test
-   public void testCreateUpdateDeleteDomain() {
+   @Test(expectedExceptions = IllegalStateException.class)
+   public void testCreateUpdateDeleteDomain() throws InterruptedException {
       skipIfNotDomainAdmin();
 
       Domain domain = null;
@@ -68,6 +68,7 @@ public class GlobalDomainClientLiveTest extends 
BaseCloudStackClientLiveTest {
             domainClient.deleteDomainAndAttachedResources(domain.getId());
          }
       }
+      Thread.sleep(5000);
       assertNull(domainClient.getDomainById(domain.getId()));
    }
 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java
index d861f53..0bbcc74 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java
@@ -56,7 +56,6 @@ public class GlobalHostClientLiveTest extends 
BaseCloudStackClientLiveTest {
          assert host.getAverageLoad() >= 0;
          assert host.getHypervisor() != null;
       }
-      assert host.getAllocationState() != null;
       assert host.getEvents() != null;
       if (host.getType() == Host.Type.SECONDARY_STORAGE_VM) {
          assert host.getName().startsWith("s-");

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java
index 1018bfd..3f54f6b 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java
@@ -78,14 +78,14 @@ public class GlobalPodClientLiveTest extends 
BaseCloudStackClientLiveTest {
    public void testCreatePod() {
       skipIfNotGlobalAdmin();
 
-      zone = globalAdminClient.getZoneClient().createZone(prefix + "-zone", 
NetworkType.BASIC, "8.8.8.8", "10.10.10.10");
+      zone = globalAdminClient.getZoneClient().createZone(prefix + 
"-zone-for-pod", NetworkType.BASIC, "8.8.8.8", "10.10.10.10");
       pod = globalAdminClient.getPodClient().createPod(prefix + "-pod", 
zone.getId(), "172.20.0.1", "172.20.0.250", "172.20.0.254", "255.255.255.0",
       CreatePodOptions.Builder.allocationState(AllocationState.ENABLED));
 
       assertNotNull(pod);
       assertEquals(pod.getName(), prefix + "-pod");
       assertEquals(pod.getZoneId(), zone.getId());
-      assertEquals(pod.getZoneName(), prefix + "-zone");
+      assertEquals(pod.getZoneName(), prefix + "-zone-for-pod");
       assertEquals(pod.getStartIp(), "172.20.0.1");
       assertEquals(pod.getEndIp(), "172.20.0.250");
       assertEquals(pod.getGateway(), "172.20.0.254");
@@ -107,7 +107,7 @@ public class GlobalPodClientLiveTest extends 
BaseCloudStackClientLiveTest {
       assertNotNull(updated);
       assertEquals(updated.getName(), prefix + "-updatedpod");
       assertEquals(updated.getZoneId(), zone.getId());
-      assertEquals(updated.getZoneName(), prefix + "-zone");
+      assertEquals(updated.getZoneName(), prefix + "-zone-for-pod");
       assertEquals(updated.getStartIp(), "172.21.0.129");
       assertEquals(updated.getEndIp(), "172.21.0.250");
       assertEquals(updated.getGateway(), "172.21.0.254");

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageClientLiveTest.java
index 018fe52..f0c04c8 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageClientLiveTest.java
@@ -54,7 +54,7 @@ public class GlobalUsageClientLiveTest extends 
BaseCloudStackClientLiveTest {
 
       Set<UsageRecord> records = 
globalAdminClient.getUsageClient().listUsageRecords(start, end, 
ListUsageRecordsOptions.NONE);
       assertNotNull(records);
-      assertTrue(records.size() > 0);
+      assertTrue(records.size() >= 0);
    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java
index b39b94f..4aacecb 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java
@@ -91,32 +91,34 @@ public class GlobalVlanClientLiveTest extends 
BaseCloudStackClientLiveTest {
       final Zone zone = Iterables.find(client.getZoneClient().listZones(), 
ZonePredicates.supportsAdvancedNetworks());
       final NetworkOffering offering = 
find(client.getOfferingClient().listNetworkOfferings(),
          NetworkOfferingPredicates.supportsGuestVirtualNetworks());
-      
-      Set<Network> suitableNetworks = 
Sets.filter(client.getNetworkClient().listNetworks(
-            
zoneId(zone.getId()).isSystem(false).trafficType(TrafficType.GUEST)),
-         new Predicate<Network>() {
+
+      if (offering != null) {
+         Set<Network> suitableNetworks = 
Sets.filter(client.getNetworkClient().listNetworks(
+                 
zoneId(zone.getId()).isSystem(false).trafficType(TrafficType.GUEST)),
+                 new Predicate<Network>() {
             @Override
             public boolean apply(Network network) {
                return network.getNetworkOfferingId().equals(offering.getId());
             }
          });
 
-      if (suitableNetworks.size() > 0) {
-         network = Iterables.get(suitableNetworks, 0);
-         usingExistingNetwork = true;
-         
-      } else if (network == null) {
-         network = client.getNetworkClient().createNetworkInZone(zone.getId(),
-            offering.getId(), "net-" + prefix, "jclouds test " + prefix);
-         usingExistingNetwork = false;
+         if (suitableNetworks.size() > 0) {
+            network = Iterables.get(suitableNetworks, 0);
+            usingExistingNetwork = true;
+
+         } else if (network == null) {
+            network = 
client.getNetworkClient().createNetworkInZone(zone.getId(),
+                    offering.getId(), "net-" + prefix, "jclouds test " + 
prefix);
+            usingExistingNetwork = false;
+         }
+
+         range = 
globalAdminClient.getVlanClient().createVlanIPRange("172.19.1.1", 
"172.19.1.199", CreateVlanIPRangeOptions.Builder
+                 .accountInDomain(user.getAccount(), user.getDomainId())
+                 .forVirtualNetwork(true)
+                 .vlan(1001)
+                 .networkId(network.getId())
+         );
       }
-
-      range = 
globalAdminClient.getVlanClient().createVlanIPRange("172.19.1.1", 
"172.19.1.199", CreateVlanIPRangeOptions.Builder
-         .accountInDomain(user.getAccount(), user.getDomainId())
-         .forVirtualNetwork(true)
-         .vlan(1001)
-         .networkId(network.getId())
-      );
    }
 
    @AfterGroups(groups = "live")

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineClientLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineClientLiveTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineClientLiveTest.java
index 15df50d..70c8f21 100644
--- 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineClientLiveTest.java
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineClientLiveTest.java
@@ -181,7 +181,7 @@ public class VirtualMachineClientLiveTest extends 
BaseCloudStackClientLiveTest {
       if (vm.getPassword() != null) {
          conditionallyCheckSSH();
       }
-      assert in(ImmutableSet.of("NetworkFilesystem", "IscsiLUN", "VMFS", 
"PreSetup"))
+      assert in(ImmutableSet.of("NetworkFilesystem", "IscsiLUN", "VMFS", 
"PreSetup", "ROOT"))
          .apply(vm.getRootDeviceType()) : vm;
       checkVm(vm);
    }
@@ -349,7 +349,6 @@ public class VirtualMachineClientLiveTest extends 
BaseCloudStackClientLiveTest {
       assertEquals(vm.getId(), 
client.getVirtualMachineClient().getVirtualMachine(vm.getId()).getId());
       assert vm.getId() != null : vm;
       assert vm.getName() != null : vm;
-      assert vm.getDisplayName() != null : vm;
       assert vm.getAccount() != null : vm;
       assert vm.getDomain() != null : vm;
       assert vm.getDomainId() != null : vm;

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bbe80c1e/apis/cloudstack/src/test/resources/listresourcelimitsresponse.json
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/resources/listresourcelimitsresponse.json 
b/apis/cloudstack/src/test/resources/listresourcelimitsresponse.json
index 4f70d9f..2b72c04 100644
--- a/apis/cloudstack/src/test/resources/listresourcelimitsresponse.json
+++ b/apis/cloudstack/src/test/resources/listresourcelimitsresponse.json
@@ -1 +1,9 @@
-{ "listresourcelimitsresponse" : { "count":5 ,"resourcelimit" : [  
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"0","max":-1},
 
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"1","max":-1},
 
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"2","max":-1},
 
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"3","max":-1},
 
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"4","max":-1}
 ] } }
\ No newline at end of file
+{ "listresourcelimitsresponse" : { "count":8 ,"resourcelimit" : [
+    
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"0","max":-1},
+    
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"1","max":-1},
+    
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"2","max":-1},
+    
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"3","max":-1},
+    
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"4","max":-1},
+    
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"7","max":-1},
+    
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"8","max":-1},
+    
{"account":"jclouds","domainid":457,"domain":"AA000062-jclouds-dev","resourcetype":"9","max":-1}]
 } }

Reply via email to