You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by an...@apache.org on 2016/04/13 09:40:55 UTC

jclouds-labs git commit: JCLOUDS-664 Azurecompute-arm LocationApi

Repository: jclouds-labs
Updated Branches:
  refs/heads/master 8e7d4c057 -> 559fdecf8


JCLOUDS-664 Azurecompute-arm LocationApi


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

Branch: refs/heads/master
Commit: 559fdecf877306b5b3e494eb0dd0d997294feb94
Parents: 8e7d4c0
Author: Rita Zhang <ri...@gmail.com>
Authored: Mon Apr 11 17:00:13 2016 -0700
Committer: Andrea Turli <an...@gmail.com>
Committed: Wed Apr 13 09:37:38 2016 +0200

----------------------------------------------------------------------
 .../azurecompute/arm/AzureComputeApi.java       |  9 ++
 .../arm/AzureComputeProviderMetadata.java       |  2 +
 .../compute/functions/LocationToLocation.java   | 62 ++++++++++++++
 .../azurecompute/arm/domain/Location.java       | 58 +++++++++++++
 .../jclouds/azurecompute/arm/domain/Region.java | 90 ++++++++++++++++++++
 .../azurecompute/arm/features/LocationApi.java  | 57 +++++++++++++
 .../arm/features/LocationApiLiveTest.java       | 39 +++++++++
 .../arm/features/LocationApiMockTest.java       | 50 +++++++++++
 .../arm/features/ResourceGroupApiMockTest.java  |  2 +-
 .../internal/BaseAzureComputeApiMockTest.java   |  4 +-
 .../src/test/resources/locations.json           | 10 +++
 .../src/test/resources/resourcegroup.json       |  2 +-
 .../src/test/resources/resourcegroups.json      |  6 +-
 .../test/resources/resourcegroupupdated.json    |  2 +-
 14 files changed, 385 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java
index a897c9a..1e7cb91 100644
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java
+++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java
@@ -19,6 +19,7 @@ package org.jclouds.azurecompute.arm;
 import java.io.Closeable;
 
 import org.jclouds.azurecompute.arm.features.JobApi;
+import org.jclouds.azurecompute.arm.features.LocationApi;
 import org.jclouds.azurecompute.arm.features.ResourceGroupApi;
 import org.jclouds.rest.annotations.Delegate;
 
@@ -40,4 +41,12 @@ public interface AzureComputeApi extends Closeable {
 
    @Delegate
    JobApi getJobApi();
+
+   /**
+    * This Azure Resource Manager API provides all of the locations that are available for resource providers
+    *
+    * @see <a href="https://msdn.microsoft.com/en-US/library/azure/dn790540.aspx">docs</a>
+    */
+   @Delegate
+   LocationApi getLocationApi();
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java
index 958a6dd..39defdc 100644
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java
+++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadata.java
@@ -27,6 +27,7 @@ import static org.jclouds.oauth.v2.config.OAuthProperties.CREDENTIAL_TYPE;
 
 import java.net.URI;
 import java.util.Properties;
+import org.jclouds.azurecompute.arm.domain.Region;
 import org.jclouds.providers.ProviderMetadata;
 import org.jclouds.providers.internal.BaseProviderMetadata;
 
@@ -75,6 +76,7 @@ public class AzureComputeProviderMetadata extends BaseProviderMetadata {
                  .homepage(URI.create("https://www.windowsazure.com/"))
                  .console(URI.create("https://windows.azure.com/default.aspx"))
                  .linkedServices("azureblob")
+                 .iso3166Codes(Region.iso3166Codes())
                  .defaultProperties(AzureComputeProviderMetadata.defaultProperties());
       }
 

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/LocationToLocation.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/LocationToLocation.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/LocationToLocation.java
new file mode 100644
index 0000000..a4d4b1e
--- /dev/null
+++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/functions/LocationToLocation.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.compute.functions;
+
+import static com.google.common.collect.Iterables.getOnlyElement;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.azurecompute.arm.domain.Location;
+import org.jclouds.azurecompute.arm.domain.Region;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.location.suppliers.all.JustProvider;
+
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Converts an Location into a Location.
+ */
+@Singleton
+public class LocationToLocation implements Function<Location, org.jclouds.domain.Location> {
+
+   private final JustProvider justProvider;
+
+   @Inject
+   LocationToLocation(JustProvider justProvider) {
+      this.justProvider = justProvider;
+   }
+
+   @Override
+   public org.jclouds.domain.Location apply(final Location location) {
+      final LocationBuilder builder = new LocationBuilder();
+      builder.id(location.id());
+      builder.description(location.displayName());
+      builder.parent(getOnlyElement(justProvider.get()));
+
+      builder.scope(LocationScope.REGION);
+      final Region region = Region.byName(location.name());
+      if (region != null) {
+         builder.iso3166Codes(ImmutableSet.of(region.iso3166Code()));
+      }
+
+      return builder.build();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Location.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Location.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Location.java
new file mode 100644
index 0000000..a597a61
--- /dev/null
+++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Location.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.json.SerializedNames;
+
+/**
+ * A data center location that is valid for your subscription.
+ */
+@AutoValue
+public abstract class Location {
+   /**
+    * The id of the data center.
+    */
+   public abstract String id();
+
+   /**
+    * The name of the data center location. Ex. {@code West Europe}.
+    */
+   public abstract String name();
+
+   /**
+    * The localized name of the data center location.
+    */
+   public abstract String displayName();
+
+   /**
+    * The longitude of the datacenter
+    */
+   public abstract double longitude();
+
+   /**
+    * The latitude of the datacenter
+    */
+   public abstract double latitude();
+
+   @SerializedNames({"id", "name", "displayName", "longitude", "latitude"})
+   public static Location create(final String id, final String name, final String displayName, final double longitude,
+           final double latitude) {
+
+      return new AutoValue_Location(id, name, displayName, longitude, latitude);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Region.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Region.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Region.java
new file mode 100644
index 0000000..5c85493
--- /dev/null
+++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Region.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.domain;
+
+import com.google.common.base.Function;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import java.util.Arrays;
+import java.util.Set;
+
+/**
+ * Regions used in Azure.
+ *
+ * @see <a href="http://azure.microsoft.com/en-us/regions/">this page</a>
+ */
+public enum Region {
+
+   CENTRAL_US("Central US", "US-IA"),
+   EAST_US("East US", "US-VA"),
+   EAST_US_2("East US 2", "US-VA"),
+   US_GOV_IOWA("US Gov Iowa", "US-IA"),
+   US_GOV_VIRGINIA("US Gov Virginia", "US-VA"),
+   NORTH_CENTRAL_US("North Central US", "US-IL"),
+   SOUTH_CENTRAL_US("South Central US", "US-TX"),
+   WEST_US("West US", "US-CA"),
+   NORTH_EUROPE("North Europe", "IE"),
+   WEST_EUROPE("West Europe", "NL"),
+   EAST_ASIA("East Asia", "HK"),
+   SOUTH_EAST_ASIA("Southeast Asia", "SG"),
+   JAPAN_EAST("Japan East", "JP-11"),
+   JAPAN_WEST("Japan West", "JP-27"),
+   BRAZIL_SOUTH("Brazil South", "BR"),
+   AUSTRALIA_EAST("Australia East", "AU-NSW"),
+   AUSTRALIA_SOUTH_EAST("Australia Southeast", "AU-VIC");
+
+   private final String name;
+
+   private final String iso3166Code;
+
+   Region(final String name, final String iso3166Code) {
+      this.name = name;
+      this.iso3166Code = iso3166Code;
+   }
+
+   public String getName() {
+      return name;
+   }
+
+   public String iso3166Code() {
+      return iso3166Code;
+   }
+
+   public static Region byName(final String name) {
+      Preconditions.checkNotNull(name);
+
+      Region result = null;
+      for (Region region : values()) {
+         if (name.equals(region.name)) {
+            result = region;
+         }
+      }
+
+      return result;
+   }
+
+   public static Set<String> iso3166Codes() {
+      return ImmutableSet.copyOf(Iterables.transform(Arrays.asList(values()), new Function<Region, String>() {
+
+         @Override
+         public String apply(final Region region) {
+            return region.iso3166Code;
+         }
+      }));
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/LocationApi.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/LocationApi.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/LocationApi.java
new file mode 100644
index 0000000..772b3cb
--- /dev/null
+++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/LocationApi.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.features;
+
+import java.util.List;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
+import org.jclouds.azurecompute.arm.domain.Location;
+import org.jclouds.oauth.v2.filters.OAuthFilter;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.Fallback;
+
+/**
+ * This Azure Resource Manager API provides all of the locations that are available for resource providers
+ * <p/>
+ *
+ * @see <a href="https://msdn.microsoft.com/en-US/library/azure/dn790540.aspx">docs</a>
+ */
+@Path("/locations")
+@RequestFilters(OAuthFilter.class)
+@QueryParams(keys = "api-version", values = "2015-11-01")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface LocationApi {
+
+   /**
+    * The List Locations operation lists all of the data center locations that are valid for your subscription.
+    */
+   @Named("ListLocations")
+   @GET
+   @SelectJson("value")
+   @Fallback(EmptyListOnNotFoundOr404.class)
+   List<Location> list();
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocationApiLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocationApiLiveTest.java b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocationApiLiveTest.java
new file mode 100644
index 0000000..2c63a70
--- /dev/null
+++ b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocationApiLiveTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.features;
+
+import org.jclouds.azurecompute.arm.domain.Location;
+import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiLiveTest;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertTrue;
+
+@Test(groups = "live", testName = "LocationApiLiveTest")
+public class LocationApiLiveTest extends BaseAzureComputeApiLiveTest {
+
+   @Test
+   public void testList() {
+      for (Location location : api().list()) {
+          assertTrue(!location.id().isEmpty());
+      }
+      assertTrue(!api().list().isEmpty());
+   }
+
+   private LocationApi api() {
+      return api.getLocationApi();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocationApiMockTest.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocationApiMockTest.java b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocationApiMockTest.java
new file mode 100644
index 0000000..5ea60d4
--- /dev/null
+++ b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/LocationApiMockTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.azurecompute.arm.features;
+
+import com.google.common.collect.ImmutableList;
+import com.squareup.okhttp.mockwebserver.MockResponse;
+import org.jclouds.azurecompute.arm.domain.Location;
+import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiMockTest;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+@Test(groups = "unit", testName = "LocationApiMockTest", singleThreaded = true)
+public class LocationApiMockTest extends BaseAzureComputeApiMockTest {
+
+   public void testList() throws Exception {
+      server.enqueue(jsonResponse("/locations.json"));
+      final LocationApi locationAPI = api.getLocationApi();
+      assertEquals(locationAPI.list(), ImmutableList.of(
+              Location.create("/subscriptions/SUBSCRIPTIONID/locations/eastasia",
+                      "eastasia", "East Asia", 114.188, 22.267)
+      ));
+      assertSent(server, "GET", "/subscriptions/SUBSCRIPTIONID/locations?api-version=2015-11-01");
+   }
+
+   public void testEmptyList() throws Exception {
+      server.enqueue(new MockResponse().setResponseCode(404));
+
+      final LocationApi locationAPI = api.getLocationApi();
+
+      assertTrue(locationAPI.list().isEmpty());
+
+      assertSent(server, "GET", "/subscriptions/SUBSCRIPTIONID/locations?api-version=2015-11-01");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/ResourceGroupApiMockTest.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/ResourceGroupApiMockTest.java b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/ResourceGroupApiMockTest.java
index 91cb2b1..0c03c75 100644
--- a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/ResourceGroupApiMockTest.java
+++ b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/ResourceGroupApiMockTest.java
@@ -34,7 +34,7 @@ import static org.testng.Assert.assertEquals;
 @Test(groups = "unit", testName = "ResourceGroupApiMockTest", singleThreaded = true)
 public class ResourceGroupApiMockTest extends BaseAzureComputeApiMockTest {
 
-   final String subscriptionid = "12345678-1234-1234-1234-123456789012";
+   final String subscriptionid = "SUBSCRIPTIONID";
    final String requestUrl = "/subscriptions/" + subscriptionid + "/resourcegroups";
    final String version = "?api-version=2015-01-01";
 

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiMockTest.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiMockTest.java b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiMockTest.java
index f6dbee3..5a228f4 100644
--- a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiMockTest.java
+++ b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiMockTest.java
@@ -64,7 +64,7 @@ public class BaseAzureComputeApiMockTest {
       AzureComputeProviderMetadata pm = AzureComputeProviderMetadata.builder().build();
       api = ContextBuilder.newBuilder(pm)
               .credentials("", MOCK_BEARER_TOKEN)
-              .endpoint(server.getUrl("/").toString() + "subscriptions/12345678-1234-1234-1234-123456789012")
+              .endpoint(server.getUrl("/").toString() + "subscriptions/SUBSCRIPTIONID")
               .modules(modules)
               .overrides(properties)
               .buildApi(AzureComputeApi.class);
@@ -99,7 +99,7 @@ public class BaseAzureComputeApiMockTest {
    protected MockResponse response202WithHeader() {
       return new MockResponse()
               .setStatus("HTTP/1.1 202 Accepted")
-              .addHeader("Location", "https://management.azure.com/subscriptions/12345678-1234-1234-1234-123456789012/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1SVEVTVC1DRU5UUkFMVVMiLCJqb2JMb2NhdGlvbiI6ImNlbnRyYWx1cyJ9?api-version=2014-04-01");
+              .addHeader("Location", "https://management.azure.com/subscriptions/SUBSCRIPTIONID/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1SVEVTVC1DRU5UUkFMVVMiLCJqb2JMb2NhdGlvbiI6ImNlbnRyYWx1cyJ9?api-version=2014-04-01");
    }
 
    protected String stringFromResource(String resourceName) {

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/test/resources/locations.json
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/resources/locations.json b/azurecompute-arm/src/test/resources/locations.json
new file mode 100644
index 0000000..ded0d8b
--- /dev/null
+++ b/azurecompute-arm/src/test/resources/locations.json
@@ -0,0 +1,10 @@
+{"value": [
+  {
+    "id":"/subscriptions/SUBSCRIPTIONID/locations/eastasia",
+    "name":"eastasia",
+    "displayName":"East Asia",
+    "longitude":"114.188",
+    "latitude":"22.267"
+  }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/test/resources/resourcegroup.json
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/resources/resourcegroup.json b/azurecompute-arm/src/test/resources/resourcegroup.json
index 1d0cc68..6ca47cf 100644
--- a/azurecompute-arm/src/test/resources/resourcegroup.json
+++ b/azurecompute-arm/src/test/resources/resourcegroup.json
@@ -1,5 +1,5 @@
 {
-  "id": "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/jcloudstest",
+  "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/jcloudstest",
   "name": "jcloudstest",
   "location": "westus",
   "tags": {

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/test/resources/resourcegroups.json
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/resources/resourcegroups.json b/azurecompute-arm/src/test/resources/resourcegroups.json
index bde3a9d..e21fdb7 100644
--- a/azurecompute-arm/src/test/resources/resourcegroups.json
+++ b/azurecompute-arm/src/test/resources/resourcegroups.json
@@ -1,7 +1,7 @@
 {
    "value": [
       {
-         "id": "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test1",
+         "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/test1",
          "name": "test1",
          "location": "westus",
          "properties": {
@@ -9,7 +9,7 @@
          }
       },
       {
-         "id": "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test2",
+         "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/test2",
          "name": "test2",
          "location": "eastus",
          "tags": {},
@@ -18,5 +18,5 @@
          }
       }
    ],
-   "nextLink": "https://management.azure.com/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups?api-version=2015-11-01&%24top=2&%24skiptoken=eyJuZXh0UGFydGl0aW9uS2V5IjoiMSE4IVJVTkJNalEtIiwibmV4dFJvd0tleSI6IjEhNjghTURSR04wVkRPRGc0UlRJNE5ERkZSRGcxTXpjMVJURTNOelkyTURBeFJqVmZRVTVRVWtsRFJWUkZVMVF0VjBWVFZGVlQifQ%3d%3d"
+   "nextLink": "https://management.azure.com/subscriptions/SUBSCRIPTIONID/resourceGroups?api-version=2015-11-01&%24top=2&%24skiptoken=eyJuZXh0UGFydGl0aW9uS2V5IjoiMSE4IVJVTkJNalEtIiwibmV4dFJvd0tleSI6IjEhNjghTURSR04wVkRPRGc0UlRJNE5ERkZSRGcxTXpjMVJURTNOelkyTURBeFJqVmZRVTVRVWtsRFJWUkZVMVF0VjBWVFZGVlQifQ%3d%3d"
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/559fdecf/azurecompute-arm/src/test/resources/resourcegroupupdated.json
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/resources/resourcegroupupdated.json b/azurecompute-arm/src/test/resources/resourcegroupupdated.json
index 3d54d03..19c366b 100644
--- a/azurecompute-arm/src/test/resources/resourcegroupupdated.json
+++ b/azurecompute-arm/src/test/resources/resourcegroupupdated.json
@@ -1,5 +1,5 @@
 {
-  "id": "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/jcloudstest",
+  "id": "/subscriptions/SUBSCRIPTIONID/resourceGroups/jcloudstest",
   "name": "jcloudstest",
   "location": "westus",
   "tags": {},