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/06/26 14:44:36 UTC

[01/50] [abbrv] jclouds git commit: added InstanceApi.setScheduling

Repository: jclouds
Updated Branches:
  refs/heads/master 87b885306 -> 647df25d9


added InstanceApi.setScheduling


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

Branch: refs/heads/master
Commit: 0c41f7afbed740c4e1062b0e98501250cad81ea0
Parents: 1440ef2
Author: Daniel Broudy <br...@google.com>
Authored: Mon Nov 24 17:15:30 2014 -0800
Committer: Adrian Cole <ac...@twitter.com>
Committed: Wed Nov 26 13:12:44 2014 -0800

----------------------------------------------------------------------
 .../GoogleComputeEngineServiceAdapter.java      |  5 +-
 .../googlecomputeengine/domain/Instance.java    | 40 ++++++++++-
 .../googlecomputeengine/domain/NewInstance.java | 11 +--
 .../features/InstanceApi.java                   | 20 ++++++
 .../GoogleComputeEngineServiceMockTest.java     | 73 ++------------------
 .../features/InstanceApiLiveTest.java           | 18 ++++-
 .../features/InstanceApiMockTest.java           | 13 ++++
 .../parse/ParseInstanceTest.java                |  4 +-
 .../resources/aggregated_instance_list.json     |  4 ++
 .../src/test/resources/firewall_insert_2.json   | 28 ++++++++
 .../src/test/resources/instance_get.json        |  4 ++
 .../src/test/resources/instance_insert.json     | 33 ++++++++-
 .../src/test/resources/instance_insert_2.json   | 37 ++++++++++
 .../test/resources/instance_insert_simple.json  | 29 +++++++-
 .../src/test/resources/instance_list.json       |  4 ++
 15 files changed, 243 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index 22315f3..fb3f7f6 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -47,6 +47,8 @@ import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTempla
 import org.jclouds.googlecomputeengine.domain.AttachDisk;
 import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
+import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
+import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
 import org.jclouds.googlecomputeengine.domain.MachineType;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.Operation;
@@ -162,7 +164,8 @@ public final class GoogleComputeEngineServiceAdapter
             null, // networkInterfaces
             null, // disks
             newInstance.metadata(), // metadata
-            null // serviceAccounts
+            null, // serviceAccounts
+            Scheduling.create(OnHostMaintenance.MIGRATE, true) // scheduling
       ));
       checkState(instanceVisible.apply(instance), "instance %s is not api visible!", instance.get());
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
index 6c420b4..be5b1e5 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
@@ -157,6 +157,38 @@ public abstract class Instance {
       }
    }
 
+   /**
+    * Defines the maintenance behavior for this instance. The default behavior is migrate.
+    */
+   @AutoValue
+   public abstract static class Scheduling {
+
+      public enum OnHostMaintenance {
+         /**
+          * Allows Compute Engine to automatically migrate instances out of the way of maintenance events.
+          */
+         MIGRATE,
+         /**
+          * Allows Compute Engine to terminate and restart the instance away from the maintenance activity.
+          * If you would like your instance to be restarted, set the automaticRestart flag to true.
+          * Your instance may be restarted more than once, and it may be restarted outside the window
+          * of maintenance events.
+          */
+         TERMINATE
+      }
+
+      public abstract OnHostMaintenance onHostMaintenance();
+      public abstract boolean automaticRestart();
+
+      @SerializedNames({ "onHostMaintenance", "automaticRestart" })
+      public static Scheduling create(OnHostMaintenance onHostMaintenance, boolean automaticRestart) {
+         return new AutoValue_Instance_Scheduling(onHostMaintenance, automaticRestart);
+      }
+
+      Scheduling() {
+      }
+   }
+
    public enum Status {
       PROVISIONING,
       STAGING,
@@ -197,13 +229,15 @@ public abstract class Instance {
 
    public abstract List<ServiceAccount> serviceAccounts();
 
+   public abstract Scheduling scheduling();
+
    @SerializedNames({ "id", "selfLink", "name", "description", "tags", "machineType", "status", "statusMessage", "zone",
-         "networkInterfaces", "disks", "metadata", "serviceAccounts" })
+         "networkInterfaces", "disks", "metadata", "serviceAccounts", "scheduling"})
    public static Instance create(String id, URI selfLink, String name, String description, Tags tags, URI machineType,
          Status status, String statusMessage, URI zone, List<NetworkInterface> networkInterfaces,
-         List<AttachedDisk> disks, Metadata metadata, List<ServiceAccount> serviceAccounts) {
+         List<AttachedDisk> disks, Metadata metadata, List<ServiceAccount> serviceAccounts, Scheduling scheduling) {
       return new AutoValue_Instance(id, selfLink, name, description, tags, machineType, status, statusMessage, zone,
-            copyOf(networkInterfaces), copyOf(disks), metadata, copyOf(serviceAccounts));
+            copyOf(networkInterfaces), copyOf(disks), metadata, copyOf(serviceAccounts), scheduling);
    }
 
    Instance() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
index 6f59b85..e70c9dd 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
+import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
 
@@ -66,6 +67,8 @@ public abstract class NewInstance {
    /** Add metadata via {@link Metadata#items()}. */
    public abstract Metadata metadata();
 
+   @Nullable public abstract Scheduling scheduling();
+
    /** Convenience for creating a new instance with only a boot disk and minimal parameters. */
    public static NewInstance create(String name, URI machineType, URI network, URI sourceImage) {
       return create(name, machineType, network, Arrays.asList(AttachDisk.newBootDisk(sourceImage)), null);
@@ -81,13 +84,13 @@ public abstract class NewInstance {
          }
       }
       return create(name, machineType, ImmutableList.of(NetworkInterface.create(network)), ImmutableList.copyOf(disks),
-            description, Tags.create(), Metadata.create());
+            description, Tags.create(), Metadata.create(), null);
    }
 
-   @SerializedNames({ "name", "machineType", "networkInterfaces", "disks", "description", "tags", "metadata" })
+   @SerializedNames({ "name", "machineType", "networkInterfaces", "disks", "description", "tags", "metadata", "scheduling" })
    static NewInstance create(String name, URI machineType, List<NetworkInterface> networkInterfaces,
-         List<AttachDisk> disks, String description, Tags tags, Metadata metadata) {
-      return new AutoValue_NewInstance(name, machineType, networkInterfaces, disks, description, tags, metadata);
+         List<AttachDisk> disks, String description, Tags tags, Metadata metadata, Scheduling scheduling) {
+      return new AutoValue_NewInstance(name, machineType, networkInterfaces, disks, description, tags, metadata, scheduling);
    }
 
    NewInstance() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
index b561bca..0b61795 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
@@ -38,6 +38,7 @@ import org.jclouds.googlecloud.domain.ListPage;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.domain.AttachDisk;
 import org.jclouds.googlecomputeengine.domain.Instance;
+import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
 import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.Operation;
@@ -233,6 +234,25 @@ public interface InstanceApi {
                                @QueryParam("autoDelete") boolean autoDelete);
 
    /**
+    * Sets an instance's scheduling options.
+    * @see <a href = "https://cloud.google.com/compute/docs/instances#onhostmaintenance"/>
+    *
+    * @param instanceName The name of the instance
+    * @param onHostMaintenance either MIGRATE or TERMINATE the default is MIGRATE (Live Migration).
+    * @param automaticRestart Defines whether the Instance should be automatically
+    *  restarted when it is terminated by Compute Engine (not terminated by user).
+    *  Used when onHostMaintenance is set to TERMINATE.
+    * @return
+    */
+   @Named("Instances:setScheduling")
+   @POST
+   @Path("/{instance}/setScheduling")
+   @MapBinder(BindToJsonPayload.class)
+   Operation setScheduling(@PathParam("instance") String instanceName,
+                           @PayloadParam("onHostMaintenance") Scheduling.OnHostMaintenance onHostMaintenance,
+                           @PayloadParam("automaticRestart") boolean automaticRestart);
+
+   /**
     * Retrieves the list of instance resources available to the specified project.
     * By default the list as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() has not
     * been set.

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
index f161724..7045821 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
@@ -185,75 +185,14 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");
       assertSent(server, "GET", "/projects/party/global/networks/jclouds-test");
       assertSent(server, "GET", "/projects/party/global/firewalls/jclouds-test-port-22");
-      assertSent(server, "POST", "/projects/party/global/firewalls", "" //
-            + "{" //
-            + "  \"name\": \"jclouds-test-port-22\"," //
-            + "  \"network\": \"" + url("/projects/party/networks/jclouds-test") + "\","//
-            + "  \"sourceRanges\": [" //
-            + "    \"10.0.0.0/8\","//
-            + "    \"0.0.0.0/0\"" //
-            + "  ]," //
-            + "  \"sourceTags\": [" //
-            + "    \"aTag\"" //
-            + "  ]," //
-            + "  \"targetTags\": [" //
-            + "    \"jclouds-test-port-22\"" //
-            + "  ]," //
-            + "  \"allowed\": [" //
-            + "    {" //
-            + "      \"IPProtocol\": \"tcp\"," //
-            + "      \"ports\": [" //
-            + "        \"22\"" //
-            + "      ]" //
-            + "    }," //
-            + "    {" //
-            + "      \"IPProtocol\": \"udp\"," //
-            + "      \"ports\": [" //
-            + "        \"22\""//
-            + "      ]" //
-            + "    }" //
-            + "  ]" //
-            + "}");
+      assertSent(server, "POST", "/projects/party/global/firewalls",
+            stringFromResource("/firewall_insert_2.json"));
+
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");
       assertSent(server, "GET", "/projects/party/aggregated/instances");
-      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances", "" //
-            + "{" //
-            + "  \"machineType\": \"" + template.getHardware().getId() + "\"," //
-            + "  \"name\": \"test-1\"," //
-            + "  \"networkInterfaces\": [" //
-            + "    {" //
-            + "      \"network\": \"" + url("/projects/party/networks/jclouds-test") + "\"," //
-            + "      \"accessConfigs\": [" //
-            + "        \"ONE_TO_ONE_NAT\"" //
-            + "      ]" //
-            + "    }" //
-            + "  ]," //
-            + "  \"disks\": [" //
-            + "    {" //
-            + "      \"type\": \"PERSISTENT\"," //
-            + "      \"initializeParams\": {" //
-            + "        \"sourceImage\": \"" + template.getImage().getId() + "\"" //
-            + "      }," //
-            + "      \"boot\": true," //
-            + "      \"autoDelete\": true" //
-            + "    }" //
-            + "  ]," //
-            + "  \"description\": \"test\"," //
-            + "  \"tags\": {" //
-            + "    \"items\": [" //
-            + "      \"aTag\"," //
-            + "      \"jclouds-test-port-22\"" //
-            + "    ]" //
-            + "  }," //
-            + "  \"metadata\": {" //
-            + "    \"items\": [" //
-            + "      {" //
-            + "        \"key\": \"jclouds-group\"," //
-            + "        \"value\": \"test\"" //
-            + "      }" //
-            + "    ]" //
-            + "  }" //
-            + "}");
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances",
+            String.format(stringFromResource("/instance_insert_2.json"), template.getHardware().getId(), template.getImage().getId()));
+
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-1");
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index fe671d6..1d643c5 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -32,6 +32,7 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
+import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
 import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.AttachDisk;
@@ -119,7 +120,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertInstance")
-   public void testSetDiskAutoDelete(){
+   public void testSetDiskAutoDelete() {
 
       assertTrue(existsDiskWithNameAndAutoDelete(INSTANCE_NAME, DEFAULT_BOOT_DISK_NAME, true));
 
@@ -134,6 +135,19 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertTrue(existsDiskWithNameAndAutoDelete(INSTANCE_NAME, DEFAULT_BOOT_DISK_NAME, true));
    }
 
+   @Test(groups = "live", dependsOnMethods = "testInsertInstance")
+   public void testSetScheduling() {
+      Instance instance = api().get(INSTANCE_NAME);
+      assertEquals(instance.scheduling().automaticRestart(), true);
+      assertEquals(instance.scheduling().onHostMaintenance(), Scheduling.OnHostMaintenance.MIGRATE);
+
+      assertOperationDoneSuccessfully(api().setScheduling(INSTANCE_NAME, Scheduling.OnHostMaintenance.TERMINATE, false));
+
+      Instance instanceAltered = api().get(INSTANCE_NAME);
+      assertEquals(instanceAltered.scheduling().automaticRestart(), false);
+      assertEquals(instanceAltered.scheduling().onHostMaintenance(), Scheduling.OnHostMaintenance.TERMINATE);
+   }
+
    private boolean existsDiskWithNameAndAutoDelete(String instanceName, final String diskName, final boolean autoDelete){
       Instance revertedInstance = api().get(instanceName);
 
@@ -229,7 +243,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertOperationDoneSuccessfully(api().reset(INSTANCE_NAME));
    }
 
-   @Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance"}, alwaysRun = true)
+   @Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling"}, alwaysRun = true)
    public void testDeleteInstance() {
       assertOperationDoneSuccessfully(api().delete(INSTANCE_NAME));
       assertOperationDoneSuccessfully(diskApi().delete(DISK_NAME));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
index 369bced..56cc5f9 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
@@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.features;
 import static org.testng.Assert.assertEquals;
 
 import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
 import org.jclouds.googlecomputeengine.parse.ParseZoneOperationTest;
 import org.testng.annotations.Test;
@@ -39,4 +40,16 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/setDiskAutoDelete"
           + "?deviceName=test-disk-1&autoDelete=true");
    }
+
+   public void setScheduling() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      InstanceApi instanceApi = api().instancesInZone("us-central1-a");
+
+      assertEquals(instanceApi.setScheduling("test-1", OnHostMaintenance.TERMINATE, true),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/setScheduling",
+            "{\"onHostMaintenance\": \"TERMINATE\",\"automaticRestart\": true}");
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
index 8d92d9b..e34c149 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
@@ -26,6 +26,7 @@ import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
 import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface;
 import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
+import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
 import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.Tags;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
@@ -72,7 +73,8 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
                     .put("aKey", "aValue")
                     .put("jclouds-image", BASE_URL + "/debian-cloud/global/images/debian-7-wheezy-v20140718")
                     .put("jclouds-delete-boot-disk", "true"), // metadata
-            ImmutableList.of(ServiceAccount.create("default", ImmutableList.of("myscope"))) // serviceAccounts
+            ImmutableList.of(ServiceAccount.create("default", ImmutableList.of("myscope"))), // serviceAccounts
+            Instance.Scheduling.create(OnHostMaintenance.MIGRATE, false) // scheduling
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/resources/aggregated_instance_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/aggregated_instance_list.json b/providers/google-compute-engine/src/test/resources/aggregated_instance_list.json
index a1b31ac..d50f1c5 100644
--- a/providers/google-compute-engine/src/test/resources/aggregated_instance_list.json
+++ b/providers/google-compute-engine/src/test/resources/aggregated_instance_list.json
@@ -138,6 +138,10 @@
                "Group-port-42"
             ],
             "fingerprint": "abcd"
+         },
+        "scheduling": {
+            "onHostMaintenance": "MIGRATE",
+            "automaticRestart": false
          }
       }
    ]

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/resources/firewall_insert_2.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/firewall_insert_2.json b/providers/google-compute-engine/src/test/resources/firewall_insert_2.json
new file mode 100644
index 0000000..485721e
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/firewall_insert_2.json
@@ -0,0 +1,28 @@
+{
+  "name": "jclouds-test-port-22",
+  "network": "https://www.googleapis.com/compute/v1/projects/party/networks/jclouds-test",
+  "sourceRanges": [
+    "10.0.0.0/8",
+    "0.0.0.0/0"
+  ],
+  "sourceTags": [
+    "aTag"
+  ],
+  "targetTags": [
+    "jclouds-test-port-22"
+  ],
+  "allowed": [
+    {
+      "IPProtocol": "tcp",
+      "ports": [
+        "22"
+      ]
+    },
+    {
+      "IPProtocol": "udp",
+      "ports": [
+        "22"
+      ]
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/resources/instance_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_get.json b/providers/google-compute-engine/src/test/resources/instance_get.json
index e8fac93..984db08 100644
--- a/providers/google-compute-engine/src/test/resources/instance_get.json
+++ b/providers/google-compute-engine/src/test/resources/instance_get.json
@@ -59,5 +59,9 @@
          "Group-port-42"
       ],
       "fingerprint": "abcd"
+   },
+    "scheduling": {
+        "onHostMaintenance": "MIGRATE",
+        "automaticRestart": false
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/resources/instance_insert.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_insert.json b/providers/google-compute-engine/src/test/resources/instance_insert.json
index 2ce8f0b..b26eb06 100644
--- a/providers/google-compute-engine/src/test/resources/instance_insert.json
+++ b/providers/google-compute-engine/src/test/resources/instance_insert.json
@@ -1 +1,32 @@
-{"machineType":"https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1","name":"test-1","networkInterfaces":[{"network":"https://www.googleapis.com/compute/v1/projects/party/global/networks/default","accessConfigs":["ONE_TO_ONE_NAT"]}],"disks":[{"type":"PERSISTENT","source":"https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test","boot":true,"autoDelete":false}],"description":"desc","tags":{"items":[]},"metadata":{"items":[{"key":"aKey","value":"aValue"}]}}
+{
+  "machineType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1",
+  "name": "test-1",
+  "networkInterfaces": [
+    {
+      "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
+      "accessConfigs": [
+        "ONE_TO_ONE_NAT"
+      ]
+    }
+  ],
+  "disks": [
+    {
+      "type": "PERSISTENT",
+      "source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
+      "boot": true,
+      "autoDelete": false
+    }
+  ],
+  "description": "desc",
+  "tags": {
+    "items": []
+  },
+  "metadata": {
+    "items": [
+      {
+        "key": "aKey",
+        "value": "aValue"
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/resources/instance_insert_2.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_insert_2.json b/providers/google-compute-engine/src/test/resources/instance_insert_2.json
new file mode 100644
index 0000000..99adbfe
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/instance_insert_2.json
@@ -0,0 +1,37 @@
+{
+  "machineType": "%s",
+  "name": "test-1",
+  "networkInterfaces": [
+    {
+      "network": "https://www.googleapis.com/compute/v1/projects/party/networks/jclouds-test",
+      "accessConfigs": [
+        "ONE_TO_ONE_NAT"
+      ]
+    }
+  ],
+  "disks": [
+    {
+      "type": "PERSISTENT",
+      "initializeParams": {
+        "sourceImage": "%s"
+      },
+      "boot": true,
+      "autoDelete": true
+    }
+  ],
+  "description": "test",
+  "tags": {
+    "items": [
+      "aTag",
+      "jclouds-test-port-22"
+    ]
+  },
+  "metadata": {
+    "items": [
+      {
+        "key": "jclouds-group",
+        "value": "test"
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/resources/instance_insert_simple.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_insert_simple.json b/providers/google-compute-engine/src/test/resources/instance_insert_simple.json
index 9a8266a..c140522 100644
--- a/providers/google-compute-engine/src/test/resources/instance_insert_simple.json
+++ b/providers/google-compute-engine/src/test/resources/instance_insert_simple.json
@@ -1 +1,28 @@
-{"name":"test-1","machineType":"https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1","networkInterfaces":[{"network":"https://www.googleapis.com/compute/v1/projects/party/global/networks/default","accessConfigs":["ONE_TO_ONE_NAT"]}],"disks":[{"type":"PERSISTENT","initializeParams":{"sourceImage":"https://www.googleapis.com/compute/v1/projects/party/global/images/centos-6-2-v20120326"},"boot":true,"autoDelete":true}],"tags":{"items":[]},"metadata":{"items":[]}}
+{
+  "name": "test-1",
+  "machineType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1",
+  "networkInterfaces": [
+    {
+      "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
+      "accessConfigs": [
+        "ONE_TO_ONE_NAT"
+      ]
+    }
+  ],
+  "disks": [
+    {
+      "type": "PERSISTENT",
+      "initializeParams": {
+        "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/centos-6-2-v20120326"
+      },
+      "boot": true,
+      "autoDelete": true
+    }
+  ],
+  "tags": {
+    "items": []
+  },
+  "metadata": {
+    "items": []
+  }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0c41f7af/providers/google-compute-engine/src/test/resources/instance_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_list.json b/providers/google-compute-engine/src/test/resources/instance_list.json
index 7a35c25..47040e2 100644
--- a/providers/google-compute-engine/src/test/resources/instance_list.json
+++ b/providers/google-compute-engine/src/test/resources/instance_list.json
@@ -64,6 +64,10 @@
                "Group-port-42"
             ],
             "fingerprint": "abcd"
+         },
+         "scheduling": {
+            "onHostMaintenance": "MIGRATE",
+            "automaticRestart": false
          }
       }
    ]


[23/50] [abbrv] jclouds git commit: Fixed InstanceApiLiveTest, made Instance.status @Nullable

Posted by na...@apache.org.
Fixed InstanceApiLiveTest, made Instance.status @Nullable


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

Branch: refs/heads/master
Commit: da9bd0c19dd969b30c002626a3e4c3ec825abb14
Parents: aa3a8df
Author: Daniel Broudy <br...@google.com>
Authored: Tue Jan 6 15:25:41 2015 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Fri Jan 9 23:19:33 2015 +0100

----------------------------------------------------------------------
 .../java/org/jclouds/googlecomputeengine/domain/Instance.java | 2 +-
 .../googlecomputeengine/features/InstanceApiLiveTest.java     | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/da9bd0c1/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
index cdc2ee4..dcbc344 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
@@ -225,7 +225,7 @@ public abstract class Instance {
 
    public abstract URI machineType();
 
-   public abstract Status status();
+   @Nullable public abstract Status status();
 
    /** Human-readable explanation of the status. */
    @Nullable public abstract String statusMessage();

http://git-wip-us.apache.org/repos/asf/jclouds/blob/da9bd0c1/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index 9add978..1910282 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -126,9 +126,14 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    @Test(groups = "live", dependsOnMethods = "testInsertInstance")
    public void testAddAccessConfig() {
+      Instance instance = api().get(INSTANCE_NAME);
+      assertNotNull(instance);
+      assertOperationDoneSuccessfully(api().deleteAccessConfigFromNic(INSTANCE_NAME,
+            instance.networkInterfaces().get(0).accessConfigs().get(0).name(), "nic0"));
+
       AccessConfig config = AccessConfig.create("test-config", Type.ONE_TO_ONE_NAT, null);
       assertOperationDoneSuccessfully(api().addAccessConfigToNic(INSTANCE_NAME, config, "nic0"));
-      Instance instance = api().get(INSTANCE_NAME);
+      instance = api().get(INSTANCE_NAME);
       assertNotNull(instance);
       assertEquals(instance.networkInterfaces().get(0).accessConfigs().get(0).name(), "test-config");
    }


[37/50] [abbrv] jclouds git commit: Remove firewall-tag filtering

Posted by na...@apache.org.
Remove firewall-tag filtering


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

Branch: refs/heads/master
Commit: 465a62aa2767427018d83c2711fd427e90e97ef4
Parents: 5adfce8
Author: Daniel Broudy <br...@google.com>
Authored: Wed May 20 13:28:57 2015 -0700
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue May 26 15:53:06 2015 +0200

----------------------------------------------------------------------
 .../functions/FirewallTagNamingConvention.java     | 12 ------------
 .../compute/functions/InstanceToNodeMetadata.java  | 17 +----------------
 .../functions/InstanceToNodeMetadataTest.java      | 13 +------------
 3 files changed, 2 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/465a62aa/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
index 1fe5928..61e4fd0 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
@@ -22,8 +22,6 @@ import javax.inject.Inject;
 
 import org.jclouds.compute.functions.GroupNamingConvention;
 
-import com.google.common.base.Predicate;
-
 /**
  * The convention for naming instance tags that firewall rules recognise.
  */
@@ -58,14 +56,4 @@ public final class FirewallTagNamingConvention {
 
       return String.format("%s-%s", sharedResourceName, Integer.toHexString(result));
    }
-
-
-   public Predicate<String> isFirewallTag() {
-      return new Predicate<String>() {
-         @Override
-         public boolean apply(String input) {
-            return input != null && input.startsWith(sharedResourceName + "-port-");
-         }
-      };
-   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/465a62aa/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
index 81e40b9..aab8cf9 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
@@ -16,11 +16,9 @@
  */
 package org.jclouds.googlecomputeengine.compute.functions;
 
-import static com.google.common.base.Preconditions.checkNotNull;
 import static org.jclouds.compute.util.ComputeServiceUtils.groupFromMapOrName;
 
 import java.net.URI;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -36,7 +34,6 @@ import org.jclouds.domain.Location;
 import org.jclouds.googlecomputeengine.domain.Instance;
 
 import com.google.common.base.Function;
-import com.google.common.base.Predicate;
 import com.google.common.base.Supplier;
 import com.google.common.collect.ImmutableList;
 
@@ -47,33 +44,21 @@ public final class InstanceToNodeMetadata implements Function<Instance, NodeMeta
    private final Map<URI, URI> diskToSourceImage;
    private final Supplier<Map<URI, Hardware>> hardwares;
    private final Supplier<Map<URI, Location>> locationsByUri;
-   private final FirewallTagNamingConvention.Factory firewallTagNamingConvention;
 
    @Inject InstanceToNodeMetadata(Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus,
                                   GroupNamingConvention.Factory namingConvention,
                                   Map<URI, URI> diskToSourceImage,
                                   @Memoized Supplier<Map<URI, Hardware>> hardwares,
-                                  @Memoized Supplier<Map<URI, Location>> locationsByUri,
-                                  FirewallTagNamingConvention.Factory firewallTagNamingConvention) {
+                                  @Memoized Supplier<Map<URI, Location>> locationsByUri) {
       this.toPortableNodeStatus = toPortableNodeStatus;
       this.nodeNamingConvention = namingConvention.createWithoutPrefix();
       this.diskToSourceImage = diskToSourceImage;
       this.hardwares = hardwares;
       this.locationsByUri = locationsByUri;
-      this.firewallTagNamingConvention = checkNotNull(firewallTagNamingConvention, "firewallTagNamingConvention");
    }
 
    @Override public NodeMetadata apply(Instance input) {
       String group = groupFromMapOrName(input.metadata().asMap(), input.name(), nodeNamingConvention);
-      Predicate<String> isFirewallTag = firewallTagNamingConvention.get(group).isFirewallTag();
-      if (group != null) {
-         for (Iterator<String> tag = input.tags().items().iterator(); tag.hasNext(); ) {
-            if (isFirewallTag.apply(tag.next())) {
-               tag.remove();
-            }
-         }
-      }
-
       NodeMetadataBuilder builder = new NodeMetadataBuilder();
 
       Location zone = locationsByUri.get().get(input.zone());

http://git-wip-us.apache.org/repos/asf/jclouds/blob/465a62aa/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadataTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadataTest.java
index 6888b24..fff0891 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadataTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadataTest.java
@@ -178,18 +178,7 @@ public class InstanceToNodeMetadataTest {
             namingConventionFactory,
             ImmutableMap.of(instance.disks().get(0).source(), imageUrl),
             hardwareSupplier,
-            locationSupplier,
-            new FirewallTagNamingConvention.Factory(namingConventionFactory));
-   }
-
-   @Test
-   public final void testTagFilteringWorks() {
-      NodeMetadata nodeMetadata = groupGroupNodeParser.apply(instance);
-      assertEquals(nodeMetadata.getId(), instance.selfLink().toString());
-      assertEquals(nodeMetadata.getTags(), ImmutableSet.of(
-            "aTag"  // "aTag" kept as a non firewall tag.
-            // "Group-port-42" filtered out as a firewall tag.
-      ));
+            locationSupplier);
    }
 
    @Test


[03/50] [abbrv] jclouds git commit: Converting tests to Mock

Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiExpectTest.java
deleted file mode 100644
index 1adcd5e..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiExpectTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.net.URI;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
-import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleListTest;
-import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleTest;
-import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ForwardingRuleApiExpectTest")
-public class GlobalForwardingRuleApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public void testGetForwardingRuleResponseIs2xx() throws Exception {
-      HttpRequest get = HttpRequest
-            .builder()
-            .method("GET")
-            .endpoint(BASE_URL + "/party/global/forwardingRules/test-forwarding-rule")
-                  .addHeader("Accept", "application/json")
-                  .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/forwardingrule_get.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, get, response).globalForwardingRules();
-
-      assertEquals(api.get("test-forwarding-rule"), new ParseForwardingRuleTest().expected());
-   }
-
-   public void testGetForwardingRuleResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-            .builder()
-            .method("GET")
-            .endpoint(BASE_URL + "/party/global/forwardingRules/test-forwarding-rule")
-                  .addHeader("Accept", "application/json")
-                  .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, get, response).globalForwardingRules();
-
-      assertNull(api.get("test-forwarding-rule"));
-   }
-
-   public void testInsertForwardingRuleResponseIs2xx() {
-      HttpRequest insert = HttpRequest
-            .builder()
-            .method("POST")
-            .endpoint(BASE_URL + "/party/global/forwardingRules")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType("/forwardingrule_insert.json", MediaType.APPLICATION_JSON))
-            .build();
-
-      HttpResponse insertForwardingRuleResponse = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, insert,
-            insertForwardingRuleResponse).globalForwardingRules();
-
-      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
-      .target(URI.create(BASE_URL + "/party/regions/europe-west1/targetPools/test-target-pool"));
-      assertEquals(api.create("test-forwarding-rule", forwardingRuleCreationOptions),
-            new ParseRegionOperationTest().expected());
-   }
-
-   public void testDeleteForwardingRuleResponseIs2xx() {
-      HttpRequest delete = HttpRequest
-            .builder()
-            .method("DELETE")
-            .endpoint(BASE_URL + "/party/global/forwardingRules/test-forwarding-rule")
-                  .addHeader("Accept", "application/json")
-                  .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, delete, deleteResponse).globalForwardingRules();
-
-      assertEquals(api.delete("test-forwarding-rule"), new ParseRegionOperationTest().expected());
-   }
-
-   public void testDeleteForwardingRuleResponseIs4xx() {
-      HttpRequest delete = HttpRequest
-            .builder()
-            .method("DELETE")
-            .endpoint(BASE_URL + "/party/global/forwardingRules/test-targetPool")
-                  .addHeader("Accept", "application/json")
-                  .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, delete, deleteResponse).globalForwardingRules();
-
-      assertNull(api.delete("test-targetPool"));
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(BASE_URL + "/party/global/forwardingRules")
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void list() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/forwardingrule_list.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, list, response).globalForwardingRules();
-
-      assertEquals(api.list().next(), new ParseForwardingRuleListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, list, response).globalForwardingRules();
-
-      assertFalse(api.list().hasNext());
-   }
-
-   public void testSetTargetForwardingRuleResponseIs2xx(){
-      String ruleName = "testForwardingRule";
-      HttpRequest setTarget = HttpRequest
-            .builder()
-            .method("POST")
-            .endpoint(BASE_URL + "/party/global/forwardingRules/" + ruleName + "/setTarget")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType("/forwardingrule_set_target.json", MediaType.APPLICATION_JSON))
-            .build();
-
-      HttpResponse setTargetResponse = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, setTarget, setTargetResponse).globalForwardingRules();
-
-      URI newTarget = URI.create(BASE_URL + "/party/regions/europe-west1/targetPools/test-target-pool");
-      assertEquals(api.setTarget(ruleName, newTarget), new ParseRegionOperationTest().expected());
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiMockTest.java
new file mode 100644
index 0000000..8c0d318
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiMockTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import java.net.URI;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
+import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleListTest;
+import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleTest;
+import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "GlobalForwardingRuleApiMockTest", singleThreaded = true)
+public class GlobalForwardingRuleApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/forwardingrule_get.json"));
+
+      assertEquals(globalForwardingRuleApi().get("test-forwarding-rule"),
+            new ParseForwardingRuleTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/forwardingRules/test-forwarding-rule");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(globalForwardingRuleApi().get("test-forwarding-rule"));
+      assertSent(server, "GET", "/projects/party/global/forwardingRules/test-forwarding-rule");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
+      .target(URI.create(url("/projects/party/regions/europe-west1/targetPools/test-target-pool")));
+
+      assertEquals(globalForwardingRuleApi().create("test-forwarding-rule", forwardingRuleCreationOptions),
+            new ParseRegionOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/global/forwardingRules",
+            stringFromResource("/forwardingrule_insert.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      assertEquals(globalForwardingRuleApi().delete("test-forwarding-rule"),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/global/forwardingRules/test-forwarding-rule");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(globalForwardingRuleApi().delete("test-forwarding-rule"));
+      assertSent(server, "DELETE", "/projects/party/global/forwardingRules/test-forwarding-rule");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/forwardingrule_list.json"));
+
+      assertEquals(globalForwardingRuleApi().list().next(), new ParseForwardingRuleListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/forwardingRules");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(globalForwardingRuleApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/global/forwardingRules");
+   }
+
+   public void setTarget() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      URI newTarget = URI.create(url("/projects/party/regions/europe-west1/targetPools/test-target-pool"));
+      assertEquals(globalForwardingRuleApi().setTarget("testForwardingRule", newTarget),
+            new ParseRegionOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/global/forwardingRules/testForwardingRule/setTarget",
+            stringFromResource("/forwardingrule_set_target.json"));
+   }
+
+   ForwardingRuleApi globalForwardingRuleApi(){
+      return api().globalForwardingRules();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
index ad915ca..1e1549a 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
@@ -17,8 +17,6 @@
 package org.jclouds.googlecomputeengine.features;
 
 import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
 
 import javax.ws.rs.core.MediaType;
 
@@ -26,8 +24,6 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
 import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
 import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
-import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckListTest;
-import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckTest;
 import org.jclouds.http.HttpRequest;
 import org.jclouds.http.HttpResponse;
 import org.testng.annotations.Test;
@@ -35,121 +31,6 @@ import org.testng.annotations.Test;
 @Test(groups = "unit", testName = "HttpHealthCheckApiExpectTest")
 public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
 
-   public void testGetHttpHealthCheckResponseIs2xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/global/httpHealthChecks/http-health-check-api-live-test")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/httphealthcheck_get.json")).build();
-
-      HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).httpHeathChecks();
-
-      assertEquals(api.get("http-health-check-api-live-test"),
-              new ParseHttpHealthCheckTest().expected());
-   }
-
-   public void testGetHttpHealthCheckResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/global/httpHealthChecks/http-health-check-test")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).httpHeathChecks();
-
-      assertNull(api.get("http-health-check-test"));
-   }
-
-   public void testInsertHttpHealthCheckResponseIs2xx() {
-      HttpRequest insert = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/global/httpHealthChecks")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/global_operation.json")).build();
-
-      HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, insert,
-              insertHttpHealthCheckResponse).httpHeathChecks();
-      HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
-      assertEquals(api.insert("http-health-check", options), new ParseGlobalOperationTest().expected());
-   }
-
-   public void testDeleteHttpHealthCheckResponseIs2xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/global/httpHealthChecks/http-health-check")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/global_operation.json")).build();
-
-      HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).httpHeathChecks();
-
-      assertEquals(api.delete("http-health-check"),
-              new ParseGlobalOperationTest().expected());
-   }
-
-   public void testDeleteHttpHealthCheckResponseIs4xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/global/httpHealthChecks/http-health-check")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
-      HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).httpHeathChecks();
-
-      assertNull(api.delete("http-health-check"));
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(BASE_URL + "/party/global/httpHealthChecks")
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void list() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/httphealthcheck_list.json")).build();
-
-      HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).httpHeathChecks();
-
-      assertEquals(api.list().next(), new ParseHttpHealthCheckListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).httpHeathChecks();
-
-      assertFalse(api.list().hasNext());
-   }
-   
    public void testPatchHttpHealthChecksResponseIs2xx() {
       String healthCheckName = "http-health-check";
       HttpRequest patch = HttpRequest
@@ -163,7 +44,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineExpectT
 
        HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200)
                .payload(payloadFromResource("/global_operation.json")).build();
-   
+
        HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
                TOKEN_RESPONSE, patch,
                insertHttpHealthCheckResponse).httpHeathChecks();
@@ -171,24 +52,4 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineExpectT
        assertEquals(api.patch(healthCheckName, options), new ParseGlobalOperationTest().expected());
    }
 
-   public void testUpdateHttpHealthChecksResponseIs2xx() {
-      String healthCheckName = "http-health-check";
-      HttpRequest patch = HttpRequest
-            .builder()
-            .method("PUT")
-            .endpoint(BASE_URL + "/party/global/httpHealthChecks/" + healthCheckName)
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
-            .build();
-
-       HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200)
-               .payload(payloadFromResource("/global_operation.json")).build();
-
-       HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-               TOKEN_RESPONSE, patch,
-               insertHttpHealthCheckResponse).httpHeathChecks();
-       HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
-       assertEquals(api.update(healthCheckName, options), new ParseGlobalOperationTest().expected());
-   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
new file mode 100644
index 0000000..35b4e03
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
+import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckListTest;
+import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "HttpHealthCheckApiMockTest", singleThreaded = true)
+public class HttpHealthCheckApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception{
+      server.enqueue(jsonResponse("/httphealthcheck_get.json"));
+
+      assertEquals(httpHealthCheckApi().get("http-health-check-api-live-test"),
+            new ParseHttpHealthCheckTest().expected(url("/projects")));
+
+      assertSent(server, "GET", "/projects/party/global/httpHealthChecks/http-health-check-api-live-test");
+   }
+
+   public void get_4xx() throws Exception{
+      server.enqueue(response404());
+
+      assertNull(httpHealthCheckApi().get("http-health-check-api-live-test"));
+      assertSent(server, "GET", "/projects/party/global/httpHealthChecks/http-health-check-api-live-test");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/global_operation.json"));
+
+      HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions()
+         .timeoutSec(0).unhealthyThreshold(0);
+      assertEquals(httpHealthCheckApi().insert("http-health-check", options),
+            new ParseGlobalOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/global/httpHealthChecks",
+            stringFromResource("/httphealthcheck_insert.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/global_operation.json"));
+
+      assertEquals(httpHealthCheckApi().delete("http-health-check"),
+            new ParseGlobalOperationTest().expected(url("/projects")));
+
+      assertSent(server, "DELETE", "/projects/party/global/httpHealthChecks/http-health-check");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(httpHealthCheckApi().delete("http-health-check"));
+
+      assertSent(server, "DELETE", "/projects/party/global/httpHealthChecks/http-health-check");
+   }
+
+   public void update() throws Exception {
+      server.enqueue(jsonResponse("/global_operation.json"));
+
+      HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions()
+         .timeoutSec(0).unhealthyThreshold(0);
+      assertEquals(httpHealthCheckApi().update("http-health-check", options),
+            new ParseGlobalOperationTest().expected(url("/projects")));
+
+      assertSent(server, "PUT", "/projects/party/global/httpHealthChecks/http-health-check",
+            stringFromResource("/httphealthcheck_insert.json"));
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/httphealthcheck_list.json"));
+
+      assertEquals(httpHealthCheckApi().list().next(),
+            new ParseHttpHealthCheckListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/httpHealthChecks");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(httpHealthCheckApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/global/httpHealthChecks");
+   }
+
+
+   HttpHealthCheckApi httpHealthCheckApi() {
+      return api().httpHeathChecks();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
index 7fd62c5..ccdc039 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
@@ -78,35 +78,35 @@ public class ImageApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       assertSent(server, "DELETE", "/projects/party/global/images/centos-6-2-v20120326");
    }
 
-   public void list() throws InterruptedException {
+   public void list() throws Exception {
       server.enqueue(jsonResponse("/image_list.json"));
 
       assertEquals(imageApi().list().next(), new ParseImageListTest().expected(url("/projects")));
       assertSent(server, "GET", "/projects/party/global/images");
    }
 
-   public void list_empty() throws InterruptedException {
+   public void list_empty() throws Exception {
       server.enqueue(jsonResponse("/list_empty.json"));
 
       assertFalse(imageApi().list().hasNext());
       assertSent(server, "GET", "/projects/party/global/images");
    }
 
-   public void listInProject() throws InterruptedException {
+   public void listInProject() throws Exception {
       server.enqueue(jsonResponse("/image_list.json"));
 
       assertEquals(imageApi().listInProject("centos-cloud").next(), new ParseImageListTest().expected(url("/projects")));
       assertSent(server, "GET", "/projects/centos-cloud/global/images");
    }
 
-   public void listInProject_empty() throws InterruptedException {
+   public void listInProject_empty() throws Exception {
       server.enqueue(jsonResponse("/list_empty.json"));
 
       assertFalse(imageApi().listInProject("centos-cloud").hasNext());
       assertSent(server, "GET", "/projects/centos-cloud/global/images");
    }
 
-   public void createImageFromPd_2xx() throws InterruptedException{
+   public void createImageFromPd_2xx() throws Exception{
       server.enqueue(jsonResponse("/operation.json"));
 
       assertEquals(imageApi().createFromDisk("my-image", url("/projects/party/zones/us-central1-a/disks/mydisk")),
@@ -114,7 +114,7 @@ public class ImageApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       assertSent(server, "POST", "/projects/party/global/images", stringFromResource("/image_insert_from_pd.json"));
    }
 
-   public void deprecateImage_2xx() throws InterruptedException{
+   public void deprecateImage_2xx() throws Exception{
       String imageName = "test-image";
       server.enqueue(jsonResponse("/operation.json"));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
deleted file mode 100644
index 1742320..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.jclouds.googlecomputeengine.features.ProjectApiExpectTest.GET_PROJECT_REQUEST;
-import static org.jclouds.googlecomputeengine.features.ProjectApiExpectTest.GET_PROJECT_RESPONSE;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-import java.util.Arrays;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.AttachDisk;
-import org.jclouds.googlecomputeengine.domain.Metadata;
-import org.jclouds.googlecomputeengine.domain.NewInstance;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseInstanceSerialOutputTest;
-import org.jclouds.googlecomputeengine.parse.ParseInstanceTest;
-import org.jclouds.googlecomputeengine.parse.ParseZoneOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-@Test(groups = "unit", testName = "InstanceApiExpectTest")
-public class InstanceApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public static final HttpRequest GET_INSTANCE_REQUEST = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(BASE_URL + "/party/zones/us-central1-a/instances/test-1")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse GET_INSTANCE_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/instance_get.json")).build();
-
-   public static final HttpRequest LIST_INSTANCES_REQUEST = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(BASE_URL + "/party/zones/us-central1-a/instances")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse LIST_INSTANCES_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/instance_list.json")).build();
-
-   public static final HttpResponse CREATE_INSTANCE_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/zone_operation.json")).build();
-
-   public void testGetInstanceResponseIs2xx() throws Exception {
-
-      InstanceApi api = requestsSendResponses(
-              requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE,
-              GET_INSTANCE_REQUEST, GET_INSTANCE_RESPONSE).instancesInZone("us-central1-a");
-
-      assertEquals(api.get("test-1"), new ParseInstanceTest().expected());
-   }
-
-   public void testGetInstanceResponseIs4xx() throws Exception {
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_INSTANCE_REQUEST, response).instancesInZone("us-central1-a");
-
-      assertNull(api.get("test-1"));
-   }
-
-   public void testGetInstanceSerialPortOutput() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/instances/test-1/serialPort")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/instance_serial_port.json")).build();
-
-
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).instancesInZone("us-central1-a");
-
-      assertEquals(api.getSerialPortOutput("test-1"), new ParseInstanceSerialOutputTest().expected());
-   }
-
-   public void testInsertInstanceResponseIs2xxNoOptions() {
-      HttpRequest insert = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/instances")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/instance_insert_simple.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      InstanceApi api = requestsSendResponses(ImmutableMap.of(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_PROJECT_REQUEST, GET_PROJECT_RESPONSE,
-              requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, insert,
-              CREATE_INSTANCE_RESPONSE)).instancesInZone("us-central1-a");
-
-      NewInstance newInstance = NewInstance.create(
-            "test-1", // name
-            URI.create(BASE_URL + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // machineType
-            URI.create(BASE_URL + "/party/global/networks/default"), // network
-            URI.create(BASE_URL + "/party/global/images/centos-6-2-v20120326") // sourceImage
-      );
-
-      assertEquals(api.create(newInstance), new ParseZoneOperationTest().expected());
-   }
-
-   public void testInsertInstanceResponseIs2xxAllOptions() {
-      HttpRequest insert = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/instances")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/instance_insert.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse insertInstanceResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_operation.json")).build();
-
-      InstanceApi api = requestsSendResponses(ImmutableMap.of(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_PROJECT_REQUEST, GET_PROJECT_RESPONSE,
-              requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, insert, insertInstanceResponse)).instancesInZone("us-central1-a");
-
-      NewInstance newInstance = NewInstance.create(
-            "test-1", // name
-            URI.create(BASE_URL + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // machineType
-            URI.create(BASE_URL + "/party/global/networks/default"), // network
-            Arrays.asList(AttachDisk.existingBootDisk(URI.create(BASE_URL + "/party/zones/us-central1-a/disks/test"))),
-            "desc" // description
-      );
-
-      newInstance.metadata().put("aKey", "aValue");
-      assertEquals(api.create(newInstance), new ParseZoneOperationTest().expected());
-   }
-
-   public void testDeleteInstanceResponseIs2xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/instances/test-1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_operation.json")).build();
-
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).instancesInZone("us-central1-a");
-
-      assertEquals(api.delete("test-1"), new ParseZoneOperationTest().expected());
-   }
-
-   public void testDeleteInstanceResponseIs4xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/instances/test-1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).instancesInZone("us-central1-a");
-
-      assertNull(api.delete("test-1"));
-   }
-
-   public void list() {
-      InstanceApi api = requestsSendResponses(
-              requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE,
-              LIST_INSTANCES_REQUEST, LIST_INSTANCES_RESPONSE).instancesInZone("us-central1-a");
-
-      assertTrue(api.list().hasNext());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, LIST_INSTANCES_REQUEST, response).instancesInZone("us-central1-a");
-
-      assertFalse(api.list().hasNext());
-   }
-
-   public void testSetInstanceMetadataResponseIs2xx() {
-      HttpRequest setMetadata = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/instances/test-1/setMetadata")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/instance_set_metadata.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_operation.json")).build();
-
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, setMetadata, setMetadataResponse).instancesInZone("us-central1-a");
-
-      assertEquals(api.setMetadata("test-1", Metadata.create("efgh").put("foo", "bar")),
-              new ParseZoneOperationTest().expected());
-   }
-
-   public void testSetInstanceTagsResponseIs2xx() {
-      HttpRequest setTags = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/instances/test-1/setTags")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/instance_set_tags.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse setTagsResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_operation.json")).build();
-
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, setTags, setTagsResponse).instancesInZone("us-central1-a");
-
-      assertEquals(api.setTags("test-1", ImmutableList.of("foo", "bar"), "efgh"),
-              new ParseZoneOperationTest().expected());
-   }
-
-   public void testResetInstanceResponseIs2xx() {
-      HttpRequest reset = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/instances/test-1/reset")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse resetResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_operation.json")).build();
-
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, reset, resetResponse).instancesInZone("us-central1-a");
-
-      assertEquals(api.reset("test-1"),
-              new ParseZoneOperationTest().expected());
-   }
-
-   public void testAttachDiskResponseIs2xx() {
-      HttpRequest attach = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/instances/test-1/attachDisk")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/instance_attach_disk.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse attachResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_operation.json")).build();
-
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, attach, attachResponse).instancesInZone("us-central1-a");
-
-      assertEquals(api.attachDisk("test-1",
-              AttachDisk.create(AttachDisk.Type.PERSISTENT,
-                                       AttachDisk.Mode.READ_ONLY,
-                                       URI.create(BASE_URL + "/party/zones/us-central1-a/disks/testimage1"),
-                                       null,
-                                       false,
-                                       null,
-                                       true)),
-              new ParseZoneOperationTest().expected());
-   }
-
-   public void testDetachDiskResponseIs2xx() {
-      HttpRequest detach = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/instances/test-1/detachDisk?deviceName=test-disk-1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .build();
-
-      HttpResponse detachResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_operation.json")).build();
-
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, detach, detachResponse).instancesInZone("us-central1-a");
-
-      assertEquals(api.detachDisk("test-1", "test-disk-1"),
-              new ParseZoneOperationTest().expected());
-   }
-}
-
-

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
index 56cc5f9..45abb94 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
@@ -17,25 +17,165 @@
 package org.jclouds.googlecomputeengine.features;
 
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
 
-import org.jclouds.googlecomputeengine.domain.Operation;
+import java.net.URI;
+import java.util.Arrays;
+
+import org.jclouds.googlecomputeengine.domain.AttachDisk;
+import org.jclouds.googlecomputeengine.domain.Metadata;
+import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseInstanceListTest;
+import org.jclouds.googlecomputeengine.parse.ParseInstanceSerialOutputTest;
+import org.jclouds.googlecomputeengine.parse.ParseInstanceTest;
 import org.jclouds.googlecomputeengine.parse.ParseZoneOperationTest;
 import org.testng.annotations.Test;
 
+import com.google.common.collect.ImmutableList;
+
 @Test(groups = "unit", testName = "InstanceApiMockTest", singleThreaded = true)
 public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
 
-   public void setDiskAutoDeleteResponseIs2xx() throws Exception {
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/instance_get.json"));
+
+      assertEquals(instanceApi().get("test-1"), new ParseInstanceTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-1");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(instanceApi().get("test-1"));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-1");
+   }
+
+   public void getInstanceSerialPortOutput() throws Exception {
+      server.enqueue(jsonResponse("/instance_serial_port.json"));
+
+      assertEquals(instanceApi().getSerialPortOutput("test-1"),
+            new ParseInstanceSerialOutputTest().expected());
+
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-1/serialPort");
+   }
+
+   public void insert_noOptions() throws Exception {
       server.enqueue(jsonResponse("/zone_operation.json"));
 
-      InstanceApi instanceApi = api().instancesInZone("us-central1-a");
+      NewInstance newInstance = NewInstance.create(
+            "test-1", // name
+            URI.create(url("/projects/party/zones/us-central1-a/machineTypes/n1-standard-1")), // machineType
+            URI.create(url("/projects/party/global/networks/default")), // network
+            URI.create(url("/projects/party/global/images/centos-6-2-v20120326")) // sourceImage
+      );
+
+      assertEquals(instanceApi().create(newInstance), new ParseZoneOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances",
+            stringFromResource("/instance_insert_simple.json"));
+   }
+
+   public void insert_allOptions() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
 
-      Operation o = instanceApi.setDiskAutoDelete("test-1", "test-disk-1", true);
-      int port = server.getPort();
-      // Endpoint is different for URIs such as zone and selfLink.
-      assertEquals(o, new ParseZoneOperationTest().expected("http://localhost:" + port + "/projects"));
+      NewInstance newInstance = NewInstance.create(
+            "test-1", // name
+            URI.create(url("/projects/party/zones/us-central1-a/machineTypes/n1-standard-1")), // machineType
+            URI.create(url("/projects/party/global/networks/default")), // network
+            Arrays.asList(AttachDisk.existingBootDisk(URI.create(url("/projects/party/zones/us-central1-a/disks/test")))),
+            "desc" // description
+      );
+
+      newInstance.metadata().put("aKey", "aValue");
+      assertEquals(instanceApi().create(newInstance), new ParseZoneOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances",
+            stringFromResource("/instance_insert.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(instanceApi().delete("test-1"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/instances/test-1");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(instanceApi().delete("test-1"));
+      assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/instances/test-1");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/instance_list.json"));
+
+      assertEquals(instanceApi().list().next(), new ParseInstanceListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(instanceApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances");
+   }
+
+   public void setMetadata() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(instanceApi().setMetadata("test-1", Metadata.create("efgh").put("foo", "bar")),
+            new ParseZoneOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/setMetadata",
+            stringFromResource("/instance_set_metadata.json"));
+   }
+
+   public void setTags() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(instanceApi().setTags("test-1", ImmutableList.of("foo", "bar"), "efgh"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/setTags",
+            stringFromResource("/instance_set_tags.json"));
+   }
+
+   public void reset() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(instanceApi().reset("test-1"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/reset");
+   }
+
+   public void attachDisk() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(instanceApi().attachDisk("test-1",
+            AttachDisk.create(AttachDisk.Type.PERSISTENT,
+                                     AttachDisk.Mode.READ_ONLY,
+                                     URI.create(url("/projects/party/zones/us-central1-a/disks/testimage1")),
+                                     null, false, null, true)),
+            new ParseZoneOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/attachDisk",
+            stringFromResource("/instance_attach_disk.json"));
+   }
+
+   public void detatchDisk() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(instanceApi().detachDisk("test-1", "test-disk-1"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/detachDisk?deviceName=test-disk-1");
+   }
+
+   public void setDiskAutoDelete() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(instanceApi().setDiskAutoDelete("test-1", "test-disk-1", true),
+            new ParseZoneOperationTest().expected(url("/projects")));
 
       assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/setDiskAutoDelete"
           + "?deviceName=test-disk-1&autoDelete=true");
@@ -44,12 +184,14 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
    public void setScheduling() throws Exception {
       server.enqueue(jsonResponse("/zone_operation.json"));
 
-      InstanceApi instanceApi = api().instancesInZone("us-central1-a");
-
-      assertEquals(instanceApi.setScheduling("test-1", OnHostMaintenance.TERMINATE, true),
+      assertEquals(instanceApi().setScheduling("test-1", OnHostMaintenance.TERMINATE, true),
             new ParseZoneOperationTest().expected(url("/projects")));
 
       assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/setScheduling",
             "{\"onHostMaintenance\": \"TERMINATE\",\"automaticRestart\": true}");
    }
+
+   InstanceApi instanceApi(){
+      return api().instancesInZone("us-central1-a");
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiExpectTest.java
deleted file mode 100644
index 01be4c3..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiExpectTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseMachineTypeListTest;
-import org.jclouds.googlecomputeengine.parse.ParseMachineTypeTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "MachineTypeApiExpectTest")
-public class MachineTypeApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public static final HttpRequest LIST_MACHINE_TYPES_REQUEST = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(BASE_URL + "/party/zones/us-central1-a/machineTypes")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse LIST_MACHINE_TYPES_RESPONSE = HttpResponse.builder()
-           .statusCode(200)
-           .payload(staticPayloadFromResource("/machinetype_list.json"))
-           .build();
-
-   public static final HttpRequest LIST_CENTRAL1B_MACHINE_TYPES_REQUEST = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(BASE_URL + "/party/zones/us-central1-b/machineTypes")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse LIST_CENTRAL1B_MACHINE_TYPES_RESPONSE = HttpResponse.builder()
-           .statusCode(200)
-           .payload(staticPayloadFromResource("/machinetype_list_central1b.json"))
-           .build();
-
-   public void testGetMachineTypeResponseIs2xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/machineTypes/n1-standard-1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/machinetype.json")).build();
-
-      MachineTypeApi machineTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).machineTypesInZone("us-central1-a");
-
-      assertEquals(machineTypeApi.get("n1-standard-1"), new ParseMachineTypeTest().expected());
-   }
-
-   public void testGetMachineTypeResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/machineTypes/n1-standard-1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      MachineTypeApi machineTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).machineTypesInZone("us-central1-a");
-
-      assertNull(machineTypeApi.get("n1-standard-1"));
-   }
-
-   public void list() throws Exception {
-
-      MachineTypeApi machineTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, LIST_MACHINE_TYPES_REQUEST, LIST_MACHINE_TYPES_RESPONSE).machineTypesInZone(
-            "us-central1-a");
-
-      assertEquals(machineTypeApi.list().next(), new ParseMachineTypeListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      MachineTypeApi machineTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE,
-            LIST_MACHINE_TYPES_REQUEST, response).machineTypesInZone("us-central1-a");
-
-      assertFalse(machineTypeApi.list().hasNext());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiMockTest.java
new file mode 100644
index 0000000..058cf57
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiMockTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseMachineTypeListTest;
+import org.jclouds.googlecomputeengine.parse.ParseMachineTypeTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "MachineTypeApiMockTest", singleThreaded = true)
+public class MachineTypeApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception{
+      server.enqueue(jsonResponse("/machinetype.json"));
+
+      assertEquals(machineTypeApi().get("n1-standard-1"),
+            new ParseMachineTypeTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/machineTypes/n1-standard-1");
+   }
+
+   public void get_4xx() throws Exception{
+      server.enqueue(response404());
+
+      assertNull(machineTypeApi().get("n1-standard-1"));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/machineTypes/n1-standard-1");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/machinetype_list.json"));
+
+      assertEquals(machineTypeApi().list().next(), new ParseMachineTypeListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/machineTypes");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(machineTypeApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/machineTypes");
+   }
+
+   MachineTypeApi machineTypeApi() {
+      return api().machineTypesInZone("us-central1-a");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
index 1908914..5041211 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
@@ -40,15 +40,20 @@ public class ParseAddressListTest extends BaseGoogleComputeEngineParseTest<ListP
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<Address> expected() {
-      Address address1 = new ParseAddressTest().expected();
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<Address> expected(String baseUrl) {
+      Address address1 = new ParseAddressTest().expected(baseUrl);
       Address address2 = Address.create( //
             "4881363978908129158", // id
-            URI.create(BASE_URL + "/party/regions/us-central1/addresses/test-ip2"), // selfLink
+            URI.create(baseUrl + "/party/regions/us-central1/addresses/test-ip2"), // selfLink
             "test-ip2", // name
             "", // description
             "RESERVED", // status
             null, // user
-            URI.create(BASE_URL + "/party/regions/us-central1"), // region
+            URI.create(baseUrl + "/party/regions/us-central1"), // region
             "173.255.118.115" // address
       );
       return ForwardingListPage.create( //

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
index 28feb2e..3dd748f 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
@@ -36,14 +36,19 @@ public class ParseAddressTest extends BaseGoogleComputeEngineParseTest<Address>
 
    @Override @Consumes(APPLICATION_JSON)
    public Address expected() {
-      return Address.create( //
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Address expected(String baseUrl) {
+      return Address.create( //d
             "4439373783165447583", // id
-            URI.create(BASE_URL + "/party/regions/us-central1/addresses/test-ip1"), // selfLink
+            URI.create(baseUrl + "/party/regions/us-central1/addresses/test-ip1"), // selfLink
             "test-ip1", // name
             "", // description
             "RESERVED", // status
             null, // user
-            URI.create(BASE_URL + "/party/regions/us-central1"), // region
+            URI.create(baseUrl + "/party/regions/us-central1"), // region
             "173.255.115.190" // address
       );
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceGetHealthTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceGetHealthTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceGetHealthTest.java
index b131b43..5eab529 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceGetHealthTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceGetHealthTest.java
@@ -39,8 +39,12 @@ public class ParseBackendServiceGetHealthTest extends BaseGoogleComputeEnginePar
    @Override
    @Consumes(APPLICATION_JSON)
    public BackendServiceGroupHealth expected() {
-      URI uri = URI.create("https://www.googleapis.com/compute/v1/projects/"
-                           + "myproject/zones/us-central1-a/instances/"
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public BackendServiceGroupHealth expected(String baseUrl) {
+      URI uri = URI.create(baseUrl + "/myproject/zones/us-central1-a/instances/"
                            + "jclouds-test");
       return BackendServiceGroupHealth.create(
             ImmutableList.of(HealthStatus.create(

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceListTest.java
index 9397557..7bd0b4a 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceListTest.java
@@ -42,16 +42,21 @@ public class ParseBackendServiceListTest extends BaseGoogleComputeEngineParseTes
    @Override
    @Consumes(APPLICATION_JSON)
    public ListPage<BackendService> expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<BackendService> expected(String baseUrl) {
       return ForwardingListPage.create(
             ImmutableList.of(
-                  new ParseBackendServiceTest().expected(),
+                  new ParseBackendServiceTest().expected(baseUrl),
                   BackendService.create("12862241067393040785", //id
                         new SimpleDateFormatDateService().iso8601DateParse("2012-04-13T03:05:04.365"), //creationTimestamp,
-                        URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test-2"), //selfLink,
+                        URI.create(baseUrl + "/myproject/global/backendServices/jclouds-test-2"), //selfLink,
                         "jclouds-test-2", //name,
                         "Backend Service 2", //description
                         null, // backends,
-                        ImmutableList.of(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/jclouds-test")), //healthChecks,
+                        ImmutableList.of(URI.create(baseUrl + "/myproject/global/httpHealthChecks/jclouds-test")), //healthChecks,
                         45, //timeoutSec,
                         80, //port,
                         "HTTP", //protocol,

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceTest.java
index 004a9ec..51a63f4 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceTest.java
@@ -41,12 +41,12 @@ public class ParseBackendServiceTest extends BaseGoogleComputeEngineParseTest<Ba
    @Override
    @Consumes(MediaType.APPLICATION_JSON)
    public BackendService expected() {
-      URI selfLink = URI.create("https://www.googleapis.com/compute/v1/"
-                                + "projects/myproject/global/backendServices/"
-                                + "jclouds-test");
-      URI healthCheck = URI.create("https://www.googleapis.com/compute/v1/"
-                                   + "projects/myproject/global/httpHealthChecks"
-                                   + "/jclouds-test");
+      return expected(BASE_URL);
+   }
+
+   public BackendService expected(String baseUrl) {
+      URI selfLink = URI.create(baseUrl + "/myproject/global/backendServices/jclouds-test");
+      URI healthCheck = URI.create(baseUrl + "/myproject/global/httpHealthChecks/jclouds-test");
       URI group = URI.create("https://www.googleapis.com/resourceviews/v1beta1"
                              + "/projects/myproject/zones/us-central1-a/"
                              + "resourceViews/jclouds-test");

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java
index ab76aca..2f6ca3d 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java
@@ -38,8 +38,13 @@ public class ParseDiskListTest extends BaseGoogleComputeEngineParseTest<ListPage
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<Disk> expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<Disk> expected(String baseUrl) {
       return ForwardingListPage.create( //
-            ImmutableList.of(new ParseDiskTest().expected()), // items
+            ImmutableList.of(new ParseDiskTest().expected(baseUrl)), // items
             null // nextPageToken
       );
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
index 67689ab..9ce7449 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
@@ -36,15 +36,20 @@ public class ParseDiskTest extends BaseGoogleComputeEngineParseTest<Disk> {
 
    @Override @Consumes(APPLICATION_JSON)
    public Disk expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Disk expected(String baseUrl){
       return Disk.create( //
             "13050421646334304115", // id
-            URI.create(BASE_URL + "/party/zones/us-central1-a"), // zone
+            URI.create(baseUrl + "/party/zones/us-central1-a"), // zone
             "READY", // status
             "testimage1", // name
             null, // description
             1, // sizeGb
-            URI.create(BASE_URL + "/party/zones/us-central1-a/disks/testimage1"), // selfLink
-            URI.create(BASE_URL + "/studied-point-720/zones/us-central1-a/diskTypes/pd-standard") // type
+            URI.create(baseUrl + "/party/zones/us-central1-a/disks/testimage1"), // selfLink
+            URI.create(baseUrl + "/studied-point-720/zones/us-central1-a/diskTypes/pd-standard") // type
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
index 8b02a82..e6a7f00 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
@@ -40,13 +40,18 @@ public class ParseFirewallListTest extends BaseGoogleComputeEngineParseTest<List
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<Firewall> expected() {
-      Firewall firewall1 = new ParseFirewallTest().expected();
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<Firewall> expected(String baseUrl) {
+      Firewall firewall1 = new ParseFirewallTest().expected(baseUrl);
       Firewall firewall2 = Firewall.create( //
             "12862241067393040785", // id
-            URI.create(BASE_URL + "/google/global/firewalls/default-ssh"), // selfLink
+            URI.create(baseUrl + "/google/global/firewalls/default-ssh"), // selfLink
             "default-ssh", // name
             "SSH allowed from anywhere", // description
-            URI.create(BASE_URL + "/google/global/networks/default"), // network
+            URI.create(baseUrl + "/google/global/networks/default"), // network
             ImmutableList.of("0.0.0.0/0"), // sourceRanges
             null, // sourceTags
             null, // targetTags

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
index e4219a7..4ac6bc1 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
@@ -39,12 +39,17 @@ public class ParseFirewallTest extends BaseGoogleComputeEngineParseTest<Firewall
 
    @Override @Consumes(APPLICATION_JSON)
    public Firewall expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Firewall expected(String base_url) {
       return Firewall.create( //
             "12862241031274216284", // id
-            URI.create(BASE_URL + "/party/global/firewalls/jclouds-test"), // selfLink
+            URI.create(base_url + "/party/global/firewalls/jclouds-test"), // selfLink
             "jclouds-test", // name
             "Internal traffic from default allowed", // description
-            URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network
+            URI.create(base_url + "/party/global/networks/jclouds-test"), // network
             ImmutableList.of("10.0.0.0/8"), // sourceRanges
             null, // sourceTags
             null, // targetTags

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
index 2cc546f..9e17644 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java
@@ -38,8 +38,13 @@ public class ParseForwardingRuleListTest extends BaseGoogleComputeEngineParseTes
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<ForwardingRule> expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<ForwardingRule> expected(String baseUrl) {
       return ForwardingListPage.create( //
-            ImmutableList.of(new ParseForwardingRuleTest().expected()), // items
+            ImmutableList.of(new ParseForwardingRuleTest().expected(baseUrl)), // items
             null // nextPageToken
       );
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
index 7b09dc6..ce21f9b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java
@@ -37,17 +37,21 @@ public class ParseForwardingRuleTest extends BaseGoogleComputeEngineParseTest<Fo
 
    @Override @Consumes(APPLICATION_JSON)
    public ForwardingRule expected() {
+      return expected(BASE_URL);
+   }
+
+   public ForwardingRule expected(String baseUrl) {
       return ForwardingRule.create( //
             "6732523704970219884", // id
-            URI.create(BASE_URL + "/party/regions/europe-west1/forwardingRules/test-forwarding-rule"), // selfLink
+            URI.create(baseUrl + "/party/regions/europe-west1/forwardingRules/test-forwarding-rule"), // selfLink
             "test-forwarding-rule", // name
             null, // description
             new SimpleDateFormatDateService().iso8601DateParse("2014-01-08T06:51:10.809-08:00"), // creationTimestamp
-            URI.create(BASE_URL + "/party/regions/europe-west1"), // region
+            URI.create(baseUrl + "/party/regions/europe-west1"), // region
             "23.251.129.77", // ipAddress
             ForwardingRule.IPProtocol.TCP, // ipProtocol
             "1-65535", // portRange
-            URI.create(BASE_URL + "/party/regions/europe-west1/targetPools/test-target-pool") // target
+            URI.create(baseUrl + "/party/regions/europe-west1/targetPools/test-target-pool") // target
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationTest.java
index 9aac11c..78ebb5f 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationTest.java
@@ -36,12 +36,17 @@ public class ParseGlobalOperationTest extends BaseGoogleComputeEngineParseTest<O
 
    @Override @Consumes(APPLICATION_JSON)
    public Operation expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Operation expected(String baseUrl) {
       return Operation.create( //
             "13053095055850848306", // id
-            URI.create(BASE_URL + "/party/global/operations/operation-1354084865060"),
+            URI.create(baseUrl + "/party/global/operations/operation-1354084865060"),
             "operation-1354084865060", // name
             null, // description
-            URI.create(BASE_URL + "/party/global/firewalls/jclouds-test-delete"), // targetLink
+            URI.create(baseUrl + "/party/global/firewalls/jclouds-test-delete"), // targetLink
             "13053094017547040099", // targetId
             null, // clientOperationId
             Operation.Status.DONE, // status

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
index 9d9c269..687f10f 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
@@ -40,10 +40,15 @@ public class ParseHttpHealthCheckListTest extends BaseGoogleComputeEngineParseTe
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<HttpHealthCheck> expected() {
-      HttpHealthCheck healthCheck1 = new ParseHttpHealthCheckTest().expected();
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<HttpHealthCheck> expected(String baseUrl) {
+      HttpHealthCheck healthCheck1 = new ParseHttpHealthCheckTest().expected(baseUrl);
       HttpHealthCheck healthCheck2 = HttpHealthCheck.create( //
             "1035854271083519643", // id
-            URI.create(BASE_URL + "/party-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check"),
+            URI.create(baseUrl + "/party-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check"),
             // selfLink
             "myname-andrea-kmzmi1bh-http-health-check", // name
             null, // description
@@ -57,7 +62,7 @@ public class ParseHttpHealthCheckListTest extends BaseGoogleComputeEngineParseTe
       );
       HttpHealthCheck healthCheck3 = HttpHealthCheck.create( //
             "7006563292274658743", // id
-            URI.create(BASE_URL + "/party-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check"),
+            URI.create(baseUrl + "/party-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check"),
             // selfLink
             "myname-andrea-zk7gadwq-http-health-check", // name
             null, // description


[42/50] [abbrv] jclouds git commit: Do not use AutoValue shaded imports

Posted by na...@apache.org.
Do not use AutoValue shaded imports


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

Branch: refs/heads/master
Commit: 3b6b73d9a17527ecdc04a6cac968e89bc45b74af
Parents: d8222cf
Author: Ignasi Barrera <na...@apache.org>
Authored: Wed Jun 10 13:00:33 2015 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Jun 10 13:00:33 2015 +0200

----------------------------------------------------------------------
 .../googlecomputeengine/compute/GoogleComputeEngineService.java | 5 ++---
 .../googlecomputeengine/compute/predicates/GroupIsEmpty.java    | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/3b6b73d9/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
index 1dc337c..74c7c57 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
@@ -16,8 +16,8 @@
  */
 package org.jclouds.googlecomputeengine.compute;
 
-import static autovalue.shaded.com.google.common.common.collect.Sets.newHashSet;
 import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Sets.newHashSet;
 import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
 import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
 import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
@@ -65,12 +65,11 @@ import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.features.FirewallApi;
 import org.jclouds.scriptbuilder.functions.InitAdminAccess;
 
-import autovalue.shaded.com.google.common.common.collect.ImmutableSet;
-
 import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.base.Predicate;
 import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.util.concurrent.Atomics;
 import com.google.common.util.concurrent.ListeningExecutorService;
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3b6b73d9/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java
index d80e888..3b5c093 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java
@@ -16,7 +16,7 @@
  */
 package org.jclouds.googlecomputeengine.compute.predicates;
 
-import static autovalue.shaded.com.google.common.common.collect.Iterables.isEmpty;
+import static com.google.common.collect.Iterables.isEmpty;
 import static com.google.common.collect.Sets.filter;
 import static org.jclouds.compute.predicates.NodePredicates.all;
 import static org.jclouds.compute.predicates.NodePredicates.inGroup;


[10/50] [abbrv] jclouds git commit: Updates to Address, Disk, Image, Operations + others

Posted by na...@apache.org.
Updates to Address, Disk, Image, Operations + others


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

Branch: refs/heads/master
Commit: 6918ab1089482e94080b6f62119a129f1110c9c4
Parents: 1d3ad70
Author: Daniel Broudy <br...@google.com>
Authored: Tue Dec 2 15:34:58 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Dec 8 23:25:59 2014 +0100

----------------------------------------------------------------------
 .../binders/DiskCreationBinder.java             |   4 +-
 .../compute/predicates/AtomicOperationDone.java |   2 +-
 .../googlecomputeengine/domain/Address.java     |  18 ++-
 .../domain/BackendService.java                  |   7 +-
 .../googlecomputeengine/domain/Disk.java        |  34 +++++-
 .../googlecomputeengine/domain/DiskType.java    |   9 +-
 .../googlecomputeengine/domain/Firewall.java    |   9 +-
 .../googlecomputeengine/domain/Image.java       |  35 +++++-
 .../googlecomputeengine/domain/Operation.java   |  89 +++++++++++---
 .../features/AddressApi.java                    |   8 ++
 .../googlecomputeengine/features/DiskApi.java   |  20 +++-
 .../googlecomputeengine/features/ImageApi.java  |   8 ++
 .../options/AddressCreationOptions.java         |  62 ++++++++++
 .../options/BackendServiceOptions.java          |  10 ++
 .../options/DiskCreationOptions.java            |  45 +++++--
 .../options/FirewallOptions.java                |  16 +++
 .../options/ImageCreationOptions.java           |  87 ++++++++++++++
 .../binders/DiskCreationBinderTest.java         |  11 +-
 .../functions/FirewallToIpPermissionTest.java   |   2 +
 .../GoogleComputeEngineImageToImageTest.java    |  12 +-
 .../features/AddressApiMockTest.java            |  13 ++
 .../features/DiskApiLiveTest.java               |  13 +-
 .../features/DiskApiMockTest.java               |  30 +++--
 .../features/FirewallApiExpectTest.java         |   1 +
 .../features/ImageApiLiveTest.java              |   4 +-
 .../features/ImageApiMockTest.java              |  20 +++-
 .../features/InstanceApiLiveTest.java           |   7 +-
 .../features/SnapshotApiLiveTest.java           |   4 +-
 .../BaseGoogleComputeEngineApiLiveTest.java     |   2 +-
 .../parse/ParseAddressListTest.java             |   6 +-
 .../parse/ParseAddressTest.java                 |   8 +-
 .../parse/ParseBackendServiceListTest.java      |   3 +-
 .../parse/ParseBackendServiceTest.java          |   3 +-
 .../parse/ParseDiskTest.java                    |  11 +-
 .../parse/ParseDiskTypeListTest.java            |   3 +-
 .../parse/ParseDiskTypeTest.java                |   3 +-
 .../parse/ParseFirewallListTest.java            |   1 +
 .../parse/ParseFirewallTest.java                |   1 +
 .../parse/ParseGlobalOperationTest.java         |   2 +
 .../parse/ParseImageTest.java                   |  14 ++-
 .../parse/ParseOperationTest.java               |  18 ++-
 .../parse/ParseRegionOperationTest.java         |   2 +
 .../parse/ParseZoneOperationTest.java           |   2 +
 .../NetworkFirewallPredicatesTest.java          |   3 +
 .../src/test/resources/address_get.json         |  21 ++--
 .../src/test/resources/address_list.json        |  59 ++++-----
 .../aggregated_global_operation_list.json       |   1 +
 .../test/resources/disk_insert_sourceImage.json |   1 -
 .../src/test/resources/global_operation.json    |   1 +
 .../test/resources/global_operation_list.json   |   1 +
 .../src/test/resources/image_get.json           |  40 ++++---
 .../src/test/resources/image_list.json          |  54 +++++----
 .../test/resources/image_list_single_page.json  | 119 +++++++++++--------
 .../src/test/resources/operation.json           |  53 ++++++---
 .../src/test/resources/region_operation.json    |   1 +
 .../test/resources/region_operation_list.json   |   1 +
 .../src/test/resources/zone_operation.json      |   1 +
 .../src/test/resources/zone_operation_list.json |   1 +
 58 files changed, 772 insertions(+), 244 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinder.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinder.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinder.java
index 16825e5..b91671d 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinder.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinder.java
@@ -37,11 +37,11 @@ public final class DiskCreationBinder implements MapBinder {
       try {
          json.beginObject();
          json.name("name").value(postParams.get("name").toString());
-         json.name("sizeGb").value((Integer) postParams.get("sizeGb"));
+         json.name("sizeGb").value(options.sizeGb());
          json.name("type").value(options.type() != null ? options.type().toString() : null);
-         json.name("sourceImage").value(options.sourceImage() != null ? options.sourceImage().toString() : null);
          json.name("sourceSnapshot")
                .value(options.sourceSnapshot() != null ? options.sourceSnapshot().toString() : null);
+         json.name("description").value(options.description());
          json.endObject();
          json.close();
       } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicOperationDone.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicOperationDone.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicOperationDone.java
index 1f917ae..2bf1c80 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicOperationDone.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicOperationDone.java
@@ -40,7 +40,7 @@ public final class AtomicOperationDone implements Predicate<AtomicReference<Oper
       checkNotNull(input.get(), "operation");
       Operation current = resources.operation(input.get().selfLink());
       input.set(current);
-      checkState(current.errors().isEmpty(), "Task ended in error %s", current); // ISE will break the loop.
+      checkState(current.error().errors().isEmpty(), "Task ended in error %s", current); // ISE will break the loop.
       switch (current.status()) {
          case DONE:
             return true;

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
index 1dea66f..ff7226d 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
@@ -17,6 +17,8 @@
 package org.jclouds.googlecomputeengine.domain;
 
 import java.net.URI;
+import java.util.Date;
+import java.util.List;
 
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
@@ -26,12 +28,18 @@ import com.google.auto.value.AutoValue;
 @AutoValue
 public abstract class Address {
 
+   public enum Status{
+      RESERVED,
+      IN_USE;
+   }
    public abstract String id();
 
    public abstract URI selfLink();
 
    public abstract String name();
 
+   public abstract Date creationTimestamp();
+
    @Nullable public abstract String description();
 
    /**
@@ -39,10 +47,10 @@ public abstract class Address {
     * A reserved address is currently available to the project and can be
     * used by a resource. An in-use address is currently being used by a resource.
     */
-   public abstract String status(); // TODO: enum
+   public abstract Status status();
 
    /** URL of the resource currently using this address. */
-   @Nullable public abstract URI user();
+   @Nullable public abstract List<URI> users();
 
    /** URL of the region where the address resides. */
    public abstract URI region();
@@ -50,10 +58,10 @@ public abstract class Address {
    /** The IP address represented by this resource. */
    public abstract String address();
 
-   @SerializedNames({ "id", "selfLink", "name", "description", "status", "user", "region", "address" })
-   public static Address create(String id, URI selfLink, String name, String description, String status, URI user,
+   @SerializedNames({ "id", "selfLink", "name", "creationTimestamp", "description", "status", "users", "region", "address" })
+   public static Address create(String id, URI selfLink, String name, Date creationTimestamp, String description, Status status, List<URI> users,
          URI region, String address) {
-      return new AutoValue_Address(id, selfLink, name, description, status, user, region, address);
+      return new AutoValue_Address(id, selfLink, name, creationTimestamp, description, status, users, region, address);
    }
 
    Address() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/BackendService.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/BackendService.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/BackendService.java
index 8b90a4f..f4b15c2 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/BackendService.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/BackendService.java
@@ -76,6 +76,7 @@ public abstract class BackendService {
    @Nullable public abstract int port();
    @Nullable public abstract String protocol();
    @Nullable public abstract String fingerprint();
+   @Nullable public abstract String portName();
 
    /**
     * @param timeoutSec Defaults to 30 when null.
@@ -83,18 +84,18 @@ public abstract class BackendService {
     */
    @SerializedNames({ "id", "creationTimestamp", "selfLink", "name", "description",
       "backends", "healthChecks", "timeoutSec", "port", "protocol",
-      "fingerprint"})
+      "fingerprint", "portName"})
    public static BackendService create(String id, Date creationTimestamp, URI selfLink,
                           String name, @Nullable String description,
                           @Nullable List<Backend> backends, List<URI> healthChecks,
                           @Nullable Integer timeoutSec, @Nullable Integer port,
                           @Nullable String protocol,
-                          @Nullable String fingerprint){
+                          @Nullable String fingerprint, String portName){
       return new AutoValue_BackendService(id, creationTimestamp, selfLink, name, description,
                             backends, healthChecks,
                             timeoutSec != null ? timeoutSec : 30,
                             port != null ? port : 80,
-                            protocol, fingerprint);
+                            protocol, fingerprint, portName);
    }
 
    BackendService(){

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
index 140f47a..88becb4 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
@@ -17,6 +17,8 @@
 package org.jclouds.googlecomputeengine.domain;
 
 import java.net.URI;
+import java.util.Date;
+import java.util.List;
 
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
@@ -25,11 +27,21 @@ import com.google.auto.value.AutoValue;
 
 @AutoValue
 public abstract class Disk {
+
+   public enum Status {
+      CREATING,
+      FAILED,
+      READY,
+      RESTORING;
+   }
+
    public abstract String id();
 
+   public abstract Date creationTimestamp();
+
    public abstract URI zone();
 
-   public abstract String status(); // TODO: enum
+   public abstract Status status();
 
    public abstract String name();
 
@@ -37,15 +49,27 @@ public abstract class Disk {
 
    public abstract int sizeGb();
 
+   @Nullable public abstract String sourceSnapshot();
+
+   @Nullable public abstract String sourceSnapshotId();
+
    public abstract URI selfLink();
 
+   @Nullable public abstract String sourceImage();
+
+   @Nullable public abstract String sourceImageId();
+
    /** URL of the corresponding disk type resource. */
    @Nullable public abstract URI type();
 
-   @SerializedNames({ "id", "zone", "status", "name", "description", "sizeGb", "selfLink", "type" })
-   public static Disk create(String id, URI zone, String status, String name, String description, int sizeGb,
-         URI selfLink, URI type) {
-      return new AutoValue_Disk(id, zone, status, name, description, sizeGb, selfLink, type);
+   @Nullable public abstract List<String> licenses();
+
+   @SerializedNames({ "id", "creationTimestamp", "zone", "status", "name", "description", "sizeGb", "sourceSnapshot",
+      "sourceSnapshotId", "selfLink", "sourceImage", "sourceImageId", "type", "licenses" })
+   public static Disk create(String id, Date creationTimestamp, URI zone, Status status, String name, String description, int sizeGb,
+         String sourceSnapshot, String sourceSnapshotId, URI selfLink, String sourceImage, String sourceImageId, URI type, List<String> licenses) {
+      return new AutoValue_Disk(id, creationTimestamp, zone, status, name, description, sizeGb,
+            sourceSnapshot, sourceSnapshotId, selfLink, sourceImage, sourceImageId, type, licenses);
    }
 
    Disk(){

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/DiskType.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/DiskType.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/DiskType.java
index bab2d08..e1c3fc3 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/DiskType.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/DiskType.java
@@ -17,6 +17,7 @@
 package org.jclouds.googlecomputeengine.domain;
 
 import java.net.URI;
+import java.util.Date;
 
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
@@ -26,6 +27,8 @@ import com.google.auto.value.AutoValue;
 @AutoValue
 public abstract class DiskType {
 
+   public abstract Date creationTimestamp();
+
    public abstract String name();
 
    @Nullable public abstract String description();
@@ -42,10 +45,10 @@ public abstract class DiskType {
    /** Server defined default disk size in GB. */
    public abstract long defaultDiskSizeGb();
 
-   @SerializedNames({ "name", "description", "validDiskSize", "deprecated", "zone", "selfLink", "defaultDiskSizeGb" })
-   public static DiskType create(String name, String description, String validDiskSize, Deprecated deprecated, URI zone,
+   @SerializedNames({ "creationTimestamp", "name", "description", "validDiskSize", "deprecated", "zone", "selfLink", "defaultDiskSizeGb" })
+   public static DiskType create(Date creationTimestamp, String name, String description, String validDiskSize, Deprecated deprecated, URI zone,
          URI selfLink, long defaultDiskSizeGb) {
-      return new AutoValue_DiskType(name, description, validDiskSize, deprecated, zone, selfLink, defaultDiskSizeGb);
+      return new AutoValue_DiskType(creationTimestamp, name, description, validDiskSize, deprecated, zone, selfLink, defaultDiskSizeGb);
    }
 
    DiskType() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
index 25ac6eb..f8acf8d 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
@@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.domain;
 import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
 
 import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.jclouds.javax.annotation.Nullable;
@@ -55,6 +56,8 @@ public abstract class Firewall {
 
    public abstract URI selfLink();
 
+   public abstract Date creationTimestamp();
+
    public abstract String name();
 
    @Nullable public abstract String description();
@@ -94,10 +97,10 @@ public abstract class Firewall {
    public abstract List<Rule> allowed();
 
    @SerializedNames(
-         { "id", "selfLink", "name", "description", "network", "sourceRanges", "sourceTags", "targetTags", "allowed" })
-   public static Firewall create(String id, URI selfLink, String name, String description, URI network,
+         { "id", "selfLink", "creationTimestamp", "name", "description", "network", "sourceRanges", "sourceTags", "targetTags", "allowed" })
+   public static Firewall create(String id, URI selfLink, Date creationTimestamp, String name, String description, URI network,
          List<String> sourceRanges, List<String> sourceTags, List<String> targetTags, List<Rule> allowed) {
-      return new AutoValue_Firewall(id, selfLink, name, description, network, copyOf(sourceRanges), copyOf(sourceTags),
+      return new AutoValue_Firewall(id, selfLink, creationTimestamp, name, description, network, copyOf(sourceRanges), copyOf(sourceTags),
             copyOf(targetTags), copyOf(allowed));
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
index e70e92e..b055ee2 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
@@ -17,6 +17,8 @@
 package org.jclouds.googlecomputeengine.domain;
 
 import java.net.URI;
+import java.util.Date;
+import java.util.List;
 
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
@@ -26,6 +28,12 @@ import com.google.auto.value.AutoValue;
 @AutoValue
 public abstract class Image {
 
+   public enum Status {
+        FAILED,
+        PENDING,
+        READY;
+   }
+
    @AutoValue
    public abstract static class RawDisk {
       /**
@@ -58,22 +66,39 @@ public abstract class Image {
 
    public abstract URI selfLink();
 
+   public abstract Date creationTimestamp();
+
    public abstract String name();
 
    @Nullable public abstract String description();
 
    /** Must be RAW; provided by the client when the disk image is created. */
    // TODO: if this is true, why bother listing it?
-   public abstract String sourceType();
+   @Nullable public abstract String sourceType();
 
    @Nullable public abstract RawDisk rawDisk();
 
    @Nullable public abstract Deprecated deprecated();
 
-   @SerializedNames({ "id", "selfLink", "name", "description", "sourceType", "rawDisk", "deprecated" })
-   public static Image create(String id, URI selfLink, String name, String description, String sourceType,
-         RawDisk rawDisk, Deprecated deprecated) {
-      return new AutoValue_Image(id, selfLink, name, description, sourceType, rawDisk, deprecated);
+   public abstract Status status();
+
+   public abstract Long archiveSizeBytes();
+
+   public abstract Long diskSizeGb();
+
+   @Nullable public abstract String sourceDisk();
+
+   @Nullable public abstract String sourceDiskId();
+
+   @Nullable public abstract List<String> licenses();
+
+   @SerializedNames({ "id", "selfLink", "creationTimestamp", "name", "description", "sourceType", "rawDisk", "deprecated",
+      "status", "archiveSizeBytes", "diskSizeGb", "sourceDisk", "sourceDiskId", "licenses"})
+   public static Image create(String id, URI selfLink, Date creationTimestamp, String name, String description, String sourceType,
+         RawDisk rawDisk, Deprecated deprecated, Status status, Long archiveSizeBytes, Long diskSizeGb,
+         String sourceDisk, String sourceDiskId, List<String> licenses) {
+      return new AutoValue_Image(id, selfLink, creationTimestamp, name, description, sourceType, rawDisk, deprecated, status,
+            archiveSizeBytes, diskSizeGb, sourceDisk, sourceDiskId, licenses);
    }
 
    Image() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
index 59bda21..0c99535 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
@@ -16,12 +16,12 @@
  */
 package org.jclouds.googlecomputeengine.domain;
 
-import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
-
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import org.jclouds.googlecomputeengine.domain.Metadata.Entry;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
 
@@ -32,20 +32,71 @@ public abstract class Operation {
 
    @AutoValue
    public abstract static class Error {
-      /** The error type identifier for this error. */
-      public abstract String code(); // TODO: enum?
 
-      /** The field in the request which caused the error. */
-      @Nullable public abstract String location();
+      @AutoValue
+      public abstract static class Entry {
+
+         /** The error type identifier for this error. */
+         public abstract String code(); // TODO: enum?
+
+         /** The field in the request which caused the error. */
+         @Nullable public abstract String location();
+
+         @Nullable public abstract String message();
+
+         @SerializedNames({ "code", "location", "message" })
+         public static Entry create(String code, String location, String message) {
+            return new AutoValue_Operation_Error_Entry(code, location, message);
+         }
+
+         Entry() {
+         }
+      }
+
+      public abstract List<Entry> errors();
+
+      @SerializedNames({ "errors" })
+      public static Error create(List<Entry> errors) {
+         return new AutoValue_Operation_Error(errors != null ? errors : new ArrayList<Entry>());
+      }
+
+      public static Error empty(){
+         return create(null);
+      }
+
+      Error(){
+      }
+   }
+
+   @AutoValue
+   public abstract static class Warning {
+
+      // TODO: combine this with Metadata.Entry
+      @AutoValue
+      public abstract static class Entry {
+         abstract String key();
 
+         abstract String value();
+
+         @SerializedNames({ "key", "value" })
+         public static Entry create(String key, String value) {
+            return new AutoValue_Operation_Warning_Entry(key, value);
+         }
+
+         Entry(){
+         }
+      }
+
+      public abstract String code();
       @Nullable public abstract String message();
+      public abstract List<Entry> data();
 
-      @SerializedNames({ "code", "location", "message" })
-      public static Error create(String code, String location, String message) {
-         return new AutoValue_Operation_Error(code, location, message);
+      @SerializedNames({"code", "message", "data"})
+      public static Warning create(String code, String message, List<Entry> data){
+         return new AutoValue_Operation_Warning(code, message, data);
       }
 
-      Error() {
+      Warning() {
       }
    }
 
@@ -57,6 +108,8 @@ public abstract class Operation {
 
    public abstract String id();
 
+   @Nullable public abstract Date creationTimestamp();
+
    public abstract URI selfLink();
 
    public abstract String name();
@@ -103,22 +156,24 @@ public abstract class Operation {
    /** Examples include insert, update, and delete. */
    public abstract String operationType(); // TODO: enum
 
-   public abstract List<Error> errors();
+   public abstract Error error();
+
+   @Nullable public abstract List<Warning> warnings();
 
    @Nullable public abstract URI region();
 
    @Nullable public abstract URI zone();
 
-   @SerializedNames({ "id", "selfLink", "name", "description", "targetLink", "targetId", "clientOperationId", "status",
+   @SerializedNames({ "id", "creationTimestamp", "selfLink", "name", "description", "targetLink", "targetId", "clientOperationId", "status",
          "statusMessage", "user", "progress", "insertTime", "startTime", "endTime", "httpErrorStatusCode",
-         "httpErrorMessage", "operationType", "errors", "region", "zone" })
-   public static Operation create(String id, URI selfLink, String name, String description, URI targetLink,
+         "httpErrorMessage", "operationType", "error", "warnings", "region", "zone" })
+   public static Operation create(String id, Date creationTimestamp, URI selfLink, String name, String description, URI targetLink,
          String targetId, String clientOperationId, Status status, String statusMessage, String user, Integer progress,
          Date insertTime, Date startTime, Date endTime, Integer httpErrorStatusCode, String httpErrorMessage,
-         String operationType, List<Error> errors, URI region, URI zone) {
-      return new AutoValue_Operation(id, selfLink, name, description, targetLink, targetId, clientOperationId, status,
+         String operationType, Error error, List<Warning> warnings, URI region, URI zone) {
+      return new AutoValue_Operation(id, creationTimestamp, selfLink, name, description, targetLink, targetId, clientOperationId, status,
             statusMessage, user, progress, insertTime, startTime, endTime, httpErrorStatusCode, httpErrorMessage,
-            operationType, copyOf(errors), region, zone);
+            operationType, error != null ? error : Error.empty(), warnings, region, zone);
    }
 
    Operation() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
index e4a6eb6..801fb41 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
@@ -37,9 +37,11 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.domain.Address;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPage;
+import org.jclouds.googlecomputeengine.options.AddressCreationOptions;
 import org.jclouds.googlecomputeengine.options.ListOptions;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.oauth.v2.filters.OAuthFilter;
+import org.jclouds.rest.annotations.BinderParam;
 import org.jclouds.rest.annotations.Fallback;
 import org.jclouds.rest.annotations.MapBinder;
 import org.jclouds.rest.annotations.PayloadParam;
@@ -77,6 +79,12 @@ public interface AddressApi {
    @MapBinder(BindToJsonPayload.class)
    Operation create(@PayloadParam("name") String address);
 
+   /** @see #create(String) */
+   @Named("Addresses:insert")
+   @POST
+   @Produces(APPLICATION_JSON)
+   Operation create(@BinderParam(BindToJsonPayload.class) AddressCreationOptions options);
+
    /** Deletes an address by name and returns the operation in progress, or null if not found. */
    @Named("Addresses:delete")
    @DELETE

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
index 433a7ac..ce826d0 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
@@ -67,24 +67,26 @@ public interface DiskApi {
    Disk get(@PathParam("disk") String disk);
 
    /**
-    * Creates a persistent disk resource in the specified project specifying the size of the disk.
+    * Creates a persistent disk resource, in the specified project, specifying the size of the disk and other options.
     *
     * @param diskName the name of disk.
     * @param sizeGb   the size of the disk
+    * @param options the options of the disk to create.
     * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
     *         you, and look for the status field.
     */
    @Named("Disks:insert")
    @POST
    @Produces(APPLICATION_JSON)
-   @MapBinder(BindToJsonPayload.class)
-   Operation create(@PayloadParam("name") String diskName, @PayloadParam("sizeGb") int sizeGb);
+   @MapBinder(DiskCreationBinder.class)
+   Operation create(@PayloadParam("name") String diskName,
+                    @PayloadParam("options") DiskCreationOptions options);
 
    /**
     * Creates a persistent disk resource, in the specified project, specifying the size of the disk and other options.
     *
     * @param diskName the name of disk.
-    * @param sizeGb   the size of the disk
+    * @param sourceImage Fully-qualified URL of the source image to apply to the disk.
     * @param options the options of the disk to create.
     * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
     *         you, and look for the status field.
@@ -94,7 +96,7 @@ public interface DiskApi {
    @Produces(APPLICATION_JSON)
    @MapBinder(DiskCreationBinder.class)
    Operation create(@PayloadParam("name") String diskName,
-                    @PayloadParam("sizeGb") int sizeGb,
+                    @QueryParam("sourceImage") String sourceImage,
                     @PayloadParam("options") DiskCreationOptions options);
 
    /** Deletes a persistent disk by name and returns the operation in progress, or null if not found. */
@@ -120,6 +122,14 @@ public interface DiskApi {
    @MapBinder(BindToJsonPayload.class)
    Operation createSnapshot(@PathParam("disk") String diskName, @PayloadParam("name") String snapshotName);
 
+   /** @see #createSnapshot(String, String) */
+   @Named("Disks:createSnapshot")
+   @POST
+   @Path("/{disk}/createSnapshot")
+   @MapBinder(BindToJsonPayload.class)
+   Operation createSnapshot(@PathParam("disk") String diskName, @PayloadParam("name") String snapshotName,
+         @PayloadParam("description") String description);
+
    /**
     * Retrieves the list of persistent disk resources available to the specified project.
     * By default the list as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() has not

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
index e7c24e6..58d206e 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
@@ -41,6 +41,7 @@ import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.internal.BaseArg0ToIteratorOfListPage;
 import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
 import org.jclouds.googlecomputeengine.options.DeprecateOptions;
+import org.jclouds.googlecomputeengine.options.ImageCreationOptions;
 import org.jclouds.googlecomputeengine.options.ListOptions;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.oauth.v2.filters.OAuthFilter;
@@ -103,6 +104,13 @@ public interface ImageApi {
    @MapBinder(BindToJsonPayload.class)
    Operation createFromDisk(@PayloadParam("name") String image, @PayloadParam("sourceDisk") String sourceDisk);
 
+   @Named("Images:insert")
+   @POST
+   @Endpoint(CurrentProject.class)
+   @Path("/global/images")
+   @Produces(APPLICATION_JSON)
+   Operation create(@BinderParam(BindToJsonPayload.class) ImageCreationOptions options);
+
    /**
     * Sets the deprecation status of an image. If no message body is given, clears the deprecation status instead.
     *

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/AddressCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/AddressCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/AddressCreationOptions.java
new file mode 100644
index 0000000..413a61d
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/AddressCreationOptions.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.googlecomputeengine.options;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class AddressCreationOptions {
+
+   public abstract String name();
+   @Nullable public abstract String address();
+   @Nullable public abstract String description();
+
+   @SerializedNames({"name", "address", "description"})
+   static AddressCreationOptions create(String name, String address, String description){
+      return new AutoValue_AddressCreationOptions(name, address, description);
+   }
+
+   public static class Builder {
+      private String name;
+      private String address;
+      private String description;
+
+      public Builder(String name) {
+         this.name = name;
+      }
+
+      public Builder address(String address) {
+         this.address = address;
+         return this;
+      }
+
+      public Builder description(String description) {
+         this.description = description;
+         return this;
+      }
+
+      public AddressCreationOptions build() {
+         checkNotNull(name, "AddressCreationOptions name cannot be null");
+         return create(name, address, description);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
index 6a2e82f..60f1e4f 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
@@ -32,6 +32,7 @@ public class BackendServiceOptions {
    private Integer port;
    private String protocol;
    private String fingerprint;
+   private String portName;
 
    /**
     * Name of the BackendService resource.
@@ -161,4 +162,13 @@ public class BackendServiceOptions {
       this.fingerprint = fingerprint;
       return this;
    }
+
+   public String getPortName() {
+      return portName;
+   }
+
+   public BackendServiceOptions portName(String portName) {
+      this.portName = portName;
+      return this;
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DiskCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DiskCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DiskCreationOptions.java
index 2dd215c..166d021 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DiskCreationOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DiskCreationOptions.java
@@ -21,25 +21,27 @@ import java.net.URI;
 public final class DiskCreationOptions {
 
    private URI type;
-   private URI sourceImage;
+   private Integer sizeGb;
    private URI sourceSnapshot;
+   private String description;
+
 
    /**
     * The disk type, fully qualified URL for the disk type.
     *
     * @return the disk type
     */
-   public URI type(){
+   public URI type() {
       return type;
    }
 
    /**
-    * The source image
-    *
-    * @return sourceImage, fully qualified URL for the image to be copied.
+    * Size of the persistent disk, specified in GB.
+    * You can also specify this when creating a persistent disk
+    * using the sourceImage or sourceSnapshot parameter.
     */
-   public URI sourceImage(){
-      return sourceImage;
+   public Integer sizeGb() {
+      return sizeGb;
    }
 
    /**
@@ -47,31 +49,48 @@ public final class DiskCreationOptions {
     *
     * @return sourceSnapshot, fully qualified URL for the snapshot to be copied.
     */
-   public URI sourceSnapshot(){
+   public URI sourceSnapshot() {
       return sourceSnapshot;
    }
 
    /**
+    * The description
+    *
+    * @return description, An optional textual description of the resource.
+    */
+   public String description() {
+      return description;
+   }
+
+   /**
     * @see DiskCreationOptions#type()
     */
-   public DiskCreationOptions type(URI type){
+   public DiskCreationOptions type(URI type) {
       this.type = type;
       return this;
    }
 
    /**
-    * @see DiskCreationOptions#sourceImage()
+    * @see DiskCreationOptions#sizeGb()
     */
-   public DiskCreationOptions sourceImage(URI sourceImage){
-      this.sourceImage = sourceImage;
+   public DiskCreationOptions sizeGb(Integer sizeGb) {
+      this.sizeGb = sizeGb;
       return this;
    }
 
    /**
     * @see DiskCreationOptions#sourceSnapshot()
     */
-   public DiskCreationOptions sourceSnapshot(URI sourceSnapshot){
+   public DiskCreationOptions sourceSnapshot(URI sourceSnapshot) {
       this.sourceSnapshot = sourceSnapshot;
       return this;
    }
+
+   /**
+    * @see DiskCreationOptions#description()
+    */
+   public DiskCreationOptions description(String description) {
+      this.description = description;
+      return this;
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java
index 0762e96..eb4d4ce 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/FirewallOptions.java
@@ -32,6 +32,7 @@ public class FirewallOptions {
 
    private String name;
    private URI network;
+   private String description;
    private ImmutableList.Builder<String> sourceRanges = ImmutableList.builder();
    private ImmutableList.Builder<String> sourceTags = ImmutableList.builder();
    private ImmutableList.Builder<String> targetTags = ImmutableList.builder();
@@ -77,6 +78,21 @@ public class FirewallOptions {
    }
 
    /**
+    * @see org.jclouds.googlecomputeengine.domain.Firewall#description()
+    */
+   public FirewallOptions description(String description) {
+      this.description = description;
+      return this;
+   }
+
+   /**
+    * @see org.jclouds.googlecomputeengine.domain.Firewall#description()
+    */
+   public String description() {
+      return description;
+   }
+
+   /**
     * @see org.jclouds.googlecomputeengine.domain.Firewall#network()
     */
    public FirewallOptions network(URI network) {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ImageCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ImageCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ImageCreationOptions.java
new file mode 100644
index 0000000..cb75d1d
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ImageCreationOptions.java
@@ -0,0 +1,87 @@
+/*
+ * 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.googlecomputeengine.options;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.googlecomputeengine.domain.Image.RawDisk;
+import org.jclouds.googlecomputeengine.domain.NewTargetInstance.Builder;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+import org.jclouds.googlecomputeengine.domain.Deprecated;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class ImageCreationOptions {
+
+   public abstract String name();
+   @Nullable public abstract String description();
+   @Nullable public abstract String sourceType();
+   @Nullable public abstract RawDisk rawDisk();
+   @Nullable public abstract Deprecated deprecated();
+   @Nullable public abstract String sourceDisk();
+
+   @SerializedNames({"name", "description", "sourceType", "rawDisk", "deprecated", "sourceDisk"})
+   static ImageCreationOptions create(String name, String description, String sourceType,
+         RawDisk rawDisk, Deprecated deprecated, String sourceDisk){
+      return new AutoValue_ImageCreationOptions(name, description, sourceType, rawDisk, deprecated, sourceDisk);
+   }
+
+   public static class Builder{
+      public String name;
+      public String description;
+      public String sourceType;
+      public RawDisk rawDisk;
+      public Deprecated deprecated;
+      public String sourceDisk;
+
+      public Builder(String name) {
+         this.name = name;
+      }
+
+      public Builder description(String description) {
+         this.description = description;
+         return this;
+      }
+
+      public Builder sourceType(String sourceType) {
+         this.sourceType = sourceType;
+         return this;
+      }
+
+      public Builder rawDisk(RawDisk rawDisk) {
+         this.rawDisk = rawDisk;
+         return this;
+      }
+
+      public Builder deprecated(Deprecated deprecated) {
+         this.deprecated = deprecated;
+         return this;
+      }
+
+      public Builder sourceDisk(String sourceDisk) {
+         this.sourceDisk = sourceDisk;
+         return this;
+      }
+
+      public ImageCreationOptions build() {
+         checkNotNull(name, "ImageCreationOptions: name cannot be null");
+         return create(name, description, sourceType, rawDisk, deprecated, sourceDisk);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinderTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinderTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinderTest.java
index 86ea1a0..3467ab4 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinderTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinderTest.java
@@ -31,22 +31,23 @@ import com.google.common.collect.ImmutableMap;
 @Test(groups = "unit", testName = "DiskCreationBinderTest")
 public class DiskCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
 
-   private static final String FAKE_SOURCE_IMAGE = "https://www.googleapis.com/compute/v1/projects/" +
+   private static final String FAKE_SOURCE_SNAPSHOT = "https://www.googleapis.com/compute/v1/projects/" +
                                        "debian-cloud/global/images/backports-debian-7-wheezy-v20141017";
 
    DiskCreationBinder binder = new DiskCreationBinder();
- 
+
    @Test
    public void testMap() throws SecurityException, NoSuchMethodException {
-      DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sourceImage(URI.create(FAKE_SOURCE_IMAGE));
+      DiskCreationOptions diskCreationOptions = new DiskCreationOptions()
+         .sourceSnapshot(URI.create(FAKE_SOURCE_SNAPSHOT)).sizeGb(15).description(null);
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
-      Map<String, Object> postParams = ImmutableMap.of("name", "testName", "sizeGb", 15, "options", diskCreationOptions);
+      Map<String, Object> postParams = ImmutableMap.of("name", "testName", "options", diskCreationOptions);
 
       request = binder.bindToRequest(request, postParams);
 
       assertEquals(request.getPayload().getRawContent(),
-            "{\"name\":\"testName\",\"sizeGb\":15,\"sourceImage\":\"" + FAKE_SOURCE_IMAGE + "\"}");
+            "{\"name\":\"testName\",\"sizeGb\":15,\"sourceSnapshot\":\"" + FAKE_SOURCE_SNAPSHOT + "\"}");
       assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/json");
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermissionTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermissionTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermissionTest.java
index b8aee36..9c2f759 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermissionTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermissionTest.java
@@ -21,6 +21,7 @@ import static org.testng.Assert.assertTrue;
 
 import java.net.URI;
 
+import org.jclouds.date.internal.SimpleDateFormatDateService;
 import org.jclouds.googlecomputeengine.domain.Firewall;
 import org.jclouds.net.domain.IpPermission;
 import org.jclouds.net.domain.IpProtocol;
@@ -56,6 +57,7 @@ public class FirewallToIpPermissionTest {
       return Firewall.create( //
             "abcd", // id
             URI.create(baseUrl + "/jclouds/global/firewalls/jclouds-test"), // selfLink
+            new SimpleDateFormatDateService().iso8601DateParse("2012-04-13T03:05:04.365"), // creationTimestamp
             "jclouds-test", // name
             null, // description
             URI.create(baseUrl + "/jclouds/global/networks/jclouds-test"), // network

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImageTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImageTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImageTest.java
index 9414b98..3a4765d 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImageTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImageTest.java
@@ -23,11 +23,14 @@ import java.net.URI;
 
 import org.jclouds.compute.domain.Image.Status;
 import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
 import org.jclouds.googlecomputeengine.domain.Deprecated;
 import org.jclouds.googlecomputeengine.domain.Deprecated.State;
 import org.jclouds.googlecomputeengine.domain.Image;
 import org.testng.annotations.Test;
 
+import com.google.common.collect.ImmutableList;
+
 @Test(groups = "unit", testName = "GoogleComputeEngineImageToImageTest")
 public class GoogleComputeEngineImageToImageTest {
    public void testArbitraryImageName() {
@@ -86,11 +89,18 @@ public class GoogleComputeEngineImageToImageTest {
       return Image.create( //
             "1234", // id
             URI.create("http://test.com/1234"), // selfLink
+            new SimpleDateFormatDateService().iso8601DateParse("2012-07-16T22:16:13.468"), // creationTimestamp
             name, // name
             "", // description
             "RAW", // sourceType
             Image.RawDisk.create(URI.create("foo"), "TAR", null), // rawDisk
-            deprecated // deprecated
+            deprecated, // deprecated
+            Image.Status.READY, // status
+            Long.parseLong("881210631", 10), // archivedSizeBytes
+            Long.parseLong("8", 10), // diskSizeGb
+            "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disk/disk", // sourceDisk
+            "9598530021316715047", // sourceDiskId
+            ImmutableList.of("https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12") // license
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiMockTest.java
index 3903048..0fdca5b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiMockTest.java
@@ -21,6 +21,7 @@ import static org.testng.Assert.assertFalse;
 import static org.testng.AssertJUnit.assertNull;
 
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.AddressCreationOptions;
 import org.jclouds.googlecomputeengine.parse.ParseAddressListTest;
 import org.jclouds.googlecomputeengine.parse.ParseAddressTest;
 import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
@@ -52,6 +53,18 @@ public class AddressApiMockTest extends BaseGoogleComputeEngineApiMockTest {
             stringFromResource("/address_insert.json"));
    }
 
+   public void insert_options() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      AddressCreationOptions options = new AddressCreationOptions.Builder("address-with-options")
+         .description("This is a test").address("1.1.1.1").build();
+      assertEquals(addressApi().create(options),
+            new ParseRegionOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/regions/us-central1/addresses",
+            "{\"name\": \"address-with-options\",\"description\":\"This is a test\",\"address\":\"1.1.1.1\"}");
+   }
+
    public void delete() throws Exception {
       server.enqueue(jsonResponse("/region_operation.json"));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
index b53761a..b071f20 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
@@ -34,7 +34,7 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    public static final String DISK_NAME = "disk-api-live-test-disk";
    public static final String SSD_DISK_NAME = "disk-api-live-test-disk-ssd";
-   public static final int sizeGb = 1;
+   public static final int SIZE_GB = 1;
 
    private DiskApi api() {
       return api.disksInZone(DEFAULT_ZONE_NAME);
@@ -42,7 +42,8 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    @Test(groups = "live")
    public void testInsertDisk() {
-      assertOperationDoneSuccessfully(api().create(DISK_NAME, sizeGb));
+      DiskCreationOptions options = new DiskCreationOptions().sizeGb( SIZE_GB);
+      assertOperationDoneSuccessfully(api().create(DISK_NAME, options));
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertDisk")
@@ -70,15 +71,15 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    private void assertDiskEquals(Disk result) {
       assertEquals(result.name(), DISK_NAME);
-      assertEquals(result.sizeGb(), sizeGb);
+      assertEquals(result.sizeGb(), SIZE_GB);
       assertEquals(result.zone(), getDefaultZoneUrl());
    }
 
    @Test(groups = "live")
    public void testInsertSSDDisk() {
       URI diskType = getDiskTypeUrl(DEFAULT_ZONE_NAME, "pd-ssd");
-      DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(diskType);
-      assertOperationDoneSuccessfully(api().create(SSD_DISK_NAME, sizeGb, diskCreationOptions));
+      DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(diskType).sizeGb(SIZE_GB);
+      assertOperationDoneSuccessfully(api().create(SSD_DISK_NAME, diskCreationOptions));
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertSSDDisk")
@@ -95,7 +96,7 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    private void assertSSDDiskEquals(Disk result) {
       assertEquals(result.name(), SSD_DISK_NAME);
-      assertEquals(result.sizeGb(), sizeGb);
+      assertEquals(result.sizeGb(), SIZE_GB);
       assertEquals(result.zone(), getDefaultZoneUrl());
       assertEquals(result.type(), getDiskTypeUrl(DEFAULT_ZONE_NAME, "pd-ssd"));
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
index 7633a03..9c5a1e6 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
@@ -52,7 +52,8 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
    public void insert() throws Exception {
       server.enqueue(jsonResponse("/zone_operation.json"));
 
-      assertEquals(diskApi().create("testimage1", 1),
+      DiskCreationOptions options = new DiskCreationOptions().sizeGb(1);
+      assertEquals(diskApi().create("testimage1", options),
             new ParseZoneOperationTest().expected(url("/projects")));
 
       assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
@@ -62,20 +63,23 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
    public void insertFromImage() throws Exception {
       server.enqueue(jsonResponse("/zone_operation.json"));
 
-      DiskCreationOptions diskCreationOptions = new DiskCreationOptions()
-         .sourceImage(URI.create(url(IMAGE_URL)));
-      assertEquals(diskApi().create("testimage1", 1, diskCreationOptions),
+      DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sizeGb(1).description("testing 123");
+
+      assertEquals(diskApi().create("testimage1", url(IMAGE_URL), diskCreationOptions),
             new ParseZoneOperationTest().expected(url("/projects")));
 
-      assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
-            stringFromResource("/disk_insert_sourceImage.json"));
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks?sourceImage="
+            + url("/projects/party/zones/us-central1-a/images/foo").replace(":", "%3A"), //TODO (broudy) clean this up.
+            "{\"name\":\"testimage1\",\"sizeGb\":1,\"description\":\"testing 123\"}");
    }
 
    public void insertFromSSD() throws Exception {
       server.enqueue(jsonResponse("/zone_operation.json"));
 
-      DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(URI.create(url(SSD_URL)));
-      assertEquals(diskApi().create("testimage1", 1, diskCreationOptions),
+      DiskCreationOptions diskCreationOptions = new DiskCreationOptions()
+         .type(URI.create(url(SSD_URL))).sizeGb(1);
+
+      assertEquals(diskApi().create("testimage1", diskCreationOptions),
             new ParseZoneOperationTest().expected(url("/projects")));
 
       assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
@@ -92,6 +96,16 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
             stringFromResource("/disk_create_snapshot.json"));
    }
 
+   public void creatSnapshot_description() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(diskApi().createSnapshot("testimage1", "test-snap", "This is a test"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks/testimage1/createSnapshot",
+            "{\"name\":\"test-snap\",\"description\":\"This is a test\"}");
+   }
+
    public void delete() throws Exception {
       server.enqueue(jsonResponse("/zone_operation.json"));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
index cc92e23..b1ec4da 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
@@ -83,6 +83,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineExpectTest<Goo
       return payload;
    }
 
+   //TODO (broudy): convert to mock test and add description to test.
    public void testInsertFirewallResponseIs2xx() throws IOException {
 
       HttpRequest request = HttpRequest

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
index 4d1afc7..486e701 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
@@ -31,6 +31,7 @@ import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Deprecated.State;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
 import org.jclouds.googlecomputeengine.options.DeprecateOptions;
+import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
 import org.testng.annotations.Test;
 
 public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@@ -68,7 +69,8 @@ public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    @Test(groups = "live")
    public void testInsertDisk() {
-      assertOperationDoneSuccessfully(diskApi().create(DISK_NAME, sizeGb));
+      assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
+            new DiskCreationOptions().sizeGb(sizeGb)));
       Disk disk = diskApi().get(DISK_NAME);
       diskURI = disk.selfLink();
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
index ccdc039..7d9e9c0 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
@@ -23,9 +23,11 @@ import static org.testng.Assert.assertNull;
 import java.net.URI;
 
 import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.Deprecated;
 import org.jclouds.googlecomputeengine.domain.Deprecated.State;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
 import org.jclouds.googlecomputeengine.options.DeprecateOptions;
+import org.jclouds.googlecomputeengine.options.ImageCreationOptions;
 import org.jclouds.googlecomputeengine.parse.ParseImageListTest;
 import org.jclouds.googlecomputeengine.parse.ParseImageTest;
 import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
@@ -106,7 +108,7 @@ public class ImageApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       assertSent(server, "GET", "/projects/centos-cloud/global/images");
    }
 
-   public void createImageFromPd_2xx() throws Exception{
+   public void createImageFromPd_2xx() throws Exception {
       server.enqueue(jsonResponse("/operation.json"));
 
       assertEquals(imageApi().createFromDisk("my-image", url("/projects/party/zones/us-central1-a/disks/mydisk")),
@@ -114,6 +116,22 @@ public class ImageApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       assertSent(server, "POST", "/projects/party/global/images", stringFromResource("/image_insert_from_pd.json"));
    }
 
+   public void createImage_options() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      ImageCreationOptions options = new ImageCreationOptions.Builder("name")
+         .description("this is a test")
+         .sourceDisk("projects/project/zones/zone/disks/disks")
+         .deprecated(Deprecated.create(State.DEPRECATED, null, null, null, null)).build();
+      assertEquals(imageApi().create(options),
+            new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/global/images",
+            "{\"name\":\"name\",\"description\":\"this is a test\",\""
+            + "deprecated\":{\"state\":\"DEPRECATED\"},\"sourceDisk\":"
+            + "\"projects/project/zones/zone/disks/disks\"}");
+
+   }
+
    public void deprecateImage_2xx() throws Exception{
       String imageName = "test-image";
       server.enqueue(jsonResponse("/operation.json"));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index 1d643c5..fa5676e 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -38,6 +38,7 @@ import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.AttachDisk;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
 
@@ -108,7 +109,8 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertOperationDoneSuccessfully(api.networks().createInIPv4Range
               (INSTANCE_NETWORK_NAME, IPV4_RANGE));
 
-      assertOperationDoneSuccessfully(diskApi().create(DISK_NAME, DEFAULT_DISK_SIZE_GB));
+      assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
+            new DiskCreationOptions().sizeGb(DEFAULT_DISK_SIZE_GB)));
       assertOperationDoneSuccessfully(api().create(instance));
    }
 
@@ -189,7 +191,8 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    @Test(groups = "live", dependsOnMethods = "testSetMetadataForInstance")
    public void testAttachDiskToInstance() {
-      assertOperationDoneSuccessfully(diskApi().create(ATTACH_DISK_NAME, 1));
+      assertOperationDoneSuccessfully(diskApi().create(ATTACH_DISK_NAME,
+            new DiskCreationOptions().sizeGb(1)));
 
       Instance originalInstance = api().get(INSTANCE_NAME);
       assertOperationDoneSuccessfully(api().attachDisk(INSTANCE_NAME,

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
index ec1f17a..cec6ffa 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
@@ -26,6 +26,7 @@ import org.jclouds.googlecloud.domain.ListPage;
 import org.jclouds.googlecomputeengine.domain.Disk;
 import org.jclouds.googlecomputeengine.domain.Snapshot;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
 import org.testng.annotations.Test;
 
 public class SnapshotApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@@ -44,7 +45,8 @@ public class SnapshotApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    @Test(groups = "live")
    public void testCreateSnapshot() {
-      assertOperationDoneSuccessfully(diskApi().create(DISK_NAME, 1));
+      assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
+            new DiskCreationOptions().sizeGb(1)));
       disk = diskApi().get(DISK_NAME);
 
       assertOperationDoneSuccessfully(diskApi().createSnapshot(DISK_NAME, SNAPSHOT_NAME));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
index 1a62257..b61c840 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
@@ -89,7 +89,7 @@ public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleCo
       AtomicReference<Operation> ref = Atomics.newReference(checkNotNull(operation, "operation"));
       checkState(operationDone.apply(ref), "Timeout waiting for operation: %s", operation);
       assertEquals(ref.get().status(), Operation.Status.DONE);
-      assertTrue(ref.get().errors().isEmpty());
+      assertTrue(ref.get().error().errors().isEmpty());
    }
 
    protected void waitOperationDone(@Nullable Operation operation) {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
index 5041211..50d58ed 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
@@ -25,6 +25,7 @@ import javax.ws.rs.Consumes;
 import org.jclouds.googlecloud.domain.ForwardingListPage;
 import org.jclouds.googlecloud.domain.ListPage;
 import org.jclouds.googlecomputeengine.domain.Address;
+import org.jclouds.googlecomputeengine.domain.Address.Status;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
 import org.testng.annotations.Test;
 
@@ -50,9 +51,10 @@ public class ParseAddressListTest extends BaseGoogleComputeEngineParseTest<ListP
             "4881363978908129158", // id
             URI.create(baseUrl + "/party/regions/us-central1/addresses/test-ip2"), // selfLink
             "test-ip2", // name
+            parse("2013-07-26T14:08:21.552-07:00"), //creationTimestamp
             "", // description
-            "RESERVED", // status
-            null, // user
+            Status.RESERVED, // status
+            null, // users
             URI.create(baseUrl + "/party/regions/us-central1"), // region
             "173.255.118.115" // address
       );

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
index 3dd748f..454822c 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
@@ -23,9 +23,12 @@ import java.net.URI;
 import javax.ws.rs.Consumes;
 
 import org.jclouds.googlecomputeengine.domain.Address;
+import org.jclouds.googlecomputeengine.domain.Address.Status;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
 import org.testng.annotations.Test;
 
+import com.google.common.collect.ImmutableList;
+
 @Test(groups = "unit", testName = "ParseAddressTest")
 public class ParseAddressTest extends BaseGoogleComputeEngineParseTest<Address> {
 
@@ -45,9 +48,10 @@ public class ParseAddressTest extends BaseGoogleComputeEngineParseTest<Address>
             "4439373783165447583", // id
             URI.create(baseUrl + "/party/regions/us-central1/addresses/test-ip1"), // selfLink
             "test-ip1", // name
+            parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
             "", // description
-            "RESERVED", // status
-            null, // user
+            Status.IN_USE, // status
+            ImmutableList.of(URI.create(baseUrl + "/party/regions/us-central1-a/forwardingRules/test-forwarding-rule")), // users
             URI.create(baseUrl + "/party/regions/us-central1"), // region
             "173.255.115.190" // address
       );

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceListTest.java
index 7bd0b4a..992d446 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceListTest.java
@@ -60,7 +60,8 @@ public class ParseBackendServiceListTest extends BaseGoogleComputeEngineParseTes
                         45, //timeoutSec,
                         80, //port,
                         "HTTP", //protocol,
-                        null) //fingerprint
+                        null, //fingerprint
+                        null) // portName
                   ),
             null
       );

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceTest.java
index 51a63f4..dc99239 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceTest.java
@@ -67,7 +67,8 @@ public class ParseBackendServiceTest extends BaseGoogleComputeEngineParseTest<Ba
             30, //timeoutSec
             80, //port
             "HTTP", //protocol
-            "I6n5NPSXn8g=" //fingerprint
+            "I6n5NPSXn8g=", //fingerprint
+            null // portName
             );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
index 9ce7449..d7784bb 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
@@ -23,6 +23,7 @@ import java.net.URI;
 import javax.ws.rs.Consumes;
 
 import org.jclouds.googlecomputeengine.domain.Disk;
+import org.jclouds.googlecomputeengine.domain.Disk.Status;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
 import org.testng.annotations.Test;
 
@@ -43,13 +44,19 @@ public class ParseDiskTest extends BaseGoogleComputeEngineParseTest<Disk> {
    public Disk expected(String baseUrl){
       return Disk.create( //
             "13050421646334304115", // id
+            parse("2012-11-25T01:38:48.306"), // creationTimestamp
             URI.create(baseUrl + "/party/zones/us-central1-a"), // zone
-            "READY", // status
+            Status.READY, // status
             "testimage1", // name
             null, // description
             1, // sizeGb
+            null, // sourceSnapshot
+            null, // sourceSnapshotId
             URI.create(baseUrl + "/party/zones/us-central1-a/disks/testimage1"), // selfLink
-            URI.create(baseUrl + "/studied-point-720/zones/us-central1-a/diskTypes/pd-standard") // type
+            null, // sourceImage
+            null, // sourceImageId
+            URI.create(baseUrl + "/studied-point-720/zones/us-central1-a/diskTypes/pd-standard"), // type
+            null // license
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTypeListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTypeListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTypeListTest.java
index edf1c73..b796186 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTypeListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTypeListTest.java
@@ -41,7 +41,8 @@ public class ParseDiskTypeListTest extends BaseGoogleComputeEngineParseTest<List
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<DiskType> expected() {
       String contentBaseUrl = BASE_URL.replace("www", "content");
-      DiskType diskType1 = DiskType.create( //
+      DiskType diskType1 = DiskType.create(
+            parse("2014-06-02T11:07:28.530-07:00"), // creationTimestamp
             "pd-standard", // name
             "Standard Persistent Disk", // description
             "10GB-10TB", // validDiskSize

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTypeTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTypeTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTypeTest.java
index 6064067..564977e 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTypeTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTypeTest.java
@@ -37,7 +37,8 @@ public class ParseDiskTypeTest extends BaseGoogleComputeEngineParseTest<DiskType
    @Override @Consumes(APPLICATION_JSON)
    public DiskType expected() {
       String contentBaseUrl = BASE_URL.replace("www", "content");
-      return DiskType.create( //
+      return DiskType.create(
+            parse("2014-06-02T11:07:28.529-07:00"), // creationTimestamp
             "pd-ssd", // name
             "SSD Persistent Disk", // description
             "10GB-1TB", // validDiskSize

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
index e6a7f00..0fa6737 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
@@ -49,6 +49,7 @@ public class ParseFirewallListTest extends BaseGoogleComputeEngineParseTest<List
       Firewall firewall2 = Firewall.create( //
             "12862241067393040785", // id
             URI.create(baseUrl + "/google/global/firewalls/default-ssh"), // selfLink
+            parse("2012-04-13T03:05:04.365"), // creationTimestamp
             "default-ssh", // name
             "SSH allowed from anywhere", // description
             URI.create(baseUrl + "/google/global/networks/default"), // network

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
index 4ac6bc1..4a20dc7 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
@@ -47,6 +47,7 @@ public class ParseFirewallTest extends BaseGoogleComputeEngineParseTest<Firewall
       return Firewall.create( //
             "12862241031274216284", // id
             URI.create(base_url + "/party/global/firewalls/jclouds-test"), // selfLink
+            parse("2012-04-13T03:05:02.855"), // creationTimestamp
             "jclouds-test", // name
             "Internal traffic from default allowed", // description
             URI.create(base_url + "/party/global/networks/jclouds-test"), // network

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationTest.java
index 78ebb5f..2d12ba9 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationTest.java
@@ -43,6 +43,7 @@ public class ParseGlobalOperationTest extends BaseGoogleComputeEngineParseTest<O
    public Operation expected(String baseUrl) {
       return Operation.create( //
             "13053095055850848306", // id
+            parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
             URI.create(baseUrl + "/party/global/operations/operation-1354084865060"),
             "operation-1354084865060", // name
             null, // description
@@ -60,6 +61,7 @@ public class ParseGlobalOperationTest extends BaseGoogleComputeEngineParseTest<O
             null, // httpErrorMessage
             "insert", // operationType
             null, // errors
+            null, // warnings
             null, // region
             null // zone
       );


[49/50] [abbrv] jclouds git commit: Promote Google Compute Engine

Posted by na...@apache.org.
Promote Google Compute Engine


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

Branch: refs/heads/master
Commit: 05fb3222bb4ff9a34d3c98fdfe6bf53a7524b482
Parents: 87b8853 70da397
Author: Ignasi Barrera <na...@apache.org>
Authored: Fri Jun 26 11:30:30 2015 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Fri Jun 26 11:30:30 2015 +0200

----------------------------------------------------------------------
 common/googlecloud/pom.xml                      |  62 +++
 .../googlecloud/GoogleCredentialsFromJson.java  |  63 +++
 .../googlecloud/config/CurrentProject.java      |  50 ++
 .../config/GoogleCloudProperties.java           |  40 ++
 .../config/ListPageAdapterFactory.java          | 109 ++++
 .../googlecloud/domain/ForwardingListPage.java  |  51 ++
 .../jclouds/googlecloud/domain/ListPage.java    |  28 ++
 .../googlecloud/internal/AdvancingIterator.java |  48 ++
 .../internal/BaseArg0ToIteratorOfListPage.java  |  58 +++
 .../BaseCallerArg0ToIteratorOfListPage.java     |  58 +++
 .../internal/BaseToIteratorOfListPage.java      |  49 ++
 .../jclouds/googlecloud/internal/ListPages.java |  57 +++
 .../googlecloud/internal/NullSafeCopies.java    |  39 ++
 .../googlecloud/options/ListOptions.java        |  30 ++
 .../googlecloud/internal/TestProperties.java    | 108 ++++
 providers/google-compute-engine/README.md       |  70 +++
 providers/google-compute-engine/pom.xml         | 170 +++++++
 .../GoogleComputeEngineApi.java                 | 163 ++++++
 .../GoogleComputeEngineApiMetadata.java         | 101 ++++
 .../GoogleComputeEngineFallbacks.java           |  36 ++
 .../GoogleComputeEngineProviderMetadata.java    |  72 +++
 .../binders/DiskCreationBinder.java             |  58 +++
 .../binders/FirewallBinder.java                 |  47 ++
 .../binders/ForwardingRuleCreationBinder.java   |  73 +++
 .../binders/HttpHealthCheckCreationBinder.java  |  78 +++
 .../binders/RouteBinder.java                    |  47 ++
 .../TargetPoolChangeHealthChecksBinder.java     |  28 ++
 .../TargetPoolChangeInstancesBinder.java        |  28 ++
 .../TargetPoolMapofListofMapGenericBinder.java  |  66 +++
 .../compute/GoogleComputeEngineService.java     | 183 +++++++
 .../GoogleComputeEngineServiceAdapter.java      | 318 ++++++++++++
 ...GoogleComputeEngineServiceContextModule.java | 221 ++++++++
 .../functions/FirewallTagNamingConvention.java  |  59 +++
 .../GoogleComputeEngineImageToImage.java        |  59 +++
 .../functions/ImageNameToOperatingSystem.java   |  65 +++
 .../functions/InstanceToNodeMetadata.java       | 114 +++++
 .../functions/MachineTypeToHardware.java        |  83 +++
 .../functions/OrphanedGroupsFromDeadNodes.java  |  51 ++
 .../compute/functions/Resources.java            |  94 ++++
 .../compute/loaders/DiskURIToImage.java         |  57 +++
 .../GoogleComputeEngineTemplateOptions.java     | 283 +++++++++++
 .../predicates/AtomicInstanceVisible.java       |  44 ++
 .../compute/predicates/AtomicOperationDone.java |  53 ++
 .../compute/predicates/GroupIsEmpty.java        |  42 ++
 ...desWithGroupEncodedIntoNameThenAddToSet.java | 233 +++++++++
 .../GoogleComputeEngineHttpApiModule.java       | 143 ++++++
 .../config/GoogleComputeEngineParserModule.java | 137 +++++
 .../config/GoogleComputeEngineProperties.java   |  39 ++
 .../googlecomputeengine/domain/Address.java     |  69 +++
 .../googlecomputeengine/domain/AttachDisk.java  | 132 +++++
 .../domain/BackendService.java                  | 103 ++++
 .../googlecomputeengine/domain/Deprecated.java  |  64 +++
 .../googlecomputeengine/domain/Disk.java        |  77 +++
 .../googlecomputeengine/domain/DiskType.java    |  56 +++
 .../googlecomputeengine/domain/Firewall.java    | 109 ++++
 .../domain/ForwardingRule.java                  |  88 ++++
 .../domain/HealthStatus.java                    |  56 +++
 .../domain/HttpHealthCheck.java                 |  75 +++
 .../googlecomputeengine/domain/Image.java       | 106 ++++
 .../googlecomputeengine/domain/Instance.java    | 262 ++++++++++
 .../domain/KeyValuePair.java                    |  37 ++
 .../googlecomputeengine/domain/License.java     |  40 ++
 .../googlecomputeengine/domain/MachineType.java |  87 ++++
 .../googlecomputeengine/domain/Metadata.java    | 118 +++++
 .../googlecomputeengine/domain/Network.java     |  63 +++
 .../googlecomputeengine/domain/NewInstance.java | 180 +++++++
 .../domain/NewTargetInstance.java               |  72 +++
 .../googlecomputeengine/domain/Operation.java   | 148 ++++++
 .../googlecomputeengine/domain/Project.java     |  80 +++
 .../googlecomputeengine/domain/Quota.java       |  41 ++
 .../googlecomputeengine/domain/Region.java      |  62 +++
 .../googlecomputeengine/domain/Route.java       |  88 ++++
 .../googlecomputeengine/domain/Snapshot.java    |  75 +++
 .../googlecomputeengine/domain/Tags.java        |  55 ++
 .../domain/TargetHttpProxy.java                 |  47 ++
 .../domain/TargetInstance.java                  |  49 ++
 .../googlecomputeengine/domain/TargetPool.java  | 100 ++++
 .../googlecomputeengine/domain/UrlMap.java      | 125 +++++
 .../domain/UrlMapValidateResult.java            |  84 ++++
 .../googlecomputeengine/domain/Warning.java     |  40 ++
 .../googlecomputeengine/domain/Zone.java        |  97 ++++
 .../features/AddressApi.java                    | 138 +++++
 .../features/AggregatedListApi.java             | 501 +++++++++++++++++++
 .../features/BackendServiceApi.java             | 197 ++++++++
 .../googlecomputeengine/features/DiskApi.java   | 175 +++++++
 .../features/DiskTypeApi.java                   | 101 ++++
 .../features/FirewallApi.java                   | 168 +++++++
 .../features/ForwardingRuleApi.java             | 158 ++++++
 .../features/HttpHealthCheckApi.java            | 180 +++++++
 .../googlecomputeengine/features/ImageApi.java  | 226 +++++++++
 .../features/InstanceApi.java                   | 323 ++++++++++++
 .../features/LicenseApi.java                    |  48 ++
 .../features/MachineTypeApi.java                | 101 ++++
 .../features/NetworkApi.java                    | 145 ++++++
 .../features/OperationApi.java                  | 219 ++++++++
 .../features/ProjectApi.java                    |  80 +++
 .../googlecomputeengine/features/RegionApi.java | 100 ++++
 .../googlecomputeengine/features/RouteApi.java  | 134 +++++
 .../features/SnapshotApi.java                   | 111 ++++
 .../features/TargetHttpProxyApi.java            | 175 +++++++
 .../features/TargetInstanceApi.java             | 129 +++++
 .../features/TargetPoolApi.java                 | 250 +++++++++
 .../googlecomputeengine/features/UrlMapApi.java | 216 ++++++++
 .../googlecomputeengine/features/ZoneApi.java   | 100 ++++
 .../GoogleComputeEngineErrorHandler.java        |  59 +++
 .../internal/BaseArg0ToIteratorOfListPage.java  |  23 +
 .../BaseCallerArg0ToIteratorOfListPage.java     |  23 +
 .../internal/BaseToIteratorOfListPage.java      |  23 +
 .../options/AddressCreationOptions.java         |  62 +++
 .../options/BackendServiceOptions.java          | 155 ++++++
 .../options/DeprecateOptions.java               | 113 +++++
 .../options/DiskCreationOptions.java            |  94 ++++
 .../options/FirewallOptions.java                | 182 +++++++
 .../options/ForwardingRuleCreationOptions.java  | 109 ++++
 .../options/HttpHealthCheckCreationOptions.java | 169 +++++++
 .../options/ImageCreationOptions.java           |  87 ++++
 .../options/ListOptions.java                    |  89 ++++
 .../options/NetworkCreationOptions.java         |  85 ++++
 .../options/RouteOptions.java                   | 218 ++++++++
 .../options/TargetHttpProxyOptions.java         |  67 +++
 .../options/TargetPoolCreationOptions.java      | 142 ++++++
 .../options/UrlMapOptions.java                  | 145 ++++++
 ...GoogleComputeEngineProviderMetadataTest.java |  34 ++
 .../binders/DiskCreationBinderTest.java         |  53 ++
 .../ForwardingRuleCreationBinderTest.java       |  72 +++
 .../HttpHealthCheckCreationBinderTest.java      |  72 +++
 .../TargetPoolAddInstanceBinderTest.java        |  59 +++
 .../GoogleComputeEngineServiceLiveTest.java     | 149 ++++++
 .../GoogleComputeEngineServiceMockTest.java     | 270 ++++++++++
 ...gleComputeEngineTemplateBuilderLiveTest.java |  79 +++
 .../GoogleComputeEngineImageToImageTest.java    | 106 ++++
 .../ImageNameToOperatingSystemTest.java         |  52 ++
 .../functions/InstanceToNodeMetadataTest.java   | 202 ++++++++
 .../OrphanedGroupsFromDeadNodesTest.java        | 172 +++++++
 .../compute/functions/ResourcesMockTest.java    | 162 ++++++
 .../UseApiToResolveProjectNameMockTest.java     |  76 +++
 .../features/AddressApiLiveTest.java            |  60 +++
 .../features/AddressApiMockTest.java            | 100 ++++
 .../features/AggregatedListApiLiveTest.java     | 168 +++++++
 .../features/AggregatedListApiMockTest.java     | 207 ++++++++
 .../features/BackendServiceApiLiveTest.java     | 131 +++++
 .../features/BackendServiceApiMockTest.java     | 152 ++++++
 .../features/DiskApiLiveTest.java               | 103 ++++
 .../features/DiskApiMockTest.java               | 142 ++++++
 .../features/DiskTypeApiLiveTest.java           |  66 +++
 .../features/DiskTypeApiMockTest.java           |  63 +++
 .../features/FirewallApiLiveTest.java           | 124 +++++
 .../features/FirewallApiMockTest.java           | 140 ++++++
 .../features/ForwardingRuleApiLiveTest.java     | 125 +++++
 .../features/ForwardingRuleApiMockTest.java     | 114 +++++
 .../GlobalForwardingRuleApiLiveTest.java        | 138 +++++
 .../GlobalForwardingRuleApiMockTest.java        | 106 ++++
 .../features/HttpHealthCheckApiLiveTest.java    | 120 +++++
 .../features/HttpHealthCheckApiMockTest.java    | 121 +++++
 .../features/ImageApiLiveTest.java              | 128 +++++
 .../features/ImageApiMockTest.java              | 154 ++++++
 .../features/InstanceApiLiveTest.java           | 358 +++++++++++++
 .../features/InstanceApiMockTest.java           | 293 +++++++++++
 .../features/LicenseApiLiveTest.java            |  47 ++
 .../features/LicenseApiMockTest.java            |  46 ++
 .../features/MachineTypeApiLiveTest.java        |  62 +++
 .../features/MachineTypeApiMockTest.java        |  63 +++
 .../features/NetworkApiLiveTest.java            |  73 +++
 .../features/NetworkApiMockTest.java            |  87 ++++
 .../features/OperationApiLiveTest.java          |  98 ++++
 .../features/OperationApiMockTest.java          | 166 ++++++
 .../features/ProjectApiLiveTest.java            |  82 +++
 .../features/ProjectApiMockTest.java            |  72 +++
 .../features/RegionApiLiveTest.java             |  62 +++
 .../features/RegionApiMockTest.java             |  63 +++
 .../features/RouteApiLiveTest.java              |  90 ++++
 .../features/RouteApiMockTest.java              |  98 ++++
 .../features/SnapshotApiLiveTest.java           |  85 ++++
 .../features/SnapshotApiMockTest.java           |  79 +++
 .../features/TargetHttpProxyApiLiveTest.java    | 114 +++++
 .../features/TargetHttpProxyApiMockTest.java    | 114 +++++
 .../features/TargetInstanceApiLiveTest.java     |  77 +++
 .../features/TargetInstanceApiMockTest.java     | 101 ++++
 .../features/TargetPoolApiLiveTest.java         | 274 ++++++++++
 .../features/TargetPoolApiMockTest.java         | 178 +++++++
 .../features/UrlMapApiLiveTest.java             | 214 ++++++++
 .../features/UrlMapApiMockTest.java             | 139 +++++
 .../features/ZoneApiLiveTest.java               |  64 +++
 .../features/ZoneApiMockTest.java               |  63 +++
 .../GoogleComputeEngineErrorHandlerTest.java    |  92 ++++
 .../BaseGoogleComputeEngineApiLiveTest.java     | 158 ++++++
 .../BaseGoogleComputeEngineApiMockTest.java     | 147 ++++++
 .../BaseGoogleComputeEngineExpectTest.java      | 122 +++++
 .../BaseGoogleComputeEngineParseTest.java       |  41 ++
 .../internal/GoogleComputeEngineTestModule.java |  94 ++++
 .../ToIteratorOfListPageExpectTest.java         | 184 +++++++
 .../parse/ParseAddressListTest.java             |  66 +++
 .../parse/ParseAddressTest.java                 |  59 +++
 .../parse/ParseBackendServiceListTest.java      |  69 +++
 .../parse/ParseBackendServiceTest.java          |  74 +++
 .../parse/ParseDiskListTest.java                |  51 ++
 .../parse/ParseDiskTest.java                    |  62 +++
 .../parse/ParseDiskTypeListTest.java            |  60 +++
 .../parse/ParseDiskTypeTest.java                |  51 ++
 .../parse/ParseFirewallListTest.java            |  66 +++
 .../parse/ParseFirewallTest.java                |  63 +++
 .../parse/ParseForwardingRuleListTest.java      |  51 ++
 .../parse/ParseForwardingRuleTest.java          |  57 +++
 .../ParseGlobalForwardingRuleListTest.java      |  46 ++
 .../parse/ParseGlobalForwardingRuleTest.java    |  51 ++
 .../parse/ParseGlobalOperationListTest.java     |  51 ++
 .../parse/ParseGlobalOperationTest.java         |  69 +++
 .../parse/ParseHealthStatusTest.java            |  58 +++
 .../parse/ParseHttpHealthCheckListTest.java     |  84 ++++
 .../parse/ParseHttpHealthCheckTest.java         |  59 +++
 .../parse/ParseImageListTest.java               |  50 ++
 .../parse/ParseImageTest.java                   |  74 +++
 .../parse/ParseInstanceListTest.java            |  51 ++
 .../parse/ParseInstanceSerialOutputTest.java    |  48 ++
 .../parse/ParseInstanceTest.java                |  94 ++++
 .../parse/ParseLicenseTest.java                 |  46 ++
 .../parse/ParseMachineTypeListTest.java         |  98 ++++
 .../parse/ParseMachineTypeTest.java             |  63 +++
 .../parse/ParseMetadataTest.java                |  39 ++
 .../parse/ParseNetworkListTest.java             |  51 ++
 .../parse/ParseNetworkTest.java                 |  54 ++
 .../parse/ParseOperationTest.java               |  79 +++
 .../parse/ParseProjectTest.java                 |  71 +++
 .../parse/ParseQuotaTest.java                   |  39 ++
 .../parse/ParseRegionListTest.java              |  74 +++
 .../parse/ParseRegionOperationTest.java         |  69 +++
 .../parse/ParseRegionTest.java                  |  69 +++
 .../parse/ParseRouteListTest.java               |  70 +++
 .../parse/ParseRouteTest.java                   |  67 +++
 .../parse/ParseSnapshotListTest.java            |  69 +++
 .../parse/ParseSnapshotTest.java                |  59 +++
 .../parse/ParseTargetHttpProxyListTest.java     |  60 +++
 .../parse/ParseTargetHttpProxyTest.java         |  51 ++
 .../parse/ParseTargetInstanceListTest.java      |  62 +++
 .../parse/ParseTargetInstanceTest.java          |  53 ++
 .../parse/ParseTargetPoolListTest.java          |  51 ++
 .../parse/ParseTargetPoolTest.java              |  58 +++
 .../parse/ParseUrlMapListTest.java              |  63 +++
 .../parse/ParseUrlMapTest.java                  |  81 +++
 .../parse/ParseUrlMapValidateTest.java          |  56 +++
 .../parse/ParseZoneListTest.java                |  72 +++
 .../parse/ParseZoneOperationTest.java           |  69 +++
 .../parse/ParseZoneTest.java                    |  65 +++
 .../parse/SimpleParsingTests.java               |  82 +++
 .../src/test/resources/address_get.json         |  14 +
 .../src/test/resources/address_insert.json      |   1 +
 .../src/test/resources/address_list.json        |  32 ++
 .../test/resources/aggregated_address_list.json | 131 +++++
 .../aggregated_address_list_empty.json          | 115 +++++
 .../test/resources/aggregated_disk_list.json    | 118 +++++
 .../resources/aggregated_disk_list_empty.json   | 115 +++++
 .../resources/aggregated_disktype_list.json     | 127 +++++
 .../aggregated_disktype_list_empty.json         | 115 +++++
 .../aggregated_forwarding_rule_list.json        |  60 +++
 .../aggregated_forwarding_rule_list_empty.json  |  55 ++
 .../aggregated_global_operation_list.json       |  99 ++++
 .../aggregated_global_operation_list_empty.json | 115 +++++
 .../resources/aggregated_instance_list.json     | 174 +++++++
 .../aggregated_instance_list_empty.json         | 115 +++++
 .../resources/aggregated_machinetype_list.json  |  58 +++
 .../aggregated_target_instance_list.json        | 128 +++++
 .../aggregated_target_instance_list_empty.json  |  55 ++
 .../resources/aggregated_target_pool_list.json  |  46 ++
 .../aggregated_target_pool_list_empty.json      |  43 ++
 .../src/test/resources/backend_service_get.json |  24 +
 .../backend_service_get_health_request.json     |   1 +
 .../test/resources/backend_service_insert.json  |   9 +
 .../test/resources/backend_service_list.json    |  45 ++
 .../test/resources/disk_create_snapshot.json    |   1 +
 .../src/test/resources/disk_get.json            |  11 +
 .../resources/disk_get_with_source_image.json   |  12 +
 .../src/test/resources/disk_insert.json         |   1 +
 .../src/test/resources/disk_insert_ssd.json     |   1 +
 .../src/test/resources/disk_list.json           |  18 +
 .../src/test/resources/disktype.json            |  11 +
 .../src/test/resources/disktype_list.json       |  27 +
 .../test/resources/disktype_list_central1b.json |  17 +
 .../src/test/resources/disktype_ssd.json        |  11 +
 .../src/test/resources/firewall_get.json        |  30 ++
 .../src/test/resources/firewall_insert.json     |  22 +
 .../src/test/resources/firewall_insert_2.json   |  28 ++
 .../src/test/resources/firewall_list.json       |  58 +++
 .../test/resources/firewall_list_compute.json   |  36 ++
 .../src/test/resources/forwardingrule_get.json  |  12 +
 .../test/resources/forwardingrule_insert.json   |   4 +
 .../src/test/resources/forwardingrule_list.json |  19 +
 .../resources/forwardingrule_set_target.json    |   1 +
 .../resources/global_forwarding_rule_get.json   |  12 +
 .../global_forwarding_rule_insert.json          |   1 +
 .../resources/global_forwarding_rule_list.json  |  19 +
 .../global_forwarding_rule_setTarget.json       |   3 +
 .../src/test/resources/global_operation.json    |  16 +
 .../test/resources/global_operation_list.json   |  23 +
 .../resources/health_status_get_health.json     |  10 +
 .../src/test/resources/httphealthcheck_get.json |  14 +
 .../test/resources/httphealthcheck_insert.json  |   1 +
 .../test/resources/httphealthcheck_list.json    |  39 ++
 .../test/resources/httphealthcheck_patch.json   |   1 +
 .../src/test/resources/image_deprecate.json     |   7 +
 .../src/test/resources/image_get.json           |  25 +
 .../resources/image_get_for_source_image.json   |  25 +
 .../src/test/resources/image_insert.json        |   4 +
 .../test/resources/image_insert_from_pd.json    |   1 +
 .../src/test/resources/image_list.json          |  32 ++
 .../src/test/resources/image_list_centos.json   | 183 +++++++
 .../src/test/resources/image_list_debian.json   | 400 +++++++++++++++
 .../src/test/resources/image_list_empty.json    |   6 +
 .../resources/image_list_multiple_page_1.json   |  55 ++
 .../resources/image_list_multiple_page_2.json   |  47 ++
 .../test/resources/image_list_single_page.json  |  71 +++
 .../resources/instance_add_access_config.json   |  11 +
 .../test/resources/instance_attach_disk.json    |  18 +
 .../src/test/resources/instance_get.json        |  74 +++
 .../src/test/resources/instance_insert.json     |  34 ++
 .../src/test/resources/instance_insert_2.json   |  39 ++
 .../test/resources/instance_insert_full.json    |  47 ++
 .../test/resources/instance_insert_simple.json  |  30 ++
 .../src/test/resources/instance_insert_ssd.json |  40 ++
 .../src/test/resources/instance_list.json       |  81 +++
 .../instance_list_central1b_empty.json          |   6 +
 .../test/resources/instance_serial_port.json    |   5 +
 .../test/resources/instance_set_metadata.json   |   1 +
 .../src/test/resources/instance_set_tags.json   |   4 +
 .../src/test/resources/license_get.json         |   6 +
 .../src/test/resources/list_empty.json          |   5 +
 .../src/test/resources/logback.xml              |  83 +++
 .../src/test/resources/machinetype.json         |  21 +
 .../src/test/resources/machinetype_list.json    |  54 ++
 .../src/test/resources/metadata.json            |   1 +
 .../src/test/resources/network_get.json         |  10 +
 .../src/test/resources/network_get_default.json |  10 +
 .../src/test/resources/network_insert.json      |   1 +
 .../src/test/resources/network_list.json        |  18 +
 .../src/test/resources/operation.json           |  40 ++
 .../src/test/resources/operation_error.json     |  26 +
 .../src/test/resources/operation_list.json      |  24 +
 .../src/test/resources/project.json             |  73 +++
 .../src/test/resources/quota.json               |   5 +
 .../src/test/resources/region_get.json          |  60 +++
 .../src/test/resources/region_list.json         | 126 +++++
 .../src/test/resources/region_operation.json    |  17 +
 .../test/resources/region_operation_list.json   |  24 +
 .../src/test/resources/route_get.json           |  28 ++
 .../src/test/resources/route_insert.json        |   1 +
 .../src/test/resources/route_list.json          |  47 ++
 .../src/test/resources/snapshot_get.json        |  13 +
 .../src/test/resources/snapshot_list.json       |  33 ++
 .../src/test/resources/tag_insert.json          |   1 +
 .../test/resources/target_http_proxy_get.json   |   8 +
 .../resources/target_http_proxy_insert.json     |   4 +
 .../test/resources/target_http_proxy_list.json  |  24 +
 .../target_http_proxy_set_url_map.json          |   1 +
 .../src/test/resources/target_instance_get.json |  11 +
 .../test/resources/target_instance_insert.json  |   6 +
 .../test/resources/target_instance_list.json    |  30 ++
 .../test/resources/targetpool_addinstance.json  |   1 +
 .../resources/targetpool_changehealthcheck.json |   1 +
 .../src/test/resources/targetpool_get.json      |   9 +
 .../src/test/resources/targetpool_insert.json   |   3 +
 .../src/test/resources/targetpool_list.json     |  17 +
 .../test/resources/targetpool_setbackup.json    |   1 +
 .../src/test/resources/test                     |  27 +
 .../src/test/resources/url_map_get.json         |  39 ++
 .../src/test/resources/url_map_insert.json      |   1 +
 .../src/test/resources/url_map_list.json        |  56 +++
 .../src/test/resources/url_map_validate.json    |  17 +
 .../resources/url_map_validate_request.json     |   1 +
 .../src/test/resources/zone_get.json            |  18 +
 .../src/test/resources/zone_list.json           |  43 ++
 .../src/test/resources/zone_list_short.json     |  25 +
 .../src/test/resources/zone_operation.json      |  17 +
 .../test/resources/zone_operation_error.json    |  25 +
 .../src/test/resources/zone_operation_list.json |  24 +
 373 files changed, 28930 insertions(+)
----------------------------------------------------------------------



[45/50] [abbrv] jclouds git commit: Add running GoogleComputeEngineTemplateBuilderLiveTest with Json key

Posted by na...@apache.org.
Add running GoogleComputeEngineTemplateBuilderLiveTest with Json key


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

Branch: refs/heads/master
Commit: c1b1cfbbeaa32b0d9fca6ac649734c1abd8a0b69
Parents: 6d850a8
Author: Daniel Broudy <br...@google.com>
Authored: Mon Jun 15 09:56:03 2015 -0700
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Jun 15 22:44:47 2015 +0200

----------------------------------------------------------------------
 .../GoogleComputeEngineTemplateBuilderLiveTest.java    | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/c1b1cfbb/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineTemplateBuilderLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineTemplateBuilderLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineTemplateBuilderLiveTest.java
index 851b94d..dbbedb3 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineTemplateBuilderLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineTemplateBuilderLiveTest.java
@@ -26,12 +26,14 @@ import static org.testng.Assert.assertTrue;
 
 import java.io.IOException;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 
 import org.jclouds.compute.domain.Image;
 import org.jclouds.compute.domain.OsFamily;
 import org.jclouds.compute.domain.Template;
 import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
+import org.jclouds.googlecloud.internal.TestProperties;
 import org.testng.annotations.Test;
 
 import com.google.common.collect.ImmutableMap;
@@ -43,7 +45,12 @@ public class GoogleComputeEngineTemplateBuilderLiveTest extends BaseTemplateBuil
    public GoogleComputeEngineTemplateBuilderLiveTest() {
       provider = "google-compute-engine";
    }
-   
+
+   @Override protected Properties setupProperties() {
+      TestProperties.setGoogleCredentialsFromJson(provider);
+      return TestProperties.apply(provider, super.setupProperties());
+   }
+
    @Test
    @Override
    public void testDefaultTemplateBuilder() throws IOException {
@@ -53,7 +60,7 @@ public class GoogleComputeEngineTemplateBuilderLiveTest extends BaseTemplateBuil
       assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), DEBIAN);
       assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
    }
-   
+
    @Test
    public void testDefaultCredentials() {
       Map<OsFamily, String> defaultUsernames = ImmutableMap.of(COREOS, "core", WINDOWS, "Administrator");
@@ -63,7 +70,7 @@ public class GoogleComputeEngineTemplateBuilderLiveTest extends BaseTemplateBuil
                firstNonNull(defaultUsernames.get(image.getOperatingSystem().getFamily()), "jclouds"));
       }
    }
-   
+
    @Override
    protected Set<String> getIso3166Codes() {
       return ImmutableSet.<String> of();


[28/50] [abbrv] jclouds git commit: Updated BackendServiceOptions to AutoValue + Builder

Posted by na...@apache.org.
Updated BackendServiceOptions to AutoValue + Builder


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

Branch: refs/heads/master
Commit: a9eecfad818eaddbf3048e44b5cd6567f10602f8
Parents: 7ac7197
Author: Daniel Broudy <br...@google.com>
Authored: Tue Jan 27 16:47:16 2015 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Feb 18 10:58:36 2015 +0100

----------------------------------------------------------------------
 .../options/BackendServiceOptions.java          | 279 +++++++++----------
 .../features/BackendServiceApiLiveTest.java     |  29 +-
 .../features/BackendServiceApiMockTest.java     |  12 +-
 .../GlobalForwardingRuleApiLiveTest.java        |   3 +-
 .../features/TargetHttpProxyApiLiveTest.java    |   4 +-
 .../features/UrlMapApiLiveTest.java             |   3 +-
 6 files changed, 154 insertions(+), 176 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/a9eecfad/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
index 60f1e4f..0257882 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
@@ -21,154 +21,135 @@ import java.util.List;
 
 import org.jclouds.googlecomputeengine.domain.BackendService.Backend;
 import org.jclouds.javax.annotation.Nullable;
-
-public class BackendServiceOptions {
-
-   private String name;
-   @Nullable private String description;
-   private List<URI> healthChecks;
-   private List<Backend> backends;
-   private Integer timeoutSec;
-   private Integer port;
-   private String protocol;
-   private String fingerprint;
-   private String portName;
-
-   /**
-    * Name of the BackendService resource.
-    * @return name, provided by the client.
-    */
-   public String getName(){
-      return name;
-   }
-
-   /**
-    * @see BackendServiceOptions#getName()
-    */
-   public BackendServiceOptions name(String name) {
-      this.name = name;
-      return this;
-   }
-
-   /**
-    * An optional textual description of the BackendService.
-    * @return description, provided by the client.
-    */
-   public String getDescription(){
-      return description;
-   }
-
-   /**
-    * @see BackendServiceOptions#getDescription()
-    */
-   public BackendServiceOptions description(String description) {
-      this.description = description;
-      return this;
-   }
-
-   /**
-    * The list of {@link HttpHealthCheck#selfLink Links} to the HttpHealthCheck resource for health checking this BackendService.
-    * Currently at most one health check can be specified, and a health check is required.
-    */
-   public List<URI> getHealthChecks() {
-      return healthChecks;
-   }
-
-   /**
-    * @see BackendServiceOptions#getHealthChecks()
-    */
-   public BackendServiceOptions healthChecks(List<URI> healthChecks) {
-      this.healthChecks = healthChecks;
-      return this;
-   }
-
-   /**
-    * The list of backends that serve this BackendService.
-    */
-   public List<Backend> getBackends() {
-      return backends;
-   }
-
-   /**
-    * @see BackendServiceOptions#getBackends()
-    */
-   public BackendServiceOptions backends(List<Backend> backends){
-      this.backends = backends;
-      return this;
-   }
-
-   /**
-    * How many seconds to wait for the backend before considering it a failed request.
-    * Default is 30 seconds.
-    */
-   public Integer getTimeoutSec() {
-      return timeoutSec;
-   }
-
-   /**
-    * @see BackendServiceOptions#getTimeoutSec()
-    */
-   public BackendServiceOptions timeoutSec(Integer timeoutSec) {
-      this.timeoutSec = timeoutSec;
-      return this;
-   }
-
-   /**
-    * The TCP port to connect on the backend.
-    * The default value is 80.
-    */
-   public Integer getPort() {
-      return port;
-   }
-
-   /**
-    * @see BackendServiceOptions#getPort()
-    */
-   public BackendServiceOptions port(Integer port) {
-      this.port = port;
-      return this;
-   }
-
-
-   /**
-    * The  protocol for incoming requests.
-    */
-   public String getProtocol() {
-      return protocol;
-   }
-
-   /**
-    * @see BackendServiceOptions#getProtocol()
-    */
-   public BackendServiceOptions protocol(String protocol) {
-      this.protocol = protocol;
-      return this;
-   }
-
-   /**
-    * Fingerprint of this resource. A hash of the contents stored in this object.
-    * This field is used in optimistic locking. This field will be ignored when
-    * inserting a BackendService. An up-to-date fingerprint must be provided in
-    * order to update the BackendService.
-    */
-   public String getFingerprint() {
-      return fingerprint;
-   }
-
-   /**
-    * @see BackendServiceOptions#getFingerprint()
-    */
-   public BackendServiceOptions fingerprint(String fingerprint) {
-      this.fingerprint = fingerprint;
-      return this;
-   }
-
-   public String getPortName() {
-      return portName;
-   }
-
-   public BackendServiceOptions portName(String portName) {
-      this.portName = portName;
-      return this;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class BackendServiceOptions {
+
+   @Nullable public abstract String name();
+   @Nullable public abstract String description();
+   @Nullable public abstract List<URI> healthChecks();
+   @Nullable public abstract List<Backend> backends();
+   @Nullable public abstract Integer timeoutSec();
+   @Nullable public abstract Integer port();
+   @Nullable public abstract String protocol();
+   @Nullable public abstract String fingerprint();
+   @Nullable public abstract String portName();
+
+   @SerializedNames({"name", "description", "healthChecks", "backends", "timeoutSec",
+      "port", "protocol", "fingerprint", "portName"})
+   static BackendServiceOptions create(String name, String description, List<URI> healthChecks,
+         List<Backend> backends, Integer timeoutSec, Integer port, String protocol, String fingerprint, String portName){
+      return new AutoValue_BackendServiceOptions(name, description, healthChecks,
+            backends, timeoutSec, port, protocol, fingerprint, portName);
+   }
+
+   BackendServiceOptions(){
+   }
+
+   public static class Builder {
+
+      private String name;
+      private String description;
+      private List<URI> healthChecks;
+      private List<Backend> backends;
+      private Integer timeoutSec;
+      private Integer port;
+      private String protocol;
+      private String fingerprint;
+      private String portName;
+
+      /**
+       * @param name, provided by the client.
+       * @param healthChecks The list of {@link HttpHealthCheck#selfLink Links} to the HttpHealthCheck
+       * resource for health checking this BackendService.
+       * Currently at most one health check can be specified, and a health check is required.
+       */
+      public Builder(String name, List<URI> healthChecks){
+         this.name = name;
+         this.healthChecks = healthChecks;
+      }
+
+      /**
+       * Empty builder for use when patching or updating and existing BackendService
+       * Otherwise use the other {@link #Builder(String, List) builder}
+       */
+      public Builder(){
+      }
+
+      /**
+       * An optional textual description of the BackendService.
+       */
+      public Builder description(String description){
+         this.description =  description;
+         return this;
+      }
+
+      /**
+       *  HealthChecks - The list of {@link HttpHealthCheck#selfLink Links} to the HttpHealthCheck
+       * resource for health checking this BackendService.
+       * Currently at most one health check can be specified, and a health check is required.
+       */
+      public Builder healthChecks(List<URI> healthChecks){
+         this.healthChecks =  healthChecks;
+         return this;
+      }
+
+      /**
+       * The list of backends that serve this BackendService.
+       */
+      public Builder backends(List<Backend> backends){
+         this.backends = backends;
+         return this;
+      }
+
+      /**
+       * How many seconds to wait for the backend before considering it a failed request.
+       * Default is 30 seconds.
+       */
+      public Builder timeoutSec(Integer timeoutSec) {
+         this.timeoutSec = timeoutSec;
+         return this;
+      }
+
+      /**
+       * The TCP port to connect on the backend.
+       * The default value is 80.
+       */
+      public Builder port(Integer port) {
+         this.port = port;
+         return this;
+      }
+
+      /**
+       * The  protocol for incoming requests.
+       */
+      public Builder protocol(String protocol) {
+         this.protocol = protocol;
+         return this;
+      }
+
+      /**
+       * Fingerprint of this resource. A hash of the contents stored in this object.
+       * This field is used in optimistic locking. This field will be ignored when
+       * inserting a BackendService. An up-to-date fingerprint must be provided in
+       * order to update the BackendService.
+       */
+      public Builder fingerprint(String fingerprint) {
+         this.fingerprint = fingerprint;
+         return this;
+      }
+
+      public Builder portName(String portName) {
+         this.portName = portName;
+         return this;
+      }
+
+      public BackendServiceOptions build(){
+         return create(name, description, healthChecks,
+               backends, timeoutSec, port, protocol, fingerprint, portName);
+      }
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a9eecfad/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiLiveTest.java
index c5eeee6..9ed6ceb 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiLiveTest.java
@@ -47,7 +47,8 @@ public class BackendServiceApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
       assertOperationDoneSuccessfully(api.httpHeathChecks().insert(BACKEND_SERVICE_HEALTH_CHECK_NAME));
 
       List<URI> healthChecks = ImmutableList.of(getHealthCheckUrl(BACKEND_SERVICE_HEALTH_CHECK_NAME));
-      BackendServiceOptions b = new BackendServiceOptions().name(BACKEND_SERVICE_NAME).healthChecks(healthChecks);
+
+      BackendServiceOptions b = new BackendServiceOptions.Builder(BACKEND_SERVICE_NAME, healthChecks).build();
       assertOperationDoneSuccessfully(api().create(b));
    }
 
@@ -61,11 +62,10 @@ public class BackendServiceApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
    @Test(groups = "live", dependsOnMethods = "testGetBackendService")
    public void testPatchBackendService() {
       String fingerprint = api().get(BACKEND_SERVICE_NAME).fingerprint();
-      BackendServiceOptions backendService = new BackendServiceOptions()
-              .name(BACKEND_SERVICE_NAME)
-              .healthChecks(ImmutableList.of(getHealthCheckUrl(BACKEND_SERVICE_HEALTH_CHECK_NAME)))
+      BackendServiceOptions backendService = new BackendServiceOptions.Builder(BACKEND_SERVICE_NAME, ImmutableList.of(getHealthCheckUrl(BACKEND_SERVICE_HEALTH_CHECK_NAME)))
               .timeoutSec(10)
-              .fingerprint(fingerprint);
+              .fingerprint(fingerprint)
+              .build();
 
       assertOperationDoneSuccessfully(api().update(BACKEND_SERVICE_NAME, backendService));
       assertBackendServiceEquals(api().get(BACKEND_SERVICE_NAME), backendService);
@@ -75,12 +75,11 @@ public class BackendServiceApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
    public void testUpdateBackendService() {
       String fingerprint = api().get(BACKEND_SERVICE_NAME).fingerprint();
 
-      BackendServiceOptions backendService = new BackendServiceOptions()
-              .name(BACKEND_SERVICE_NAME)
-              .healthChecks(ImmutableList.of(getHealthCheckUrl(BACKEND_SERVICE_HEALTH_CHECK_NAME)))
+      BackendServiceOptions backendService = new BackendServiceOptions.Builder(BACKEND_SERVICE_NAME, ImmutableList.of(getHealthCheckUrl(BACKEND_SERVICE_HEALTH_CHECK_NAME)))
               .timeoutSec(45)
               .port(8080)
-              .fingerprint(fingerprint);
+              .fingerprint(fingerprint)
+              .build();
 
       assertOperationDoneSuccessfully(api().update(BACKEND_SERVICE_NAME, backendService));
       assertBackendServiceEquals(api().get(BACKEND_SERVICE_NAME),
@@ -119,13 +118,13 @@ public class BackendServiceApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
    }
 
    private void assertBackendServiceEquals(BackendService result, BackendServiceOptions expected) {
-      assertEquals(result.name(), expected.getName());
-      assertEquals(result.healthChecks(), expected.getHealthChecks());
-      if (expected.getTimeoutSec() != null) {
-         org.testng.Assert.assertEquals(result.timeoutSec(), expected.getTimeoutSec().intValue());
+      assertEquals(result.name(), expected.name());
+      assertEquals(result.healthChecks(), expected.healthChecks());
+      if (expected.timeoutSec() != null) {
+         org.testng.Assert.assertEquals(result.timeoutSec(), expected.timeoutSec().intValue());
       }
-      if (expected.getPort() != null) {
-         org.testng.Assert.assertEquals(result.port(), expected.getPort().intValue());
+      if (expected.port() != null) {
+         org.testng.Assert.assertEquals(result.port(), expected.port().intValue());
       }
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a9eecfad/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
index 1cc8400..fd9a639 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
@@ -57,11 +57,11 @@ public class BackendServiceApiMockTest extends BaseGoogleComputeEngineApiMockTes
       List<URI> healthChecks = ImmutableList.of(URI.create(url("/projects/"
             + "myproject/global/httpHealthChecks/jclouds-test")));
 
-      assertEquals(backendServiceApi().create( new BackendServiceOptions().name("jclouds-test")
+      assertEquals(backendServiceApi().create( new BackendServiceOptions.Builder("jclouds-test", healthChecks)
             .protocol("HTTP")
             .port(80)
             .timeoutSec(30)
-            .healthChecks(healthChecks)),
+            .build()),
             new ParseOperationTest().expected(url("/projects")));
 
       assertSent(server, "POST", "/projects/party/global/backendServices",
@@ -75,11 +75,11 @@ public class BackendServiceApiMockTest extends BaseGoogleComputeEngineApiMockTes
             + "myproject/global/httpHealthChecks/jclouds-test")));
 
       assertEquals(backendServiceApi().update("jclouds-test",
-            new BackendServiceOptions().name("jclouds-test")
+            new BackendServiceOptions.Builder("jclouds-test", healthChecks)
                .protocol("HTTP")
                .port(80)
                .timeoutSec(30)
-               .healthChecks(healthChecks)),
+               .build()),
             new ParseOperationTest().expected(url("/projects")));
       assertSent(server, "PUT", "/projects/party/global/backendServices/jclouds-test",
             stringFromResource("/backend_service_insert.json"));
@@ -92,11 +92,11 @@ public class BackendServiceApiMockTest extends BaseGoogleComputeEngineApiMockTes
             + "myproject/global/httpHealthChecks/jclouds-test")));
 
       assertEquals(backendServiceApi().patch("jclouds-test",
-            new BackendServiceOptions().name("jclouds-test")
+            new BackendServiceOptions.Builder("jclouds-test", healthChecks)
                .protocol("HTTP")
                .port(80)
                .timeoutSec(30)
-               .healthChecks(healthChecks)),
+               .build()),
             new ParseOperationTest().expected(url("/projects")));
       assertSent(server, "PATCH", "/projects/party/global/backendServices/jclouds-test",
             stringFromResource("/backend_service_insert.json"));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a9eecfad/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
index a3656a0..3aa012b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
@@ -61,8 +61,7 @@ public class GlobalForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiL
 
 
       List<URI> healthChecks = ImmutableList.of(getHealthCheckUrl(GLOBAL_FORWARDING_RULE_HEALTH_CHECK_NAME));
-      BackendServiceOptions b = new BackendServiceOptions().name(GLOBAL_FORWARDING_RULE_BACKEND_SERVICE_NAME)
-                                                           .healthChecks(healthChecks);
+      BackendServiceOptions b = new BackendServiceOptions.Builder(GLOBAL_FORWARDING_RULE_BACKEND_SERVICE_NAME, healthChecks).build();
       assertOperationDoneSuccessfully(api.backendServices()
                                               .create(b));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a9eecfad/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiLiveTest.java
index ef3abae..be51627 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiLiveTest.java
@@ -52,8 +52,8 @@ public class TargetHttpProxyApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
       assertOperationDoneSuccessfully(api.httpHeathChecks().insert(HEALTH_CHECK_NAME));
 
       List<URI> healthChecks = ImmutableList.of(getHealthCheckUrl(HEALTH_CHECK_NAME));
-      BackendServiceOptions b = new BackendServiceOptions().name(URL_MAP_DEFAULT_SERVICE_NAME)
-                                                           .healthChecks(healthChecks);
+      BackendServiceOptions b = new BackendServiceOptions.Builder(URL_MAP_DEFAULT_SERVICE_NAME, healthChecks)
+                                                           .build();
 
       assertOperationDoneSuccessfully(api.backendServices().create(b));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a9eecfad/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
index f48e44a..c5df2ff 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
@@ -54,8 +54,7 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertOperationDoneSuccessfully(api.httpHeathChecks().insert(HEALTH_CHECK_NAME));
 
       List<URI> healthChecks = ImmutableList.of(getHealthCheckUrl(HEALTH_CHECK_NAME));
-      BackendServiceOptions b = new BackendServiceOptions().name(URL_MAP_BACKEND_SERVICE_NAME)
-                                                           .healthChecks(healthChecks);
+      BackendServiceOptions b = new BackendServiceOptions.Builder(URL_MAP_BACKEND_SERVICE_NAME, healthChecks).build();
       assertOperationDoneSuccessfully(api.backendServices().create(b));
 
       UrlMapOptions map = new UrlMapOptions.Builder().name(URL_MAP_NAME).description("simple url map")


[39/50] [abbrv] jclouds git commit: JCLOUDS-906: Add ServiceAccounts to GoogleComputeEngineTemplateOptions

Posted by na...@apache.org.
JCLOUDS-906: Add ServiceAccounts to GoogleComputeEngineTemplateOptions


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

Branch: refs/heads/master
Commit: 55348c0ddbdc21ecbdbfbd84f22db9423f21733d
Parents: aa33619
Author: Daniel Broudy <br...@google.com>
Authored: Fri May 29 10:13:31 2015 -0700
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Jun 3 01:47:54 2015 +0200

----------------------------------------------------------------------
 .../GoogleComputeEngineServiceAdapter.java      | 17 ++--
 .../GoogleComputeEngineTemplateOptions.java     | 24 +++++-
 .../googlecomputeengine/domain/NewInstance.java | 87 ++++++++++++++++++--
 .../googlecomputeengine/domain/Tags.java        |  4 -
 .../features/InstanceApiLiveTest.java           | 27 +++++-
 .../features/InstanceApiMockTest.java           | 37 +++++++++
 .../test/resources/instance_insert_full.json    | 47 +++++++++++
 7 files changed, 219 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/55348c0d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index bf45ed0..2ab5c0f 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -138,15 +138,14 @@ public final class GoogleComputeEngineServiceAdapter
          tags.add(naming.name(ports));
       }
 
-      NewInstance newInstance = NewInstance.create(
-            name, // name
+      NewInstance newInstance = new NewInstance.Builder( name,
             template.getHardware().getUri(), // machineType
-            network, // network
-            disks, // disks
-            group, // description
-            Tags.create(null, ImmutableList.copyOf(tags)) // tags
-      );
-
+            network,
+            disks)
+            .description(group)
+            .tags(Tags.create(null, ImmutableList.copyOf(tags)))
+            .serviceAccounts(options.serviceAccounts())
+            .build();
 
       // Add metadata from template and for ssh key and image id
       newInstance.metadata().putAll(options.getUserMetadata());
@@ -177,7 +176,7 @@ public final class GoogleComputeEngineServiceAdapter
             null, // networkInterfaces
             null, // disks
             newInstance.metadata(), // metadata
-            null, // serviceAccounts
+            newInstance.serviceAccounts(), // serviceAccounts
             Scheduling.create(OnHostMaintenance.MIGRATE, true) // scheduling
       ));
       checkState(instanceVisible.apply(instance), "instance %s is not api visible!", instance.get());

http://git-wip-us.apache.org/repos/asf/jclouds/blob/55348c0d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
index 2fc8e8a..1923c3a 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
@@ -16,16 +16,19 @@
  */
 package org.jclouds.googlecomputeengine.compute.options;
 
+import java.util.List;
 import java.util.Map;
 
 import org.jclouds.compute.options.TemplateOptions;
 import org.jclouds.domain.LoginCredentials;
 import org.jclouds.scriptbuilder.domain.Statement;
+import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
 
 /** Instance options specific to Google Compute Engine. */
 public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
 
    private boolean autoCreateKeyPair = true;
+   private List<ServiceAccount> serviceAccounts;
 
    @Override
    public GoogleComputeEngineTemplateOptions clone() {
@@ -40,6 +43,7 @@ public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
       if (to instanceof GoogleComputeEngineTemplateOptions) {
          GoogleComputeEngineTemplateOptions eTo = GoogleComputeEngineTemplateOptions.class.cast(to);
          eTo.autoCreateKeyPair(autoCreateKeyPair());
+         eTo.serviceAccounts(serviceAccounts());
       }
    }
 
@@ -52,13 +56,31 @@ public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
    }
 
    /**
-    * Sets whether an SSH key pair should be created automatically.
+    * Gets whether an SSH key pair should be created automatically.
     */
    public boolean autoCreateKeyPair() {
       return autoCreateKeyPair;
    }
 
    /**
+    * Sets a list of service accounts, with their specified scopes, to authorize on created instance.
+    * For example, to give a node the 'compute' scope you would add a service account with the email 'default'
+    * and the scope 'https://www.googleapis.com/auth/compute'
+    * These scopes will be given to all nodes created with these template options.
+    */
+   public GoogleComputeEngineTemplateOptions serviceAccounts(List<ServiceAccount> serviceAccounts){
+      this.serviceAccounts = serviceAccounts;
+      return this;
+   }
+
+   /**
+    * Gets the list of service accounts, with their specified scopes, that will be authorize on created instances.
+    */
+   public List<ServiceAccount> serviceAccounts(){
+      return serviceAccounts;
+   }
+
+   /**
     * {@inheritDoc}
     */
    @Override

http://git-wip-us.apache.org/repos/asf/jclouds/blob/55348c0d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
index f6b6f6d..2738646 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
@@ -17,6 +17,7 @@
 package org.jclouds.googlecomputeengine.domain;
 
 import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
 
 import java.net.URI;
 import java.util.Arrays;
@@ -80,7 +81,8 @@ public abstract class NewInstance {
       return create(name, machineType, network, Arrays.asList(AttachDisk.newBootDisk(sourceImage)), null, null);
    }
 
-   public static NewInstance create(String name, URI machineType, URI network, List<AttachDisk> disks, @Nullable String description, @Nullable Tags tags) {
+   public static NewInstance create(String name, URI machineType, URI network, List<AttachDisk> disks,
+                                    @Nullable String description, @Nullable Tags tags) {
       checkArgument(disks.get(0).boot(), "disk 0 must be a boot disk! %s", disks);
       boolean foundBoot = false;
       for (AttachDisk disk : disks) {
@@ -93,13 +95,86 @@ public abstract class NewInstance {
             description, tags != null ? tags : Tags.create(), Metadata.create(), null, null);
    }
 
-   @SerializedNames({ "name", "machineType", "canIpForward", "networkInterfaces", "disks", "description", "tags", "metadata",
-      "serviceAccounts", "scheduling" })
-   static NewInstance create(String name, URI machineType, Boolean canIpForward, List<NetworkInterface> networkInterfaces,
-         List<AttachDisk> disks, String description, Tags tags, Metadata metadata, List<ServiceAccount> serviceAccounts, Scheduling scheduling) {
-      return new AutoValue_NewInstance(name, machineType, canIpForward, networkInterfaces, disks, description, tags, metadata, serviceAccounts, scheduling);
+   @SerializedNames({ "name", "machineType", "canIpForward", "networkInterfaces", "disks", "description",
+                      "tags", "metadata", "serviceAccounts", "scheduling" })
+   static NewInstance create(String name, URI machineType, Boolean canIpForward,
+                             List<NetworkInterface> networkInterfaces, List<AttachDisk> disks, String description,
+                             Tags tags, Metadata metadata, List<ServiceAccount> serviceAccounts, Scheduling scheduling) {
+      return new AutoValue_NewInstance(name, machineType, canIpForward, networkInterfaces, disks, description,
+                                       tags, metadata, serviceAccounts, scheduling);
    }
 
    NewInstance() {
    }
+
+   public static class Builder {
+      private String name;
+      private URI machineType;
+      private Boolean canIpForward;
+      private List<NetworkInterface> networkInterfaces;
+      private List<AttachDisk> disks;
+      private String description;
+      private Tags tags;
+      private Metadata metadata;
+      private List<ServiceAccount> serviceAccounts;
+      private Scheduling scheduling;
+
+      public Builder(String name, URI machineType, URI network, List<AttachDisk> disks) {
+         checkNotNull(name, "NewInstance name cannot be null");
+         this.name = name;
+         this.machineType = machineType;
+         this.networkInterfaces = ImmutableList.of(NetworkInterface.create(network));
+         this.disks = disks;
+      }
+
+      public Builder(String name, URI machineType, URI network, URI sourceImage) {
+         checkNotNull(name, "NewInstance name cannot be null");
+         this.name = name;
+         this.machineType = machineType;
+         this.networkInterfaces = ImmutableList.of(NetworkInterface.create(network));
+         this.disks = Arrays.asList(AttachDisk.newBootDisk(sourceImage));
+      }
+
+      public Builder canIpForward(Boolean canIpForward){
+         this.canIpForward = canIpForward;
+         return this;
+      }
+
+      public Builder description(String description){
+         this.description = description;
+         return this;
+      }
+
+      public Builder tags(Tags tags){
+         this.tags = tags;
+         return this;
+      }
+
+      public Builder metadata(Metadata metadata){
+         this.metadata = metadata;
+         return this;
+      }
+
+      /**
+       * A list of service accounts, with their specified scopes, authorized for this instance.
+       * Service accounts generate access tokens that can be accessed through the metadata server
+       * and used to authenticate applications on the instance.
+       * Note: to add scopes to the default service account on the VM you can use 'default' as
+       * a keyword for email.
+       */
+      public Builder serviceAccounts(List<ServiceAccount> serviceAccounts){
+         this.serviceAccounts = serviceAccounts;
+         return this;
+      }
+
+      public Builder scheduling(Scheduling scheduling){
+         this.scheduling = scheduling;
+         return this;
+      }
+
+      public NewInstance build() {
+         return create(name, machineType, canIpForward, networkInterfaces, disks, description, tags != null ? tags : Tags.create(),
+                       metadata != null ? metadata : Metadata.create(), serviceAccounts, scheduling);
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/55348c0d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Tags.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Tags.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Tags.java
index 2bd09fd..59f3071 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Tags.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Tags.java
@@ -40,10 +40,6 @@ public abstract class Tags implements Cloneable {
       return Tags.create(null, null);
    }
 
-   public static Tags create(String fingerprint) {
-      return Tags.create(fingerprint, null);
-   }
-
    @SerializedNames({ "fingerprint", "items" })
    public static Tags create(String fingerprint, ImmutableList<String> items) { // Dictates the type when created from json!
       ImmutableList<String> empty = ImmutableList.of();

http://git-wip-us.apache.org/repos/asf/jclouds/blob/55348c0d/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index 651c7d1..5200c3a 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -34,7 +34,9 @@ import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
 import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig.Type;
 import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
+import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
 import org.jclouds.googlecomputeengine.domain.Instance.SerialPortOutput;
+import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
 import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
 import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
@@ -99,11 +101,16 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       );
       instance.metadata().put("mykey", "myvalue");
 
-      instance2 = NewInstance.create(
-            INSTANCE_NAME2, // name
+      instance2 = new NewInstance.Builder(INSTANCE_NAME2, // name
             getDefaultMachineTypeUrl(), // machineType
             getNetworkUrl(INSTANCE_NETWORK_NAME), // network
-            imageUri); // sourceImage
+            imageUri) // sourceImage
+            .canIpForward(true)
+            .description("description")
+            .tags(Tags.create(null, ImmutableList.of("tag1")))
+            .serviceAccounts(ImmutableList.of(ServiceAccount.create("default", ImmutableList.of("https://www.googleapis.com/auth/compute"))))
+            .scheduling(Scheduling.create(OnHostMaintenance.MIGRATE, true))
+            .build();
 
       return api;
    }
@@ -116,6 +123,18 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       return api.disksInZone(DEFAULT_ZONE_NAME);
    }
 
+   @Test(groups = "live", dependsOnMethods = "testInsertInstance")
+   public void testGetInstance2() {
+      Instance instance = api().get(INSTANCE_NAME2);
+      assertNotNull(instance);
+      assertInstanceEquals(instance, this.instance2);
+      assertTrue(instance.canIpForward());
+      assertEquals(instance.description(), "description");
+      assertEquals(instance.serviceAccounts().get(0).scopes(), ImmutableList.of("https://www.googleapis.com/auth/compute"));
+      assertTrue(instance.scheduling().automaticRestart());
+      assertEquals(instance.scheduling().onHostMaintenance(), OnHostMaintenance.MIGRATE);
+   }
+
    @Test(groups = "live")
    public void testInsertInstance() {
       // need to insert the network first
@@ -294,7 +313,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertOperationDoneSuccessfully(api().reset(INSTANCE_NAME));
    }
 
-   @Test(groups = "live", dependsOnMethods = "testInsertInstance")
+   @Test(groups = "live", dependsOnMethods = "testGetInstance2")
    public void testStopInstance() {
       Instance originalInstance = api().get(INSTANCE_NAME2);
       assertEquals(originalInstance.status(), Instance.Status.RUNNING);

http://git-wip-us.apache.org/repos/asf/jclouds/blob/55348c0d/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
index 7d1a72a..2c19324 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
@@ -27,6 +27,8 @@ import org.jclouds.googlecomputeengine.domain.AttachDisk;
 import org.jclouds.googlecomputeengine.domain.AttachDisk.DiskInterface;
 import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
 import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig.Type;
+import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
+import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
 import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
@@ -250,6 +252,41 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/stop");
    }
 
+   public void builderTest() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      NewInstance newInstance = new NewInstance.Builder("test-1", // name
+            URI.create(url("/projects/party/zones/us-central1-a/machineTypes/n1-standard-1")), // machineType
+            URI.create(url("/projects/party/global/networks/default")), // network
+            URI.create(url("/projects/party/global/images/centos-6-2-v20120326"))).build(); // sourceImage)
+
+      assertEquals(instanceApi().create(newInstance), new ParseZoneOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances",
+            stringFromResource("/instance_insert_simple.json"));
+   }
+
+   public void insert_builder_allOptions() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      NewInstance newInstance = new NewInstance.Builder(
+            "test-1", // name
+            URI.create(url("/projects/party/zones/us-central1-a/machineTypes/n1-standard-1")), // machineType
+            URI.create(url("/projects/party/global/networks/default")), // network
+            Arrays.asList(AttachDisk.existingBootDisk(URI.create(url("/projects/party/zones/us-central1-a/disks/test")))))
+            .canIpForward(true)
+            .description("desc")
+            .tags(null)
+            .metadata(Metadata.create().put("aKey", "aValue"))
+            .serviceAccounts(ImmutableList.of(ServiceAccount.create("default",
+                                              ImmutableList.of("https://www.googleapis.com/auth/compute"))))
+            .scheduling(Scheduling.create(OnHostMaintenance.MIGRATE, true))
+            .build();
+
+      assertEquals(instanceApi().create(newInstance), new ParseZoneOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances",
+            stringFromResource("/instance_insert_full.json"));
+   }
+
    InstanceApi instanceApi(){
       return api().instancesInZone("us-central1-a");
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/55348c0d/providers/google-compute-engine/src/test/resources/instance_insert_full.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_insert_full.json b/providers/google-compute-engine/src/test/resources/instance_insert_full.json
new file mode 100644
index 0000000..61302df
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/instance_insert_full.json
@@ -0,0 +1,47 @@
+{
+  "name": "test-1",
+  "machineType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1",
+  "canIpForward": true,
+  "networkInterfaces": [
+    {
+      "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
+      "accessConfigs": [
+        {
+          "type": "ONE_TO_ONE_NAT"
+        }
+      ]
+    }
+  ],
+  "disks": [
+    {
+      "type": "PERSISTENT",
+      "source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
+      "boot": true,
+      "autoDelete": false
+    }
+  ],
+  "description": "desc",
+  "tags": {
+    "items": []
+  },
+  "metadata": {
+    "items": [
+      {
+        "key": "aKey",
+        "value": "aValue"
+      }
+    ]
+  },
+  "serviceAccounts": [
+    {
+      "email": "default",
+      "scopes": [
+        "https://www.googleapis.com/auth/compute"
+      ]
+    }
+  ],
+  "scheduling": {
+    "onHostMaintenance": "MIGRATE",
+    "automaticRestart": true
+  }
+}
\ No newline at end of file


[04/50] [abbrv] jclouds git commit: Converting tests to Mock

Posted by na...@apache.org.
Converting tests to Mock


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

Branch: refs/heads/master
Commit: 81d410a5880a1249ac203e3be40b5da8e380f2ca
Parents: 0c41f7a
Author: Daniel Broudy <br...@google.com>
Authored: Tue Nov 25 13:43:54 2014 -0800
Committer: Adrian Cole <ac...@twitter.com>
Committed: Wed Nov 26 15:27:44 2014 -0800

----------------------------------------------------------------------
 .../features/AddressApiExpectTest.java          | 149 ---------
 .../features/AddressApiMockTest.java            |  87 +++++
 .../features/BackendServiceApiExpectTest.java   | 146 ---------
 .../features/BackendServiceApiMockTest.java     | 136 ++++++++
 .../features/DiskApiExpectTest.java             | 217 -------------
 .../features/DiskApiMockTest.java               | 128 ++++++++
 .../features/DiskTypeApiExpectTest.java         | 101 ------
 .../features/DiskTypeApiMockTest.java           |  63 ++++
 .../features/FirewallApiExpectTest.java         |  90 ------
 .../features/FirewallApiMockTest.java           |  82 +++++
 .../features/ForwardingRuleApiExpectTest.java   | 177 ----------
 .../features/ForwardingRuleApiMockTest.java     | 104 ++++++
 .../GlobalForwardingRuleApiExpectTest.java      | 177 ----------
 .../GlobalForwardingRuleApiMockTest.java        | 106 ++++++
 .../features/HttpHealthCheckApiExpectTest.java  | 141 +-------
 .../features/HttpHealthCheckApiMockTest.java    | 109 +++++++
 .../features/ImageApiMockTest.java              |  12 +-
 .../features/InstanceApiExpectTest.java         | 321 -------------------
 .../features/InstanceApiMockTest.java           | 162 +++++++++-
 .../features/MachineTypeApiExpectTest.java      | 109 -------
 .../features/MachineTypeApiMockTest.java        |  63 ++++
 .../parse/ParseAddressListTest.java             |  11 +-
 .../parse/ParseAddressTest.java                 |  11 +-
 .../parse/ParseBackendServiceGetHealthTest.java |   8 +-
 .../parse/ParseBackendServiceListTest.java      |  11 +-
 .../parse/ParseBackendServiceTest.java          |  12 +-
 .../parse/ParseDiskListTest.java                |   7 +-
 .../parse/ParseDiskTest.java                    |  11 +-
 .../parse/ParseFirewallListTest.java            |  11 +-
 .../parse/ParseFirewallTest.java                |   9 +-
 .../parse/ParseForwardingRuleListTest.java      |   7 +-
 .../parse/ParseForwardingRuleTest.java          |  10 +-
 .../parse/ParseGlobalOperationTest.java         |   9 +-
 .../parse/ParseHttpHealthCheckListTest.java     |  11 +-
 .../parse/ParseHttpHealthCheckTest.java         |   7 +-
 .../parse/ParseInstanceListTest.java            |   7 +-
 .../parse/ParseInstanceTest.java                |  17 +-
 .../parse/ParseMachineTypeListTest.java         |  11 +-
 .../parse/ParseMachineTypeTest.java             |   7 +-
 .../parse/ParseRegionOperationTest.java         |  11 +-
 .../src/test/resources/address_get.json         |   1 -
 .../resources/machinetype_list_central1b.json   |  41 ---
 .../machinetype_list_central1b_empty.json       |   6 -
 43 files changed, 1175 insertions(+), 1741 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiExpectTest.java
deleted file mode 100644
index 5feeef1..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiExpectTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseAddressListTest;
-import org.jclouds.googlecomputeengine.parse.ParseAddressTest;
-import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "AddressApiExpectTest")
-public class AddressApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public void testGetAddressResponseIs2xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/regions/us-central1/addresses/test-ip1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/address_get.json")).build();
-
-      AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).addressesInRegion("us-central1");
-
-      assertEquals(api.get("test-ip1"), new ParseAddressTest().expected());
-   }
-
-   public void testGetAddressResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/regions/us-central1/addresses/test-ip1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).addressesInRegion("us-central1");
-
-      assertNull(api.get("test-ip1"));
-   }
-
-   public void testInsertAddressResponseIs2xx() {
-      HttpRequest insert = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/regions/us-central1/addresses")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/address_insert.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse insertAddressResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/region_operation.json")).build();
-
-      AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, insert,
-              insertAddressResponse).addressesInRegion("us-central1");
-
-      assertEquals(api.create("test-ip1"), new ParseRegionOperationTest().expected());
-   }
-
-   public void testDeleteAddressResponseIs2xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/regions/us-central1/addresses/test-ip1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/region_operation.json")).build();
-
-      AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).addressesInRegion("us-central1");
-
-      assertEquals(api.delete("test-ip1"), new ParseRegionOperationTest().expected());
-   }
-
-   public void testDeleteAddressResponseIs4xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/regions/us-central1/addresses/test-ip1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
-      AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).addressesInRegion("us-central1");
-
-      assertNull(api.delete("test-ip1"));
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(BASE_URL + "/party/regions/us-central1/addresses")
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void list() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/address_list.json")).build();
-
-      AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).addressesInRegion("us-central1");
-
-      assertEquals(api.list().next(), new ParseAddressListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      AddressApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).addressesInRegion("us-central1");
-
-      assertFalse(api.list().hasNext());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiMockTest.java
new file mode 100644
index 0000000..3903048
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiMockTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseAddressListTest;
+import org.jclouds.googlecomputeengine.parse.ParseAddressTest;
+import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "AddressApiExpectTest", singleThreaded = true)
+public class AddressApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception{
+      server.enqueue(jsonResponse("/address_get.json"));
+
+      assertEquals(addressApi().get("test-ip1"), new ParseAddressTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/regions/us-central1/addresses/test-ip1");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(addressApi().get("test-ip1"));
+      assertSent(server, "GET", "/projects/party/regions/us-central1/addresses/test-ip1");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      assertEquals(addressApi().create("test-ip1"),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/regions/us-central1/addresses",
+            stringFromResource("/address_insert.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      assertEquals(addressApi().delete("test-ip1"),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/regions/us-central1/addresses/test-ip1");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(addressApi().delete("test-ip1"));
+      assertSent(server, "DELETE", "/projects/party/regions/us-central1/addresses/test-ip1");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/address_list.json"));
+
+      assertEquals(addressApi().list().next(), new ParseAddressListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/regions/us-central1/addresses");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(addressApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/regions/us-central1/addresses");
+   }
+
+   AddressApi addressApi(){
+      return api().addressesInRegion("us-central1");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiExpectTest.java
index 2e03495..79fd5f7 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiExpectTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiExpectTest.java
@@ -18,8 +18,6 @@ package org.jclouds.googlecomputeengine.features;
 
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
 
 import java.io.IOException;
 import java.net.URI;
@@ -28,9 +26,6 @@ import java.util.List;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
 import org.jclouds.googlecomputeengine.options.BackendServiceOptions;
-import org.jclouds.googlecomputeengine.parse.ParseBackendServiceGetHealthTest;
-import org.jclouds.googlecomputeengine.parse.ParseBackendServiceListTest;
-import org.jclouds.googlecomputeengine.parse.ParseBackendServiceTest;
 import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
 import org.jclouds.http.HttpRequest;
 import org.jclouds.http.HttpResponse;
@@ -55,75 +50,6 @@ public class BackendServiceApiExpectTest extends BaseGoogleComputeEngineExpectTe
                                    .build();
    }
 
-   public void testGetBackendServiceResponseIs2xx() throws Exception {
-      HttpRequest request = getBasicRequest().method("GET")
-                                             .endpoint(ENDPOINT_BASE + "/jclouds-test")
-                                             .build();
-      HttpResponse response = createResponse("/backend_service_get.json");
-      BackendServiceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, request, response)
-              .backendServices();
-
-      assertEquals(api.get("jclouds-test"), new ParseBackendServiceTest().expected());
-   }
-
-   public void testGetBackendServiceResponseIs4xx() throws Exception {
-      HttpRequest request = getBasicRequest().method("GET")
-                                             .endpoint(ENDPOINT_BASE + "/jclouds-test")
-                                             .build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      BackendServiceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, request, response)
-              .backendServices();
-
-      assertNull(api.get("jclouds-test"));
-   }
-
-   public void testInsertBackendServiceResponseIs2xx() throws IOException {
-      HttpRequest request = getBasicRequest().method("POST")
-               .endpoint(ENDPOINT_BASE)
-               .payload(payloadFromResourceWithContentType("/backend_service_insert.json",
-                                                           APPLICATION_JSON))
-               .build();
-      HttpResponse response = createResponse("/operation.json");
-
-      BackendServiceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).backendServices();
-
-      List<URI> healthChecks = ImmutableList.of(URI.create("https://www.googleapis.com/compute/v1/projects/"
-                           + "myproject/global/httpHealthChecks/jclouds-test"));
-      assertEquals(api.create( new BackendServiceOptions().name("jclouds-test")
-                                                                         .protocol("HTTP")
-                                                                         .port(80)
-                                                                         .timeoutSec(30)
-                                                                         .healthChecks(healthChecks)),
-                   new ParseOperationTest().expected());
-
-   }
-
-   public void testUpdateBackendServiceResponseIs2xx() throws IOException {
-      HttpRequest request = getBasicRequest().method("PUT")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .payload(payloadFromResourceWithContentType("/backend_service_insert.json",
-                                                           APPLICATION_JSON))
-               .build();
-      HttpResponse response = createResponse("/operation.json");
-
-      BackendServiceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).backendServices();
-
-      List<URI> healthChecks = ImmutableList.of(URI.create("https://www.googleapis.com/compute/v1/projects/"
-                          + "myproject/global/httpHealthChecks/jclouds-test"));
-      assertEquals(api.update("jclouds-test", new BackendServiceOptions().name("jclouds-test")
-                                                                         .protocol("HTTP")
-                                                                         .port(80)
-                                                                         .timeoutSec(30)
-                                                                         .healthChecks(healthChecks)),
-                   new ParseOperationTest().expected());
-   }
-
    public void testPatchBackendServiceResponseIs2xx() throws IOException {
       HttpRequest request = getBasicRequest().method("PATCH")
                .endpoint(ENDPOINT_BASE + "/jclouds-test")
@@ -144,76 +70,4 @@ public class BackendServiceApiExpectTest extends BaseGoogleComputeEngineExpectTe
                                                                          .healthChecks(healthChecks)),
                    new ParseOperationTest().expected());
    }
-
-   public void testDeleteBackendServiceResponseIs2xx() {
-      HttpRequest request = getBasicRequest().method("DELETE")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .build();
-      HttpResponse response = createResponse("/operation.json");
-
-      BackendServiceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).backendServices();
-
-      assertEquals(api.delete("jclouds-test"), new ParseOperationTest().expected());
-   }
-
-   public void testDeleteBackendServiceResponseIs4xx() {
-      HttpRequest request = getBasicRequest().method("DELETE")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      BackendServiceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).backendServices();
-
-      assertNull(api.delete("jclouds-test"));
-   }
-
-   public void testListBackendServiceResponseIs2xx() {
-      HttpRequest request = getBasicRequest().method("GET")
-               .endpoint(ENDPOINT_BASE)
-               .build();
-      HttpResponse response = createResponse("/backend_service_list.json");
-
-      BackendServiceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, request, response).backendServices();
-
-      assertEquals(api.list().next(), new ParseBackendServiceListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpRequest list = HttpRequest
-            .builder()
-            .method("GET")
-            .endpoint(BASE_URL + "/party/global/backendServices")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      BackendServiceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, list, response).backendServices();
-
-      assertFalse(api.list().hasNext());
-   }
-
-   public void testGetHealthResponseIs2xx() throws IOException {
-      HttpRequest request = getBasicRequest().method("POST")
-                                             .endpoint(ENDPOINT_BASE
-                                                       + "/jclouds-test/getHealth")
-                                             .payload(payloadFromResource("/backend_service_get_health_request.json"))
-                                             .build();
-      HttpResponse response = createResponse("/backend_service_get_health.json");
-
-      BackendServiceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).backendServices();
-
-      URI group = URI.create("https://www.googleapis.com/resourceviews/v1beta1/"
-                             + "projects/myproject/zones/us-central1-a/"
-                             + "resourceViews/jclouds-test");
-      assertEquals(api.getHealth("jclouds-test", group), new ParseBackendServiceGetHealthTest().expected());
-
-   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
new file mode 100644
index 0000000..0434401
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
@@ -0,0 +1,136 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import java.net.URI;
+import java.util.List;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.BackendServiceOptions;
+import org.jclouds.googlecomputeengine.parse.ParseBackendServiceGetHealthTest;
+import org.jclouds.googlecomputeengine.parse.ParseBackendServiceListTest;
+import org.jclouds.googlecomputeengine.parse.ParseBackendServiceTest;
+import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+@Test(groups = "unit", testName = "BackendServiceApiMockTest", singleThreaded = true)
+public class BackendServiceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/backend_service_get.json"));
+
+      assertEquals(backendServiceApi().get("jclouds-test"),
+            new ParseBackendServiceTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/backendServices/jclouds-test");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(backendServiceApi().get("jclouds-test"));
+      assertSent(server, "GET", "/projects/party/global/backendServices/jclouds-test");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      List<URI> healthChecks = ImmutableList.of(URI.create(url("/projects/"
+            + "myproject/global/httpHealthChecks/jclouds-test")));
+
+      assertEquals(backendServiceApi().create( new BackendServiceOptions().name("jclouds-test")
+            .protocol("HTTP")
+            .port(80)
+            .timeoutSec(30)
+            .healthChecks(healthChecks)),
+            new ParseOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/global/backendServices",
+            stringFromResource("/backend_service_insert.json"));
+   }
+
+   public void update() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      List<URI> healthChecks = ImmutableList.of(URI.create(url("/projects/"
+            + "myproject/global/httpHealthChecks/jclouds-test")));
+
+      assertEquals(backendServiceApi().update("jclouds-test",
+            new BackendServiceOptions().name("jclouds-test")
+               .protocol("HTTP")
+               .port(80)
+               .timeoutSec(30)
+               .healthChecks(healthChecks)),
+            new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "PUT", "/projects/party/global/backendServices/jclouds-test",
+            stringFromResource("/backend_service_insert.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      assertEquals(backendServiceApi().delete("jclouds-test"),
+            new ParseOperationTest().expected(url("/projects")));
+
+      assertSent(server, "DELETE", "/projects/party/global/backendServices/jclouds-test");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(backendServiceApi().delete("jclouds-test"));
+
+      assertSent(server, "DELETE", "/projects/party/global/backendServices/jclouds-test");
+   }
+
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/backend_service_list.json"));
+
+      assertEquals(backendServiceApi().list().next(), new ParseBackendServiceListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/backendServices");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(backendServiceApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/global/backendServices");
+   }
+
+   public void getHealth() throws Exception {
+      server.enqueue(jsonResponse("/backend_service_get_health.json"));
+
+      URI group = URI.create("https://www.googleapis.com/resourceviews/v1beta1/"
+            + "projects/myproject/zones/us-central1-a/"
+            + "resourceViews/jclouds-test");
+      assertEquals(backendServiceApi().getHealth("jclouds-test", group),
+            new ParseBackendServiceGetHealthTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/global/backendServices/jclouds-test/getHealth",
+            stringFromResource("/backend_service_get_health_request.json"));
+   }
+
+   public BackendServiceApi backendServiceApi(){
+      return api().backendServices();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
deleted file mode 100644
index e3807bc..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.net.URI;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
-import org.jclouds.googlecomputeengine.parse.ParseDiskListTest;
-import org.jclouds.googlecomputeengine.parse.ParseDiskTest;
-import org.jclouds.googlecomputeengine.parse.ParseZoneOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "DiskApiExpectTest")
-public class DiskApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-   public static final String IMAGE_URL = BASE_URL + "/party/zones/us-central1-a/images/foo";
-   public static final String SSD_URL = BASE_URL + "/party/zones/us-central1-a/diskTypes/pd-ssd";
-
-   public void testGetDiskResponseIs2xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/disk_get.json")).build();
-
-      DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).disksInZone("us-central1-a");
-
-      assertEquals(api.get("testimage1"), new ParseDiskTest().expected());
-   }
-
-   public void testGetDiskResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).disksInZone("us-central1-a");
-
-      assertNull(api.get("testimage1"));
-   }
-
-   public void testInsertDiskResponseIs2xx() {
-      HttpRequest insert = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/disks")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/disk_insert.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse insertDiskResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_operation.json")).build();
-
-      DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, insert,
-              insertDiskResponse).disksInZone("us-central1-a");
-
-      assertEquals(api.create("testimage1", 1), new ParseZoneOperationTest().expected());
-   }
-
-   public void testInsertDiskFromImageResponseIs2xx() {
-      HttpRequest insert = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/disks")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/disk_insert_sourceImage.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse insertDiskResponse = HttpResponse.builder().statusCode(200)
-                                                    .payload(payloadFromResource("/zone_operation.json")).build();
-
-      DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-                                          TOKEN_RESPONSE, insert,
-                                          insertDiskResponse).disksInZone("us-central1-a");
-
-      DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sourceImage(URI.create(IMAGE_URL));
-      assertEquals(api.create("testimage1", 1, diskCreationOptions), new ParseZoneOperationTest().expected());
-   }
-
-   public void testInsertDiskSSDResponseIs2xx(){
-      HttpRequest insert = HttpRequest
-            .builder()
-            .method("POST")
-            .endpoint(BASE_URL + "/party/zones/us-central1-a/disks")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType("/disk_insert_ssd.json", MediaType.APPLICATION_JSON))
-            .build();
-
-    HttpResponse insertDiskResponse = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/zone_operation.json")).build();
-
-    DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-                                       TOKEN_RESPONSE, insert,
-                                       insertDiskResponse).disksInZone("us-central1-a");
-
-    DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(URI.create(SSD_URL));
-    assertEquals(api.create("testimage1", 1, diskCreationOptions), new ParseZoneOperationTest().expected());
-   }
-
-   public void testCreateSnapshotResponseIs2xx() {
-      HttpRequest createSnapshotRequest = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1/createSnapshot")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/disk_create_snapshot.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse createSnapshotResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_operation.json")).build();
-
-      DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, createSnapshotRequest,
-              createSnapshotResponse).disksInZone("us-central1-a");
-
-      assertEquals(api.createSnapshot("testimage1", "test-snap"), new ParseZoneOperationTest().expected());
-   }
-
-   public void testDeleteDiskResponseIs2xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_operation.json")).build();
-
-      DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).disksInZone("us-central1-a");
-
-      assertEquals(api.delete("testimage1"),
-              new ParseZoneOperationTest().expected());
-   }
-
-   public void testDeleteDiskResponseIs4xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
-      DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).disksInZone("us-central1-a");
-
-      assertNull(api.delete("testimage1"));
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(BASE_URL + "/party/zones/us-central1-a/disks")
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void list() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/disk_list.json")).build();
-
-      DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).disksInZone("us-central1-a");
-
-      assertEquals(api.list().next(), new ParseDiskListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-      
-      DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).disksInZone("us-central1-a");
-
-      assertFalse(api.list().hasNext());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
new file mode 100644
index 0000000..7633a03
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import java.net.URI;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
+import org.jclouds.googlecomputeengine.parse.ParseDiskListTest;
+import org.jclouds.googlecomputeengine.parse.ParseDiskTest;
+import org.jclouds.googlecomputeengine.parse.ParseZoneOperationTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "DiskApiMockTest", singleThreaded = true)
+public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public static final String IMAGE_URL = "/projects/party/zones/us-central1-a/images/foo";
+   public static final String SSD_URL =  "/projects/party/zones/us-central1-a/diskTypes/pd-ssd";
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/disk_get.json"));
+
+      assertEquals(diskApi().get("testimage1"), new ParseDiskTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/disks/testimage1");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(diskApi().get("testimage1"));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/disks/testimage1");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(diskApi().create("testimage1", 1),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
+            stringFromResource("/disk_insert.json"));
+   }
+
+   public void insertFromImage() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      DiskCreationOptions diskCreationOptions = new DiskCreationOptions()
+         .sourceImage(URI.create(url(IMAGE_URL)));
+      assertEquals(diskApi().create("testimage1", 1, diskCreationOptions),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
+            stringFromResource("/disk_insert_sourceImage.json"));
+   }
+
+   public void insertFromSSD() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(URI.create(url(SSD_URL)));
+      assertEquals(diskApi().create("testimage1", 1, diskCreationOptions),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
+            stringFromResource("/disk_insert_ssd.json"));
+   }
+
+   public void creatSnapshot() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(diskApi().createSnapshot("testimage1", "test-snap"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks/testimage1/createSnapshot",
+            stringFromResource("/disk_create_snapshot.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(diskApi().delete("testimage1"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/disks/testimage1");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(diskApi().delete("testimage1"));
+      assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/disks/testimage1");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/disk_list.json"));
+
+      assertEquals(diskApi().list().next(), new ParseDiskListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/disks");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(diskApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/disks");
+   }
+
+   public DiskApi diskApi(){
+      return api().disksInZone("us-central1-a");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
deleted file mode 100644
index 37ece62..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.maxResults;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseDiskTypeListTest;
-import org.jclouds.googlecomputeengine.parse.ParseDiskTypeTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "DiskTypeApiExpectTest")
-public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public static final HttpRequest LIST_DISK_TYPES_REQUEST = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(BASE_URL + "/party/zones/us-central1-a/diskTypes")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse LIST_DISK_TYPES_RESPONSE = HttpResponse.builder()
-           .statusCode(200)
-           .payload(staticPayloadFromResource("/disktype_list.json"))
-           .build();
-
-   public void testGetDiskTypeResponseIs2xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/diskTypes/pd-standard")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/disktype.json")).build();
-
-      DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).diskTypesInZone("us-central1-a");
-
-      assertEquals(diskTypeApi.get("pd-standard"),
-              new ParseDiskTypeTest().expected());
-   }
-
-   public void testGetDiskTypeResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/zones/us-central1-a/diskTypes/pd-standard")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).diskTypesInZone("us-central1-a");
-
-      assertNull(diskTypeApi.get("pd-standard"));
-   }
-
-   public void list() throws Exception {
-
-      DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, LIST_DISK_TYPES_REQUEST, LIST_DISK_TYPES_RESPONSE).diskTypesInZone("us-central1-a");
-
-      assertEquals(diskTypeApi.list().next(), new ParseDiskTypeListTest().expected());
-   }
-
-   public void listWithOptionsEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-      
-      HttpRequest listRequestWithOptions = LIST_DISK_TYPES_REQUEST.toBuilder()
-            .endpoint(LIST_DISK_TYPES_REQUEST.getEndpoint() + "?maxResults=1").build();
-
-      DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, listRequestWithOptions, response).diskTypesInZone("us-central1-a");
-
-      assertFalse(diskTypeApi.list(maxResults(1)).hasNext());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiMockTest.java
new file mode 100644
index 0000000..07b8cf2
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiMockTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseDiskTypeListTest;
+import org.jclouds.googlecomputeengine.parse.ParseDiskTypeTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "DiskTypeApiMockTest", singleThreaded = true)
+public class DiskTypeApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/disktype.json"));
+
+      assertEquals(diskTypeApi().get("pd-standard"),
+            new ParseDiskTypeTest().expected());
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/diskTypes/pd-standard");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(diskTypeApi().get("pd-standard"));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/diskTypes/pd-standard");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/disktype_list.json"));
+
+      assertEquals(diskTypeApi().list().next(), new ParseDiskTypeListTest().expected());
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/diskTypes");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(diskTypeApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/diskTypes");
+   }
+
+   public DiskTypeApi diskTypeApi() {
+      return api().diskTypesInZone("us-central1-a");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
index 96dd7b2..cc92e23 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
@@ -22,8 +22,6 @@ import static java.lang.String.format;
 import static org.jclouds.io.Payloads.newStringPayload;
 import static org.jclouds.util.Strings2.toStringAndClose;
 import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
 
 import java.io.IOException;
 import java.net.URI;
@@ -35,8 +33,6 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.domain.Firewall;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
 import org.jclouds.googlecomputeengine.options.FirewallOptions;
-import org.jclouds.googlecomputeengine.parse.ParseFirewallListTest;
-import org.jclouds.googlecomputeengine.parse.ParseFirewallTest;
 import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
 import org.jclouds.http.HttpRequest;
 import org.jclouds.http.HttpResponse;
@@ -59,14 +55,6 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineExpectTest<Goo
    public static HttpResponse GET_FIREWALL_RESPONSE = HttpResponse.builder().statusCode(200)
            .payload(staticPayloadFromResource("/firewall_get.json")).build();
 
-   public void testGetFirewallResponseIs2xx() throws Exception {
-
-      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_FIREWALL_REQUEST, GET_FIREWALL_RESPONSE).firewalls();
-
-      assertEquals(api.get("jclouds-test"), new ParseFirewallTest().expected());
-   }
-
    public static Payload firewallPayloadFirewallOfName(String firewallName,
                                                        String networkName,
                                                        List<String> sourceRanges,
@@ -95,23 +83,6 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineExpectTest<Goo
       return payload;
    }
 
-
-   public void testGetFirewallResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/global/firewalls/jclouds-test")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).firewalls();
-
-      assertNull(api.get("jclouds-test"));
-   }
-
    public void testInsertFirewallResponseIs2xx() throws IOException {
 
       HttpRequest request = HttpRequest
@@ -209,65 +180,4 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineExpectTest<Goo
                       .addSourceRange("10.0.1.0/32")
                       .addTargetTag("tag2")), new ParseOperationTest().expected());
    }
-
-   public void testDeleteFirewallResponseIs2xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/global/firewalls/default-allow-internal")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/operation.json")).build();
-
-      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).firewalls();
-
-      assertEquals(api.delete("default-allow-internal"),
-              new ParseOperationTest().expected());
-   }
-
-   public void testDeleteFirewallResponseIs4xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/global/firewalls/default-allow-internal")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
-      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).firewalls();
-
-      assertNull(api.delete("default-allow-internal"));
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(BASE_URL + "/party/global/firewalls")
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void testListFirewallsResponseIs2xx() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/firewall_list.json")).build();
-
-      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).firewalls();
-
-      assertEquals(api.list().next(), new ParseFirewallListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).firewalls();
-
-      assertFalse(api.list().hasNext());
-   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
new file mode 100644
index 0000000..bf7ce5d
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
@@ -0,0 +1,82 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseFirewallListTest;
+import org.jclouds.googlecomputeengine.parse.ParseFirewallTest;
+import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "FirewallApiMockTest", singleThreaded = true)
+public class FirewallApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/firewall_get.json"));
+
+      assertEquals(firewallApi().get("jclouds-test"),
+            new ParseFirewallTest().expected(url("/projects")));
+
+      assertSent(server, "GET", "/projects/party/global/firewalls/jclouds-test");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(firewallApi().get("jclouds-test"));
+
+      assertSent(server, "GET", "/projects/party/global/firewalls/jclouds-test");
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      assertEquals(firewallApi().delete("default-allow-internal"),
+            new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/global/firewalls/default-allow-internal");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(firewallApi().delete("default-allow-internal"));
+      assertSent(server, "DELETE", "/projects/party/global/firewalls/default-allow-internal");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/firewall_list.json"));
+
+      assertEquals(firewallApi().list().next(), new ParseFirewallListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/firewalls");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(firewallApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/global/firewalls");
+   }
+
+   FirewallApi firewallApi(){
+      return api().firewalls();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
deleted file mode 100644
index d3c5402..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.net.URI;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
-import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleListTest;
-import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleTest;
-import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ForwardingRuleApiExpectTest")
-public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public void testGetForwardingRuleResponseIs2xx() throws Exception {
-      HttpRequest get = HttpRequest
-            .builder()
-            .method("GET")
-            .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules/test-forwarding-rule")
-                  .addHeader("Accept", "application/json")
-                  .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/forwardingrule_get.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, get, response).forwardingRulesInRegion("us-central1");
-
-      assertEquals(api.get("test-forwarding-rule"), new ParseForwardingRuleTest().expected());
-   }
-
-   public void testGetForwardingRuleResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-            .builder()
-            .method("GET")
-            .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules/test-forwarding-rule")
-                  .addHeader("Accept", "application/json")
-                  .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, get, response).forwardingRulesInRegion("us-central1");
-
-      assertNull(api.get("test-forwarding-rule"));
-   }
-
-   public void testInsertForwardingRuleResponseIs2xx() {
-      HttpRequest insert = HttpRequest
-            .builder()
-            .method("POST")
-            .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType("/forwardingrule_insert.json", MediaType.APPLICATION_JSON))
-            .build();
-
-      HttpResponse insertForwardingRuleResponse = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, insert,
-            insertForwardingRuleResponse).forwardingRulesInRegion("us-central1");
-
-      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
-      .target(URI.create(BASE_URL + "/party/regions/europe-west1/targetPools/test-target-pool"));
-      assertEquals(api.create("test-forwarding-rule", forwardingRuleCreationOptions),
-            new ParseRegionOperationTest().expected());
-   }
-
-   public void testDeleteForwardingRuleResponseIs2xx() {
-      HttpRequest delete = HttpRequest
-            .builder()
-            .method("DELETE")
-            .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules/test-forwarding-rule")
-                  .addHeader("Accept", "application/json")
-                  .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, delete, deleteResponse).forwardingRulesInRegion("us-central1");
-
-      assertEquals(api.delete("test-forwarding-rule"), new ParseRegionOperationTest().expected());
-   }
-
-   public void testDeleteForwardingRuleResponseIs4xx() {
-      HttpRequest delete = HttpRequest
-            .builder()
-            .method("DELETE")
-            .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules/test-targetPool")
-                  .addHeader("Accept", "application/json")
-                  .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, delete, deleteResponse).forwardingRulesInRegion("us-central1");
-
-      assertNull(api.delete("test-targetPool"));
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules")
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void list() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/forwardingrule_list.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, list, response).forwardingRulesInRegion("us-central1");
-
-      assertEquals(api.list().next(), new ParseForwardingRuleListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, list, response).forwardingRulesInRegion("us-central1");
-
-      assertFalse(api.list().hasNext());
-   }
-
-   public void testSetTargetForwardingRuleResponseIs2xx(){
-      String ruleName = "testForwardingRule";
-      HttpRequest setTarget = HttpRequest
-            .builder()
-            .method("POST")
-            .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules/" + ruleName + "/setTarget")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType("/forwardingrule_set_target.json", MediaType.APPLICATION_JSON))
-            .build();
-
-      HttpResponse setTargetResponse = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, setTarget, setTargetResponse).forwardingRulesInRegion("us-central1");
-
-      URI newTarget = URI.create(BASE_URL + "/party/regions/europe-west1/targetPools/test-target-pool");
-      assertEquals(api.setTarget(ruleName, newTarget), new ParseRegionOperationTest().expected());
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
new file mode 100644
index 0000000..f66a141
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import java.net.URI;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
+import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleListTest;
+import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleTest;
+import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "ForwardingRuleApiMockTest", singleThreaded = true)
+public class ForwardingRuleApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/forwardingrule_get.json"));
+
+      assertEquals(forwardingRuleApi().get("test-forwarding-rule"),
+            new ParseForwardingRuleTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/regions/us-central1/forwardingRules/test-forwarding-rule");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(forwardingRuleApi().get("test-forwarding-rule"));
+      assertSent(server, "GET", "/projects/party/regions/us-central1/forwardingRules/test-forwarding-rule");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
+      .target(URI.create(url("/projects/party/regions/europe-west1/targetPools/test-target-pool")));
+      assertEquals(forwardingRuleApi().create("test-forwarding-rule", forwardingRuleCreationOptions),
+            new ParseRegionOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/regions/us-central1/forwardingRules",
+            stringFromResource("/forwardingrule_insert.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      assertEquals(forwardingRuleApi().delete("test-forwarding-rule"),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/regions/us-central1/forwardingRules/test-forwarding-rule");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(forwardingRuleApi().delete("test-forwarding-rule"));
+      assertSent(server, "DELETE", "/projects/party/regions/us-central1/forwardingRules/test-forwarding-rule");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/forwardingrule_list.json"));
+
+      assertEquals(forwardingRuleApi().list().next(), new ParseForwardingRuleListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/regions/us-central1/forwardingRules");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(forwardingRuleApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/regions/us-central1/forwardingRules");
+   }
+
+   public void setTarget() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      URI newTarget = URI.create(url("/projects/party/regions/europe-west1/targetPools/test-target-pool"));
+      assertEquals(forwardingRuleApi().setTarget("testForwardingRule", newTarget), new ParseRegionOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/regions/us-central1/forwardingRules/testForwardingRule/setTarget",
+            stringFromResource("/forwardingrule_set_target.json"));
+   }
+
+   ForwardingRuleApi forwardingRuleApi() {
+      return api().forwardingRulesInRegion("us-central1");
+   }
+}


[35/50] [abbrv] jclouds git commit: Fix the HealthCheck live tests

Posted by na...@apache.org.
Fix the HealthCheck live tests


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

Branch: refs/heads/master
Commit: 9d3b2d70e1c74cdbbc3e11af683fc2dd3fdce6d3
Parents: 3c5f3ae
Author: Ignasi Barrera <na...@apache.org>
Authored: Wed Apr 15 23:40:32 2015 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Apr 15 23:40:32 2015 +0200

----------------------------------------------------------------------
 .../googlecomputeengine/features/HttpHealthCheckApiLiveTest.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/9d3b2d70/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
index 49e9cc5..f3dcad9 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
@@ -46,8 +46,8 @@ public class HttpHealthCheckApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
                      .port(56)
                      .checkIntervalSec(40)
                      .timeoutSec(40)
-                     .healthyThreshold(30)
-                     .unhealthyThreshold(15)
+                     .healthyThreshold(5)
+                     .unhealthyThreshold(3)
                      .description("A First Health Check!")
                      .buildWithDefaults();
       assertOperationDoneSuccessfully(api().insert(HTTP_HEALTH_CHECK_NAME, options));


[13/50] [abbrv] jclouds git commit: Added targetPool:AggregatedList, getHealth. Updated HttpHealthCheck

Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHealthStatusTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHealthStatusTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHealthStatusTest.java
new file mode 100644
index 0000000..b425db9
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHealthStatusTest.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.googlecomputeengine.parse;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+
+import java.net.URI;
+import javax.ws.rs.Consumes;
+
+import org.jclouds.googlecomputeengine.domain.HealthStatus;
+import org.jclouds.googlecomputeengine.domain.HealthStatus.HealthStatusInternal;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+@Test(groups = "unit")
+public class ParseHealthStatusTest extends BaseGoogleComputeEngineParseTest<HealthStatus> {
+
+   @Override
+   public String resource() {
+      return "/health_status_get_health.json";
+   }
+
+   @Override
+   @Consumes(APPLICATION_JSON)
+   public HealthStatus expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public HealthStatus expected(String baseUrl) {
+      URI uri = URI.create(baseUrl + "/party/zones/us-central1-a/instances/"
+                           + "jclouds-test");
+      return HealthStatus.create(
+            ImmutableList.of(HealthStatusInternal.create(
+                  null, // ipAddress
+                  80, // port
+                  uri, // instance
+                  "HEALTHY" //healthState
+                  )) //healthStatuses
+            );
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
index c4071e2..b53f805 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java
@@ -38,8 +38,13 @@ public class ParseTargetPoolListTest extends BaseGoogleComputeEngineParseTest<Li
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<TargetPool> expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<TargetPool> expected(String baseUrl) {
       return ForwardingListPage.create( //
-            ImmutableList.of(new ParseTargetPoolTest().expected()), // items
+            ImmutableList.of(new ParseTargetPoolTest().expected(baseUrl)), // items
             null // nextPageToken
       );
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
index 81f357c..efa2ee9 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
@@ -36,12 +36,17 @@ public class ParseTargetPoolTest extends BaseGoogleComputeEngineParseTest<Target
 
    @Override @Consumes(MediaType.APPLICATION_JSON)
    public TargetPool expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(MediaType.APPLICATION_JSON)
+   public TargetPool expected(String baseUrl) {
       return TargetPool.create( //
             "5199309593612841404", // id
-            URI.create(BASE_URL + "/party/regions/us-central1/targetPools/test-targetpool"), // selfLink
+            URI.create(baseUrl + "/party/regions/us-central1/targetPools/test-targetpool"), // selfLink
             "test-targetpool", // name
             null, // description
-            URI.create(BASE_URL + "/party/regions/us-central1"), // region
+            URI.create(baseUrl + "/party/regions/us-central1"), // region
             null, // healthChecks
             null, // instances
             SessionAffinityValue.NONE, // sessionAffinity

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/resources/aggregated_target_pool_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/aggregated_target_pool_list.json b/providers/google-compute-engine/src/test/resources/aggregated_target_pool_list.json
new file mode 100644
index 0000000..60fc7c6
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/aggregated_target_pool_list.json
@@ -0,0 +1,46 @@
+{
+ "kind": "compute#targetPoolAggregatedList",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/party/aggregated/targetPools",
+ "id": "projects/party/aggregated/targetPools",
+ "items": {
+  "regions/asia-east1": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'regions/asia-east1' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "regions/asia-east1"
+     }
+    ]
+   }
+  },
+  "regions/europe-west1": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'regions/europe-west1' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "regions/europe-west1"
+     }
+    ]
+   }
+  },
+  "regions/us-central1": {
+   "targetPools": [
+    {
+
+     "kind": "compute#targetPool",
+     "id": "17592955481805765508",
+     "creationTimestamp": "2014-12-01T11:51:15.611-08:00",
+     "name": "test",
+     "description": "a Pool!",
+     "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
+     "sessionAffinity": "NONE",
+     "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/targetPools/test"
+    }
+   ]
+  }
+ }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/resources/aggregated_target_pool_list_empty.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/aggregated_target_pool_list_empty.json b/providers/google-compute-engine/src/test/resources/aggregated_target_pool_list_empty.json
new file mode 100644
index 0000000..9c10a7b
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/aggregated_target_pool_list_empty.json
@@ -0,0 +1,43 @@
+{
+ "kind": "compute#targetPoolAggregatedList",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/party/aggregated/targetPools",
+ "id": "projects/party/aggregated/targetPools",
+ "items": {
+  "regions/asia-east1": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'regions/asia-east1' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "regions/asia-east1"
+     }
+    ]
+   }
+  },
+  "regions/europe-west1": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'regions/europe-west1' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "regions/europe-west1"
+     }
+    ]
+   }
+  },
+  "regions/us-central1": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'regions/us-central1' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "regions/us-central1"
+     }
+    ]
+   }
+  }
+ }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/resources/backend_service_get_health.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/backend_service_get_health.json b/providers/google-compute-engine/src/test/resources/backend_service_get_health.json
deleted file mode 100644
index 7e01eed..0000000
--- a/providers/google-compute-engine/src/test/resources/backend_service_get_health.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-   "kind": "compute#backendServiceGroupHealth",
-   "healthStatus": [
-      {
-         "port": 80,         
-         "instance": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/instances/jclouds-test",
-         "healthState": "HEALTHY"
-      }
-   ]
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/resources/health_status_get_health.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/health_status_get_health.json b/providers/google-compute-engine/src/test/resources/health_status_get_health.json
new file mode 100644
index 0000000..62dcc0d
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/health_status_get_health.json
@@ -0,0 +1,10 @@
+{
+   "kind": "compute#backendServiceGroupHealth",
+   "healthStatus": [
+      {
+         "port": 80,         
+         "instance": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/jclouds-test",
+         "healthState": "HEALTHY"
+      }
+   ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/resources/httphealthcheck_insert.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/httphealthcheck_insert.json b/providers/google-compute-engine/src/test/resources/httphealthcheck_insert.json
index 0564f1d..6ad0077 100644
--- a/providers/google-compute-engine/src/test/resources/httphealthcheck_insert.json
+++ b/providers/google-compute-engine/src/test/resources/httphealthcheck_insert.json
@@ -1 +1 @@
-{"name":"http-health-check","timeoutSec":0,"unhealthyThreshold":0}
+{"name":"http-health-check","requestPath":"/","port":80,"checkIntervalSec":5,"timeoutSec":0,"unhealthyThreshold":0,"healthyThreshold":2}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/resources/httphealthcheck_patch.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/httphealthcheck_patch.json b/providers/google-compute-engine/src/test/resources/httphealthcheck_patch.json
new file mode 100644
index 0000000..65c089b
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/httphealthcheck_patch.json
@@ -0,0 +1 @@
+{"name":"http-health-check","timeoutSec":0,"unhealthyThreshold":0}
\ No newline at end of file


[18/50] [abbrv] jclouds git commit: MockTests now support PATCH semantics

Posted by na...@apache.org.
MockTests now support PATCH semantics


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

Branch: refs/heads/master
Commit: 4772587722d9d1cba14ae4acd720b88f275be96f
Parents: e4cc728
Author: Daniel Broudy <br...@google.com>
Authored: Mon Dec 15 14:59:50 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Dec 16 00:44:33 2014 +0100

----------------------------------------------------------------------
 providers/google-compute-engine/pom.xml         |  6 ++
 .../features/BackendServiceApiExpectTest.java   | 73 ------------------
 .../features/BackendServiceApiMockTest.java     | 18 ++++-
 .../features/FirewallApiExpectTest.java         | 64 ----------------
 .../features/FirewallApiMockTest.java           | 18 +++++
 .../features/HttpHealthCheckApiExpectTest.java  | 55 --------------
 .../features/HttpHealthCheckApiMockTest.java    | 12 +++
 .../features/UrlMapApiExpectTest.java           | 79 --------------------
 .../features/UrlMapApiMockTest.java             |  4 +-
 .../BaseGoogleComputeEngineApiMockTest.java     |  5 +-
 10 files changed, 57 insertions(+), 277 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/47725877/providers/google-compute-engine/pom.xml
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/pom.xml b/providers/google-compute-engine/pom.xml
index 4c01bbc..c5837ff 100644
--- a/providers/google-compute-engine/pom.xml
+++ b/providers/google-compute-engine/pom.xml
@@ -99,6 +99,12 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.jclouds.driver</groupId>
+            <artifactId>jclouds-okhttp</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>ch.qos.logback</groupId>
             <artifactId>logback-classic</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/jclouds/blob/47725877/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiExpectTest.java
deleted file mode 100644
index 79fd5f7..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiExpectTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.List;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.options.BackendServiceOptions;
-import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit")
-public class BackendServiceApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   private static final String ENDPOINT_BASE = "https://www.googleapis.com/"
-            + "compute/v1/projects/party/global/backendServices";
-
-   private org.jclouds.http.HttpRequest.Builder<? extends HttpRequest.Builder<?>> getBasicRequest() {
-      return HttpRequest.builder().addHeader("Accept", "application/json")
-                                  .addHeader("Authorization", "Bearer " + TOKEN);
-   }
-
-   private HttpResponse createResponse(String payloadFile) {
-      return HttpResponse.builder().statusCode(200)
-                                   .payload(payloadFromResource(payloadFile))
-                                   .build();
-   }
-
-   public void testPatchBackendServiceResponseIs2xx() throws IOException {
-      HttpRequest request = getBasicRequest().method("PATCH")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .payload(payloadFromResourceWithContentType("/backend_service_insert.json",
-                                                           APPLICATION_JSON))
-               .build();
-      HttpResponse response = createResponse("/operation.json");
-
-      BackendServiceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).backendServices();
-
-      List<URI> healthChecks = ImmutableList.of(URI.create("https://www.googleapis.com/compute/v1/projects/"
-                          + "myproject/global/httpHealthChecks/jclouds-test"));
-      assertEquals(api.patch("jclouds-test", new BackendServiceOptions().name("jclouds-test")
-                                                                         .protocol("HTTP")
-                                                                         .port(80)
-                                                                         .timeoutSec(30)
-                                                                         .healthChecks(healthChecks)),
-                   new ParseOperationTest().expected());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/47725877/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
index ba5bfe0..1cc8400 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
@@ -85,6 +85,23 @@ public class BackendServiceApiMockTest extends BaseGoogleComputeEngineApiMockTes
             stringFromResource("/backend_service_insert.json"));
    }
 
+   public void patch() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      List<URI> healthChecks = ImmutableList.of(URI.create(url("/projects/"
+            + "myproject/global/httpHealthChecks/jclouds-test")));
+
+      assertEquals(backendServiceApi().patch("jclouds-test",
+            new BackendServiceOptions().name("jclouds-test")
+               .protocol("HTTP")
+               .port(80)
+               .timeoutSec(30)
+               .healthChecks(healthChecks)),
+            new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "PATCH", "/projects/party/global/backendServices/jclouds-test",
+            stringFromResource("/backend_service_insert.json"));
+   }
+
    public void delete() throws Exception {
       server.enqueue(jsonResponse("/operation.json"));
 
@@ -102,7 +119,6 @@ public class BackendServiceApiMockTest extends BaseGoogleComputeEngineApiMockTes
       assertSent(server, "DELETE", "/projects/party/global/backendServices/jclouds-test");
    }
 
-
    public void list() throws Exception {
       server.enqueue(jsonResponse("/backend_service_list.json"));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/47725877/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
deleted file mode 100644
index b5ed9a1..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.options.FirewallOptions;
-import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "FirewallApiExpectTest")
-public class FirewallApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public void testPatchFirewallResponseIs2xx() throws IOException {
-      HttpRequest update = HttpRequest
-              .builder()
-              .method("PATCH")
-              .endpoint(BASE_URL + "/party/global/firewalls/myfw")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResource("/firewall_insert.json"))
-              .build();
-
-      HttpResponse updateFirewallResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/operation.json")).build();
-
-      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, update,
-              updateFirewallResponse).firewalls();
-
-      assertEquals(api.patch("myfw",
-              new FirewallOptions()
-                      .name("myfw")
-                      .network(URI.create(BASE_URL + "/party/global/networks/default"))
-                      .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24")))
-                      .addSourceTag("tag1")
-                      .addSourceRange("10.0.1.0/32")
-                      .addTargetTag("tag2")), new ParseOperationTest().expected());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/47725877/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
index ba8afef..bae4f72 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
@@ -115,6 +115,24 @@ public class FirewallApiMockTest extends BaseGoogleComputeEngineApiMockTest {
             stringFromResource("/firewall_insert.json"));
    }
 
+   public void patch() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      FirewallOptions options = new FirewallOptions()
+         .name("myfw")
+         .network(URI.create(url("/projects/party/global/networks/default")))
+         .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24")))
+         .addSourceTag("tag1")
+         .addSourceRange("10.0.1.0/32")
+         .addTargetTag("tag2");
+
+      assertEquals(firewallApi().patch("myfw", options),
+            new ParseOperationTest().expected(url("/projects")));
+
+      assertSent(server, "PATCH", "/projects/party/global/firewalls/myfw",
+            stringFromResource("/firewall_insert.json"));
+   }
+
    FirewallApi firewallApi(){
       return api().firewalls();
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/47725877/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
deleted file mode 100644
index 2b50537..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
-import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "HttpHealthCheckApiExpectTest")
-public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public void testPatchHttpHealthChecksResponseIs2xx() {
-      String healthCheckName = "http-health-check";
-      HttpRequest patch = HttpRequest
-            .builder()
-            .method("PATCH")
-            .endpoint(BASE_URL + "/party/global/httpHealthChecks/" + healthCheckName)
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType("/httphealthcheck_patch.json", MediaType.APPLICATION_JSON))
-            .build();
-
-       HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200)
-               .payload(payloadFromResource("/global_operation.json")).build();
-
-       HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-               TOKEN_RESPONSE, patch,
-               insertHttpHealthCheckResponse).httpHeathChecks();
-       HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions.Builder().timeoutSec(0).unhealthyThreshold(0).buildNoDefaults();
-       assertEquals(api.patch(healthCheckName, options), new ParseGlobalOperationTest().expected());
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/47725877/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
index 2943a33..ebc86fe 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
@@ -87,6 +87,18 @@ public class HttpHealthCheckApiMockTest extends BaseGoogleComputeEngineApiMockTe
             stringFromResource("/httphealthcheck_insert.json"));
    }
 
+   public void patch() throws Exception {
+      server.enqueue(jsonResponse("/global_operation.json"));
+
+      HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions.Builder()
+         .timeoutSec(0).unhealthyThreshold(0).buildNoDefaults();
+      assertEquals(httpHealthCheckApi().patch("http-health-check", options),
+            new ParseGlobalOperationTest().expected(url("/projects")));
+
+      assertSent(server, "PATCH", "/projects/party/global/httpHealthChecks/http-health-check",
+            stringFromResource("/httphealthcheck_patch.json"));
+   }
+
    public void list() throws Exception {
       server.enqueue(jsonResponse("/httphealthcheck_list.json"));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/47725877/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiExpectTest.java
deleted file mode 100644
index 885ab88..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiExpectTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.net.URI;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.UrlMap;
-import org.jclouds.googlecomputeengine.domain.UrlMap.HostRule;
-import org.jclouds.googlecomputeengine.domain.UrlMap.PathMatcher;
-import org.jclouds.googlecomputeengine.domain.UrlMap.PathMatcher.PathRule;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.options.UrlMapOptions;
-import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit")
-public class UrlMapApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-
-   public void patch() throws IOException {
-      HttpRequest request = HttpRequest.builder()
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .method("PATCH")
-            .endpoint("https://www.googleapis.com/compute/v1/projects"
-                     + "/party/global/urlMaps/jclouds-test")
-            .payload(payloadFromResourceWithContentType("/url_map_insert.json", MediaType.APPLICATION_JSON))
-            .build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/operation.json"))
-            .build();
-
-      UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).urlMaps();
-
-      assertEquals(api.patch("jclouds-test", createBasicMap()), new ParseOperationTest().expected());
-   }
-
-   private UrlMapOptions createBasicMap() {
-      URI service = URI.create("https://www.googleapis.com/compute/v1/projects/"
-               + "myproject/global/backendServices/jclouds-test");
-      return new UrlMapOptions().name("jclouds-test")
-                                .description("Sample url map")
-                                .hostRule(HostRule.create(null, ImmutableList.of("jclouds-test"), "path"))
-                                .pathMatcher(PathMatcher.create("path",
-                                                                null,
-                                                                service,
-                                                                ImmutableList.of(
-                                                                      PathRule.create(ImmutableList.of("/"),
-                                                                                      service))))
-                                .test(UrlMap.UrlMapTest.create(null, "jclouds-test", "/test/path", service))
-                                .defaultService(service);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/47725877/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
index b0de3d8..1107557 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
@@ -70,9 +70,7 @@ public class UrlMapApiMockTest extends BaseGoogleComputeEngineApiMockTest {
             stringFromResource("/url_map_insert.json"));
    }
 
-/*
    public void patch() throws Exception {
-      // PATCH not yet supported
       server.enqueue(jsonResponse("/operation.json"));
 
       assertEquals(urlMapApi().patch("jclouds-test", createBasicMap()),
@@ -80,7 +78,7 @@ public class UrlMapApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       assertSent(server, "PATCH", "/projects/party/global/urlMaps/jclouds-test",
             stringFromResource("/url_map_insert.json"));
    }
-*/
+
    public void delete() throws Exception {
       server.enqueue(jsonResponse("/operation.json"));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/47725877/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
index a9f4483..8907be9 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
@@ -36,6 +36,7 @@ import org.jclouds.ContextBuilder;
 import org.jclouds.compute.ComputeService;
 import org.jclouds.compute.ComputeServiceContext;
 import org.jclouds.concurrent.config.ExecutorServiceModule;
+import org.jclouds.http.okhttp.config.OkHttpCommandExecutorServiceModule;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineProviderMetadata;
 import org.testng.annotations.AfterMethod;
@@ -49,7 +50,7 @@ import com.squareup.okhttp.mockwebserver.MockWebServer;
 import com.squareup.okhttp.mockwebserver.RecordedRequest;
 
 /**
- * Tests need to run {@code singleThreaded = true) as otherwise tests will clash on the server field.
+ * Tests need to run {@code singleThreaded = true} as otherwise tests will clash on the server field.
  * Sharing the server field means less code to write.
  */
 public class BaseGoogleComputeEngineApiMockTest {
@@ -80,7 +81,7 @@ public class BaseGoogleComputeEngineApiMockTest {
    }
 
    private final Set<Module> modules = ImmutableSet
-         .of(new ExecutorServiceModule(sameThreadExecutor()), GoogleComputeEngineTestModule.INSTANCE);
+         .of(new ExecutorServiceModule(sameThreadExecutor()), GoogleComputeEngineTestModule.INSTANCE, new OkHttpCommandExecutorServiceModule());
 
    final AtomicInteger suffix = new AtomicInteger();
 


[26/50] [abbrv] jclouds git commit: adding start and stop to Instance Api

Posted by na...@apache.org.
adding start and stop to Instance Api


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

Branch: refs/heads/master
Commit: 7ac7197e836ba29d15b2a0ff38ba6804f75c472f
Parents: 19c65d8
Author: Daniel Broudy <br...@google.com>
Authored: Thu Feb 5 17:46:30 2015 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Feb 11 17:25:44 2015 +0100

----------------------------------------------------------------------
 .../features/InstanceApi.java                   | 24 ++++++++++++++++
 .../features/InstanceApiLiveTest.java           | 29 +++++++++++++++++++-
 .../features/InstanceApiMockTest.java           | 18 ++++++++++++
 3 files changed, 70 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/7ac7197e/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
index 03e690b..5405de2 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
@@ -253,6 +253,30 @@ public interface InstanceApi {
                            @PayloadParam("automaticRestart") boolean automaticRestart);
 
    /**
+    * This method starts an instance that was stopped using the using the {@link #stop(String)} method.
+    * @param instance - name of the instance to be started
+    */
+   @Named("Instances:start")
+   @POST
+   @Path("/{instance}/start")
+   @Produces(APPLICATION_JSON)
+   Operation start(@PathParam("instance") String instance);
+
+   /**
+    * This method stops a running instance, shutting it down cleanly, and allows you to restart
+    *  the instance at a later time. Stopped instances do not incur per-minute, virtual machine
+    *  usage charges while they are stopped, but any resources that the virtual machine is using,
+    *  such as persistent disks and static IP addresses,will continue to be charged until they are deleted.
+    * @param instance
+    * @return
+    */
+   @Named("Instances:stop")
+   @POST
+   @Path("/{instance}/stop")
+   @Produces(APPLICATION_JSON)
+   Operation stop(@PathParam("instance") String instance);
+
+   /**
     * Retrieves the list of instance resources available to the specified project.
     * By default the list as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() has not
     * been set.

http://git-wip-us.apache.org/repos/asf/jclouds/blob/7ac7197e/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index 1910282..266d759 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -56,6 +56,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    private static final String INSTANCE_NETWORK_NAME = "instance-api-live-test-network";
    private static final String INSTANCE_NAME = "instance-api-test-instance-1";
+   private static final String INSTANCE_NAME2 = "instance-api-test-instance-2";
    private static final String DISK_NAME = "instance-live-test-disk";
    private static final String IPV4_RANGE = "10.0.0.0/8";
    private static final String METADATA_ITEM_KEY = "instanceLiveTestTestProp";
@@ -68,6 +69,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    private static final String DEFAULT_BOOT_DISK_NAME = "persistent-disk-0";
 
    private NewInstance instance;
+   private NewInstance instance2;
 
    @Override
    protected GoogleComputeEngineApi create(Properties props, Iterable<Module> modules) {
@@ -95,6 +97,13 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       );
       instance.tags().items().addAll(Arrays.asList("foo", "bar"));
       instance.metadata().put("mykey", "myvalue");
+
+      instance2 = NewInstance.create(
+            INSTANCE_NAME2, // name
+            getDefaultMachineTypeUrl(), // machineType
+            getNetworkUrl(INSTANCE_NETWORK_NAME), // network
+            imageUri); // sourceImage
+
       return api;
    }
 
@@ -115,6 +124,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
             new DiskCreationOptions().sizeGb(DEFAULT_DISK_SIZE_GB)));
       assertOperationDoneSuccessfully(api().create(instance));
+      assertOperationDoneSuccessfully(api().create(instance2));
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertInstance")
@@ -283,10 +293,27 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertOperationDoneSuccessfully(api().reset(INSTANCE_NAME));
    }
 
+   @Test(groups = "live", dependsOnMethods = "testInsertInstance")
+   public void testStopInstance() {
+      Instance originalInstance = api().get(INSTANCE_NAME2);
+      assertEquals(originalInstance.status(), Instance.Status.RUNNING);
+      assertOperationDoneSuccessfully(api().stop(INSTANCE_NAME2));
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testStopInstance")
+   public void testStartInstance() {
+      Instance originalInstance = api().get(INSTANCE_NAME2);
+      assertEquals(originalInstance.status(), Instance.Status.TERMINATED);
+      assertOperationDoneSuccessfully(api().start(INSTANCE_NAME2));
+      originalInstance = api().get(INSTANCE_NAME2);
+      assertEquals(originalInstance.status(), Instance.Status.RUNNING);
+   }
+
    @Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling",
-         "testGetInstance", "testGetSerialPortOutput", "testDeleteAccessConfig"}, alwaysRun = true)
+         "testGetInstance", "testGetSerialPortOutput", "testDeleteAccessConfig", "testStartInstance"}, alwaysRun = true)
    public void testDeleteInstance() {
       assertOperationDoneSuccessfully(api().delete(INSTANCE_NAME));
+      assertOperationDoneSuccessfully(api().delete(INSTANCE_NAME2));
       assertOperationDoneSuccessfully(diskApi().delete(DISK_NAME));
       Operation deleteNetwork = api.networks().delete(INSTANCE_NETWORK_NAME);
       assertOperationDoneSuccessfully(deleteNetwork);

http://git-wip-us.apache.org/repos/asf/jclouds/blob/7ac7197e/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
index db3f6eb..ee1b08d 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
@@ -231,6 +231,24 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
             "{\"onHostMaintenance\": \"TERMINATE\",\"automaticRestart\": true}");
    }
 
+   public void start_test() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(instanceApi().start("test-1"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/start");
+   }
+
+   public void stop_test() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(instanceApi().stop("test-1"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/stop");
+   }
+
    InstanceApi instanceApi(){
       return api().instancesInZone("us-central1-a");
    }


[47/50] [abbrv] jclouds git commit: JCLOUDS-936: Switch to LoadingCache for disk->image

Posted by na...@apache.org.
JCLOUDS-936: Switch to LoadingCache for disk->image


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

Branch: refs/heads/master
Commit: db6f6efaba2066535ea8eb41ccc6729f24cd108f
Parents: f3555cb
Author: Andrew Bayer <an...@gmail.com>
Authored: Thu Jun 18 11:44:11 2015 +0200
Committer: Andrew Bayer <an...@gmail.com>
Committed: Thu Jun 18 11:44:11 2015 +0200

----------------------------------------------------------------------
 .../GoogleComputeEngineServiceAdapter.java      | 15 +++---
 ...GoogleComputeEngineServiceContextModule.java | 52 ++++++++++--------
 .../functions/InstanceToNodeMetadata.java       | 24 ++++-----
 .../compute/functions/Resources.java            | 15 +++++-
 .../compute/loaders/DiskURIToImage.java         | 57 ++++++++++++++++++++
 .../googlecomputeengine/domain/Disk.java        |  4 +-
 .../GoogleComputeEngineServiceMockTest.java     | 24 +++++++--
 .../functions/InstanceToNodeMetadataTest.java   | 22 +++++---
 .../compute/functions/ResourcesMockTest.java    | 38 ++++++++++++-
 .../parse/ParseInstanceTest.java                |  3 +-
 .../resources/disk_get_with_source_image.json   | 12 +++++
 .../resources/image_get_for_source_image.json   | 25 +++++++++
 .../src/test/resources/instance_get.json        |  6 +--
 .../src/test/resources/instance_list.json       |  6 +--
 14 files changed, 233 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index e7035ba..2ef8100 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -31,12 +31,12 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.atomic.AtomicReference;
 
 import com.google.common.base.Predicate;
 import com.google.common.base.Splitter;
 import com.google.common.base.Strings;
+import com.google.common.cache.LoadingCache;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
@@ -88,27 +88,27 @@ public final class GoogleComputeEngineServiceAdapter
    private final JustProvider justProvider;
    private final GoogleComputeEngineApi api;
    private final Resources resources;
-   private final Map<URI, URI> diskToSourceImage;
    private final Predicate<AtomicReference<Operation>> operationDone;
    private final Predicate<AtomicReference<Instance>> instanceVisible;
    private final FirewallTagNamingConvention.Factory firewallTagNamingConvention;
    private final List<String> imageProjects;
+   private final LoadingCache<URI, Image> diskURIToImage;
 
    @Inject GoogleComputeEngineServiceAdapter(JustProvider justProvider, GoogleComputeEngineApi api,
                                             Predicate<AtomicReference<Operation>> operationDone,
                                             Predicate<AtomicReference<Instance>> instanceVisible,
-                                            Map<URI, URI> diskToSourceImage,
                                             Resources resources,
                                             FirewallTagNamingConvention.Factory firewallTagNamingConvention,
-                                            @Named(IMAGE_PROJECTS) String imageProjects) {
+                                            @Named(IMAGE_PROJECTS) String imageProjects,
+                                            LoadingCache<URI, Image> diskURIToImage) {
       this.justProvider = justProvider;
       this.api = api;
       this.operationDone = operationDone;
       this.instanceVisible = instanceVisible;
-      this.diskToSourceImage = diskToSourceImage;
       this.resources = resources;
       this.firewallTagNamingConvention = firewallTagNamingConvention;
       this.imageProjects = Splitter.on(',').omitEmptyStrings().splitToList(imageProjects);
+      this.diskURIToImage = diskURIToImage;
    }
 
    @Override public NodeAndInitialCredentials<Instance> createNodeWithGroupEncodedIntoName(String group, String name,
@@ -182,14 +182,15 @@ public final class GoogleComputeEngineServiceAdapter
       checkState(instanceVisible.apply(instance), "instance %s is not api visible!", instance.get());
 
       // Add lookup for InstanceToNodeMetadata
-      diskToSourceImage.put(instance.get().disks().get(0).source(), template.getImage().getUri());
+      diskURIToImage.getUnchecked(instance.get().disks().get(0).source());
 
       return new NodeAndInitialCredentials<Instance>(instance.get(), instance.get().selfLink().toString(), credentials);
    }
 
    @Override public Iterable<MachineType> listHardwareProfiles() {
       return filter(concat(api.aggregatedList().machineTypes()), new Predicate<MachineType>() {
-         @Override public boolean apply(MachineType input) {
+         @Override
+         public boolean apply(MachineType input) {
             return input.deprecated() == null;
          }
       });

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
index 5c79e95..4951b05 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
@@ -25,14 +25,26 @@ import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperti
 import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
 import static org.jclouds.util.Predicates2.retry;
 
+import javax.inject.Named;
+import javax.inject.Singleton;
 import java.net.URI;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
 
-import javax.inject.Named;
-import javax.inject.Singleton;
-
+import com.google.common.base.Function;
+import com.google.common.base.Functions;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.TypeLiteral;
 import org.jclouds.collect.Memoized;
 import org.jclouds.compute.ComputeService;
 import org.jclouds.compute.ComputeServiceAdapter;
@@ -55,10 +67,11 @@ import org.jclouds.googlecomputeengine.compute.functions.InstanceToNodeMetadata;
 import org.jclouds.googlecomputeengine.compute.functions.MachineTypeToHardware;
 import org.jclouds.googlecomputeengine.compute.functions.OrphanedGroupsFromDeadNodes;
 import org.jclouds.googlecomputeengine.compute.functions.Resources;
+import org.jclouds.googlecomputeengine.compute.loaders.DiskURIToImage;
 import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
-import org.jclouds.googlecomputeengine.compute.predicates.GroupIsEmpty;
 import org.jclouds.googlecomputeengine.compute.predicates.AtomicInstanceVisible;
 import org.jclouds.googlecomputeengine.compute.predicates.AtomicOperationDone;
+import org.jclouds.googlecomputeengine.compute.predicates.GroupIsEmpty;
 import org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
 import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
@@ -67,18 +80,6 @@ import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.location.suppliers.ImplicitLocationSupplier;
 import org.jclouds.location.suppliers.implicit.FirstZone;
 
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import com.google.inject.Injector;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-import com.google.inject.TypeLiteral;
-
 public final class GoogleComputeEngineServiceContextModule
       extends ComputeServiceAdapterContextModule<Instance, MachineType, Image, Location> {
 
@@ -122,6 +123,10 @@ public final class GoogleComputeEngineServiceContextModule
       }).to(ImageNameToOperatingSystem.class);
 
       bind(FirewallTagNamingConvention.Factory.class).in(Scopes.SINGLETON);
+
+      bind(new TypeLiteral<CacheLoader<URI, Image>>() {
+      }).to(DiskURIToImage.class);
+
       bindHttpApi(binder(), Resources.class);
    }
 
@@ -136,10 +141,6 @@ public final class GoogleComputeEngineServiceContextModule
       return retry(input, timeout, interval, MILLISECONDS);
    }
 
-   @Provides @Singleton Map<URI, URI> diskToSourceImage() {
-      return Maps.newConcurrentMap();
-   }
-
    @Provides @Singleton @Memoized Supplier<Map<URI, Hardware>> hardwareByUri(
          @Memoized final Supplier<Set<? extends Hardware>> hardwareSupplier,
          @Named(PROPERTY_SESSION_INTERVAL) long seconds) {
@@ -157,7 +158,8 @@ public final class GoogleComputeEngineServiceContextModule
    @Provides @Singleton @Memoized Supplier<Map<URI, Location>> locationsByUri(
          @Memoized final Supplier<Set<? extends Location>> locations, @Named(PROPERTY_SESSION_INTERVAL) long seconds) {
       return memoizeWithExpiration(new Supplier<Map<URI, Location>>() {
-         @Override public Map<URI, Location> get() {
+         @Override
+         public Map<URI, Location> get() {
             ImmutableMap.Builder<URI, Location> result = ImmutableMap.builder();
             for (Location location : locations.get()) {
                result.put(URI.create(location.getDescription()), location);
@@ -188,6 +190,14 @@ public final class GoogleComputeEngineServiceContextModule
       return builder.build();
    }
 
+   @Provides
+   @Singleton
+   protected LoadingCache<URI, Image> diskURIToImageMap(
+         CacheLoader<URI, Image> in) {
+      return CacheBuilder.newBuilder().build(in);
+   }
+
+
    @Override protected Optional<ImageExtension> provideImageExtension(Injector i) {
       return Optional.absent();
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
index aab8cf9..6f72bee 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
@@ -18,41 +18,41 @@ package org.jclouds.googlecomputeengine.compute.functions;
 
 import static org.jclouds.compute.util.ComputeServiceUtils.groupFromMapOrName;
 
+import javax.inject.Inject;
 import java.net.URI;
 import java.util.List;
 import java.util.Map;
 
-import javax.inject.Inject;
-
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableList;
 import org.jclouds.collect.Memoized;
 import org.jclouds.compute.domain.Hardware;
 import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
 import org.jclouds.compute.domain.NodeMetadata.Status;
+import org.jclouds.compute.domain.NodeMetadataBuilder;
 import org.jclouds.compute.functions.GroupNamingConvention;
 import org.jclouds.domain.Location;
+import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-
 public final class InstanceToNodeMetadata implements Function<Instance, NodeMetadata> {
 
    private final Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus;
    private final GroupNamingConvention nodeNamingConvention;
-   private final Map<URI, URI> diskToSourceImage;
+   private final LoadingCache<URI, Image> diskURIToImage;
    private final Supplier<Map<URI, Hardware>> hardwares;
    private final Supplier<Map<URI, Location>> locationsByUri;
 
    @Inject InstanceToNodeMetadata(Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus,
                                   GroupNamingConvention.Factory namingConvention,
-                                  Map<URI, URI> diskToSourceImage,
+                                  LoadingCache<URI, Image> diskURIToImage,
                                   @Memoized Supplier<Map<URI, Hardware>> hardwares,
                                   @Memoized Supplier<Map<URI, Location>> locationsByUri) {
       this.toPortableNodeStatus = toPortableNodeStatus;
       this.nodeNamingConvention = namingConvention.createWithoutPrefix();
-      this.diskToSourceImage = diskToSourceImage;
+      this.diskURIToImage = diskURIToImage;
       this.hardwares = hardwares;
       this.locationsByUri = locationsByUri;
    }
@@ -71,14 +71,14 @@ public final class InstanceToNodeMetadata implements Function<Instance, NodeMeta
       //
       // Note: This will be present if we created the node. In the future we could choose to make diskToSourceImage
       // a loading cache. That would be more expensive, but could ensure this isn't null.
-      URI bootImage = diskToSourceImage.get(input.disks().get(0).source());
+      Image image = diskURIToImage.getUnchecked(input.disks().get(0).source());
 
       builder.id(input.selfLink().toString())
              .name(input.name())
              .providerId(input.id())
              .hostname(input.name())
              .location(zone)
-             .imageId(bootImage != null ? bootImage.toString() : null)
+             .imageId(image != null ? image.selfLink().toString() : null)
              .hardware(hardwares.get().get(input.machineType()))
              .status(input.status() != null ? toPortableNodeStatus.get(input.status()) : Status.UNRECOGNIZED)
              .tags(input.tags().items())

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
index 50154ba..97c4a3e 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
@@ -19,15 +19,16 @@ package org.jclouds.googlecomputeengine.compute.functions;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
 
-import java.net.URI;
-
 import javax.inject.Named;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
+import java.net.URI;
 
+import org.jclouds.googlecomputeengine.domain.Disk;
+import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.Network;
 import org.jclouds.googlecomputeengine.domain.Operation;
@@ -80,4 +81,14 @@ public interface Resources {
    @POST
    @Path("/stop")
    Operation stopInstance(@EndpointParam URI selfLink);
+
+   /** Returns a disk by self-link or null if not found. */
+   @Named("Disks:get")
+   @GET
+   @Fallback(NullOnNotFoundOr404.class) @Nullable Disk disk(@EndpointParam URI selfLink);
+
+   /** Returns an image by self-link or null if not found. */
+   @Named("Images:get")
+   @GET
+   @Fallback(NullOnNotFoundOr404.class) @Nullable Image image(@EndpointParam URI selfLink);
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java
new file mode 100644
index 0000000..0dccaf4
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.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.googlecomputeengine.compute.loaders;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.net.URI;
+import java.util.concurrent.ExecutionException;
+
+import com.google.common.cache.CacheLoader;
+import org.jclouds.googlecomputeengine.compute.functions.Resources;
+import org.jclouds.googlecomputeengine.domain.Disk;
+import org.jclouds.googlecomputeengine.domain.Image;
+import org.jclouds.logging.Logger;
+
+
+@Singleton
+public class DiskURIToImage extends CacheLoader<URI, Image> {
+   @Resource
+   protected Logger logger = Logger.NULL;
+
+   private final Resources resources;
+
+   @Inject
+   DiskURIToImage(Resources resources) {
+      this.resources = resources;
+   }
+
+   @Override
+   public Image load(URI key) throws ExecutionException {
+      try {
+         Disk disk = resources.disk(key);
+         return resources.image(disk.sourceImage());
+      } catch (Exception e) {
+         throw new ExecutionException(message(key, e), e);
+      }
+   }
+
+   public static String message(URI key, Exception e) {
+      return String.format("could not find image for disk %s: %s", key.toString(), e.getMessage());
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
index 88becb4..4321347 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
@@ -55,7 +55,7 @@ public abstract class Disk {
 
    public abstract URI selfLink();
 
-   @Nullable public abstract String sourceImage();
+   @Nullable public abstract URI sourceImage();
 
    @Nullable public abstract String sourceImageId();
 
@@ -67,7 +67,7 @@ public abstract class Disk {
    @SerializedNames({ "id", "creationTimestamp", "zone", "status", "name", "description", "sizeGb", "sourceSnapshot",
       "sourceSnapshotId", "selfLink", "sourceImage", "sourceImageId", "type", "licenses" })
    public static Disk create(String id, Date creationTimestamp, URI zone, Status status, String name, String description, int sizeGb,
-         String sourceSnapshot, String sourceSnapshotId, URI selfLink, String sourceImage, String sourceImageId, URI type, List<String> licenses) {
+         String sourceSnapshot, String sourceSnapshotId, URI selfLink, URI sourceImage, String sourceImageId, URI type, List<String> licenses) {
       return new AutoValue_Disk(id, creationTimestamp, zone, status, name, description, sizeGb,
             sourceSnapshot, sourceSnapshotId, selfLink, sourceImage, sourceImageId, type, licenses);
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
index d374f93..4eb7aef 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
@@ -20,12 +20,13 @@ import static com.google.common.collect.Iterables.getOnlyElement;
 import static org.jclouds.googlecomputeengine.domain.Instance.Status.RUNNING;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 
 import java.io.IOException;
 import java.util.Set;
 
+import com.google.common.collect.ImmutableSet;
+import com.squareup.okhttp.mockwebserver.MockResponse;
 import org.jclouds.compute.ComputeService;
 import org.jclouds.compute.domain.ComputeMetadata;
 import org.jclouds.compute.domain.Hardware;
@@ -38,9 +39,6 @@ import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableSet;
-import com.squareup.okhttp.mockwebserver.MockResponse;
-
 @Test(groups = "unit", testName = "GoogleComputeEngineServiceMockTest", singleThreaded = true)
 public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineApiMockTest {
 
@@ -75,6 +73,8 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
    public void firewallDeletedWhenAllGroupNodesAreTerminated() throws IOException, InterruptedException {
       server.enqueue(instanceWithNetworkAndStatus("test-delete-1", "default", RUNNING));
       server.enqueue(singleRegionSingleZoneResponse());
+      server.enqueue(jsonResponse("/disk_get_with_source_image.json"));
+      server.enqueue(jsonResponse("/image_get_for_source_image.json"));
       server.enqueue(jsonResponse("/aggregated_machinetype_list.json")); // Why are we getting machineTypes to delete an instance?
       server.enqueue(instanceWithNetworkAndStatus("test-delete-1", "default", RUNNING));
       server.enqueue(jsonResponse("/operation.json")); // instance delete
@@ -90,6 +90,8 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
 
       assertSent(server, "GET", "/jclouds/zones/us-central1-a/instances/test-delete-1");
       assertSent(server, "GET", "/projects/party/regions");
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/disks/test");
+      assertSent(server, "GET", "/projects/debian-cloud/global/images/debian-7-wheezy-v20140718");
       assertSent(server, "GET", "/projects/party/aggregated/machineTypes"); // Why are we getting machineTypes to delete an instance?
       assertSent(server, "GET", "/jclouds/zones/us-central1-a/instances/test-delete-1");
       assertSent(server, "DELETE", "/jclouds/zones/us-central1-a/instances/test-delete-1"); // instance delete
@@ -130,15 +132,19 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
    public void listNodes() throws Exception {
       server.enqueue(aggregatedListWithInstanceNetworkAndStatus("test-0", "test-network", RUNNING));
       server.enqueue(singleRegionSingleZoneResponse());
+      server.enqueue(jsonResponse("/disk_get_with_source_image.json"));
+      server.enqueue(jsonResponse("/image_get_for_source_image.json"));
       server.enqueue(jsonResponse("/aggregated_machinetype_list.json"));
 
       Set<? extends ComputeMetadata> nodes = computeService().listNodes();
       assertEquals(nodes.size(), 1);
       NodeMetadata node = (NodeMetadata) nodes.iterator().next();
-      assertNull(node.getImageId()); // not pre-cached by createNodes
+      assertNotNull(node.getImageId());
 
       assertSent(server, "GET", "/projects/party/aggregated/instances");
       assertSent(server, "GET", "/projects/party/regions");
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/disks/test");
+      assertSent(server, "GET", "/projects/debian-cloud/global/images/debian-7-wheezy-v20140718");
       assertSent(server, "GET", "/projects/party/aggregated/machineTypes");
    }
 
@@ -152,6 +158,8 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
       server.enqueue(jsonResponse("/operation.json")); // Create Firewall
       server.enqueue(jsonResponse("/zone_operation.json"));
       server.enqueue(aggregatedListWithInstanceNetworkAndStatus("test-0", "test-network", RUNNING));
+      server.enqueue(jsonResponse("/disk_get_with_source_image.json"));
+      server.enqueue(jsonResponse("/image_get_for_source_image.json"));
       server.enqueue(jsonResponse("/operation.json")); // Create Instance
       server.enqueue(instanceWithNetworkAndStatus("test-1", "test-network", RUNNING));
 
@@ -178,6 +186,8 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
 
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");
       assertSent(server, "GET", "/projects/party/aggregated/instances");
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/disks/test");
+      assertSent(server, "GET", "/projects/debian-cloud/global/images/debian-7-wheezy-v20140718");
       assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances",
             String.format(stringFromResource("/instance_insert_2.json"), template.getHardware().getId(), template.getImage().getId()));
 
@@ -194,6 +204,8 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
       server.enqueue(jsonResponse("/operation.json")); // Create Firewall
       server.enqueue(jsonResponse("/zone_operation.json"));
       server.enqueue(aggregatedListWithInstanceNetworkAndStatus("test-0", "test-network", RUNNING));
+      server.enqueue(jsonResponse("/disk_get_with_source_image.json"));
+      server.enqueue(jsonResponse("/image_get_for_source_image.json"));
       server.enqueue(jsonResponse("/disktype_ssd.json"));
       server.enqueue(jsonResponse("/operation.json")); // Create Instance
       server.enqueue(instanceWithNetworkAndStatusAndSsd("test-1", "test-network", RUNNING));
@@ -223,6 +235,8 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
 
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");
       assertSent(server, "GET", "/projects/party/aggregated/instances");
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/disks/test");
+      assertSent(server, "GET", "/projects/debian-cloud/global/images/debian-7-wheezy-v20140718");
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/diskTypes/pd-ssd");
       assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances",
             String.format(stringFromResource("/instance_insert_ssd.json"), template.getHardware().getId(), template.getImage().getId()));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadataTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadataTest.java
index fff0891..8fa40b0 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadataTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadataTest.java
@@ -23,6 +23,15 @@ import java.net.URI;
 import java.util.Map;
 import java.util.Set;
 
+import com.google.common.base.Function;
+import com.google.common.base.Functions;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
 import org.jclouds.compute.domain.Hardware;
 import org.jclouds.compute.domain.HardwareBuilder;
 import org.jclouds.compute.domain.NodeMetadata;
@@ -33,19 +42,13 @@ import org.jclouds.compute.functions.GroupNamingConvention;
 import org.jclouds.domain.Location;
 import org.jclouds.domain.LocationBuilder;
 import org.jclouds.domain.LocationScope;
+import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.parse.ParseImageTest;
 import org.jclouds.googlecomputeengine.parse.ParseInstanceTest;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
 @Test(groups = "unit", testName = "InstanceToNodeMetadataTest", singleThreaded = true) // BeforeMethod = singleThreaded
 public class InstanceToNodeMetadataTest {
 
@@ -172,11 +175,14 @@ public class InstanceToNodeMetadataTest {
             }
          };
 
+      Map<URI, Image> imageMap = ImmutableMap.of(instance.disks().get(0).source(),
+            new ParseImageTest().expected());
+
       return new InstanceToNodeMetadata(
          ImmutableMap.<Instance.Status, NodeMetadata.Status>builder()
             .put(Instance.Status.RUNNING, NodeMetadata.Status.PENDING).build(),
             namingConventionFactory,
-            ImmutableMap.of(instance.disks().get(0).source(), imageUrl),
+            CacheBuilder.newBuilder().build(CacheLoader.from(Functions.forMap(imageMap))),
             hardwareSupplier,
             locationSupplier);
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ResourcesMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ResourcesMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ResourcesMockTest.java
index 8ad0f03..fb2ed04 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ResourcesMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ResourcesMockTest.java
@@ -19,10 +19,14 @@ package org.jclouds.googlecomputeengine.compute.functions;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 
+import org.jclouds.googlecomputeengine.domain.Disk;
+import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.Network;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseDiskTest;
+import org.jclouds.googlecomputeengine.parse.ParseImageTest;
 import org.jclouds.googlecomputeengine.parse.ParseInstanceTest;
 import org.jclouds.googlecomputeengine.parse.ParseNetworkTest;
 import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
@@ -62,7 +66,39 @@ public class ResourcesMockTest extends BaseGoogleComputeEngineApiMockTest {
       assertNull(network);
       assertSent(server, "GET", "/foo/bar");
    }
-   
+
+   public void testDisk() throws Exception {
+      server.enqueue(jsonResponse("/disk_get.json"));
+
+      Disk disk = resourceApi().disk(server.getUrl("/foo/bar").toURI());
+      assertEquals(disk, new ParseDiskTest().expected(url("/projects")));
+      assertSent(server, "GET", "/foo/bar");
+   }
+
+   public void testDiskReturns404() throws Exception {
+      server.enqueue(response404());
+
+      Disk disk = resourceApi().disk(server.getUrl("/foo/bar").toURI());
+      assertNull(disk);
+      assertSent(server, "GET", "/foo/bar");
+   }
+
+   public void testImage() throws Exception {
+      server.enqueue(jsonResponse("/image_get.json"));
+
+      Image image = resourceApi().image(server.getUrl("/foo/bar").toURI());
+      assertEquals(image, new ParseImageTest().expected(url("/projects")));
+      assertSent(server, "GET", "/foo/bar");
+   }
+
+   public void testImageReturns404() throws Exception {
+      server.enqueue(response404());
+
+      Image image = resourceApi().image(server.getUrl("/foo/bar").toURI());
+      assertNull(image);
+      assertSent(server, "GET", "/foo/bar");
+   }
+
    public void testOperation() throws Exception {
       server.enqueue(jsonResponse("/operation.json"));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
index 651de37..2a75143 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
@@ -78,7 +78,7 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
                   AttachDisk.InitializeParams.create(
                         "test", // diskName
                         Long.parseLong("100", 10), // diskSizeGb
-                        URI.create(baseUrl + "/party/global/images/test"), // sourceImage
+                        URI.create(baseUrl + "/debian-cloud/global/images/debian-7-wheezy-v20140718"), // sourceImage
                         URI.create(baseUrl + "/party/zones/us-central1-a/diskTypes/pd-standard") // diskType
                         ), // initializeParams
                   ImmutableList.of(baseUrl + "/suse-cloud/global/licenses/sles-12"), // licenses
@@ -86,7 +86,6 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
             )), // disks
             Metadata.create("efgh")
                     .put("aKey", "aValue")
-                    .put("jclouds-image", baseUrl + "/debian-cloud/global/images/debian-7-wheezy-v20140718")
                     .put("jclouds-delete-boot-disk", "true"), // metadata
             ImmutableList.of(ServiceAccount.create("default", ImmutableList.of("myscope"))), // serviceAccounts
             Instance.Scheduling.create(OnHostMaintenance.MIGRATE, false) // scheduling

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/test/resources/disk_get_with_source_image.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/disk_get_with_source_image.json b/providers/google-compute-engine/src/test/resources/disk_get_with_source_image.json
new file mode 100644
index 0000000..bca8f2b
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/disk_get_with_source_image.json
@@ -0,0 +1,12 @@
+{
+   "kind": "compute#disk",
+   "id": "13050421646334304115",
+   "creationTimestamp": "2012-11-25T01:38:48.306",
+   "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
+   "name": "test",
+   "sizeGb": "1",
+   "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
+   "status": "READY",
+   "type": "https://www.googleapis.com/compute/v1/projects/studied-point-720/zones/us-central1-a/diskTypes/pd-standard",
+   "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/test/resources/image_get_for_source_image.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/image_get_for_source_image.json b/providers/google-compute-engine/src/test/resources/image_get_for_source_image.json
new file mode 100644
index 0000000..acf311e
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/image_get_for_source_image.json
@@ -0,0 +1,25 @@
+{
+  "kind": "compute#image",
+  "id": "12941197498378735318",
+  "creationTimestamp": "2012-07-16T22:16:13.468",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718",
+  "name": "debian-7-wheezy-v20140718",
+  "description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
+  "sourceType": "RAW",
+  "deprecated": {
+    "state": "DEPRECATED",
+    "replacement": "https://www.googleapis.com/compute/v1/projects/party/global/images/centos-6-v20130104"
+  },
+  "rawDisk": {
+    "source": "",
+    "containerType": "TAR"
+  },
+  "status": "READY",
+  "archiveSizeBytes": "881210631",
+  "diskSizeGb": "8",
+  "sourceDisk": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disk/disk",
+  "sourceDiskId": "9598530021316715047",
+  "licenses": [
+    "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/test/resources/instance_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_get.json b/providers/google-compute-engine/src/test/resources/instance_get.json
index b2795b6..7da215d 100644
--- a/providers/google-compute-engine/src/test/resources/instance_get.json
+++ b/providers/google-compute-engine/src/test/resources/instance_get.json
@@ -28,7 +28,7 @@
          "boot": true,
          "initializeParams": {
             "diskName": "test",
-            "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
+            "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718",
             "diskSizeGb": "100",
             "diskType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/diskTypes/pd-standard"
          },
@@ -54,10 +54,6 @@
             "value": "aValue"
          },
          {
-            "key": "jclouds-image",
-            "value": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718"
-         },
-         {
             "key": "jclouds-delete-boot-disk",
             "value": "true"
          }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/db6f6efa/providers/google-compute-engine/src/test/resources/instance_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_list.json b/providers/google-compute-engine/src/test/resources/instance_list.json
index ee31a1a..5a068fc 100644
--- a/providers/google-compute-engine/src/test/resources/instance_list.json
+++ b/providers/google-compute-engine/src/test/resources/instance_list.json
@@ -33,7 +33,7 @@
           "boot": true,
           "initializeParams": {
             "diskName": "test",
-            "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
+            "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718",
             "diskSizeGb": "100",
             "diskType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/diskTypes/pd-standard"
           },
@@ -59,10 +59,6 @@
             "value": "aValue"
           },
           {
-            "key": "jclouds-image",
-            "value": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718"
-          },
-          {
             "key": "jclouds-delete-boot-disk",
             "value": "true"
           }


[02/50] [abbrv] jclouds git commit: Converting tests to Mock

Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
index 43ccb60..62138b5 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
@@ -36,9 +36,14 @@ public class ParseHttpHealthCheckTest extends BaseGoogleComputeEngineParseTest<H
 
    @Override @Consumes(APPLICATION_JSON)
    public HttpHealthCheck expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public HttpHealthCheck expected(String baseUrl) {
       return HttpHealthCheck.create( //
             "2761502483700014319", // id
-            URI.create(BASE_URL + "/party-gce/global/httpHealthChecks/http-health-check-api-live-test"), // selfLink
+            URI.create(baseUrl + "/party-gce/global/httpHealthChecks/http-health-check-api-live-test"), // selfLink
             "http-health-check-api-live-test", // name
             null, // description
             null, // host

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java
index 762de45..67acdc5 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java
@@ -38,8 +38,13 @@ public class ParseInstanceListTest extends BaseGoogleComputeEngineParseTest<List
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<Instance> expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<Instance> expected(String baseUrl) {
       return ForwardingListPage.create( //
-            ImmutableList.of(new ParseInstanceTest().expected()), // items
+            ImmutableList.of(new ParseInstanceTest().expected(baseUrl)), // items
             null // nextPageToken
       );
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
index e34c149..f786a5c 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
@@ -44,19 +44,24 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
 
    @Override @Consumes(APPLICATION_JSON)
    public Instance expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Instance expected(String baseUrl) {
       return Instance.create( //
             "13051190678907570425", // id
-            URI.create(BASE_URL + "/party/zones/us-central1-a/instances/test-0"), // selfLink
+            URI.create(baseUrl + "/party/zones/us-central1-a/instances/test-0"), // selfLink
             "test-0", // name
             "desc", // description
             Tags.create("abcd").add("aTag").add("Group-port-42"), // tags
-            URI.create(BASE_URL + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // machineType
+            URI.create(baseUrl + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // machineType
             Instance.Status.RUNNING, // status
             null, // statusMessage
-            URI.create(BASE_URL + "/party/zones/us-central1-a"), // zone
+            URI.create(baseUrl + "/party/zones/us-central1-a"), // zone
             ImmutableList.of(NetworkInterface.create( //
                   "nic0", // name
-                  URI.create(BASE_URL + "/party/global/networks/default"), // network
+                  URI.create(baseUrl + "/party/global/networks/default"), // network
                   "10.240.121.115", // networkIP
                   null // accessConfigs
             )), // networkInterfaces
@@ -64,14 +69,14 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
                   0, // index
                   AttachedDisk.Type.PERSISTENT, // type
                   AttachedDisk.Mode.READ_WRITE, // mode
-                  URI.create(BASE_URL + "/party/zones/us-central1-a/disks/test"), // source
+                  URI.create(baseUrl + "/party/zones/us-central1-a/disks/test"), // source
                   "test", // deviceName
                   false, // autoDelete
                   true// boot
             )), // disks
             Metadata.create("efgh")
                     .put("aKey", "aValue")
-                    .put("jclouds-image", BASE_URL + "/debian-cloud/global/images/debian-7-wheezy-v20140718")
+                    .put("jclouds-image", baseUrl + "/debian-cloud/global/images/debian-7-wheezy-v20140718")
                     .put("jclouds-delete-boot-disk", "true"), // metadata
             ImmutableList.of(ServiceAccount.create("default", ImmutableList.of("myscope"))), // serviceAccounts
             Instance.Scheduling.create(OnHostMaintenance.MIGRATE, false) // scheduling

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
index 7bd42d7..c563789 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
@@ -40,9 +40,14 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<MachineType> expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<MachineType> expected(String baseUrl) {
       MachineType machineType1 = MachineType.create( //
             "4618642685664990776", // id
-            URI.create(BASE_URL + "/party/zones/us-central1-a/machineTypes/f1-micro"), // selfLink
+            URI.create(baseUrl + "/party/zones/us-central1-a/machineTypes/f1-micro"), // selfLink
             "f1-micro", // name
             "1 vCPU (shared physical core) and 0.6 GB RAM", // description
             1, // guestCpus
@@ -55,7 +60,7 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
       );
       MachineType machineType2 = MachineType.create( //
             "12907738072351752276", // id
-            URI.create(BASE_URL + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // selfLink
+            URI.create(baseUrl + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // selfLink
             "n1-standard-1", // name
             "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk", // description
             1, // guestCpus
@@ -68,7 +73,7 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
       );
       MachineType machineType3 = MachineType.create( //
             "12908560709887590691", // id
-            URI.create(BASE_URL + "/party/zones/us-central1-a/machineTypes/n1-standard-8-d"), // selfLink
+            URI.create(baseUrl + "/party/zones/us-central1-a/machineTypes/n1-standard-8-d"), // selfLink
             "n1-standard-8-d", // name
             "8 vCPUs, 30 GB RAM, a 10 GB ephemeral root disk, and 2 extra 1770 GB ephemeral disks", // description
             8, // guestCpus

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
index 7bb6782..490ed5b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
@@ -39,9 +39,14 @@ public class ParseMachineTypeTest extends BaseGoogleComputeEngineParseTest<Machi
 
    @Override @Consumes(APPLICATION_JSON)
    public MachineType expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public MachineType expected(String baseUrl) {
       return MachineType.create( //
             "12907738072351752276", // id
-            URI.create(BASE_URL + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // selfLink
+            URI.create(baseUrl + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // selfLink
             "n1-standard-1", // name
             "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk", // description
             1, // guestCpus

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
index dca6c8d..9e20c6d 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
@@ -36,12 +36,17 @@ public class ParseRegionOperationTest extends BaseGoogleComputeEngineParseTest<O
 
    @Override @Consumes(APPLICATION_JSON)
    public Operation expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Operation expected(String baseUrl) {
       return Operation.create( //
             "13053095055850848306", // id
-            URI.create(BASE_URL + "/party/regions/us-central1/operations/operation-1354084865060"), // selfLink
+            URI.create(baseUrl + "/party/regions/us-central1/operations/operation-1354084865060"), // selfLink
             "operation-1354084865060", // name
             null, // description
-            URI.create(BASE_URL + "/party/regions/us-central1/addresses/test-address"), // targetLink
+            URI.create(baseUrl + "/party/regions/us-central1/addresses/test-address"), // targetLink
             "13053094017547040099", // targetId
             null, // clientOperationId
             Operation.Status.DONE, // status
@@ -55,7 +60,7 @@ public class ParseRegionOperationTest extends BaseGoogleComputeEngineParseTest<O
             null, // httpErrorMessage
             "insert", // operationType
             null, // errors
-            URI.create(BASE_URL + "/party/regions/us-central1"), // region
+            URI.create(baseUrl + "/party/regions/us-central1"), // region
             null // zone
       );
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/resources/address_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/address_get.json b/providers/google-compute-engine/src/test/resources/address_get.json
index 24047a4..ea5f7e3 100644
--- a/providers/google-compute-engine/src/test/resources/address_get.json
+++ b/providers/google-compute-engine/src/test/resources/address_get.json
@@ -1,5 +1,4 @@
 {
-
     "kind": "compute#address",
     "id": "4439373783165447583",
     "creationTimestamp": "2013-07-26T13:57:20.204-07:00",

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/resources/machinetype_list_central1b.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/machinetype_list_central1b.json b/providers/google-compute-engine/src/test/resources/machinetype_list_central1b.json
deleted file mode 100644
index 8ec63be..0000000
--- a/providers/google-compute-engine/src/test/resources/machinetype_list_central1b.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
-   "kind": "compute#machineTypeList",
-   "selfLink": "https://www.googleapis.com/compute/v1/projects/abayer-jclouds-test1/zones/us-central1-b/machineTypes",
-   "id": "projects/abayer-jclouds-test1/zones/us-central1-b/machineTypes",
-   "items": [
-      {
-         "kind": "compute#machineType",
-         "id": "12907738072351752276",
-         "creationTimestamp": "2012-06-07T20:48:14.670",
-         "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-b/machineTypes/n1-standard-0",
-         "name": "n1-standard-0",
-         "description": "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk",
-         "guestCpus": 1,
-         "memoryMb": 3840,
-         "maximumPersistentDisks": 16,
-         "maximumPersistentDisksSizeGb": "128",
-         "zone": "us-central1-b"
-      },
-      {
-         "kind": "compute#machineType",
-         "id": "12908560709887590691",
-         "creationTimestamp": "2012-06-07T20:51:19.936",
-         "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-b/machineTypes/n1-standard-8-d",
-         "name": "n1-standard-8-d",
-         "description": "8 vCPUs, 30 GB RAM, a 10 GB ephemeral root disk, and 2 extra 1770 GB ephemeral disks",
-         "guestCpus": 8,
-         "memoryMb": 30720,
-         "scratchDisks": [
-            {
-               "diskGb": 1770
-            },
-            {
-               "diskGb": 1770
-            }
-         ],
-         "maximumPersistentDisks": 16,
-         "maximumPersistentDisksSizeGb": "1024",
-         "zone": "us-central1-b"
-      }
-      ]
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/81d410a5/providers/google-compute-engine/src/test/resources/machinetype_list_central1b_empty.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/machinetype_list_central1b_empty.json b/providers/google-compute-engine/src/test/resources/machinetype_list_central1b_empty.json
deleted file mode 100644
index 670ca20..0000000
--- a/providers/google-compute-engine/src/test/resources/machinetype_list_central1b_empty.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-   "kind": "compute#machineTypeList",
-   "id": "projects/party/zones/us-central1-b/machineTypes",
-   "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-b/machineTypes",
-   "items": []
-}
\ No newline at end of file


[11/50] [abbrv] jclouds git commit: Updated Network, MachineType, Region, Route, Snapshot, TargetInstance, and Zone

Posted by na...@apache.org.
Updated Network, MachineType, Region, Route, Snapshot, TargetInstance, and Zone


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

Branch: refs/heads/master
Commit: fd27ab1a9ad05495c878b91ef201f377d0a63d2a
Parents: 6918ab1
Author: Daniel Broudy <br...@google.com>
Authored: Fri Dec 5 14:53:49 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Dec 8 23:50:31 2014 +0100

----------------------------------------------------------------------
 .../functions/CreateNetworkIfNeeded.java        |  5 +-
 .../googlecomputeengine/domain/MachineType.java | 13 ++-
 .../googlecomputeengine/domain/Metadata.java    |  4 +-
 .../googlecomputeengine/domain/Network.java     |  9 ++-
 .../googlecomputeengine/domain/Region.java      |  9 ++-
 .../googlecomputeengine/domain/Route.java       | 15 ++--
 .../googlecomputeengine/domain/Snapshot.java    | 20 ++++-
 .../domain/TargetInstance.java                  |  7 +-
 .../googlecomputeengine/domain/Zone.java        | 14 +++-
 .../features/NetworkApi.java                    |  7 +-
 .../options/NetworkCreationOptions.java         | 85 ++++++++++++++++++++
 .../functions/CreateNetworkIfNeededTest.java    |  7 +-
 .../functions/FindNetworkOrCreateTest.java      |  2 +
 .../functions/NetworkToSecurityGroupTest.java   |  2 +
 .../parse/ParseMachineTypeListTest.java         |  6 ++
 .../parse/ParseMachineTypeTest.java             |  2 +
 .../parse/ParseNetworkTest.java                 |  1 +
 .../parse/ParseRegionListTest.java              |  1 +
 .../parse/ParseRegionTest.java                  |  1 +
 .../parse/ParseRouteListTest.java               |  1 +
 .../parse/ParseRouteTest.java                   |  6 +-
 .../parse/ParseSnapshotListTest.java            |  6 +-
 .../parse/ParseSnapshotTest.java                |  6 +-
 .../parse/ParseTargetInstanceListTest.java      |  4 +-
 .../parse/ParseTargetInstanceTest.java          |  4 +-
 .../parse/ParseZoneListTest.java                |  3 +
 .../parse/ParseZoneTest.java                    |  3 +
 .../src/test/resources/route_get.json           | 38 ++++++---
 .../src/test/resources/route_list.json          | 73 ++++++++++-------
 .../src/test/resources/target_instance_get.json |  2 +-
 .../src/test/resources/zone_get.json            |  1 +
 .../src/test/resources/zone_list.json           |  2 +
 .../src/test/resources/zone_list_short.json     |  1 +
 33 files changed, 277 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeeded.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeeded.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeeded.java
index 7030c75..3923ad7 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeeded.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeeded.java
@@ -27,6 +27,7 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
 import org.jclouds.googlecomputeengine.domain.Network;
 import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.options.NetworkCreationOptions;
 
 import com.google.common.base.Function;
 import com.google.common.base.Predicate;
@@ -51,8 +52,10 @@ public final class CreateNetworkIfNeeded implements Function<NetworkAndAddressRa
       }
 
       if (input.gateway() != null) {
+         NetworkCreationOptions options = new NetworkCreationOptions.Builder(input.name(), input.rangeIPv4())
+            .gatewayIPv4(input.gateway()).build();
          AtomicReference<Operation> operation = Atomics.newReference(api.networks()
-               .createInIPv4RangeWithGateway(input.name(), input.rangeIPv4(), input.gateway()));
+               .createInIPv4Range(options));
          operationDone.apply(operation);
 
          checkState(operation.get().httpErrorStatusCode() == null,

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
index 973a4b1..cc3389d 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
@@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.domain;
 import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
 
 import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.jclouds.javax.annotation.Nullable;
@@ -46,6 +47,8 @@ public abstract class MachineType {
 
    public abstract String id();
 
+   public abstract Date creationTimestamp();
+
    public abstract URI selfLink();
 
    public abstract String name();
@@ -56,6 +59,8 @@ public abstract class MachineType {
 
    public abstract int memoryMb();
 
+   @Nullable public abstract Integer imageSpaceGb();
+
    public abstract List<ScratchDisk> scratchDisks();
 
    public abstract int maximumPersistentDisks();
@@ -68,12 +73,12 @@ public abstract class MachineType {
    @Nullable public abstract Deprecated deprecated();
 
    @SerializedNames(
-         { "id", "selfLink", "name", "description", "guestCpus", "memoryMb", "scratchDisks", "maximumPersistentDisks",
+         { "id", "creationTimestamp", "selfLink", "name", "description", "guestCpus", "memoryMb", "imageSpaceGb", "scratchDisks", "maximumPersistentDisks",
                "maximumPersistentDisksSizeGb", "zone", "deprecated" })
-   public static MachineType create(String id, URI selfLink, String name, String description, int guestCpus,
-         int memoryMb, List<ScratchDisk> scratchDisks, int maximumPersistentDisks, long maximumPersistentDisksSizeGb,
+   public static MachineType create(String id, Date creationTimestamp, URI selfLink, String name, String description, int guestCpus,
+         int memoryMb, Integer imageSpaceGb, List<ScratchDisk> scratchDisks, int maximumPersistentDisks, long maximumPersistentDisksSizeGb,
          String zone, Deprecated deprecated) {
-      return new AutoValue_MachineType(id, selfLink, name, description, guestCpus, memoryMb, copyOf(scratchDisks),
+      return new AutoValue_MachineType(id, creationTimestamp, selfLink, name, description, guestCpus, memoryMb, imageSpaceGb, copyOf(scratchDisks),
             maximumPersistentDisks, maximumPersistentDisksSizeGb, zone, deprecated);
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
index 25f39f0..60b8abd 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
@@ -34,13 +34,13 @@ import com.google.auto.value.AutoValue;
 public abstract class Metadata implements Cloneable {
 
    @AutoValue
-   abstract static class Entry {
+   public abstract static class Entry {
       abstract String key();
 
       abstract String value();
 
       @SerializedNames({ "key", "value" })
-      static Entry create(String key, String value) {
+      public static Entry create(String key, String value) {
          return new AutoValue_Metadata_Entry(key, value);
       }
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
index 3b7eef9..7b30cff 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
@@ -17,6 +17,7 @@
 package org.jclouds.googlecomputeengine.domain;
 
 import java.net.URI;
+import java.util.Date;
 
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
@@ -31,6 +32,8 @@ public abstract class Network {
 
    public abstract String id();
 
+   public abstract Date creationTimestamp();
+
    public abstract URI selfLink();
 
    public abstract String name();
@@ -49,10 +52,10 @@ public abstract class Network {
     */
    @Nullable public abstract String gatewayIPv4();
 
-   @SerializedNames({ "id", "selfLink", "name", "description", "IPv4Range", "gatewayIPv4" })
-   public static Network create(String id, URI selfLink, String name, String description, String rangeIPv4,
+   @SerializedNames({ "id", "creationTimestamp", "selfLink", "name", "description", "IPv4Range", "gatewayIPv4" })
+   public static Network create(String id, Date creationTimestamp, URI selfLink, String name, String description, String rangeIPv4,
          String gatewayIPv4) {
-      return new AutoValue_Network(id, selfLink, name, description, rangeIPv4, gatewayIPv4);
+      return new AutoValue_Network(id, creationTimestamp, selfLink, name, description, rangeIPv4, gatewayIPv4);
    }
 
    Network() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
index f055091..91d4cf1 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
@@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.domain;
 import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
 
 import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.jclouds.javax.annotation.Nullable;
@@ -36,6 +37,8 @@ public abstract class Region {
 
    public abstract String id();
 
+   public abstract Date creationTimestamp();
+
    public abstract URI selfLink();
 
    public abstract String name();
@@ -48,10 +51,10 @@ public abstract class Region {
 
    public abstract List<Quota> quotas();
 
-   @SerializedNames({ "id", "selfLink", "name", "description", "status", "zones", "quotas" })
-   public static Region create(String id, URI selfLink, String name, String description, Status status, List<URI> zones,
+   @SerializedNames({ "id", "creationTimestamp", "selfLink", "name", "description", "status", "zones", "quotas" })
+   public static Region create(String id, Date creationTimestamp, URI selfLink, String name, String description, Status status, List<URI> zones,
          List<Quota> quotas) {
-      return new AutoValue_Region(id, selfLink, name, description, status, copyOf(zones), copyOf(quotas));
+      return new AutoValue_Region(id, creationTimestamp, selfLink, name, description, status, copyOf(zones), copyOf(quotas));
    }
 
    Region() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
index ac8774f..ed0737e 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
@@ -19,8 +19,8 @@ package org.jclouds.googlecomputeengine.domain;
 import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
 
 import java.net.URI;
+import java.util.Date;
 import java.util.List;
-import java.util.Map;
 
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
@@ -34,12 +34,13 @@ public abstract class Route {
    public abstract static class Warning {
       public abstract String code(); // TODO: enum
 
+      // TODO: create common Warning resource.
       @Nullable public abstract String message();
 
-      public abstract Map<String, String> data();
+      public abstract List<Metadata.Entry> data();
 
       @SerializedNames({ "code", "message", "data" })
-      public static Warning create(String code, String message, Map<String, String> data) {
+      public static Warning create(String code, String message, List<Metadata.Entry> data) {
          return new AutoValue_Route_Warning(code, message, copyOf(data));
       }
 
@@ -49,6 +50,8 @@ public abstract class Route {
 
    public abstract String id();
 
+   public abstract Date creationTimestamp();
+
    public abstract URI selfLink();
 
    public abstract String name();
@@ -86,12 +89,12 @@ public abstract class Route {
    public abstract List<Warning> warnings();
 
    @SerializedNames(
-         { "id", "selfLink", "name", "description", "network", "tags", "destRange", "priority", "nextHopInstance",
+         { "id", "creationTimestamp", "selfLink", "name", "description", "network", "tags", "destRange", "priority", "nextHopInstance",
                "nextHopIp", "nextHopNetwork", "nextHopGateway", "warnings" })
-   public static Route create(String id, URI selfLink, String name, String description, URI network, List<String> tags,
+   public static Route create(String id, Date creationTimestamp, URI selfLink, String name, String description, URI network, List<String> tags,
          String destRange, int priority, URI nextHopInstance, String nextHopIp, URI nextHopNetwork, URI nextHopGateway,
          List<Warning> warnings) {
-      return new AutoValue_Route(id, selfLink, name, description, network, copyOf(tags), destRange, priority,
+      return new AutoValue_Route(id, creationTimestamp, selfLink, name, description, network, copyOf(tags), destRange, priority,
             nextHopInstance, nextHopIp, nextHopNetwork, nextHopGateway, copyOf(warnings));
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
index 22838ce..50b7356 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
@@ -17,6 +17,8 @@
 package org.jclouds.googlecomputeengine.domain;
 
 import java.net.URI;
+import java.util.Date;
+import java.util.List;
 
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
@@ -30,6 +32,8 @@ public abstract class Snapshot {
 
    public abstract URI selfLink();
 
+   public abstract Date creationTimestamp();
+
    public abstract String name();
 
    @Nullable public abstract String description();
@@ -52,10 +56,18 @@ public abstract class Snapshot {
     */
    public abstract String sourceDiskId();
 
-   @SerializedNames({ "id", "selfLink", "name", "description", "diskSizeGb", "status", "sourceDisk", "sourceDiskId" })
-   public static Snapshot create(String id, URI selfLink, String name, String description, int diskSizeGb, String status,
-         URI sourceDisk, String sourceDiskId) {
-      return new AutoValue_Snapshot(id, selfLink, name, description, diskSizeGb, status, sourceDisk, sourceDiskId);
+   @Nullable public abstract Long storageBytes();
+
+   @Nullable public abstract String storageByteStatus();
+
+   @Nullable public abstract List<String> licenses();
+
+   @SerializedNames({ "id", "selfLink", "creationTimestamp", "name", "description", "diskSizeGb", "status",
+      "sourceDisk", "sourceDiskId", "storageBytes", "storageByteStatus", "licenses" })
+   public static Snapshot create(String id, URI selfLink, Date creationTimestamp, String name, String description,
+         int diskSizeGb, String status, URI sourceDisk, String sourceDiskId, Long storageBytes, String storageByteStatus, List<String> licenses) {
+      return new AutoValue_Snapshot(id, selfLink, creationTimestamp, name, description, diskSizeGb, status,
+            sourceDisk, sourceDiskId, storageBytes, storageByteStatus, licenses);
    }
 
    Snapshot() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetInstance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetInstance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetInstance.java
index 656bc8f..f477572 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetInstance.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetInstance.java
@@ -27,6 +27,7 @@ import com.google.auto.value.AutoValue;
 @AutoValue
 public abstract class TargetInstance {
 
+   public abstract String id();
    public abstract String creationTimestamp();
    public abstract String name();
    @Nullable public abstract String description();
@@ -35,11 +36,11 @@ public abstract class TargetInstance {
    @Nullable public abstract URI instance();
    public abstract URI selfLink();
 
-   @SerializedNames({"creationTimestamp", "name", "description", "zone",
+   @SerializedNames({"id", "creationTimestamp", "name", "description", "zone",
       "natPolicy", "instance", "selfLink"})
-   public static TargetInstance create(String creationTimestamp, String name,
+   public static TargetInstance create(String id, String creationTimestamp, String name,
          String description, URI zone, String natPolicy, URI instance, URI selfLink){
-      return new AutoValue_TargetInstance(creationTimestamp, name, description, zone,
+      return new AutoValue_TargetInstance(id, creationTimestamp, name, description, zone,
             natPolicy, instance, selfLink);
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
index 68b9a31..70f9fb6 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
@@ -61,6 +61,8 @@ public abstract class Zone {
 
    public abstract String id();
 
+   public abstract Date creationTimestamp();
+
    public abstract URI selfLink();
 
    public abstract String name();
@@ -75,14 +77,18 @@ public abstract class Zone {
     */
    public abstract List<MaintenanceWindow> maintenanceWindows();
 
+   @Nullable public abstract Deprecated deprecated();
+
+   public abstract String region();
+
    /** The machine types that can be used in this zone. */
    public abstract List<String> availableMachineTypes();
 
    @SerializedNames(
-         { "id", "selfLink", "name", "description", "status", "maintenanceWindows", "availableMachineTypes" })
-   public static Zone create(String id, URI selfLink, String name, String description, Status status,
-         List<MaintenanceWindow> maintenanceWindows, List<String> availableMachineTypes) {
-      return new AutoValue_Zone(id, selfLink, name, description, status, copyOf(maintenanceWindows),
+         { "id", "creationTimestamp", "selfLink", "name", "description", "status", "maintenanceWindows", "deprecated", "region", "availableMachineTypes" })
+   public static Zone create(String id, Date creationTimestamp, URI selfLink, String name, String description, Status status,
+         List<MaintenanceWindow> maintenanceWindows, Deprecated deprecated, String region, List<String> availableMachineTypes) {
+      return new AutoValue_Zone(id, creationTimestamp, selfLink, name, description, status, copyOf(maintenanceWindows), deprecated, region,
             copyOf(availableMachineTypes));
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
index 4cdd8b9..c975784 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
@@ -38,8 +38,10 @@ import org.jclouds.googlecomputeengine.domain.Network;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
 import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.googlecomputeengine.options.NetworkCreationOptions;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.oauth.v2.filters.OAuthFilter;
+import org.jclouds.rest.annotations.BinderParam;
 import org.jclouds.rest.annotations.Fallback;
 import org.jclouds.rest.annotations.MapBinder;
 import org.jclouds.rest.annotations.PayloadParam;
@@ -90,10 +92,7 @@ public interface NetworkApi {
    @Named("Networks:insert")
    @POST
    @Produces(APPLICATION_JSON)
-   @MapBinder(BindToJsonPayload.class)
-   Operation createInIPv4RangeWithGateway(@PayloadParam("name") String networkName,
-                                          @PayloadParam("IPv4Range") String IPv4Range,
-                                          @PayloadParam("gatewayIPv4") String gatewayIPv4);
+   Operation createInIPv4Range(@BinderParam(BindToJsonPayload.class) NetworkCreationOptions options);
 
    /** Deletes a network by name and returns the operation in progress, or null if not found. */
    @Named("Networks:delete")

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/NetworkCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/NetworkCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/NetworkCreationOptions.java
new file mode 100644
index 0000000..3003322
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/NetworkCreationOptions.java
@@ -0,0 +1,85 @@
+/*
+ * 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.googlecomputeengine.options;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+/**
+ * Represents a network used to enable instance communication.
+ */
+@AutoValue
+public abstract class NetworkCreationOptions {
+
+   public abstract String name();
+
+   @Nullable public abstract String description();
+
+   /**
+    * The range of internal addresses that are legal on this network. This range is a CIDR
+    * specification, for example: {@code 192.168.0.0/16}.
+    */
+   public abstract String rangeIPv4();
+
+   /**
+    * This must be within the range specified by IPv4Range, and is typically the first usable address in that range.
+    * If not specified, the default value is the first usable address in IPv4Range.
+    */
+   @Nullable public abstract String gatewayIPv4();
+
+   @SerializedNames({ "name", "description", "IPv4Range", "gatewayIPv4" })
+   public static NetworkCreationOptions create(String name, String description, String rangeIPv4,
+         String gatewayIPv4) {
+      return new AutoValue_NetworkCreationOptions(name, description, rangeIPv4, gatewayIPv4);
+   }
+
+   NetworkCreationOptions() {
+   }
+
+   public static class Builder {
+      private String name;
+      private String description;
+      private String rangeIPv4;
+      private String gatewayIPv4;
+
+      public Builder(String name, String rangeIPv4){
+         this.name = name;
+         this.rangeIPv4 = rangeIPv4;
+      }
+
+      public Builder description(String description) {
+         this.description = description;
+         return this;
+      }
+
+      public Builder gatewayIPv4(String gatewayIPv4) {
+         this.gatewayIPv4 = gatewayIPv4;
+         return this;
+      }
+
+      public NetworkCreationOptions build() {
+         checkNotNull(name, "NetworkCreationOptions name cannot be null");
+         checkNotNull(rangeIPv4, "NetworkCreationOptions rangeIPv4 cannot be null");
+         return create(name, description, rangeIPv4, gatewayIPv4);
+      }
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeededTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeededTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeededTest.java
index 75e8bd7..8a5dd8f 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeededTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeededTest.java
@@ -24,12 +24,14 @@ import static org.testng.Assert.assertEquals;
 
 import java.net.URI;
 
+import org.jclouds.date.internal.SimpleDateFormatDateService;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
 import org.jclouds.googlecomputeengine.compute.predicates.AtomicOperationDone;
 import org.jclouds.googlecomputeengine.domain.Network;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.features.NetworkApi;
+import org.jclouds.googlecomputeengine.options.NetworkCreationOptions;
 import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
 import org.testng.annotations.Test;
 
@@ -48,6 +50,7 @@ public class CreateNetworkIfNeededTest {
 
       Network network = Network.create( //
             "abcd", // id
+            new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
             URI.create(BASE_URL + "/party/global/networks/this-network"), // selfLink
             "this-network", // name
             null, // description
@@ -84,6 +87,7 @@ public class CreateNetworkIfNeededTest {
 
       Network network = Network.create( //
             "abcd", // id
+            new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
             URI.create(BASE_URL + "/party/global/networks/this-network"), // selfLink
             "this-network", // name
             null, // description
@@ -95,7 +99,8 @@ public class CreateNetworkIfNeededTest {
 
       expect(api.networks()).andReturn(nwApi).atLeastOnce();
 
-      expect(nwApi.createInIPv4RangeWithGateway("this-network", "0.0.0.0/0", "1.2.3.4")).andReturn(createOp);
+      expect(nwApi.createInIPv4Range(new NetworkCreationOptions.Builder("this-network", "0.0.0.0/0")
+         .gatewayIPv4("1.2.3.4").build())).andReturn(createOp);
       expect(resources.operation(createOp.selfLink())).andReturn(createOp);
       expect(nwApi.get("this-network")).andReturn(null);
       expect(nwApi.get("this-network")).andReturn(network);

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreateTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreateTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreateTest.java
index dfe4036..137f004 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreateTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreateTest.java
@@ -25,6 +25,7 @@ import static org.testng.Assert.assertEquals;
 import java.net.URI;
 import java.util.concurrent.atomic.AtomicReference;
 
+import org.jclouds.date.internal.SimpleDateFormatDateService;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
 import org.jclouds.googlecomputeengine.compute.predicates.AtomicOperationDone;
@@ -46,6 +47,7 @@ public class FindNetworkOrCreateTest {
    private static final String BASE_URL = "https://www.googleapis.com/compute/v1/projects";
    private static final Network NETWORK = Network.create( //
          "abcd", // id
+         new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
          URI.create(BASE_URL + "/party/global/networks/this-network"), // selfLink
          "this-network", // name
          null, // description

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
index d42cab5..97b730b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
@@ -29,6 +29,7 @@ import static org.testng.Assert.assertTrue;
 import java.net.URI;
 
 import org.jclouds.compute.domain.SecurityGroup;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
 import org.jclouds.googlecloud.domain.ForwardingListPage;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.domain.Network;
@@ -59,6 +60,7 @@ public class NetworkToSecurityGroupTest {
 
       Network network = Network.create( //
             "abcd", // id
+            new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
             URI.create("https://www.googleapis.com/compute/v1/projects/party/global/networks/party-test"),
             "party-test", // name
             "some description", // description

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
index c563789..2d5977e 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
@@ -47,11 +47,13 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
    public ListPage<MachineType> expected(String baseUrl) {
       MachineType machineType1 = MachineType.create( //
             "4618642685664990776", // id
+            parse("2013-04-25T13:32:49.088-07:00"), // creationTimestamp
             URI.create(baseUrl + "/party/zones/us-central1-a/machineTypes/f1-micro"), // selfLink
             "f1-micro", // name
             "1 vCPU (shared physical core) and 0.6 GB RAM", // description
             1, // guestCpus
             614, // memoryMb
+            null, // imageSpaceGb
             null, // scratchDisks
             4, // maximumPersistentDisks
             3072, // maximumPersistentDisksSizeGb
@@ -60,11 +62,13 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
       );
       MachineType machineType2 = MachineType.create( //
             "12907738072351752276", // id
+            parse("2012-06-07T20:48:14.670"), // creationTimestamp
             URI.create(baseUrl + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // selfLink
             "n1-standard-1", // name
             "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk", // description
             1, // guestCpus
             3840, // memoryMb
+            null, // imageSpaceGb
             null, // scratchDisks
             16, // maximumPersistentDisks
             128, // maximumPersistentDisksSizeGb
@@ -73,11 +77,13 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
       );
       MachineType machineType3 = MachineType.create( //
             "12908560709887590691", // id
+            parse("2012-06-07T20:51:19.936"), // creationTimestamp
             URI.create(baseUrl + "/party/zones/us-central1-a/machineTypes/n1-standard-8-d"), // selfLink
             "n1-standard-8-d", // name
             "8 vCPUs, 30 GB RAM, a 10 GB ephemeral root disk, and 2 extra 1770 GB ephemeral disks", // description
             8, // guestCpus
             30720, // memoryMb
+            null, // imageSpaceGb
             ImmutableList.of(MachineType.ScratchDisk.create(1770), MachineType.ScratchDisk.create(1770)), // scratchDisks
             16, // maximumPersistentDisks
             1024, // maximumPersistentDisksSizeGb

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
index 490ed5b..893dcab 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
@@ -46,11 +46,13 @@ public class ParseMachineTypeTest extends BaseGoogleComputeEngineParseTest<Machi
    public MachineType expected(String baseUrl) {
       return MachineType.create( //
             "12907738072351752276", // id
+            parse("2012-06-07T20:48:14.670"), // creationTimestamp
             URI.create(baseUrl + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // selfLink
             "n1-standard-1", // name
             "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk", // description
             1, // guestCpus
             3840, // memoryMb
+            null, // imageSpaceGb
             ImmutableList.of(ScratchDisk.create(1770), ScratchDisk.create(1770)), // scratchDisks
             16, // maximumPersistentDisks
             128, // maximumPersistentDisksSizeGb

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
index 5b92ed3..fc29125 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
@@ -43,6 +43,7 @@ public class ParseNetworkTest extends BaseGoogleComputeEngineParseTest<Network>
    public Network expected(String baseUrl) {
       return Network.create( //
             "13024414170909937976", // id
+            parse("2012-10-24T20:13:19.967"), // creationTimestamp
             URI.create(baseUrl + "/party/networks/jclouds-test"), // selfLink
             "default", // name
             "Default network for the project", // description

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java
index 5f83a5b..61f96b3 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java
@@ -49,6 +49,7 @@ public class ParseRegionListTest extends BaseGoogleComputeEngineParseTest<ListPa
       Region region1 = new ParseRegionTest().expected(baseUrl);
       Region region2 = Region.create( //
             "6396763663251190992", // id
+            parse("2013-07-08T14:40:37.939-07:00"), // creationTimestamp
             URI.create(baseUrl + "/party/regions/us-central2"), // selfLink
             "us-central2", // name
             "us-central2", // description

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java
index 6a81a90..611c794 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java
@@ -46,6 +46,7 @@ public class ParseRegionTest extends BaseGoogleComputeEngineParseTest<Region> {
    public Region expected(String baseUrl) {
       return Region.create( //
             "12912210600542709766", // id
+            parse("2013-07-08T14:40:37.939-07:00"), // creationTimestamp
             URI.create(baseUrl + "/party/regions/us-central1"), // selfLink
             "us-central1", // name
             "us-central1", // description

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
index 8235ec7..5aac869 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
@@ -47,6 +47,7 @@ public class ParseRouteListTest extends BaseGoogleComputeEngineParseTest<ListPag
       Route route1 = new ParseRouteTest().expected(baseUrl);
       Route route2 = Route.create( //
             "507025480040058551", // id
+            parse("2013-07-08T14:40:38.502-07:00"), // creationTimestamp
             URI.create(baseUrl + "/party/global/routes/default-route-fc92a41ecb5a8d17"), // selfLink
             "default-route-fc92a41ecb5a8d17", // name
             "Default route to the Internet.", // description

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
index 0dd5ba4..22ab3a5 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
@@ -22,7 +22,9 @@ import java.net.URI;
 
 import javax.ws.rs.Consumes;
 
+import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.Route;
+import org.jclouds.googlecomputeengine.domain.Route.Warning;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
 import org.testng.annotations.Test;
 
@@ -45,6 +47,7 @@ public class ParseRouteTest extends BaseGoogleComputeEngineParseTest<Route> {
    public Route expected(String baseUrl) {
       return Route.create( //
             "7241926205630356071", // id
+            parse("2013-07-08T14:40:38.502-07:00"), // creationTimestamp
             URI.create(baseUrl + "/party/global/routes/default-route-c99ebfbed0e1f375"), // selfLink
             "default-route-c99ebfbed0e1f375", // name
             "Default route to the virtual network.", // description
@@ -56,7 +59,8 @@ public class ParseRouteTest extends BaseGoogleComputeEngineParseTest<Route> {
             null, // nextHopIp
             URI.create(baseUrl + "/party/global/networks/default"), // nextHopNetwork
             null, // nextHopGateway
-            null // warnings
+            ImmutableList.of(Warning.create("NO_RESULTS_ON_PAGE", "This is an example warning", ImmutableList.of(
+                  Metadata.Entry.create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))) // warnings
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java
index 6cd691a..b3c0f66 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java
@@ -49,12 +49,16 @@ public class ParseSnapshotListTest extends BaseGoogleComputeEngineParseTest<List
       Snapshot snapshot2 = Snapshot.create( //
             "13895715048576107883", // id
             URI.create(baseUrl + "/party/global/snapshots/test-snap2"), // selfLink
+            parse("2013-07-26T12:57:01.927-07:00"), // creationTimestamp
             "test-snap2", // name
             "", // description
             10, // sizeGb
             "READY", // status
             URI.create(baseUrl + "/party/zones/us-central1-a/disks/testimage1"), // sourceDisk
-            "8243603669926824540"// sourceDiskId
+            "8243603669926824540", // sourceDiskId
+            null, // storageBytes
+            null, // storageByteStatus
+            null // licenses
       );
       return ForwardingListPage.create( //
             ImmutableList.of(snapshot1, snapshot2), // items

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java
index 3247934..6f922c4 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java
@@ -44,12 +44,16 @@ public class ParseSnapshotTest extends BaseGoogleComputeEngineParseTest<Snapshot
       return Snapshot.create( //
             "9734455566806191190", // id
             URI.create(baseUrl + "/party/global/snapshots/test-snap"), // selfLink
+            parse("2013-07-26T12:54:23.173-07:00"), // creationTimestamp
             "test-snap", // name
             "", // description
             10, // sizeGb
             "READY", // status
             URI.create(baseUrl + "/party/zones/us-central1-a/disks/testimage1"), // sourceDisk
-            "8243603669926824540"// sourceDiskId
+            "8243603669926824540", // sourceDiskId
+            null, // storageBytes
+            null, // storageByteStatus
+            null // licenses
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceListTest.java
index 4af9d4d..694dd0b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceListTest.java
@@ -46,7 +46,9 @@ public class ParseTargetInstanceListTest extends BaseGoogleComputeEngineParseTes
    public ListPage<TargetInstance> expected(String baseURL){
       return ForwardingListPage.create( //
             ImmutableList.of(new ParseTargetInstanceTest().expected(baseURL),
-                  TargetInstance.create("2014-11-20T17:35:17.268-08:00", // creationTimestamp
+                  TargetInstance.create(
+                        "7362436693678237415", // id
+                        "2014-11-20T17:35:17.268-08:00", // creationTimestamp
                         "target-instance-2", // name
                         null, // description
                         URI.create(baseURL + "/party/zones/us-central1-a"), // zone

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceTest.java
index deae9f4..ab78036 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceTest.java
@@ -40,7 +40,9 @@ public class ParseTargetInstanceTest extends BaseGoogleComputeEngineParseTest<Ta
    }
 
    public TargetInstance expected(String baseUrl) {
-      return TargetInstance.create("2014-07-18T09:47:30.826-07:00", // creationTimestamp
+      return TargetInstance.create(
+            "13050421646334304115", // id
+            "2014-07-18T09:47:30.826-07:00", // creationTimestamp
             "target-instance-1", // name
             "A pretty cool target instance", // description
             URI.create(baseUrl + "/party/zones/us-central1-a"), // zone

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java
index 06b8808..05f610d 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java
@@ -43,6 +43,7 @@ public class ParseZoneListTest extends BaseGoogleComputeEngineParseTest<ListPage
       Zone zone1 = new ParseZoneTest().expected();
       Zone zone2 = Zone.create( //
             "13024414164050619686", // id
+            parse("2012-10-24T20:13:19.271"), // creationTimestamp
             URI.create(BASE_URL + "/party/zones/us-central1-b"), // selfLink
             "us-central1-b", // name
             "us-central1-b", // description
@@ -54,6 +55,8 @@ public class ParseZoneListTest extends BaseGoogleComputeEngineParseTest<ListPage
                         parse("2013-02-17T08:00:00.000"), // beginTime
                         parse("2013-03-03T08:00:00.000") // endTime)
                   )), //
+            null, // deprecated
+            "us-central1", // region
             null // availableMachineTypes
       );
       return ForwardingListPage.create( //

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneTest.java
index b2fd488..2a472c9 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneTest.java
@@ -40,6 +40,7 @@ public class ParseZoneTest extends BaseGoogleComputeEngineParseTest<Zone> {
    public Zone expected() {
       return Zone.create( //
             "13020128040171887099", // id
+            parse("2012-10-19T16:42:54.131"), // creationTimestamp
             URI.create(BASE_URL + "/party/zones/us-central1-a"), // selfLink
             "us-central1-a", // name
             "us-central1-a", // description
@@ -51,6 +52,8 @@ public class ParseZoneTest extends BaseGoogleComputeEngineParseTest<Zone> {
                         parse("2012-11-10T20:00:00.000"), // beginTime
                         parse("2012-12-02T20:00:00.000") // endTime)
                   )), //
+            null, // deprecated
+            "us-central1", // region
             null // availableMachineTypes
       );
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/resources/route_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/route_get.json b/providers/google-compute-engine/src/test/resources/route_get.json
index a2fcb9b..ee649fd 100644
--- a/providers/google-compute-engine/src/test/resources/route_get.json
+++ b/providers/google-compute-engine/src/test/resources/route_get.json
@@ -1,14 +1,28 @@
 {
-
-    "kind": "compute#route",
-    "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/routes/default-route-c99ebfbed0e1f375",
-    "id": "7241926205630356071",
-    "creationTimestamp": "2013-07-08T14:40:38.502-07:00",
-    "name": "default-route-c99ebfbed0e1f375",
-    "description": "Default route to the virtual network.",
-    "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
-    "destRange": "10.240.0.0/16",
-    "priority": 1000,
-    "nextHopNetwork": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
-    "tags": [ "fooTag", "barTag" ]
+  "kind": "compute#route",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/routes/default-route-c99ebfbed0e1f375",
+  "id": "7241926205630356071",
+  "creationTimestamp": "2013-07-08T14:40:38.502-07:00",
+  "name": "default-route-c99ebfbed0e1f375",
+  "description": "Default route to the virtual network.",
+  "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
+  "destRange": "10.240.0.0/16",
+  "priority": 1000,
+  "nextHopNetwork": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
+  "tags": [
+    "fooTag",
+    "barTag"
+  ],
+  "warnings": [
+    {
+      "code": "NO_RESULTS_ON_PAGE",
+      "message": "This is an example warning",
+      "data": [
+        {
+          "key": "scope",
+          "value": "There are no results for scope 'zones/asia-east1-b' on this page."
+        }
+      ]
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/resources/route_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/route_list.json b/providers/google-compute-engine/src/test/resources/route_list.json
index 8c69688..2dca138 100644
--- a/providers/google-compute-engine/src/test/resources/route_list.json
+++ b/providers/google-compute-engine/src/test/resources/route_list.json
@@ -1,34 +1,47 @@
 {
-    "kind": "compute#routeList",
-    "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/routes",
-    "id": "projects/party/global/routes",
-    "items": [
+  "kind": "compute#routeList",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/routes",
+  "id": "projects/party/global/routes",
+  "items": [
+    {
+      "kind": "compute#route",
+      "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/routes/default-route-c99ebfbed0e1f375",
+      "id": "7241926205630356071",
+      "creationTimestamp": "2013-07-08T14:40:38.502-07:00",
+      "name": "default-route-c99ebfbed0e1f375",
+      "description": "Default route to the virtual network.",
+      "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
+      "destRange": "10.240.0.0/16",
+      "priority": 1000,
+      "nextHopNetwork": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
+      "tags": [
+        "fooTag",
+        "barTag"
+      ],
+      "warnings": [
         {
-
-            "kind": "compute#route",
-            "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/routes/default-route-c99ebfbed0e1f375",
-            "id": "7241926205630356071",
-            "creationTimestamp": "2013-07-08T14:40:38.502-07:00",
-            "name": "default-route-c99ebfbed0e1f375",
-            "description": "Default route to the virtual network.",
-            "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
-            "destRange": "10.240.0.0/16",
-            "priority": 1000,
-            "nextHopNetwork": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
-            "tags": [ "fooTag", "barTag" ]
-        },
-        {
-
-            "kind": "compute#route",
-            "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/routes/default-route-fc92a41ecb5a8d17",
-            "id": "507025480040058551",
-            "creationTimestamp": "2013-07-08T14:40:38.502-07:00",
-            "name": "default-route-fc92a41ecb5a8d17",
-            "description": "Default route to the Internet.",
-            "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
-            "destRange": "0.0.0.0/0",
-            "priority": 1000,
-            "nextHopGateway": "https://www.googleapis.com/compute/v1/projects/party/global/gateways/default-internet-gateway"
+          "code": "NO_RESULTS_ON_PAGE",
+          "message": "This is an example warning",
+          "data": [
+            {
+              "key": "scope",
+              "value": "There are no results for scope 'zones/asia-east1-b' on this page."
+            }
+          ]
         }
-    ]
+      ]
+    },
+    {
+      "kind": "compute#route",
+      "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/routes/default-route-fc92a41ecb5a8d17",
+      "id": "507025480040058551",
+      "creationTimestamp": "2013-07-08T14:40:38.502-07:00",
+      "name": "default-route-fc92a41ecb5a8d17",
+      "description": "Default route to the Internet.",
+      "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
+      "destRange": "0.0.0.0/0",
+      "priority": 1000,
+      "nextHopGateway": "https://www.googleapis.com/compute/v1/projects/party/global/gateways/default-internet-gateway"
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/resources/target_instance_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/target_instance_get.json b/providers/google-compute-engine/src/test/resources/target_instance_get.json
index 89607d8..b90f527 100644
--- a/providers/google-compute-engine/src/test/resources/target_instance_get.json
+++ b/providers/google-compute-engine/src/test/resources/target_instance_get.json
@@ -1,6 +1,6 @@
 {
   "kind": "compute#targetInstance",
-  "id": 13050421646334304115,
+  "id": "13050421646334304115",
   "creationTimestamp": "2014-07-18T09:47:30.826-07:00",
   "name": "target-instance-1",
   "description": "A pretty cool target instance",

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/resources/zone_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/zone_get.json b/providers/google-compute-engine/src/test/resources/zone_get.json
index 886b58e..4ad9133 100644
--- a/providers/google-compute-engine/src/test/resources/zone_get.json
+++ b/providers/google-compute-engine/src/test/resources/zone_get.json
@@ -5,6 +5,7 @@
    "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
    "name": "us-central1-a",
    "description": "us-central1-a",
+   "region": "us-central1",
    "status": "DOWN",
    "maintenanceWindows": [
       {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/resources/zone_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/zone_list.json b/providers/google-compute-engine/src/test/resources/zone_list.json
index ab8b960..c32c44b 100644
--- a/providers/google-compute-engine/src/test/resources/zone_list.json
+++ b/providers/google-compute-engine/src/test/resources/zone_list.json
@@ -11,6 +11,7 @@
          "name": "us-central1-a",
          "description": "us-central1-a",
          "status": "DOWN",
+         "region": "us-central1",
          "maintenanceWindows": [
             {
                "name": "2012-11-10-planned-outage",
@@ -28,6 +29,7 @@
          "name": "us-central1-b",
          "description": "us-central1-b",
          "status": "UP",
+         "region": "us-central1",
          "maintenanceWindows": [
             {
                "name": "2013-02-17-planned-outage",

http://git-wip-us.apache.org/repos/asf/jclouds/blob/fd27ab1a/providers/google-compute-engine/src/test/resources/zone_list_short.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/zone_list_short.json b/providers/google-compute-engine/src/test/resources/zone_list_short.json
index 2b2eafe..c13ed95 100644
--- a/providers/google-compute-engine/src/test/resources/zone_list_short.json
+++ b/providers/google-compute-engine/src/test/resources/zone_list_short.json
@@ -11,6 +11,7 @@
          "name": "us-central1-a",
          "description": "us-central1-a",
          "status": "DOWN",
+         "region": "us-central1",
          "maintenanceWindows": [
             {
                "name": "2012-11-10-planned-outage",


[41/50] [abbrv] jclouds git commit: Update UrlMapApiLiveTest

Posted by na...@apache.org.
Update UrlMapApiLiveTest


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

Branch: refs/heads/master
Commit: d8222cf0f7c3d984303c538b42e46a3d1e5e4cb2
Parents: 2e7ca20
Author: Daniel Broudy <br...@google.com>
Authored: Mon Jun 8 13:48:46 2015 -0700
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Jun 9 23:59:13 2015 +0200

----------------------------------------------------------------------
 .../features/UrlMapApiLiveTest.java             | 83 +++++++++++---------
 1 file changed, 45 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/d8222cf0/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
index c5df2ff..6fa4070 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
@@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.features;
 import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.filter;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
+import static com.google.common.collect.ImmutableList.of;
 
 import java.net.URI;
 import java.util.List;
@@ -41,9 +42,13 @@ import com.google.common.collect.Iterables;
 public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    public static final String URL_MAP_NAME = "url-map-api-live-test-url-map";
-   public static final String URL_MAP_BACKEND_SERVICE_NAME = "url-map-api-live-test-backend-service";
+   public static final String URL_MAP_DEFAULT_BACKEND_SERVICE_NAME = "url-map-api-live-test-backend-service";
+   public static final String URL_MAP_OTHER_BACKEND_SERVICE_NAME = "url-map-api-live-test-other-backend-service";
    public static final String HEALTH_CHECK_NAME = "url-map-api-live-test-health-check";
 
+   public URI default_backend_service_url;
+   public URI other_backend_service_url;
+
    private UrlMapApi api() {
       return api.urlMaps();
    }
@@ -53,15 +58,21 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       // Create extra resources needed for url maps
       assertOperationDoneSuccessfully(api.httpHeathChecks().insert(HEALTH_CHECK_NAME));
 
-      List<URI> healthChecks = ImmutableList.of(getHealthCheckUrl(HEALTH_CHECK_NAME));
-      BackendServiceOptions b = new BackendServiceOptions.Builder(URL_MAP_BACKEND_SERVICE_NAME, healthChecks).build();
+      List<URI> healthChecks = of(getHealthCheckUrl(HEALTH_CHECK_NAME));
+      BackendServiceOptions b = new BackendServiceOptions.Builder(URL_MAP_DEFAULT_BACKEND_SERVICE_NAME, healthChecks).build();
       assertOperationDoneSuccessfully(api.backendServices().create(b));
 
+
       UrlMapOptions map = new UrlMapOptions.Builder().name(URL_MAP_NAME).description("simple url map")
-                                             .defaultService(getBackendServiceUrl(URL_MAP_BACKEND_SERVICE_NAME)).build();
+                                             .defaultService(getBackendServiceUrl(URL_MAP_DEFAULT_BACKEND_SERVICE_NAME)).build();
+
+      BackendServiceOptions b2 = new BackendServiceOptions.Builder(URL_MAP_OTHER_BACKEND_SERVICE_NAME, healthChecks).build();
+      assertOperationDoneSuccessfully(api.backendServices().create(b2));
 
       assertOperationDoneSuccessfully(api().create(map));
 
+      default_backend_service_url = getBackendServiceUrl(URL_MAP_DEFAULT_BACKEND_SERVICE_NAME);
+      other_backend_service_url = getBackendServiceUrl(URL_MAP_OTHER_BACKEND_SERVICE_NAME);
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertUrlMap")
@@ -87,22 +98,20 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    public void testUpdateUrlMap() {
       String fingerprint = api().get(URL_MAP_NAME).fingerprint();
 
-      URI service = getBackendServiceUrl(URL_MAP_BACKEND_SERVICE_NAME);
+      ImmutableList<String> paths = of("/other", "/other/*");
 
-      ImmutableList<String> paths = ImmutableList.<String>of("/");
+      ImmutableList<PathRule> rules = of(PathRule.create(paths, other_backend_service_url));
 
-      PathRule rule = PathRule.create(paths, service);
+      ImmutableList<PathMatcher> matchers = of(
+            PathMatcher.create("test-path-matcher", "", default_backend_service_url, rules));
 
-      ImmutableList<PathRule> rules = ImmutableList.<PathRule>of(rule);
+      ImmutableList<HostRule> hostRules = of(
+            HostRule.create("", of("*"), "test-path-matcher"));
 
-      ImmutableList<PathMatcher> matchers = ImmutableList.<PathMatcher>of(PathMatcher.create("test-path-matcher", "", service, rules));
-
-      ImmutableList<String> hosts = ImmutableList.<String>of("jclouds-test");
-      ImmutableList<HostRule> hostRules = ImmutableList.<HostRule>of(HostRule.create("", hosts, "test-path-matcher"));
       UrlMapOptions options = new UrlMapOptions.Builder().name(URL_MAP_NAME)
                                                  .pathMatchers(matchers)
                                                  .hostRules(hostRules)
-                                                 .defaultService(service)
+                                                 .defaultService(default_backend_service_url)
                                                  .fingerprint(fingerprint).build();
 
       assertOperationDoneSuccessfully(api().update(URL_MAP_NAME, options));
@@ -113,30 +122,28 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    @Test(groups = "live", dependsOnMethods = "testUpdateUrlMap")
    public void testPatchUrlMap() {
       String fingerprint = api().get(URL_MAP_NAME).fingerprint();
-      URI service = getBackendServiceUrl(URL_MAP_BACKEND_SERVICE_NAME);
 
-      UrlMapTest urlMapTest = UrlMapTest.create(null, "jclouds-test", "/test/path", service);
-      ImmutableList<UrlMap.UrlMapTest> urlMapTests = ImmutableList.<UrlMap.UrlMapTest>of(urlMapTest);
+      ImmutableList<UrlMap.UrlMapTest> urlMapTests = of(
+            UrlMapTest.create(null, "jclouds-test", "/test/path", default_backend_service_url),
+            UrlMapTest.create(null, "jclouds-test", "/other", other_backend_service_url));
 
       UrlMapOptions options = new UrlMapOptions.Builder().tests(urlMapTests)
                                                  .fingerprint(fingerprint).buildForPatch();
       assertOperationDoneSuccessfully(api().patch(URL_MAP_NAME, options));
 
       // Update options with settings it should have for later assertions.
-      ImmutableList<String> paths = ImmutableList.<String>of("/");
-      PathRule rule = PathRule.create(paths, service);
-
-      ImmutableList<PathRule> rules = ImmutableList.<PathRule>of(rule);
-      ImmutableList<PathMatcher> matchers = ImmutableList.<PathMatcher>of(PathMatcher.create("test-path-matcher", "", service, rules));
-
-      ImmutableList<String> hosts = ImmutableList.<String>of("jclouds-test");
-      ImmutableList<HostRule> hostRules = ImmutableList.<HostRule>of(HostRule.create("", hosts, "test-path-matcher"));
+      ImmutableList<String> paths = of("/other", "/other/*");
+      ImmutableList<PathRule> rules = of(PathRule.create(paths, other_backend_service_url));
+      ImmutableList<PathMatcher> matchers = of(
+            PathMatcher.create("test-path-matcher", "", default_backend_service_url, rules));
+      ImmutableList<HostRule> hostRules = of(
+            HostRule.create("", of("*"), "test-path-matcher"));
 
       options = new UrlMapOptions.Builder().name(URL_MAP_NAME)
              .description("simple url map")
              .pathMatchers(matchers)
              .hostRules(hostRules)
-             .defaultService(service)
+             .defaultService(default_backend_service_url)
              .tests(urlMapTests)
              .fingerprint(fingerprint)
              .build();
@@ -153,30 +160,30 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    @Test(groups = "live", dependsOnMethods = "testPatchUrlMap")
    public void testValidateUrlMapWithOptions() {
-      URI service = getBackendServiceUrl(URL_MAP_BACKEND_SERVICE_NAME);
-      ImmutableList<String> paths = ImmutableList.<String>of("/");
-      PathRule rule = PathRule.create(paths, service);
-      ImmutableList<PathRule> rules = ImmutableList.<PathRule>of(rule);
+      ImmutableList<String> paths = of("/test/*");
+      ImmutableList<PathRule> rules = of(PathRule.create(paths, other_backend_service_url));
 
-      ImmutableList<PathMatcher> matchers = ImmutableList.<PathMatcher>of(PathMatcher.create("test-path-matcher", "", service, rules));
+      ImmutableList<PathMatcher> matchers = of(PathMatcher.create("test-path-matcher", "", default_backend_service_url, rules));
 
-      ImmutableList<String> hosts = ImmutableList.<String>of("jclouds-test");
+      ImmutableList<String> hosts = of("jclouds-test");
 
-      ImmutableList<HostRule> hostRules = ImmutableList.<HostRule>of(HostRule.create("", hosts, "test-path-matcher"));
-      UrlMapTest urlMapTest = UrlMapTest.create(null, "jclouds-test", "/test/path", service);
-      ImmutableList<UrlMap.UrlMapTest> urlMapTests = ImmutableList.<UrlMap.UrlMapTest>of(urlMapTest);
+      ImmutableList<HostRule> hostRules = of(HostRule.create("", hosts, "test-path-matcher"));
+      UrlMapTest urlMapTest = UrlMapTest.create(null, "jclouds-test", "/test/path", other_backend_service_url);
+      ImmutableList<UrlMap.UrlMapTest> urlMapTests = of(urlMapTest);
 
       UrlMapOptions options = new UrlMapOptions.Builder()
              .pathMatchers(matchers)
              .name(URL_MAP_NAME)
              .hostRules(hostRules)
              .tests(urlMapTests)
-             .defaultService(service)
+             .defaultService(default_backend_service_url)
              .description("simple url map")
              .build();
 
       UrlMapValidateResult results = api().validate(URL_MAP_NAME, options);
       UrlMapValidateResult expected = UrlMapValidateResult.allPass();
+
+
       assertEquals(results, expected);
    }
 
@@ -186,15 +193,15 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertOperationDoneSuccessfully(api().delete(URL_MAP_NAME));
 
       // remove extra resources created
-      assertOperationDoneSuccessfully(api.backendServices().delete(URL_MAP_BACKEND_SERVICE_NAME));
+      assertOperationDoneSuccessfully(api.backendServices().delete(URL_MAP_DEFAULT_BACKEND_SERVICE_NAME));
+      assertOperationDoneSuccessfully(api.backendServices().delete(URL_MAP_OTHER_BACKEND_SERVICE_NAME));
 
       assertOperationDoneSuccessfully(api.httpHeathChecks().delete(HEALTH_CHECK_NAME));
-
    }
 
    private void assertUrlMapEquals(UrlMap result) {
       assertEquals(result.name(), URL_MAP_NAME);
-      assertEquals(result.defaultService(), getBackendServiceUrl(URL_MAP_BACKEND_SERVICE_NAME));
+      assertEquals(result.defaultService(), default_backend_service_url);
       assertEquals(result.description(), "simple url map");
    }
 


[48/50] [abbrv] jclouds git commit: Update ComposeObjectTemplate and update MockTests

Posted by na...@apache.org.
Update ComposeObjectTemplate and update MockTests


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

Branch: refs/heads/master
Commit: 70da397237332d4ef7d7d14e4fbe928bc8ac8b5a
Parents: db6f6ef
Author: Daniel Broudy <br...@google.com>
Authored: Mon Jun 8 17:29:21 2015 -0700
Committer: Daniel Broudy <br...@google.com>
Committed: Mon Jun 22 09:37:42 2015 -0700

----------------------------------------------------------------------
 .../internal/BaseGoogleComputeEngineApiLiveTest.java               | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/70da3972/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
index 714d76c..41e1e74 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
@@ -44,7 +44,7 @@ import com.google.inject.TypeLiteral;
 public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleComputeEngineApi> {
 
    protected static final String ZONE_API_URL_SUFFIX = "/zones/";
-   protected static final String DEFAULT_ZONE_NAME = "us-central1-a";
+   protected static final String DEFAULT_ZONE_NAME = "us-central1-f";
    protected static final String DEFAULT_REGION_NAME = "us-central1";
    protected static final String NETWORK_API_URL_SUFFIX = "/global/networks/";
    protected static final String MACHINE_TYPE_API_URL_SUFFIX = "/machineTypes/";


[09/50] [abbrv] jclouds git commit: Updates to Address, Disk, Image, Operations + others

Posted by na...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java
index 7a14a37..6306df2 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java
@@ -26,9 +26,12 @@ import javax.ws.rs.Consumes;
 import org.jclouds.googlecomputeengine.domain.Deprecated;
 import org.jclouds.googlecomputeengine.domain.Deprecated.State;
 import org.jclouds.googlecomputeengine.domain.Image;
+import org.jclouds.googlecomputeengine.domain.Image.Status;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
 import org.testng.annotations.Test;
 
+import com.google.common.collect.ImmutableList;
+
 @Test(groups = "unit", testName = "ParseImageTest")
 public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> {
 
@@ -47,6 +50,7 @@ public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> {
       return Image.create( //
             "12941197498378735318", // id
             URI.create(baseUrl + "/centos-cloud/global/images/centos-6-2-v20120326"), // selfLink
+            parse("2012-07-16T22:16:13.468"), // creationTimestamp
             "centos-6-2-v20120326", // name
             "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000", // description
             "RAW", // sourceType
@@ -57,6 +61,14 @@ public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> {
                   null, // deprecated
                   null, // obsolete
                   null // deleted
-            ));
+           ),
+           Status.READY, // status
+           Long.parseLong("881210631", 10), // archivedSizeBytes
+           Long.parseLong("8", 10), // diskSizeGb
+           baseUrl + "/party/zones/us-central1-a/disk/disk", // sourceDisk
+           "9598530021316715047", // sourceDiskId
+           ImmutableList.of(baseUrl + "/suse-cloud/global/licenses/sles-12") // license
+            );
+
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
index a4e9055..2e24e0c 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
@@ -23,9 +23,12 @@ import java.net.URI;
 import javax.ws.rs.Consumes;
 
 import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.Operation.Warning;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
 import org.testng.annotations.Test;
 
+import com.google.common.collect.ImmutableList;
+
 @Test(groups = "unit", testName = "ParseOperationTest")
 public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operation> {
 
@@ -43,6 +46,7 @@ public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operati
    public Operation expected(String baseUrl) {
       return Operation.create( //
             "13053095055850848306", // id
+            parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
             URI.create(baseUrl + "/party/zones/us-central1-a/operations/operation-1354084865060"),
             "operation-1354084865060", // name
             null, // description
@@ -56,10 +60,18 @@ public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operati
             parse("2012-11-28T06:41:05.060"), // insertTime
             parse("2012-11-28T06:41:05.142"), // startTime
             parse("2012-11-28T06:41:06.142"), // endTime
-            null, // httpErrorStatusCode
-            null, // httpErrorMessage
+            400, // httpErrorStatusCode
+            "BAD REQUEST", // httpErrorMessage
             "insert", // operationType
-            null, // errors
+            Operation.Error.create(ImmutableList.of(Operation.Error.Entry
+                  .create("INVALID_FIELD_VALUE", null,
+                        "Invalid value for field 'resource.urlMaps': "
+                        + "'projects/party/global/urlMaps/target-http-proxy-api-live-test-url-map-2'."
+                        + " Resource was not found."))), // errors
+            ImmutableList.of(Warning
+                  .create("NO_RESULTS_ON_PAGE", "This is an example warning",
+                  ImmutableList.of(Warning.Entry
+                        .create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))), // warnings
             URI.create(baseUrl + "/party/regions/us-central1"), // region
             URI.create(baseUrl + "/party/zones/us-central1-a") // zone
       );

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
index 9e20c6d..77dcfe9 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java
@@ -43,6 +43,7 @@ public class ParseRegionOperationTest extends BaseGoogleComputeEngineParseTest<O
    public Operation expected(String baseUrl) {
       return Operation.create( //
             "13053095055850848306", // id
+            parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
             URI.create(baseUrl + "/party/regions/us-central1/operations/operation-1354084865060"), // selfLink
             "operation-1354084865060", // name
             null, // description
@@ -60,6 +61,7 @@ public class ParseRegionOperationTest extends BaseGoogleComputeEngineParseTest<O
             null, // httpErrorMessage
             "insert", // operationType
             null, // errors
+            null, // warnings
             URI.create(baseUrl + "/party/regions/us-central1"), // region
             null // zone
       );

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneOperationTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneOperationTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneOperationTest.java
index 0c47de8..3a3b935 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneOperationTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneOperationTest.java
@@ -43,6 +43,7 @@ public class ParseZoneOperationTest extends BaseGoogleComputeEngineParseTest<Ope
    public Operation expected(String baseUrl) {
       return Operation.create( //
             "13053095055850848306", // id
+            parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
             URI.create(baseUrl + "/party/zones/us-central1-a/operations/operation-1354084865060"),
             "operation-1354084865060", // name
             null, // description
@@ -60,6 +61,7 @@ public class ParseZoneOperationTest extends BaseGoogleComputeEngineParseTest<Ope
             null, // httpErrorMessage
             "insert", // operationType
             null, // errors
+            null, // warnings
             null, // region
             URI.create(baseUrl + "/party/zones/us-central1-a") // zone
       );

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicatesTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicatesTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicatesTest.java
index f43bd8c..55eb837 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicatesTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicatesTest.java
@@ -27,6 +27,7 @@ import static org.testng.Assert.assertTrue;
 
 import java.net.URI;
 
+import org.jclouds.date.internal.SimpleDateFormatDateService;
 import org.jclouds.googlecomputeengine.domain.Firewall;
 import org.jclouds.net.domain.IpPermission;
 import org.jclouds.net.domain.IpProtocol;
@@ -42,6 +43,7 @@ public class NetworkFirewallPredicatesTest {
       return Firewall.create( //
             "abcd", // id
             URI.create(BASE_URL + "/party/global/firewalls/jclouds-test"), // selfLink
+            new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
             "jclouds-test", // name
             null, // description
             URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network
@@ -58,6 +60,7 @@ public class NetworkFirewallPredicatesTest {
       return Firewall.create( //
             "abcd", // id
             URI.create(BASE_URL + "/party/global/firewalls/jclouds-test"), // selfLink
+            new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
             "jclouds-test", // name
             null, // description
             URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/address_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/address_get.json b/providers/google-compute-engine/src/test/resources/address_get.json
index ea5f7e3..e7663e6 100644
--- a/providers/google-compute-engine/src/test/resources/address_get.json
+++ b/providers/google-compute-engine/src/test/resources/address_get.json
@@ -1,11 +1,14 @@
 {
-    "kind": "compute#address",
-    "id": "4439373783165447583",
-    "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
-    "status": "RESERVED",
-    "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
-    "name": "test-ip1",
-    "description": "",
-    "address": "173.255.115.190",
-    "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip1"
+  "kind": "compute#address",
+  "id": "4439373783165447583",
+  "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
+  "status": "IN_USE",
+  "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
+  "name": "test-ip1",
+  "description": "",
+  "address": "173.255.115.190",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip1",
+  "users": [
+    "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1-a/forwardingRules/test-forwarding-rule"
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/address_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/address_list.json b/providers/google-compute-engine/src/test/resources/address_list.json
index 2b53868..7f9d171 100644
--- a/providers/google-compute-engine/src/test/resources/address_list.json
+++ b/providers/google-compute-engine/src/test/resources/address_list.json
@@ -1,31 +1,32 @@
 {
-    "kind": "compute#addressList",
-    "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses",
-    "id": "projects/party/regions/us-central1/addresses",
-    "items": [
-        {
-
-            "kind": "compute#address",
-            "id": "4439373783165447583",
-            "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
-            "status": "RESERVED",
-            "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
-            "name": "test-ip1",
-            "description": "",
-            "address": "173.255.115.190",
-            "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip1"
-        },
-        {
-
-            "kind": "compute#address",
-            "id": "4881363978908129158",
-            "creationTimestamp": "2013-07-26T14:08:21.552-07:00",
-            "status": "RESERVED",
-            "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
-            "name": "test-ip2",
-            "description": "",
-            "address": "173.255.118.115",
-            "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip2"
-        }
-    ]
+  "kind": "compute#addressList",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses",
+  "id": "projects/party/regions/us-central1/addresses",
+  "items": [
+    {
+      "kind": "compute#address",
+      "id": "4439373783165447583",
+      "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
+      "status": "IN_USE",
+      "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
+      "name": "test-ip1",
+      "description": "",
+      "address": "173.255.115.190",
+      "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip1",
+      "users": [
+        "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1-a/forwardingRules/test-forwarding-rule"
+      ]
+    },
+    {
+      "kind": "compute#address",
+      "id": "4881363978908129158",
+      "creationTimestamp": "2013-07-26T14:08:21.552-07:00",
+      "status": "RESERVED",
+      "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
+      "name": "test-ip2",
+      "description": "",
+      "address": "173.255.118.115",
+      "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip2"
+    }
+  ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/aggregated_global_operation_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/aggregated_global_operation_list.json b/providers/google-compute-engine/src/test/resources/aggregated_global_operation_list.json
index 93f86c3..2ef24b5 100644
--- a/providers/google-compute-engine/src/test/resources/aggregated_global_operation_list.json
+++ b/providers/google-compute-engine/src/test/resources/aggregated_global_operation_list.json
@@ -80,6 +80,7 @@
       {
          "kind": "compute#operation",
          "id": "13053095055850848306",
+         "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
          "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060",
          "name": "operation-1354084865060",
          "targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/disk_insert_sourceImage.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/disk_insert_sourceImage.json b/providers/google-compute-engine/src/test/resources/disk_insert_sourceImage.json
deleted file mode 100644
index b2fddca..0000000
--- a/providers/google-compute-engine/src/test/resources/disk_insert_sourceImage.json
+++ /dev/null
@@ -1 +0,0 @@
-{"name":"testimage1","sizeGb":1,"sourceImage":"https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/images/foo"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/global_operation.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/global_operation.json b/providers/google-compute-engine/src/test/resources/global_operation.json
index f85b7ea..fc1086d 100644
--- a/providers/google-compute-engine/src/test/resources/global_operation.json
+++ b/providers/google-compute-engine/src/test/resources/global_operation.json
@@ -1,6 +1,7 @@
 {
    "kind": "compute#operation",
    "id": "13053095055850848306",
+   "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
    "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060",
    "name": "operation-1354084865060",
    "targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/global_operation_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/global_operation_list.json b/providers/google-compute-engine/src/test/resources/global_operation_list.json
index d5cede0..4be4783 100644
--- a/providers/google-compute-engine/src/test/resources/global_operation_list.json
+++ b/providers/google-compute-engine/src/test/resources/global_operation_list.json
@@ -6,6 +6,7 @@
       {
          "kind": "compute#operation",
          "id": "13053095055850848306",
+         "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
          "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060",
          "name": "operation-1354084865060",
          "targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/image_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/image_get.json b/providers/google-compute-engine/src/test/resources/image_get.json
index d31e4e7..3a0b0b1 100644
--- a/providers/google-compute-engine/src/test/resources/image_get.json
+++ b/providers/google-compute-engine/src/test/resources/image_get.json
@@ -1,17 +1,25 @@
 {
-   "kind": "compute#image",
-   "id": "12941197498378735318",
-   "creationTimestamp": "2012-07-16T22:16:13.468",
-   "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326",
-   "name": "centos-6-2-v20120326",
-   "description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
-   "sourceType": "RAW",
-   "deprecated": {
-      "state": "DEPRECATED",
-      "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104"
-   },
-   "rawDisk": {
-      "source": "",
-      "containerType": "TAR"
-   }
-}
+  "kind": "compute#image",
+  "id": "12941197498378735318",
+  "creationTimestamp": "2012-07-16T22:16:13.468",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326",
+  "name": "centos-6-2-v20120326",
+  "description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
+  "sourceType": "RAW",
+  "deprecated": {
+    "state": "DEPRECATED",
+    "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104"
+  },
+  "rawDisk": {
+    "source": "",
+    "containerType": "TAR"
+  },
+  "status": "READY",
+  "archiveSizeBytes": "881210631",
+  "diskSizeGb": "8",
+  "sourceDisk": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disk/disk",
+  "sourceDiskId": "9598530021316715047",
+  "licenses": [
+    "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/image_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/image_list.json b/providers/google-compute-engine/src/test/resources/image_list.json
index 6010f5a..0fc7194 100644
--- a/providers/google-compute-engine/src/test/resources/image_list.json
+++ b/providers/google-compute-engine/src/test/resources/image_list.json
@@ -1,24 +1,32 @@
 {
-   "kind": "compute#imageList",
-   "id": "projects/centos-cloud/global/images",
-   "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images",
-   "items": [
-      {
-         "kind": "compute#image",
-         "id": "12941197498378735318",
-         "creationTimestamp": "2012-07-16T22:16:13.468",
-         "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326",
-         "name": "centos-6-2-v20120326",
-         "description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
-         "sourceType": "RAW",
-         "deprecated": {
-            "state": "DEPRECATED",
-            "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104"
-         },
-         "rawDisk": {
-            "source": "",
-            "containerType": "TAR"
-         }
-      }
-   ]
-}
+  "kind": "compute#imageList",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images",
+  "id": "projects/centos-cloud/global/images",
+  "items": [
+    {
+      "kind": "compute#image",
+      "id": "12941197498378735318",
+      "creationTimestamp": "2012-07-16T22:16:13.468",
+      "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326",
+      "name": "centos-6-2-v20120326",
+      "description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
+      "sourceType": "RAW",
+      "deprecated": {
+        "state": "DEPRECATED",
+        "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104"
+      },
+      "rawDisk": {
+        "source": "",
+        "containerType": "TAR"
+      },
+      "status": "READY",
+      "archiveSizeBytes": "881210631",
+      "diskSizeGb": "8",
+      "sourceDisk": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disk/disk",
+      "sourceDiskId": "9598530021316715047",
+      "licenses": [
+        "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
+      ]
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/image_list_single_page.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/image_list_single_page.json b/providers/google-compute-engine/src/test/resources/image_list_single_page.json
index a9e0ffa..1bf13ba 100644
--- a/providers/google-compute-engine/src/test/resources/image_list_single_page.json
+++ b/providers/google-compute-engine/src/test/resources/image_list_single_page.json
@@ -1,50 +1,71 @@
 {
-   "kind": "compute#imageList",
-   "id": "projects/centos-cloud/global/images",
-   "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images",
-   "items": [
-      {
-         "kind": "compute#image",
-         "id": "13037722963789596520",
-         "creationTimestamp": "2012-11-09T11:43:28.749-08:00",
-         "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/gcel-10-04-v20121106",
-         "name": "gcel-10-04-v20121106",
-         "description": "SCSI-enabled GCEL 10.04 LTS; Created Tue, 06 Nov 2012 00:00:00 +0000",
-         "sourceType": "RAW",
-         "rawDisk": {
-            "source": "",
-            "containerType": "TAR"
-         }
-      },
-      {
-         "kind": "compute#image",
-         "id": "13037721421359523565",
-         "creationTimestamp": "2012-11-09T11:40:51.994-08:00",
-         "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718",
-         "name": "debian-7-wheezy-v20140718",
-         "description": "SCSI-enabled GCEL 12.04 LTS; Created Tue, 06 Nov 2012 00:00:00 +0000",
-         "sourceType": "RAW",
-         "rawDisk": {
-            "source": "",
-            "containerType": "TAR"
-         }
-      },
-      {
-         "kind": "compute#image",
-         "id": "12941198995845323366",
-         "creationTimestamp": "2012-07-16T15:18:50.405-07:00",
-         "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/ubuntu-10-04-v20110728",
-         "name": "ubuntu-10-04-v20110728",
-         "description": "DEPRECATED. GCEL 10.04 LTS; Created Thu, 28 Jul 2011 16:45:51 +0000",
-         "sourceType": "RAW",
-         "deprecated": {
-            "state": "DELETED",
-            "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/gcel-10-04-v20130104"
-         },
-         "rawDisk": {
-            "source": "",
-            "containerType": "TAR"
-         }
-      }
-   ]
-}
+ "kind": "compute#imageList",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images",
+ "id": "projects/centos-cloud/global/images",
+ "items": [
+  {
+
+   "kind": "compute#image",
+   "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20131120",
+   "id": "11748647391859510935",
+   "creationTimestamp": "2013-11-25T15:13:50.611-08:00",
+   "name": "centos-6-v20131120",
+   "description": "SCSI-enabled CentOS 6 built on 2013-11-20",
+   "sourceType": "RAW",
+   "rawDisk": {
+    "source": "",
+    "containerType": "TAR"
+   },
+   "deprecated": {
+    "state": "DEPRECATED",
+    "replacement": "https://content.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140318"
+   },
+   "status": "READY",
+   "archiveSizeBytes": "269993565",
+   "diskSizeGb": "10"
+  },
+  {
+
+   "kind": "compute#image",
+   "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140318",
+   "id": "11743140967858608122",
+   "creationTimestamp": "2014-03-19T15:01:13.388-07:00",
+   "name": "centos-6-v20140318",
+   "description": "CentOS 6.5 x86_64 built on 2014-03-18",
+   "sourceType": "RAW",
+   "rawDisk": {
+    "source": "",
+    "containerType": "TAR"
+   },
+   "deprecated": {
+    "state": "DEPRECATED",
+    "replacement": "https://content.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140408"
+   },
+   "status": "READY",
+   "archiveSizeBytes": "341230444",
+   "diskSizeGb": "10"
+  },
+  {
+
+   "kind": "compute#image",
+   "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140408",
+   "id": "18033188469723077298",
+   "creationTimestamp": "2014-04-09T10:31:57.518-07:00",
+   "name": "centos-6-v20140408",
+   "description": "CentOS 6.5 x86_64 built on 2014-04-08",
+   "sourceType": "RAW",
+   "rawDisk": {
+    "source": "",
+    "containerType": "TAR"
+   },
+   "deprecated": {
+    "state": "DEPRECATED",
+    "replacement": "https://content.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140415"
+   },
+   "status": "READY",
+   "archiveSizeBytes": "342252847",
+   "diskSizeGb": "10"
+  }
+ ],
+ "nextPageToken": "CkcIjf6H7sqqwgI6PAoCGAEKAiAACgIYAgoHIJT6lOrjDQoCGAYKFCoSY2VudG9zLTYtdjIwMTQwNDA4CgsgsrWOzOirsKH6AQ=="
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/operation.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/operation.json b/providers/google-compute-engine/src/test/resources/operation.json
index 9683b67..74b7b6f 100644
--- a/providers/google-compute-engine/src/test/resources/operation.json
+++ b/providers/google-compute-engine/src/test/resources/operation.json
@@ -1,17 +1,40 @@
 {
-   "kind": "compute#operation",
-   "id": "13053095055850848306",
-   "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
-   "name": "operation-1354084865060",
-   "targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",
-   "targetId": "13053094017547040099",
-   "status": "DONE",
-   "user": "user@developer.gserviceaccount.com",
-   "progress": 100,
-   "insertTime": "2012-11-28T06:41:05.060",
-   "startTime": "2012-11-28T06:41:05.142",
-   "endTime": "2012-11-28T06:41:06.142",
-   "operationType": "insert",
-   "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
-   "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a"
+  "kind": "compute#operation",
+  "id": "13053095055850848306",
+  "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
+  "name": "operation-1354084865060",
+  "targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",
+  "targetId": "13053094017547040099",
+  "status": "DONE",
+  "user": "user@developer.gserviceaccount.com",
+  "progress": 100,
+  "insertTime": "2012-11-28T06:41:05.060",
+  "startTime": "2012-11-28T06:41:05.142",
+  "endTime": "2012-11-28T06:41:06.142",
+  "operationType": "insert",
+  "error": {
+    "errors": [
+      {
+        "code": "INVALID_FIELD_VALUE",
+        "message": "Invalid value for field 'resource.urlMaps': 'projects/party/global/urlMaps/target-http-proxy-api-live-test-url-map-2'. Resource was not found."
+      }
+    ]
+  },
+  "warnings": [
+    {
+      "code": "NO_RESULTS_ON_PAGE",
+      "message": "This is an example warning",
+      "data": [
+        {
+          "key": "scope",
+          "value": "There are no results for scope 'zones/asia-east1-b' on this page."
+        }
+      ]
+    }
+  ],
+  "httpErrorStatusCode": 400,
+  "httpErrorMessage": "BAD REQUEST",
+  "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
+  "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a"
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/region_operation.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/region_operation.json b/providers/google-compute-engine/src/test/resources/region_operation.json
index d663466..9f8e6fa 100644
--- a/providers/google-compute-engine/src/test/resources/region_operation.json
+++ b/providers/google-compute-engine/src/test/resources/region_operation.json
@@ -1,6 +1,7 @@
 {
    "kind": "compute#operation",
    "id": "13053095055850848306",
+   "creationTimestamp": "2013-07-26T13:57:20.204-07:00",      
    "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/operations/operation-1354084865060",
    "name": "operation-1354084865060",
    "targetLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-address",

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/region_operation_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/region_operation_list.json b/providers/google-compute-engine/src/test/resources/region_operation_list.json
index 2e8baa3..b63ba6c 100644
--- a/providers/google-compute-engine/src/test/resources/region_operation_list.json
+++ b/providers/google-compute-engine/src/test/resources/region_operation_list.json
@@ -6,6 +6,7 @@
       {
          "kind": "compute#operation",
          "id": "13053095055850848306",
+         "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
          "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/operations/operation-1354084865060",
          "name": "operation-1354084865060",
          "targetLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-address",

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/zone_operation.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/zone_operation.json b/providers/google-compute-engine/src/test/resources/zone_operation.json
index 86acde4..4297784 100644
--- a/providers/google-compute-engine/src/test/resources/zone_operation.json
+++ b/providers/google-compute-engine/src/test/resources/zone_operation.json
@@ -1,6 +1,7 @@
 {
    "kind": "compute#operation",
    "id": "13053095055850848306",
+   "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
    "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
    "name": "operation-1354084865060",
    "targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6918ab10/providers/google-compute-engine/src/test/resources/zone_operation_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/zone_operation_list.json b/providers/google-compute-engine/src/test/resources/zone_operation_list.json
index 24fa451..8658e5a 100644
--- a/providers/google-compute-engine/src/test/resources/zone_operation_list.json
+++ b/providers/google-compute-engine/src/test/resources/zone_operation_list.json
@@ -6,6 +6,7 @@
       {
          "kind": "compute#operation",
          "id": "13053095055850848306",
+         "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
          "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
          "name": "operation-1354084865060",
          "targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",


[24/50] [abbrv] jclouds git commit: Split Auto dependencies into auto-service and auto-value

Posted by na...@apache.org.
Split Auto dependencies into auto-service and auto-value


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

Branch: refs/heads/master
Commit: 079b4d9c5caba86cae07c57b0a94f75e2b7b5b8a
Parents: da9bd0c
Author: Jeremy Daggett <je...@rackspace.com>
Authored: Wed Jan 14 16:11:28 2015 -0800
Committer: Jeremy Daggett <je...@rackspace.com>
Committed: Fri Jan 16 14:38:06 2015 -0800

----------------------------------------------------------------------
 providers/google-compute-engine/pom.xml | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/079b4d9c/providers/google-compute-engine/pom.xml
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/pom.xml b/providers/google-compute-engine/pom.xml
index c5837ff..2cf38fb 100644
--- a/providers/google-compute-engine/pom.xml
+++ b/providers/google-compute-engine/pom.xml
@@ -68,6 +68,11 @@
             <version>${jclouds.version}</version>
         </dependency>
         <dependency>
+            <groupId>com.google.auto.service</groupId>
+            <artifactId>auto-service</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>com.google.auto.value</groupId>
             <artifactId>auto-value</artifactId>
             <scope>provided</scope>


[08/50] [abbrv] jclouds git commit: New MockTests: Network, Operation, Region, Route, Snapshot

Posted by na...@apache.org.
New MockTests: Network, Operation, Region, Route, Snapshot


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

Branch: refs/heads/master
Commit: 1d3ad709d5b92fe6e7c54a0d0adc4dacdf0200f2
Parents: 3e9612a
Author: Daniel Broudy <br...@google.com>
Authored: Wed Dec 3 16:11:10 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Fri Dec 5 00:11:05 2014 +0100

----------------------------------------------------------------------
 .../features/NetworkApiExpectTest.java          | 153 -----------
 .../features/NetworkApiMockTest.java            |  87 ++++++
 .../features/OperationApiExpectTest.java        | 274 -------------------
 .../features/OperationApiMockTest.java          | 166 +++++++++++
 .../features/RegionApiExpectTest.java           |  89 ------
 .../features/RegionApiMockTest.java             |  63 +++++
 .../features/RouteApiExpectTest.java            | 162 -----------
 .../features/RouteApiMockTest.java              |  98 +++++++
 .../features/SnapshotApiExpectTest.java         |  89 ------
 .../features/SnapshotApiMockTest.java           |  79 ++++++
 .../parse/ParseGlobalOperationListTest.java     |   7 +-
 .../parse/ParseNetworkListTest.java             |   7 +-
 .../parse/ParseNetworkTest.java                 |   7 +-
 .../parse/ParseRegionListTest.java              |  11 +-
 .../parse/ParseRegionTest.java                  |  11 +-
 .../parse/ParseRouteListTest.java               |  13 +-
 .../parse/ParseRouteTest.java                   |  11 +-
 .../parse/ParseSnapshotListTest.java            |  11 +-
 .../parse/ParseSnapshotTest.java                |   9 +-
 19 files changed, 559 insertions(+), 788 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiExpectTest.java
deleted file mode 100644
index a4996bc..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiExpectTest.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseNetworkListTest;
-import org.jclouds.googlecomputeengine.parse.ParseNetworkTest;
-import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "NetworkApiExpectTest")
-public class NetworkApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public static final HttpRequest GET_NETWORK_REQUEST = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(BASE_URL + "/party/global/networks/jclouds-test")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse GET_NETWORK_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/network_get.json")).build();
-
-   public void testGetNetworkResponseIs2xx() throws Exception {
-
-      NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_NETWORK_REQUEST, GET_NETWORK_RESPONSE).networks();
-
-      assertEquals(api.get("jclouds-test"),
-              new ParseNetworkTest().expected());
-   }
-
-   public void testGetNetworkResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/global/networks/jclouds-test")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).networks();
-
-      assertNull(api.get("jclouds-test"));
-   }
-
-   public void testInsertNetworkResponseIs2xx() {
-      HttpRequest insert = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/global/networks")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/network_insert.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse insertNetworkResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/operation.json")).build();
-
-      NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, insert,
-              insertNetworkResponse).networks();
-
-      assertEquals(api.createInIPv4Range("test-network", "10.0.0.0/8"), new ParseOperationTest().expected());
-   }
-
-   public void testDeleteNetworkResponseIs2xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/global/networks/jclouds-test")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/operation.json")).build();
-
-      NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).networks();
-
-      assertEquals(api.delete("jclouds-test"),
-              new ParseOperationTest().expected());
-   }
-
-   public void testDeleteNetworkResponseIs4xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/global/networks/jclouds-test")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
-      NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).networks();
-
-      assertNull(api.delete("jclouds-test"));
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(BASE_URL + "/party/global/networks")
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void testListNetworksResponseIs2xx() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/network_list.json")).build();
-
-      NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).networks();
-
-      assertEquals(api.list().next(),
-              new ParseNetworkListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      NetworkApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE, list,
-            response).networks();
-
-      assertFalse(api.list().hasNext());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiMockTest.java
new file mode 100644
index 0000000..240ae07
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiMockTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseNetworkListTest;
+import org.jclouds.googlecomputeengine.parse.ParseNetworkTest;
+import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "NetworkApiMockTest", singleThreaded = true)
+public class NetworkApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/network_get.json"));
+
+      assertEquals(networkApi().get("jclouds-test"),
+            new ParseNetworkTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/networks/jclouds-test");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(networkApi().get("jclouds-test"));
+      assertSent(server, "GET", "/projects/party/global/networks/jclouds-test");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      assertEquals(networkApi().createInIPv4Range("test-network", "10.0.0.0/8"), new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/global/networks",
+            stringFromResource("/network_insert.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      assertEquals(networkApi().delete("jclouds-test"),
+            new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/global/networks/jclouds-test");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(networkApi().delete("jclouds-test"));
+      assertSent(server, "DELETE", "/projects/party/global/networks/jclouds-test");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/network_list.json"));
+
+      assertEquals(networkApi().list().next(), new ParseNetworkListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/networks");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(networkApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/global/networks");
+   }
+
+   NetworkApi networkApi(){
+      return api().networks();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/OperationApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/OperationApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/OperationApiExpectTest.java
deleted file mode 100644
index 5b5f4e1..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/OperationApiExpectTest.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.filter;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-
-import org.jclouds.googlecloud.domain.ForwardingListPage;
-import org.jclouds.googlecloud.domain.ListPage;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationListTest;
-import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
-import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
-import org.jclouds.googlecomputeengine.parse.ParseZoneOperationTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "OperationApiExpectTest")
-public class OperationApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   private static final String OPERATIONS_URL_PREFIX = BASE_URL + "/party/global/operations";
-   private static final String REGION_OPERATIONS_URL_PREFIX = BASE_URL + "/party/regions/us-central1/operations";
-   private static final String ZONE_OPERATIONS_URL_PREFIX = BASE_URL + "/party/zones/us-central1-a/operations";
-
-   public static final HttpRequest GET_GLOBAL_OPERATION_REQUEST = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(OPERATIONS_URL_PREFIX + "/operation-1354084865060")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse GET_GLOBAL_OPERATION_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/global_operation.json")).build();
-
-   public void get() throws Exception {
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_GLOBAL_OPERATION_REQUEST, GET_GLOBAL_OPERATION_RESPONSE).operations();
-
-      assertEquals(api.get(GET_GLOBAL_OPERATION_REQUEST.getEndpoint()),
-              new ParseGlobalOperationTest().expected());
-   }
-
-   public void getResponseIs4xx() throws Exception {
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_GLOBAL_OPERATION_REQUEST, response).operations();
-
-      assertNull(api.get(GET_GLOBAL_OPERATION_REQUEST.getEndpoint()));
-   }
-
-   public void delete() throws Exception {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(OPERATIONS_URL_PREFIX + "/operation-1352178598164-4cdcc9d031510-4aa46279")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(204).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, response).operations();
-
-      api.delete(delete.getEndpoint());
-   }
-
-   public void deleteResponseIs4xx() throws Exception {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(OPERATIONS_URL_PREFIX + "/operation-1352178598164-4cdcc9d031510-4aa46279")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, response).operations();
-
-      api.delete(delete.getEndpoint());
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(OPERATIONS_URL_PREFIX)
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void list() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/global_operation_list.json")).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).operations();
-
-      assertEquals(api.list().next(), new ParseGlobalOperationListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, list, response).operations();
-
-      assertFalse(api.list().hasNext());
-   }
-
-   public void listPageWithOptions() {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(OPERATIONS_URL_PREFIX +
-                      "?pageToken=CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcG" +
-                      "VyYXRpb24tMTM1MjI0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz&" +
-                      "filter=" +
-                      "status%20eq%20done&" +
-                      "maxResults=3")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/global_operation_list.json")).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).operations();
-
-      assertEquals(api.listPage("CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1Mj" +
-              "I0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz",
-              filter("status eq done").maxResults(3)),
-              new ParseGlobalOperationListTest().expected());
-   }
-
-   private ListPage<Operation> regionList() {
-      return ForwardingListPage.create( //
-            ImmutableList.of(new ParseRegionOperationTest().expected()), // items
-            null // nextPageToken
-      );
-   }
-
-   HttpRequest listInRegion = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(REGION_OPERATIONS_URL_PREFIX)
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void listInRegion() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation_list.json")).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, listInRegion, response).operations();
-
-      assertEquals(api.listInRegion("us-central1").next(), regionList());
-   }
-
-   public void listInRegionEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, listInRegion, response).operations();
-
-      assertFalse(api.listInRegion("us-central1").hasNext());
-   }
-
-   public void listPageInRegion() {
-      HttpRequest get = HttpRequest
-            .builder()
-            .method("GET")
-            .endpoint(REGION_OPERATIONS_URL_PREFIX +
-                  "?pageToken=CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcG" +
-                  "VyYXRpb24tMTM1MjI0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz&" +
-                  "filter=" +
-                  "status%20eq%20done&" +
-                  "maxResults=3")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation_list.json")).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, get, response).operations();
-
-      assertEquals(api.listPageInRegion("us-central1",
-                  "CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1MjI0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz",
-                  filter("status eq done").maxResults(3)).toString(), regionList().toString());
-   }
-
-   private ListPage<Operation> zoneList() {
-      return ForwardingListPage.create( //
-            ImmutableList.of(new ParseZoneOperationTest().expected()), // items
-            null // nextPageToken
-      );
-   }
-
-   HttpRequest listInZone = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(ZONE_OPERATIONS_URL_PREFIX)
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void listInZone() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/zone_operation_list.json")).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, listInZone, response).operations();
-
-      assertEquals(api.listInZone("us-central1-a").next(), zoneList());
-   }
-
-   public void listInZoneEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, listInZone, response).operations();
-
-      assertFalse(api.listInZone("us-central1-a").hasNext());
-   }
-
-   public void listPageInZone() {
-      HttpRequest get = HttpRequest
-            .builder()
-            .method("GET")
-            .endpoint(ZONE_OPERATIONS_URL_PREFIX +
-                  "?pageToken=CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcG" +
-                  "VyYXRpb24tMTM1MjI0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz&" +
-                  "filter=" +
-                  "status%20eq%20done&" +
-                  "maxResults=3")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/zone_operation_list.json")).build();
-
-      OperationApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, get, response).operations();
-
-      assertEquals(api.listPageInZone("us-central1-a",
-            "CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1MjI0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz",
-            filter("status eq done").maxResults(3)).toString(), zoneList().toString());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/OperationApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/OperationApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/OperationApiMockTest.java
new file mode 100644
index 0000000..3c4caa8
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/OperationApiMockTest.java
@@ -0,0 +1,166 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.filter;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+
+import java.net.URI;
+
+import org.jclouds.googlecloud.domain.ForwardingListPage;
+import org.jclouds.googlecloud.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationListTest;
+import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseZoneOperationTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.squareup.okhttp.mockwebserver.MockResponse;
+
+@Test(groups = "unit", testName = "OperationApiMockTest", singleThreaded = true)
+public class OperationApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/global_operation.json"));
+
+      assertEquals(operationApi().get(URI.create(url("/projects/party/global/operations/operation-1354084865060"))),
+            new ParseGlobalOperationTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/operations/operation-1354084865060");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(operationApi().get(URI.create(url("/projects/party/global/operations/operation-1354084865060"))));
+      assertSent(server, "GET", "/projects/party/global/operations/operation-1354084865060");
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(new MockResponse().setBody(""));
+
+      operationApi().delete(URI.create(url("/projects/party/global/operations/operation-1352178598164-4cdcc9d031510-4aa46279")));
+      assertSent(server, "DELETE", "/projects/party/global/operations/operation-1352178598164-4cdcc9d031510-4aa46279");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      operationApi().delete(URI.create(url("/projects/party/global/operations/operation-1352178598164-4cdcc9d031510-4aa46279")));
+      assertSent(server, "DELETE", "/projects/party/global/operations/operation-1352178598164-4cdcc9d031510-4aa46279");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/global_operation_list.json"));
+
+      assertEquals(operationApi().list().next(), new ParseGlobalOperationListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/operations");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(operationApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/global/operations");
+   }
+
+   public void listPage_options() throws Exception {
+      server.enqueue(jsonResponse("/global_operation_list.json"));
+
+      assertEquals(operationApi().listPage("CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1Mj" +
+            "I0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz",
+            filter("status eq done").maxResults(3)), new ParseGlobalOperationListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/operations?pageToken=CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcG" +
+                      "VyYXRpb24tMTM1MjI0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz&" +
+                      "filter=status%20eq%20done&maxResults=3");
+   }
+
+   private ListPage<Operation> regionList() {
+      return ForwardingListPage.create( //
+            ImmutableList.of(new ParseRegionOperationTest().expected(url("/projects"))), // items
+            null // nextPageToken
+      );
+   }
+
+   public void listInRegion() throws Exception {
+      server.enqueue(jsonResponse("/region_operation_list.json"));
+
+      assertEquals(operationApi().listInRegion("us-central1").next(), regionList());
+      assertSent(server, "GET", "/projects/party/regions/us-central1/operations");
+   }
+
+   public void listInRegion_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(operationApi().listInRegion("us-central1").hasNext());
+      assertSent(server, "GET", "/projects/party/regions/us-central1/operations");
+   }
+
+   public void listPageInRegion() throws Exception {
+      server.enqueue(jsonResponse("/region_operation_list.json"));
+
+      assertEquals(operationApi().listPageInRegion("us-central1", "CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1MjI0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz",
+            filter("status eq done").maxResults(3)).toString(), regionList().toString());
+      assertSent(server, "GET", "/projects/party/regions/us-central1/operations?pageToken=CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcG" +
+                  "VyYXRpb24tMTM1MjI0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz&" +
+                  "filter=" +
+                  "status%20eq%20done&" +
+                  "maxResults=3");
+   }
+
+   private ListPage<Operation> zoneList() {
+      return ForwardingListPage.create( //
+            ImmutableList.of(new ParseZoneOperationTest().expected(url("/projects"))), // items
+            null // nextPageToken
+      );
+   }
+
+   public void listInZone() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation_list.json"));
+
+      assertEquals(operationApi().listInZone("us-central1-a").next(), zoneList());
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations");
+   }
+
+   public void listInZone_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(operationApi().listInZone("us-central1-a").hasNext());
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations");
+   }
+
+   public void listPageInZone() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation_list.json"));
+
+      assertEquals(operationApi().listPageInZone("us-central1-a",
+            "CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1MjI0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz",
+            filter("status eq done").maxResults(3)).toString(), zoneList().toString());
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations?pageToken=CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcG" +
+                  "VyYXRpb24tMTM1MjI0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz&" +
+                  "filter=" +
+                  "status%20eq%20done&" +
+                  "maxResults=3");
+   }
+
+   OperationApi operationApi(){
+      return api().operations();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiExpectTest.java
deleted file mode 100644
index 86273da..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiExpectTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseRegionListTest;
-import org.jclouds.googlecomputeengine.parse.ParseRegionTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "RegionApiExpectTest")
-public class RegionApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public static final String REGIONS_URL_PREFIX = BASE_URL + "/party/regions";
-
-   public static final HttpRequest GET_REGION_REQ = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(REGIONS_URL_PREFIX + "/us-central1")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpRequest LIST_REGIONS_REQ = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(REGIONS_URL_PREFIX)
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse LIST_REGIONS_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/region_list.json")).build();
-
-   public void testGetRegionResponseIs2xx() throws Exception {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/region_get.json")).build();
-
-      RegionApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_REGION_REQ, response).regions();
-
-      assertEquals(api.get("us-central1"), new ParseRegionTest().expected());
-   }
-
-   public void testGetRegionResponseIs4xx() throws Exception {
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      RegionApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_REGION_REQ, response).regions();
-
-      assertNull(api.get("us-central1"));
-   }
-
-   public void list() throws Exception {
-      RegionApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, LIST_REGIONS_REQ, LIST_REGIONS_RESPONSE).regions();
-
-      assertEquals(api.list().next(), new ParseRegionListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      RegionApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, LIST_REGIONS_REQ, response).regions();
-
-      assertFalse(api.list().hasNext());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiMockTest.java
new file mode 100644
index 0000000..7312eca
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiMockTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+
+import org.jclouds.googlecomputeengine.parse.ParseRegionListTest;
+import org.jclouds.googlecomputeengine.parse.ParseRegionTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "RegionApiMockTest", singleThreaded = true)
+public class RegionApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/region_get.json"));
+
+      assertEquals(regionApi().get("us-central1"), new ParseRegionTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/regions/us-central1");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(regionApi().get("us-central1"));
+      assertSent(server, "GET", "/projects/party/regions/us-central1");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/region_list.json"));
+
+      assertEquals(regionApi().list().next(), new ParseRegionListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/regions");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(regionApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/regions");
+   }
+
+   RegionApi regionApi() {
+      return api().regions();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java
deleted file mode 100644
index abeeb5f..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.net.URI;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.options.RouteOptions;
-import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
-import org.jclouds.googlecomputeengine.parse.ParseRouteListTest;
-import org.jclouds.googlecomputeengine.parse.ParseRouteTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "RouteApiExpectTest")
-public class RouteApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public void testGetRouteResponseIs2xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/global/routes/default-route-c99ebfbed0e1f375")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/route_get.json")).build();
-
-      RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).routes();
-
-      assertEquals(api.get("default-route-c99ebfbed0e1f375"),
-              new ParseRouteTest().expected());
-   }
-
-   public void testGetRouteResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/global/routes/default-route-c99ebfbed0e1f375")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).routes();
-
-      assertNull(api.get("default-route-c99ebfbed0e1f375"));
-   }
-
-   public void testInsertRouteResponseIs2xx() {
-      HttpRequest insert = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/global/routes")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/route_insert.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse insertRouteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/global_operation.json")).build();
-
-      RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, insert,
-              insertRouteResponse).routes();
-
-      assertEquals(api.createInNetwork("default-route-c99ebfbed0e1f375",
-              URI.create(BASE_URL + "/party/global/networks/default"),
-              new RouteOptions().addTag("fooTag")
-                      .addTag("barTag")
-                      .description("Default route to the virtual network.")
-              .destRange("10.240.0.0/16")
-              .priority(1000)
-              .nextHopNetwork(URI.create(BASE_URL + "/party/global/networks/default"))
-      ), new ParseGlobalOperationTest().expected());
-   }
-
-   public void testDeleteRouteResponseIs2xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/global/routes/default-route-c99ebfbed0e1f375")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/global_operation.json")).build();
-
-      RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).routes();
-
-      assertEquals(api.delete("default-route-c99ebfbed0e1f375"),
-              new ParseGlobalOperationTest().expected());
-   }
-
-   public void testDeleteRouteResponseIs4xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/global/routes/default-route-c99ebfbed0e1f375")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
-      RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).routes();
-
-      assertNull(api.delete("default-route-c99ebfbed0e1f375"));
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(BASE_URL + "/party/global/routes")
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void list() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/route_list.json")).build();
-
-      RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).routes();
-
-      assertEquals(api.list().next(), new ParseRouteListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).routes();
-
-      assertFalse(api.list().hasNext());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiMockTest.java
new file mode 100644
index 0000000..c9d94b9
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiMockTest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+
+import java.net.URI;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.RouteOptions;
+import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseRouteListTest;
+import org.jclouds.googlecomputeengine.parse.ParseRouteTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "RouteApiMockTest", singleThreaded = true)
+public class RouteApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/route_get.json"));
+
+      assertEquals(routeApi().get("default-route-c99ebfbed0e1f375"),
+            new ParseRouteTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/routes/default-route-c99ebfbed0e1f375");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(routeApi().get("default-route-c99ebfbed0e1f375"));
+      assertSent(server, "GET", "/projects/party/global/routes/default-route-c99ebfbed0e1f375");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/global_operation.json"));
+
+      assertEquals(routeApi().createInNetwork("default-route-c99ebfbed0e1f375",
+            URI.create(url("/projects/party/global/networks/default")),
+            new RouteOptions().addTag("fooTag")
+                    .addTag("barTag")
+                    .description("Default route to the virtual network.")
+            .destRange("10.240.0.0/16")
+            .priority(1000)
+            .nextHopNetwork(URI.create(url("/projects/party/global/networks/default")))),
+            new ParseGlobalOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/global/routes",
+            stringFromResource("/route_insert.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/global_operation.json"));
+
+      assertEquals(routeApi().delete("default-route-c99ebfbed0e1f375"),
+            new ParseGlobalOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/global/routes/default-route-c99ebfbed0e1f375");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(routeApi().delete("default-route-c99ebfbed0e1f375"));
+      assertSent(server, "DELETE", "/projects/party/global/routes/default-route-c99ebfbed0e1f375");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/route_list.json"));
+
+      assertEquals(routeApi().list().next(), new ParseRouteListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/routes");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(routeApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/global/routes");
+   }
+
+   RouteApi routeApi() {
+      return api().routes();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java
deleted file mode 100644
index 2465809..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseSnapshotListTest;
-import org.jclouds.googlecomputeengine.parse.ParseSnapshotTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "SnapshotApiExpectTest")
-public class SnapshotApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public static final String SNAPSHOT_URL_PREFIX = BASE_URL + "/party/global/snapshots";
-
-   public static final HttpRequest GET_SNAPSHOT_REQ = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(SNAPSHOT_URL_PREFIX + "/test-snap")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpRequest LIST_SNAPSHOTS_REQ = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(SNAPSHOT_URL_PREFIX)
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse LIST_SNAPSHOTS_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/snapshot_list.json")).build();
-
-   public void testGetSnapshotResponseIs2xx() throws Exception {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/snapshot_get.json")).build();
-
-      SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_SNAPSHOT_REQ, response).snapshots();
-
-      assertEquals(api.get("test-snap"),
-              new ParseSnapshotTest().expected());
-   }
-
-   public void testGetSnapshotResponseIs4xx() throws Exception {
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_SNAPSHOT_REQ, response).snapshots();
-
-      assertNull(api.get("test-snap"));
-   }
-
-   public void list() throws Exception {
-      SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, LIST_SNAPSHOTS_REQ, LIST_SNAPSHOTS_RESPONSE).snapshots();
-
-      assertEquals(api.list().next(), new ParseSnapshotListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, LIST_SNAPSHOTS_REQ, response).snapshots();
-
-      assertFalse(api.list().hasNext());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiMockTest.java
new file mode 100644
index 0000000..9379f7a
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiMockTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseSnapshotListTest;
+import org.jclouds.googlecomputeengine.parse.ParseSnapshotTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "SnapshotApiMockTest", singleThreaded = true)
+public class SnapshotApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/snapshot_get.json"));
+
+      assertEquals(snapshotApi().get("test-snap"),
+            new ParseSnapshotTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/snapshots/test-snap");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(snapshotApi().get("test-snap"));
+      assertSent(server, "GET", "/projects/party/global/snapshots/test-snap");
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/global_operation.json"));
+
+      assertEquals(snapshotApi().delete("test-snap"),
+            new ParseGlobalOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/global/snapshots/test-snap");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(snapshotApi().delete("test-snap"));
+      assertSent(server, "DELETE", "/projects/party/global/snapshots/test-snap");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/snapshot_list.json"));
+
+      assertEquals(snapshotApi().list().next(), new ParseSnapshotListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/snapshots");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(snapshotApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/global/snapshots");
+   }
+
+   SnapshotApi snapshotApi() {
+      return api().snapshots();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationListTest.java
index d071a48..1a837ea 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseGlobalOperationListTest.java
@@ -38,8 +38,13 @@ public class ParseGlobalOperationListTest extends BaseGoogleComputeEngineParseTe
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<Operation> expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<Operation> expected(String baseUrl) {
       return ForwardingListPage.create( //
-            ImmutableList.of(new ParseGlobalOperationTest().expected()), // items
+            ImmutableList.of(new ParseGlobalOperationTest().expected(baseUrl)), // items
             null // nextPageToken
       );
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java
index fdb8e9f..f6d92fa 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java
@@ -38,8 +38,13 @@ public class ParseNetworkListTest extends BaseGoogleComputeEngineParseTest<ListP
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<Network> expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<Network> expected(String baseUrl) {
       return ForwardingListPage.create( //
-            ImmutableList.of(new ParseNetworkTest().expected()), // items
+            ImmutableList.of(new ParseNetworkTest().expected(baseUrl)), // items
             null // nextPageToken
       );
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
index 310b5ca..5b92ed3 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
@@ -36,9 +36,14 @@ public class ParseNetworkTest extends BaseGoogleComputeEngineParseTest<Network>
 
    @Override @Consumes(APPLICATION_JSON)
    public Network expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Network expected(String baseUrl) {
       return Network.create( //
             "13024414170909937976", // id
-            URI.create(BASE_URL + "/party/networks/jclouds-test"), // selfLink
+            URI.create(baseUrl + "/party/networks/jclouds-test"), // selfLink
             "default", // name
             "Default network for the project", // description
             "10.0.0.0/8", // rangeIPv4

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java
index 846410a..5f83a5b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java
@@ -41,14 +41,19 @@ public class ParseRegionListTest extends BaseGoogleComputeEngineParseTest<ListPa
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<Region> expected() {
-      Region region1 = new ParseRegionTest().expected();
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<Region> expected(String baseUrl) {
+      Region region1 = new ParseRegionTest().expected(baseUrl);
       Region region2 = Region.create( //
             "6396763663251190992", // id
-            URI.create(BASE_URL + "/party/regions/us-central2"), // selfLink
+            URI.create(baseUrl + "/party/regions/us-central2"), // selfLink
             "us-central2", // name
             "us-central2", // description
             Region.Status.UP, // status
-            ImmutableList.of(URI.create(BASE_URL + "/party/zones/us-central2-a")), // zones
+            ImmutableList.of(URI.create(baseUrl + "/party/zones/us-central2-a")), // zones
             ImmutableList.of( //
                   Quota.create("INSTANCES", 0, 8), //
                   Quota.create("CPUS", 0, 8), //

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java
index fab2746..6a81a90 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java
@@ -39,15 +39,20 @@ public class ParseRegionTest extends BaseGoogleComputeEngineParseTest<Region> {
 
    @Override @Consumes(APPLICATION_JSON)
    public Region expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Region expected(String baseUrl) {
       return Region.create( //
             "12912210600542709766", // id
-            URI.create(BASE_URL + "/party/regions/us-central1"), // selfLink
+            URI.create(baseUrl + "/party/regions/us-central1"), // selfLink
             "us-central1", // name
             "us-central1", // description
             Region.Status.UP, // status
             ImmutableList.of(//
-                  URI.create(BASE_URL + "/party/zones/us-central1-a"),
-                  URI.create(BASE_URL + "/party/zones/us-central1-b")), // zones
+                  URI.create(baseUrl + "/party/zones/us-central1-a"),
+                  URI.create(baseUrl + "/party/zones/us-central1-b")), // zones
             ImmutableList.of( //
                   Quota.create("INSTANCES", 0, 8), //
                   Quota.create("CPUS", 0, 8), //

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
index 9eb18f9..8235ec7 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
@@ -39,20 +39,25 @@ public class ParseRouteListTest extends BaseGoogleComputeEngineParseTest<ListPag
 
    @Override @Consumes(MediaType.APPLICATION_JSON)
    public ListPage<Route> expected() {
-      Route route1 = new ParseRouteTest().expected();
+      return expected(BASE_URL);
+   }
+
+   @Consumes(MediaType.APPLICATION_JSON)
+   public ListPage<Route> expected(String baseUrl) {
+      Route route1 = new ParseRouteTest().expected(baseUrl);
       Route route2 = Route.create( //
             "507025480040058551", // id
-            URI.create(BASE_URL + "/party/global/routes/default-route-fc92a41ecb5a8d17"), // selfLink
+            URI.create(baseUrl + "/party/global/routes/default-route-fc92a41ecb5a8d17"), // selfLink
             "default-route-fc92a41ecb5a8d17", // name
             "Default route to the Internet.", // description
-            URI.create(BASE_URL + "/party/global/networks/default"), // network
+            URI.create(baseUrl + "/party/global/networks/default"), // network
             null, // tags
             "0.0.0.0/0", // destRange
             1000, // priority
             null, // nextHopInstance
             null, // nextHopIp
             null, // nextHopNetwork
-            URI.create(BASE_URL + "/party/global/gateways/default-internet-gateway"), // nextHopGateway
+            URI.create(baseUrl + "/party/global/gateways/default-internet-gateway"), // nextHopGateway
             null // warnings
       );
       return ForwardingListPage.create( //

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
index b5f0c42..0dd5ba4 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
@@ -38,18 +38,23 @@ public class ParseRouteTest extends BaseGoogleComputeEngineParseTest<Route> {
 
    @Override @Consumes(APPLICATION_JSON)
    public Route expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Route expected(String baseUrl) {
       return Route.create( //
             "7241926205630356071", // id
-            URI.create(BASE_URL + "/party/global/routes/default-route-c99ebfbed0e1f375"), // selfLink
+            URI.create(baseUrl + "/party/global/routes/default-route-c99ebfbed0e1f375"), // selfLink
             "default-route-c99ebfbed0e1f375", // name
             "Default route to the virtual network.", // description
-            URI.create(BASE_URL + "/party/global/networks/default"), // network
+            URI.create(baseUrl + "/party/global/networks/default"), // network
             ImmutableList.of("fooTag", "barTag"), // tags
             "10.240.0.0/16", // destRange
             1000, // priority
             null, // nextHopInstance
             null, // nextHopIp
-            URI.create(BASE_URL + "/party/global/networks/default"), // nextHopNetwork
+            URI.create(baseUrl + "/party/global/networks/default"), // nextHopNetwork
             null, // nextHopGateway
             null // warnings
       );

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java
index 76e32e3..6cd691a 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java
@@ -40,15 +40,20 @@ public class ParseSnapshotListTest extends BaseGoogleComputeEngineParseTest<List
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<Snapshot> expected() {
-      Snapshot snapshot1 = new ParseSnapshotTest().expected();
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<Snapshot> expected(String baseUrl) {
+      Snapshot snapshot1 = new ParseSnapshotTest().expected(baseUrl);
       Snapshot snapshot2 = Snapshot.create( //
             "13895715048576107883", // id
-            URI.create(BASE_URL + "/party/global/snapshots/test-snap2"), // selfLink
+            URI.create(baseUrl + "/party/global/snapshots/test-snap2"), // selfLink
             "test-snap2", // name
             "", // description
             10, // sizeGb
             "READY", // status
-            URI.create(BASE_URL + "/party/zones/us-central1-a/disks/testimage1"), // sourceDisk
+            URI.create(baseUrl + "/party/zones/us-central1-a/disks/testimage1"), // sourceDisk
             "8243603669926824540"// sourceDiskId
       );
       return ForwardingListPage.create( //

http://git-wip-us.apache.org/repos/asf/jclouds/blob/1d3ad709/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java
index 77f39e0..3247934 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java
@@ -36,14 +36,19 @@ public class ParseSnapshotTest extends BaseGoogleComputeEngineParseTest<Snapshot
 
    @Override @Consumes(APPLICATION_JSON)
    public Snapshot expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Snapshot expected(String baseUrl) {
       return Snapshot.create( //
             "9734455566806191190", // id
-            URI.create(BASE_URL + "/party/global/snapshots/test-snap"), // selfLink
+            URI.create(baseUrl + "/party/global/snapshots/test-snap"), // selfLink
             "test-snap", // name
             "", // description
             10, // sizeGb
             "READY", // status
-            URI.create(BASE_URL + "/party/zones/us-central1-a/disks/testimage1"), // sourceDisk
+            URI.create(baseUrl + "/party/zones/us-central1-a/disks/testimage1"), // sourceDisk
             "8243603669926824540"// sourceDiskId
       );
    }


[16/50] [abbrv] jclouds git commit: Bug fixes related to LiveTest failures

Posted by na...@apache.org.
Bug fixes related to LiveTest failures


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

Branch: refs/heads/master
Commit: 3db5cef592561190109acb142af701b1bd07a0bb
Parents: f81e44c
Author: Daniel Broudy <br...@google.com>
Authored: Fri Dec 12 17:01:52 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Dec 15 23:03:36 2014 +0100

----------------------------------------------------------------------
 .../compute/functions/InstanceToNodeMetadata.java             | 3 ++-
 .../org/jclouds/googlecomputeengine/domain/NewInstance.java   | 7 ++++---
 .../src/test/resources/instance_insert.json                   | 4 +++-
 .../src/test/resources/instance_insert_2.json                 | 4 +++-
 .../src/test/resources/instance_insert_simple.json            | 6 ++++--
 5 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/3db5cef5/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
index eed9872..5562b48 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
@@ -30,6 +30,7 @@ import org.jclouds.collect.Memoized;
 import org.jclouds.compute.domain.Hardware;
 import org.jclouds.compute.domain.NodeMetadata;
 import org.jclouds.compute.domain.NodeMetadataBuilder;
+import org.jclouds.compute.domain.NodeMetadata.Status;
 import org.jclouds.compute.functions.GroupNamingConvention;
 import org.jclouds.domain.Location;
 import org.jclouds.googlecomputeengine.domain.Instance;
@@ -95,7 +96,7 @@ public final class InstanceToNodeMetadata implements Function<Instance, NodeMeta
              .location(zone)
              .imageId(bootImage != null ? bootImage.toString() : null)
              .hardware(hardwares.get().get(input.machineType()))
-             .status(toPortableNodeStatus.get(input.status()))
+             .status(input.status() != null ? toPortableNodeStatus.get(input.status()) : Status.UNRECOGNIZED)
              .tags(input.tags().items())
              .uri(input.selfLink())
              .userMetadata(input.metadata().asMap())

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3db5cef5/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
index fb45764..57b22a8 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
+import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig.Type;
 import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
 import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
 import org.jclouds.javax.annotation.Nullable;
@@ -38,14 +39,14 @@ public abstract class NewInstance {
    abstract static class NetworkInterface {
       abstract URI network();
 
-      abstract List<AccessConfig.Type> accessConfigs();
+      abstract List<AccessConfig> accessConfigs();
 
       static NetworkInterface create(URI network) {
-         return create(network, Arrays.asList(AccessConfig.Type.ONE_TO_ONE_NAT));
+         return create(network, Arrays.asList(AccessConfig.create(null, Type.ONE_TO_ONE_NAT, null)));
       }
 
       @SerializedNames({ "network", "accessConfigs" })
-      static NetworkInterface create(URI network, List<AccessConfig.Type> accessConfigs) {
+      static NetworkInterface create(URI network, List<AccessConfig> accessConfigs) {
          return new AutoValue_NewInstance_NetworkInterface(network, accessConfigs);
       }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3db5cef5/providers/google-compute-engine/src/test/resources/instance_insert.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_insert.json b/providers/google-compute-engine/src/test/resources/instance_insert.json
index b26eb06..cc86f84 100644
--- a/providers/google-compute-engine/src/test/resources/instance_insert.json
+++ b/providers/google-compute-engine/src/test/resources/instance_insert.json
@@ -5,7 +5,9 @@
     {
       "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
       "accessConfigs": [
-        "ONE_TO_ONE_NAT"
+        {
+          "type": "ONE_TO_ONE_NAT"
+        }
       ]
     }
   ],

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3db5cef5/providers/google-compute-engine/src/test/resources/instance_insert_2.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_insert_2.json b/providers/google-compute-engine/src/test/resources/instance_insert_2.json
index 99adbfe..78002a6 100644
--- a/providers/google-compute-engine/src/test/resources/instance_insert_2.json
+++ b/providers/google-compute-engine/src/test/resources/instance_insert_2.json
@@ -5,7 +5,9 @@
     {
       "network": "https://www.googleapis.com/compute/v1/projects/party/networks/jclouds-test",
       "accessConfigs": [
-        "ONE_TO_ONE_NAT"
+        {
+          "type": "ONE_TO_ONE_NAT"
+        }
       ]
     }
   ],

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3db5cef5/providers/google-compute-engine/src/test/resources/instance_insert_simple.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_insert_simple.json b/providers/google-compute-engine/src/test/resources/instance_insert_simple.json
index c140522..4012c0f 100644
--- a/providers/google-compute-engine/src/test/resources/instance_insert_simple.json
+++ b/providers/google-compute-engine/src/test/resources/instance_insert_simple.json
@@ -5,7 +5,9 @@
     {
       "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
       "accessConfigs": [
-        "ONE_TO_ONE_NAT"
+        {
+          "type": "ONE_TO_ONE_NAT"
+        }
       ]
     }
   ],
@@ -25,4 +27,4 @@
   "metadata": {
     "items": []
   }
-}
+}
\ No newline at end of file


[20/50] [abbrv] jclouds git commit: Removed the SecurityGroupExtension

Posted by na...@apache.org.
Removed the SecurityGroupExtension


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

Branch: refs/heads/master
Commit: 2ba48dc9f66416b5d8515bd6a07b27a213d89a7c
Parents: d6d1e7d
Author: Ignasi Barrera <na...@apache.org>
Authored: Tue Dec 23 18:28:45 2014 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Jan 5 13:55:28 2015 +0100

----------------------------------------------------------------------
 ...GoogleComputeEngineServiceContextModule.java |  15 +-
 ...ogleComputeEngineSecurityGroupExtension.java | 334 -------------------
 .../functions/FirewallToIpPermission.java       |  67 ----
 .../functions/NetworkToSecurityGroup.java       |  67 ----
 .../predicates/NetworkFirewallPredicates.java   | 125 -------
 ...uteEngineSecurityGroupExtensionLiveTest.java |  35 --
 .../functions/FirewallToIpPermissionTest.java   |  93 ------
 .../functions/NetworkToSecurityGroupTest.java   |  85 -----
 .../NetworkFirewallPredicatesTest.java          | 162 ---------
 9 files changed, 1 insertion(+), 982 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ba48dc9/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
index b99ef02..8eaeaa9 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
@@ -39,7 +39,6 @@ import org.jclouds.compute.ComputeServiceAdapter;
 import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
 import org.jclouds.compute.domain.Hardware;
 import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.SecurityGroup;
 import org.jclouds.compute.extensions.ImageExtension;
 import org.jclouds.compute.extensions.SecurityGroupExtension;
 import org.jclouds.compute.options.TemplateOptions;
@@ -47,15 +46,12 @@ import org.jclouds.domain.Location;
 import org.jclouds.googlecomputeengine.compute.GoogleComputeEngineService;
 import org.jclouds.googlecomputeengine.compute.GoogleComputeEngineServiceAdapter;
 import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
-import org.jclouds.googlecomputeengine.compute.extensions.GoogleComputeEngineSecurityGroupExtension;
 import org.jclouds.googlecomputeengine.compute.functions.CreateNetworkIfNeeded;
 import org.jclouds.googlecomputeengine.compute.functions.FindNetworkOrCreate;
 import org.jclouds.googlecomputeengine.compute.functions.FirewallTagNamingConvention;
-import org.jclouds.googlecomputeengine.compute.functions.FirewallToIpPermission;
 import org.jclouds.googlecomputeengine.compute.functions.GoogleComputeEngineImageToImage;
 import org.jclouds.googlecomputeengine.compute.functions.InstanceToNodeMetadata;
 import org.jclouds.googlecomputeengine.compute.functions.MachineTypeToHardware;
-import org.jclouds.googlecomputeengine.compute.functions.NetworkToSecurityGroup;
 import org.jclouds.googlecomputeengine.compute.functions.OrphanedGroupsFromDeadNodes;
 import org.jclouds.googlecomputeengine.compute.functions.Resources;
 import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
@@ -63,7 +59,6 @@ import org.jclouds.googlecomputeengine.compute.predicates.AllNodesInGroupTermina
 import org.jclouds.googlecomputeengine.compute.predicates.AtomicInstanceVisible;
 import org.jclouds.googlecomputeengine.compute.predicates.AtomicOperationDone;
 import org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
-import org.jclouds.googlecomputeengine.domain.Firewall;
 import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.MachineType;
@@ -71,7 +66,6 @@ import org.jclouds.googlecomputeengine.domain.Network;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.location.suppliers.ImplicitLocationSupplier;
 import org.jclouds.location.suppliers.implicit.FirstZone;
-import org.jclouds.net.domain.IpPermission;
 
 import com.google.common.base.Function;
 import com.google.common.base.Functions;
@@ -116,12 +110,6 @@ public final class GoogleComputeEngineServiceContextModule
       bind(new TypeLiteral<Function<Image, org.jclouds.compute.domain.Image>>() {
       }).to(GoogleComputeEngineImageToImage.class);
 
-      bind(new TypeLiteral<Function<Firewall, Iterable<IpPermission>>>() {
-      }).to(FirewallToIpPermission.class);
-
-      bind(new TypeLiteral<Function<Network, SecurityGroup>>() {
-      }).to(NetworkToSecurityGroup.class);
-
       bind(org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet.class)
             .to(CreateNodesWithGroupEncodedIntoNameThenAddToSet.class);
 
@@ -139,7 +127,6 @@ public final class GoogleComputeEngineServiceContextModule
       bind(new TypeLiteral<CacheLoader<NetworkAndAddressRange, Network>>() {
       }).to(FindNetworkOrCreate.class);
 
-      bind(SecurityGroupExtension.class).to(GoogleComputeEngineSecurityGroupExtension.class);
       bind(FirewallTagNamingConvention.Factory.class).in(Scopes.SINGLETON);
       bindHttpApi(binder(), Resources.class);
    }
@@ -196,7 +183,7 @@ public final class GoogleComputeEngineServiceContextModule
    }
 
    @Override protected Optional<SecurityGroupExtension> provideSecurityGroupExtension(Injector i) {
-      return Optional.of(i.getInstance(SecurityGroupExtension.class));
+      return Optional.absent();
    }
 
    private static final Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus =

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ba48dc9/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
deleted file mode 100644
index 9185edf..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.extensions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.jclouds.googlecloud.internal.ListPages.concat;
-import static org.jclouds.googlecomputeengine.compute.predicates.NetworkFirewallPredicates.equalsIpPermission;
-import static org.jclouds.googlecomputeengine.compute.predicates.NetworkFirewallPredicates.providesIpPermission;
-import static org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet.DEFAULT_INTERNAL_NETWORK_RANGE;
-import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperties.OPERATION_COMPLETE_INTERVAL;
-import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperties.OPERATION_COMPLETE_TIMEOUT;
-import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.filter;
-import static org.jclouds.util.Predicates2.retry;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.compute.extensions.SecurityGroupExtension;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.domain.Location;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
-import org.jclouds.googlecomputeengine.compute.functions.Resources;
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.domain.Instance;
-import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface;
-import org.jclouds.googlecomputeengine.domain.Network;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.options.FirewallOptions;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.net.domain.IpPermission;
-import org.jclouds.net.domain.IpProtocol;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.Atomics;
-
-/** This implementation sets {@linkplain SecurityGroup#getId()} to {@link Network#name()}. */
-public final class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupExtension {
-
-   private final GoogleComputeEngineApi api;
-   private final Resources resources;
-   private final GroupNamingConvention.Factory namingConvention;
-   private final LoadingCache<NetworkAndAddressRange, Network> networkCreator;
-   private final Function<Network, SecurityGroup> groupConverter;
-   private final Predicate<AtomicReference<Operation>> operationDone;
-   private final long operationCompleteCheckInterval;
-   private final long operationCompleteCheckTimeout;
-
-   @Inject GoogleComputeEngineSecurityGroupExtension(GoogleComputeEngineApi api, Resources resources,
-         GroupNamingConvention.Factory namingConvention,
-         LoadingCache<NetworkAndAddressRange, Network> networkCreator, Function<Network, SecurityGroup> groupConverter,
-         Predicate<AtomicReference<Operation>> operationDone,
-         @Named(OPERATION_COMPLETE_INTERVAL) Long operationCompleteCheckInterval,
-         @Named(OPERATION_COMPLETE_TIMEOUT) Long operationCompleteCheckTimeout) {
-      this.api = api;
-      this.resources = resources;
-      this.namingConvention = namingConvention;
-      this.networkCreator = networkCreator;
-      this.groupConverter = groupConverter;
-      this.operationCompleteCheckInterval = operationCompleteCheckInterval;
-      this.operationCompleteCheckTimeout = operationCompleteCheckTimeout;
-      this.operationDone = operationDone;
-   }
-
-   @Override
-   public Set<SecurityGroup> listSecurityGroups() {
-      return FluentIterable.from(concat(api.networks().list())).transform(groupConverter).toSet();
-   }
-
-   @Override
-   public Set<SecurityGroup> listSecurityGroupsInLocation(final Location location) {
-      return listSecurityGroups();
-   }
-
-   @Override
-   public Set<SecurityGroup> listSecurityGroupsForNode(String id) {
-      Instance instance = resources.instance(URI.create(checkNotNull(id, "id")));
-
-      if (instance == null) {
-         return ImmutableSet.of();
-      }
-
-      ImmutableSet.Builder builder = ImmutableSet.builder();
-
-      for (NetworkInterface nwInterface : instance.networkInterfaces()) {
-         Network nw = resources.network(nwInterface.network());
-
-         SecurityGroup grp = groupForTagsInNetwork(nw, instance.tags().items());
-         if (grp != null) {
-            builder.add(grp);
-         }
-      }
-
-      return builder.build();
-   }
-
-   @Override
-   public SecurityGroup getSecurityGroupById(String id) {
-      checkNotNull(id, "id");
-      Network network = api.networks().get(id);
-
-      if (network == null) {
-         return null;
-      }
-
-      return groupConverter.apply(network);
-   }
-
-   @Override
-   public SecurityGroup createSecurityGroup(String name, Location location) {
-      return createSecurityGroup(name);
-   }
-
-   public SecurityGroup createSecurityGroup(String name) {
-      checkNotNull(name, "name");
-
-      NetworkAndAddressRange nAr = NetworkAndAddressRange.create(name, DEFAULT_INTERNAL_NETWORK_RANGE, null);
-
-      Network nw = networkCreator.apply(nAr);
-
-      return groupConverter.apply(nw);
-   }
-
-   @Override
-   public boolean removeSecurityGroup(String id) {
-      checkNotNull(id, "id");
-      if (api.networks().get(id) == null) {
-         return false;
-      }
-
-      ListOptions options = filter("network eq .*/" + id);
-
-      FluentIterable<Firewall> fws = FluentIterable.from(concat(api.firewalls().list(options)));
-
-      for (Firewall fw : fws) {
-         AtomicReference<Operation> operation = Atomics
-               .newReference(api.firewalls().delete(fw.name()));
-
-         retry(operationDone, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS)
-               .apply(operation);
-
-         checkState(operation.get().httpErrorStatusCode() == null,
-               "Could not delete firewall, operation failed" + operation);
-      }
-
-      AtomicReference<Operation> operation = Atomics.newReference(api.networks().delete(id));
-
-      retry(operationDone, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS)
-            .apply(operation);
-
-      checkState(operation.get().httpErrorStatusCode() == null,
-            "Could not insert network, operation failed" + operation);
-
-      return true;
-   }
-
-   @Override
-   public SecurityGroup addIpPermission(IpPermission ipPermission, SecurityGroup group) {
-      checkNotNull(group, "group");
-      checkNotNull(ipPermission, "ipPermission");
-
-      checkNotNull(api.networks().get(group.getId()) == null, "network for group is null");
-
-      ListOptions options = filter("network eq .*/" + group.getName());
-
-      if (Iterables
-            .any(concat(api.firewalls().list(options)), providesIpPermission(ipPermission))) {
-         // Permission already exists.
-         return group;
-      }
-
-      FirewallOptions fwOptions = new FirewallOptions();
-      String uniqueFwName = namingConvention.createWithoutPrefix().uniqueNameForGroup(group.getName());
-      fwOptions.name(uniqueFwName);
-      fwOptions.network(group.getUri());
-      if (!ipPermission.getGroupIds().isEmpty()) {
-         fwOptions.sourceTags(ipPermission.getGroupIds());
-      }
-      if (!ipPermission.getCidrBlocks().isEmpty()) {
-         fwOptions.sourceRanges(ipPermission.getCidrBlocks());
-      }
-      List<String> ports = Lists.newArrayList();
-      if (ipPermission.getFromPort() > 0) {
-         if (ipPermission.getFromPort() == ipPermission.getToPort()) {
-            ports.add(String.valueOf(ipPermission.getToPort()));
-         } else {
-            ports.add(ipPermission.getFromPort() + "-" + ipPermission.getToPort());
-         }
-      }
-      fwOptions.addAllowedRule(Firewall.Rule.create(ipPermission.getIpProtocol().value().toLowerCase(), ports));
-
-      AtomicReference<Operation> operation = Atomics.newReference(
-            api.firewalls().createInNetwork(uniqueFwName, group.getUri(), fwOptions));
-
-      retry(operationDone, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS)
-            .apply(operation);
-
-      checkState(operation.get().httpErrorStatusCode() == null,
-            "Could not insert firewall, operation failed" + operation);
-
-      return getSecurityGroupById(group.getId());
-   }
-
-   @Override
-   public SecurityGroup addIpPermission(IpProtocol protocol, int fromPort, int toPort,
-         Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> cidrBlocks, Iterable<String> groupIds,
-         SecurityGroup group) {
-      IpPermission.Builder permBuilder = IpPermission.builder();
-      permBuilder.ipProtocol(protocol);
-      permBuilder.fromPort(fromPort);
-      permBuilder.toPort(toPort);
-      permBuilder.groupIds(groupIds);
-      permBuilder.cidrBlocks(cidrBlocks);
-
-      return addIpPermission(permBuilder.build(), group);
-   }
-
-   @Override
-   public SecurityGroup removeIpPermission(IpPermission ipPermission, SecurityGroup group) {
-      checkNotNull(group, "group");
-      checkNotNull(ipPermission, "ipPermission");
-
-      checkNotNull(api.networks().get(group.getId()) == null, "network for group is null");
-
-      ListOptions options = filter("network eq .*/" + group.getName());
-
-      FluentIterable<Firewall> fws = FluentIterable.from(concat(api.firewalls().list(options)));
-
-      for (Firewall fw : fws) {
-         if (equalsIpPermission(ipPermission).apply(fw)) {
-            AtomicReference<Operation> operation = Atomics
-                  .newReference(api.firewalls().delete(fw.name()));
-
-            retry(operationDone, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS)
-                  .apply(operation);
-
-            checkState(operation.get().httpErrorStatusCode() == null,
-                  "Could not delete firewall, operation failed" + operation);
-         }
-      }
-
-      return getSecurityGroupById(group.getId());
-   }
-
-   @Override
-   public SecurityGroup removeIpPermission(IpProtocol protocol, int fromPort, int toPort,
-         Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> cidrBlocks, Iterable<String> groupIds,
-         SecurityGroup group) {
-
-      IpPermission.Builder permBuilder = IpPermission.builder();
-      permBuilder.ipProtocol(protocol);
-      permBuilder.fromPort(fromPort);
-      permBuilder.toPort(toPort);
-      permBuilder.groupIds(groupIds);
-      permBuilder.cidrBlocks(cidrBlocks);
-
-      return removeIpPermission(permBuilder.build(), group);
-
-   }
-
-   @Override
-   public boolean supportsTenantIdGroupNamePairs() {
-      return false;
-   }
-
-   @Override
-   public boolean supportsTenantIdGroupIdPairs() {
-      return false;
-   }
-
-   @Override
-   public boolean supportsGroupIds() {
-      return true;
-   }
-
-   @Override
-   public boolean supportsPortRangesForGroups() {
-      return true;
-   }
-
-   @Override
-   public boolean supportsExclusionCidrBlocks() {
-      return false;
-   }
-
-   private SecurityGroup groupForTagsInNetwork(Network nw, final Collection<String> tags) {
-      ListOptions opts = filter("network eq .*/" + nw.name());
-      List<Firewall> fws = FluentIterable.from(concat(api.firewalls().list(opts)))
-            .filter(new Predicate<Firewall>() {
-               @Override public boolean apply(final Firewall input) {
-                  // If any of the targetTags on the firewall apply or the firewall has no target tags...
-                  return Iterables.any(input.targetTags(), Predicates.in(tags)) || Predicates.equalTo(0)
-                        .apply(input.targetTags().size());
-               }
-            }).toList();
-
-      if (fws.isEmpty()) {
-         return null;
-      }
-
-      return groupConverter.apply(nw);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ba48dc9/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermission.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermission.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermission.java
deleted file mode 100644
index 4f58402..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermission.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import java.util.List;
-
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.domain.Firewall.Rule;
-import org.jclouds.net.domain.IpPermission;
-import org.jclouds.net.domain.IpProtocol;
-
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableList;
-
-public final class FirewallToIpPermission implements Function<Firewall, Iterable<IpPermission>> {
-   @Override public Iterable<IpPermission> apply(Firewall fw) {
-      ImmutableList.Builder<IpPermission> rules = ImmutableList.builder();
-
-      for (Rule rule : fw.allowed()) {
-         if (rule.ports() != null && !rule.ports().isEmpty()) {
-            for (String r : rule.ports()) {
-               IpPermission.Builder builder = populateBuilder(fw, rule.ipProtocol());
-               List<String> range = Splitter.on('-').splitToList(r);
-               int from = Integer.valueOf(range.get(0));
-               builder.fromPort(from);
-               builder.toPort(range.size() == 2 ? Integer.valueOf(range.get(1)) : from);
-               rules.add(builder.build());
-            }
-         } else {
-            rules.add(populateBuilder(fw, rule.ipProtocol()).build());
-         }
-      }
-
-      return rules.build();
-   }
-
-   private static IpPermission.Builder populateBuilder(Firewall fw, String protocol) {
-      IpPermission.Builder builder = IpPermission.builder();
-
-      builder.ipProtocol(IpProtocol.fromValue(protocol.toUpperCase()));
-
-      if (!fw.sourceRanges().isEmpty()) {
-         builder.cidrBlocks(fw.sourceRanges());
-      }
-      if (!fw.sourceTags().isEmpty()) {
-         builder.groupIds(fw.sourceTags());
-      }
-
-      return builder;
-   }
-}
-

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ba48dc9/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
deleted file mode 100644
index 0afcc17..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import static org.jclouds.googlecloud.internal.ListPages.concat;
-import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.filter;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.compute.domain.SecurityGroupBuilder;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.domain.Network;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.net.domain.IpPermission;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-
-public final class NetworkToSecurityGroup implements Function<Network, SecurityGroup> {
-
-   private final Function<Firewall, Iterable<IpPermission>> firewallToPerms;
-   private final GoogleComputeEngineApi api;
-
-   @Inject NetworkToSecurityGroup(Function<Firewall, Iterable<IpPermission>> firewallToPerms,
-         GoogleComputeEngineApi api) {
-      this.firewallToPerms = firewallToPerms;
-      this.api = api;
-   }
-
-   @Override public SecurityGroup apply(Network network)  {
-      SecurityGroupBuilder builder = new SecurityGroupBuilder();
-
-      builder.id(network.name());
-      builder.providerId(network.id());
-      builder.name(network.name());
-      builder.uri(network.selfLink());
-
-      ImmutableList.Builder permBuilder = ImmutableList.builder();
-
-      ListOptions options = filter("network eq .*/" + network.name());
-
-      for (Firewall fw : concat(api.firewalls().list(options))) {
-         permBuilder.addAll(firewallToPerms.apply(fw));
-      }
-
-      builder.ipPermissions(permBuilder.build());
-
-      return builder.build();
-   }
-}
-

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ba48dc9/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/NetworkFirewallPredicates.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/NetworkFirewallPredicates.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/NetworkFirewallPredicates.java
deleted file mode 100644
index 02b189a..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/NetworkFirewallPredicates.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.predicates;
-
-import static com.google.common.collect.Sets.intersection;
-
-import java.util.List;
-
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.domain.Firewall.Rule;
-import org.jclouds.net.domain.IpPermission;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-public final class NetworkFirewallPredicates {
-
-   public static Predicate<Firewall> hasPortRange(final String protocol, final int fromPort, final int toPort) {
-      return new Predicate<Firewall>() {
-         @Override public boolean apply(Firewall fw) {
-            for (Rule rule : fw.allowed()) {
-               if (!rule.ipProtocol().equals(protocol)) {
-                  continue;
-               }
-               if (rule.ports() == null || rule.ports().isEmpty()) {
-                  return true;
-               }
-               for (String range : rule.ports()) {
-                  if (range.indexOf('-') != -1) {
-                     if (inRange(range, fromPort, toPort)) {
-                        return true;
-                     }
-                  }
-               }
-            }
-            return false;
-         }
-      };
-   }
-
-   private static boolean inRange(String range, int fromPort, int toPort) {
-      List<String> ports = Splitter.on('-').splitToList(range);
-      return fromPort >= Integer.valueOf(ports.get(0)) && toPort <= Integer.valueOf(ports.get(1));
-   }
-
-   public static Predicate<Firewall> hasSourceTag(final String sourceTag) {
-      return new Predicate<Firewall>() {
-         @Override public boolean apply(Firewall input) {
-            return input.sourceTags().contains(sourceTag);
-         }
-      };
-   }
-
-   public static Predicate<Firewall> hasSourceRange(final String sourceRange) {
-      return new Predicate<Firewall>() {
-         @Override  public boolean apply(Firewall input) {
-            return input.sourceRanges().contains(sourceRange);
-         }
-      };
-   }
-
-   public static Predicate<Firewall> equalsIpPermission(final IpPermission permission) {
-      return new Predicate<Firewall>() {
-         @Override public boolean apply(Firewall input) {
-            return Iterables.elementsEqual(permission.getGroupIds(), input.sourceTags())
-                      && Iterables.elementsEqual(permission.getCidrBlocks(), input.sourceRanges())
-                      && (input.allowed().size() == 1
-                             && ruleEqualsIpPermission(permission).apply(Iterables.getOnlyElement(input.allowed())));
-         }
-      };
-   }
-
-   public static Predicate<Firewall> providesIpPermission(final IpPermission permission) {
-      return new Predicate<Firewall>() {
-         @Override  public boolean apply(Firewall input) {
-            boolean groupsMatchTags =
-                  (permission.getGroupIds().isEmpty() && input.sourceTags().isEmpty()) || !intersection(
-                        permission.getGroupIds(), ImmutableSet.copyOf(input.sourceTags())).isEmpty();
-            boolean cidrsMatchRanges =
-                  (permission.getCidrBlocks().isEmpty() && input.sourceRanges().isEmpty()) || !intersection(
-                        permission.getCidrBlocks(), ImmutableSet.copyOf(input.sourceRanges())).isEmpty();
-            boolean firewallHasPorts = hasPortRange(permission.getIpProtocol().value().toLowerCase(),
-                        permission.getFromPort(), permission.getToPort()).apply(input);
-            return groupsMatchTags && cidrsMatchRanges && firewallHasPorts;
-         }
-      };
-   }
-
-   private static Predicate<Firewall.Rule> ruleEqualsIpPermission(final IpPermission permission) {
-      return new Predicate<Rule>() {
-         @Override public boolean apply(Firewall.Rule input) {
-            if (!permission.getIpProtocol().value().toLowerCase().equals(input.ipProtocol())) {
-               return false;
-            }
-            if (input.ports() == null
-                  || input.ports().isEmpty() && permission.getFromPort() == 0 && permission.getToPort() == 0) {
-               return true;
-            } else if (input.ports().size() == 1) {
-               String port = Iterables.getOnlyElement(input.ports());
-               if (permission.getFromPort() == permission.getToPort()) {
-                  return port.equals(String.valueOf(permission.getFromPort()));
-               }
-               return port.equals(permission.getFromPort() + "-" + permission.getToPort());
-            }
-            return false;
-         }
-      };
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ba48dc9/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtensionLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtensionLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtensionLiveTest.java
deleted file mode 100644
index 1cc00b0..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtensionLiveTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.extensions;
-
-import java.util.Properties;
-
-import org.jclouds.compute.extensions.internal.BaseSecurityGroupExtensionLiveTest;
-import org.jclouds.googlecloud.internal.TestProperties;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", singleThreaded = true, testName = "GoogleComputeEngineSecurityGroupExtensionLiveTest")
-public class GoogleComputeEngineSecurityGroupExtensionLiveTest extends BaseSecurityGroupExtensionLiveTest {
-
-   public GoogleComputeEngineSecurityGroupExtensionLiveTest() {
-      provider = "google-compute-engine";
-   }
-
-   @Override protected Properties setupProperties() {
-      return TestProperties.apply(provider, super.setupProperties());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ba48dc9/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermissionTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermissionTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermissionTest.java
deleted file mode 100644
index 9c2f759..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FirewallToIpPermissionTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.net.domain.IpPermission;
-import org.jclouds.net.domain.IpProtocol;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-@Test
-public class FirewallToIpPermissionTest {
-
-   public void testApply() {
-      Firewall fw = fwForTest();
-
-      FirewallToIpPermission converter = new FirewallToIpPermission();
-
-      Iterable<IpPermission> perms = converter.apply(fw);
-
-      assertEquals(Iterables.size(perms), 3,
-            "There should be three IpPermissions but there is only " + Iterables.size(perms));
-
-      assertTrue(Iterables.any(perms, Predicates.and(hasProtocol(IpProtocol.TCP), hasStartAndEndPort(1, 10))),
-            "No permission found for TCP, ports 1-10");
-      assertTrue(Iterables.any(perms, Predicates.and(hasProtocol(IpProtocol.TCP), hasStartAndEndPort(33, 33))),
-            "No permission found for TCP, port 33");
-      assertTrue(Iterables.any(perms, hasProtocol(IpProtocol.ICMP)), "No permission found for ICMP");
-   }
-
-   public static Firewall fwForTest() {
-      String baseUrl = "https://www.googleapis.com/compute/v1/projects";
-      return Firewall.create( //
-            "abcd", // id
-            URI.create(baseUrl + "/jclouds/global/firewalls/jclouds-test"), // selfLink
-            new SimpleDateFormatDateService().iso8601DateParse("2012-04-13T03:05:04.365"), // creationTimestamp
-            "jclouds-test", // name
-            null, // description
-            URI.create(baseUrl + "/jclouds/global/networks/jclouds-test"), // network
-            ImmutableList.of("0.0.0.0/0"), // sourceRanges
-            null, // sourceTags
-            null, // targetTags
-            ImmutableList.of( // allowed
-                  Firewall.Rule.create("tcp", ImmutableList.of("1-10")), //
-                  Firewall.Rule.create("tcp", ImmutableList.of("33")), //
-                  Firewall.Rule.create("icmp", ImmutableList.<String>of()) //
-            ));
-   }
-
-   public static Predicate<IpPermission> hasProtocol(final IpProtocol protocol) {
-      return new Predicate<IpPermission>() {
-
-         @Override
-         public boolean apply(IpPermission perm) {
-            return protocol.equals(perm.getIpProtocol());
-         }
-      };
-   }
-
-   public static Predicate<IpPermission> hasStartAndEndPort(final int startPort, final int endPort) {
-      return new Predicate<IpPermission>() {
-
-         @Override
-         public boolean apply(IpPermission perm) {
-            return startPort == perm.getFromPort() && endPort == perm.getToPort();
-         }
-      };
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ba48dc9/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
deleted file mode 100644
index 97b730b..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroupTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import static com.google.common.collect.Iterators.singletonIterator;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.jclouds.googlecomputeengine.compute.functions.FirewallToIpPermissionTest.hasProtocol;
-import static org.jclouds.googlecomputeengine.compute.functions.FirewallToIpPermissionTest.hasStartAndEndPort;
-import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.filter;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-
-import org.jclouds.compute.domain.SecurityGroup;
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecloud.domain.ForwardingListPage;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.Network;
-import org.jclouds.googlecomputeengine.features.FirewallApi;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.net.domain.IpProtocol;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-public class NetworkToSecurityGroupTest {
-
-   @Test
-   public void testApply() {
-      FirewallToIpPermission fwToPerm = new FirewallToIpPermission();
-
-      GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
-      FirewallApi fwApi = createMock(FirewallApi.class);
-
-      ListOptions options = filter("network eq .*/party-test");
-      expect(api.firewalls()).andReturn(fwApi);
-      expect(fwApi.list(options)).andReturn(
-            singletonIterator(ForwardingListPage.create(ImmutableList.of(FirewallToIpPermissionTest.fwForTest()), null)));
-
-      replay(api, fwApi);
-
-      Network network = Network.create( //
-            "abcd", // id
-            new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
-            URI.create("https://www.googleapis.com/compute/v1/projects/party/global/networks/party-test"),
-            "party-test", // name
-            "some description", // description
-            "0.0.0.0/0", // rangeIPv4
-            "1.2.3.4" // gatewayIPv4
-      );
-
-      NetworkToSecurityGroup netToSg = new NetworkToSecurityGroup(fwToPerm, api);
-
-      SecurityGroup group = netToSg.apply(network);
-
-      assertEquals(group.getId(), "party-test");
-      assertEquals(group.getUri(), URI.create("https://www.googleapis.com/compute/v1/projects/party/global/networks/party-test"));
-      assertEquals(group.getIpPermissions().size(), 3);
-      assertTrue(Iterables.any(group.getIpPermissions(), Predicates.and(hasProtocol(IpProtocol.TCP),
-              hasStartAndEndPort(1, 10))), "No permission found for TCP, ports 1-10");
-      assertTrue(Iterables.any(group.getIpPermissions(), Predicates.and(hasProtocol(IpProtocol.TCP),
-              hasStartAndEndPort(33, 33))), "No permission found for TCP, port 33");
-      assertTrue(Iterables.any(group.getIpPermissions(), hasProtocol(IpProtocol.ICMP)),
-              "No permission found for ICMP");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ba48dc9/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicatesTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicatesTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicatesTest.java
deleted file mode 100644
index 55eb837..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/predicates/NetworkFirewallPredicatesTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.predicates;
-
-import static org.jclouds.googlecomputeengine.compute.functions.FirewallToIpPermissionTest.fwForTest;
-import static org.jclouds.googlecomputeengine.compute.predicates.NetworkFirewallPredicates.equalsIpPermission;
-import static org.jclouds.googlecomputeengine.compute.predicates.NetworkFirewallPredicates.hasPortRange;
-import static org.jclouds.googlecomputeengine.compute.predicates.NetworkFirewallPredicates.hasSourceRange;
-import static org.jclouds.googlecomputeengine.compute.predicates.NetworkFirewallPredicates.hasSourceTag;
-import static org.jclouds.googlecomputeengine.compute.predicates.NetworkFirewallPredicates.providesIpPermission;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.net.domain.IpPermission;
-import org.jclouds.net.domain.IpProtocol;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "NetworkFirewallPredicatesTest")
-public class NetworkFirewallPredicatesTest {
-   protected static final String BASE_URL = "https://www.googleapis.com/compute/v1/projects";
-
-   public static Firewall getFwForTestSourceTags() {
-      return Firewall.create( //
-            "abcd", // id
-            URI.create(BASE_URL + "/party/global/firewalls/jclouds-test"), // selfLink
-            new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
-            "jclouds-test", // name
-            null, // description
-            URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network
-            null, // sourceRanges
-            ImmutableList.of("tag-1"), // sourceTags
-            null, // targetTags
-            ImmutableList.of( // allowed
-                  Firewall.Rule.create("tcp", ImmutableList.of("1-10")), //
-                  Firewall.Rule.create("tcp", ImmutableList.of("33")) //
-            ));
-   }
-
-   public static Firewall getFwForTestSourceTagsExact() {
-      return Firewall.create( //
-            "abcd", // id
-            URI.create(BASE_URL + "/party/global/firewalls/jclouds-test"), // selfLink
-            new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
-            "jclouds-test", // name
-            null, // description
-            URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network
-            null, // sourceRanges
-            ImmutableList.of("tag-1"), // sourceTags
-            null, // targetTags
-            ImmutableList.of(Firewall.Rule.create("tcp", ImmutableList.of("1-10"))) // allowed
-      );
-   }
-
-   @Test
-   public void testHasPortRange() {
-      assertTrue(hasPortRange("tcp", 2, 9).apply(fwForTest()),
-            "Firewall " + fwForTest() + " should contain the port range 2-9.");
-   }
-
-   @Test
-   public void testHasPortRangeSame() {
-      assertTrue(hasPortRange("tcp", 2, 2).apply(fwForTest()),
-            "Firewall " + fwForTest() + " should contain the port range 2-2.");
-   }
-
-   @Test
-   public void testHasPortRangeFails() {
-      assertFalse(hasPortRange("tcp", 11, 15).apply(fwForTest()),
-            "Firewall " + fwForTest() + " should NOT contain the port range 11-15.");
-   }
-
-   @Test
-   public void testHasPortRangeFailsSame() {
-      assertFalse(hasPortRange("tcp", 15, 15).apply(fwForTest()),
-            "Firewall " + fwForTest() + " should NOT contain the port range 15-15.");
-   }
-
-   @Test
-   public void testHasSourceTag() {
-      assertTrue(hasSourceTag("tag-1").apply(getFwForTestSourceTags()),
-            "Firewall " + getFwForTestSourceTags() + " should contain the source tag 'tag-1'.");
-   }
-
-   @Test
-   public void testHasSourceTagFails() {
-      assertFalse(hasSourceTag("tag-1").apply(fwForTest()),
-            "Firewall " + fwForTest() + " should NOT contain the source tag 'tag-1'.");
-   }
-
-   @Test
-   public void testHasSourceRange() {
-      assertTrue(hasSourceRange("0.0.0.0/0").apply(fwForTest()),
-            "Firewall " + fwForTest() + " should contain the source range '0.0.0.0/0'.");
-   }
-
-   @Test
-   public void testHasSourceRangeFails() {
-      assertFalse(hasSourceRange("0.0.0.0/0").apply(getFwForTestSourceTags()),
-            "Firewall " + getFwForTestSourceTags() + " should NOT contain the source range '0.0.0.0/0'.");
-   }
-
-   @Test
-   public void testEqualsIpPermission() {
-      IpPermission perm = IpPermission.builder().groupId("tag-1").fromPort(1).toPort(10).ipProtocol(IpProtocol.TCP)
-            .build();
-
-      assertTrue(equalsIpPermission(perm).apply(getFwForTestSourceTagsExact()),
-            "Firewall " + getFwForTestSourceTagsExact() + " should match IpPermission " + perm + " but does not.");
-   }
-
-   @Test
-   public void testEqualsIpPermissionFails() {
-      IpPermission perm = IpPermission.builder().groupId("tag-1").fromPort(1).toPort(10).ipProtocol(IpProtocol.TCP)
-            .build();
-
-      assertFalse(equalsIpPermission(perm).apply(getFwForTestSourceTags()),
-            "Firewall " + getFwForTestSourceTags() + " should not match IpPermission " + perm + " but does.");
-   }
-
-   @Test
-   public void testProvidesIpPermission() {
-      IpPermission perm = IpPermission.builder().groupId("tag-1").fromPort(1).toPort(10).ipProtocol(IpProtocol.TCP)
-            .build();
-
-      assertTrue(providesIpPermission(perm).apply(getFwForTestSourceTagsExact()),
-            "Firewall " + getFwForTestSourceTagsExact() + " should provide IpPermission " + perm + " but does not.");
-
-      assertTrue(providesIpPermission(perm).apply(getFwForTestSourceTags()),
-            "Firewall " + getFwForTestSourceTags() + " should inexactly provide IpPermission " + perm
-                  + " but does not.");
-   }
-
-   @Test
-   public void testProvidesIpPermissionFails() {
-      IpPermission perm = IpPermission.builder().groupId("tag-1").fromPort(1).toPort(10).ipProtocol(IpProtocol.TCP)
-            .build();
-
-      assertFalse(providesIpPermission(perm).apply(fwForTest()),
-            "Firewall " + fwForTest() + " should not provide IpPermission " + perm + " but does.");
-   }
-}
-


[50/50] [abbrv] jclouds git commit: Update Maven coordinates to the promoted naming

Posted by na...@apache.org.
Update Maven coordinates to the promoted naming


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

Branch: refs/heads/master
Commit: 647df25d903017a1539b92c248ac2b4b4423b9df
Parents: 05fb322
Author: Ignasi Barrera <na...@apache.org>
Authored: Thu Jun 25 18:47:32 2015 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Fri Jun 26 11:32:01 2015 +0200

----------------------------------------------------------------------
 common/googlecloud/pom.xml              | 14 +++++++-------
 common/pom.xml                          |  1 +
 providers/google-compute-engine/pom.xml | 24 ++++++++++++------------
 providers/pom.xml                       |  1 +
 4 files changed, 21 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/647df25d/common/googlecloud/pom.xml
----------------------------------------------------------------------
diff --git a/common/googlecloud/pom.xml b/common/googlecloud/pom.xml
index df6a7c7..2d67e73 100644
--- a/common/googlecloud/pom.xml
+++ b/common/googlecloud/pom.xml
@@ -21,13 +21,13 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
-        <groupId>org.apache.jclouds.labs</groupId>
-        <artifactId>jclouds-labs-google</artifactId>
+        <groupId>org.apache.jclouds</groupId>
+        <artifactId>jclouds-project</artifactId>
         <version>2.0.0-SNAPSHOT</version>
+        <relativePath>../../project/pom.xml</relativePath>
     </parent>
 
-    <!-- TODO: when out of labs, switch to org.jclouds.provider -->
-    <groupId>org.apache.jclouds.labs</groupId>
+    <groupId>org.apache.jclouds.common</groupId>
     <artifactId>googlecloud</artifactId>
     <name>jclouds Google Cloud Core</name>
     <description>jclouds components common to Google Cloud products</description>
@@ -36,11 +36,11 @@
         <dependency>
             <groupId>org.apache.jclouds.api</groupId>
             <artifactId>oauth</artifactId>
-            <version>${jclouds.version}</version>
+            <version>${project.version}</version>
             <type>jar</type>
         </dependency>
         <dependency>
-            <groupId>org.apache.jclouds.labs</groupId>
+            <groupId>org.apache.jclouds.api</groupId>
             <artifactId>oauth</artifactId>
             <version>${project.version}</version>
             <type>test-jar</type>
@@ -54,7 +54,7 @@
         <dependency>
             <groupId>org.apache.jclouds</groupId>
             <artifactId>jclouds-core</artifactId>
-            <version>${jclouds.version}</version>
+            <version>${project.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/jclouds/blob/647df25d/common/pom.xml
----------------------------------------------------------------------
diff --git a/common/pom.xml b/common/pom.xml
index d12c7b8..7ceb7f9 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -30,6 +30,7 @@
   <packaging>pom</packaging>
   <name>jclouds commons project</name>
   <modules>
+    <module>googlecloud</module>
     <module>openstack</module>
   </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/jclouds/blob/647df25d/providers/google-compute-engine/pom.xml
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/pom.xml b/providers/google-compute-engine/pom.xml
index 2cf38fb..2e26052 100644
--- a/providers/google-compute-engine/pom.xml
+++ b/providers/google-compute-engine/pom.xml
@@ -21,13 +21,13 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
-        <groupId>org.apache.jclouds.labs</groupId>
-        <artifactId>jclouds-labs-google</artifactId>
+        <groupId>org.apache.jclouds</groupId>
+        <artifactId>jclouds-project</artifactId>
         <version>2.0.0-SNAPSHOT</version>
+        <relativePath>../../project/pom.xml</relativePath>
     </parent>
 
-    <!-- TODO: when out of labs, switch to org.jclouds.provider -->
-    <groupId>org.apache.jclouds.labs</groupId>
+    <groupId>org.apache.jclouds.provider</groupId>
     <artifactId>google-compute-engine</artifactId>
     <name>jclouds Google Compute Engine provider</name>
     <description>jclouds components to access GoogleCompute</description>
@@ -47,16 +47,16 @@
         <dependency>
             <groupId>org.apache.jclouds</groupId>
             <artifactId>jclouds-core</artifactId>
-            <version>${jclouds.version}</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.jclouds.labs</groupId>
+            <groupId>org.apache.jclouds.common</groupId>
             <artifactId>googlecloud</artifactId>
             <version>${project.version}</version>
             <type>jar</type>
         </dependency>
         <dependency>
-            <groupId>org.apache.jclouds.labs</groupId>
+            <groupId>org.apache.jclouds.common</groupId>
             <artifactId>googlecloud</artifactId>
             <version>${project.version}</version>
             <type>test-jar</type>
@@ -65,7 +65,7 @@
         <dependency>
             <groupId>org.apache.jclouds</groupId>
             <artifactId>jclouds-compute</artifactId>
-            <version>${jclouds.version}</version>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>com.google.auto.service</groupId>
@@ -80,27 +80,27 @@
         <dependency>
             <groupId>org.apache.jclouds</groupId>
             <artifactId>jclouds-compute</artifactId>
-            <version>${jclouds.version}</version>
+            <version>${project.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.jclouds</groupId>
             <artifactId>jclouds-core</artifactId>
-            <version>${jclouds.version}</version>
+            <version>${project.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.jclouds.driver</groupId>
             <artifactId>jclouds-slf4j</artifactId>
-            <version>${jclouds.version}</version>
+            <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.jclouds.driver</groupId>
             <artifactId>jclouds-sshj</artifactId>
-            <version>${jclouds.version}</version>
+            <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/jclouds/blob/647df25d/providers/pom.xml
----------------------------------------------------------------------
diff --git a/providers/pom.xml b/providers/pom.xml
index 9eac6a2..77bf0e2 100644
--- a/providers/pom.xml
+++ b/providers/pom.xml
@@ -49,6 +49,7 @@
     <module>serverlove-z1-man</module>
     <module>skalicloud-sdg-my</module>
     <module>go2cloud-jhb1</module>
+    <module>google-compute-engine</module>
     <module>softlayer</module>
     <module>hpcloud-compute</module>
     <module>hpcloud-blockstorage</module>


[34/50] [abbrv] jclouds git commit: Use OAuth from the main repo

Posted by na...@apache.org.
Use OAuth from the main repo


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

Branch: refs/heads/master
Commit: 3c5f3ae66e5b343f02b682eebb8feddb62c7a51f
Parents: 88c3c61
Author: Ignasi Barrera <na...@apache.org>
Authored: Wed Apr 15 21:47:02 2015 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Apr 15 21:47:02 2015 +0200

----------------------------------------------------------------------
 common/googlecloud/pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/3c5f3ae6/common/googlecloud/pom.xml
----------------------------------------------------------------------
diff --git a/common/googlecloud/pom.xml b/common/googlecloud/pom.xml
index 8e06883..df6a7c7 100644
--- a/common/googlecloud/pom.xml
+++ b/common/googlecloud/pom.xml
@@ -34,9 +34,9 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.jclouds.labs</groupId>
+            <groupId>org.apache.jclouds.api</groupId>
             <artifactId>oauth</artifactId>
-            <version>${project.version}</version>
+            <version>${jclouds.version}</version>
             <type>jar</type>
         </dependency>
         <dependency>


[21/50] [abbrv] jclouds git commit: Updated TargetHttpProxyOptions, TargetPoolCreationOptions, UrlMapOptions to AutoValue + Builder

Posted by na...@apache.org.
Updated TargetHttpProxyOptions, TargetPoolCreationOptions, UrlMapOptions to AutoValue + Builder


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

Branch: refs/heads/master
Commit: 0f67b6250579e7de749671bdfaacc2d8fba1e085
Parents: 2ba48dc
Author: Daniel Broudy <br...@google.com>
Authored: Fri Dec 19 13:29:09 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Fri Jan 9 23:14:14 2015 +0100

----------------------------------------------------------------------
 .../binders/TargetPoolCreationBinder.java       |  75 ------
 .../features/TargetHttpProxyApi.java            |   1 +
 .../features/TargetPoolApi.java                 |   5 +-
 .../googlecomputeengine/features/UrlMapApi.java |   1 +
 .../options/HttpHealthCheckCreationOptions.java |   2 +-
 .../options/TargetHttpProxyOptions.java         |  76 +++---
 .../options/TargetPoolCreationOptions.java      | 195 +++++++-------
 .../options/UrlMapOptions.java                  | 264 +++++++++----------
 .../binders/TargetPoolCreationBinderTest.java   |  72 -----
 .../features/ForwardingRuleApiLiveTest.java     |   7 +-
 .../GlobalForwardingRuleApiLiveTest.java        |   4 +-
 .../features/HttpHealthCheckApiLiveTest.java    |   2 +-
 .../features/HttpHealthCheckApiMockTest.java    |   2 +-
 .../features/TargetHttpProxyApiLiveTest.java    |  19 +-
 .../features/TargetHttpProxyApiMockTest.java    |  15 ++
 .../features/TargetPoolApiLiveTest.java         |  19 +-
 .../features/TargetPoolApiMockTest.java         |   4 +-
 .../features/UrlMapApiLiveTest.java             |  38 +--
 .../features/UrlMapApiMockTest.java             |  13 +-
 .../resources/target_http_proxy_insert.json     |   5 +-
 20 files changed, 326 insertions(+), 493 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinder.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinder.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinder.java
deleted file mode 100644
index 1d52859..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinder.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.binders;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
-import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.json.Json;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-
-public class TargetPoolCreationBinder extends BindToJsonPayload {
-
-   @Inject TargetPoolCreationBinder(Json jsonBinder) {
-      super(jsonBinder);
-   }
-
-   @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-      TargetPoolCreationOptions options = (TargetPoolCreationOptions) postParams.get("options");
-      String name = postParams.get("name").toString();
-      TargetPoolBinderHelper targetPoolBinderHelper = new TargetPoolBinderHelper(name, options);
-      return super.bindToRequest(request, targetPoolBinderHelper);
-   }
-
-   private class TargetPoolBinderHelper{
-
-      /**
-       * Values used to bind TargetPoolCreationOptions to json request.
-       */
-      @SuppressWarnings("unused")
-      private String name;
-      @SuppressWarnings("unused")
-      private List<URI> healthChecks;
-      @SuppressWarnings("unused")
-      private List<URI> instances;
-      @SuppressWarnings("unused")
-      private SessionAffinityValue sessionAffinity;
-      @SuppressWarnings("unused")
-      private Float failoverRatio;
-      @SuppressWarnings("unused")
-      private URI backupPool;
-      @SuppressWarnings("unused")
-      private String description; 
-
-      private TargetPoolBinderHelper(String name, TargetPoolCreationOptions targetPoolCreationOptions){
-         this.name = name;
-         this.healthChecks = targetPoolCreationOptions.getHealthChecks();
-         this.instances = targetPoolCreationOptions.getInstances();
-         this.sessionAffinity = targetPoolCreationOptions.getSessionAffinity();
-         this.failoverRatio = targetPoolCreationOptions.getFailoverRatio();
-         this.backupPool = targetPoolCreationOptions.getBackupPool();
-         this.description = targetPoolCreationOptions.getDescription();
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApi.java
index abb0bf4..97c45d4 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApi.java
@@ -83,6 +83,7 @@ public interface TargetHttpProxyApi {
    @Path("/global/targetHttpProxies")
    Operation create(@BinderParam(BindToJsonPayload.class) TargetHttpProxyOptions targetHttpProxyOptions);
 
+   //TODO (broudy) : Should we remove this because it is redundant?
    /**
     * Creates a targetHttpProxy resource in the specified project using the given URI for the urlMap.
     *

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
index e623c12..6d57086 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
@@ -38,7 +38,6 @@ import org.jclouds.googlecloud.domain.ListPage;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.binders.TargetPoolChangeHealthChecksBinder;
 import org.jclouds.googlecomputeengine.binders.TargetPoolChangeInstancesBinder;
-import org.jclouds.googlecomputeengine.binders.TargetPoolCreationBinder;
 import org.jclouds.googlecomputeengine.domain.HealthStatus;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.domain.TargetPool;
@@ -47,6 +46,7 @@ import org.jclouds.googlecomputeengine.options.ListOptions;
 import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.oauth.v2.filters.OAuthFilter;
+import org.jclouds.rest.annotations.BinderParam;
 import org.jclouds.rest.annotations.Fallback;
 import org.jclouds.rest.annotations.MapBinder;
 import org.jclouds.rest.annotations.PayloadParam;
@@ -82,8 +82,7 @@ public interface TargetPoolApi {
    @Named("TargetPools:insert")
    @POST
    @Produces(APPLICATION_JSON)
-   @MapBinder(TargetPoolCreationBinder.class)
-   Operation create(@PayloadParam("name") String name, @PayloadParam("options") TargetPoolCreationOptions options);
+   Operation create(@BinderParam(BindToJsonPayload.class) TargetPoolCreationOptions options);
 
    /** Deletes a target pool by name and returns the operation in progress, or null if not found. */
    @Named("TargetPools:delete")

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/UrlMapApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/UrlMapApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/UrlMapApi.java
index 25783d2..d77c542 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/UrlMapApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/UrlMapApi.java
@@ -113,6 +113,7 @@ public interface UrlMapApi {
 
    /**
     * Updates the specified urlMap resource, with patch semantics, with the data included in the request.
+    * Note:{@link UrlMapOptions.Builder#buildForPatch()} may be helpful.
     *
     * @param urlMapName    the name urlMap to be updated.
     * @param urlMapOptions the new urlMap options.

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
index 1e49f2b..6902232 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
@@ -161,7 +161,7 @@ public abstract class HttpHealthCheckCreationOptions {
        * Useful when performing a PATCH operation and you do not want to overwrite
        * unspecified values with the default values.
        */
-      public HttpHealthCheckCreationOptions buildNoDefaults() {
+      public HttpHealthCheckCreationOptions buildForPatch() {
          return HttpHealthCheckCreationOptions.create(host, requestPath, port,
                checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description);
       }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetHttpProxyOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetHttpProxyOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetHttpProxyOptions.java
index 94dd75a..0fa01c9 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetHttpProxyOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetHttpProxyOptions.java
@@ -16,60 +16,52 @@
  */
 package org.jclouds.googlecomputeengine.options;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.net.URI;
 
 import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
 
-public final class TargetHttpProxyOptions {
+import com.google.auto.value.AutoValue;
 
-   private String name;
-   @Nullable private String description;
-   private URI urlMap;
+@AutoValue
+public abstract class TargetHttpProxyOptions {
 
-   /**
-    * Name of the TargetHttpProxy resource.
-    * @return name, provided by the client.
-    */
-   public String getName(){
-      return name;
-   }
+   public abstract String name();
+   @Nullable public abstract String description();
+   public abstract URI urlMap();
 
-   /**
-    * @see TargetHttpProxyOptions#getName()
-    */
-   public TargetHttpProxyOptions name(String name) {
-      this.name = name;
-      return this;
+   @SerializedNames({ "name", "description", "urlMap"})
+   static TargetHttpProxyOptions create(String name, String description, URI urlMap) {
+      return new AutoValue_TargetHttpProxyOptions(name, description, urlMap);
    }
 
-   /**
-    * An optional textual description of the TargetHttpProxy.
-    * @return description, provided by the client.
-    */
-   public String getDescription(){
-      return description;
+   TargetHttpProxyOptions() {
    }
 
-   /**
-    * @see TargetHttpProxyOptions#getDescription()
-    */
-   public TargetHttpProxyOptions description(String description) {
-      this.description = description;
-      return this;
-   }
+   public static class Builder {
+      private String name;
+      private String description;
+      private URI urlMap;
 
-   /**
-    * URL to the UrlMap resource that defines the mapping from URL to the BackendService.
-    */
-   public URI getUrlMap() {
-      return urlMap;
-   }
+      public Builder(String name, URI urlMap) {
+         this.name = name;
+         this.urlMap = urlMap;
+      }
+
+      /**
+       * @see TargetHttpProxyOptions#getDescription()
+       */
+      public Builder description(String description) {
+         this.description = description;
+         return this;
+      }
 
-   /**
-    * @see TargetHttpProxyOptions#getUrlMap()
-    */
-   public TargetHttpProxyOptions urlMap(URI urlMap) {
-      this.urlMap = urlMap;
-      return this;
+      public TargetHttpProxyOptions build() {
+         checkNotNull(name, "TargetHttpProxyOptions name cannot be null");
+         checkNotNull(urlMap, "TargetHttpProxyOptions name cannot be null");
+         return create(name, description, urlMap);
+      }
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetPoolCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetPoolCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetPoolCreationOptions.java
index 4864148..31ba738 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetPoolCreationOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetPoolCreationOptions.java
@@ -16,17 +16,24 @@
  */
 package org.jclouds.googlecomputeengine.options;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.net.URI;
 import java.util.List;
 
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
 /**
  * Options for creating a Target Pool
- * 
  */
-public class TargetPoolCreationOptions{
+@AutoValue
+public abstract class TargetPoolCreationOptions{
 
    /**
-    * Session affinity determines the hash method that 
+    * Session affinity determines the hash method that
     * Google Compute Engine uses to distribute traffic.
     * @see <a href="https://cloud.google.com/compute/docs/reference/latest/targetPools#resource"/>
     */
@@ -36,116 +43,100 @@ public class TargetPoolCreationOptions{
       NONE
    }
 
-   private List<URI> healthChecks;
-   private List<URI> instances;
-   private SessionAffinityValue sessionAffinity;
-   private Float failoverRatio;
-   private URI backupPool;
-   private String description;
+   public abstract String name();
+   @Nullable public abstract List<URI> healthChecks();
+   @Nullable public abstract List<URI> instances();
+   @Nullable public abstract SessionAffinityValue sessionAffinity();
+   @Nullable public abstract Float failoverRatio();
+   @Nullable public abstract URI backupPool();
+   @Nullable public abstract String description();
 
-   /**
-    * The set of HealthChecks
-    *
-    * @return a set of HealthCheck URIs
-    */
-   public List<URI> getHealthChecks(){
-      return healthChecks;
+   @SerializedNames({ "name", "healthChecks", "instances", "sessionAffinity", "failoverRatio",
+                     "backupPool", "description"})
+   public static TargetPoolCreationOptions create(String name, List<URI> healthChecks, List<URI> instances,
+         SessionAffinityValue sessionAffinity, Float failoverRatio, URI backupPool, String description) {
+      return new AutoValue_TargetPoolCreationOptions(name, healthChecks, instances, sessionAffinity, failoverRatio,
+            backupPool, description);
    }
 
-   /**
-    * A List of resource URIs to the member VMs serving this pool.
-    * They must live in zones contained in the same region as this pool.
-    *
-    * @return set of instance URIs
-    */
-   public List<URI> getInstances(){
-      return instances;
+   TargetPoolCreationOptions() {
    }
 
-   /**
-    * Defines the session affinity option.
-    * Session affinity determines the hash method that Google Compute Engine uses to distribute traffic.
-    * @return
-    */
-   public SessionAffinityValue getSessionAffinity(){
-      return sessionAffinity;
-   }
+   public static class Builder {
 
-   /**
-    * This field is applicable only when the target pool is serving a forwarding rule as the primary pool 
-    * (e.g. not as a backup pool to some other target pool). 
-    * The value of the a float between [0, 1]. 
-    * If set, backupPool must also be set.
-    * @return failoverRatio, a float between [0, 1]
-    */
-   public Float getFailoverRatio(){
-      return failoverRatio;
-   }
+      private String name;
+      private List<URI> healthChecks;
+      private List<URI> instances;
+      private SessionAffinityValue sessionAffinity;
+      private Float failoverRatio;
+      private URI backupPool;
+      private String description;
 
-   /**
-    * This field is applicable only when the target pool is serving a forwarding rule as the primary pool 
-    * (e.g. not as a backup pool to some other target pool). Must be a fully-qualified URL to a target pool that is in the same region as the primary target pool.
-    * If set, failoverRatio must also be set
-    * @return backupPool, Fully-qualified URI to a target pool in the same region as primary target pool
-    */
-   public URI getBackupPool(){
-      return backupPool;
-   }
-   
-   /**
-    * An optional textual description of the TargetPool.
-    * @return description, provided by the client.
-    */
-   public String getDescription(){
-      return description;
-   }
+      public Builder(String name){
+         checkNotNull(name, "TargetPoolCreationOptions name cannot be null");
+         this.name = name;
+      }
 
-   /**
-    * @see TargetPoolCreationOptions#getHealthChecks()
-    */
-   public TargetPoolCreationOptions healthChecks(List<URI> healthChecks){
-      this.healthChecks = healthChecks;
-      return this;
-   }
+      /** The set of HealthChecks */
+      public Builder healthChecks(List<URI> healthChecks){
+         this.healthChecks = healthChecks;
+         return this;
+      }
 
-   /**
-    * @see TargetPoolCreationOptions#getInstances()
-    */
-   public TargetPoolCreationOptions instances(List<URI> instances){
-      this.instances = instances;
-      return this;
-   }
+      /**
+       * A List of resource URIs to the member VMs serving this pool.
+       * They must live in zones contained in the same region as this pool.
+       */
+      public Builder instances(List<URI> instances){
+         this.instances = instances;
+         return this;
+      }
 
-   /**
-    * @see TargetPoolCreationOptions#getSessionAffinity()
-    */
-   public TargetPoolCreationOptions sessionAffinity(SessionAffinityValue sessionAffinity){
-      this.sessionAffinity = sessionAffinity;
-      return this;
-   }
+      /**
+       * Defines the session affinity option.
+       * Session affinity determines the hash method that Google Compute Engine uses to distribute traffic.
+       */
+      public Builder sessionAffinity(SessionAffinityValue sessionAffinity){
+         this.sessionAffinity = sessionAffinity;
+         return this;
+      }
 
-   /**
-    * @see TargetPoolCreationOptions#getFailoverRatio()
-    */
-   public TargetPoolCreationOptions failoverRatio(float failoverRatio){
-      this.failoverRatio = failoverRatio;
-      return this;
-   }
+      /**
+       * This field is applicable only when the target pool is serving a forwarding rule as the primary pool
+       * (e.g. not as a backup pool to some other target pool).
+       * The value of the a float between [0, 1].
+       * If set, backupPool must also be set.
+       * @return failoverRatio, a float between [0, 1]
+       */
+      public Builder failoverRatio(float failoverRatio){
+         this.failoverRatio = failoverRatio;
+         return this;
+      }
 
-   /**
-    * @see TargetPoolCreationOptions#getBackupPool()
-    */
-   public TargetPoolCreationOptions backupPool(URI backupPool){
-      this.backupPool = backupPool;
-      return this;
-   }
-   
-   /**
-    * @see TargetPoolCreationOptions#getDescription()
-    */
-   public TargetPoolCreationOptions description(String description){
-      this.description = description;
-      return this;
-   }
+      /**
+       * This field is applicable only when the target pool is serving a forwarding rule as the primary pool
+       * (e.g. not as a backup pool to some other target pool). Must be a fully-qualified URL to a target pool
+       * that is in the same region as the primary target pool.
+       * If set, failoverRatio must also be set
+       * @return backupPool, Fully-qualified URI to a target pool in the same region as primary target pool
+       */
+      public Builder backupPool(URI backupPool){
+         this.backupPool = backupPool;
+         return this;
+      }
 
+      /**
+       * An optional textual description of the TargetPool.
+       * @return description, provided by the client.
+       */
+      public Builder description(String description){
+         this.description = description;
+         return this;
+      }
+
+      public TargetPoolCreationOptions build() {
+         return create(name, healthChecks, instances, sessionAffinity, failoverRatio,
+               backupPool, description);
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/UrlMapOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/UrlMapOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/UrlMapOptions.java
index b47aaf9..e569e79 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/UrlMapOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/UrlMapOptions.java
@@ -16,6 +16,8 @@
  */
 package org.jclouds.googlecomputeengine.options;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.net.URI;
 import java.util.List;
 
@@ -23,151 +25,121 @@ import org.jclouds.googlecomputeengine.domain.UrlMap.HostRule;
 import org.jclouds.googlecomputeengine.domain.UrlMap.PathMatcher;
 import org.jclouds.googlecomputeengine.domain.UrlMap.UrlMapTest;
 import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.collect.ImmutableList;
-
-public class UrlMapOptions {
-
-   private String name;
-   @Nullable private String description;
-   private List<HostRule> hostRules;
-   private List<PathMatcher> pathMatchers;
-   private List<UrlMapTest> tests;
-   private URI defaultService;
-   private String fingerprint;
-
-   /**
-    * Name of the UrlMap resource.
-    * @return name, provided by the client.
-    */
-   public String getName(){
-      return name;
-   }
-
-   /**
-    * @see UrlMapOptions#getName()
-    */
-   public UrlMapOptions name(String name) {
-      this.name = name;
-      return this;
-   }
-
-   /**
-    * An optional textual description of the UrlMap.
-    * @return description, provided by the client.
-    */
-   public String getDescription(){
-      return description;
-   }
-
-   /**
-    * @see UrlMapOptions#getDescription()
-    */
-   public UrlMapOptions description(String description) {
-      this.description = description;
-      return this;
-   }
-
-   /**
-    * Rules for matching and directing incoming hosts.
-    */
-   public List<HostRule> getHostRules() {
-      return hostRules;
-   }
-
-   /**
-    * @see UrlMapOptions#getHostRules()
-    */
-   public UrlMapOptions hostRules(List<HostRule> hostRules) {
-      this.hostRules = hostRules;
-      return this;
-   }
-
-   /**
-    * @see UrlMapOptions#getHostRules()
-    */
-   public UrlMapOptions hostRule(HostRule hostRule){
-      this.hostRules = ImmutableList.of(hostRule);
-      return this;
-   }
-
-   /**
-    * The list of named PathMatchers to use against the URL.
-    */
-   public List<PathMatcher> getPathMatchers() {
-      return pathMatchers;
-   }
-
-   /**
-    * @see UrlMapOptions#getPathMatchers()
-    */
-   public UrlMapOptions pathMatcher(PathMatcher pathMatcher) {
-      this.pathMatchers = ImmutableList.of(pathMatcher);
-      return this;
-   }
-
-   /**
-    * @see UrlMapOptions#getPathMatchers()
-    */
-   public UrlMapOptions pathMatchers(List<PathMatcher> pathMatchers) {
-      this.pathMatchers = pathMatchers;
-      return this;
-   }
-
-   /**
-    * The list of expected URL mappings. Request to update this
-    * UrlMap will succeed only all of the test cases pass.
-    */
-   public List<UrlMapTest> getTests() {
-      return tests;
-   }
-
-   /**
-    * @see UrlMapOptions#getTests()
-    */
-   public UrlMapOptions test(UrlMapTest urlMapTest) {
-      this.tests = ImmutableList.of(urlMapTest);
-      return this;
-   }
-
-   /**
-    * @see UrlMapOptions#getTests()
-    */
-   public UrlMapOptions urlMapTests(List<UrlMapTest> urlMapTests) {
-      this.tests = urlMapTests;
-      return this;
-   }
-
-   /**
-    * The URL of the BackendService resource if none of the hostRules match.
-    */
-   public URI getDefaultService() {
-      return defaultService;
-   }
-
-   /**
-    * @see UrlMapOptions#getDefaultService()
-    */
-   public UrlMapOptions defaultService(URI defaultService) {
-      this.defaultService = defaultService;
-      return this;
-   }
-
-   /**
-    * Fingerprint of this resource. A hash of the contents stored in this object.
-    * This field is used in optimistic locking. This field will be ignored when
-    * inserting a UrlMap. An up-to-date fingerprint must be provided in order to
-    * update the UrlMap.
-    */
-   public String getFingerprint() {
-      return fingerprint;
-   }
-
-   /**
-    * @see UrlMapOptions#getFingerprint()
-    */
-   public UrlMapOptions fingerprint(String fingerprint) {
-      this.fingerprint = fingerprint;
-      return this;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class UrlMapOptions {
+
+   @Nullable public abstract String name();
+   @Nullable public abstract String description();
+   @Nullable public abstract List<HostRule> hostRules();
+   @Nullable public abstract List<PathMatcher> pathMatchers();
+   @Nullable public abstract List<UrlMapTest> tests();
+   @Nullable public abstract URI defaultService();
+   @Nullable public abstract String fingerprint();
+
+   @SerializedNames({ "name", "description", "hostRules", "pathMatchers", "tests",
+                     "defaultService", "fingerprint"})
+   static UrlMapOptions create(String name, String description, List<HostRule> hostRules,
+         List<PathMatcher> pathMatchers, List<UrlMapTest> tests, URI defaultService, String fingerprint) {
+      return new AutoValue_UrlMapOptions(name, description, hostRules,
+             pathMatchers, tests, defaultService, fingerprint);
+   }
+
+   UrlMapOptions(){
+   }
+
+   public static class Builder {
+
+      private String name;
+      private String description;
+      private List<HostRule> hostRules;
+      private List<PathMatcher> pathMatchers;
+      private List<UrlMapTest> tests;
+      private URI defaultService;
+      private String fingerprint;
+
+      /**
+       * Name of the UrlMap resource.
+       */
+      public Builder name(String name) {
+         this.name = name;
+         return this;
+      }
+
+      /**
+       * An optional textual description of the UrlMap.
+       */
+      public Builder description(String description) {
+         this.description = description;
+         return this;
+      }
+
+      /**
+       * Rules for matching and directing incoming hosts.
+       */
+      public Builder hostRules(List<HostRule> hostRules) {
+         this.hostRules = hostRules;
+         return this;
+      }
+
+      /**
+       * The list of named PathMatchers to use against the URL.
+       */
+      public Builder pathMatchers(List<PathMatcher> pathMatchers) {
+         this.pathMatchers = pathMatchers;
+         return this;
+      }
+
+      /**
+       * The list of expected URL mappings. Request to update this
+       * UrlMap will succeed only all of the test cases pass.
+       */
+      public Builder tests(List<UrlMapTest> tests) {
+         this.tests = tests;
+         return this;
+      }
+
+      /**
+       * The URL of the BackendService resource if none of the hostRules match.
+       */
+      public Builder defaultService(URI defaultService) {
+         this.defaultService = defaultService;
+         return this;
+      }
+
+      /**
+       * Fingerprint of this resource. A hash of the contents stored in this object.
+       * This field is used in optimistic locking. This field will be ignored when
+       * inserting a UrlMap. An up-to-date fingerprint must be provided in order to
+       * update the UrlMap.
+       */
+      public Builder fingerprint(String fingerprint) {
+         this.fingerprint = fingerprint;
+         return this;
+      }
+
+      /**
+       * Builds the UrlMapOptions.
+       * Note: This enforces that "name" and "defaultService" are not null as the GCE API expects.
+       * If you are patching an existing UrlMap you may wish to use {@link #buildForPatch()} instead.
+       */
+      public UrlMapOptions build() {
+         checkNotNull(name, "In UrlMapOptions: A UrlMap name cannot be null, if patching an existing UrlMap use buildForPatch() instead of build()");
+         checkNotNull(defaultService, "In UrlMapOptions: A UrlMap defaultService cannot be null, if patching an existing UrlMap use buildForPatch() instead of build()");
+         return create(name, description, hostRules, pathMatchers, tests,
+               defaultService, fingerprint);
+      }
+
+      /**
+       * This build option is specifically for when patching an existing UrlMap.
+       * If not patching an existing urlMap it is recommended that you use {@link #build()}.
+       */
+      public UrlMapOptions buildForPatch() {
+         return create(name, description, hostRules, pathMatchers, tests,
+               defaultService, fingerprint);
+      }
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinderTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinderTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinderTest.java
deleted file mode 100644
index f55e938..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/TargetPoolCreationBinderTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.binders;
-
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
-import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.json.Json;
-import org.jclouds.json.internal.GsonWrapper;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.gson.Gson;
-
-@Test(groups = "unit", testName = "TargetPoolCreationBinderTest")
-public class TargetPoolCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
-
-   private static final List<URI> FAKE_HEALTH_CHECKS = ImmutableList.of(
-         URI.create("https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20141017"));
-   private static SessionAffinityValue SESSION_AFFINITY = SessionAffinityValue.CLIENT_IP_PROTO;
-   private static float FAILOVER_RATIO = (float) 0.4;
-   private static String DESCRIPTION = "This is a test!";
-
-   Json json = new GsonWrapper(new Gson());
- 
-   @Test
-   public void testMap() throws SecurityException, NoSuchMethodException {
-      TargetPoolCreationBinder binder = new TargetPoolCreationBinder(json);
-      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions()
-                                                                  .healthChecks(FAKE_HEALTH_CHECKS)
-                                                                  .sessionAffinity(SESSION_AFFINITY)
-                                                                  .failoverRatio(FAILOVER_RATIO)
-                                                                  .description(DESCRIPTION);
-
-      HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
-      Map<String, Object> postParams = ImmutableMap.of("name", "testTargetPoolName", "options", targetPoolCreationOptions);
-
-      binder.bindToRequest(request, postParams);
-
-      assertEquals(request.getPayload().getRawContent(),
-            "{\""
-            + "name\":\"testTargetPoolName\","
-            + "\"healthChecks\":[\"" + FAKE_HEALTH_CHECKS.toArray()[0] + "\"],"
-            + "\"sessionAffinity\":\"CLIENT_IP_PROTO\","
-            + "\"failoverRatio\":0.4,"
-            + "\"description\":\"This is a test!\""
-            + "}");
-      assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/json");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
index 257c4bc..2f03623 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
@@ -61,11 +61,12 @@ public class ForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
 
    @BeforeClass
    public void init() {
-      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions();
-      assertOperationDoneSuccessfully(targetPoolApi().create(TARGETPOOL_NAME, targetPoolCreationOptions));
+      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions.Builder(TARGETPOOL_NAME).build();
+      assertOperationDoneSuccessfully(targetPoolApi().create(targetPoolCreationOptions));
       targetPool = targetPoolApi().get(TARGETPOOL_NAME);
 
-      assertOperationDoneSuccessfully(targetPoolApi().create(TARGETPOOL_NAME_NEW, targetPoolCreationOptions));
+      targetPoolCreationOptions = new TargetPoolCreationOptions.Builder(TARGETPOOL_NAME_NEW).build();
+      assertOperationDoneSuccessfully(targetPoolApi().create(targetPoolCreationOptions));
       newTargetPool = targetPoolApi().get(TARGETPOOL_NAME_NEW);
 
       assertOperationDoneSuccessfully(addressApi().create(ADDRESS_NAME));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
index 31df698..a3656a0 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
@@ -66,9 +66,9 @@ public class GlobalForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiL
       assertOperationDoneSuccessfully(api.backendServices()
                                               .create(b));
 
-      UrlMapOptions map = new UrlMapOptions().name(GLOBAL_FORWARDING_RULE_URL_MAP_NAME)
+      UrlMapOptions map = new UrlMapOptions.Builder().name(GLOBAL_FORWARDING_RULE_URL_MAP_NAME)
                                              .description("simple url map")
-                                             .defaultService(getBackendServiceUrl(GLOBAL_FORWARDING_RULE_BACKEND_SERVICE_NAME));
+                                             .defaultService(getBackendServiceUrl(GLOBAL_FORWARDING_RULE_BACKEND_SERVICE_NAME)).build();
       assertOperationDoneSuccessfully(api.urlMaps()
                                               .create(map));
       assertOperationDoneSuccessfully(api.targetHttpProxies()

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
index ec2cad8..49e9cc5 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
@@ -78,7 +78,7 @@ public class HttpHealthCheckApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
          .port(options.port() + OFFSET)
          .checkIntervalSec(options.checkIntervalSec() + OFFSET)
          .timeoutSec(options.timeoutSec() + OFFSET)
-         .buildNoDefaults();
+         .buildForPatch();
       assertOperationDoneSuccessfully(api().patch(HTTP_HEALTH_CHECK_NAME, newOptions));
 
       // Check changes happened and others unchanged.

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
index ebc86fe..9efa8d9 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
@@ -91,7 +91,7 @@ public class HttpHealthCheckApiMockTest extends BaseGoogleComputeEngineApiMockTe
       server.enqueue(jsonResponse("/global_operation.json"));
 
       HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions.Builder()
-         .timeoutSec(0).unhealthyThreshold(0).buildNoDefaults();
+         .timeoutSec(0).unhealthyThreshold(0).buildForPatch();
       assertEquals(httpHealthCheckApi().patch("http-health-check", options),
             new ParseGlobalOperationTest().expected(url("/projects")));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiLiveTest.java
index 2a4e517..ef3abae 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiLiveTest.java
@@ -57,12 +57,14 @@ public class TargetHttpProxyApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
 
       assertOperationDoneSuccessfully(api.backendServices().create(b));
 
-      UrlMapOptions map = new UrlMapOptions().name(TARGET_HTTP_PROXY_URL_MAP_NAME).description("simple url map")
-                                             .defaultService(getBackendServiceUrl(URL_MAP_DEFAULT_SERVICE_NAME));
+      UrlMapOptions map = new UrlMapOptions.Builder().name(TARGET_HTTP_PROXY_URL_MAP_NAME).description("simple url map")
+                                             .defaultService(getBackendServiceUrl(URL_MAP_DEFAULT_SERVICE_NAME)).build();
       assertOperationDoneSuccessfully(api.urlMaps().create(map));
 
-      UrlMapOptions map2 = new UrlMapOptions().name(TARGET_HTTP_PROXY_URL_MAP_NAME + "-2").description("a second simple url map")
-            .defaultService(getBackendServiceUrl(URL_MAP_DEFAULT_SERVICE_NAME));
+      UrlMapOptions map2 = new UrlMapOptions.Builder().name(TARGET_HTTP_PROXY_URL_MAP_NAME + "-2")
+            .description("a second simple url map")
+            .defaultService(getBackendServiceUrl(URL_MAP_DEFAULT_SERVICE_NAME))
+            .build();
       assertOperationDoneSuccessfully(api.urlMaps().create(map2));
 
 
@@ -78,13 +80,8 @@ public class TargetHttpProxyApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
 
    @Test(groups = "live", dependsOnMethods = "testGetTargetHttpProxy")
    public void testSetUrlMapTargetHttpProxy() {
-      UrlMapOptions map = new UrlMapOptions().name(TARGET_HTTP_PROXY_URL_MAP_NAME).description("simple url map")
-                                             .defaultService(getBackendServiceUrl(URL_MAP_DEFAULT_SERVICE_NAME));
-      assertOperationDoneSuccessfully(api.urlMaps()
-                                              .create(map));
-
       assertOperationDoneSuccessfully(api().setUrlMap(TARGET_HTTP_PROXY_NAME,
-                                                           getUrlMapUrl(TARGET_HTTP_PROXY_URL_MAP_NAME + "-2")));
+                                                     getUrlMapUrl(TARGET_HTTP_PROXY_URL_MAP_NAME + "-2")));
    }
 
    @Test(groups = "live", dependsOnMethods = "testSetUrlMapTargetHttpProxy")
@@ -97,7 +94,7 @@ public class TargetHttpProxyApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
                                   getUrlMapUrl(TARGET_HTTP_PROXY_URL_MAP_NAME + "-2"));
    }
 
-   @Test(groups = "live", dependsOnMethods = "testListTargetHttpProxy")
+   @Test(groups = "live", dependsOnMethods = "testListTargetHttpProxy", alwaysRun = true)
    public void testDeleteTargetHttpProxy() {
       assertOperationDoneSuccessfully(api().delete(TARGET_HTTP_PROXY_NAME));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiMockTest.java
index 08d3e85..cd9a825 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiMockTest.java
@@ -23,6 +23,7 @@ import static org.testng.AssertJUnit.assertNull;
 import java.net.URI;
 
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.TargetHttpProxyOptions;
 import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
 import org.jclouds.googlecomputeengine.parse.ParseTargetHttpProxyListTest;
 import org.jclouds.googlecomputeengine.parse.ParseTargetHttpProxyTest;
@@ -55,6 +56,20 @@ public class TargetHttpProxyApiMockTest extends BaseGoogleComputeEngineApiMockTe
             stringFromResource("/target_http_proxy_insert.json"));
    }
 
+   public void insert_options() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      URI urlMap = URI.create(url("/projects/myproject/global/urlMaps/jclouds-test"));
+      TargetHttpProxyOptions options = new TargetHttpProxyOptions.Builder("jclouds-test", urlMap).description("test").build();
+      assertEquals(targetHttpProxyApi().create(options), new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/global/targetHttpProxies",
+            "{" +
+            "  \"name\": \"jclouds-test\"," +
+            "  \"urlMap\": \"" + url("/projects/myproject/global/urlMaps/jclouds-test") + "\"," +
+            "  \"description\": \"test\"" +
+            "}");
+   }
+
    public void delete() throws Exception {
       server.enqueue(jsonResponse("/operation.json"));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
index d94a616..c2423bc 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
@@ -126,10 +126,11 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    @Test(groups = "live")
    public void testInsertTargetPool() {
-      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions()
+      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions.Builder(BACKUP_TARGETPOOL_NAME)
       .description(DESCRIPTION_BACKUP)
-      .sessionAffinity(SessionAffinityValue.CLIENT_IP);
-      assertOperationDoneSuccessfully(api().create(BACKUP_TARGETPOOL_NAME, targetPoolCreationOptions));
+      .sessionAffinity(SessionAffinityValue.CLIENT_IP)
+      .build();
+      assertOperationDoneSuccessfully(api().create(targetPoolCreationOptions));
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertTargetPool")
@@ -137,12 +138,13 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       TargetPool targetPool = api().get(BACKUP_TARGETPOOL_NAME);
       assertNotNull(targetPool);
       // Make a Target Pool with a backup and failoverRatio specified.
-      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions()
+      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions.Builder(TARGETPOOL_NAME)
          .description(DESCRIPTION)
          .sessionAffinity(SessionAffinityValue.CLIENT_IP)
          .backupPool(targetPool.selfLink())
-         .failoverRatio((float) 0.5);
-      assertOperationDoneSuccessfully(api().create(TARGETPOOL_NAME, targetPoolCreationOptions));
+         .failoverRatio((float) 0.5)
+         .build();
+      assertOperationDoneSuccessfully(api().create(targetPoolCreationOptions));
       TargetPool targetPool2 = api().get(TARGETPOOL_NAME);
       assertNotNull(targetPool2);
       assertEquals(targetPool2.name(), TARGETPOOL_NAME);
@@ -222,8 +224,9 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    @Test(groups = "live", dependsOnMethods = {"testInsertTargetPool2"})
    public void testListBackupTargetPool() {
-      TargetPoolCreationOptions options = new TargetPoolCreationOptions().description("A targetPool for testing setBackup.");
-      assertOperationDoneSuccessfully(api().create(THIRD_TARGETPOOL_NAME, options));
+      TargetPoolCreationOptions options = new TargetPoolCreationOptions.Builder(THIRD_TARGETPOOL_NAME)
+      .description("A targetPool for testing setBackup.").build();
+      assertOperationDoneSuccessfully(api().create(options));
       TargetPool targetPool = api().get(THIRD_TARGETPOOL_NAME);
       assertNotNull(targetPool);
       assertEquals(targetPool.name(), THIRD_TARGETPOOL_NAME);

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiMockTest.java
index f45a384..5f579ec 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiMockTest.java
@@ -54,8 +54,8 @@ public class TargetPoolApiMockTest extends BaseGoogleComputeEngineApiMockTest {
    public void insert() throws Exception {
       server.enqueue(jsonResponse("/region_operation.json"));
 
-      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions();
-      assertEquals(targetPoolApi().create("test", targetPoolCreationOptions),
+      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions.Builder("test").build();
+      assertEquals(targetPoolApi().create(targetPoolCreationOptions),
             new ParseRegionOperationTest().expected(url("/projects")));
       assertSent(server, "POST", "/projects/party/regions/us-central1/targetPools",
             stringFromResource("/targetpool_insert.json"));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
index f47d96e..f48e44a 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiLiveTest.java
@@ -58,8 +58,8 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
                                                            .healthChecks(healthChecks);
       assertOperationDoneSuccessfully(api.backendServices().create(b));
 
-      UrlMapOptions map = new UrlMapOptions().name(URL_MAP_NAME).description("simple url map")
-                                             .defaultService(getBackendServiceUrl(URL_MAP_BACKEND_SERVICE_NAME));
+      UrlMapOptions map = new UrlMapOptions.Builder().name(URL_MAP_NAME).description("simple url map")
+                                             .defaultService(getBackendServiceUrl(URL_MAP_BACKEND_SERVICE_NAME)).build();
 
       assertOperationDoneSuccessfully(api().create(map));
 
@@ -100,11 +100,11 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
       ImmutableList<String> hosts = ImmutableList.<String>of("jclouds-test");
       ImmutableList<HostRule> hostRules = ImmutableList.<HostRule>of(HostRule.create("", hosts, "test-path-matcher"));
-      UrlMapOptions options = new UrlMapOptions().name(URL_MAP_NAME)
+      UrlMapOptions options = new UrlMapOptions.Builder().name(URL_MAP_NAME)
                                                  .pathMatchers(matchers)
                                                  .hostRules(hostRules)
                                                  .defaultService(service)
-                                                 .fingerprint(fingerprint);
+                                                 .fingerprint(fingerprint).build();
 
       assertOperationDoneSuccessfully(api().update(URL_MAP_NAME, options));
 
@@ -119,8 +119,8 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       UrlMapTest urlMapTest = UrlMapTest.create(null, "jclouds-test", "/test/path", service);
       ImmutableList<UrlMap.UrlMapTest> urlMapTests = ImmutableList.<UrlMap.UrlMapTest>of(urlMapTest);
 
-      UrlMapOptions options = new UrlMapOptions().urlMapTests(urlMapTests)
-                                                 .fingerprint(fingerprint);
+      UrlMapOptions options = new UrlMapOptions.Builder().tests(urlMapTests)
+                                                 .fingerprint(fingerprint).buildForPatch();
       assertOperationDoneSuccessfully(api().patch(URL_MAP_NAME, options));
 
       // Update options with settings it should have for later assertions.
@@ -132,11 +132,15 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
       ImmutableList<String> hosts = ImmutableList.<String>of("jclouds-test");
       ImmutableList<HostRule> hostRules = ImmutableList.<HostRule>of(HostRule.create("", hosts, "test-path-matcher"));
-      options.name(URL_MAP_NAME)
+
+      options = new UrlMapOptions.Builder().name(URL_MAP_NAME)
              .description("simple url map")
              .pathMatchers(matchers)
              .hostRules(hostRules)
-             .defaultService(service);
+             .defaultService(service)
+             .tests(urlMapTests)
+             .fingerprint(fingerprint)
+             .build();
 
       assertUrlMapEquals(api().get(URL_MAP_NAME), options);
    }
@@ -163,14 +167,14 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       UrlMapTest urlMapTest = UrlMapTest.create(null, "jclouds-test", "/test/path", service);
       ImmutableList<UrlMap.UrlMapTest> urlMapTests = ImmutableList.<UrlMap.UrlMapTest>of(urlMapTest);
 
-      UrlMapOptions options = new UrlMapOptions();
-
-      options.pathMatchers(matchers)
+      UrlMapOptions options = new UrlMapOptions.Builder()
+             .pathMatchers(matchers)
              .name(URL_MAP_NAME)
              .hostRules(hostRules)
-             .urlMapTests(urlMapTests)
+             .tests(urlMapTests)
              .defaultService(service)
-             .description("simple url map");
+             .description("simple url map")
+             .build();
 
       UrlMapValidateResult results = api().validate(URL_MAP_NAME, options);
       UrlMapValidateResult expected = UrlMapValidateResult.allPass();
@@ -196,9 +200,9 @@ public class UrlMapApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    }
 
    private void assertUrlMapEquals(UrlMap result, UrlMapOptions expected) {
-      assertEquals(result.name(), expected.getName());
-      assertEquals(result.defaultService(), expected.getDefaultService());
-      assertEquals(result.pathMatchers(), expected.getPathMatchers());
-      assertEquals(result.hostRules(), expected.getHostRules());
+      assertEquals(result.name(), expected.name());
+      assertEquals(result.defaultService(), expected.defaultService());
+      assertEquals(result.pathMatchers(), expected.pathMatchers());
+      assertEquals(result.hostRules(), expected.hostRules());
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
index 1107557..7c6d639 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
@@ -119,17 +119,18 @@ public class UrlMapApiMockTest extends BaseGoogleComputeEngineApiMockTest {
 
    private UrlMapOptions createBasicMap() {
       URI service = URI.create(url("/projects/myproject/global/backendServices/jclouds-test"));
-      return new UrlMapOptions().name("jclouds-test")
+      return new UrlMapOptions.Builder().name("jclouds-test")
                                 .description("Sample url map")
-                                .hostRule(HostRule.create(null, ImmutableList.of("jclouds-test"), "path"))
-                                .pathMatcher(PathMatcher.create("path",
+                                .hostRules(ImmutableList.of(HostRule.create(null, ImmutableList.of("jclouds-test"), "path")))
+                                .pathMatchers(ImmutableList.of(PathMatcher.create("path",
                                                                 null,
                                                                 service,
                                                                 ImmutableList.of(
                                                                       PathRule.create(ImmutableList.of("/"),
-                                                                                      service))))
-                                .test(UrlMap.UrlMapTest.create(null, "jclouds-test", "/test/path", service))
-                                .defaultService(service);
+                                                                                      service)))))
+                                .tests(ImmutableList.of(UrlMap.UrlMapTest.create(null, "jclouds-test", "/test/path", service)))
+                                .defaultService(service)
+                                .build();
    }
 
    UrlMapApi urlMapApi() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/0f67b625/providers/google-compute-engine/src/test/resources/target_http_proxy_insert.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/target_http_proxy_insert.json b/providers/google-compute-engine/src/test/resources/target_http_proxy_insert.json
index b296e71..991055a 100644
--- a/providers/google-compute-engine/src/test/resources/target_http_proxy_insert.json
+++ b/providers/google-compute-engine/src/test/resources/target_http_proxy_insert.json
@@ -1 +1,4 @@
-{"name":"jclouds-test","urlMap":"https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test"}
\ No newline at end of file
+{
+  "name": "jclouds-test",
+  "urlMap": "https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test"
+}
\ No newline at end of file


[36/50] [abbrv] jclouds git commit: Removing network management, use default network, use fewer firewalls.

Posted by na...@apache.org.
Removing network management, use default network, use fewer firewalls.


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

Branch: refs/heads/master
Commit: 5adfce8d4871ab8d7e8c126bb0f36ae4942be00f
Parents: 9d3b2d7
Author: Daniel Broudy <br...@google.com>
Authored: Thu Apr 23 13:39:03 2015 -0700
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue May 19 15:39:55 2015 +0200

----------------------------------------------------------------------
 .../compute/GoogleComputeEngineService.java     |  37 ++----
 .../GoogleComputeEngineServiceAdapter.java      |  21 ++-
 ...GoogleComputeEngineServiceContextModule.java |  18 ---
 .../compute/domain/NetworkAndAddressRange.java  |  41 ------
 .../functions/CreateNetworkIfNeeded.java        |  74 -----------
 .../compute/functions/FindNetworkOrCreate.java  |  45 -------
 .../functions/FirewallTagNamingConvention.java  |  14 +-
 .../functions/InstanceToNodeMetadata.java       |   1 -
 .../GoogleComputeEngineTemplateOptions.java     |  15 ---
 ...desWithGroupEncodedIntoNameThenAddToSet.java | 123 ++++++++++++------
 .../GoogleComputeEngineServiceLiveTest.java     |   9 ++
 .../GoogleComputeEngineServiceMockTest.java     |  52 +++-----
 .../functions/CreateNetworkIfNeededTest.java    | 130 -------------------
 .../functions/FindNetworkOrCreateTest.java      | 130 -------------------
 .../parse/ParseNetworkTest.java                 |   4 +-
 .../parse/SimpleParsingTests.java               |  82 ++++++++++++
 .../firewall_list.json                          |   3 +-
 .../src/test/resources/firewall_insert_2.json   |   6 +-
 .../src/test/resources/instance_insert_2.json   |   4 +-
 .../src/test/resources/network_get.json         |   4 +-
 .../src/test/resources/network_get_default.json |  10 ++
 .../src/test/resources/network_list.json        |   4 +-
 22 files changed, 258 insertions(+), 569 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
index ed7c5fb6..241a91d 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
@@ -58,7 +58,6 @@ import org.jclouds.domain.Location;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
 import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.domain.Network;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.features.FirewallApi;
 import org.jclouds.scriptbuilder.functions.InitAdminAccess;
@@ -125,36 +124,26 @@ public final class GoogleComputeEngineService extends BaseComputeService {
    protected synchronized void cleanUpIncidentalResourcesOfDeadNodes(Set<? extends NodeMetadata> deadNodes) {
       Set<String> orphanedGroups = findOrphanedGroups.apply(deadNodes);
       for (String orphanedGroup : orphanedGroups) {
-         cleanUpNetworksAndFirewallsForGroup(orphanedGroup);
+         cleanUpFirewallsForGroup(orphanedGroup);
       }
    }
 
-   private void cleanUpNetworksAndFirewallsForGroup(final String groupName) {
-      String resourceName = namingConvention.create().sharedNameForGroup(groupName);
-      Network network = api.networks().get(resourceName);
+   private void cleanUpFirewallsForGroup(final String groupName) {
+      GroupNamingConvention namingScheme = namingConvention.create();
       FirewallApi firewallApi = api.firewalls();
 
       for (Firewall firewall : concat(firewallApi.list())) {
-         if (firewall == null || !firewall.network().equals(network.selfLink())) {
-            continue;
+         String foundGroup = namingScheme.groupInUniqueNameOrNull(firewall.name());
+         if ((foundGroup != null) && foundGroup.equals(groupName)){
+            AtomicReference<Operation> operation = Atomics.newReference(firewallApi.delete(firewall.name()));
+            operationDone.apply(operation);
+
+            if (operation.get().httpErrorStatusCode() != null) {
+               logger.warn("delete orphaned firewall %s failed. Http Error Code: %d HttpError: %s",
+                     operation.get().targetId(), operation.get().httpErrorStatusCode(),
+                     operation.get().httpErrorMessage());
+            }
          }
-         AtomicReference<Operation> operation = Atomics.newReference(firewallApi.delete(firewall.name()));
-         operationDone.apply(operation);
-
-         if (operation.get().httpErrorStatusCode() != null) {
-            logger.warn("delete orphaned firewall %s failed. Http Error Code: %d HttpError: %s",
-                  operation.get().targetId(), operation.get().httpErrorStatusCode(),
-                  operation.get().httpErrorMessage());
-         }
-      }
-
-      AtomicReference<Operation> operation = Atomics.newReference(api.networks().delete(resourceName));
-
-      operationDone.apply(operation);
-
-      if (operation.get().httpErrorStatusCode() != null) {
-         logger.warn("delete orphaned network failed. Http Error Code: " + operation.get().httpErrorStatusCode() +
-               " HttpError: " + operation.get().httpErrorMessage());
       }
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index 91a8dfe..01654ec 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -23,8 +23,10 @@ import static com.google.common.collect.Lists.newArrayList;
 import static java.lang.String.format;
 import static org.jclouds.googlecloud.internal.ListPages.concat;
 import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperties.IMAGE_PROJECTS;
+import static org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet.simplifyPorts;
 
 import java.net.URI;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicReference;
@@ -111,26 +113,35 @@ public final class GoogleComputeEngineServiceAdapter
    @Override public NodeAndInitialCredentials<Instance> createNodeWithGroupEncodedIntoName(String group, String name,
          Template template) {
       GoogleComputeEngineTemplateOptions options = GoogleComputeEngineTemplateOptions.class.cast(template.getOptions());
-      checkNotNull(options.network(), "template options must specify a network");
+
+      checkNotNull(options.getNetworks(), "template options must specify a network");
       checkNotNull(template.getHardware().getUri(), "hardware must have a URI");
       checkNotNull(template.getImage().getUri(), "image URI is null");
 
       List<AttachDisk> disks = Lists.newArrayList();
       disks.add(AttachDisk.newBootDisk(template.getImage().getUri()));
 
+      Iterator<String> networks = options.getNetworks().iterator();
+
+      URI network = URI.create(networks.next());
+      assert !networks.hasNext() : "Error: Options should specify only one network";
+
       NewInstance newInstance = NewInstance.create(
             name, // name
             template.getHardware().getUri(), // machineType
-            options.network(), // network
+            network, // network
             disks, // disks
             group // description
       );
 
-      // Add tags from template and for security groups
+      // Add tags from template
       newInstance.tags().items().addAll(options.getTags());
+
+      // Add tags for firewalls
       FirewallTagNamingConvention naming = firewallTagNamingConvention.get(group);
-      for (int port : options.getInboundPorts()) {
-         newInstance.tags().items().add(naming.name(port));
+      List<String> ports = simplifyPorts(options.getInboundPorts());
+      if (ports != null){
+         newInstance.tags().items().add(naming.name(ports));
       }
 
       // Add metadata from template and for ssh key and image id

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
index 8eaeaa9..b943c2c 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
@@ -45,9 +45,6 @@ import org.jclouds.compute.options.TemplateOptions;
 import org.jclouds.domain.Location;
 import org.jclouds.googlecomputeengine.compute.GoogleComputeEngineService;
 import org.jclouds.googlecomputeengine.compute.GoogleComputeEngineServiceAdapter;
-import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
-import org.jclouds.googlecomputeengine.compute.functions.CreateNetworkIfNeeded;
-import org.jclouds.googlecomputeengine.compute.functions.FindNetworkOrCreate;
 import org.jclouds.googlecomputeengine.compute.functions.FirewallTagNamingConvention;
 import org.jclouds.googlecomputeengine.compute.functions.GoogleComputeEngineImageToImage;
 import org.jclouds.googlecomputeengine.compute.functions.InstanceToNodeMetadata;
@@ -62,7 +59,6 @@ import org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEnco
 import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.MachineType;
-import org.jclouds.googlecomputeengine.domain.Network;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.location.suppliers.ImplicitLocationSupplier;
 import org.jclouds.location.suppliers.implicit.FirstZone;
@@ -72,9 +68,6 @@ import com.google.common.base.Functions;
 import com.google.common.base.Optional;
 import com.google.common.base.Predicate;
 import com.google.common.base.Supplier;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Maps;
 import com.google.inject.Injector;
@@ -121,12 +114,6 @@ public final class GoogleComputeEngineServiceContextModule
       bind(new TypeLiteral<Predicate<String>>() {
       }).to(AllNodesInGroupTerminated.class);
 
-      bind(new TypeLiteral<Function<NetworkAndAddressRange, Network>>() {
-      }).to(CreateNetworkIfNeeded.class);
-
-      bind(new TypeLiteral<CacheLoader<NetworkAndAddressRange, Network>>() {
-      }).to(FindNetworkOrCreate.class);
-
       bind(FirewallTagNamingConvention.Factory.class).in(Scopes.SINGLETON);
       bindHttpApi(binder(), Resources.class);
    }
@@ -173,11 +160,6 @@ public final class GoogleComputeEngineServiceContextModule
       }, seconds, SECONDS);
    }
 
-   @Provides @Singleton
-   LoadingCache<NetworkAndAddressRange, Network> networkMap(CacheLoader<NetworkAndAddressRange, Network> in) {
-      return CacheBuilder.newBuilder().build(in);
-   }
-
    @Override protected Optional<ImageExtension> provideImageExtension(Injector i) {
       return Optional.absent();
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/domain/NetworkAndAddressRange.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/domain/NetworkAndAddressRange.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/domain/NetworkAndAddressRange.java
deleted file mode 100644
index d70cc98..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/domain/NetworkAndAddressRange.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.domain;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.json.SerializedNames;
-
-import com.google.auto.value.AutoValue;
-
-/** Container for network, IPv4 range and optional gateway, for creation caching */
-@AutoValue
-public abstract class NetworkAndAddressRange {
-
-   public abstract String name();
-
-   public abstract String rangeIPv4();
-
-   @Nullable public abstract String gateway();
-
-   @SerializedNames({ "name", "ipV4Range", "gateway" })
-   public static NetworkAndAddressRange create(String name, String rangeIPv4, @Nullable String gateway) {
-      return new AutoValue_NetworkAndAddressRange(name, rangeIPv4, gateway);
-   }
-
-   NetworkAndAddressRange() {
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeeded.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeeded.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeeded.java
deleted file mode 100644
index 3923ad7..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeeded.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Inject;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
-import org.jclouds.googlecomputeengine.domain.Network;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.options.NetworkCreationOptions;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.util.concurrent.Atomics;
-
-public final class CreateNetworkIfNeeded implements Function<NetworkAndAddressRange, Network> {
-   private final GoogleComputeEngineApi api;
-   private final Predicate<AtomicReference<Operation>> operationDone;
-
-   @Inject CreateNetworkIfNeeded(GoogleComputeEngineApi api, Predicate<AtomicReference<Operation>> operationDone) {
-      this.api = api;
-      this.operationDone = operationDone;
-   }
-
-   @Override
-   public Network apply(NetworkAndAddressRange input) {
-      checkNotNull(input, "input");
-
-      Network nw = api.networks().get(input.name());
-      if (nw != null) {
-         return nw;
-      }
-
-      if (input.gateway() != null) {
-         NetworkCreationOptions options = new NetworkCreationOptions.Builder(input.name(), input.rangeIPv4())
-            .gatewayIPv4(input.gateway()).build();
-         AtomicReference<Operation> operation = Atomics.newReference(api.networks()
-               .createInIPv4Range(options));
-         operationDone.apply(operation);
-
-         checkState(operation.get().httpErrorStatusCode() == null,
-               "Could not insert network, operation failed" + operation);
-      } else {
-         AtomicReference<Operation> operation = Atomics
-               .newReference(api.networks().createInIPv4Range(input.name(), input.rangeIPv4()));
-         operationDone.apply(operation);
-
-         checkState(operation.get().httpErrorStatusCode() == null,
-               "Could not insert network, operation failed" + operation);
-      }
-      return checkNotNull(api.networks().get(input.name()), "no network with name %s was found",
-            input.name());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreate.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreate.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreate.java
deleted file mode 100644
index 1137ef9..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreate.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import javax.inject.Inject;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
-import org.jclouds.googlecomputeengine.domain.Network;
-
-import com.google.common.base.Function;
-import com.google.common.cache.CacheLoader;
-
-public final class FindNetworkOrCreate extends CacheLoader<NetworkAndAddressRange, Network> {
-   private final GoogleComputeEngineApi api;
-   private final Function<NetworkAndAddressRange, Network> networkCreator;
-
-   @Inject FindNetworkOrCreate(GoogleComputeEngineApi api, Function<NetworkAndAddressRange, Network> networkCreator) {
-      this.api = api;
-      this.networkCreator = networkCreator;
-   }
-
-   @Override public Network load(NetworkAndAddressRange in) {
-      Network network = api.networks().get(in.name());
-      if (network != null) {
-         return network;
-      } else {
-         return networkCreator.apply(in);
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
index 2cd7e84..1fe5928 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
@@ -16,6 +16,8 @@
  */
 package org.jclouds.googlecomputeengine.compute.functions;
 
+import java.util.List;
+
 import javax.inject.Inject;
 
 import org.jclouds.compute.functions.GroupNamingConvention;
@@ -46,10 +48,18 @@ public final class FirewallTagNamingConvention {
       this.sharedResourceName = sharedResourceName;
    }
 
-   public String name(int port) {
-      return String.format("%s-port-%s", sharedResourceName, port);
+   public String name(List<String> ports) {
+      final int prime = 31;
+      int result = 1;
+      for (String s : ports){
+         result = result * prime + s.hashCode();
+         // TODO(broudy): this may break between java versions! Consider a different implementation.
+      }
+
+      return String.format("%s-%s", sharedResourceName, Integer.toHexString(result));
    }
 
+
    public Predicate<String> isFirewallTag() {
       return new Predicate<String>() {
          @Override

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
index 5562b48..81e40b9 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
@@ -89,7 +89,6 @@ public final class InstanceToNodeMetadata implements Function<Instance, NodeMeta
       URI bootImage = diskToSourceImage.get(input.disks().get(0).source());
 
       builder.id(input.selfLink().toString())
-             .providerId(input.id())
              .name(input.name())
              .providerId(input.id())
              .hostname(input.name())

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
index 1b1dac8..2fc8e8a 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
@@ -16,18 +16,15 @@
  */
 package org.jclouds.googlecomputeengine.compute.options;
 
-import java.net.URI;
 import java.util.Map;
 
 import org.jclouds.compute.options.TemplateOptions;
 import org.jclouds.domain.LoginCredentials;
-import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.scriptbuilder.domain.Statement;
 
 /** Instance options specific to Google Compute Engine. */
 public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
 
-   private URI network = null;
    private boolean autoCreateKeyPair = true;
 
    @Override
@@ -42,22 +39,10 @@ public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
       super.copyTo(to);
       if (to instanceof GoogleComputeEngineTemplateOptions) {
          GoogleComputeEngineTemplateOptions eTo = GoogleComputeEngineTemplateOptions.class.cast(to);
-         eTo.network(network());
          eTo.autoCreateKeyPair(autoCreateKeyPair());
       }
    }
 
-   /** @see #network()  */
-   public GoogleComputeEngineTemplateOptions network(URI network) {
-      this.network = network;
-      return this;
-   }
-
-   /** The network instances will attach to. When absent, a new network will be created for the project. */
-   @Nullable public URI network() {
-      return network;
-   }
-
    /**
     * Sets whether an SSH key pair should be created automatically.
     */

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
index 7fb71df..20bc2c3 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
@@ -16,10 +16,13 @@
  */
 package org.jclouds.googlecomputeengine.compute.strategy;
 
+import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkState;
 import static com.google.common.collect.ImmutableList.of;
 
-import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -39,7 +42,6 @@ import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
 import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
 import org.jclouds.compute.strategy.ListNodesStrategy;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
 import org.jclouds.googlecomputeengine.compute.functions.FirewallTagNamingConvention;
 import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
 import org.jclouds.googlecomputeengine.domain.Firewall;
@@ -53,9 +55,8 @@ import org.jclouds.ssh.SshKeyPairGenerator;
 
 import com.google.common.base.Predicate;
 import com.google.common.base.Strings;
-import com.google.common.cache.LoadingCache;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Multimap;
 import com.google.common.util.concurrent.Atomics;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -67,8 +68,9 @@ public final class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
    public static final String EXTERIOR_RANGE = "0.0.0.0/0";
    public static final String DEFAULT_INTERNAL_NETWORK_RANGE = "10.0.0.0/8";
 
+   public static final String DEFAULT_NETWORK_NAME = "default";
+
    private final GoogleComputeEngineApi api;
-   private final LoadingCache<NetworkAndAddressRange, Network> networkMap;
    private final Predicate<AtomicReference<Operation>> operationDone;
    private final FirewallTagNamingConvention.Factory firewallTagNamingConvention;
    private final SshKeyPairGenerator keyGenerator;
@@ -85,13 +87,11 @@ public final class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
          @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
          CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
          GoogleComputeEngineApi api, Predicate<AtomicReference<Operation>> operationDone,
-         LoadingCache<NetworkAndAddressRange, Network> networkMap,
          FirewallTagNamingConvention.Factory firewallTagNamingConvention, SshKeyPairGenerator keyGenerator) {
       super(addNodeWithGroupStrategy, listNodesStrategy, namingConvention, userExecutor,
             customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
       this.api = api;
       this.operationDone = operationDone;
-      this.networkMap = networkMap;
       this.firewallTagNamingConvention = firewallTagNamingConvention;
       this.keyGenerator = keyGenerator;
    }
@@ -101,17 +101,16 @@ public final class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
          Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes,
          Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
 
-      String sharedResourceName = namingConvention.create().sharedNameForGroup(group);
-      Template mutableTemplate = template.clone();
+            Template mutableTemplate = template.clone();
       GoogleComputeEngineTemplateOptions templateOptions = GoogleComputeEngineTemplateOptions.class
             .cast(mutableTemplate.getOptions());
       assert template.getOptions().equals(templateOptions) : "options didn't clone properly";
 
-      // get or insert the network and insert a firewall with the users
-      // configuration
-      Network network = getOrCreateNetwork(templateOptions, sharedResourceName);
+      // Get Network
+      Network network = getNetwork(templateOptions.getNetworks());
+      // Setup Firewall rules
       getOrCreateFirewalls(templateOptions, network, firewallTagNamingConvention.get(group));
-      templateOptions.network(network.selfLink());
+      templateOptions.networks(ImmutableSet.of(network.selfLink().toString()));
       templateOptions.userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
 
       // Configure the default credentials, if needed
@@ -131,12 +130,22 @@ public final class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
    }
 
    /**
-    * Try and find a network either previously created by jclouds or user
-    * defined.
+    * Try and find a network previously created by the user.
     */
-   private Network getOrCreateNetwork(GoogleComputeEngineTemplateOptions templateOptions, String sharedResourceName) {
-      String networkName = templateOptions.network() != null ? toName(templateOptions.network()) : sharedResourceName;
-      return networkMap.getUnchecked(NetworkAndAddressRange.create(networkName, DEFAULT_INTERNAL_NETWORK_RANGE, null));
+   private Network getNetwork(Set<String> networks) {
+      String networkName;
+      if (networks == null || networks.isEmpty()){
+         networkName = DEFAULT_NETWORK_NAME;
+      }
+      else {
+         Iterator<String> iterator = networks.iterator();
+         networkName = nameFromNetworkString(iterator.next());
+         checkArgument(!iterator.hasNext(), "Error: Please specify only one network in TemplateOptions when using GCE.");
+
+      }
+      Network network = api.networks().get(networkName);
+      checkArgument(network != null, "Error: no network with name %s was found", networkName);
+      return network;
    }
 
    /**
@@ -147,7 +156,7 @@ public final class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
     * {@link FirewallTagNamingConvention}, with a target tag also following the
     * {@link FirewallTagNamingConvention}, which opens the requested port for
     * all sources on both TCP and UDP protocols.
-    * 
+    *
     * @see org.jclouds.googlecomputeengine.features.FirewallApi#patch(String,
     *      org.jclouds.googlecomputeengine.options.FirewallOptions)
     */
@@ -155,32 +164,70 @@ public final class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
          FirewallTagNamingConvention naming) {
 
       FirewallApi firewallApi = api.firewalls();
-      List<AtomicReference<Operation>> operations = Lists.newArrayList();
-
-      for (Integer port : templateOptions.getInboundPorts()) {
-         String name = naming.name(port);
-         Firewall firewall = firewallApi.get(name);
-         if (firewall == null) {
-            List<String> ports = ImmutableList.of(String.valueOf(port));
-            List<Rule> rules = ImmutableList.of(Rule.create("tcp", ports), Rule.create("udp", ports));
-            FirewallOptions firewallOptions = new FirewallOptions().name(name).network(network.selfLink())
-                  .allowedRules(rules).sourceTags(templateOptions.getTags())
-                  .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE)).targetTags(ImmutableList.of(name));
-            AtomicReference<Operation> operation = Atomics.newReference(firewallApi.createInNetwork(
-                  firewallOptions.name(), network.selfLink(), firewallOptions));
-            operations.add(operation);
-         }
+      int[] inboundPorts = templateOptions.getInboundPorts();
+      if ((inboundPorts == null) || inboundPorts.length == 0){
+         return;
       }
 
-      for (AtomicReference<Operation> operation : operations) {
+      List<String> ports = simplifyPorts(inboundPorts);
+      String name = naming.name(ports);
+      Firewall firewall = firewallApi.get(name);
+      AtomicReference<Operation> operation = null;
+      if (firewall == null) {
+         List<Rule> rules = ImmutableList.of(Rule.create("tcp", ports), Rule.create("udp", ports));
+         FirewallOptions firewallOptions = new FirewallOptions().name(name).network(network.selfLink())
+                  .allowedRules(rules).sourceTags(templateOptions.getTags())
+                  .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE))
+                  .targetTags(ImmutableList.of(name));
+
+         operation = Atomics.newReference(firewallApi
+               .createInNetwork(firewallOptions.name(), network.selfLink(), firewallOptions));
+
          operationDone.apply(operation);
          checkState(operation.get().httpErrorStatusCode() == null, "Could not insert firewall, operation failed %s",
                operation);
       }
    }
 
-   private static String toName(URI link) {
-      String path = link.getPath();
-      return path.substring(path.lastIndexOf('/') + 1);
+   // Helper function for simplifying an array of ports to a list of ranges FirewallOptions expects.
+   public static List<String> simplifyPorts(int[] ports){
+      if ((ports == null) || (ports.length == 0)) {
+         return null;
+      }
+      ArrayList<String> output = new ArrayList<String>();
+      Arrays.sort(ports);
+
+      int range_start = ports[0];
+      int range_end = ports[0];
+      for (int i = 1; i < ports.length; i++) {
+         if ((ports[i - 1] == ports[i] - 1) || (ports[i - 1] == ports[i])){
+            // Range continues.
+            range_end = ports[i];
+         }
+         else {
+            // Range ends.
+            output.add(formatRange(range_start, range_end));
+            range_start = ports[i];
+            range_end = ports[i];
+         }
+      }
+      // Make sure we get the last range.
+      output.add(formatRange(range_start, range_end));
+      return output;
+   }
+
+   // Helper function for simplifyPorts. Formats port range strings.
+   private static String formatRange(int start, int finish){
+      if (start == finish){
+         return Integer.toString(start);
+      }
+      else {
+         return String.format("%s-%s", Integer.toString(start), Integer.toString(finish));
+      }
+   }
+
+   // Helper function for getting the network name from the full URI.
+   public static String nameFromNetworkString(String networkString) {
+      return networkString.substring(networkString.lastIndexOf('/') + 1);
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
index 42c62f0..8c449b0 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
@@ -21,6 +21,7 @@ import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 
 import java.util.Properties;
+import java.util.Set;
 
 import org.jclouds.compute.domain.Hardware;
 import org.jclouds.compute.domain.NodeMetadata;
@@ -113,4 +114,12 @@ public class GoogleComputeEngineServiceLiveTest extends BaseComputeServiceLiveTe
    protected Module getSshModule() {
       return new SshjSshClientModule();
    }
+
+   @Override
+   protected void checkTagsInNodeEquals(NodeMetadata node, ImmutableSet<String> tags) {
+      Set<String> nodeTags = node.getTags();
+      for (String tag : tags){
+         assert nodeTags.contains(tag) : String.format("node tags did not match %s %s node:", tags, nodeTags, node);
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
index 839a344..23a2b50 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
@@ -73,39 +73,34 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
       assertSent(server, "GET", "/projects/party/aggregated/machineTypes");
    }
 
-   public void networksAndFirewallDeletedWhenAllGroupNodesAreTerminated() throws IOException, InterruptedException {
-      server.enqueue(instanceWithNetworkAndStatus("test-delete-networks", "test-network", RUNNING));
+   public void firewallDeletedWhenAllGroupNodesAreTerminated() throws IOException, InterruptedException {
+      server.enqueue(instanceWithNetworkAndStatus("test-delete-1", "default", RUNNING));
       server.enqueue(singleRegionSingleZoneResponse());
-      server.enqueue(jsonResponse("/aggregated_machinetype_list.json"));
-      server.enqueue(jsonResponse("/operation.json"));
+      server.enqueue(jsonResponse("/aggregated_machinetype_list.json")); // Why are we getting machineTypes to delete an instance?
+      server.enqueue(jsonResponse("/operation.json")); // instance delete
       server.enqueue(jsonResponse("/zone_operation.json"));
-      server.enqueue(instanceWithNetworkAndStatus("test-delete-networks", "test-network", TERMINATED));
-      server.enqueue(aggregatedListWithInstanceNetworkAndStatus("test-delete-networks", "test-network", TERMINATED));
-      server.enqueue(jsonResponse("/GoogleComputeEngineServiceExpectTest/network_get.json"));
+      server.enqueue(instanceWithNetworkAndStatus("test-delete-1", "default", TERMINATED));
+      server.enqueue(aggregatedListWithInstanceNetworkAndStatus("test-delete-1", "default", TERMINATED));
       server.enqueue(jsonResponse("/GoogleComputeEngineServiceExpectTest/firewall_list.json"));
       server.enqueue(jsonResponse("/operation.json"));
       server.enqueue(jsonResponse("/zone_operation.json"));
-      server.enqueue(jsonResponse("/operation.json"));
-      server.enqueue(jsonResponse("/zone_operation.json"));
 
       ComputeService computeService = computeService();
-      computeService.destroyNode(url("/jclouds/zones/us-central1-a/instances/test-delete-networks"));
+      computeService.destroyNode(url("/jclouds/zones/us-central1-a/instances/test-delete-1"));
 
-      assertSent(server, "GET", "/jclouds/zones/us-central1-a/instances/test-delete-networks");
+      assertSent(server, "GET", "/jclouds/zones/us-central1-a/instances/test-delete-1");
       assertSent(server, "GET", "/projects/party/regions");
-      assertSent(server, "GET", "/projects/party/aggregated/machineTypes");
-      assertSent(server, "DELETE", "/jclouds/zones/us-central1-a/instances/test-delete-networks");
+      assertSent(server, "GET", "/projects/party/aggregated/machineTypes"); // Why are we getting machineTypes to delete an instance?
+      assertSent(server, "DELETE", "/jclouds/zones/us-central1-a/instances/test-delete-1"); // instance delete
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");
-      assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-delete-networks");
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-delete-1"); // get instance
       assertSent(server, "GET", "/projects/party/aggregated/instances");
-      assertSent(server, "GET", "/projects/party/global/networks/jclouds-test-delete");
       assertSent(server, "GET", "/projects/party/global/firewalls");
-      assertSent(server, "DELETE", "/projects/party/global/firewalls/jclouds-test-delete");
-      assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");
-      assertSent(server, "DELETE", "/projects/party/global/networks/jclouds-test-delete");
+      assertSent(server, "DELETE", "/projects/party/global/firewalls/jclouds-test-delete-34sf");
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");
    }
 
+
    public void listAssignableLocations() throws Exception {
       server.enqueue(singleRegionSingleZoneResponse());
 
@@ -146,17 +141,13 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
       assertSent(server, "GET", "/projects/party/aggregated/machineTypes");
    }
 
-   public void createNodeWhenNetworkNorFirewallExistDoesNotExist() throws Exception {
+   public void createNodeWhenFirewallDoesNotExist() throws Exception {
       server.enqueue(singleRegionSingleZoneResponse());
       server.enqueue(jsonResponse("/image_list.json"));
       server.enqueue(jsonResponse("/image_list_debian.json")); // per IMAGE_PROJECTS = "debian-cloud"
       server.enqueue(jsonResponse("/aggregated_machinetype_list.json"));
-      server.enqueue(new MockResponse().setResponseCode(404)); // Network
-      server.enqueue(new MockResponse().setResponseCode(404)); // Network again?
-      server.enqueue(jsonResponse("/operation.json")); // Create Network
-      server.enqueue(jsonResponse("/zone_operation.json"));
-      server.enqueue(jsonResponse("/network_get.json"));
-      server.enqueue(new MockResponse().setResponseCode(404)); // Firewall
+      server.enqueue(jsonResponse("/network_get_default.json"));
+      server.enqueue(new MockResponse().setResponseCode(404)); // Get Firewall
       server.enqueue(jsonResponse("/operation.json")); // Create Firewall
       server.enqueue(jsonResponse("/zone_operation.json"));
       server.enqueue(aggregatedListWithInstanceNetworkAndStatus("test-0", "test-network", RUNNING));
@@ -179,14 +170,9 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
       assertSent(server, "GET", "/projects/party/global/images");
       assertSent(server, "GET", "/projects/debian-cloud/global/images");
       assertSent(server, "GET", "/projects/party/aggregated/machineTypes");
-      assertSent(server, "GET", "/projects/party/global/networks/jclouds-test");
-      assertSent(server, "GET", "/projects/party/global/networks/jclouds-test");
-      assertSent(server, "POST", "/projects/party/global/networks",
-            "{\"name\":\"jclouds-test\",\"IPv4Range\":\"10.0.0.0/8\"}");
-      assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");
-      assertSent(server, "GET", "/projects/party/global/networks/jclouds-test");
-      assertSent(server, "GET", "/projects/party/global/firewalls/jclouds-test-port-22");
-      assertSent(server, "POST", "/projects/party/global/firewalls",
+      assertSent(server, "GET", "/projects/party/global/networks/default");
+      assertSent(server, "GET", "/projects/party/global/firewalls/jclouds-test-65f"); // Get Firewall
+      assertSent(server, "POST", "/projects/party/global/firewalls", // Create Firewall
             stringFromResource("/firewall_insert_2.json"));
 
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeededTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeededTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeededTest.java
deleted file mode 100644
index 8a5dd8f..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/CreateNetworkIfNeededTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
-import org.jclouds.googlecomputeengine.compute.predicates.AtomicOperationDone;
-import org.jclouds.googlecomputeengine.domain.Network;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.features.NetworkApi;
-import org.jclouds.googlecomputeengine.options.NetworkCreationOptions;
-import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
-import org.testng.annotations.Test;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-
-@Test
-public class CreateNetworkIfNeededTest {
-
-   private static final String BASE_URL = "https://www.googleapis.com/compute/v1/projects";
-
-   public void testApply() {
-      GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
-      NetworkApi nwApi = createMock(NetworkApi.class);
-      Resources resources = createMock(Resources.class);
-
-      Network network = Network.create( //
-            "abcd", // id
-            new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
-            URI.create(BASE_URL + "/party/global/networks/this-network"), // selfLink
-            "this-network", // name
-            null, // description
-            "0.0.0.0/0", // rangeIPv4
-            null // gatewayIPv4
-      );
-
-      Operation createOp = new ParseGlobalOperationTest().expected();
-
-      expect(api.networks()).andReturn(nwApi).atLeastOnce();
-
-      expect(nwApi.createInIPv4Range("this-network", "0.0.0.0/0")) .andReturn(createOp);
-      expect(resources.operation(createOp.selfLink())).andReturn(createOp);
-      expect(nwApi.get("this-network")).andReturn(null);
-      expect(nwApi.get("this-network")).andReturn(network);
-
-      replay(api, nwApi, resources);
-
-      NetworkAndAddressRange input = NetworkAndAddressRange.create("this-network", "0.0.0.0/0", null);
-
-      AtomicOperationDone pred = atomicOperationDone(api, resources);
-
-      CreateNetworkIfNeeded creator = new CreateNetworkIfNeeded(api, pred);
-
-      assertEquals(creator.apply(input), network);
-
-      verify(api, nwApi, resources);
-   }
-
-   public void testApplyWithGateway() {
-      GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
-      NetworkApi nwApi = createMock(NetworkApi.class);
-      Resources resources = createMock(Resources.class);
-
-      Network network = Network.create( //
-            "abcd", // id
-            new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
-            URI.create(BASE_URL + "/party/global/networks/this-network"), // selfLink
-            "this-network", // name
-            null, // description
-            "0.0.0.0/0", // rangeIPv4
-            "1.2.3.4" // gatewayIPv4
-      );
-
-      Operation createOp = new ParseGlobalOperationTest().expected();
-
-      expect(api.networks()).andReturn(nwApi).atLeastOnce();
-
-      expect(nwApi.createInIPv4Range(new NetworkCreationOptions.Builder("this-network", "0.0.0.0/0")
-         .gatewayIPv4("1.2.3.4").build())).andReturn(createOp);
-      expect(resources.operation(createOp.selfLink())).andReturn(createOp);
-      expect(nwApi.get("this-network")).andReturn(null);
-      expect(nwApi.get("this-network")).andReturn(network);
-
-      replay(api, nwApi, resources);
-
-      NetworkAndAddressRange input = NetworkAndAddressRange.create("this-network", "0.0.0.0/0", "1.2.3.4");
-
-      AtomicOperationDone pred = atomicOperationDone(api, resources);
-
-      CreateNetworkIfNeeded creator = new CreateNetworkIfNeeded(api, pred);
-
-      assertEquals(creator.apply(input), network);
-
-      verify(api, nwApi, resources);
-   }
-
-   private AtomicOperationDone atomicOperationDone(final GoogleComputeEngineApi api,
-         final Resources resources) {
-      return Guice.createInjector(new AbstractModule() { // Rather than opening ctor public
-         @Override protected void configure() {
-            bind(GoogleComputeEngineApi.class).toInstance(api);
-            bind(Resources.class).toInstance(resources);
-         }
-      }).getInstance(AtomicOperationDone.class);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreateTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreateTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreateTest.java
deleted file mode 100644
index 137f004..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/FindNetworkOrCreateTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.compute.domain.NetworkAndAddressRange;
-import org.jclouds.googlecomputeengine.compute.predicates.AtomicOperationDone;
-import org.jclouds.googlecomputeengine.domain.Network;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.features.NetworkApi;
-import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.LoadingCache;
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-
-@Test
-public class FindNetworkOrCreateTest {
-   private static final String BASE_URL = "https://www.googleapis.com/compute/v1/projects";
-   private static final Network NETWORK = Network.create( //
-         "abcd", // id
-         new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
-         URI.create(BASE_URL + "/party/global/networks/this-network"), // selfLink
-         "this-network", // name
-         null, // description
-         "0.0.0.0/0", // rangeIPv4
-         null // gatewayIPv4
-   );
-
-   public void testLoadExisting() {
-      GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
-      NetworkApi nwApi = createMock(NetworkApi.class);
-
-      expect(api.networks()).andReturn(nwApi).atLeastOnce();
-
-      expect(nwApi.get("this-network")).andReturn(NETWORK);
-
-      replay(api, nwApi);
-
-      NetworkAndAddressRange input = NetworkAndAddressRange.create("this-network", "0.0.0.0/0", null);
-
-      Predicate<AtomicReference<Operation>> operationDone = Predicates.alwaysFalse(); // No op should be created!
-
-      CreateNetworkIfNeeded creator = new CreateNetworkIfNeeded(api, operationDone);
-
-      FindNetworkOrCreate loader = new FindNetworkOrCreate(api, creator);
-
-      LoadingCache<NetworkAndAddressRange, Network> cache = CacheBuilder.newBuilder().build(loader);
-
-      assertEquals(cache.getUnchecked(input), NETWORK);
-
-      // Second call is to ensure we only need to make the API calls once.
-      assertEquals(cache.getUnchecked(input), NETWORK);
-
-      verify(api, nwApi);
-   }
-
-   public void testLoadNew() {
-      GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
-      NetworkApi nwApi = createMock(NetworkApi.class);
-      Resources resources = createMock(Resources.class);
-
-      Operation createOp = new ParseGlobalOperationTest().expected();
-
-      expect(api.networks()).andReturn(nwApi).atLeastOnce();
-
-      expect(nwApi.createInIPv4Range("this-network", "0.0.0.0/0")).andReturn(createOp);
-      expect(resources.operation(createOp.selfLink())).andReturn(createOp);
-      // pre-creation
-      expect(nwApi.get("this-network")).andReturn(null).times(2);
-      // post-creation
-      expect(nwApi.get("this-network")).andReturn(NETWORK);
-
-      replay(api, nwApi, resources);
-
-      NetworkAndAddressRange input = NetworkAndAddressRange.create("this-network", "0.0.0.0/0", null);
-
-      AtomicOperationDone pred = atomicOperationDone(resources);
-
-      CreateNetworkIfNeeded creator = new CreateNetworkIfNeeded(api, pred);
-
-      FindNetworkOrCreate loader = new FindNetworkOrCreate(api, creator);
-
-      LoadingCache<NetworkAndAddressRange, Network> cache = CacheBuilder.newBuilder().build(loader);
-
-      assertEquals(cache.getUnchecked(input), NETWORK);
-
-      // Second call is to ensure we only need to make the API calls once.
-      assertEquals(cache.getUnchecked(input), NETWORK);
-
-      verify(api, nwApi, resources);
-   }
-
-   private AtomicOperationDone atomicOperationDone(final Resources resources) {
-      return Guice.createInjector(new AbstractModule() { // Rather than opening ctor public
-         @Override protected void configure() {
-            bind(Resources.class).toInstance(resources);
-         }
-      }).getInstance(AtomicOperationDone.class);
-   }
-}
-

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
index fc29125..98ad345 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
@@ -45,8 +45,8 @@ public class ParseNetworkTest extends BaseGoogleComputeEngineParseTest<Network>
             "13024414170909937976", // id
             parse("2012-10-24T20:13:19.967"), // creationTimestamp
             URI.create(baseUrl + "/party/networks/jclouds-test"), // selfLink
-            "default", // name
-            "Default network for the project", // description
+            "jclouds-test", // name
+            "A custom network for the project", // description
             "10.0.0.0/8", // rangeIPv4
             "10.0.0.1" // gatewayIPv4
       );

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/SimpleParsingTests.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/SimpleParsingTests.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/SimpleParsingTests.java
new file mode 100644
index 0000000..3b13193
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/SimpleParsingTests.java
@@ -0,0 +1,82 @@
+/*
+ * 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.googlecomputeengine.parse;
+
+import static org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet.simplifyPorts;
+import static org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet.nameFromNetworkString;
+
+import java.util.List;
+
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+import static org.testng.Assert.assertEquals;
+
+
+@Test(groups = "unit", testName = "SimpleParsingTests", singleThreaded = true)
+public class SimpleParsingTests {
+
+   public void testOnePort(){
+      int[] ports = {22};
+      List<String> output = simplifyPorts(ports);
+
+      assertEquals(ImmutableList.of("22"), output);
+   }
+
+   public void testBasic(){
+      int[] ports = {1, 2, 3, 4};
+      List<String> output = simplifyPorts(ports);
+
+      assertEquals(ImmutableList.of("1-4"), output);
+   }
+
+   public void testComplex(){
+      int[] ports = {3, 1, 5, 2, 1002, 17, 1001, 22, 80, 1000};
+      List<String> output = simplifyPorts(ports);
+
+      assertEquals(ImmutableList.of("1-3", "5", "17", "22", "80", "1000-1002"), output);
+   }
+
+   public void testEmpty(){
+      int[] ports = {};
+      List<String> output = simplifyPorts(ports);
+
+      assertEquals(null, output);
+   }
+
+   public void testEndSingle(){
+      int[] ports = {1, 2, 3, 4, 7};
+      List<String> output = simplifyPorts(ports);
+
+      assertEquals(ImmutableList.of("1-4", "7"), output);
+   }
+
+   public void testNetworkFromString(){
+      String network = "https://www.googleapis.com/compute/v1/projects/project/global/networks/network";
+      assertEquals("network", nameFromNetworkString(network));
+
+      network = "projects/project/global/networks/network";
+      assertEquals("network", nameFromNetworkString(network));
+
+      network = "global/networks/default";
+      assertEquals("default", nameFromNetworkString(network));
+
+      network = "default";
+      assertEquals("default", nameFromNetworkString(network));
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json b/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json
index f549d2a..0ad66be 100644
--- a/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json
+++ b/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json
@@ -4,12 +4,11 @@
    "selfLink": "https://www.googleapis.com/compute/v1/projects/google/global/firewalls",
    "items": [
       {
-
          "kind": "compute#firewall",
          "id": "12862241031274216284",
          "creationTimestamp": "2012-04-13T03:05:02.855",
          "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",
-         "name": "jclouds-test-delete",
+         "name": "jclouds-test-delete-34sf",
          "description": "Internal traffic from default allowed",
          "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/jclouds-test-delete",
          "sourceRanges": [

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/resources/firewall_insert_2.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/firewall_insert_2.json b/providers/google-compute-engine/src/test/resources/firewall_insert_2.json
index 485721e..6d0ed14 100644
--- a/providers/google-compute-engine/src/test/resources/firewall_insert_2.json
+++ b/providers/google-compute-engine/src/test/resources/firewall_insert_2.json
@@ -1,6 +1,6 @@
 {
-  "name": "jclouds-test-port-22",
-  "network": "https://www.googleapis.com/compute/v1/projects/party/networks/jclouds-test",
+  "name": "jclouds-test-65f",
+  "network": "https://www.googleapis.com/compute/v1/projects/party/networks/default",
   "sourceRanges": [
     "10.0.0.0/8",
     "0.0.0.0/0"
@@ -9,7 +9,7 @@
     "aTag"
   ],
   "targetTags": [
-    "jclouds-test-port-22"
+    "jclouds-test-65f"
   ],
   "allowed": [
     {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/resources/instance_insert_2.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_insert_2.json b/providers/google-compute-engine/src/test/resources/instance_insert_2.json
index 78002a6..012e172 100644
--- a/providers/google-compute-engine/src/test/resources/instance_insert_2.json
+++ b/providers/google-compute-engine/src/test/resources/instance_insert_2.json
@@ -3,7 +3,7 @@
   "name": "test-1",
   "networkInterfaces": [
     {
-      "network": "https://www.googleapis.com/compute/v1/projects/party/networks/jclouds-test",
+      "network": "https://www.googleapis.com/compute/v1/projects/party/networks/default",
       "accessConfigs": [
         {
           "type": "ONE_TO_ONE_NAT"
@@ -25,7 +25,7 @@
   "tags": {
     "items": [
       "aTag",
-      "jclouds-test-port-22"
+      "jclouds-test-65f"
     ]
   },
   "metadata": {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/resources/network_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/network_get.json b/providers/google-compute-engine/src/test/resources/network_get.json
index a1a6203..ca82f69 100644
--- a/providers/google-compute-engine/src/test/resources/network_get.json
+++ b/providers/google-compute-engine/src/test/resources/network_get.json
@@ -3,8 +3,8 @@
    "id": "13024414170909937976",
    "creationTimestamp": "2012-10-24T20:13:19.967",
    "selfLink": "https://www.googleapis.com/compute/v1/projects/party/networks/jclouds-test",
-   "name": "default",
-   "description": "Default network for the project",
+   "name": "jclouds-test",
+   "description": "A custom network for the project",
    "IPv4Range": "10.0.0.0/8",
    "gatewayIPv4": "10.0.0.1"
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/resources/network_get_default.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/network_get_default.json b/providers/google-compute-engine/src/test/resources/network_get_default.json
new file mode 100644
index 0000000..55b322c
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/network_get_default.json
@@ -0,0 +1,10 @@
+{
+   "kind": "compute#network",
+   "id": "13024414170909937976",
+   "creationTimestamp": "2012-10-24T20:13:19.967",
+   "selfLink": "https://www.googleapis.com/compute/v1/projects/party/networks/default",
+   "name": "default",
+   "description": "Default network for the project",
+   "IPv4Range": "10.0.0.0/8",
+   "gatewayIPv4": "10.0.0.1"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/5adfce8d/providers/google-compute-engine/src/test/resources/network_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/network_list.json b/providers/google-compute-engine/src/test/resources/network_list.json
index eb4249a..ed2273b 100644
--- a/providers/google-compute-engine/src/test/resources/network_list.json
+++ b/providers/google-compute-engine/src/test/resources/network_list.json
@@ -9,8 +9,8 @@
          "id": "13024414170909937976",
          "creationTimestamp": "2012-10-24T20:13:19.967",
          "selfLink": "https://www.googleapis.com/compute/v1/projects/party/networks/jclouds-test",
-         "name": "default",
-         "description": "Default network for the project",
+         "name": "jclouds-test",
+         "description": "A custom network for the project",
          "IPv4Range": "10.0.0.0/8",
          "gatewayIPv4": "10.0.0.1"
       }


[12/50] [abbrv] jclouds git commit: Updates to InstanceApi. 100% coverage

Posted by na...@apache.org.
Updates to InstanceApi. 100% coverage


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

Branch: refs/heads/master
Commit: 94d42c3c6c583e5f516393886ec4c70021c7324c
Parents: fd27ab1
Author: Daniel Broudy <br...@google.com>
Authored: Thu Dec 4 15:29:21 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Dec 9 17:54:08 2014 +0100

----------------------------------------------------------------------
 .../GoogleComputeEngineServiceAdapter.java      |   2 +
 .../googlecomputeengine/domain/AttachDisk.java  |  31 ++--
 .../googlecomputeengine/domain/Instance.java    |  37 +++--
 .../googlecomputeengine/domain/NewInstance.java |  18 ++-
 .../features/InstanceApi.java                   |   8 +-
 .../features/InstanceApiLiveTest.java           |  28 +++-
 .../features/InstanceApiMockTest.java           |  54 ++++++-
 .../parse/ParseInstanceSerialOutputTest.java    |  11 +-
 .../parse/ParseInstanceTest.java                |  14 +-
 .../test/resources/instance_attach_disk.json    |  21 ++-
 .../src/test/resources/instance_get.json        |  13 +-
 .../src/test/resources/instance_list.json       | 155 ++++++++++---------
 .../test/resources/instance_serial_port.json    |   5 +-
 13 files changed, 271 insertions(+), 126 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index fb3f7f6..29f239d 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -153,6 +153,7 @@ public final class GoogleComputeEngineServiceAdapter
       // We need to see the created instance so that we can access the newly created disk.
       AtomicReference<Instance> instance = Atomics.newReference(Instance.create( //
             "0000000000000000000", // id can't be null, but isn't available until provisioning is done.
+            null, // creationTimestamp
             create.targetLink(), // selfLink
             newInstance.name(), // name
             newInstance.description(), // description
@@ -161,6 +162,7 @@ public final class GoogleComputeEngineServiceAdapter
             Instance.Status.PROVISIONING, // status
             null, // statusMessage
             create.zone(), // zone
+            null, // canIpForward
             null, // networkInterfaces
             null, // disks
             newInstance.metadata(), // metadata

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
index 22db29b..6306715 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
@@ -17,6 +17,7 @@
 package org.jclouds.googlecomputeengine.domain;
 
 import java.net.URI;
+import java.util.List;
 
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
@@ -26,7 +27,7 @@ import com.google.auto.value.AutoValue;
 @AutoValue
 public abstract class AttachDisk {
    @AutoValue
-   abstract static class InitializeParams {
+   public abstract static class InitializeParams {
       /** Override the default naming convention. */
       @Nullable public abstract String diskName();
 
@@ -36,13 +37,15 @@ public abstract class AttachDisk {
       /** The {@link org.jclouds.googlecomputeengine.domain.Image#selfLink() source image}. */
       public abstract URI sourceImage();
 
+      @Nullable public abstract String diskType();
+
       static InitializeParams create(URI sourceImage) {
-         return create(null, null, sourceImage);
+         return create(null, null, sourceImage, null);
       }
 
-      @SerializedNames({ "diskName", "diskSizeGb", "sourceImage" })
-      static InitializeParams create(String diskName, Long diskSizeGb, URI sourceImage) {
-         return new AutoValue_AttachDisk_InitializeParams(diskName, diskSizeGb, sourceImage);
+      @SerializedNames({ "diskName", "diskSizeGb", "sourceImage", "diskType" })
+      public static InitializeParams create(String diskName, Long diskSizeGb, URI sourceImage, String diskType) {
+         return new AutoValue_AttachDisk_InitializeParams(diskName, diskSizeGb, sourceImage, diskType);
       }
 
       InitializeParams() {
@@ -59,6 +62,11 @@ public abstract class AttachDisk {
       READ_ONLY;
    }
 
+   public enum DiskInterface {
+      NVME,
+      SCSI;
+   }
+
    public abstract Type type();
 
    @Nullable public abstract Mode mode();
@@ -82,6 +90,11 @@ public abstract class AttachDisk {
    /** True if this disk will be deleted when the instance is delete. */
    public abstract boolean autoDelete();
 
+   @Nullable public abstract List<String> licenses();
+
+   // Note: this is disks[].interface in the api docs but interface is a Java keyword.
+   @Nullable public abstract DiskInterface diskInterface();
+
    public static AttachDisk existingBootDisk(URI existingBootDisk) {
       return create(Type.PERSISTENT, existingBootDisk, null, true, false);
    }
@@ -96,13 +109,13 @@ public abstract class AttachDisk {
 
    static AttachDisk create(Type type, URI source, InitializeParams initializeParams, boolean boot,
             boolean autoDelete) {
-         return create(type, null, source, null, boot, initializeParams, autoDelete);
+         return create(type, null, source, null, boot, initializeParams, autoDelete, null, null);
       }
 
-   @SerializedNames({"type", "mode", "source", "deviceName", "boot", "initializeParams", "autoDelete" })
+   @SerializedNames({"type", "mode", "source", "deviceName", "boot", "initializeParams", "autoDelete", "licenses", "interface" })
    public static AttachDisk create(Type type, Mode mode, URI source, String deviceName, boolean boot, InitializeParams initializeParams,
-         boolean autoDelete) {
-      return new AutoValue_AttachDisk(type, mode, source, deviceName, boot, initializeParams, autoDelete);
+         boolean autoDelete, List<String> licenses, DiskInterface diskInterface) {
+      return new AutoValue_AttachDisk(type, mode, source, deviceName, boot, initializeParams, autoDelete, licenses, diskInterface);
    }
 
    AttachDisk() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
index be5b1e5..cdc2ee4 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
@@ -19,8 +19,11 @@ package org.jclouds.googlecomputeengine.domain;
 import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
 
 import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
+import org.jclouds.googlecomputeengine.domain.AttachDisk.DiskInterface;
+import org.jclouds.googlecomputeengine.domain.AttachDisk.InitializeParams;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
 
@@ -63,10 +66,20 @@ public abstract class Instance {
 
       public abstract boolean boot();
 
-      @SerializedNames({ "index", "type", "mode", "source", "deviceName", "autoDelete", "boot" })
+      @Nullable public abstract InitializeParams initializeParams();
+
+      @Nullable public abstract List<String> licenses();
+
+      // Note: this is disks[].interface in the api docs but interface is a Java keyword.
+      @Nullable public abstract DiskInterface diskInterface();
+
+      @SerializedNames({ "index", "type", "mode", "source", "deviceName", "autoDelete", "boot",
+         "initializeParams", "licenses", "interface" })
       public static AttachedDisk create(int index, Type type, Mode mode, URI source, String deviceName,
-            boolean autoDelete, boolean boot) {
-         return new AutoValue_Instance_AttachedDisk(index, type, mode, source, deviceName, autoDelete, boot);
+            boolean autoDelete, boolean boot, InitializeParams initializeParams,
+            List<String> licenses, DiskInterface diskInterface) {
+         return new AutoValue_Instance_AttachedDisk(index, type, mode, source, deviceName, autoDelete,
+               boot, initializeParams, licenses, diskInterface);
       }
 
       AttachedDisk() {
@@ -124,7 +137,7 @@ public abstract class Instance {
    @AutoValue
    public abstract static class SerialPortOutput {
 
-      @Nullable public abstract URI selfLink(); // TODO: is this really nullable?!
+      public abstract URI selfLink();
 
       /** The contents of the console output. */
       public abstract String contents();
@@ -200,6 +213,8 @@ public abstract class Instance {
 
    public abstract String id();
 
+   @Nullable public abstract Date creationTimestamp();
+
    public abstract URI selfLink();
 
    public abstract String name();
@@ -221,6 +236,8 @@ public abstract class Instance {
     */
    public abstract URI zone();
 
+   @Nullable public abstract Boolean canIpForward();
+
    public abstract List<NetworkInterface> networkInterfaces();
 
    public abstract List<AttachedDisk> disks();
@@ -231,13 +248,13 @@ public abstract class Instance {
 
    public abstract Scheduling scheduling();
 
-   @SerializedNames({ "id", "selfLink", "name", "description", "tags", "machineType", "status", "statusMessage", "zone",
-         "networkInterfaces", "disks", "metadata", "serviceAccounts", "scheduling"})
-   public static Instance create(String id, URI selfLink, String name, String description, Tags tags, URI machineType,
-         Status status, String statusMessage, URI zone, List<NetworkInterface> networkInterfaces,
+   @SerializedNames({ "id", "creationTimestamp", "selfLink", "name", "description", "tags", "machineType", "status", "statusMessage", "zone",
+         "canIpForward", "networkInterfaces", "disks", "metadata", "serviceAccounts", "scheduling"})
+   public static Instance create(String id, Date creationTimestamp, URI selfLink, String name, String description, Tags tags, URI machineType,
+         Status status, String statusMessage, URI zone, Boolean canIpForward, List<NetworkInterface> networkInterfaces,
          List<AttachedDisk> disks, Metadata metadata, List<ServiceAccount> serviceAccounts, Scheduling scheduling) {
-      return new AutoValue_Instance(id, selfLink, name, description, tags, machineType, status, statusMessage, zone,
-            copyOf(networkInterfaces), copyOf(disks), metadata, copyOf(serviceAccounts), scheduling);
+      return new AutoValue_Instance(id, creationTimestamp, selfLink, name, description, tags, machineType, status, statusMessage, zone,
+            canIpForward, copyOf(networkInterfaces), copyOf(disks), metadata, copyOf(serviceAccounts), scheduling);
    }
 
    Instance() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
index e70c9dd..fb45764 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
@@ -24,6 +24,7 @@ import java.util.List;
 
 import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
 import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
+import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
 
@@ -56,6 +57,8 @@ public abstract class NewInstance {
 
    public abstract URI machineType();
 
+   @Nullable public abstract Boolean canIpForward();
+
    public abstract List<NetworkInterface> networkInterfaces();
 
    public abstract List<AttachDisk> disks();
@@ -67,6 +70,8 @@ public abstract class NewInstance {
    /** Add metadata via {@link Metadata#items()}. */
    public abstract Metadata metadata();
 
+   @Nullable public abstract List<ServiceAccount> serviceAccounts();
+
    @Nullable public abstract Scheduling scheduling();
 
    /** Convenience for creating a new instance with only a boot disk and minimal parameters. */
@@ -83,14 +88,15 @@ public abstract class NewInstance {
             foundBoot = true;
          }
       }
-      return create(name, machineType, ImmutableList.of(NetworkInterface.create(network)), ImmutableList.copyOf(disks),
-            description, Tags.create(), Metadata.create(), null);
+      return create(name, machineType, null, ImmutableList.of(NetworkInterface.create(network)), ImmutableList.copyOf(disks),
+            description, Tags.create(), Metadata.create(), null, null);
    }
 
-   @SerializedNames({ "name", "machineType", "networkInterfaces", "disks", "description", "tags", "metadata", "scheduling" })
-   static NewInstance create(String name, URI machineType, List<NetworkInterface> networkInterfaces,
-         List<AttachDisk> disks, String description, Tags tags, Metadata metadata, Scheduling scheduling) {
-      return new AutoValue_NewInstance(name, machineType, networkInterfaces, disks, description, tags, metadata, scheduling);
+   @SerializedNames({ "name", "machineType", "canIpForward", "networkInterfaces", "disks", "description", "tags", "metadata",
+      "serviceAccounts", "scheduling" })
+   static NewInstance create(String name, URI machineType, Boolean canIpForward, List<NetworkInterface> networkInterfaces,
+         List<AttachDisk> disks, String description, Tags tags, Metadata metadata, List<ServiceAccount> serviceAccounts, Scheduling scheduling) {
+      return new AutoValue_NewInstance(name, machineType, canIpForward, networkInterfaces, disks, description, tags, metadata, serviceAccounts, scheduling);
    }
 
    NewInstance() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
index 0b61795..7097191 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
@@ -107,7 +107,7 @@ public interface InstanceApi {
    Operation addAccessConfigToNic(@PathParam("instance") String instance,
                                   @BinderParam(BindToJsonPayload.class)
                                   AccessConfig accessConfig,
-                                  @QueryParam("network_interface") String networkInterfaceName);
+                                  @QueryParam("networkInterface") String networkInterfaceName);
 
    /**
     * Deletes an access config from an instance's network interface.
@@ -122,8 +122,8 @@ public interface InstanceApi {
    @DELETE
    @Path("/{instance}/deleteAccessConfig")
    Operation deleteAccessConfigFromNic(@PathParam("instance") String instance,
-                                       @QueryParam("access_config") String accessConfigName,
-                                       @QueryParam("network_interface") String networkInterfaceName);
+                                       @QueryParam("accessConfig") String accessConfigName,
+                                       @QueryParam("networkInterface") String networkInterfaceName);
 
    /**
     * Returns the specified instance's serial port output.
@@ -131,7 +131,7 @@ public interface InstanceApi {
     * @param instance the instance name.
     * @return if successful, this method returns a SerialPortOutput containing the instance's serial output.
     */
-   @Named("Instances:serialPort")
+   @Named("Instances:getSerialPortOutput")
    @GET
    @Path("/{instance}/serialPort")
    SerialPortOutput getSerialPortOutput(@PathParam("instance") String instance);

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index fa5676e..bcff586 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -33,6 +33,7 @@ import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
 import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
+import org.jclouds.googlecomputeengine.domain.Instance.SerialPortOutput;
 import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.AttachDisk;
@@ -122,6 +123,14 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertInstance")
+   public void testGetSerialPortOutput() {
+      SerialPortOutput output = api().getSerialPortOutput(INSTANCE_NAME);
+      assertNotNull(output);
+      assertNotNull(output.selfLink());
+      assertNotNull(output.contents());
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testInsertInstance")
    public void testSetDiskAutoDelete() {
 
       assertTrue(existsDiskWithNameAndAutoDelete(INSTANCE_NAME, DEFAULT_BOOT_DISK_NAME, true));
@@ -196,13 +205,16 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
       Instance originalInstance = api().get(INSTANCE_NAME);
       assertOperationDoneSuccessfully(api().attachDisk(INSTANCE_NAME,
-                  AttachDisk.create(AttachDisk.Type.PERSISTENT,
-                                    AttachDisk.Mode.READ_ONLY,
-                                    getDiskUrl(ATTACH_DISK_NAME),
-                                    ATTACH_DISK_DEVICE_NAME,
-                                    false,
-                                    null,
-                                    false)));
+                  AttachDisk.create(AttachDisk.Type.PERSISTENT, // type
+                                    AttachDisk.Mode.READ_ONLY, // mode
+                                    getDiskUrl(ATTACH_DISK_NAME), // source
+                                    ATTACH_DISK_DEVICE_NAME, // deviceName
+                                    false, // boot
+                                    null, // initializeParams
+                                    false, // autoDelete
+                                    null, // licenses
+                                    null // interface
+                                    )));
 
       Instance modifiedInstance = api().get(INSTANCE_NAME);
 
@@ -246,7 +258,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertOperationDoneSuccessfully(api().reset(INSTANCE_NAME));
    }
 
-   @Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling"}, alwaysRun = true)
+   @Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling", "testGetInstance", "testGetSerialPortOutput"}, alwaysRun = true)
    public void testDeleteInstance() {
       assertOperationDoneSuccessfully(api().delete(INSTANCE_NAME));
       assertOperationDoneSuccessfully(diskApi().delete(DISK_NAME));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
index 45abb94..50e7426 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
@@ -24,6 +24,9 @@ import java.net.URI;
 import java.util.Arrays;
 
 import org.jclouds.googlecomputeengine.domain.AttachDisk;
+import org.jclouds.googlecomputeengine.domain.AttachDisk.DiskInterface;
+import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
+import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig.Type;
 import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
@@ -42,8 +45,8 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
    public void get() throws Exception {
       server.enqueue(jsonResponse("/instance_get.json"));
 
-      assertEquals(instanceApi().get("test-1"), new ParseInstanceTest().expected(url("/projects")));
-      assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-1");
+      assertEquals(instanceApi().get("test-instance"), new ParseInstanceTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-instance");
    }
 
    public void get_4xx() throws Exception {
@@ -57,7 +60,7 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       server.enqueue(jsonResponse("/instance_serial_port.json"));
 
       assertEquals(instanceApi().getSerialPortOutput("test-1"),
-            new ParseInstanceSerialOutputTest().expected());
+            new ParseInstanceSerialOutputTest().expected(url("/projects")));
 
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-1/serialPort");
    }
@@ -94,6 +97,32 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
             stringFromResource("/instance_insert.json"));
    }
 
+   public void addAccessConfig() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      AccessConfig config = AccessConfig.create("test-access", Type.ONE_TO_ONE_NAT, "1.1.1.1");
+      assertEquals(instanceApi().addAccessConfigToNic("test-instance", config, "test-network"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-instance/"
+            + "addAccessConfig?networkInterface=test-network",
+            "{" +
+            "  \"type\": \"ONE_TO_ONE_NAT\"," +
+            "  \"name\": \"test-access\"," +
+            "  \"natIP\": \"1.1.1.1\"" +
+            "}");
+   }
+
+   public void deleteAccessConfig() throws Exception {
+      server.enqueue(jsonResponse("/zone_operation.json"));
+
+      assertEquals(instanceApi().deleteAccessConfigFromNic("test-instance", "test-access", "test-network"),
+            new ParseZoneOperationTest().expected(url("/projects")));
+
+      assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/instances/test-instance/"
+            + "deleteAccessConfig?accessConfig=test-access&networkInterface=test-network");
+   }
+
    public void delete() throws Exception {
       server.enqueue(jsonResponse("/zone_operation.json"));
 
@@ -154,10 +183,21 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       server.enqueue(jsonResponse("/zone_operation.json"));
 
       assertEquals(instanceApi().attachDisk("test-1",
-            AttachDisk.create(AttachDisk.Type.PERSISTENT,
-                                     AttachDisk.Mode.READ_ONLY,
-                                     URI.create(url("/projects/party/zones/us-central1-a/disks/testimage1")),
-                                     null, false, null, true)),
+            AttachDisk.create(AttachDisk.Type.PERSISTENT, // type
+                                     AttachDisk.Mode.READ_WRITE, // mode
+                                     URI.create(url("/projects/party/zones/us-central1-a/disks/test")), // source
+                                     "test", // deviceName
+                                     true, // boot
+                                     AttachDisk.InitializeParams.create(
+                                           "test", // diskName
+                                           Long.parseLong("100", 10), // diskSizeGb
+                                           URI.create(url("/projects/party/global/images/test")), // sourceImage
+                                           "pd-standard" // diskType
+                                           ), // initializeParams
+                                     true, // autoDelete
+                                     ImmutableList.of(url("/projects/suse-cloud/global/licenses/sles-12")), // licenses
+                                     DiskInterface.NVME // interface
+                                     )),
             new ParseZoneOperationTest().expected(url("/projects")));
       assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-1/attachDisk",
             stringFromResource("/instance_attach_disk.json"));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java
index 244f780..5b8eca5 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java
@@ -19,6 +19,8 @@ package org.jclouds.googlecomputeengine.parse;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 import static org.jclouds.googlecomputeengine.domain.Instance.SerialPortOutput;
 
+import java.net.URI;
+
 import javax.ws.rs.Consumes;
 
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
@@ -34,6 +36,13 @@ public class ParseInstanceSerialOutputTest extends BaseGoogleComputeEngineParseT
 
    @Override @Consumes(APPLICATION_JSON)
    public SerialPortOutput expected() {
-      return SerialPortOutput.create(null, "console output");
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public SerialPortOutput expected(String baseUrl) {
+      return SerialPortOutput.create(
+            URI.create(baseUrl + "/party/zones/us-central1-a/instances/test-instance/serialPort"),
+            "console output");
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
index f786a5c..bef2abe 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
@@ -22,6 +22,8 @@ import java.net.URI;
 
 import javax.ws.rs.Consumes;
 
+import org.jclouds.googlecomputeengine.domain.AttachDisk;
+import org.jclouds.googlecomputeengine.domain.AttachDisk.DiskInterface;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
 import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface;
@@ -51,6 +53,7 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
    public Instance expected(String baseUrl) {
       return Instance.create( //
             "13051190678907570425", // id
+            parse("2012-11-25T23:48:20.758"), // creationTimestamp
             URI.create(baseUrl + "/party/zones/us-central1-a/instances/test-0"), // selfLink
             "test-0", // name
             "desc", // description
@@ -59,6 +62,7 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
             Instance.Status.RUNNING, // status
             null, // statusMessage
             URI.create(baseUrl + "/party/zones/us-central1-a"), // zone
+            true, // canIpForward
             ImmutableList.of(NetworkInterface.create( //
                   "nic0", // name
                   URI.create(baseUrl + "/party/global/networks/default"), // network
@@ -72,7 +76,15 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
                   URI.create(baseUrl + "/party/zones/us-central1-a/disks/test"), // source
                   "test", // deviceName
                   false, // autoDelete
-                  true// boot
+                  true, // boot
+                  AttachDisk.InitializeParams.create(
+                        "test", // diskName
+                        Long.parseLong("100", 10), // diskSizeGb
+                        URI.create(baseUrl + "/party/global/images/test"), // sourceImage
+                        "pd-standard" // diskType
+                        ), // initializeParams
+                  ImmutableList.of(baseUrl + "/suse-cloud/global/licenses/sles-12"), // licenses
+                  DiskInterface.NVME // interface
             )), // disks
             Metadata.create("efgh")
                     .put("aKey", "aValue")

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/test/resources/instance_attach_disk.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_attach_disk.json b/providers/google-compute-engine/src/test/resources/instance_attach_disk.json
index add9ab9..3738015 100644
--- a/providers/google-compute-engine/src/test/resources/instance_attach_disk.json
+++ b/providers/google-compute-engine/src/test/resources/instance_attach_disk.json
@@ -1,7 +1,18 @@
 {
-    "type": "PERSISTENT",
-    "mode": "READ_ONLY",
-    "source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/testimage1",
-    "boot": false,
-    "autoDelete": true
+  "type": "PERSISTENT",
+  "mode": "READ_WRITE",
+  "deviceName": "test",
+  "source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
+  "boot": true,
+  "autoDelete": true,
+  "initializeParams": {
+    "diskName": "test",
+    "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
+    "diskSizeGb": 100,
+    "diskType": "pd-standard"
+  },
+  "licenses": [
+    "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
+  ],
+  "interface": "NVME"
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/test/resources/instance_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_get.json b/providers/google-compute-engine/src/test/resources/instance_get.json
index 984db08..afe7ae8 100644
--- a/providers/google-compute-engine/src/test/resources/instance_get.json
+++ b/providers/google-compute-engine/src/test/resources/instance_get.json
@@ -7,6 +7,7 @@
    "name": "test-0",
    "machineType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1",
    "status": "RUNNING",
+   "canIpForward": true,
    "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
    "networkInterfaces": [
       {
@@ -24,7 +25,17 @@
          "deviceName": "test",
          "source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
          "index": 0,
-         "boot": true
+         "boot": true,
+         "initializeParams": {
+            "diskName": "test",
+            "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
+            "diskSizeGb": "100",
+            "diskType": "pd-standard"
+         },
+         "licenses": [
+            "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
+         ],
+         "interface": "NVME"
       }
    ],
    "serviceAccounts": [

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/test/resources/instance_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_list.json b/providers/google-compute-engine/src/test/resources/instance_list.json
index 47040e2..ed277f3 100644
--- a/providers/google-compute-engine/src/test/resources/instance_list.json
+++ b/providers/google-compute-engine/src/test/resources/instance_list.json
@@ -1,74 +1,85 @@
 {
-   "kind": "compute#instanceList",
-   "id": "projects/party/zones/us-central1-a/instances",
-   "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances",
-   "items": [
-      {
-         "kind": "compute#instance",
-         "id": "13051190678907570425",
-         "description": "desc",
-         "creationTimestamp": "2012-11-25T23:48:20.758",
-         "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-0",
-         "name": "test-0",
-         "machineType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1",
-         "status": "RUNNING",
-         "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
-         "networkInterfaces": [
-            {
-               "kind": "compute#instanceNetworkInterface",
-               "name": "nic0",
-               "networkIP": "10.240.121.115",
-               "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default"
-            }
-         ],
-         "disks": [
-            {
-               "kind": "compute#instanceDisk",
-               "type": "PERSISTENT",
-               "mode": "READ_WRITE",
-               "deviceName": "test",
-               "source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
-               "index": 0,
-               "boot": true
-            }
-         ],
-         "serviceAccounts": [
-            {
-               "kind": "compute#serviceAccount",
-               "email": "default",
-               "scopes": [
-                  "myscope"
-               ]
-            }
-         ],
-         "metadata": {
-            "items": [
-               {
-                  "key": "aKey",
-                  "value": "aValue"
-               },
-               {
-                  "key": "jclouds-image",
-                  "value": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718"
-               },
-               {
-                  "key": "jclouds-delete-boot-disk",
-                  "value": "true"
-               }
-            ],
-            "fingerprint": "efgh"
-         },
-         "tags": {
-            "items": [
-               "aTag",
-               "Group-port-42"
-            ],
-            "fingerprint": "abcd"
-         },
-         "scheduling": {
-            "onHostMaintenance": "MIGRATE",
-            "automaticRestart": false
-         }
+  "kind": "compute#instanceList",
+  "id": "projects/party/zones/us-central1-a/instances",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances",
+  "items": [
+    {
+      "kind": "compute#instance",
+      "id": "13051190678907570425",
+      "description": "desc",
+      "creationTimestamp": "2012-11-25T23:48:20.758",
+      "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-0",
+      "name": "test-0",
+      "machineType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/machineTypes/n1-standard-1",
+      "status": "RUNNING",
+      "canIpForward": true,
+      "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
+      "networkInterfaces": [
+        {
+          "kind": "compute#instanceNetworkInterface",
+          "name": "nic0",
+          "networkIP": "10.240.121.115",
+          "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default"
+        }
+      ],
+      "disks": [
+        {
+          "kind": "compute#instanceDisk",
+          "type": "PERSISTENT",
+          "mode": "READ_WRITE",
+          "deviceName": "test",
+          "source": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disks/test",
+          "index": 0,
+          "boot": true,
+          "initializeParams": {
+            "diskName": "test",
+            "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
+            "diskSizeGb": "100",
+            "diskType": "pd-standard"
+          },
+          "licenses": [
+            "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
+          ],
+          "interface": "NVME"
+        }
+      ],
+      "serviceAccounts": [
+        {
+          "kind": "compute#serviceAccount",
+          "email": "default",
+          "scopes": [
+            "myscope"
+          ]
+        }
+      ],
+      "metadata": {
+        "items": [
+          {
+            "key": "aKey",
+            "value": "aValue"
+          },
+          {
+            "key": "jclouds-image",
+            "value": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718"
+          },
+          {
+            "key": "jclouds-delete-boot-disk",
+            "value": "true"
+          }
+        ],
+        "fingerprint": "efgh"
+      },
+      "tags": {
+        "items": [
+          "aTag",
+          "Group-port-42"
+        ],
+        "fingerprint": "abcd"
+      },
+      "scheduling": {
+        "onHostMaintenance": "MIGRATE",
+        "automaticRestart": false
       }
-   ]
-}
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/94d42c3c/providers/google-compute-engine/src/test/resources/instance_serial_port.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_serial_port.json b/providers/google-compute-engine/src/test/resources/instance_serial_port.json
index 03280cc..98d9ce6 100644
--- a/providers/google-compute-engine/src/test/resources/instance_serial_port.json
+++ b/providers/google-compute-engine/src/test/resources/instance_serial_port.json
@@ -1,4 +1,5 @@
 {
-   "kind": "compute#serialPortOutput",
-   "contents": "console output"
+  "kind": "compute#serialPortOutput",
+  "contents": "console output",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-instance/serialPort"
 }
\ No newline at end of file


[22/50] [abbrv] jclouds git commit: Added Project:setUsageExportBucket and ProjectApiMockTest

Posted by na...@apache.org.
Added Project:setUsageExportBucket and ProjectApiMockTest


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

Branch: refs/heads/master
Commit: aa3a8dff8abe716aa54ac8f913595017ebadcb4e
Parents: 0f67b62
Author: Daniel Broudy <br...@google.com>
Authored: Mon Nov 24 17:51:37 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Fri Jan 9 23:19:15 2015 +0100

----------------------------------------------------------------------
 .../googlecomputeengine/domain/Project.java     | 27 +++++-
 .../features/ProjectApi.java                    | 10 +++
 .../features/ProjectApiExpectTest.java          | 88 --------------------
 .../features/ProjectApiLiveTest.java            | 13 +++
 .../features/ProjectApiMockTest.java            | 72 ++++++++++++++++
 .../BaseGoogleComputeEngineApiLiveTest.java     |  5 --
 .../parse/ParseProjectTest.java                 | 13 ++-
 .../src/test/resources/project.json             |  6 +-
 8 files changed, 135 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa3a8dff/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
index 480f23f..ecec9e4 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
@@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.domain;
 import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
 
 import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.jclouds.javax.annotation.Nullable;
@@ -30,6 +31,22 @@ import com.google.auto.value.AutoValue;
 @AutoValue
 public abstract class Project {
 
+   @AutoValue
+   public abstract static class UsageExportLocation {
+
+      public abstract String bucketName();
+
+      public abstract String reportNamePrefix();
+
+      @SerializedNames({"bucketName", "reportNamePrefix"})
+      public static UsageExportLocation create(String bucketName, String reporNamePrefix) {
+         return new AutoValue_Project_UsageExportLocation(bucketName, reporNamePrefix);
+      }
+
+      UsageExportLocation () {
+      }
+   }
+
    public abstract String id();
 
    public abstract URI selfLink();
@@ -46,12 +63,16 @@ public abstract class Project {
    /** Available IP addresses available for use in this project. */
    public abstract List<String> externalIpAddresses();
 
+   public abstract Date creationTimestamp();
+
+   @Nullable public abstract UsageExportLocation usageExportLocation();
+
    @SerializedNames(
-         { "id", "selfLink", "name", "description", "commonInstanceMetadata", "quotas", "externalIpAddresses" })
+         { "id", "selfLink", "name", "description", "commonInstanceMetadata", "quotas", "externalIpAddresses", "creationTimestamp", "usageExportLocation"})
    public static Project create(String id, URI selfLink, String name, String description,
-         Metadata commonInstanceMetadata, List<Quota> quotas, List<String> externalIpAddresses) {
+         Metadata commonInstanceMetadata, List<Quota> quotas, List<String> externalIpAddresses, Date creationTimestamp, UsageExportLocation usageExportLocation) {
       return new AutoValue_Project(id, selfLink, name, description, commonInstanceMetadata, copyOf(quotas),
-            copyOf(externalIpAddresses));
+            copyOf(externalIpAddresses), creationTimestamp, usageExportLocation);
    }
 
    Project() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa3a8dff/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
index 1f5aac3..c33aced 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
@@ -32,6 +32,8 @@ import org.jclouds.googlecomputeengine.domain.Project;
 import org.jclouds.oauth.v2.filters.OAuthFilter;
 import org.jclouds.rest.annotations.BinderParam;
 import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
 import org.jclouds.rest.annotations.RequestFilters;
 import org.jclouds.rest.annotations.SkipEncoding;
 import org.jclouds.rest.binders.BindToJsonPayload;
@@ -67,4 +69,12 @@ public interface ProjectApi {
    @Path("/setCommonInstanceMetadata")
    @Produces(APPLICATION_JSON)
    Operation setCommonInstanceMetadata(@BinderParam(BindToJsonPayload.class) Metadata metadata);
+
+   @Named("Projects:setUsageExportBucket")
+   @POST
+   @Path("/setUsageExportBucket")
+   @Produces(APPLICATION_JSON)
+   @MapBinder(BindToJsonPayload.class)
+   Operation setUsageExportBucket(@PayloadParam("bucketName") String bucketName,
+                                  @PayloadParam("reportNamePrefix") String reportNamePrefix);
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa3a8dff/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiExpectTest.java
deleted file mode 100644
index fd945e8..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiExpectTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.Metadata;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
-import org.jclouds.googlecomputeengine.parse.ParseMetadataTest;
-import org.jclouds.googlecomputeengine.parse.ParseProjectTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ProjectApiExpectTest")
-public class ProjectApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public static final HttpRequest GET_PROJECT_REQUEST = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(BASE_URL + "/party")
-           .addHeader("Accept", APPLICATION_JSON)
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse GET_PROJECT_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/project.json")).build();
-
-   public void testGetProjectResponseIs2xx() throws Exception {
-      ProjectApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE,
-            GET_PROJECT_REQUEST, GET_PROJECT_RESPONSE).project();
-
-      assertEquals(api.get(), new ParseProjectTest().expected());
-   }
-
-   public void testGetProjectResponseIs4xx() throws Exception {
-      HttpRequest getProjectRequest = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party")
-              .addHeader("Accept", APPLICATION_JSON)
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse getProjectResponse = HttpResponse.builder().statusCode(404).build();
-
-      ProjectApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE,
-            getProjectRequest, getProjectResponse).project();
-
-      assertNull(api.get());
-   }
-
-   public void testSetCommonInstanceMetadata() {
-      HttpRequest setMetadata = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/setCommonInstanceMetadata")
-              .addHeader("Accept", APPLICATION_JSON)
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/metadata.json", APPLICATION_JSON))
-              .build();
-
-      HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/global_operation.json")).build();
-
-      ProjectApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), TOKEN_RESPONSE, setMetadata,
-            setMetadataResponse).project();
-
-      Metadata expected = new ParseMetadataTest().expected();
-      assertEquals(api.setCommonInstanceMetadata(expected), new ParseGlobalOperationTest().expected());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa3a8dff/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiLiveTest.java
index 8aeb7de..e4e9038 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiLiveTest.java
@@ -22,6 +22,8 @@ import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
 import org.jclouds.googlecomputeengine.domain.Metadata;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.Operation.Status;
 import org.jclouds.googlecomputeengine.domain.Project;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
 import org.testng.annotations.Test;
@@ -66,4 +68,15 @@ public class ProjectApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertEquals(project.commonInstanceMetadata().size(), initialMetadataSize);
       assertEquals(project.commonInstanceMetadata().fingerprint(), initialFingerprint);
    }
+
+   @Test(groups = "live", dependsOnMethods = "getProject")
+   public void testSetUsageExportBucket() {
+      Operation o = api.project().setUsageExportBucket("test-bucket", "test-");
+
+      while (o.status() == Status.PENDING) {
+         o = api.operations().get(o.selfLink());
+      }
+      assertEquals(o.error().errors().get(0).code(), "PERMISSIONS_ERROR");
+      assertEquals(o.error().errors().get(0).message(), "Required 'owner' permission for 'test-bucket'");
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa3a8dff/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiMockTest.java
new file mode 100644
index 0000000..b9142e2
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiMockTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+
+import org.jclouds.googlecomputeengine.domain.Metadata;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseMetadataTest;
+import org.jclouds.googlecomputeengine.parse.ParseProjectTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "ProjectApiMockTest", singleThreaded = true)
+public class ProjectApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/project.json"));
+
+      assertEquals(projectApi().get(), new ParseProjectTest().expected(url("/projects")));
+
+      assertSent(server, "GET", "/projects/party");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(projectApi().get());
+
+      assertSent(server, "GET", "/projects/party");
+   }
+
+   public void setCommonInstanceMetadata() throws Exception {
+      server.enqueue(jsonResponse("/global_operation.json"));
+
+      Metadata expected = new ParseMetadataTest().expected();
+      assertEquals(projectApi().setCommonInstanceMetadata(expected), new ParseGlobalOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/setCommonInstanceMetadata",
+            stringFromResource("/metadata.json"));
+   }
+
+   public void setUsageExportBucket() throws Exception {
+      server.enqueue(jsonResponse("/global_operation.json"));
+
+      assertEquals(projectApi().setUsageExportBucket("bucket-name", "report-name-prefix"),
+            new ParseGlobalOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/setUsageExportBucket",
+            "{\"bucketName\": \"bucket-name\",\"reportNamePrefix\": \"report-name-prefix\"}");
+   }
+
+   ProjectApi projectApi() {
+      return api().project();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa3a8dff/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
index b61c840..8378b22 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
@@ -63,11 +63,6 @@ public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleCo
    protected Predicate<AtomicReference<Operation>> operationDone;
    protected URI projectUrl;
 
-   protected Supplier<String> userProject;
-   protected Predicate<AtomicReference<Operation>> globalOperationDonePredicate;
-   protected Predicate<AtomicReference<Operation>> regionOperationDonePredicate;
-   protected Predicate<AtomicReference<Operation>> zoneOperationDonePredicate;
-
    public BaseGoogleComputeEngineApiLiveTest() {
       provider = "google-compute-engine";
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa3a8dff/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java
index a3dffdc..fcc3e00 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java
@@ -22,9 +22,11 @@ import java.net.URI;
 
 import javax.ws.rs.Consumes;
 
+import org.jclouds.date.internal.SimpleDateFormatDateService;
 import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.Project;
 import org.jclouds.googlecomputeengine.domain.Quota;
+import org.jclouds.googlecomputeengine.domain.Project.UsageExportLocation;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
 import org.testng.annotations.Test;
 
@@ -40,9 +42,14 @@ public class ParseProjectTest extends BaseGoogleComputeEngineParseTest<Project>
 
    @Override @Consumes(APPLICATION_JSON)
    public Project expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Project expected(String baseUrl) {
       return Project.create( //
             "13024414184846275913", // id
-            URI.create(BASE_URL + "/761326798069"), // selfLink
+            URI.create(baseUrl + "/761326798069"), // selfLink
             "party", // name
             "", // description
             Metadata.create("efgh").put("propA", "valueA").put("propB", "valueB"), // commonInstanceMetadata
@@ -56,7 +63,9 @@ public class ParseProjectTest extends BaseGoogleComputeEngineParseTest<Project>
                   Quota.create("NETWORKS", 1, 5), //
                   Quota.create("FIREWALLS", 2, 100), //
                   Quota.create("IMAGES", 0, 100)), // quotas
-            null // externalIpAddresses
+            null, // externalIpAddresses
+            new SimpleDateFormatDateService().iso8601DateParse("2012-10-24T20:13:16.252"), // creationTimestamp
+            UsageExportLocation.create("test-bucket", "report-prefix")// usageExportLocation
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa3a8dff/providers/google-compute-engine/src/test/resources/project.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/project.json b/providers/google-compute-engine/src/test/resources/project.json
index 2cb56f0..24ac767 100644
--- a/providers/google-compute-engine/src/test/resources/project.json
+++ b/providers/google-compute-engine/src/test/resources/project.json
@@ -65,5 +65,9 @@
          "usage": 0,
          "limit": 100
       }
-   ]
+   ],
+   "usageExportLocation": {
+       "bucketName": "test-bucket",
+       "reportNamePrefix": "report-prefix"
+  }
 }
\ No newline at end of file


[17/50] [abbrv] jclouds git commit: New MockTests: TargetHttpProxyApi, UrlMap, ZoneApi, FirewallApi

Posted by na...@apache.org.
New MockTests: TargetHttpProxyApi, UrlMap, ZoneApi, FirewallApi


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

Branch: refs/heads/master
Commit: e4cc7282d798ca14e9394a53506a7b5447b026fc
Parents: 3db5cef
Author: Daniel Broudy <br...@google.com>
Authored: Tue Dec 9 10:15:43 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Dec 16 00:44:31 2014 +0100

----------------------------------------------------------------------
 .../features/FirewallApiExpectTest.java         | 122 +------------
 .../features/FirewallApiMockTest.java           |  40 +++++
 .../features/TargetHttpProxyApiExpectTest.java  | 171 -------------------
 .../features/TargetHttpProxyApiMockTest.java    |  99 +++++++++++
 .../features/UrlMapApiExpectTest.java           | 159 ++---------------
 .../features/UrlMapApiMockTest.java             | 140 +++++++++++++++
 .../features/ZoneApiExpectTest.java             |  95 -----------
 .../features/ZoneApiMockTest.java               |  63 +++++++
 .../parse/ParseTargetHttpProxyListTest.java     |  15 +-
 .../parse/ParseTargetHttpProxyTest.java         |  12 +-
 .../parse/ParseUrlMapListTest.java              |  13 +-
 .../parse/ParseUrlMapTest.java                  |   9 +-
 .../parse/ParseUrlMapValidateTest.java          |   9 +-
 .../parse/ParseZoneListTest.java                |   9 +-
 .../parse/ParseZoneTest.java                    |   7 +-
 .../src/test/resources/firewall_insert.json     |  23 ++-
 16 files changed, 429 insertions(+), 557 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
index b1ec4da..b5ed9a1 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
@@ -16,18 +16,10 @@
  */
 package org.jclouds.googlecomputeengine.features;
 
-import static com.google.common.base.Joiner.on;
-import static com.google.common.collect.Iterables.transform;
-import static java.lang.String.format;
-import static org.jclouds.io.Payloads.newStringPayload;
-import static org.jclouds.util.Strings2.toStringAndClose;
 import static org.testng.Assert.assertEquals;
 
 import java.io.IOException;
 import java.net.URI;
-import java.util.List;
-
-import javax.ws.rs.core.MediaType;
 
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.domain.Firewall;
@@ -36,119 +28,13 @@ import org.jclouds.googlecomputeengine.options.FirewallOptions;
 import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
 import org.jclouds.http.HttpRequest;
 import org.jclouds.http.HttpResponse;
-import org.jclouds.io.Payload;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Function;
 import com.google.common.collect.ImmutableList;
 
 @Test(groups = "unit", testName = "FirewallApiExpectTest")
 public class FirewallApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
 
-   public static final HttpRequest GET_FIREWALL_REQUEST = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(BASE_URL + "/party/global/firewalls/jclouds-test")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static HttpResponse GET_FIREWALL_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/firewall_get.json")).build();
-
-   public static Payload firewallPayloadFirewallOfName(String firewallName,
-                                                       String networkName,
-                                                       List<String> sourceRanges,
-                                                       List<String> sourceTags,
-                                                       List<String> targetTags,
-                                                       List<String> portRanges) throws IOException {
-      Function<String, String> addQuotes = new Function<String, String>() {
-         @Override
-         public String apply(String input) {
-            return "\"" + input + "\"";
-         }
-      };
-
-      String ports = on(",").skipNulls().join(transform(portRanges, addQuotes));
-
-      Payload payload = newStringPayload(
-              format(toStringAndClose(FirewallApiExpectTest.class.getResourceAsStream("/firewall_insert.json")),
-                      firewallName,
-                      networkName,
-                      on(",").skipNulls().join(transform(sourceRanges, addQuotes)),
-                      on(",").skipNulls().join(transform(sourceTags, addQuotes)),
-                      on(",").skipNulls().join(transform(targetTags, addQuotes)),
-                      ports,
-                      ports));
-      payload.getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
-      return payload;
-   }
-
-   //TODO (broudy): convert to mock test and add description to test.
-   public void testInsertFirewallResponseIs2xx() throws IOException {
-
-      HttpRequest request = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/global/firewalls")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(firewallPayloadFirewallOfName(
-                      "myfw",
-                      "default",
-                      ImmutableList.of("10.0.1.0/32"),
-                      ImmutableList.of("tag1"),
-                      ImmutableList.of("tag2"),
-                      ImmutableList.of("22", "23-24")))
-              .build();
-
-      HttpResponse insertFirewallResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/operation.json")).build();
-
-      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, insertFirewallResponse).firewalls();
-
-      assertEquals(api.createInNetwork("myfw", URI.create(BASE_URL + "/party/global/networks/default"),
-              new FirewallOptions()
-                      .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24")))
-                      .addSourceTag("tag1")
-                      .addSourceRange("10.0.1.0/32")
-                      .addTargetTag("tag2")), new ParseOperationTest().expected());
-
-   }
-
-   public void testUpdateFirewallResponseIs2xx() throws IOException {
-      HttpRequest update = HttpRequest
-              .builder()
-              .method("PUT")
-              .endpoint(BASE_URL + "/party/global/firewalls/myfw")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(firewallPayloadFirewallOfName(
-                      "myfw",
-                      "default",
-                      ImmutableList.of("10.0.1.0/32"),
-                      ImmutableList.of("tag1"),
-                      ImmutableList.of("tag2"),
-                      ImmutableList.of("22", "23-24")))
-              .build();
-
-      HttpResponse updateFirewallResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/operation.json")).build();
-
-      FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, update,
-              updateFirewallResponse).firewalls();
-
-      assertEquals(api.update("myfw",
-              new FirewallOptions()
-                      .name("myfw")
-                      .network(URI.create(BASE_URL + "/party/global/networks/default"))
-                      .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24")))
-                      .addSourceTag("tag1")
-                      .addSourceRange("10.0.1.0/32")
-                      .addTargetTag("tag2")), new ParseOperationTest().expected());
-   }
-
    public void testPatchFirewallResponseIs2xx() throws IOException {
       HttpRequest update = HttpRequest
               .builder()
@@ -156,13 +42,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineExpectTest<Goo
               .endpoint(BASE_URL + "/party/global/firewalls/myfw")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(firewallPayloadFirewallOfName(
-                      "myfw",
-                      "default",
-                      ImmutableList.of("10.0.1.0/32"),
-                      ImmutableList.of("tag1"),
-                      ImmutableList.of("tag2"),
-                      ImmutableList.of("22", "23-24")))
+              .payload(payloadFromResource("/firewall_insert.json"))
               .build();
 
       HttpResponse updateFirewallResponse = HttpResponse.builder().statusCode(200)

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
index bf7ce5d..ba8afef 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiMockTest.java
@@ -20,12 +20,18 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.AssertJUnit.assertNull;
 
+import java.net.URI;
+
+import org.jclouds.googlecomputeengine.domain.Firewall;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.FirewallOptions;
 import org.jclouds.googlecomputeengine.parse.ParseFirewallListTest;
 import org.jclouds.googlecomputeengine.parse.ParseFirewallTest;
 import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
 import org.testng.annotations.Test;
 
+import com.google.common.collect.ImmutableList;
+
 @Test(groups = "unit", testName = "FirewallApiMockTest", singleThreaded = true)
 public class FirewallApiMockTest extends BaseGoogleComputeEngineApiMockTest {
 
@@ -75,6 +81,40 @@ public class FirewallApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       assertSent(server, "GET", "/projects/party/global/firewalls");
    }
 
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      FirewallOptions options = new FirewallOptions()
+         .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24")))
+         .addSourceTag("tag1")
+         .addSourceRange("10.0.1.0/32")
+         .addTargetTag("tag2");
+
+      assertEquals(firewallApi().createInNetwork("myfw", URI.create(url("/projects/party/global/networks/default")), options),
+            new ParseOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/global/firewalls",
+            stringFromResource("/firewall_insert.json"));
+   }
+
+   public void update() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      FirewallOptions options = new FirewallOptions()
+         .name("myfw")
+         .network(URI.create(url("/projects/party/global/networks/default")))
+         .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24")))
+         .addSourceTag("tag1")
+         .addSourceRange("10.0.1.0/32")
+         .addTargetTag("tag2");
+
+      assertEquals(firewallApi().update("myfw", options),
+            new ParseOperationTest().expected(url("/projects")));
+
+      assertSent(server, "PUT", "/projects/party/global/firewalls/myfw",
+            stringFromResource("/firewall_insert.json"));
+   }
+
    FirewallApi firewallApi(){
       return api().firewalls();
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiExpectTest.java
deleted file mode 100644
index 9984b20..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiExpectTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.net.URI;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
-import org.jclouds.googlecomputeengine.parse.ParseTargetHttpProxyListTest;
-import org.jclouds.googlecomputeengine.parse.ParseTargetHttpProxyTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit")
-public class TargetHttpProxyApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   private static final String ENDPOINT_BASE = "https://www.googleapis.com/"
-            + "compute/v1/projects/party/global/targetHttpProxies";
-
-   private org.jclouds.http.HttpRequest.Builder<? extends HttpRequest.Builder<?>> getBasicRequest() {
-      return HttpRequest.builder().addHeader("Accept", "application/json")
-                                  .addHeader("Authorization", "Bearer " + TOKEN);
-   }
-
-   private HttpResponse createResponse(String payloadFile) {
-      return HttpResponse.builder().statusCode(200)
-                                   .payload(payloadFromResource(payloadFile))
-                                   .build();
-   }
-
-   public void testGetTargetHttpProxyResponseIs2xx() throws Exception {
-      HttpRequest request = getBasicRequest().method("GET")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test").build();
-
-      HttpResponse response = createResponse("/target_http_proxy_get.json");
-
-      TargetHttpProxyApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, request, response).targetHttpProxies();
-
-      assertEquals(api.get("jclouds-test"),
-                   new ParseTargetHttpProxyTest().expected());
-   }
-
-   public void testGetTargetHttpProxyResponseIs4xx() throws Exception {
-      HttpRequest request = getBasicRequest().method("GET")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test").build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      TargetHttpProxyApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, request, response).targetHttpProxies();
-
-      assertNull(api.get("jclouds-test"));
-   }
-
-
-
-   public void testInsertTargetHttpProxyResponseIs2xx() {
-      HttpRequest request = getBasicRequest().method("POST")
-               .endpoint(ENDPOINT_BASE)
-               .payload(payloadFromResourceWithContentType("/target_http_proxy_insert.json",
-                                                           MediaType.APPLICATION_JSON))
-               .build();
-
-      HttpResponse response = createResponse("/operation.json");
-
-      TargetHttpProxyApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).targetHttpProxies();
-
-      URI urlMap = URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test");
-      assertEquals(api.create("jclouds-test", urlMap), new ParseOperationTest().expected());
-   }
-
-   public void testDeleteTargetHttpProxyResponseIs2xx() {
-      HttpRequest request = getBasicRequest().method("DELETE")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .build();
-
-      HttpResponse response = createResponse("/operation.json");
-
-      TargetHttpProxyApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).targetHttpProxies();
-
-      assertEquals(api.delete("jclouds-test"),
-              new ParseOperationTest().expected());
-   }
-
-   public void testDeleteTargetHttpProxyResponseIs4xx() {
-      HttpRequest request = getBasicRequest().method("DELETE")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      TargetHttpProxyApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).targetHttpProxies();
-
-      assertNull(api.delete("jclouds-test"));
-   }
-
-   public void testSetUrlMapTargetHttpProxyResponseIs2xx() {
-      HttpRequest request = getBasicRequest().method("POST")
-               // setUrlMap uses a non-standard url pattern
-               .endpoint("https://www.googleapis.com/compute/v1/projects/party/targetHttpProxies"
-                         + "/jclouds-test/setUrlMap")
-               .payload(payloadFromResourceWithContentType("/target_http_proxy_set_url_map.json",
-                                                           MediaType.APPLICATION_JSON))
-               .build();
-
-      HttpResponse response = createResponse("/operation.json");
-
-      TargetHttpProxyApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).targetHttpProxies();
-
-      URI urlMap = URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test");
-      assertEquals(api.setUrlMap("jclouds-test", urlMap), new ParseOperationTest().expected());
-   }
-
-   public void testListTargetHttpProxiesResponseIs2xx() {
-      HttpRequest request = getBasicRequest().method("GET")
-               .endpoint(ENDPOINT_BASE)
-               .build();
-
-      HttpResponse response = createResponse("/target_http_proxy_list.json");
-
-      TargetHttpProxyApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, request, response).targetHttpProxies();
-
-      assertEquals(api.list().next(),
-              new ParseTargetHttpProxyListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpRequest list = HttpRequest
-            .builder()
-            .method("GET")
-            .endpoint(BASE_URL + "/party/global/targetHttpProxies")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      TargetHttpProxyApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-            TOKEN_RESPONSE, list, response).targetHttpProxies();
-
-      assertFalse(api.list().hasNext());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiMockTest.java
new file mode 100644
index 0000000..08d3e85
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApiMockTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import java.net.URI;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseTargetHttpProxyListTest;
+import org.jclouds.googlecomputeengine.parse.ParseTargetHttpProxyTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "TargetHttpProxyApiMockTest", singleThreaded = true)
+public class TargetHttpProxyApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/target_http_proxy_get.json"));
+
+      assertEquals(targetHttpProxyApi().get("jclouds-test"),
+            new ParseTargetHttpProxyTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/targetHttpProxies/jclouds-test");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(targetHttpProxyApi().get("jclouds-test"));
+      assertSent(server, "GET", "/projects/party/global/targetHttpProxies/jclouds-test");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      URI urlMap = URI.create(url("/projects/myproject/global/urlMaps/jclouds-test"));
+      assertEquals(targetHttpProxyApi().create("jclouds-test", urlMap), new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/global/targetHttpProxies",
+            stringFromResource("/target_http_proxy_insert.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      assertEquals(targetHttpProxyApi().delete("jclouds-test"),
+            new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/global/targetHttpProxies/jclouds-test");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(targetHttpProxyApi().delete("jclouds-test"));
+      assertSent(server, "DELETE", "/projects/party/global/targetHttpProxies/jclouds-test");
+   }
+
+   public void setUrlMap() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      URI urlMap = URI.create(url("/projects/myproject/global/urlMaps/jclouds-test"));
+      assertEquals(targetHttpProxyApi().setUrlMap("jclouds-test", urlMap), new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/targetHttpProxies/jclouds-test/setUrlMap",
+            stringFromResource("/target_http_proxy_set_url_map.json"));
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/target_http_proxy_list.json"));
+
+      assertEquals(targetHttpProxyApi().list().next(), new ParseTargetHttpProxyListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/targetHttpProxies");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(targetHttpProxyApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/global/targetHttpProxies");
+   }
+
+   TargetHttpProxyApi targetHttpProxyApi() {
+      return api().targetHttpProxies();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiExpectTest.java
index e13dbf3..885ab88 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiExpectTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiExpectTest.java
@@ -17,8 +17,6 @@
 package org.jclouds.googlecomputeengine.features;
 
 import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
 
 import java.io.IOException;
 import java.net.URI;
@@ -33,9 +31,6 @@ import org.jclouds.googlecomputeengine.domain.UrlMap.PathMatcher.PathRule;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
 import org.jclouds.googlecomputeengine.options.UrlMapOptions;
 import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
-import org.jclouds.googlecomputeengine.parse.ParseUrlMapListTest;
-import org.jclouds.googlecomputeengine.parse.ParseUrlMapTest;
-import org.jclouds.googlecomputeengine.parse.ParseUrlMapValidateTest;
 import org.jclouds.http.HttpRequest;
 import org.jclouds.http.HttpResponse;
 import org.testng.annotations.Test;
@@ -45,155 +40,25 @@ import com.google.common.collect.ImmutableList;
 @Test(groups = "unit")
 public class UrlMapApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
 
-   private static final String ENDPOINT_BASE = "https://www.googleapis.com/"
-            + "compute/v1/projects/party/global/urlMaps";
 
-   private org.jclouds.http.HttpRequest.Builder<? extends HttpRequest.Builder<?>> getBasicRequest() {
-      return HttpRequest.builder().addHeader("Accept", "application/json")
-                                  .addHeader("Authorization", "Bearer " + TOKEN);
-   }
-
-   private HttpResponse createResponse(String payloadFile) {
-      return HttpResponse.builder().statusCode(200)
-                                   .payload(payloadFromResource(payloadFile))
-                                   .build();
-   }
-
-   public void testGetUrlMapResponseIs2xx() throws Exception {
-      HttpRequest request = getBasicRequest().method("GET")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .build();
-
-      HttpResponse response = createResponse("/url_map_get.json");
-
-      UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, request, response).urlMaps();
-
-      assertEquals(api.get("jclouds-test"), new ParseUrlMapTest().expected());
-   }
-
-   public void testGetUrlMapResponseIs4xx() throws Exception {
-      HttpRequest request = getBasicRequest().method("GET")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, request, response).urlMaps();
-
-      assertNull(api.get("jclouds-test"));
-   }
-
-   public void testInsertUrlMapResponseIs2xx() throws IOException {
-      HttpRequest request = getBasicRequest().method("POST")
-               .endpoint(ENDPOINT_BASE)
-               .payload(payloadFromResourceWithContentType("/url_map_insert.json", MediaType.APPLICATION_JSON))
-               .build();
-
-      HttpResponse response = createResponse("/operation.json");
-
-      UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).urlMaps();
-
-      assertEquals(api.create(createBasicMap()), new ParseOperationTest().expected());
-
-   }
-
-   public void testUpdateUrlMapResponseIs2xx() throws IOException {
-      HttpRequest request = getBasicRequest().method("PUT")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .payload(payloadFromResourceWithContentType("/url_map_insert.json", MediaType.APPLICATION_JSON))
-               .build();
-
-      HttpResponse response = createResponse("/operation.json");
-
-      UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).urlMaps();
-
-      assertEquals(api.update("jclouds-test", createBasicMap()), new ParseOperationTest().expected());
-   }
-
-   public void testPatchUrlMapResponseIs2xx() throws IOException {
-      HttpRequest request = getBasicRequest().method("PATCH")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .payload(payloadFromResourceWithContentType("/url_map_insert.json", MediaType.APPLICATION_JSON))
-               .build();
-
-      HttpResponse response = createResponse("/operation.json");
+   public void patch() throws IOException {
+      HttpRequest request = HttpRequest.builder()
+            .addHeader("Accept", "application/json")
+            .addHeader("Authorization", "Bearer " + TOKEN)
+            .method("PATCH")
+            .endpoint("https://www.googleapis.com/compute/v1/projects"
+                     + "/party/global/urlMaps/jclouds-test")
+            .payload(payloadFromResourceWithContentType("/url_map_insert.json", MediaType.APPLICATION_JSON))
+            .build();
 
-      UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).urlMaps();
-
-      assertEquals(api.patch("jclouds-test", createBasicMap()), new ParseOperationTest().expected());
-   }
-
-   public void testDeleteUrlMapResponseIs2xx() {
-      HttpRequest request = getBasicRequest().method("DELETE")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .build();
-
-      HttpResponse response = createResponse("/operation.json");
-
-      UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).urlMaps();
-
-      assertEquals(api.delete("jclouds-test"), new ParseOperationTest().expected());
-   }
-
-   public void testDeleteUrlMapResponseIs4xx() {
-      HttpRequest request = getBasicRequest().method("DELETE")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test")
-               .build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, request, response).urlMaps();
-
-      assertNull(api.delete("jclouds-test"));
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(ENDPOINT_BASE)
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void list() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/url_map_list.json")).build();
-
-      UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).urlMaps();
-
-      assertEquals(api.list().next(), new ParseUrlMapListTest().expected());
-   }
-
-   public void listEmpty() {
       HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).urlMaps();
-
-      assertFalse(api.list().hasNext());
-   }
-
-   public void testValidateUrlMapsResponseIs2xx() {
-      HttpRequest request = getBasicRequest().method("POST")
-               .endpoint(ENDPOINT_BASE + "/jclouds-test/validate")
-               .payload(payloadFromResourceWithContentType("/url_map_validate_request.json",
-                                                           MediaType.APPLICATION_JSON))
-               .build();
-
-      HttpResponse response = createResponse("/url_map_validate.json");
+            .payload(payloadFromResource("/operation.json"))
+            .build();
 
       UrlMapApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
               TOKEN_RESPONSE, request, response).urlMaps();
 
-      assertEquals(api.validate("jclouds-test", createBasicMap()), new ParseUrlMapValidateTest().expected());
+      assertEquals(api.patch("jclouds-test", createBasicMap()), new ParseOperationTest().expected());
    }
 
    private UrlMapOptions createBasicMap() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
new file mode 100644
index 0000000..b0de3d8
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/UrlMapApiMockTest.java
@@ -0,0 +1,140 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import java.net.URI;
+
+import org.jclouds.googlecomputeengine.domain.UrlMap;
+import org.jclouds.googlecomputeengine.domain.UrlMap.HostRule;
+import org.jclouds.googlecomputeengine.domain.UrlMap.PathMatcher;
+import org.jclouds.googlecomputeengine.domain.UrlMap.PathMatcher.PathRule;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.UrlMapOptions;
+import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseUrlMapListTest;
+import org.jclouds.googlecomputeengine.parse.ParseUrlMapTest;
+import org.jclouds.googlecomputeengine.parse.ParseUrlMapValidateTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+@Test(groups = "unit", testName = "UrlMapApiMockTest", singleThreaded = true)
+public class UrlMapApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/url_map_get.json"));
+
+      assertEquals(urlMapApi().get("jclouds-test"), new ParseUrlMapTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/urlMaps/jclouds-test");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(urlMapApi().get("jclouds-test"));
+      assertSent(server, "GET", "/projects/party/global/urlMaps/jclouds-test");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      assertEquals(urlMapApi().create(createBasicMap()), new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/global/urlMaps",
+            stringFromResource("/url_map_insert.json"));
+   }
+
+   public void update() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      assertEquals(urlMapApi().update("jclouds-test", createBasicMap()),
+            new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "PUT", "/projects/party/global/urlMaps/jclouds-test",
+            stringFromResource("/url_map_insert.json"));
+   }
+
+/*
+   public void patch() throws Exception {
+      // PATCH not yet supported
+      server.enqueue(jsonResponse("/operation.json"));
+
+      assertEquals(urlMapApi().patch("jclouds-test", createBasicMap()),
+            new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "PATCH", "/projects/party/global/urlMaps/jclouds-test",
+            stringFromResource("/url_map_insert.json"));
+   }
+*/
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      assertEquals(urlMapApi().delete("jclouds-test"),
+            new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/global/urlMaps/jclouds-test");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(urlMapApi().delete("jclouds-test"));
+      assertSent(server, "DELETE", "/projects/party/global/urlMaps/jclouds-test");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/url_map_list.json"));
+
+      assertEquals(urlMapApi().list().next(),
+            new ParseUrlMapListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/global/urlMaps");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(urlMapApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/global/urlMaps");
+   }
+
+   public void validate() throws Exception {
+      server.enqueue(jsonResponse("/url_map_validate.json"));
+
+      assertEquals(urlMapApi().validate("jclouds-test", createBasicMap()),
+            new ParseUrlMapValidateTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/global/urlMaps/jclouds-test/validate");
+   }
+
+   private UrlMapOptions createBasicMap() {
+      URI service = URI.create(url("/projects/myproject/global/backendServices/jclouds-test"));
+      return new UrlMapOptions().name("jclouds-test")
+                                .description("Sample url map")
+                                .hostRule(HostRule.create(null, ImmutableList.of("jclouds-test"), "path"))
+                                .pathMatcher(PathMatcher.create("path",
+                                                                null,
+                                                                service,
+                                                                ImmutableList.of(
+                                                                      PathRule.create(ImmutableList.of("/"),
+                                                                                      service))))
+                                .test(UrlMap.UrlMapTest.create(null, "jclouds-test", "/test/path", service))
+                                .defaultService(service);
+   }
+
+   UrlMapApi urlMapApi() {
+      return api().urlMaps();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java
deleted file mode 100644
index 43f1b00..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.parse.ParseZoneListTest;
-import org.jclouds.googlecomputeengine.parse.ParseZoneTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ZoneApiExpectTest")
-public class ZoneApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   public static final String ZONES_URL_PREFIX = BASE_URL + "/party/zones";
-
-   public static final HttpRequest GET_ZONE_REQ = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(ZONES_URL_PREFIX + "/us-central1-a")
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpRequest LIST_ZONES_REQ = HttpRequest
-           .builder()
-           .method("GET")
-           .endpoint(ZONES_URL_PREFIX)
-           .addHeader("Accept", "application/json")
-           .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public static final HttpResponse LIST_ZONES_SHORT_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/zone_list_short.json")).build();
-
-   public static final HttpResponse LIST_ZONES_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/zone_list.json")).build();
-
-   public void testGetZoneResponseIs2xx() throws Exception {
-
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/zone_get.json")).build();
-
-      ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_ZONE_REQ, response).zones();
-
-      assertEquals(api.get("us-central1-a"),
-              new ParseZoneTest().expected());
-   }
-
-   public void testGetZoneResponseIs4xx() throws Exception {
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, GET_ZONE_REQ, response).zones();
-
-      assertNull(api.get("us-central1-a"));
-   }
-
-   public void list() throws Exception {
-      ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, LIST_ZONES_REQ, LIST_ZONES_RESPONSE).zones();
-
-      assertEquals(api.list().next(), new ParseZoneListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, LIST_ZONES_REQ, response).zones();
-
-      assertFalse(api.list().hasNext());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiMockTest.java
new file mode 100644
index 0000000..cefecf4
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiMockTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseZoneListTest;
+import org.jclouds.googlecomputeengine.parse.ParseZoneTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "ZoneApiMockTest", singleThreaded = true)
+public class ZoneApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/zone_get.json"));
+
+      assertEquals(zoneApi().get("us-central1-a"),
+            new ParseZoneTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(zoneApi().get("us-central1-a"));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/zone_list.json"));
+
+      assertEquals(zoneApi().list().next(), new ParseZoneListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(zoneApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/zones");
+   }
+
+   ZoneApi zoneApi() {
+      return api().zones();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyListTest.java
index d4abfca..4c0a3d2 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyListTest.java
@@ -38,19 +38,22 @@ public class ParseTargetHttpProxyListTest extends BaseGoogleComputeEngineParseTe
       return "/target_http_proxy_list.json";
    }
 
-   @Override
-   @Consumes(MediaType.APPLICATION_JSON)
+   @Override @Consumes(MediaType.APPLICATION_JSON)
    public ListPage<TargetHttpProxy> expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(MediaType.APPLICATION_JSON)
+   public ListPage<TargetHttpProxy> expected(String baseUrl) {
       return ForwardingListPage.create(
             ImmutableList.of(
-                  new ParseTargetHttpProxyTest().expected(),
+                  new ParseTargetHttpProxyTest().expected(baseUrl),
                   TargetHttpProxy.create("13050421646334304116", // id
                         new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306"), // creationTimestamp
-                        URI.create("https://www.googleapis" +
-                              ".com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test-2"), // selfLink
+                        URI.create(baseUrl + "/myproject/global/targetHttpProxies/jclouds-test-2"), // selfLink
                         "jclouds-test-2", // name
                         "Simple proxy", // description
-                        URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test-2"))), // urlMap
+                        URI.create(baseUrl + "/myproject/global/urlMaps/jclouds-test-2"))), // urlMap
                   null // nextPageToken d
             );
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyTest.java
index 802ad46..47ce80b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyTest.java
@@ -34,14 +34,18 @@ public class ParseTargetHttpProxyTest extends BaseGoogleComputeEngineParseTest<T
       return "/target_http_proxy_get.json";
    }
 
-   @Override
-   @Consumes(MediaType.APPLICATION_JSON)
+   @Override @Consumes(MediaType.APPLICATION_JSON)
    public TargetHttpProxy expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(MediaType.APPLICATION_JSON)
+   public TargetHttpProxy expected(String baseUrl) {
       return TargetHttpProxy.create("13050421646334304115", // id
             new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306"), // creationTimestamp
-            URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test"), // selfLink
+            URI.create(baseUrl + "/myproject/global/targetHttpProxies/jclouds-test"), // selfLink
             "jclouds-test", // name
             null,
-            URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test")); // urlMap
+            URI.create(baseUrl + "/myproject/global/urlMaps/jclouds-test")); // urlMap
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapListTest.java
index 5c7f945..a5b30c4 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapListTest.java
@@ -41,19 +41,22 @@ public class ParseUrlMapListTest extends BaseGoogleComputeEngineParseTest<ListPa
    @Override
    @Consumes(MediaType.APPLICATION_JSON)
    public ListPage<UrlMap> expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(MediaType.APPLICATION_JSON)
+   public ListPage<UrlMap> expected(String baseUrl) {
       return ForwardingListPage.create(
-            ImmutableList.of(new ParseUrlMapTest().expected(),
+            ImmutableList.of(new ParseUrlMapTest().expected(baseUrl),
                   UrlMap.create("13741966667737398120", // id
                         new SimpleDateFormatDateService().iso8601DateParse("2014-07-23T12:39:50.022-07:00"), // creationTimestamp
-                        URI.create("https://www.googleapis" +
-                              ".com/compute/v1/projects/myproject/global/urlMaps/jclouds-test-2"), // selfLink
+                        URI.create(baseUrl + "/myproject/global/urlMaps/jclouds-test-2"), // selfLink
                         "jclouds-test-2", // name
                         "Basic url map", // description
                         null, // hostRules
                         null, // pathMatchers
                         null, // urlMapTests
-                        URI.create("https://www.googleapis.com/compute/v1/projects/"
-                              + "myproject/global/backendServices/jclouds-test"), // defaultService
+                        URI.create(baseUrl + "/myproject/global/backendServices/jclouds-test"), // defaultService
                         "EDqhvJucpz4=")), // fingerprint
             null);
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapTest.java
index e29b8dd..f266f6d 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapTest.java
@@ -44,7 +44,12 @@ public class ParseUrlMapTest extends BaseGoogleComputeEngineParseTest<UrlMap> {
    @Override
    @Consumes(MediaType.APPLICATION_JSON)
    public UrlMap expected() {
-      URI service = URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test");
+      return expected(BASE_URL);
+   }
+
+   @Consumes(MediaType.APPLICATION_JSON)
+   public UrlMap expected(String baseUrl) {
+      URI service = URI.create(baseUrl + "/myproject/global/backendServices/jclouds-test");
 
       List<HostRule> hostRules = ImmutableList.of(HostRule.create(null, // description
             ImmutableList.of("jclouds-test"), // hosts
@@ -64,7 +69,7 @@ public class ParseUrlMapTest extends BaseGoogleComputeEngineParseTest<UrlMap> {
 
       return UrlMap.create("13741966667737398119", // id
             new SimpleDateFormatDateService().iso8601DateParse("2014-07-23T12:39:50.022-07:00"), // creationTimestamp
-            URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test"), // selfLink
+            URI.create(baseUrl + "/myproject/global/urlMaps/jclouds-test"), // selfLink
             "jclouds-test", // name
             "Sample url map", // description
             hostRules, // hostRules

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapValidateTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapValidateTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapValidateTest.java
index 20380c0..06fdc6b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapValidateTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapValidateTest.java
@@ -39,13 +39,18 @@ public class ParseUrlMapValidateTest extends BaseGoogleComputeEngineParseTest<Ur
    @Override
    @Consumes(APPLICATION_JSON)
    public UrlMapValidateResult expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public UrlMapValidateResult expected(String baseUrl) {
       return UrlMapValidateResult.create(false, // loadSucceded
             ImmutableList.of("jclouds-test"), // loadError
             false, // testPassed
             ImmutableList.of(TestFailure.create("jclouds-test", // host
                   "/test/path", // path
-                  URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test"), // expectedService
-                  URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test-2") //actualService
+                  URI.create(baseUrl + "/myproject/global/backendServices/jclouds-test"), // expectedService
+                  URI.create(baseUrl + "/myproject/global/backendServices/jclouds-test-2") //actualService
                   ))); //testFailures)
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java
index 05f610d..9bd0930 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java
@@ -40,11 +40,16 @@ public class ParseZoneListTest extends BaseGoogleComputeEngineParseTest<ListPage
 
    @Override @Consumes(APPLICATION_JSON)
    public ListPage<Zone> expected() {
-      Zone zone1 = new ParseZoneTest().expected();
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public ListPage<Zone> expected(String baseUrl) {
+      Zone zone1 = new ParseZoneTest().expected(baseUrl);
       Zone zone2 = Zone.create( //
             "13024414164050619686", // id
             parse("2012-10-24T20:13:19.271"), // creationTimestamp
-            URI.create(BASE_URL + "/party/zones/us-central1-b"), // selfLink
+            URI.create(baseUrl + "/party/zones/us-central1-b"), // selfLink
             "us-central1-b", // name
             "us-central1-b", // description
             Zone.Status.UP, // status

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneTest.java
index 2a472c9..7bfd66c 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneTest.java
@@ -38,10 +38,15 @@ public class ParseZoneTest extends BaseGoogleComputeEngineParseTest<Zone> {
 
    @Override @Consumes(APPLICATION_JSON)
    public Zone expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public Zone expected(String baseUrl) {
       return Zone.create( //
             "13020128040171887099", // id
             parse("2012-10-19T16:42:54.131"), // creationTimestamp
-            URI.create(BASE_URL + "/party/zones/us-central1-a"), // selfLink
+            URI.create(baseUrl + "/party/zones/us-central1-a"), // selfLink
             "us-central1-a", // name
             "us-central1-a", // description
             Zone.Status.DOWN, // status

http://git-wip-us.apache.org/repos/asf/jclouds/blob/e4cc7282/providers/google-compute-engine/src/test/resources/firewall_insert.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/firewall_insert.json b/providers/google-compute-engine/src/test/resources/firewall_insert.json
index 8742a10..6d29ef8 100644
--- a/providers/google-compute-engine/src/test/resources/firewall_insert.json
+++ b/providers/google-compute-engine/src/test/resources/firewall_insert.json
@@ -1 +1,22 @@
-{"name":"%s","network":"https://www.googleapis.com/compute/v1/projects/party/global/networks/%s","sourceRanges":[%s],"sourceTags":[%s],"targetTags":[%s],"allowed":[{"IPProtocol":"tcp","ports":[%s]}]}
\ No newline at end of file
+{
+  "name": "myfw",
+  "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/default",
+  "sourceRanges": [
+    "10.0.1.0/32"
+  ],
+  "sourceTags": [
+    "tag1"
+  ],
+  "targetTags": [
+    "tag2"
+  ],
+  "allowed": [
+    {
+      "IPProtocol": "tcp",
+      "ports": [
+        "22",
+        "23-24"
+      ]
+    }
+  ]
+}
\ No newline at end of file


[31/50] [abbrv] jclouds git commit: Updated AggregatedListApiLiveTest

Posted by na...@apache.org.
Updated AggregatedListApiLiveTest


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

Branch: refs/heads/master
Commit: 9c3cefff16f7b4e37a0b2bc03125ece304a14978
Parents: ec52bdb
Author: Daniel Broudy <br...@google.com>
Authored: Wed Feb 11 11:55:22 2015 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Feb 18 10:58:37 2015 +0100

----------------------------------------------------------------------
 .../googlecomputeengine/features/AggregatedListApiLiveTest.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/9c3cefff/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
index 00bb650..d7121b2 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
@@ -52,7 +52,7 @@ public class AggregatedListApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
 
       List<MachineType> machineTypeAsList = pageIterator.next();
 
-      assertEquals(machineTypeAsList.size(), 9); // zone count!
+      assertEquals(machineTypeAsList.size(), 1);
    }
 
    public void addresses() {


[07/50] [abbrv] jclouds git commit: Added LicenseApi

Posted by na...@apache.org.
Added LicenseApi


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

Branch: refs/heads/master
Commit: 3e9612a0bca98cb75a58e3bd7b93a290ba5a87a0
Parents: fca6022
Author: Daniel Broudy <br...@google.com>
Authored: Wed Nov 26 17:16:06 2014 -0800
Committer: Daniel Broudy <br...@google.com>
Committed: Mon Dec 1 11:27:13 2014 -0800

----------------------------------------------------------------------
 .../GoogleComputeEngineApi.java                 |  5 ++
 .../googlecomputeengine/domain/License.java     | 40 ++++++++++++++++
 .../features/LicenseApi.java                    | 48 ++++++++++++++++++++
 .../features/LicenseApiLiveTest.java            | 47 +++++++++++++++++++
 .../features/LicenseApiMockTest.java            | 46 +++++++++++++++++++
 .../parse/ParseLicenseTest.java                 | 46 +++++++++++++++++++
 .../src/test/resources/license_get.json         |  6 +++
 7 files changed, 238 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/3e9612a0/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
index 14a3961..21c0764 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
@@ -32,6 +32,7 @@ import org.jclouds.googlecomputeengine.features.ForwardingRuleApi;
 import org.jclouds.googlecomputeengine.features.HttpHealthCheckApi;
 import org.jclouds.googlecomputeengine.features.ImageApi;
 import org.jclouds.googlecomputeengine.features.InstanceApi;
+import org.jclouds.googlecomputeengine.features.LicenseApi;
 import org.jclouds.googlecomputeengine.features.MachineTypeApi;
 import org.jclouds.googlecomputeengine.features.NetworkApi;
 import org.jclouds.googlecomputeengine.features.OperationApi;
@@ -102,6 +103,10 @@ public interface GoogleComputeEngineApi extends Closeable {
    InstanceApi instancesInZone(@PathParam("zone") String zone);
 
    @Delegate
+   @Path("/projects/{project}/global")
+   LicenseApi licensesInProject(@PathParam("project") String project);
+
+   @Delegate
    @Endpoint(CurrentProject.class)
    @Path("/zones/{zone}")
    MachineTypeApi machineTypesInZone(@PathParam("zone") String zone);

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3e9612a0/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/License.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/License.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/License.java
new file mode 100644
index 0000000..68277e5
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/License.java
@@ -0,0 +1,40 @@
+/*
+ * 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.googlecomputeengine.domain;
+
+import java.net.URI;
+
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+/** Parameter to {@linkplain org.jclouds.googlecomputeengine.features.InstanceApi#create(NewInstance)}. */
+@AutoValue
+public abstract class License {
+
+   public abstract URI selfLink();
+   public abstract String name();
+   public abstract boolean chargesUseFee();
+
+   @SerializedNames({"selfLink", "name", "chargesUseFee"})
+   public static License create(URI selfLink, String name, boolean chargesUseFee) {
+      return new AutoValue_License(selfLink, name, chargesUseFee);
+   }
+
+   License() {
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3e9612a0/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/LicenseApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/LicenseApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/LicenseApi.java
new file mode 100644
index 0000000..9301fc5
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/LicenseApi.java
@@ -0,0 +1,48 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.googlecomputeengine.domain.License;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.oauth.v2.filters.OAuthFilter;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SkipEncoding;
+
+@SkipEncoding({'/', '='})
+@RequestFilters(OAuthFilter.class)
+@Consumes(APPLICATION_JSON)
+public interface LicenseApi {
+
+   /** Returns the specified License resource. */
+   @Named("License:get")
+   @GET
+   @Path("/licenses/{license}")
+   @Fallback(NullOnNotFoundOr404.class)
+   @Nullable
+   License get(@PathParam("license") String license);
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3e9612a0/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/LicenseApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/LicenseApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/LicenseApiLiveTest.java
new file mode 100644
index 0000000..247bb4f
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/LicenseApiLiveTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.net.URI;
+
+import org.jclouds.googlecomputeengine.domain.License;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.testng.annotations.Test;
+
+public class LicenseApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
+
+   public static final String PROJECT = "suse-cloud";
+   public static final String LICENSE = "sles-12";
+
+
+   private LicenseApi api() {
+      return api.licensesInProject(PROJECT);
+   }
+
+   @Test(groups = "live")
+   public void testGetLicense() {
+      License license = api().get(LICENSE);
+      assertNotNull(license);
+      assertEquals(license.name(), LICENSE);
+      URI selfLink = URI.create("https://www.googleapis.com/compute/v1/projects/" +
+            PROJECT + "/global/licenses/" + LICENSE);
+      assertEquals(license.selfLink(), selfLink);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3e9612a0/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/LicenseApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/LicenseApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/LicenseApiMockTest.java
new file mode 100644
index 0000000..cc88192
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/LicenseApiMockTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseLicenseTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "LicenseApiMockTest", singleThreaded = true)
+public class LicenseApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/license_get.json"));
+
+      assertEquals(licenseApi().get("sles-12"), new ParseLicenseTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/suse-cloud/global/licenses/sles-12");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(licenseApi().get("sles-12"));
+      assertSent(server, "GET", "/projects/suse-cloud/global/licenses/sles-12");
+   }
+
+   public LicenseApi licenseApi(){
+      return api().licensesInProject("suse-cloud");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3e9612a0/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseLicenseTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseLicenseTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseLicenseTest.java
new file mode 100644
index 0000000..519c4d5
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseLicenseTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.googlecomputeengine.parse;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+
+import org.jclouds.googlecomputeengine.domain.License;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "ParseLicenseTest")
+public class ParseLicenseTest extends BaseGoogleComputeEngineParseTest<License> {
+
+   @Override
+   public String resource() {
+      return "/license_get.json";
+   }
+
+   @Override @Consumes(APPLICATION_JSON)
+   public License expected() {
+      return expected(BASE_URL);
+   }
+
+   @Consumes(APPLICATION_JSON)
+   public License expected(String baseUrl) {
+      return License.create(URI.create(baseUrl + "/suse-cloud/global/licenses/sles-12"), "sles-12", true);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/3e9612a0/providers/google-compute-engine/src/test/resources/license_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/license_get.json b/providers/google-compute-engine/src/test/resources/license_get.json
new file mode 100644
index 0000000..fffdf6c
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/license_get.json
@@ -0,0 +1,6 @@
+{
+ "kind": "compute#license",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12",
+ "name": "sles-12",
+ "chargesUseFee": true
+}
\ No newline at end of file


[33/50] [abbrv] jclouds git commit: Next development version 2.0.0-SNAPSHOT

Posted by na...@apache.org.
Next development version 2.0.0-SNAPSHOT


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

Branch: refs/heads/master
Commit: 88c3c610816707bf538f61d18b2a93e9771124cc
Parents: 121ea20
Author: Ignasi Barrera <na...@apache.org>
Authored: Tue Mar 24 11:07:27 2015 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Mar 24 11:07:27 2015 +0100

----------------------------------------------------------------------
 common/googlecloud/pom.xml              | 2 +-
 providers/google-compute-engine/pom.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/88c3c610/common/googlecloud/pom.xml
----------------------------------------------------------------------
diff --git a/common/googlecloud/pom.xml b/common/googlecloud/pom.xml
index e4564e2..8e06883 100644
--- a/common/googlecloud/pom.xml
+++ b/common/googlecloud/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.jclouds.labs</groupId>
         <artifactId>jclouds-labs-google</artifactId>
-        <version>1.9.0</version>
+        <version>2.0.0-SNAPSHOT</version>
     </parent>
 
     <!-- TODO: when out of labs, switch to org.jclouds.provider -->

http://git-wip-us.apache.org/repos/asf/jclouds/blob/88c3c610/providers/google-compute-engine/pom.xml
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/pom.xml b/providers/google-compute-engine/pom.xml
index 55ced6f..2cf38fb 100644
--- a/providers/google-compute-engine/pom.xml
+++ b/providers/google-compute-engine/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.jclouds.labs</groupId>
         <artifactId>jclouds-labs-google</artifactId>
-        <version>1.9.0</version>
+        <version>2.0.0-SNAPSHOT</version>
     </parent>
 
     <!-- TODO: when out of labs, switch to org.jclouds.provider -->


[19/50] [abbrv] jclouds git commit: Cleanup node authentication

Posted by na...@apache.org.
Cleanup node authentication


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

Branch: refs/heads/master
Commit: d6d1e7dde518d0b485e72685225bf66e25562c8d
Parents: 4772587
Author: Ignasi Barrera <na...@apache.org>
Authored: Tue Dec 23 00:17:14 2014 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Jan 5 13:48:15 2015 +0100

----------------------------------------------------------------------
 providers/google-compute-engine/README.md       |   2 +-
 .../GoogleComputeEngineServiceAdapter.java      |  75 +++++---------
 ...GoogleComputeEngineServiceContextModule.java |   9 --
 .../GoogleComputeEngineTemplateOptions.java     |  23 +++--
 ...desWithGroupEncodedIntoNameThenAddToSet.java | 103 +++++++++++--------
 ...DefaultLoginCredentialsForImageStrategy.java |  69 -------------
 ...eNodeCredentialsButOverrideFromTemplate.java |  57 ----------
 .../GoogleComputeEngineServiceMockTest.java     |   3 +-
 8 files changed, 106 insertions(+), 235 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/d6d1e7dd/providers/google-compute-engine/README.md
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/README.md b/providers/google-compute-engine/README.md
index 47ff426..e470698 100644
--- a/providers/google-compute-engine/README.md
+++ b/providers/google-compute-engine/README.md
@@ -6,7 +6,7 @@ Authenticating into the instances:
 --------
 
 User:
-If no user is provided in GoogleComputeEngineTemplateOptions when launching an instance by default "jclouds" is used.
+If no user is provided in GoogleComputeEngineTemplateOptions when launching an instance by default "root" is used.
 
 Credential:
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d6d1e7dd/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index 29f239d..91a8dfe 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -36,6 +36,7 @@ import org.jclouds.compute.ComputeServiceAdapter;
 import org.jclouds.compute.domain.Hardware;
 import org.jclouds.compute.domain.NodeMetadata;
 import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.options.TemplateOptions;
 import org.jclouds.domain.Location;
 import org.jclouds.domain.LocationBuilder;
 import org.jclouds.domain.LocationScope;
@@ -59,6 +60,7 @@ import org.jclouds.location.suppliers.all.JustProvider;
 
 import com.google.common.base.Predicate;
 import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
@@ -108,25 +110,17 @@ public final class GoogleComputeEngineServiceAdapter
 
    @Override public NodeAndInitialCredentials<Instance> createNodeWithGroupEncodedIntoName(String group, String name,
          Template template) {
-
-      checkNotNull(template, "template");
-
       GoogleComputeEngineTemplateOptions options = GoogleComputeEngineTemplateOptions.class.cast(template.getOptions());
       checkNotNull(options.network(), "template options must specify a network");
-      Hardware hardware = checkNotNull(template.getHardware(), "hardware must be set");
-
-      checkNotNull(hardware.getUri(), "hardware must have a URI");
+      checkNotNull(template.getHardware().getUri(), "hardware must have a URI");
       checkNotNull(template.getImage().getUri(), "image URI is null");
 
       List<AttachDisk> disks = Lists.newArrayList();
       disks.add(AttachDisk.newBootDisk(template.getImage().getUri()));
-      for (URI existingDisk : options.additionalDisks()) {
-         disks.add(AttachDisk.existingDisk(existingDisk));
-      }
 
       NewInstance newInstance = NewInstance.create(
             name, // name
-            hardware.getUri(), // machineType
+            template.getHardware().getUri(), // machineType
             options.network(), // network
             disks, // disks
             group // description
@@ -141,9 +135,11 @@ public final class GoogleComputeEngineServiceAdapter
 
       // Add metadata from template and for ssh key and image id
       newInstance.metadata().putAll(options.getUserMetadata());
-      if (options.getPublicKey() != null) { // TODO: why are we doing this?
-         newInstance.metadata().put("sshKeys", format("%s:%s %s@localhost", checkNotNull(options.getLoginUser(),
-               "loginUser cannot be null"), options.getPublicKey(), options.getLoginUser()));
+
+      LoginCredentials credentials = resolveNodeCredentials(template);
+      if (options.getPublicKey() != null) {
+         newInstance.metadata().put("sshKeys",
+               format("%s:%s %s@localhost", credentials.getUser(), options.getPublicKey(), credentials.getUser()));
       }
 
       String zone = template.getLocation().getId();
@@ -174,7 +170,6 @@ public final class GoogleComputeEngineServiceAdapter
       // Add lookup for InstanceToNodeMetadata
       diskToSourceImage.put(instance.get().disks().get(0).source(), template.getImage().getUri());
 
-      LoginCredentials credentials = getFromImageAndOverrideIfRequired(template.getImage(), options);
       return new NodeAndInitialCredentials<Instance>(instance.get(), instance.get().selfLink().toString(), credentials);
    }
 
@@ -256,40 +251,6 @@ public final class GoogleComputeEngineServiceAdapter
       throw new UnsupportedOperationException("suspend is not supported by GCE");
    }
 
-   // TODO: this entire method is questionable. needs a test case, or to be removed.
-   private static LoginCredentials getFromImageAndOverrideIfRequired(org.jclouds.compute.domain.Image image,
-                                                              GoogleComputeEngineTemplateOptions options) {
-      LoginCredentials defaultCredentials = image.getDefaultCredentials();
-      String[] keys = defaultCredentials.getPrivateKey().split(":");
-      String publicKey = keys[0];
-      String privateKey = keys[1];
-
-      LoginCredentials.Builder credentialsBuilder = defaultCredentials.toBuilder();
-      credentialsBuilder.privateKey(privateKey);
-
-      // LoginCredentials from image stores the public key along with the private key in the privateKey field
-      // @see GoogleComputePopulateDefaultLoginCredentialsForImageStrategy
-      // so if options doesn't have a public key set we set it from the default
-      if (options.getPublicKey() == null) {
-         options.authorizePublicKey(publicKey);
-      }
-      if (options.hasLoginPrivateKeyOption()) {
-         credentialsBuilder.privateKey(options.getPrivateKey());
-      }
-      if (options.getLoginUser() != null) {
-         credentialsBuilder.identity(options.getLoginUser());
-      }
-      if (options.hasLoginPasswordOption()) {
-         credentialsBuilder.password(options.getLoginPassword());
-      }
-      if (options.shouldAuthenticateSudo() != null) {
-         credentialsBuilder.authenticateSudo(options.shouldAuthenticateSudo());
-      }
-      LoginCredentials credentials = credentialsBuilder.build();
-      options.overrideLoginCredentials(credentials);
-      return credentials;
-   }
-
    private void waitOperationDone(Operation operation) {
       AtomicReference<Operation> operationRef = Atomics.newReference(operation);
 
@@ -306,6 +267,24 @@ public final class GoogleComputeEngineServiceAdapter
       }
    }
 
+   private LoginCredentials resolveNodeCredentials(Template template) {
+      TemplateOptions options = template.getOptions();
+      LoginCredentials.Builder credentials = LoginCredentials.builder(template.getImage().getDefaultCredentials());
+      if (!Strings.isNullOrEmpty(options.getLoginUser())) {
+         credentials.user(options.getLoginUser());
+      }
+      if (!Strings.isNullOrEmpty(options.getLoginPrivateKey())) {
+         credentials.privateKey(options.getLoginPrivateKey());
+      }
+      if (!Strings.isNullOrEmpty(options.getLoginPassword())) {
+         credentials.password(options.getLoginPassword());
+      }
+      if (options.shouldAuthenticateSudo() != null) {
+         credentials.authenticateSudo(options.shouldAuthenticateSudo());
+      }
+      return credentials.build();
+   }
+
    private static String toName(URI link) {
       String path = link.getPath();
       return path.substring(path.lastIndexOf('/') + 1);

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d6d1e7dd/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
index 47d10a9..b99ef02 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
@@ -43,7 +43,6 @@ import org.jclouds.compute.domain.SecurityGroup;
 import org.jclouds.compute.extensions.ImageExtension;
 import org.jclouds.compute.extensions.SecurityGroupExtension;
 import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
 import org.jclouds.domain.Location;
 import org.jclouds.googlecomputeengine.compute.GoogleComputeEngineService;
 import org.jclouds.googlecomputeengine.compute.GoogleComputeEngineServiceAdapter;
@@ -64,8 +63,6 @@ import org.jclouds.googlecomputeengine.compute.predicates.AllNodesInGroupTermina
 import org.jclouds.googlecomputeengine.compute.predicates.AtomicInstanceVisible;
 import org.jclouds.googlecomputeengine.compute.predicates.AtomicOperationDone;
 import org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
-import org.jclouds.googlecomputeengine.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
-import org.jclouds.googlecomputeengine.compute.strategy.UseNodeCredentialsButOverrideFromTemplate;
 import org.jclouds.googlecomputeengine.domain.Firewall;
 import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
@@ -125,9 +122,6 @@ public final class GoogleComputeEngineServiceContextModule
       bind(new TypeLiteral<Function<Network, SecurityGroup>>() {
       }).to(NetworkToSecurityGroup.class);
 
-      bind(org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy.class)
-            .to(PopulateDefaultLoginCredentialsForImageStrategy.class);
-
       bind(org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet.class)
             .to(CreateNodesWithGroupEncodedIntoNameThenAddToSet.class);
 
@@ -146,10 +140,7 @@ public final class GoogleComputeEngineServiceContextModule
       }).to(FindNetworkOrCreate.class);
 
       bind(SecurityGroupExtension.class).to(GoogleComputeEngineSecurityGroupExtension.class);
-
-      bind(PrioritizeCredentialsFromTemplate.class).to(UseNodeCredentialsButOverrideFromTemplate.class);
       bind(FirewallTagNamingConvention.Factory.class).in(Scopes.SINGLETON);
-
       bindHttpApi(binder(), Resources.class);
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d6d1e7dd/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
index 3aabae3..1b1dac8 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
@@ -17,7 +17,6 @@
 package org.jclouds.googlecomputeengine.compute.options;
 
 import java.net.URI;
-import java.util.List;
 import java.util.Map;
 
 import org.jclouds.compute.options.TemplateOptions;
@@ -25,13 +24,11 @@ import org.jclouds.domain.LoginCredentials;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.scriptbuilder.domain.Statement;
 
-import com.google.common.collect.Lists;
-
 /** Instance options specific to Google Compute Engine. */
 public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
 
    private URI network = null;
-   private final List<URI> additionalDisks = Lists.newArrayList();
+   private boolean autoCreateKeyPair = true;
 
    @Override
    public GoogleComputeEngineTemplateOptions clone() {
@@ -46,6 +43,7 @@ public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
       if (to instanceof GoogleComputeEngineTemplateOptions) {
          GoogleComputeEngineTemplateOptions eTo = GoogleComputeEngineTemplateOptions.class.cast(to);
          eTo.network(network());
+         eTo.autoCreateKeyPair(autoCreateKeyPair());
       }
    }
 
@@ -60,10 +58,19 @@ public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
       return network;
    }
 
-   /** Additional disks to attach to this instance. */
-   // TODO: test me or remove me!
-   public List<URI> additionalDisks() {
-      return additionalDisks;
+   /**
+    * Sets whether an SSH key pair should be created automatically.
+    */
+   public GoogleComputeEngineTemplateOptions autoCreateKeyPair(boolean autoCreateKeyPair) {
+      this.autoCreateKeyPair = autoCreateKeyPair;
+      return this;
+   }
+
+   /**
+    * Sets whether an SSH key pair should be created automatically.
+    */
+   public boolean autoCreateKeyPair() {
+      return autoCreateKeyPair;
    }
 
    /**

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d6d1e7dd/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
index 8c889d2..7fb71df 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
@@ -25,6 +25,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
 
+import javax.annotation.Resource;
 import javax.inject.Inject;
 import javax.inject.Named;
 
@@ -47,8 +48,11 @@ import org.jclouds.googlecomputeengine.domain.Network;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.features.FirewallApi;
 import org.jclouds.googlecomputeengine.options.FirewallOptions;
+import org.jclouds.logging.Logger;
+import org.jclouds.ssh.SshKeyPairGenerator;
 
 import com.google.common.base.Predicate;
+import com.google.common.base.Strings;
 import com.google.common.cache.LoadingCache;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
@@ -58,7 +62,7 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 
 public final class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
-        org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet {
+      org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet {
 
    public static final String EXTERIOR_RANGE = "0.0.0.0/0";
    public static final String DEFAULT_INTERNAL_NETWORK_RANGE = "10.0.0.0/8";
@@ -67,67 +71,88 @@ public final class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
    private final LoadingCache<NetworkAndAddressRange, Network> networkMap;
    private final Predicate<AtomicReference<Operation>> operationDone;
    private final FirewallTagNamingConvention.Factory firewallTagNamingConvention;
-
-   @Inject CreateNodesWithGroupEncodedIntoNameThenAddToSet(
-           CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy,
-           ListNodesStrategy listNodesStrategy,
-           GroupNamingConvention.Factory namingConvention,
-           @Named(Constants.PROPERTY_USER_THREADS)
-           ListeningExecutorService userExecutor,
-           CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory
-                   customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
-           GoogleComputeEngineApi api,
-           Predicate<AtomicReference<Operation>> operationDone,
-           LoadingCache<NetworkAndAddressRange, Network> networkMap,
-           FirewallTagNamingConvention.Factory firewallTagNamingConvention) {
+   private final SshKeyPairGenerator keyGenerator;
+
+   @Resource
+   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+   protected Logger logger = Logger.NULL;
+
+   @Inject
+   CreateNodesWithGroupEncodedIntoNameThenAddToSet(
+         CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy,
+         ListNodesStrategy listNodesStrategy,
+         GroupNamingConvention.Factory namingConvention,
+         @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
+         CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
+         GoogleComputeEngineApi api, Predicate<AtomicReference<Operation>> operationDone,
+         LoadingCache<NetworkAndAddressRange, Network> networkMap,
+         FirewallTagNamingConvention.Factory firewallTagNamingConvention, SshKeyPairGenerator keyGenerator) {
       super(addNodeWithGroupStrategy, listNodesStrategy, namingConvention, userExecutor,
-              customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
+            customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
       this.api = api;
       this.operationDone = operationDone;
       this.networkMap = networkMap;
       this.firewallTagNamingConvention = firewallTagNamingConvention;
+      this.keyGenerator = keyGenerator;
    }
 
-   @Override // TODO: why synchronized?
-   public synchronized Map<?, ListenableFuture<Void>> execute(String group, int count,
-                                                              Template template,
-                                                              Set<NodeMetadata> goodNodes,
-                                                              Map<NodeMetadata, Exception> badNodes,
-                                                              Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
+   @Override
+   public Map<?, ListenableFuture<Void>> execute(String group, int count, Template template,
+         Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes,
+         Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
 
       String sharedResourceName = namingConvention.create().sharedNameForGroup(group);
       Template mutableTemplate = template.clone();
-      GoogleComputeEngineTemplateOptions templateOptions = GoogleComputeEngineTemplateOptions.class.cast(mutableTemplate
-              .getOptions());
+      GoogleComputeEngineTemplateOptions templateOptions = GoogleComputeEngineTemplateOptions.class
+            .cast(mutableTemplate.getOptions());
       assert template.getOptions().equals(templateOptions) : "options didn't clone properly";
 
-      // get or insert the network and insert a firewall with the users configuration
+      // get or insert the network and insert a firewall with the users
+      // configuration
       Network network = getOrCreateNetwork(templateOptions, sharedResourceName);
       getOrCreateFirewalls(templateOptions, network, firewallTagNamingConvention.get(group));
       templateOptions.network(network.selfLink());
       templateOptions.userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
 
+      // Configure the default credentials, if needed
+      if (templateOptions.autoCreateKeyPair() && Strings.isNullOrEmpty(templateOptions.getPublicKey())) {
+         logger.debug(">> creating default keypair...");
+         Map<String, String> defaultKeys = keyGenerator.get();
+         templateOptions.authorizePublicKey(defaultKeys.get("public"));
+         templateOptions.overrideLoginPrivateKey(defaultKeys.get("private"));
+      }
+
+      if (templateOptions.getRunScript() != null && templateOptions.getLoginPrivateKey() == null) {
+         logger.warn(">> A runScript has been configured but no SSH key has been provided."
+               + " Authentication will delegate to the ssh-agent");
+      }
+
       return super.execute(group, count, mutableTemplate, goodNodes, badNodes, customizationResponses);
    }
 
    /**
-    * Try and find a network either previously created by jclouds or user defined.
+    * Try and find a network either previously created by jclouds or user
+    * defined.
     */
    private Network getOrCreateNetwork(GoogleComputeEngineTemplateOptions templateOptions, String sharedResourceName) {
       String networkName = templateOptions.network() != null ? toName(templateOptions.network()) : sharedResourceName;
-      return networkMap.apply(NetworkAndAddressRange.create(networkName, DEFAULT_INTERNAL_NETWORK_RANGE, null));
+      return networkMap.getUnchecked(NetworkAndAddressRange.create(networkName, DEFAULT_INTERNAL_NETWORK_RANGE, null));
    }
 
    /**
-    * Ensures that a firewall exists for every inbound port that the instance requests.
+    * Ensures that a firewall exists for every inbound port that the instance
+    * requests.
     * <p>
-    * For each port, there must be a firewall with a name following the {@link FirewallTagNamingConvention},
-    * with a target tag also following the {@link FirewallTagNamingConvention}, which opens the requested port
-    * for all sources on both TCP and UDP protocols.
-    * @see org.jclouds.googlecomputeengine.features.FirewallApi#patch(String, org.jclouds.googlecomputeengine.options.FirewallOptions)
+    * For each port, there must be a firewall with a name following the
+    * {@link FirewallTagNamingConvention}, with a target tag also following the
+    * {@link FirewallTagNamingConvention}, which opens the requested port for
+    * all sources on both TCP and UDP protocols.
+    * 
+    * @see org.jclouds.googlecomputeengine.features.FirewallApi#patch(String,
+    *      org.jclouds.googlecomputeengine.options.FirewallOptions)
     */
    private void getOrCreateFirewalls(GoogleComputeEngineTemplateOptions templateOptions, Network network,
-                                     FirewallTagNamingConvention naming) {
+         FirewallTagNamingConvention naming) {
 
       FirewallApi firewallApi = api.firewalls();
       List<AtomicReference<Operation>> operations = Lists.newArrayList();
@@ -138,17 +163,11 @@ public final class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
          if (firewall == null) {
             List<String> ports = ImmutableList.of(String.valueOf(port));
             List<Rule> rules = ImmutableList.of(Rule.create("tcp", ports), Rule.create("udp", ports));
-            FirewallOptions firewallOptions = new FirewallOptions()
-                    .name(name)
-                    .network(network.selfLink())
-                    .allowedRules(rules)
-                    .sourceTags(templateOptions.getTags())
-                    .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE))
-                    .targetTags(ImmutableList.of(name));
+            FirewallOptions firewallOptions = new FirewallOptions().name(name).network(network.selfLink())
+                  .allowedRules(rules).sourceTags(templateOptions.getTags())
+                  .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE)).targetTags(ImmutableList.of(name));
             AtomicReference<Operation> operation = Atomics.newReference(firewallApi.createInNetwork(
-                    firewallOptions.name(),
-                    network.selfLink(),
-                    firewallOptions));
+                  firewallOptions.name(), network.selfLink(), firewallOptions));
             operations.add(operation);
          }
       }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d6d1e7dd/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/PopulateDefaultLoginCredentialsForImageStrategy.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/PopulateDefaultLoginCredentialsForImageStrategy.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/PopulateDefaultLoginCredentialsForImageStrategy.java
deleted file mode 100644
index 082d9ed..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/PopulateDefaultLoginCredentialsForImageStrategy.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
-
-import java.security.NoSuchAlgorithmException;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.TemplateBuilderSpec;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.ssh.internal.RsaSshKeyPairGenerator;
-
-import com.google.inject.Inject;
-
-@Singleton
-public class PopulateDefaultLoginCredentialsForImageStrategy implements
-        org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy {
-
-   private final TemplateBuilderSpec templateBuilder;
-   private final RsaSshKeyPairGenerator keyPairGenerator;
-   private String compoundKey;
-
-   @Inject
-   PopulateDefaultLoginCredentialsForImageStrategy(@Named(TEMPLATE) String templateSpec,
-                                                   RsaSshKeyPairGenerator keyPairGenerator)
-           throws NoSuchAlgorithmException {
-      this.templateBuilder = TemplateBuilderSpec.parse(checkNotNull(templateSpec, "template builder spec"));
-      checkNotNull(templateBuilder.getLoginUser(), "template builder spec must provide a loginUser");
-      this.keyPairGenerator = checkNotNull(keyPairGenerator, "keypair generator");
-   }
-
-   @PostConstruct
-   private void generateKeys() {
-      Map<String, String> keys = keyPairGenerator.get();
-      // as we need to store both the pubk and the pk, store them separated by : (base64 does not contain that char)
-      compoundKey = String.format("%s:%s", checkNotNull(keys.get("public"), "public key cannot be null"),
-              checkNotNull(keys.get("private"), "private key cannot be null"));
-   }
-
-   @Override
-   public LoginCredentials apply(Object image) {
-      return LoginCredentials.builder()
-              .authenticateSudo(templateBuilder.getAuthenticateSudo() != null ?
-                      templateBuilder.getAuthenticateSudo() : false)
-              .privateKey(compoundKey)
-              .user(templateBuilder.getLoginUser()).build();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d6d1e7dd/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
deleted file mode 100644
index a908910..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.options.RunScriptOptions;
-import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
-import org.jclouds.domain.LoginCredentials;
-
-import com.google.common.base.Function;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-/**
- * GCE needs the credentials to insert the node so the node credentials already take the Image credentials into account,
- * as such only overriding the TemplateOptions credentials is required.
- */
-@Singleton
-public class UseNodeCredentialsButOverrideFromTemplate extends PrioritizeCredentialsFromTemplate {
-
-
-   @Inject
-   public UseNodeCredentialsButOverrideFromTemplate(
-           Function<Template, LoginCredentials> credentialsFromImageOrTemplateOptions) {
-      super(credentialsFromImageOrTemplateOptions);
-   }
-
-   public LoginCredentials apply(Template template, LoginCredentials fromNode) {
-      RunScriptOptions options = checkNotNull(template.getOptions(), "template options are required");
-      LoginCredentials.Builder builder = LoginCredentials.builder(fromNode);
-      if (options.getLoginUser() != null)
-         builder.user(template.getOptions().getLoginUser());
-      if (options.getLoginPassword() != null)
-         builder.password(options.getLoginPassword());
-      if (options.getLoginPrivateKey() != null)
-         builder.privateKey(options.getLoginPrivateKey());
-      if (options.shouldAuthenticateSudo() != null && options.shouldAuthenticateSudo())
-         builder.authenticateSudo(true);
-      return builder.build();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/d6d1e7dd/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
index 7045821..839a344 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
@@ -166,7 +166,8 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
       ComputeService computeService = computeService();
 
       GoogleComputeEngineTemplateOptions options = computeService.templateOptions()
-            .as(GoogleComputeEngineTemplateOptions.class).tags(ImmutableSet.of("aTag")).blockUntilRunning(false);
+            .as(GoogleComputeEngineTemplateOptions.class).autoCreateKeyPair(false)
+            .tags(ImmutableSet.of("aTag")).blockUntilRunning(false);
 
       Template template = computeService.templateBuilder().options(options).build();
       NodeMetadata node = getOnlyElement(computeService.createNodesInGroup("test", 1, template));


[25/50] [abbrv] jclouds git commit: Enables working with .json key files, adding GoogleCredentialsFromJson

Posted by na...@apache.org.
Enables working with .json key files, adding GoogleCredentialsFromJson


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

Branch: refs/heads/master
Commit: 19c65d8f6f26a4ca1f76ccd39007c7985f6ccf1c
Parents: 079b4d9
Author: Daniel Broudy <br...@google.com>
Authored: Mon Jan 26 15:03:22 2015 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Feb 3 10:59:01 2015 +0100

----------------------------------------------------------------------
 .../googlecloud/GoogleCredentialsFromJson.java  | 63 ++++++++++++++++++++
 .../googlecloud/internal/TestProperties.java    | 23 +++++++
 .../GoogleComputeEngineServiceLiveTest.java     |  1 +
 .../BaseGoogleComputeEngineApiLiveTest.java     |  1 +
 4 files changed, 88 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/19c65d8f/common/googlecloud/src/main/java/org/jclouds/googlecloud/GoogleCredentialsFromJson.java
----------------------------------------------------------------------
diff --git a/common/googlecloud/src/main/java/org/jclouds/googlecloud/GoogleCredentialsFromJson.java b/common/googlecloud/src/main/java/org/jclouds/googlecloud/GoogleCredentialsFromJson.java
new file mode 100644
index 0000000..5100e1c
--- /dev/null
+++ b/common/googlecloud/src/main/java/org/jclouds/googlecloud/GoogleCredentialsFromJson.java
@@ -0,0 +1,63 @@
+/*
+ * 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.googlecloud;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.domain.Credentials;
+
+import com.google.common.base.Supplier;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
+/*
+ * Provides an easy way to pass in credentials using the json-key format.
+ * Just provide the path to the .json file and this extracts and sets identity
+ *  and credentials from the json.
+ */
+public class GoogleCredentialsFromJson implements Supplier<Credentials>{
+
+   private final String jsonKeyString;
+
+   public GoogleCredentialsFromJson(String jsonString){
+      checkNotNull(jsonString, "Google Credentials jsonString cannot be null");
+      jsonKeyString = jsonString;
+   }
+
+   /**
+    * Function for parsing JSON Key String from file downloaded from GCP developers console.
+    *
+    * @param jsonString - a String in JSON format containing service account credentials
+    *  as provided from the Google Developers Console
+    * @return Credentials object with Credentials.identity and Credentials.credential correctly set.
+    */
+   private static Credentials parseJsonKeyString(String jsonString) {
+      // Parse JsonFile to extract Service Account and PrivateKey.
+      final JsonObject json = new JsonParser().parse(jsonString).getAsJsonObject();
+      String client_email = json.get("client_email").toString().replace("\"", "");
+      // When reading the file it reads in \n in as
+      String private_key = json.get("private_key").toString().replace("\"", "").replace("\\n", "\n");
+
+      return new Credentials(client_email, // identity
+                             private_key); // credentials
+   }
+
+   @Override
+   public Credentials get() {
+      return parseJsonKeyString(jsonKeyString);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/19c65d8f/common/googlecloud/src/test/java/org/jclouds/googlecloud/internal/TestProperties.java
----------------------------------------------------------------------
diff --git a/common/googlecloud/src/test/java/org/jclouds/googlecloud/internal/TestProperties.java b/common/googlecloud/src/test/java/org/jclouds/googlecloud/internal/TestProperties.java
index 32ea5cc..91b2f48 100644
--- a/common/googlecloud/src/test/java/org/jclouds/googlecloud/internal/TestProperties.java
+++ b/common/googlecloud/src/test/java/org/jclouds/googlecloud/internal/TestProperties.java
@@ -24,8 +24,11 @@ import static org.jclouds.oauth.v2.config.CredentialType.P12_PRIVATE_KEY_CREDENT
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.charset.Charset;
 import java.util.Properties;
 
+import org.jclouds.domain.Credentials;
+import org.jclouds.googlecloud.GoogleCredentialsFromJson;
 import org.jclouds.oauth.v2.config.CredentialType;
 
 import com.google.common.base.Charsets;
@@ -80,6 +83,26 @@ public final class TestProperties {
       return credentialFromFile;
    }
 
+   /*
+    * Provides an easy way to pass in credentials using the json-key format.
+    * Just provide the path to the .json file as the system property test.google-cloud.json-key
+    * and this extracts and sets identity  and credentials from the json.
+    */
+   public static void setGoogleCredentialsFromJson(String provider) {
+      String key = "test.google-cloud.json-key";
+      if (System.getProperties().containsKey(key)) {
+         String val = System.getProperty(key);
+         try {
+            String fileContents = Files.toString(new File(val), Charset.defaultCharset());
+            Credentials creds = new GoogleCredentialsFromJson(fileContents).get();
+            System.setProperty("test." + provider + ".identity", creds.identity);
+            System.setProperty("test." + provider + ".credential", creds.credential);
+         } catch (IOException e) {
+            throw propagate(e);
+         }
+      }
+   }
+
    private TestProperties() {
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/19c65d8f/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
index 9d528cc..42c62f0 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
@@ -45,6 +45,7 @@ public class GoogleComputeEngineServiceLiveTest extends BaseComputeServiceLiveTe
    }
 
    @Override protected Properties setupProperties() {
+      TestProperties.setGoogleCredentialsFromJson(provider);
       return TestProperties.apply(provider, super.setupProperties());
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/19c65d8f/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
index 8378b22..714d76c 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
@@ -68,6 +68,7 @@ public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleCo
    }
 
    @Override protected Properties setupProperties() {
+      TestProperties.setGoogleCredentialsFromJson(provider);
       return TestProperties.apply(provider, super.setupProperties());
    }
 


[43/50] [abbrv] jclouds git commit: Image credentials and project improvements.

Posted by na...@apache.org.
Image credentials and project improvements.

JCLOUDS-870: Adds the missing projects to the default project list
JCLOUDS-861 & JCLOUDS-911: Improved the way image OSFamily is parsed and
configured the default username for each image type.


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

Branch: refs/heads/master
Commit: 012e1885e531c7f8f9b8223d5c2ecca9a34d1ea9
Parents: 3b6b73d
Author: Ignasi Barrera <na...@apache.org>
Authored: Thu Jun 11 13:02:54 2015 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Fri Jun 12 15:03:50 2015 +0200

----------------------------------------------------------------------
 providers/google-compute-engine/README.md       |  2 +-
 .../GoogleComputeEngineApiMetadata.java         |  4 +-
 ...GoogleComputeEngineServiceContextModule.java | 28 ++++++++
 .../GoogleComputeEngineImageToImage.java        | 41 ++++-------
 .../functions/ImageNameToOperatingSystem.java   | 65 ++++++++++++++++++
 ...gleComputeEngineTemplateBuilderLiveTest.java | 72 ++++++++++++++++++++
 .../GoogleComputeEngineImageToImageTest.java    |  8 +--
 .../ImageNameToOperatingSystemTest.java         | 52 ++++++++++++++
 8 files changed, 236 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/012e1885/providers/google-compute-engine/README.md
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/README.md b/providers/google-compute-engine/README.md
index e470698..aa88a7c 100644
--- a/providers/google-compute-engine/README.md
+++ b/providers/google-compute-engine/README.md
@@ -6,7 +6,7 @@ Authenticating into the instances:
 --------
 
 User:
-If no user is provided in GoogleComputeEngineTemplateOptions when launching an instance by default "root" is used.
+If no user is specified in the template options when launching instances, the default one will be used: "jclouds" for all instances, "core" for CoreOS images, and "Administrator" for Windows images.
 
 Credential:
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/012e1885/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApiMetadata.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApiMetadata.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApiMetadata.java
index ccd1d10..c2e632a 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApiMetadata.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApiMetadata.java
@@ -62,9 +62,9 @@ public class GoogleComputeEngineApiMetadata extends BaseHttpApiMetadata<GoogleCo
       properties.put(PROPERTY_SESSION_INTERVAL, 3600);
       properties.put(OPERATION_COMPLETE_INTERVAL, 500);
       properties.put(OPERATION_COMPLETE_TIMEOUT, 600000);
-      properties.put(TEMPLATE, "osFamily=DEBIAN,osVersionMatches=7\\..*,locationId=us-central1-a,loginUser=jclouds");
+      properties.put(TEMPLATE, "osFamily=DEBIAN,osVersionMatches=7\\..*,locationId=us-central1-a");
       properties.put(PROJECT_NAME, ""); // Defaulting to empty helps avoid temptation for optional inject!
-      properties.put(IMAGE_PROJECTS, "centos-cloud,debian-cloud,rhel-cloud,suse-cloud,opensuse-cloud,gce-nvme,coreos-cloud");
+      properties.put(IMAGE_PROJECTS, "centos-cloud,debian-cloud,rhel-cloud,suse-cloud,opensuse-cloud,gce-nvme,coreos-cloud,ubuntu-os-cloud,windows-cloud");
       return properties;
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/012e1885/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
index 311c51e..5c79e95 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
@@ -39,14 +39,18 @@ import org.jclouds.compute.ComputeServiceAdapter;
 import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
 import org.jclouds.compute.domain.Hardware;
 import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
 import org.jclouds.compute.extensions.ImageExtension;
 import org.jclouds.compute.extensions.SecurityGroupExtension;
 import org.jclouds.compute.options.TemplateOptions;
 import org.jclouds.domain.Location;
+import org.jclouds.domain.LoginCredentials;
 import org.jclouds.googlecomputeengine.compute.GoogleComputeEngineService;
 import org.jclouds.googlecomputeengine.compute.GoogleComputeEngineServiceAdapter;
 import org.jclouds.googlecomputeengine.compute.functions.FirewallTagNamingConvention;
 import org.jclouds.googlecomputeengine.compute.functions.GoogleComputeEngineImageToImage;
+import org.jclouds.googlecomputeengine.compute.functions.ImageNameToOperatingSystem;
 import org.jclouds.googlecomputeengine.compute.functions.InstanceToNodeMetadata;
 import org.jclouds.googlecomputeengine.compute.functions.MachineTypeToHardware;
 import org.jclouds.googlecomputeengine.compute.functions.OrphanedGroupsFromDeadNodes;
@@ -113,6 +117,9 @@ public final class GoogleComputeEngineServiceContextModule
 
       bind(new TypeLiteral<Predicate<String>>() {
       }).to(GroupIsEmpty.class);
+      
+      bind(new TypeLiteral<Function<String, OperatingSystem>>() {
+      }).to(ImageNameToOperatingSystem.class);
 
       bind(FirewallTagNamingConvention.Factory.class).in(Scopes.SINGLETON);
       bindHttpApi(binder(), Resources.class);
@@ -159,6 +166,27 @@ public final class GoogleComputeEngineServiceContextModule
          }
       }, seconds, SECONDS);
    }
+   
+   @Override
+   protected Map<OsFamily, LoginCredentials> osFamilyToCredentials(Injector injector) {
+      // GCE does not enable the 'root' account for ssh access by default, but it will create a privileged
+      // user when the SSH key is provided. Populate the map to use 'jclouds' as a default user.
+      ImmutableMap.Builder<OsFamily, LoginCredentials> builder = ImmutableMap.builder();
+      for (OsFamily family : OsFamily.values()) {
+         switch (family) {
+            case COREOS:
+               builder.put(family, LoginCredentials.builder().user("core").build());
+               break;
+            case WINDOWS:
+               builder.put(family, LoginCredentials.builder().user("Administrator").build());
+               break;
+            default:
+               builder.put(family, LoginCredentials.builder().user("jclouds").build());
+               break;
+         }
+      }
+      return builder.build();
+   }
 
    @Override protected Optional<ImageExtension> provideImageExtension(Injector i) {
       return Optional.absent();

http://git-wip-us.apache.org/repos/asf/jclouds/blob/012e1885/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImage.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImage.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImage.java
index 1700e3d..37079ba 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImage.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImage.java
@@ -16,25 +16,24 @@
  */
 package org.jclouds.googlecomputeengine.compute.functions;
 
-import static com.google.common.base.Joiner.on;
-import static com.google.common.collect.Iterables.getLast;
-import static com.google.common.collect.Iterables.limit;
-import static com.google.common.collect.Iterables.skip;
-import static org.jclouds.compute.domain.Image.Status;
-
-import java.util.List;
+import javax.inject.Inject;
 
+import org.jclouds.compute.domain.Image.Status;
 import org.jclouds.compute.domain.ImageBuilder;
 import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
 import org.jclouds.googlecomputeengine.domain.Deprecated.State;
 import org.jclouds.googlecomputeengine.domain.Image;
 
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
 
 public final class GoogleComputeEngineImageToImage implements Function<Image, org.jclouds.compute.domain.Image> {
+   private final Function<String, OperatingSystem> nameToOperatingSystem;
+   
+   @Inject GoogleComputeEngineImageToImage(Function<String, OperatingSystem> nameToOperatingSystem) {
+      this.nameToOperatingSystem = nameToOperatingSystem;
+   }
+
    @Override public org.jclouds.compute.domain.Image apply(Image image) {
       ImageBuilder builder = new ImageBuilder()
               .id(image.selfLink().toString())
@@ -52,25 +51,9 @@ public final class GoogleComputeEngineImageToImage implements Function<Image, or
          }
       }
 
-      List<String> splits = Lists.newArrayList(image.name().split("-"));
-      OperatingSystem.Builder osBuilder = defaultOperatingSystem(image);
-      if (splits == null || splits.size() == 0 || splits.size() < 3) {
-         return builder.operatingSystem(osBuilder.build()).build();
-      }
-
-      OsFamily family = OsFamily.fromValue(splits.get(0));
-      if (family != OsFamily.UNRECOGNIZED) {
-         osBuilder.family(family);
-      }
-
-      String version = on(".").join(limit(skip(splits, 1), splits.size() - 2));
-      osBuilder.version(version);
-
-      builder.version(getLast(splits));
-      return builder.operatingSystem(osBuilder.build()).build();
-   }
-
-   private OperatingSystem.Builder defaultOperatingSystem(Image image) {
-      return OperatingSystem.builder().family(OsFamily.LINUX).is64Bit(true).description(image.name());
+      builder.version(image.name().substring(image.name().lastIndexOf('-') + 1));
+      builder.operatingSystem(nameToOperatingSystem.apply(image.name()));
+      
+      return builder.build();
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/012e1885/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystem.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystem.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystem.java
new file mode 100644
index 0000000..7ecd89f
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystem.java
@@ -0,0 +1,65 @@
+/*
+ * 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.googlecomputeengine.compute.functions;
+
+import static com.google.common.base.Joiner.on;
+import static com.google.common.collect.Iterables.limit;
+import static com.google.common.collect.Iterables.skip;
+
+import java.util.List;
+
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+
+public class ImageNameToOperatingSystem implements Function<String, OperatingSystem> {
+
+   @Override public OperatingSystem apply(String input) {
+      // Remove the backport prefix before parsing the name
+      String name = input.contains("backports") ? input.substring(input.indexOf("backports-") + 10) : input;
+      
+      OperatingSystem.Builder builder = defaultOperatingSystem(name);
+      List<String> splits = Lists.newArrayList(name.split("-"));
+      if (splits == null || splits.size() == 0 || splits.size() < 3) {
+         return builder.build();
+      }
+
+      // GCE namings that don't match the OsFamily enum
+      String os = splits.get(0);
+      if ("opensuse".equals(os) || "sles".equals(os)) {
+         builder.family(OsFamily.SUSE);
+      } else {
+         OsFamily family = OsFamily.fromValue(os);
+         if (family != OsFamily.UNRECOGNIZED) {
+            builder.family(family);
+         }
+      }
+
+      // TODO: Improve the version parsing so it is more portable
+      String version = on(".").join(limit(skip(splits, 1), splits.size() - 2));
+      builder.version(version);
+
+      return builder.build();
+   }
+   
+   private OperatingSystem.Builder defaultOperatingSystem(String name) {
+      return OperatingSystem.builder().family(OsFamily.LINUX).is64Bit(true).description(name);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/012e1885/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineTemplateBuilderLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineTemplateBuilderLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineTemplateBuilderLiveTest.java
new file mode 100644
index 0000000..851b94d
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineTemplateBuilderLiveTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.googlecomputeengine.compute;
+
+import static com.google.common.base.Objects.firstNonNull;
+import static org.jclouds.compute.domain.OsFamily.COREOS;
+import static org.jclouds.compute.domain.OsFamily.DEBIAN;
+import static org.jclouds.compute.domain.OsFamily.WINDOWS;
+import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+@Test(groups = "live", testName = "GoogleComputeEngineTemplateBuilderLiveTest")
+public class GoogleComputeEngineTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
+
+   public GoogleComputeEngineTemplateBuilderLiveTest() {
+      provider = "google-compute-engine";
+   }
+   
+   @Test
+   @Override
+   public void testDefaultTemplateBuilder() throws IOException {
+      Template defaultTemplate = view.getComputeService().templateBuilder().build();
+      assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().equals("7.wheezy"));
+      assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
+      assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), DEBIAN);
+      assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
+   }
+   
+   @Test
+   public void testDefaultCredentials() {
+      Map<OsFamily, String> defaultUsernames = ImmutableMap.of(COREOS, "core", WINDOWS, "Administrator");
+      Set<? extends Image> images = view.getComputeService().listImages();
+      for (Image image : images) {
+         assertEquals(image.getDefaultCredentials().getUser(),
+               firstNonNull(defaultUsernames.get(image.getOperatingSystem().getFamily()), "jclouds"));
+      }
+   }
+   
+   @Override
+   protected Set<String> getIso3166Codes() {
+      return ImmutableSet.<String> of();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/012e1885/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImageTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImageTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImageTest.java
index 3a4765d..2dd99a3 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImageTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImageTest.java
@@ -34,7 +34,7 @@ import com.google.common.collect.ImmutableList;
 @Test(groups = "unit", testName = "GoogleComputeEngineImageToImageTest")
 public class GoogleComputeEngineImageToImageTest {
    public void testArbitraryImageName() {
-      GoogleComputeEngineImageToImage imageToImage = new GoogleComputeEngineImageToImage();
+      GoogleComputeEngineImageToImage imageToImage = new GoogleComputeEngineImageToImage(new ImageNameToOperatingSystem());
       Image image = image("arbitratyname", null);
       org.jclouds.compute.domain.Image transformed = imageToImage.apply(image);
       assertEquals(transformed.getName(), image.name());
@@ -44,7 +44,7 @@ public class GoogleComputeEngineImageToImageTest {
    }
 
    public void testWellFormedImageName() {
-      GoogleComputeEngineImageToImage imageToImage = new GoogleComputeEngineImageToImage();
+      GoogleComputeEngineImageToImage imageToImage = new GoogleComputeEngineImageToImage(new ImageNameToOperatingSystem());
       Image image = image("ubuntu-12-04-v123123", null);
       org.jclouds.compute.domain.Image transformed = imageToImage.apply(image);
       assertEquals(transformed.getName(), image.name());
@@ -55,7 +55,7 @@ public class GoogleComputeEngineImageToImageTest {
    }
 
    public void testDeleted(){
-      GoogleComputeEngineImageToImage imageToImage = new GoogleComputeEngineImageToImage();
+      GoogleComputeEngineImageToImage imageToImage = new GoogleComputeEngineImageToImage(new ImageNameToOperatingSystem());
       Deprecated deprecated =  Deprecated.create(
          State.DELETED, // state
          URI.create("http://baseurl/projects/centos-cloud/global/images/centos-6-2-v20120326test"), // replacement
@@ -73,7 +73,7 @@ public class GoogleComputeEngineImageToImageTest {
    }
 
    public void testDeprecated(){
-      GoogleComputeEngineImageToImage imageToImage = new GoogleComputeEngineImageToImage();
+      GoogleComputeEngineImageToImage imageToImage = new GoogleComputeEngineImageToImage(new ImageNameToOperatingSystem());
       Deprecated deprecated =  Deprecated.create(
          State.DEPRECATED, // state
          URI.create("http://baseurl/projects/centos-cloud/global/images/centos-6-2-v20120326test"), // replacement

http://git-wip-us.apache.org/repos/asf/jclouds/blob/012e1885/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystemTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystemTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystemTest.java
new file mode 100644
index 0000000..0d9e282
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystemTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.googlecomputeengine.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "ImageNameToOperatingSystemTest")
+public class ImageNameToOperatingSystemTest {
+   
+   private final ImageNameToOperatingSystem function = new ImageNameToOperatingSystem();
+   
+   public void testVersions() {
+      assertVersion("centos-6-v20150603", OsFamily.CENTOS, "6");
+      assertVersion("coreos-stable-681-0-0-v20150609", OsFamily.COREOS, "stable.681.0.0");
+      assertVersion("debian-7-wheezy-v20150603", OsFamily.DEBIAN, "7.wheezy");
+      assertVersion("backports-debian-7-wheezy-v20150603", OsFamily.DEBIAN, "7.wheezy");
+      assertVersion("nvme-backports-debian-7-wheezy-v20140904", OsFamily.DEBIAN, "7.wheezy");
+      assertVersion("opensuse-13-1-v20150515", OsFamily.SUSE, "13.1");
+      assertVersion("rhel-6-v20150603", OsFamily.RHEL, "6");
+      assertVersion("sles-11-sp3-v20150511", OsFamily.SUSE, "11.sp3");
+      assertVersion("sles-12-v20150511", OsFamily.SUSE, "12");
+      assertVersion("ubuntu-1204-precise-v20150316", OsFamily.UBUNTU, "1204.precise");
+      assertVersion("windows-server-2008-r2-dc-v20150511", OsFamily.WINDOWS, "server.2008.r2.dc");
+   }
+
+   private void assertVersion(String name, OsFamily family, String version) {
+      OperatingSystem result = function.apply(name);
+      assertEquals(result.getFamily(), family);
+      assertEquals(result.getVersion(), version);
+      assertTrue(result.is64Bit());
+   }
+   
+}


[38/50] [abbrv] jclouds git commit: Making tags Immutable

Posted by na...@apache.org.
Making tags Immutable


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

Branch: refs/heads/master
Commit: aa33619c92d1139c882c67d707470c5d32fe9c44
Parents: 465a62a
Author: Daniel Broudy <br...@google.com>
Authored: Wed May 20 16:36:35 2015 -0700
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue May 26 15:53:11 2015 +0200

----------------------------------------------------------------------
 .../GoogleComputeEngineServiceAdapter.java      | 24 ++++++++++++--------
 .../googlecomputeengine/domain/NewInstance.java |  6 ++---
 .../googlecomputeengine/domain/Tags.java        | 21 ++++++-----------
 .../features/InstanceApiLiveTest.java           |  5 ++--
 .../features/InstanceApiMockTest.java           |  3 ++-
 .../parse/ParseInstanceTest.java                |  2 +-
 6 files changed, 30 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa33619c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index 01654ec..bf45ed0 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -26,6 +26,7 @@ import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperti
 import static org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet.simplifyPorts;
 
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -56,6 +57,7 @@ import org.jclouds.googlecomputeengine.domain.MachineType;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.domain.Region;
+import org.jclouds.googlecomputeengine.domain.Tags;
 import org.jclouds.googlecomputeengine.domain.Zone;
 import org.jclouds.googlecomputeengine.features.InstanceApi;
 import org.jclouds.location.suppliers.all.JustProvider;
@@ -126,24 +128,26 @@ public final class GoogleComputeEngineServiceAdapter
       URI network = URI.create(networks.next());
       assert !networks.hasNext() : "Error: Options should specify only one network";
 
-      NewInstance newInstance = NewInstance.create(
-            name, // name
-            template.getHardware().getUri(), // machineType
-            network, // network
-            disks, // disks
-            group // description
-      );
-
       // Add tags from template
-      newInstance.tags().items().addAll(options.getTags());
+      ArrayList<String> tags = new ArrayList<String>(options.getTags());
 
       // Add tags for firewalls
       FirewallTagNamingConvention naming = firewallTagNamingConvention.get(group);
       List<String> ports = simplifyPorts(options.getInboundPorts());
       if (ports != null){
-         newInstance.tags().items().add(naming.name(ports));
+         tags.add(naming.name(ports));
       }
 
+      NewInstance newInstance = NewInstance.create(
+            name, // name
+            template.getHardware().getUri(), // machineType
+            network, // network
+            disks, // disks
+            group, // description
+            Tags.create(null, ImmutableList.copyOf(tags)) // tags
+      );
+
+
       // Add metadata from template and for ssh key and image id
       newInstance.metadata().putAll(options.getUserMetadata());
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa33619c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
index 57b22a8..f6b6f6d 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewInstance.java
@@ -77,10 +77,10 @@ public abstract class NewInstance {
 
    /** Convenience for creating a new instance with only a boot disk and minimal parameters. */
    public static NewInstance create(String name, URI machineType, URI network, URI sourceImage) {
-      return create(name, machineType, network, Arrays.asList(AttachDisk.newBootDisk(sourceImage)), null);
+      return create(name, machineType, network, Arrays.asList(AttachDisk.newBootDisk(sourceImage)), null, null);
    }
 
-   public static NewInstance create(String name, URI machineType, URI network, List<AttachDisk> disks, String description) {
+   public static NewInstance create(String name, URI machineType, URI network, List<AttachDisk> disks, @Nullable String description, @Nullable Tags tags) {
       checkArgument(disks.get(0).boot(), "disk 0 must be a boot disk! %s", disks);
       boolean foundBoot = false;
       for (AttachDisk disk : disks) {
@@ -90,7 +90,7 @@ public abstract class NewInstance {
          }
       }
       return create(name, machineType, null, ImmutableList.of(NetworkInterface.create(network)), ImmutableList.copyOf(disks),
-            description, Tags.create(), Metadata.create(), null, null);
+            description, tags != null ? tags : Tags.create(), Metadata.create(), null, null);
    }
 
    @SerializedNames({ "name", "machineType", "canIpForward", "networkInterfaces", "disks", "description", "tags", "metadata",

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa33619c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Tags.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Tags.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Tags.java
index 23c7228..2bd09fd 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Tags.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Tags.java
@@ -16,13 +16,11 @@
  */
 package org.jclouds.googlecomputeengine.domain;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
 
 import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
 
 /**
  * Tags for an instance or project, with their fingerprint. Each tag must be unique, must be 1-63 characters long, and
@@ -35,14 +33,8 @@ public abstract class Tags implements Cloneable {
    /** The fingerprint for the items - needed for updating them. */
    @Nullable public abstract String fingerprint();
 
-   /** Mutable list of tags. */
-   public abstract List<String> items();
-
-   /** Convenience method for chaining adds. */
-   public Tags add(String tag) {
-      items().add(tag);
-      return this;
-   }
+   /** Immutable list of tags. */
+   public abstract ImmutableList<String> items();
 
    public static Tags create() {
       return Tags.create(null, null);
@@ -53,14 +45,15 @@ public abstract class Tags implements Cloneable {
    }
 
    @SerializedNames({ "fingerprint", "items" })
-   static Tags create(String fingerprint, ArrayList<String> items) { // Dictates the type when created from json!
-      return new AutoValue_Tags(fingerprint, items != null ? items : new ArrayList<String>());
+   public static Tags create(String fingerprint, ImmutableList<String> items) { // Dictates the type when created from json!
+      ImmutableList<String> empty = ImmutableList.of();
+      return new AutoValue_Tags(fingerprint, items != null ? items : empty);
    }
 
    Tags() {
    }
 
    @Override public Tags clone() {
-      return Tags.create(fingerprint(), new ArrayList<String>(items()));
+      return Tags.create(fingerprint(), items());
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa33619c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index 4c74a3d..651c7d1 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -40,6 +40,7 @@ import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.AttachDisk;
 import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.Tags;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
 import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
 import org.testng.annotations.AfterClass;
@@ -93,9 +94,9 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
             getNetworkUrl(INSTANCE_NETWORK_NAME), // network
             Arrays.asList(AttachDisk.newBootDisk(imageUri),
                   AttachDisk.existingDisk(getDiskUrl(DISK_NAME))), // disks
-            "a description" // description
+            "a description", // description
+            Tags.create(null, ImmutableList.of("foo", "bar")) // tags
       );
-      instance.tags().items().addAll(Arrays.asList("foo", "bar"));
       instance.metadata().put("mykey", "myvalue");
 
       instance2 = NewInstance.create(

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa33619c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
index ee1b08d..7d1a72a 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
@@ -88,7 +88,8 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
             URI.create(url("/projects/party/zones/us-central1-a/machineTypes/n1-standard-1")), // machineType
             URI.create(url("/projects/party/global/networks/default")), // network
             Arrays.asList(AttachDisk.existingBootDisk(URI.create(url("/projects/party/zones/us-central1-a/disks/test")))),
-            "desc" // description
+            "desc", // description
+            null // tags
       );
 
       newInstance.metadata().put("aKey", "aValue");

http://git-wip-us.apache.org/repos/asf/jclouds/blob/aa33619c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
index bef2abe..aa71275 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
@@ -57,7 +57,7 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
             URI.create(baseUrl + "/party/zones/us-central1-a/instances/test-0"), // selfLink
             "test-0", // name
             "desc", // description
-            Tags.create("abcd").add("aTag").add("Group-port-42"), // tags
+            Tags.create("abcd", ImmutableList.of("aTag", "Group-port-42")), // tags
             URI.create(baseUrl + "/party/zones/us-central1-a/machineTypes/n1-standard-1"), // machineType
             Instance.Status.RUNNING, // status
             null, // statusMessage


[44/50] [abbrv] jclouds git commit: JCLOUDS-935. Move AttachDisk.InitializeParams to URI for diskType

Posted by na...@apache.org.
JCLOUDS-935. Move AttachDisk.InitializeParams to URI for diskType

Note that two tests are failing right now with or without this.


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

Branch: refs/heads/master
Commit: 6d850a8aee5bae14695988077ae1aa46dc406fed
Parents: 012e188
Author: Andrew Bayer <an...@gmail.com>
Authored: Thu Jun 11 14:07:24 2015 -0700
Committer: Andrew Bayer <an...@gmail.com>
Committed: Fri Jun 12 09:12:23 2015 -0700

----------------------------------------------------------------------
 .../jclouds/googlecomputeengine/domain/AttachDisk.java    |  4 ++--
 .../googlecomputeengine/features/InstanceApiMockTest.java |  2 +-
 .../googlecomputeengine/parse/ParseInstanceTest.java      | 10 ++++------
 .../src/test/resources/instance_attach_disk.json          |  2 +-
 .../src/test/resources/instance_get.json                  |  2 +-
 .../src/test/resources/instance_list.json                 |  2 +-
 6 files changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/6d850a8a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
index 6306715..198b815 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
@@ -37,14 +37,14 @@ public abstract class AttachDisk {
       /** The {@link org.jclouds.googlecomputeengine.domain.Image#selfLink() source image}. */
       public abstract URI sourceImage();
 
-      @Nullable public abstract String diskType();
+      @Nullable public abstract URI diskType();
 
       static InitializeParams create(URI sourceImage) {
          return create(null, null, sourceImage, null);
       }
 
       @SerializedNames({ "diskName", "diskSizeGb", "sourceImage", "diskType" })
-      public static InitializeParams create(String diskName, Long diskSizeGb, URI sourceImage, String diskType) {
+      public static InitializeParams create(String diskName, Long diskSizeGb, URI sourceImage, URI diskType) {
          return new AutoValue_AttachDisk_InitializeParams(diskName, diskSizeGb, sourceImage, diskType);
       }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6d850a8a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
index 2c19324..5cbc78f 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
@@ -195,7 +195,7 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
                                            "test", // diskName
                                            Long.parseLong("100", 10), // diskSizeGb
                                            URI.create(url("/projects/party/global/images/test")), // sourceImage
-                                           "pd-standard" // diskType
+                                           URI.create(url("/projects/party/zones/us-central1-a/diskTypes/pd-standard")) // diskType
                                            ), // initializeParams
                                      true, // autoDelete
                                      ImmutableList.of(url("/projects/suse-cloud/global/licenses/sles-12")), // licenses

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6d850a8a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
index aa71275..651de37 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
@@ -18,24 +18,22 @@ package org.jclouds.googlecomputeengine.parse;
 
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 
-import java.net.URI;
-
 import javax.ws.rs.Consumes;
+import java.net.URI;
 
+import com.google.common.collect.ImmutableList;
 import org.jclouds.googlecomputeengine.domain.AttachDisk;
 import org.jclouds.googlecomputeengine.domain.AttachDisk.DiskInterface;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
 import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface;
-import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
 import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
+import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
 import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.Tags;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableList;
-
 @Test(groups = "unit", testName = "ParseInstanceTest")
 public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance> {
 
@@ -81,7 +79,7 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
                         "test", // diskName
                         Long.parseLong("100", 10), // diskSizeGb
                         URI.create(baseUrl + "/party/global/images/test"), // sourceImage
-                        "pd-standard" // diskType
+                        URI.create(baseUrl + "/party/zones/us-central1-a/diskTypes/pd-standard") // diskType
                         ), // initializeParams
                   ImmutableList.of(baseUrl + "/suse-cloud/global/licenses/sles-12"), // licenses
                   DiskInterface.NVME // interface

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6d850a8a/providers/google-compute-engine/src/test/resources/instance_attach_disk.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_attach_disk.json b/providers/google-compute-engine/src/test/resources/instance_attach_disk.json
index 3738015..f7cb2cf 100644
--- a/providers/google-compute-engine/src/test/resources/instance_attach_disk.json
+++ b/providers/google-compute-engine/src/test/resources/instance_attach_disk.json
@@ -9,7 +9,7 @@
     "diskName": "test",
     "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
     "diskSizeGb": 100,
-    "diskType": "pd-standard"
+    "diskType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/diskTypes/pd-standard"
   },
   "licenses": [
     "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6d850a8a/providers/google-compute-engine/src/test/resources/instance_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_get.json b/providers/google-compute-engine/src/test/resources/instance_get.json
index afe7ae8..b2795b6 100644
--- a/providers/google-compute-engine/src/test/resources/instance_get.json
+++ b/providers/google-compute-engine/src/test/resources/instance_get.json
@@ -30,7 +30,7 @@
             "diskName": "test",
             "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
             "diskSizeGb": "100",
-            "diskType": "pd-standard"
+            "diskType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/diskTypes/pd-standard"
          },
          "licenses": [
             "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"

http://git-wip-us.apache.org/repos/asf/jclouds/blob/6d850a8a/providers/google-compute-engine/src/test/resources/instance_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_list.json b/providers/google-compute-engine/src/test/resources/instance_list.json
index ed277f3..ee31a1a 100644
--- a/providers/google-compute-engine/src/test/resources/instance_list.json
+++ b/providers/google-compute-engine/src/test/resources/instance_list.json
@@ -35,7 +35,7 @@
             "diskName": "test",
             "sourceImage": "https://www.googleapis.com/compute/v1/projects/party/global/images/test",
             "diskSizeGb": "100",
-            "diskType": "pd-standard"
+            "diskType": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/diskTypes/pd-standard"
           },
           "licenses": [
             "https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"


[15/50] [abbrv] jclouds git commit: added CreationTimestamp to HttpHealthCheck and TargetPool + refactor Warning

Posted by na...@apache.org.
added CreationTimestamp to HttpHealthCheck and TargetPool + refactor Warning


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

Branch: refs/heads/master
Commit: f81e44ceb2abab7ef44501e97464952624679811
Parents: dd5c4c5
Author: Daniel Broudy <br...@google.com>
Authored: Tue Dec 9 13:46:07 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Dec 15 22:38:53 2014 +0100

----------------------------------------------------------------------
 .../domain/HttpHealthCheck.java                 |  9 ++-
 .../domain/KeyValuePair.java                    | 37 +++++++++++
 .../googlecomputeengine/domain/Metadata.java    | 30 +++------
 .../googlecomputeengine/domain/Operation.java   | 33 ----------
 .../googlecomputeengine/domain/Route.java       | 27 ++------
 .../googlecomputeengine/domain/TargetPool.java  |  9 ++-
 .../googlecomputeengine/domain/Warning.java     | 40 ++++++++++++
 .../features/InstanceApi.java                   |  2 +-
 .../options/HttpHealthCheckCreationOptions.java | 10 +--
 .../options/RouteOptions.java                   | 16 +++++
 .../features/ForwardingRuleApiMockTest.java     | 10 +++
 .../features/InstanceApiLiveTest.java           | 23 ++++++-
 .../features/InstanceApiMockTest.java           |  2 +-
 .../parse/ParseHttpHealthCheckListTest.java     |  2 +
 .../parse/ParseHttpHealthCheckTest.java         | 15 +++--
 .../parse/ParseOperationTest.java               |  8 +--
 .../parse/ParseRouteListTest.java               |  3 +-
 .../parse/ParseRouteTest.java                   |  7 +-
 .../parse/ParseTargetPoolTest.java              |  1 +
 .../src/test/resources/httphealthcheck_get.json | 17 +++--
 .../test/resources/httphealthcheck_list.json    | 67 +++++++++++---------
 21 files changed, 229 insertions(+), 139 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
index 00553f7..0e3d955 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
@@ -17,6 +17,7 @@
 package org.jclouds.googlecomputeengine.domain;
 
 import java.net.URI;
+import java.util.Date;
 
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
@@ -30,6 +31,8 @@ public abstract class HttpHealthCheck {
 
    public abstract URI selfLink();
 
+   public abstract Date creationTimestamp();
+
    public abstract String name();
 
    @Nullable public abstract String description();
@@ -58,12 +61,12 @@ public abstract class HttpHealthCheck {
    @Nullable public abstract Integer healthyThreshold();
 
    @SerializedNames(
-         { "id", "selfLink", "name", "description", "host", "requestPath", "port", "checkIntervalSec", "timeoutSec",
+         { "id", "selfLink", "creationTimestamp", "name", "description", "host", "requestPath", "port", "checkIntervalSec", "timeoutSec",
                "unhealthyThreshold", "healthyThreshold" })
-   public static HttpHealthCheck create(String id, URI selfLink, String name, String description, String host,
+   public static HttpHealthCheck create(String id, URI selfLink, Date creationTimestamp, String name, String description, String host,
          String requestPath, Integer port, Integer checkIntervalSec, Integer timeoutSec, Integer unhealthyThreshold,
          Integer healthyThreshold) {
-      return new AutoValue_HttpHealthCheck(id, selfLink, name, description, host,
+      return new AutoValue_HttpHealthCheck(id, selfLink, creationTimestamp, name, description, host,
             requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold);
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/KeyValuePair.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/KeyValuePair.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/KeyValuePair.java
new file mode 100644
index 0000000..823b55e
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/KeyValuePair.java
@@ -0,0 +1,37 @@
+/*
+ * 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.googlecomputeengine.domain;
+
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class KeyValuePair {
+
+   public abstract String key();
+
+   public abstract String value();
+
+   @SerializedNames({ "key", "value" })
+   public static KeyValuePair create(String key, String value) {
+      return new AutoValue_KeyValuePair(key, value);
+   }
+
+   KeyValuePair(){
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
index 60b8abd..b512cbe 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
@@ -33,25 +33,13 @@ import com.google.auto.value.AutoValue;
 @AutoValue
 public abstract class Metadata implements Cloneable {
 
-   @AutoValue
-   public abstract static class Entry {
-      abstract String key();
-
-      abstract String value();
-
-      @SerializedNames({ "key", "value" })
-      public static Entry create(String key, String value) {
-         return new AutoValue_Metadata_Entry(key, value);
-      }
-   }
-
    /** The fingerprint for the items - needed for updating them. */
    @Nullable public abstract String fingerprint();
 
    /** Adds or replaces a metadata entry. */
    public Metadata put(String key, String value) {
       remove(key);
-      items().add(Entry.create(key, value));
+      items().add(KeyValuePair.create(key, value));
       return this;
    }
 
@@ -77,9 +65,9 @@ public abstract class Metadata implements Cloneable {
    /** Copies the metadata into a new mutable map. */
    public Map<String, String> asMap() {
       Map<String, String> result = new LinkedHashMap<String, String>();
-      ArrayList<Entry> items = items();
+      ArrayList<KeyValuePair> items = items();
       for (int i = 0, length = items.size(); i < length; i++) {
-         Entry item = items.get(i);
+         KeyValuePair item = items.get(i);
          result.put(item.key(), item.value());
       }
       return result;
@@ -87,9 +75,9 @@ public abstract class Metadata implements Cloneable {
 
    /** Returns the value with the supplied key, or null. */
    @Nullable public String get(String key) {
-      ArrayList<Entry> items = items();
+      ArrayList<KeyValuePair> items = items();
       for (int i = 0, length = items.size(); i < length; i++) {
-         Entry item = items.get(i);
+         KeyValuePair item = items.get(i);
          if (item.key().equals(key)) {
             return item.value();
          }
@@ -106,7 +94,7 @@ public abstract class Metadata implements Cloneable {
    }
 
    /** Mutable list of metadata. */
-   abstract ArrayList<Entry> items();
+   abstract ArrayList<KeyValuePair> items();
 
    public static Metadata create() {
       return Metadata.create(null, null);
@@ -117,14 +105,14 @@ public abstract class Metadata implements Cloneable {
    }
 
    @SerializedNames({ "fingerprint", "items" })
-   static Metadata create(String fingerprint, ArrayList<Entry> items) { // Dictates the type when created from json!
-      return new AutoValue_Metadata(fingerprint, items != null ? items : new ArrayList<Entry>());
+   static Metadata create(String fingerprint, ArrayList<KeyValuePair> items) { // Dictates the type when created from json!
+      return new AutoValue_Metadata(fingerprint, items != null ? items : new ArrayList<KeyValuePair>());
    }
 
    Metadata() {
    }
 
    @Override public Metadata clone() {
-      return Metadata.create(fingerprint(), new ArrayList<Entry>(items()));
+      return Metadata.create(fingerprint(), new ArrayList<KeyValuePair>(items()));
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
index 0c99535..b36dc64 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
-import org.jclouds.googlecomputeengine.domain.Metadata.Entry;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.json.SerializedNames;
 
@@ -68,38 +67,6 @@ public abstract class Operation {
       }
    }
 
-   @AutoValue
-   public abstract static class Warning {
-
-      // TODO: combine this with Metadata.Entry
-      @AutoValue
-      public abstract static class Entry {
-         abstract String key();
-
-         abstract String value();
-
-         @SerializedNames({ "key", "value" })
-         public static Entry create(String key, String value) {
-            return new AutoValue_Operation_Warning_Entry(key, value);
-         }
-
-         Entry(){
-         }
-      }
-
-      public abstract String code();
-      @Nullable public abstract String message();
-      public abstract List<Entry> data();
-
-      @SerializedNames({"code", "message", "data"})
-      public static Warning create(String code, String message, List<Entry> data){
-         return new AutoValue_Operation_Warning(code, message, data);
-      }
-
-      Warning() {
-      }
-   }
-
    public static enum Status {
       PENDING,
       RUNNING,

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
index ed0737e..a99d0fd 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
@@ -30,24 +30,6 @@ import com.google.auto.value.AutoValue;
 @AutoValue
 public abstract class Route {
 
-   @AutoValue
-   public abstract static class Warning {
-      public abstract String code(); // TODO: enum
-
-      // TODO: create common Warning resource.
-      @Nullable public abstract String message();
-
-      public abstract List<Metadata.Entry> data();
-
-      @SerializedNames({ "code", "message", "data" })
-      public static Warning create(String code, String message, List<Metadata.Entry> data) {
-         return new AutoValue_Route_Warning(code, message, copyOf(data));
-      }
-
-      Warning() {
-      }
-   }
-
    public abstract String id();
 
    public abstract Date creationTimestamp();
@@ -88,14 +70,17 @@ public abstract class Route {
    /** Potential misconfigurations are detected for this route. */
    public abstract List<Warning> warnings();
 
+   /** The URL to a VpnTunnel that should handle matching packets. */
+   @Nullable public abstract URI nextHopVpnTunnel();
+
    @SerializedNames(
          { "id", "creationTimestamp", "selfLink", "name", "description", "network", "tags", "destRange", "priority", "nextHopInstance",
-               "nextHopIp", "nextHopNetwork", "nextHopGateway", "warnings" })
+               "nextHopIp", "nextHopNetwork", "nextHopGateway", "warnings", "nextHopVpnTunnel" })
    public static Route create(String id, Date creationTimestamp, URI selfLink, String name, String description, URI network, List<String> tags,
          String destRange, int priority, URI nextHopInstance, String nextHopIp, URI nextHopNetwork, URI nextHopGateway,
-         List<Warning> warnings) {
+         List<Warning> warnings, URI nextHopVpnTunnel) {
       return new AutoValue_Route(id, creationTimestamp, selfLink, name, description, network, copyOf(tags), destRange, priority,
-            nextHopInstance, nextHopIp, nextHopNetwork, nextHopGateway, copyOf(warnings));
+            nextHopInstance, nextHopIp, nextHopNetwork, nextHopGateway, copyOf(warnings), nextHopVpnTunnel);
    }
 
    Route() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
index ee7fe7b..4fa447b 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
@@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.domain;
 import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
 
 import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
@@ -34,6 +35,8 @@ public abstract class TargetPool {
 
    public abstract URI selfLink();
 
+   public abstract Date creationTimestamp();
+
    public abstract String name();
 
    @Nullable public abstract String description();
@@ -83,12 +86,12 @@ public abstract class TargetPool {
     */
    @Nullable public abstract URI backupPool();
 
-   @SerializedNames({ "id", "selfLink", "name", "description", "region", "healthChecks", "instances", "sessionAffinity",
+   @SerializedNames({ "id", "selfLink", "creationTimestamp", "name", "description", "region", "healthChecks", "instances", "sessionAffinity",
          "failoverRatio", "backupPool" })
-   public static TargetPool create(String id, URI selfLink, String name, String description, URI region,
+   public static TargetPool create(String id, URI selfLink, Date creationTimestamp, String name, String description, URI region,
          List<URI> healthChecks, List<URI> instances, SessionAffinityValue sessionAffinity, Float failoverRatio,
          URI backupPool) {
-      return new AutoValue_TargetPool(id, selfLink, name, description, region, copyOf(healthChecks), copyOf(instances),
+      return new AutoValue_TargetPool(id, selfLink, creationTimestamp, name, description, region, copyOf(healthChecks), copyOf(instances),
             sessionAffinity, failoverRatio, backupPool);
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Warning.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Warning.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Warning.java
new file mode 100644
index 0000000..ec2f4b9
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Warning.java
@@ -0,0 +1,40 @@
+/*
+ * 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.googlecomputeengine.domain;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class Warning {
+
+   public abstract String code();
+   @Nullable public abstract String message();
+   public abstract List<KeyValuePair> data();
+
+   @SerializedNames({"code", "message", "data"})
+   public static Warning create(String code, String message, List<KeyValuePair> data){
+      return new AutoValue_Warning(code, message, data);
+   }
+
+   Warning() {
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
index 7097191..03e690b 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
@@ -119,7 +119,7 @@ public interface InstanceApi {
     *         you, and look for the status field.
     */
    @Named("Instances:deleteAccessConfig")
-   @DELETE
+   @POST
    @Path("/{instance}/deleteAccessConfig")
    Operation deleteAccessConfigFromNic(@PathParam("instance") String instance,
                                        @QueryParam("accessConfig") String accessConfigName,

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
index a7af465..1e49f2b 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
@@ -34,11 +34,11 @@ public abstract class HttpHealthCheckCreationOptions {
    @Nullable public abstract String description();
 
    static final String DEFAULT_REQUEST_PATH = "/";
-   static final Integer DEFAULT_PORT = 80;
-   static final Integer DEFAULT_CHECK_INTERVAL_SEC = 5;
-   static final Integer DEFAULT_TIMEOUT_SEC = 5;
-   static final Integer DEFAULT_UNHEALTHY_THRESHOLD = 2;
-   static final Integer DEFAULT_HEALTHY_THRESHOLD = 2;
+   static final int DEFAULT_PORT = 80;
+   static final int DEFAULT_CHECK_INTERVAL_SEC = 5;
+   static final int DEFAULT_TIMEOUT_SEC = 5;
+   static final int DEFAULT_UNHEALTHY_THRESHOLD = 2;
+   static final int DEFAULT_HEALTHY_THRESHOLD = 2;
 
    /*
     * Currently GCE is not setting the advertised defaults so we do so here.

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
index 98f3f03..6661fcd 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
@@ -37,6 +37,7 @@ public class RouteOptions {
    private URI nextHopGateway;
    private String description;
    private Integer priority;
+   private URI nextHopVpnTunnel;
 
    private ImmutableList.Builder<String> tags = ImmutableList.builder();
 
@@ -116,6 +117,14 @@ public class RouteOptions {
    }
 
    /**
+    * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopVpnTunnel()
+    */
+   public RouteOptions nextHopVpnTunnel(URI nextHopVpnTunnel){
+      this.nextHopVpnTunnel = nextHopVpnTunnel;
+      return this;
+   }
+
+   /**
     * @see org.jclouds.googlecomputeengine.domain.Route#getNetwork()
     */
    public RouteOptions network(URI network) {
@@ -176,6 +185,13 @@ public class RouteOptions {
    }
 
    /**
+    * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopVpnTunnel()
+    */
+   public URI getNextHopVpnTunnel() {
+      return nextHopVpnTunnel;
+   }
+
+   /**
     * @see org.jclouds.googlecomputeengine.domain.Route#getTags()
     */
    public List<String> getTags() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
index f66a141..8c90711 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
@@ -98,6 +98,16 @@ public class ForwardingRuleApiMockTest extends BaseGoogleComputeEngineApiMockTes
             stringFromResource("/forwardingrule_set_target.json"));
    }
 
+   public void setTarget_partialUrl() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      URI newTarget = URI.create("projects/project-id/regions/region/targetPools/target-pool");
+      assertEquals(forwardingRuleApi().setTarget("testForwardingRule", newTarget), new ParseRegionOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/regions/us-central1/forwardingRules/testForwardingRule/setTarget",
+            "{\"target\":\"projects/project-id/regions/region/targetPools/target-pool\"}");
+   }
+
    ForwardingRuleApi forwardingRuleApi() {
       return api().forwardingRulesInRegion("us-central1");
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index bcff586..9add978 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -32,8 +32,10 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
+import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig.Type;
 import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
 import org.jclouds.googlecomputeengine.domain.Instance.SerialPortOutput;
+import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
 import org.jclouds.googlecomputeengine.domain.Metadata;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.AttachDisk;
@@ -123,6 +125,24 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertInstance")
+   public void testAddAccessConfig() {
+      AccessConfig config = AccessConfig.create("test-config", Type.ONE_TO_ONE_NAT, null);
+      assertOperationDoneSuccessfully(api().addAccessConfigToNic(INSTANCE_NAME, config, "nic0"));
+      Instance instance = api().get(INSTANCE_NAME);
+      assertNotNull(instance);
+      assertEquals(instance.networkInterfaces().get(0).accessConfigs().get(0).name(), "test-config");
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testAddAccessConfig")
+   public void testDeleteAccessConfig() {
+      Instance instance = api().get(INSTANCE_NAME);
+      assertOperationDoneSuccessfully(api().deleteAccessConfigFromNic(INSTANCE_NAME, "test-config", "nic0"));
+      instance = api().get(INSTANCE_NAME);
+      assertNotNull(instance);
+      assertTrue(instance.networkInterfaces().get(0).accessConfigs().isEmpty());
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testInsertInstance")
    public void testGetSerialPortOutput() {
       SerialPortOutput output = api().getSerialPortOutput(INSTANCE_NAME);
       assertNotNull(output);
@@ -258,7 +278,8 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertOperationDoneSuccessfully(api().reset(INSTANCE_NAME));
    }
 
-   @Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling", "testGetInstance", "testGetSerialPortOutput"}, alwaysRun = true)
+   @Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling",
+         "testGetInstance", "testGetSerialPortOutput", "testDeleteAccessConfig"}, alwaysRun = true)
    public void testDeleteInstance() {
       assertOperationDoneSuccessfully(api().delete(INSTANCE_NAME));
       assertOperationDoneSuccessfully(diskApi().delete(DISK_NAME));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
index 50e7426..db3f6eb 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
@@ -119,7 +119,7 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       assertEquals(instanceApi().deleteAccessConfigFromNic("test-instance", "test-access", "test-network"),
             new ParseZoneOperationTest().expected(url("/projects")));
 
-      assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/instances/test-instance/"
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-instance/"
             + "deleteAccessConfig?accessConfig=test-access&networkInterface=test-network");
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
index 687f10f..360bc2b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java
@@ -50,6 +50,7 @@ public class ParseHttpHealthCheckListTest extends BaseGoogleComputeEngineParseTe
             "1035854271083519643", // id
             URI.create(baseUrl + "/party-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check"),
             // selfLink
+            parse("2014-01-08T14:38:29.363-08:00"),
             "myname-andrea-kmzmi1bh-http-health-check", // name
             null, // description
             null, // host
@@ -64,6 +65,7 @@ public class ParseHttpHealthCheckListTest extends BaseGoogleComputeEngineParseTe
             "7006563292274658743", // id
             URI.create(baseUrl + "/party-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check"),
             // selfLink
+            parse("2014-01-08T14:48:03.276-08:00"), // creationTimestamp
             "myname-andrea-zk7gadwq-http-health-check", // name
             null, // description
             null, // host

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
index 62138b5..2e655f7 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java
@@ -44,15 +44,16 @@ public class ParseHttpHealthCheckTest extends BaseGoogleComputeEngineParseTest<H
       return HttpHealthCheck.create( //
             "2761502483700014319", // id
             URI.create(baseUrl + "/party-gce/global/httpHealthChecks/http-health-check-api-live-test"), // selfLink
+            parse("2014-01-14T05:55:54.910-08:00"), // creationTimestamp
             "http-health-check-api-live-test", // name
-            null, // description
+            "Test Health Check", // description
             null, // host
-            null, // requestPath
-            null,  // port
-            null,  // checkIntervalSec
-            null,  // timeoutSec
-            null,  // unhealthyThreshold
-            null // healthyThreshold
+            "/", // requestPath
+            80,  // port
+            5,  // checkIntervalSec
+            5,  // timeoutSec
+            2,  // unhealthyThreshold
+            2 // healthyThreshold
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
index 2e24e0c..8d138a9 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
@@ -22,8 +22,9 @@ import java.net.URI;
 
 import javax.ws.rs.Consumes;
 
+import org.jclouds.googlecomputeengine.domain.KeyValuePair;
 import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.domain.Operation.Warning;
+import org.jclouds.googlecomputeengine.domain.Warning;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
 import org.testng.annotations.Test;
 
@@ -68,9 +69,8 @@ public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operati
                         "Invalid value for field 'resource.urlMaps': "
                         + "'projects/party/global/urlMaps/target-http-proxy-api-live-test-url-map-2'."
                         + " Resource was not found."))), // errors
-            ImmutableList.of(Warning
-                  .create("NO_RESULTS_ON_PAGE", "This is an example warning",
-                  ImmutableList.of(Warning.Entry
+            ImmutableList.of(Warning.create("NO_RESULTS_ON_PAGE", "This is an example warning",
+                  ImmutableList.of(KeyValuePair
                         .create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))), // warnings
             URI.create(baseUrl + "/party/regions/us-central1"), // region
             URI.create(baseUrl + "/party/zones/us-central1-a") // zone

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
index 5aac869..e447e4e 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
@@ -59,7 +59,8 @@ public class ParseRouteListTest extends BaseGoogleComputeEngineParseTest<ListPag
             null, // nextHopIp
             null, // nextHopNetwork
             URI.create(baseUrl + "/party/global/gateways/default-internet-gateway"), // nextHopGateway
-            null // warnings
+            null, // warnings
+            null // nextHopVpnTunnel
       );
       return ForwardingListPage.create( //
             ImmutableList.of(route1, route2), // items

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
index 22ab3a5..4f952c1 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
@@ -22,9 +22,9 @@ import java.net.URI;
 
 import javax.ws.rs.Consumes;
 
-import org.jclouds.googlecomputeengine.domain.Metadata;
+import org.jclouds.googlecomputeengine.domain.KeyValuePair;
 import org.jclouds.googlecomputeengine.domain.Route;
-import org.jclouds.googlecomputeengine.domain.Route.Warning;
+import org.jclouds.googlecomputeengine.domain.Warning;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
 import org.testng.annotations.Test;
 
@@ -60,7 +60,8 @@ public class ParseRouteTest extends BaseGoogleComputeEngineParseTest<Route> {
             URI.create(baseUrl + "/party/global/networks/default"), // nextHopNetwork
             null, // nextHopGateway
             ImmutableList.of(Warning.create("NO_RESULTS_ON_PAGE", "This is an example warning", ImmutableList.of(
-                  Metadata.Entry.create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))) // warnings
+                  KeyValuePair.create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))), // warnings
+            null // nextHopVpnTunnel
       );
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
index efa2ee9..febd33c 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java
@@ -44,6 +44,7 @@ public class ParseTargetPoolTest extends BaseGoogleComputeEngineParseTest<Target
       return TargetPool.create( //
             "5199309593612841404", // id
             URI.create(baseUrl + "/party/regions/us-central1/targetPools/test-targetpool"), // selfLink
+            parse("2014-01-07T05:25:27.783-08:00"), // creationTimestamp
             "test-targetpool", // name
             null, // description
             URI.create(baseUrl + "/party/regions/us-central1"), // region

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/resources/httphealthcheck_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/httphealthcheck_get.json b/providers/google-compute-engine/src/test/resources/httphealthcheck_get.json
index 37f09d8..fc3007d 100644
--- a/providers/google-compute-engine/src/test/resources/httphealthcheck_get.json
+++ b/providers/google-compute-engine/src/test/resources/httphealthcheck_get.json
@@ -1,7 +1,14 @@
 {
-    "kind": "compute#httpHealthCheck",
-    "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks/http-health-check-api-live-test",
-    "id": "2761502483700014319",
-    "creationTimestamp": "2014-01-14T05:55:54.910-08:00",
-    "name": "http-health-check-api-live-test"
+  "kind": "compute#httpHealthCheck",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks/http-health-check-api-live-test",
+  "id": "2761502483700014319",
+  "creationTimestamp": "2014-01-14T05:55:54.910-08:00",
+  "name": "http-health-check-api-live-test",
+  "description": "Test Health Check",
+  "requestPath": "/",
+  "port": 80,
+  "checkIntervalSec": 5,
+  "timeoutSec": 5,
+  "unhealthyThreshold": 2,
+  "healthyThreshold": 2
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f81e44ce/providers/google-compute-engine/src/test/resources/httphealthcheck_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/httphealthcheck_list.json b/providers/google-compute-engine/src/test/resources/httphealthcheck_list.json
index cc74e80..45aaeb1 100644
--- a/providers/google-compute-engine/src/test/resources/httphealthcheck_list.json
+++ b/providers/google-compute-engine/src/test/resources/httphealthcheck_list.json
@@ -1,32 +1,39 @@
 {
-    "kind": "compute#httpHealthCheckList",
-    "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks",
-    "id": "projects/party-gce/global/httpHealthChecks",
-    "items": [
-        {
-            "kind": "compute#httpHealthCheck",
-            "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks/http-health-check-api-live-test",
-            "id": "2761502483700014319",
-            "creationTimestamp": "2014-01-14T05:55:54.910-08:00",
-            "name": "http-health-check-api-live-test"
-        },
-        {
-            "kind": "compute#httpHealthCheck",
-            "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check",
-            "id": "1035854271083519643",
-            "creationTimestamp": "2014-01-08T14:38:29.363-08:00",
-            "name": "myname-andrea-kmzmi1bh-http-health-check",
-            "timeoutSec": 5,
-            "unhealthyThreshold": 2
-        },
-        {
-            "kind": "compute#httpHealthCheck",
-            "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check",
-            "id": "7006563292274658743",
-            "creationTimestamp": "2014-01-08T14:48:03.276-08:00",
-            "name": "myname-andrea-zk7gadwq-http-health-check",
-            "timeoutSec": 5,
-            "unhealthyThreshold": 2
-        }
-    ]
+  "kind": "compute#httpHealthCheckList",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks",
+  "id": "projects/party-gce/global/httpHealthChecks",
+  "items": [
+    {
+      "kind": "compute#httpHealthCheck",
+      "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks/http-health-check-api-live-test",
+      "id": "2761502483700014319",
+      "creationTimestamp": "2014-01-14T05:55:54.910-08:00",
+      "name": "http-health-check-api-live-test",
+      "description": "Test Health Check",
+      "requestPath": "/",
+      "port": 80,
+      "checkIntervalSec": 5,
+      "timeoutSec": 5,
+      "unhealthyThreshold": 2,
+      "healthyThreshold": 2
+    },
+    {
+      "kind": "compute#httpHealthCheck",
+      "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check",
+      "id": "1035854271083519643",
+      "creationTimestamp": "2014-01-08T14:38:29.363-08:00",
+      "name": "myname-andrea-kmzmi1bh-http-health-check",
+      "timeoutSec": 5,
+      "unhealthyThreshold": 2
+    },
+    {
+      "kind": "compute#httpHealthCheck",
+      "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check",
+      "id": "7006563292274658743",
+      "creationTimestamp": "2014-01-08T14:48:03.276-08:00",
+      "name": "myname-andrea-zk7gadwq-http-health-check",
+      "timeoutSec": 5,
+      "unhealthyThreshold": 2
+    }
+  ]
 }
\ No newline at end of file


[05/50] [abbrv] jclouds git commit: Added TargetInstanceApi

Posted by na...@apache.org.
Added TargetInstanceApi


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

Branch: refs/heads/master
Commit: 2ccf08962e764dc777574757c333fb3d4b70ce23
Parents: 81d410a
Author: Daniel Broudy <br...@google.com>
Authored: Thu Nov 20 19:02:14 2014 -0800
Committer: Adrian Cole <ac...@twitter.com>
Committed: Wed Nov 26 17:44:46 2014 -0800

----------------------------------------------------------------------
 .../GoogleComputeEngineApi.java                 |   6 +
 .../domain/NewTargetInstance.java               |  72 +++++++++++
 .../domain/TargetInstance.java                  |  48 +++++++
 .../features/AggregatedListApi.java             |  51 ++++++++
 .../features/TargetInstanceApi.java             | 129 +++++++++++++++++++
 .../features/AggregatedListApiLiveTest.java     |  18 +++
 .../features/AggregatedListApiMockTest.java     |  20 +++
 .../features/TargetInstanceApiLiveTest.java     |  77 +++++++++++
 .../features/TargetInstanceApiMockTest.java     | 101 +++++++++++++++
 .../parse/ParseTargetInstanceListTest.java      |  60 +++++++++
 .../parse/ParseTargetInstanceTest.java          |  51 ++++++++
 .../aggregated_target_instance_list.json        | 128 ++++++++++++++++++
 .../aggregated_target_instance_list_empty.json  |  55 ++++++++
 .../src/test/resources/target_instance_get.json |  11 ++
 .../test/resources/target_instance_insert.json  |   6 +
 .../test/resources/target_instance_list.json    |  30 +++++
 16 files changed, 863 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
index 8a6e36c..14a3961 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
@@ -39,6 +39,7 @@ import org.jclouds.googlecomputeengine.features.ProjectApi;
 import org.jclouds.googlecomputeengine.features.RegionApi;
 import org.jclouds.googlecomputeengine.features.RouteApi;
 import org.jclouds.googlecomputeengine.features.SnapshotApi;
+import org.jclouds.googlecomputeengine.features.TargetInstanceApi;
 import org.jclouds.googlecomputeengine.features.TargetPoolApi;
 import org.jclouds.googlecomputeengine.features.TargetHttpProxyApi;
 import org.jclouds.googlecomputeengine.features.UrlMapApi;
@@ -137,6 +138,11 @@ public interface GoogleComputeEngineApi extends Closeable {
 
    @Delegate
    @Endpoint(CurrentProject.class)
+   @Path("/zones/{zone}")
+   TargetInstanceApi targetInstancesInZone(@PathParam("zone") String zone);
+
+   @Delegate
+   @Endpoint(CurrentProject.class)
    @Path("/regions/{region}")
    TargetPoolApi targetPoolsInRegion(@PathParam("region") String region);
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewTargetInstance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewTargetInstance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewTargetInstance.java
new file mode 100644
index 0000000..478bfce
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/NewTargetInstance.java
@@ -0,0 +1,72 @@
+/*
+ * 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.googlecomputeengine.domain;
+
+import java.net.URI;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class NewTargetInstance {
+
+   public abstract String name();
+   @Nullable public abstract String description();
+   @Nullable public abstract String natPolicy();
+   @Nullable public abstract URI instance();
+
+   @SerializedNames({"name", "description", "natPolicy", "instance"})
+   static NewTargetInstance create(String name, String description, String natPolicy, URI instance){
+      return new AutoValue_NewTargetInstance(name, description, natPolicy, instance);
+   }
+
+   NewTargetInstance() {
+   }
+
+   public static class Builder {
+      private String name;
+      private String description;
+      private String natPolicy;
+      private URI instance;
+
+      public Builder name(String name) {
+         this.name = name;
+         return this;
+      }
+
+      public Builder description(String description) {
+         this.description = description;
+         return this;
+      }
+
+      public Builder natPolicy(String natPolicy) {
+         this.natPolicy = natPolicy;
+         return this;
+      }
+
+      public Builder instance(URI instance) {
+         this.instance = instance;
+         return this;
+      }
+
+      public NewTargetInstance build() {
+         return NewTargetInstance.create(name, description, natPolicy, instance);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetInstance.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetInstance.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetInstance.java
new file mode 100644
index 0000000..656bc8f
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetInstance.java
@@ -0,0 +1,48 @@
+/*
+ * 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.googlecomputeengine.domain;
+
+
+import java.net.URI;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class TargetInstance {
+
+   public abstract String creationTimestamp();
+   public abstract String name();
+   @Nullable public abstract String description();
+   public abstract URI zone();
+   public abstract String natPolicy();
+   @Nullable public abstract URI instance();
+   public abstract URI selfLink();
+
+   @SerializedNames({"creationTimestamp", "name", "description", "zone",
+      "natPolicy", "instance", "selfLink"})
+   public static TargetInstance create(String creationTimestamp, String name,
+         String description, URI zone, String natPolicy, URI instance, URI selfLink){
+      return new AutoValue_TargetInstance(creationTimestamp, name, description, zone,
+            natPolicy, instance, selfLink);
+   }
+
+   TargetInstance(){
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java
index de12f51..55ff6b2 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java
@@ -36,6 +36,7 @@ import org.jclouds.googlecomputeengine.domain.ForwardingRule;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.MachineType;
 import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.TargetInstance;
 import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
 import org.jclouds.googlecomputeengine.options.ListOptions;
 import org.jclouds.javax.annotation.Nullable;
@@ -396,4 +397,54 @@ public interface AggregatedListApi {
          };
       }
    }
+
+   /**
+    * Retrieves the list of TargetInstance resources available to the
+    * specified project. By default the list as a maximum size of 100, if no
+    * options are provided or ListOptions#getMaxResults() has not been set.
+    *
+    * @param pageToken
+    *           marks the beginning of the next list page
+    * @param listOptions
+    *           listing options
+    * @return a page of the list
+    */
+   @Named("TargetInstances:aggregatedList")
+   @GET
+   @Path("/targetInstances")
+   ListPage<TargetInstance> pageOfTargetInstances(@Nullable @QueryParam("pageToken") String pageToken,
+         ListOptions listOptions);
+
+   /** @see #pageOfTargetInstances(String, ListOptions) */
+   @Named("TargetInstances:aggregatedList")
+   @GET
+   @Path("/targetInstances")
+   @Transform(TargetInstancePages.class)
+   Iterator<ListPage<TargetInstance>> targetInstances();
+
+   /** @see #pageOfTargetInstances(String, ListOptions) */
+   @Named("TargetInstances:aggregatedList")
+   @GET
+   @Path("/targetInstances")
+   @Transform(TargetInstancePages.class)
+   Iterator<ListPage<TargetInstance>> targetInstances(ListOptions options);
+
+   static final class TargetInstancePages extends BaseToIteratorOfListPage<TargetInstance, TargetInstancePages> {
+      private final GoogleComputeEngineApi api;
+
+      @Inject
+      TargetInstancePages(GoogleComputeEngineApi api) {
+         this.api = api;
+      }
+
+      @Override
+      protected Function<String, ListPage<TargetInstance>> fetchNextPage(final ListOptions options) {
+            return new Function<String, ListPage<TargetInstance>>() {
+               @Override
+               public ListPage<TargetInstance> apply(String pageToken) {
+                  return api.aggregatedList().pageOfTargetInstances(pageToken, options);
+               }
+            };
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetInstanceApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetInstanceApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetInstanceApi.java
new file mode 100644
index 0000000..6d2c3cc
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetInstanceApi.java
@@ -0,0 +1,129 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+
+import java.util.Iterator;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.googlecloud.domain.ListPage;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecomputeengine.domain.NewTargetInstance;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.TargetInstance;
+import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPage;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.oauth.v2.filters.OAuthFilter;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SkipEncoding;
+import org.jclouds.rest.annotations.Transform;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.base.Function;
+
+@SkipEncoding({'/', '='})
+@RequestFilters(OAuthFilter.class)
+@Path("/targetInstances")
+@Consumes(APPLICATION_JSON)
+public interface TargetInstanceApi {
+
+   /** Returns a targetInstance by name or null if not found. */
+   @Named("TargetInstances:get")
+   @GET
+   @Path("/{targetInstance}")
+   @Fallback(NullOnNotFoundOr404.class)
+   @Nullable
+   TargetInstance get(@PathParam("targetInstance") String targetInstance);
+
+   /**
+    * Creates a instance resource in the specified project using the data included in the request.
+    *
+    * @param template the instance template
+    * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+    *         you, and look for the status field.
+    */
+   @Named("TargetInstances:insert")
+   @POST
+   @Produces(APPLICATION_JSON)
+   Operation create(@BinderParam(BindToJsonPayload.class) NewTargetInstance targetInstance);
+
+   /** Deletes a targetInstance by name and returns the operation in progress, or null if not found. */
+   @Named("TargetInstances:delete")
+   @DELETE
+   @Path("/{targetInstance}")
+   @Fallback(NullOnNotFoundOr404.class)
+   @Nullable
+   Operation delete(@PathParam("targetInstance") String targetInstance);
+
+   /**
+    * Retrieves the list of targetInstance resources available to the specified project.
+    * By default the list as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() has not
+    * been set.
+    *
+    * @param pageToken   marks the beginning of the next list page
+    * @param listOptions listing options
+    * @return a page of the list
+    */
+   @Named("TargetInstances:list")
+   @GET
+   ListPage<TargetInstance> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
+
+   /** @see #listPage(String, ListOptions) */
+   @Named("TargetInstances:list")
+   @GET
+   @Transform(TargetInstancePages.class)
+   Iterator<ListPage<TargetInstance>> list();
+
+   /** @see #listPage(String, ListOptions) */
+   @Named("TargetInstances:list")
+   @GET
+   @Transform(TargetInstancePages.class)
+   Iterator<ListPage<TargetInstance>> list(ListOptions options);
+
+   static final class TargetInstancePages extends BaseCallerArg0ToIteratorOfListPage<TargetInstance, TargetInstancePages> {
+
+      private final GoogleComputeEngineApi api;
+
+      @Inject TargetInstancePages(GoogleComputeEngineApi api) {
+         this.api = api;
+      }
+
+      @Override
+      protected Function<String, ListPage<TargetInstance>> fetchNextPage(final String zoneName, final ListOptions options) {
+         return new Function<String, ListPage<TargetInstance>>() {
+            @Override public ListPage<TargetInstance> apply(String pageToken) {
+               return api.targetInstancesInZone(zoneName).listPage(pageToken, options);
+            }
+         };
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
index e119872..c1e2f62 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
@@ -30,6 +30,7 @@ import org.jclouds.googlecomputeengine.domain.DiskType;
 import org.jclouds.googlecomputeengine.domain.ForwardingRule;
 import org.jclouds.googlecomputeengine.domain.MachineType;
 import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.TargetInstance;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
 import org.testng.SkipException;
 import org.testng.annotations.Test;
@@ -129,4 +130,21 @@ public class AggregatedListApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
       }
       assertEquals(count, 2);
    }
+
+   public void targetInstances() {
+      Iterator<ListPage<TargetInstance>> pageIterator = api().targetInstances(maxResults(1));
+      // make sure that in spite of having only one result per page we get at
+      // least two results
+      int count = 0;
+      for (; count < 2 && pageIterator.hasNext();) {
+         ListPage<TargetInstance> result = pageIterator.next();
+         if (!result.isEmpty()) {
+            count++;
+         }
+      }
+      if (count < 2) {
+         throw new SkipException("Not enough target instances");
+      }
+      assertEquals(count, 2);
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
index ea39619..a02ec07 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
@@ -164,4 +164,24 @@ public class AggregatedListApiMockTest extends BaseGoogleComputeEngineApiMockTes
 
       assertSent(server, "GET", "/projects/party/aggregated/forwardingRules");
    }
+
+   public void targetInstances() throws Exception {
+      server.enqueue(jsonResponse("/aggregated_target_instance_list.json"));
+
+      AggregatedListApi aggregatedList = api().aggregatedList();
+
+      assertTrue(aggregatedList.targetInstances().hasNext());
+
+      assertSent(server, "GET", "/projects/party/aggregated/targetInstances");
+   }
+
+   public void targetInstancesResponseIs4xx() throws Exception {
+      server.enqueue(jsonResponse("/aggregated_target_instance_list_empty.json"));
+
+      AggregatedListApi aggregatedList = api().aggregatedList();
+
+      assertFalse(aggregatedList.targetInstances().hasNext());
+
+      assertSent(server, "GET", "/projects/party/aggregated/targetInstances");
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetInstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetInstanceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetInstanceApiLiveTest.java
new file mode 100644
index 0000000..3b25b40
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetInstanceApiLiveTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.filter;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.googlecloud.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.NewTargetInstance;
+import org.jclouds.googlecomputeengine.domain.TargetInstance;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+
+
+public class TargetInstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
+
+   public static final String TARGET_INSTANCE_NAME = "test-target-instance-1";
+
+   @Test(groups = "live")
+   public void testInsertTargetInstance(){
+
+      NewTargetInstance newTargetInstance = new NewTargetInstance.Builder()
+         .name(TARGET_INSTANCE_NAME)
+         .description("A test Target Instance")
+         .build();
+
+      assertOperationDoneSuccessfully(api.targetInstancesInZone(DEFAULT_ZONE_NAME).create(newTargetInstance));
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testInsertTargetInstance")
+   public void testGetTargetInstance(){
+      TargetInstance targetInstance = api.targetInstancesInZone(DEFAULT_ZONE_NAME).get(TARGET_INSTANCE_NAME);
+
+      assertNotNull(targetInstance);
+      assertEquals(targetInstance.name(), TARGET_INSTANCE_NAME);
+      assertEquals(targetInstance.description(), "A test Target Instance");
+      assertEquals(targetInstance.zone(), getZoneUrl(DEFAULT_ZONE_NAME));
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testInsertTargetInstance", alwaysRun = true)
+   public void testListTargetInstance(){
+      ListPage<TargetInstance> targetInstances = api.targetInstancesInZone(DEFAULT_ZONE_NAME)
+            .list(filter("name eq " + TARGET_INSTANCE_NAME)).next();
+
+      assertEquals(targetInstances.size(), 1);
+      assertTargetInstanceEquals(Iterables.getOnlyElement(targetInstances));
+   }
+
+   @Test(groups = "live", dependsOnMethods = {"testListTargetInstance", "testGetTargetInstance"}, alwaysRun = true)
+   public void testDeleteTargetInstance(){
+      assertOperationDoneSuccessfully(api.targetInstancesInZone(DEFAULT_ZONE_NAME).delete(TARGET_INSTANCE_NAME));
+   }
+
+   private void assertTargetInstanceEquals(TargetInstance targetInstance){
+      assertNotNull(targetInstance);
+      assertEquals(targetInstance.name(), TARGET_INSTANCE_NAME);
+      assertEquals(targetInstance.description(), "A test Target Instance");
+      assertEquals(targetInstance.zone(), getZoneUrl(DEFAULT_ZONE_NAME));
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetInstanceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetInstanceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetInstanceApiMockTest.java
new file mode 100644
index 0000000..2bca642
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetInstanceApiMockTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+
+import java.net.URI;
+
+import org.jclouds.googlecomputeengine.domain.NewTargetInstance;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseTargetInstanceListTest;
+import org.jclouds.googlecomputeengine.parse.ParseTargetInstanceTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "TargetInstanceApiMockTest", singleThreaded = true)
+public class TargetInstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public static String TARGET_INSTANCE_NAME = "target-instance-1";
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/target_instance_get.json"));
+
+      assertEquals(targetInstanceApi().get(TARGET_INSTANCE_NAME),
+            new ParseTargetInstanceTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/targetInstances/" + TARGET_INSTANCE_NAME);
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(targetInstanceApi().get(TARGET_INSTANCE_NAME));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/targetInstances/" + TARGET_INSTANCE_NAME);
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      NewTargetInstance options = new NewTargetInstance.Builder()
+         .name("test-target-instance")
+         .description("This is a test")
+         .natPolicy("NO_NAT")
+         .instance(URI.create(url("/projects/party/zones/us-central1-a/instances/instance-1")))
+         .build();
+
+      assertEquals(targetInstanceApi().create(options),
+            new ParseOperationTest().expected(url("/projects")));
+
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/targetInstances",
+            stringFromResource("/target_instance_insert.json"));
+   }
+
+   public void testDeleteImageResponseIs2xx()  throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      assertEquals(targetInstanceApi().delete(TARGET_INSTANCE_NAME),
+            new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/targetInstances/" + TARGET_INSTANCE_NAME);
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(targetInstanceApi().delete(TARGET_INSTANCE_NAME));
+      assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/targetInstances/" + TARGET_INSTANCE_NAME);
+   }
+
+   public void list() throws InterruptedException {
+      server.enqueue(jsonResponse("/target_instance_list.json"));
+
+      assertEquals(targetInstanceApi().list().next(), new ParseTargetInstanceListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/targetInstances");
+   }
+
+   public void listEmpty() throws InterruptedException {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(targetInstanceApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/targetInstances");
+   }
+
+   TargetInstanceApi targetInstanceApi() {
+      return api().targetInstancesInZone("us-central1-a");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceListTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceListTest.java
new file mode 100644
index 0000000..4af9d4d
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceListTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.googlecomputeengine.parse;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+
+import org.jclouds.googlecloud.domain.ForwardingListPage;
+import org.jclouds.googlecloud.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.TargetInstance;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+@Test(groups = "unit", testName = "ParseTargetInstanceListTest")
+public class ParseTargetInstanceListTest extends BaseGoogleComputeEngineParseTest<ListPage<TargetInstance>> {
+
+   @Override
+   public String resource() {
+      return "/target_instance_list.json";
+   }
+
+   @Override @Consumes(APPLICATION_JSON)
+   public ListPage<TargetInstance> expected() {
+      return expected(BASE_URL);
+   }
+
+   public ListPage<TargetInstance> expected(String baseURL){
+      return ForwardingListPage.create( //
+            ImmutableList.of(new ParseTargetInstanceTest().expected(baseURL),
+                  TargetInstance.create("2014-11-20T17:35:17.268-08:00", // creationTimestamp
+                        "target-instance-2", // name
+                        null, // description
+                        URI.create(baseURL + "/party/zones/us-central1-a"), // zone
+                        "NO_NAT", // natPolicy
+                        URI.create(baseURL + "/party/zones/us-central1-a/instances/test-3"), // instance
+                        URI.create(baseURL + "/party/zones/us-central1-a/targetInstances/target-instance-2") // selfLink
+                        )), // items
+            null // nextPageToken
+      );
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceTest.java
new file mode 100644
index 0000000..deae9f4
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetInstanceTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.googlecomputeengine.parse;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+
+import org.jclouds.googlecomputeengine.domain.TargetInstance;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "ParseTargetInstanceTest")
+public class ParseTargetInstanceTest extends BaseGoogleComputeEngineParseTest<TargetInstance> {
+
+   @Override
+   public String resource() {
+      return "/target_instance_get.json";
+   }
+
+   @Override @Consumes(APPLICATION_JSON)
+   public TargetInstance expected() {
+      return expected(BASE_URL);
+   }
+
+   public TargetInstance expected(String baseUrl) {
+      return TargetInstance.create("2014-07-18T09:47:30.826-07:00", // creationTimestamp
+            "target-instance-1", // name
+            "A pretty cool target instance", // description
+            URI.create(baseUrl + "/party/zones/us-central1-a"), // zone
+            "NO_NAT", // natPolicy
+            URI.create(baseUrl + "/party/zones/us-central1-a/instances/test-0"), // instance
+            URI.create(baseUrl + "/party/zones/us-central1-a/targetInstances/target-instance-1")); //selfLink
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/resources/aggregated_target_instance_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/aggregated_target_instance_list.json b/providers/google-compute-engine/src/test/resources/aggregated_target_instance_list.json
new file mode 100644
index 0000000..e1e56b9
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/aggregated_target_instance_list.json
@@ -0,0 +1,128 @@
+{
+ "kind": "compute#targetInstanceAggregatedList",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/party/aggregated/targetInstances",
+ "id": "projects/party/aggregated/targetInstances",
+ "items": {
+  "zones/asia-east1-a": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'zones/asia-east1-a' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "zones/asia-east1-a"
+     }
+    ]
+   }
+  },
+  "zones/asia-east1-b": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'zones/asia-east1-b' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "zones/asia-east1-b"
+     }
+    ]
+   }
+  },
+  "zones/asia-east1-c": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'zones/asia-east1-c' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "zones/asia-east1-c"
+     }
+    ]
+   }
+  },
+  "zones/europe-west1-a": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'zones/europe-west1-a' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "zones/europe-west1-a"
+     }
+    ]
+   }
+  },
+  "zones/europe-west1-b": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'zones/europe-west1-b' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "zones/europe-west1-b"
+     }
+    ]
+   }
+  },
+  "zones/europe-west1-c": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'zones/europe-west1-c' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "zones/europe-west1-c"
+     }
+    ]
+   }
+  },
+  "zones/us-central1-a": {
+   "targetInstances": [
+    {
+
+     "kind": "compute#targetInstance",
+     "id": "3191835352771895826",
+     "creationTimestamp": "2014-11-24T10:42:45.135-08:00",
+     "name": "test-target-instance",
+     "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
+     "natPolicy": "NO_NAT",
+     "instance": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/instance-1",
+     "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/targetInstances/test-target-instance"
+    },
+    {
+
+     "kind": "compute#targetInstance",
+     "id": "7362436693678237415",
+     "creationTimestamp": "2014-11-20T17:35:17.268-08:00",
+     "name": "target-instance-1",
+     "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
+     "natPolicy": "NO_NAT",
+     "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/targetInstances/target-instance-1"
+    }
+   ]
+  },
+  "zones/us-central1-b": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'zones/us-central1-b' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "zones/us-central1-b"
+     }
+    ]
+   }
+  },
+  "zones/us-central1-f": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'zones/us-central1-f' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "zones/us-central1-f"
+     }
+    ]
+   }
+  }
+ }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/resources/aggregated_target_instance_list_empty.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/aggregated_target_instance_list_empty.json b/providers/google-compute-engine/src/test/resources/aggregated_target_instance_list_empty.json
new file mode 100644
index 0000000..e1a852c
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/aggregated_target_instance_list_empty.json
@@ -0,0 +1,55 @@
+{
+ "kind": "compute#addressAggregatedList",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/studied-point-720/aggregated/addresses",
+ "id": "projects/studied-point-720/aggregated/addresses",
+ "items": {
+  "regions/asia-east1": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'regions/asia-east1' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "regions/asia-east1"
+     }
+    ]
+   }
+  },
+  "regions/europe-west1": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'regions/europe-west1' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "regions/europe-west1"
+     }
+    ]
+   }
+  },
+  "regions/us-central1": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'regions/us-central1' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "regions/us-central1"
+     }
+    ]
+   }
+  },
+  "global": {
+   "warning": {
+    "code": "NO_RESULTS_ON_PAGE",
+    "message": "There are no results for scope 'global' on this page.",
+    "data": [
+     {
+      "key": "scope",
+      "value": "global"
+     }
+    ]
+   }
+  }
+ }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/resources/target_instance_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/target_instance_get.json b/providers/google-compute-engine/src/test/resources/target_instance_get.json
new file mode 100644
index 0000000..89607d8
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/target_instance_get.json
@@ -0,0 +1,11 @@
+{
+  "kind": "compute#targetInstance",
+  "id": 13050421646334304115,
+  "creationTimestamp": "2014-07-18T09:47:30.826-07:00",
+  "name": "target-instance-1",
+  "description": "A pretty cool target instance",
+  "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
+  "natPolicy": "NO_NAT",
+  "instance": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-0",
+  "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/targetInstances/target-instance-1"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/resources/target_instance_insert.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/target_instance_insert.json b/providers/google-compute-engine/src/test/resources/target_instance_insert.json
new file mode 100644
index 0000000..9e76ef8
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/target_instance_insert.json
@@ -0,0 +1,6 @@
+{
+ "name": "test-target-instance",
+ "description": "This is a test",
+ "natPolicy": "NO_NAT",
+ "instance": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/instance-1"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2ccf0896/providers/google-compute-engine/src/test/resources/target_instance_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/target_instance_list.json b/providers/google-compute-engine/src/test/resources/target_instance_list.json
new file mode 100644
index 0000000..7e5e2c2
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/target_instance_list.json
@@ -0,0 +1,30 @@
+{
+ "kind": "compute#targetInstanceList",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/studied-point-720/zones/us-central1-a/targetInstances",
+ "id": "projects/studied-point-720/zones/us-central1-a/targetInstances",
+ "items": [
+  {
+
+   "kind": "compute#targetInstance",
+   "id": "13050421646334304115",
+   "creationTimestamp": "2014-07-18T09:47:30.826-07:00",
+   "name": "target-instance-1",
+   "description": "A pretty cool target instance",
+   "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
+   "natPolicy": "NO_NAT",
+   "instance": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-0",
+   "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/targetInstances/target-instance-1"
+  },
+  {
+
+   "kind": "compute#targetInstance",
+   "id": "7362436693678237415",
+   "creationTimestamp": "2014-11-20T17:35:17.268-08:00",
+   "name": "target-instance-2",
+   "zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
+   "natPolicy": "NO_NAT",
+   "instance": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-3",
+   "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/targetInstances/target-instance-2"
+  }
+ ]
+}
\ No newline at end of file


[30/50] [abbrv] jclouds git commit: Updated ForwardingRuleCreationOptions to AutoValue + Builder

Posted by na...@apache.org.
Updated ForwardingRuleCreationOptions to AutoValue + Builder


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

Branch: refs/heads/master
Commit: ec52bdbfb90e1b0136e28b68501f669a40c54360
Parents: a26a721
Author: Daniel Broudy <br...@google.com>
Authored: Fri Jan 30 18:00:27 2015 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Feb 18 10:58:37 2015 +0100

----------------------------------------------------------------------
 .../binders/ForwardingRuleCreationBinder.java   |  14 +-
 .../options/ForwardingRuleCreationOptions.java  | 149 +++++++++----------
 .../ForwardingRuleCreationBinderTest.java       |   5 +-
 .../features/ForwardingRuleApiLiveTest.java     |   5 +-
 .../features/ForwardingRuleApiMockTest.java     |   4 +-
 .../GlobalForwardingRuleApiLiveTest.java        |  17 ++-
 .../GlobalForwardingRuleApiMockTest.java        |   4 +-
 .../features/TargetPoolApiLiveTest.java         |   5 +-
 8 files changed, 100 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/ec52bdbf/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinder.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinder.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinder.java
index 0b1f006..df0e6fc 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinder.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinder.java
@@ -45,8 +45,8 @@ public class ForwardingRuleCreationBinder extends BindToJsonPayload {
 
       /**
        * Values used to bind ForwardingRuleOptions to json request.
-       * Note: Two break convention of starting with lower case letters due to 
-       *       attributes on GCE starting with upper case letters. 
+       * Note: Two break convention of starting with lower case letters due to
+       *       attributes on GCE starting with upper case letters.
        */
       @SuppressWarnings("unused")
       private String name;
@@ -63,11 +63,11 @@ public class ForwardingRuleCreationBinder extends BindToJsonPayload {
 
       private ForwardingRuleCreationBinderHelper(String name, ForwardingRuleCreationOptions forwardingRuleCreationOptions){
          this.name = name;
-         this.description = forwardingRuleCreationOptions.getDescription();
-         this.IPAddress = forwardingRuleCreationOptions.getIPAddress();
-         this.IPProtocol = forwardingRuleCreationOptions.getIPProtocol();
-         this.portRange = forwardingRuleCreationOptions.getPortRange();
-         this.target = forwardingRuleCreationOptions.getTarget();
+         this.description = forwardingRuleCreationOptions.description();
+         this.IPAddress = forwardingRuleCreationOptions.ipAddress();
+         this.IPProtocol = forwardingRuleCreationOptions.ipProtocol();
+         this.portRange = forwardingRuleCreationOptions.portRange();
+         this.target = forwardingRuleCreationOptions.target();
       }
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/ec52bdbf/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleCreationOptions.java
index 1594cee..7391e83 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleCreationOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleCreationOptions.java
@@ -19,98 +19,91 @@ package org.jclouds.googlecomputeengine.options;
 import java.net.URI;
 
 import org.jclouds.googlecomputeengine.domain.ForwardingRule;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
 
 /**
  * Options for creating a Forwarding Rule
  */
-public class ForwardingRuleCreationOptions{
-
-   private String description;
-   private String ipAddress;
-   private ForwardingRule.IPProtocol ipProtocol;
-   private String portRange;
-   private URI target;
-   
-   /**
-    * An optional textual description of the TargetPool.
-    * @return description, provided by the client.
-    */
-   public String getDescription(){
-      return description;
-   }
+@AutoValue
+public abstract class ForwardingRuleCreationOptions{
 
-   /**
-    * The external IP address that this forwarding rule is serving on behalf of
-    * @return ipAddress
-    */
-   public String getIPAddress(){
-      return ipAddress;
-   }
+   @Nullable public abstract String description();
+   @Nullable public abstract String ipAddress();
+   @Nullable public abstract ForwardingRule.IPProtocol ipProtocol();
+   @Nullable public abstract String portRange();
+   @Nullable public abstract URI target();
 
-   /**
-    * The IP protocol to which this rule applies
-    * @return ipProtocol
-    */
-   public ForwardingRule.IPProtocol getIPProtocol(){
-      return ipProtocol;
-   }
 
-   /**
-    * If IPProtocol is TCP or UDP, packets addressed to ports in the specified range 
-    * will be forwarded to backend. By default, this is empty and all ports are allowed.
-    * @return portRange
-    */
-   public String getPortRange(){
-      return portRange;
+   @SerializedNames({"description", "ipAddress", "ipProtocol", "portRange", "target"})
+   static ForwardingRuleCreationOptions create(
+         String description, String ipAddress, ForwardingRule.IPProtocol ipProtocol,
+         String portRange, URI target){
+      return new AutoValue_ForwardingRuleCreationOptions(description, ipAddress, ipProtocol, portRange, target);
    }
 
-   /**
-    * The URL of the target resource to receive the matched traffic.
-    * The target resource must live in the same region as this forwarding rule.
-    * @return target
-    */
-   public URI getTarget(){
-      return target;
+   ForwardingRuleCreationOptions(){
    }
 
-   /**
-    * @see ForwardingRuleCreationOptions#getDescription()
-    */
-   public ForwardingRuleCreationOptions description(String description){
-      this.description = description;
-      return this;
-   }
+   public static class Builder {
 
-   /**
-    * @see ForwardingRuleCreationOptions#getIPAddress()
-    */
-   public ForwardingRuleCreationOptions ipAddress(String ipAddress){
-      this.ipAddress = ipAddress;
-      return this;
-   }
+      private String description;
+      private String ipAddress;
+      private ForwardingRule.IPProtocol ipProtocol;
+      private String portRange;
+      private URI target;
 
-   /**
-    * @see ForwardingRuleCreationOptions#getIPProtocol()
-    */
-   public ForwardingRuleCreationOptions ipProtocol(ForwardingRule.IPProtocol ipProtocol){
-      this.ipProtocol = ipProtocol;
-      return this;
-   }
+      /**
+       * An optional textual description of the TargetPool.
+       * @return description, provided by the client.
+       */
+      public Builder description(String description){
+         this.description = description;
+         return this;
+      }
 
-   /**
-    * @see ForwardingRuleCreationOptions#getPortRange()
-    */
-   public ForwardingRuleCreationOptions portRange(String portRange){
-      this.portRange = portRange;
-      return this;
-   }
+      /**
+       * The external IP address that this forwarding rule is serving on behalf of
+       * @return ipAddress
+       */
+      public Builder ipAddress(String ipAddress){
+         this.ipAddress = ipAddress;
+         return this;
+      }
 
-   /**
-    * @see ForwardingRuleCreationOptions#getTarget()
-    */
-   public ForwardingRuleCreationOptions target(URI target){
-      this.target = target;
-      return this;
-   }
+      /**
+       * The IP protocol to which this rule applies
+       * @return ipProtocol
+       */
+      public Builder ipProtocol(ForwardingRule.IPProtocol ipProtocol){
+         this.ipProtocol = ipProtocol;
+         return this;
+      }
 
+      /**
+       * If IPProtocol is TCP or UDP, packets addressed to ports in the specified range
+       * will be forwarded to backend. By default, this is empty and all ports are allowed.
+       * @return portRange
+       */
+      public Builder portRange(String portRange){
+         this.portRange = portRange;
+         return this;
+      }
+
+      /**
+       * The URL of the target resource to receive the matched traffic.
+       * The target resource must live in the same region as this forwarding rule.
+       * @return target
+       */
+      public Builder target(URI target){
+         this.target = target;
+         return this;
+      }
+
+      public ForwardingRuleCreationOptions build() {
+         return create(description, ipAddress, ipProtocol, portRange, target);
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/ec52bdbf/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinderTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinderTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinderTest.java
index d45a6c3..5190129 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinderTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/ForwardingRuleCreationBinderTest.java
@@ -45,12 +45,13 @@ public class ForwardingRuleCreationBinderTest extends BaseGoogleComputeEngineExp
    @Test
    public void testMap() throws SecurityException, NoSuchMethodException {
       ForwardingRuleCreationBinder binder = new ForwardingRuleCreationBinder(json);
-      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
+      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions.Builder()
                                                                   .description(DESCRIPTION)
                                                                   .ipAddress(IP_ADDRESS)
                                                                   .ipProtocol(ForwardingRule.IPProtocol.SCTP)
                                                                   .portRange(PORT_RANGE)
-                                                                  .target(TARGET);
+                                                                  .target(TARGET)
+                                                                  .build();
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
       Map<String, Object> postParams = ImmutableMap.of("name", "testForwardingRuleName", "options", forwardingRuleCreationOptions);

http://git-wip-us.apache.org/repos/asf/jclouds/blob/ec52bdbf/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
index 2f03623..625c958 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java
@@ -82,11 +82,12 @@ public class ForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
 
    @Test(groups = "live")
    public void testInsertForwardingRule() {
-      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
+      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions.Builder()
                                                                            .description(DESCRIPTION)
                                                                            .ipAddress(address.address())
                                                                            .ipProtocol(ForwardingRule.IPProtocol.TCP)
-                                                                           .target(targetPool.selfLink());
+                                                                           .target(targetPool.selfLink())
+                                                                           .build();
       assertOperationDoneSuccessfully(api().create(FORWARDING_RULE_NAME, forwardingRuleCreationOptions));
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/ec52bdbf/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
index 8c90711..7924e1b 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
@@ -50,8 +50,8 @@ public class ForwardingRuleApiMockTest extends BaseGoogleComputeEngineApiMockTes
    public void insert() throws Exception {
       server.enqueue(jsonResponse("/region_operation.json"));
 
-      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
-      .target(URI.create(url("/projects/party/regions/europe-west1/targetPools/test-target-pool")));
+      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions.Builder()
+      .target(URI.create(url("/projects/party/regions/europe-west1/targetPools/test-target-pool"))).build();
       assertEquals(forwardingRuleApi().create("test-forwarding-rule", forwardingRuleCreationOptions),
             new ParseRegionOperationTest().expected(url("/projects")));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/ec52bdbf/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
index 3aa012b..6245309 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiLiveTest.java
@@ -75,18 +75,19 @@ public class GlobalForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiL
                                                       getUrlMapUrl(GLOBAL_FORWARDING_RULE_URL_MAP_NAME)));
       assertOperationDoneSuccessfully(
             api().create(GLOBAL_FORWARDING_RULE_NAME,
-                         new ForwardingRuleCreationOptions().target(getTargetHttpProxyUrl(GLOBAL_FORWARDING_RULE_TARGET_HTTP_PROXY_NAME))
-                                                    .portRange(PORT_RANGE)));
+                         new ForwardingRuleCreationOptions.Builder().target(getTargetHttpProxyUrl(GLOBAL_FORWARDING_RULE_TARGET_HTTP_PROXY_NAME))
+                                                    .portRange(PORT_RANGE).build()));
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertGlobalForwardingRule")
    public void testGetGlobalForwardingRule() {
       ForwardingRule forwardingRule = api().get(GLOBAL_FORWARDING_RULE_NAME);
       assertNotNull(forwardingRule);
-      ForwardingRuleCreationOptions expected = new ForwardingRuleCreationOptions()
+      ForwardingRuleCreationOptions expected = new ForwardingRuleCreationOptions.Builder()
             .target(getTargetHttpProxyUrl(GLOBAL_FORWARDING_RULE_TARGET_HTTP_PROXY_NAME))
             .portRange("80-80")
-            .ipProtocol(IPProtocol.TCP);
+            .ipProtocol(IPProtocol.TCP)
+            .build();
       assertGlobalForwardingRuleEquals(forwardingRule, expected);
    }
 
@@ -127,10 +128,10 @@ public class GlobalForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiL
    }
 
    private void assertGlobalForwardingRuleEquals(ForwardingRule result, ForwardingRuleCreationOptions expected) {
-      assertEquals(result.target(), expected.getTarget());
-      assertEquals(result.ipProtocol(), expected.getIPProtocol());
-      assertEquals(result.description(), expected.getDescription());
-      assertEquals(result.portRange(), expected.getPortRange());
+      assertEquals(result.target(), expected.target());
+      assertEquals(result.ipProtocol(), expected.ipProtocol());
+      assertEquals(result.description(), expected.description());
+      assertEquals(result.portRange(), expected.portRange());
       assertTrue(result.ipAddress() != null);
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/ec52bdbf/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiMockTest.java
index 8c0d318..0656193 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalForwardingRuleApiMockTest.java
@@ -50,8 +50,8 @@ public class GlobalForwardingRuleApiMockTest extends BaseGoogleComputeEngineApiM
    public void insert() throws Exception {
       server.enqueue(jsonResponse("/region_operation.json"));
 
-      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
-      .target(URI.create(url("/projects/party/regions/europe-west1/targetPools/test-target-pool")));
+      ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions.Builder()
+      .target(URI.create(url("/projects/party/regions/europe-west1/targetPools/test-target-pool"))).build();
 
       assertEquals(globalForwardingRuleApi().create("test-forwarding-rule", forwardingRuleCreationOptions),
             new ParseRegionOperationTest().expected(url("/projects")));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/ec52bdbf/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
index c2423bc..b5957c2 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
@@ -115,10 +115,11 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       TargetPool targetPool = api().get(TARGETPOOL_NAME);
       URI target = targetPool.selfLink();
 
-      ForwardingRuleCreationOptions forwardingRuleOptions = new ForwardingRuleCreationOptions()
+      ForwardingRuleCreationOptions forwardingRuleOptions = new ForwardingRuleCreationOptions.Builder()
          .ipProtocol(IPProtocol.TCP)
          .portRange("80-80")
-         .target(target);
+         .target(target)
+         .build();
 
       assertOperationDoneSuccessfully(api.forwardingRulesInRegion(DEFAULT_REGION_NAME)
                .create(FORWARDING_RULE_NAME, forwardingRuleOptions));


[06/50] [abbrv] jclouds git commit: Upgrade to OkHttp 2.1.0

Posted by na...@apache.org.
Upgrade to OkHttp 2.1.0

Mockwebserver 2.1.0 does not bind the localhost address but
the public address. That makes the test to fail if we hardcode
the server URL to 'localhost'. The server.getUrl() method
should be used instead.


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

Branch: refs/heads/master
Commit: fca6022c23e05d220235581709f60e2ab04b1723
Parents: 2ccf089
Author: Ignasi Barrera <na...@apache.org>
Authored: Thu Nov 27 11:43:59 2014 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Thu Nov 27 11:43:59 2014 +0100

----------------------------------------------------------------------
 .../internal/BaseGoogleComputeEngineApiMockTest.java               | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/fca6022c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
index 1b06ad2..a9f4483 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
@@ -92,7 +92,7 @@ public class BaseGoogleComputeEngineApiMockTest {
    }
 
    protected String url(String path) {
-      return "http://localhost:" + server.getPort() + path;
+      return server.getUrl(path).toString();
    }
 
    @AfterMethod(alwaysRun = true)


[40/50] [abbrv] jclouds git commit: JCLOUDS-925: Add support to start and stop instances in the ComputeService

Posted by na...@apache.org.
JCLOUDS-925: Add support to start and stop instances in the ComputeService


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

Branch: refs/heads/master
Commit: 2e7ca20f1c2b93adb9e75af76cd30d801124707c
Parents: 55348c0
Author: Ignasi Barrera <na...@apache.org>
Authored: Wed May 27 10:58:26 2015 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Jun 8 16:17:03 2015 +0200

----------------------------------------------------------------------
 .../compute/GoogleComputeEngineService.java     |  30 +++++
 .../GoogleComputeEngineServiceAdapter.java      |   8 +-
 ...GoogleComputeEngineServiceContextModule.java |   6 +-
 .../compute/functions/Resources.java            |  14 ++-
 .../predicates/AllNodesInGroupTerminated.java   |  43 -------
 .../compute/predicates/GroupIsEmpty.java        |  42 +++++++
 .../GoogleComputeEngineServiceLiveTest.java     |  58 ++++-----
 .../GoogleComputeEngineServiceMockTest.java     |  13 +-
 .../OrphanedGroupsFromDeadNodesTest.java        |  66 +++++++---
 .../compute/functions/ResourcesMockTest.java    | 126 +++++++++++++++++++
 .../BaseGoogleComputeEngineApiMockTest.java     |   4 +-
 .../firewall_list.json                          |  36 ------
 .../network_get.json                            |  10 --
 .../test/resources/firewall_list_compute.json   |  36 ++++++
 .../src/test/resources/test                     |  27 ++++
 15 files changed, 362 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
index 241a91d..1dc337c 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
@@ -16,9 +16,12 @@
  */
 package org.jclouds.googlecomputeengine.compute;
 
+import static autovalue.shaded.com.google.common.common.collect.Sets.newHashSet;
+import static com.google.common.collect.Iterables.filter;
 import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
 import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
 import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
+import static org.jclouds.compute.predicates.NodePredicates.all;
 import static org.jclouds.googlecloud.internal.ListPages.concat;
 
 import java.util.Map;
@@ -62,6 +65,8 @@ import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.features.FirewallApi;
 import org.jclouds.scriptbuilder.functions.InitAdminAccess;
 
+import autovalue.shaded.com.google.common.common.collect.ImmutableSet;
+
 import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.base.Predicate;
@@ -119,6 +124,31 @@ public final class GoogleComputeEngineService extends BaseComputeService {
       this.api = api;
       this.operationDone = operationDone;
    }
+   
+   @Override
+   public void destroyNode(String id) {
+      // GCE does not return TERMINATED nodes, so in practice no node will never reach the TERMINATED
+      // state, and the deleted nodes will never be returned.
+      // In order to be able to clean up the resources associated to the deleted nodes, we have to retrieve
+      // the details of the nodes before deleting them.
+      NodeMetadata node = getNodeMetadata(id);
+      super.destroyNode(id);
+      cleanUpIncidentalResourcesOfDeadNodes(ImmutableSet.of(node));
+   }
+
+   @Override
+   public Set<? extends NodeMetadata> destroyNodesMatching(Predicate<NodeMetadata> filter) {
+      // GCE does not return TERMINATED nodes, so in practice no node will never reach the TERMINATED
+      // state, and the deleted nodes will never be returned.
+      // In order to be able to clean up the resources associated to the deleted nodes, we have to retrieve
+      // the details of the nodes before deleting them.
+      Set<? extends NodeMetadata> nodes = newHashSet(filter(listNodesDetailsMatching(all()), filter));
+      super.destroyNodesMatching(filter); // This returns an empty list (a list of null elements) in GCE, as the api does not return deleted nodes
+      cleanUpIncidentalResourcesOfDeadNodes(nodes);
+      return nodes;
+   }
+
+
 
    @Override
    protected synchronized void cleanUpIncidentalResourcesOfDeadNodes(Set<? extends NodeMetadata> deadNodes) {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index 2ab5c0f..7e3d74e 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -257,12 +257,12 @@ public final class GoogleComputeEngineServiceAdapter
       waitOperationDone(resources.resetInstance(URI.create(checkNotNull(selfLink, "id"))));
    }
 
-   @Override public void resumeNode(String name) {
-      throw new UnsupportedOperationException("resume is not supported by GCE");
+   @Override public void resumeNode(String selfLink) {
+      waitOperationDone(resources.startInstance(URI.create(checkNotNull(selfLink, "id"))));
    }
 
-   @Override  public void suspendNode(String name) {
-      throw new UnsupportedOperationException("suspend is not supported by GCE");
+   @Override public void suspendNode(String selfLink) {
+      waitOperationDone(resources.stopInstance(URI.create(checkNotNull(selfLink, "id"))));
    }
 
    private void waitOperationDone(Operation operation) {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
index b943c2c..311c51e 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
@@ -52,7 +52,7 @@ import org.jclouds.googlecomputeengine.compute.functions.MachineTypeToHardware;
 import org.jclouds.googlecomputeengine.compute.functions.OrphanedGroupsFromDeadNodes;
 import org.jclouds.googlecomputeengine.compute.functions.Resources;
 import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
-import org.jclouds.googlecomputeengine.compute.predicates.AllNodesInGroupTerminated;
+import org.jclouds.googlecomputeengine.compute.predicates.GroupIsEmpty;
 import org.jclouds.googlecomputeengine.compute.predicates.AtomicInstanceVisible;
 import org.jclouds.googlecomputeengine.compute.predicates.AtomicOperationDone;
 import org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
@@ -112,7 +112,7 @@ public final class GoogleComputeEngineServiceContextModule
       }).to(OrphanedGroupsFromDeadNodes.class);
 
       bind(new TypeLiteral<Predicate<String>>() {
-      }).to(AllNodesInGroupTerminated.class);
+      }).to(GroupIsEmpty.class);
 
       bind(FirewallTagNamingConvention.Factory.class).in(Scopes.SINGLETON);
       bindHttpApi(binder(), Resources.class);
@@ -175,7 +175,7 @@ public final class GoogleComputeEngineServiceContextModule
                      .put(Instance.Status.RUNNING, NodeMetadata.Status.RUNNING)
                      .put(Instance.Status.STOPPING, NodeMetadata.Status.PENDING)
                      .put(Instance.Status.STOPPED, NodeMetadata.Status.SUSPENDED)
-                     .put(Instance.Status.TERMINATED, NodeMetadata.Status.TERMINATED).build();
+                     .put(Instance.Status.TERMINATED, NodeMetadata.Status.SUSPENDED).build();
 
    @Provides Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus() {
       return toPortableNodeStatus;

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
index cc652b8..50154ba 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
@@ -63,9 +63,21 @@ public interface Resources {
    @DELETE
    @Fallback(NullOnNotFoundOr404.class) @Nullable Operation delete(@EndpointParam URI selfLink);
 
-   /** Hard-resets the instance by self-link and returns the operation in progres */
+   /** Hard-resets the instance by self-link and returns the operation in progress */
    @Named("Instances:reset")
    @POST
    @Path("/reset")
    Operation resetInstance(@EndpointParam URI selfLink);
+   
+   /** Starts the instance by self-link and returns the operation in progress */
+   @Named("Instances:start")
+   @POST
+   @Path("/start")
+   Operation startInstance(@EndpointParam URI selfLink);
+   
+   /** Stops the instance by self-link and returns the operation in progress */
+   @Named("Instances:stop")
+   @POST
+   @Path("/stop")
+   Operation stopInstance(@EndpointParam URI selfLink);
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AllNodesInGroupTerminated.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AllNodesInGroupTerminated.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AllNodesInGroupTerminated.java
deleted file mode 100644
index 7897907..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AllNodesInGroupTerminated.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.predicates;
-
-import static com.google.common.collect.Iterables.all;
-import static com.google.common.collect.Sets.filter;
-import static org.jclouds.compute.predicates.NodePredicates.TERMINATED;
-import static org.jclouds.compute.predicates.NodePredicates.all;
-import static org.jclouds.compute.predicates.NodePredicates.inGroup;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.ComputeService;
-
-import com.google.common.base.Predicate;
-
-public final class AllNodesInGroupTerminated implements Predicate<String> {
-
-   private final ComputeService computeService;
-
-   @Inject AllNodesInGroupTerminated(ComputeService computeService) {
-      this.computeService = computeService;
-   }
-
-
-   @Override public boolean apply(String groupName) {
-      return all(filter(computeService.listNodesDetailsMatching(all()), inGroup(groupName)), TERMINATED);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java
new file mode 100644
index 0000000..d80e888
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java
@@ -0,0 +1,42 @@
+/*
+ * 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.googlecomputeengine.compute.predicates;
+
+import static autovalue.shaded.com.google.common.common.collect.Iterables.isEmpty;
+import static com.google.common.collect.Sets.filter;
+import static org.jclouds.compute.predicates.NodePredicates.all;
+import static org.jclouds.compute.predicates.NodePredicates.inGroup;
+
+import javax.inject.Inject;
+
+import org.jclouds.compute.ComputeService;
+
+import com.google.common.base.Predicate;
+
+public final class GroupIsEmpty implements Predicate<String> {
+
+   private final ComputeService computeService;
+
+   @Inject GroupIsEmpty(ComputeService computeService) {
+      this.computeService = computeService;
+   }
+
+
+   @Override public boolean apply(String groupName) {
+      return isEmpty(filter(computeService.listNodesDetailsMatching(all()), inGroup(groupName)));
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
index 8c449b0..1801408 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
@@ -17,18 +17,21 @@
 package org.jclouds.googlecomputeengine.compute;
 
 import static com.google.common.collect.Iterables.contains;
+import static org.jclouds.util.Strings2.toStringAndClose;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 
 import java.util.Properties;
 import java.util.Set;
 
+import org.jclouds.compute.ComputeServiceContext;
 import org.jclouds.compute.domain.Hardware;
 import org.jclouds.compute.domain.NodeMetadata;
 import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
 import org.jclouds.googlecloud.internal.TestProperties;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.domain.MachineType;
+import org.jclouds.rest.AuthorizationException;
 import org.jclouds.sshj.config.SshjSshClientModule;
 import org.testng.annotations.Test;
 
@@ -71,43 +74,28 @@ public class GoogleComputeEngineServiceLiveTest extends BaseComputeServiceLiveTe
       assertTrue(node.getUserMetadata().keySet().containsAll(userMetadata.keySet()));
    }
 
-   // do not run until the auth exception problem is figured out.
-   @Test(enabled = false)
+   @Test(expectedExceptions = AuthorizationException.class)
    @Override
    public void testCorrectAuthException() throws Exception {
-   }
-
-   // reboot is not supported by GCE
-   @Test(enabled = true, dependsOnMethods = "testGet")
-   public void testReboot() throws Exception {
-   }
-
-   // suspend/Resume is not supported by GCE
-   @Test(enabled = true, dependsOnMethods = "testReboot")
-   public void testSuspendResume() throws Exception {
-   }
-
-   @Test(enabled = true, dependsOnMethods = "testSuspendResume")
-   public void testListNodesByIds() throws Exception {
-      super.testGetNodesWithDetails();
-   }
-
-   @Test(enabled = true, dependsOnMethods = "testSuspendResume")
-   @Override
-   public void testGetNodesWithDetails() throws Exception {
-      super.testGetNodesWithDetails();
-   }
-
-   @Test(enabled = true, dependsOnMethods = "testSuspendResume")
-   @Override
-   public void testListNodes() throws Exception {
-      super.testListNodes();
-   }
-
-   @Test(enabled = true, dependsOnMethods = {"testListNodes", "testGetNodesWithDetails", "testListNodesByIds"})
-   @Override
-   public void testDestroyNodes() {
-      super.testDestroyNodes();
+      ComputeServiceContext context = null;
+      try {
+         String credential = toStringAndClose(getClass().getResourceAsStream("/test"));
+         Properties overrides = setupProperties();
+         overrides.setProperty(provider + ".identity", "000000000000@developer.gserviceaccount.com");
+         overrides.setProperty(provider + ".credential", credential);
+         context = newBuilder()
+               .modules(ImmutableSet.of(getLoggingModule(), credentialStoreModule))
+               .overrides(overrides).build(ComputeServiceContext.class);
+         context.getComputeService().listNodes();
+      } catch (AuthorizationException e) {
+         throw e;
+      } catch (RuntimeException e) {
+         e.printStackTrace();
+         throw e;
+      } finally {
+         if (context != null)
+            context.close();
+      }
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
index 23a2b50..d9e53f9 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
@@ -18,7 +18,6 @@ package org.jclouds.googlecomputeengine.compute;
 
 import static com.google.common.collect.Iterables.getOnlyElement;
 import static org.jclouds.googlecomputeengine.domain.Instance.Status.RUNNING;
-import static org.jclouds.googlecomputeengine.domain.Instance.Status.TERMINATED;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
@@ -77,11 +76,12 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
       server.enqueue(instanceWithNetworkAndStatus("test-delete-1", "default", RUNNING));
       server.enqueue(singleRegionSingleZoneResponse());
       server.enqueue(jsonResponse("/aggregated_machinetype_list.json")); // Why are we getting machineTypes to delete an instance?
+      server.enqueue(instanceWithNetworkAndStatus("test-delete-1", "default", RUNNING));
       server.enqueue(jsonResponse("/operation.json")); // instance delete
       server.enqueue(jsonResponse("/zone_operation.json"));
-      server.enqueue(instanceWithNetworkAndStatus("test-delete-1", "default", TERMINATED));
-      server.enqueue(aggregatedListWithInstanceNetworkAndStatus("test-delete-1", "default", TERMINATED));
-      server.enqueue(jsonResponse("/GoogleComputeEngineServiceExpectTest/firewall_list.json"));
+      server.enqueue(response404()); // deleted instance no longer exists
+      server.enqueue(aggregatedListInstanceEmpty());
+      server.enqueue(jsonResponse("/firewall_list_compute.json"));
       server.enqueue(jsonResponse("/operation.json"));
       server.enqueue(jsonResponse("/zone_operation.json"));
 
@@ -91,6 +91,7 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
       assertSent(server, "GET", "/jclouds/zones/us-central1-a/instances/test-delete-1");
       assertSent(server, "GET", "/projects/party/regions");
       assertSent(server, "GET", "/projects/party/aggregated/machineTypes"); // Why are we getting machineTypes to delete an instance?
+      assertSent(server, "GET", "/jclouds/zones/us-central1-a/instances/test-delete-1");
       assertSent(server, "DELETE", "/jclouds/zones/us-central1-a/instances/test-delete-1"); // instance delete
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-delete-1"); // get instance
@@ -195,5 +196,9 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
             stringFromResource("/aggregated_instance_list.json").replace("test-0", instanceName)
                   .replace("default", networkName).replace("RUNNING", status.toString()));
    }
+   
+   private MockResponse aggregatedListInstanceEmpty() {
+      return new MockResponse().setBody(stringFromResource("/aggregated_instance_list_empty.json"));
+   }
 }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/OrphanedGroupsFromDeadNodesTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/OrphanedGroupsFromDeadNodesTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/OrphanedGroupsFromDeadNodesTest.java
index c15dacc..9ce0d6d 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/OrphanedGroupsFromDeadNodesTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/OrphanedGroupsFromDeadNodesTest.java
@@ -29,7 +29,7 @@ import org.jclouds.compute.ComputeService;
 import org.jclouds.compute.domain.ComputeMetadata;
 import org.jclouds.compute.domain.NodeMetadata;
 import org.jclouds.compute.domain.internal.NodeMetadataImpl;
-import org.jclouds.googlecomputeengine.compute.predicates.AllNodesInGroupTerminated;
+import org.jclouds.googlecomputeengine.compute.predicates.GroupIsEmpty;
 import org.testng.annotations.Test;
 
 import com.google.common.base.Predicate;
@@ -51,13 +51,13 @@ public class OrphanedGroupsFromDeadNodesTest {
 
 
    @Test
-   public void testDetectsAllOrphanedGroupsWhenAllNodesTerminated() {
+   public void testDetectsNoOrphanedGroupsWhenAllNodesArePresentAndTerminated() {
 
-      Set<NodeMetadata> deadNodesGroup1 = (Set) ImmutableSet.builder()
+      Set<NodeMetadata> deadNodesGroup1 = ImmutableSet.<NodeMetadata>builder()
               .add(new IdAndGroupOnlyNodeMetadata("a", "1", NodeMetadata.Status.TERMINATED)).build();
 
-      Set<NodeMetadata> deadNodesGroup2 = (Set) ImmutableSet.builder()
-              .add(new IdAndGroupOnlyNodeMetadata("b", "2", NodeMetadata.Status.TERMINATED)).build();
+      Set<NodeMetadata> deadNodesGroup2 = ImmutableSet.<NodeMetadata> builder()
+              .add(new IdAndGroupOnlyNodeMetadata("b", "2", NodeMetadata.Status.SUSPENDED)).build();
 
       Set<NodeMetadata> allDeadNodes = Sets.union(deadNodesGroup1, deadNodesGroup2);
 
@@ -74,18 +74,16 @@ public class OrphanedGroupsFromDeadNodesTest {
 
       Set<String> orphanedGroups = orphanedGroupsFromDeadNodes.apply(allDeadNodes);
 
-      assertSame(orphanedGroups.size(), 2);
-      assertTrue(orphanedGroups.contains("1"));
-      assertTrue(orphanedGroups.contains("2"));
+      assertTrue(orphanedGroups.isEmpty());
    }
 
    @Test
-   public void testDetectsAllOrphanedGroupsWhenSomeNodesTerminatedAndOtherMissing() {
+   public void testDetectsOneOrphanedGroupWhenSomeNodesTerminatedAndOtherMissing() {
 
-      Set<NodeMetadata> deadNodesGroup1 = (Set) ImmutableSet.builder()
+      Set<NodeMetadata> deadNodesGroup1 = ImmutableSet.<NodeMetadata> builder()
               .add(new IdAndGroupOnlyNodeMetadata("a", "1", NodeMetadata.Status.TERMINATED)).build();
 
-      Set<NodeMetadata> deadNodesGroup2 = (Set) ImmutableSet.builder()
+      Set<NodeMetadata> deadNodesGroup2 = ImmutableSet.<NodeMetadata> builder()
               .add(new IdAndGroupOnlyNodeMetadata("b", "2", NodeMetadata.Status.TERMINATED)).build();
 
       Set<NodeMetadata> allDeadNodes = Sets.union(deadNodesGroup1, deadNodesGroup2);
@@ -103,19 +101,18 @@ public class OrphanedGroupsFromDeadNodesTest {
 
       Set<String> orphanedGroups = orphanedGroupsFromDeadNodes.apply(allDeadNodes);
 
-      assertSame(orphanedGroups.size(), 2);
-      assertTrue(orphanedGroups.contains("1"));
+      assertSame(orphanedGroups.size(), 1);
       assertTrue(orphanedGroups.contains("2"));
    }
 
    @Test
-   public void testDetectsAllOrphanedGroupsWhenSomeNodesAreAlive() {
+   public void testDetectsOneOrphanedGroupWhenSomeNodesAreAliveAndOtherMissing() {
 
-      Set<NodeMetadata> deadNodesGroup1 = (Set) ImmutableSet.builder()
-              .add(new IdAndGroupOnlyNodeMetadata("a", "1", NodeMetadata.Status.TERMINATED)).build();
+      Set<NodeMetadata> deadNodesGroup1 = ImmutableSet.<NodeMetadata> builder()
+              .add(new IdAndGroupOnlyNodeMetadata("a", "1", NodeMetadata.Status.RUNNING)).build();
 
-      Set<NodeMetadata> deadNodesGroup2 = (Set) ImmutableSet.builder()
-              .add(new IdAndGroupOnlyNodeMetadata("b", "2", NodeMetadata.Status.RUNNING)).build();
+      Set<NodeMetadata> deadNodesGroup2 = ImmutableSet.<NodeMetadata> builder()
+              .add(new IdAndGroupOnlyNodeMetadata("b", "2", NodeMetadata.Status.TERMINATED)).build();
 
       Set<NodeMetadata> allDeadNodes = Sets.union(deadNodesGroup1, deadNodesGroup2);
 
@@ -123,7 +120,7 @@ public class OrphanedGroupsFromDeadNodesTest {
       expect(mock.listNodesDetailsMatching(EasyMock.<Predicate<ComputeMetadata>>anyObject()))
               .andReturn((Set) deadNodesGroup1).once();
       expect(mock.listNodesDetailsMatching(EasyMock.<Predicate<ComputeMetadata>>anyObject()))
-              .andReturn((Set) deadNodesGroup2).once();
+              .andReturn((Set) ImmutableSet.of()).once();
 
       replay(mock);
 
@@ -133,7 +130,36 @@ public class OrphanedGroupsFromDeadNodesTest {
       Set<String> orphanedGroups = orphanedGroupsFromDeadNodes.apply(allDeadNodes);
 
       assertSame(orphanedGroups.size(), 1);
+      assertTrue(orphanedGroups.contains("2"));
+   }
+   
+   @Test
+   public void testDetectsAllOrphanedGroupsWhenAllNodesArerMissing() {
+
+      Set<NodeMetadata> deadNodesGroup1 = ImmutableSet.<NodeMetadata> builder()
+              .add(new IdAndGroupOnlyNodeMetadata("a", "1", NodeMetadata.Status.RUNNING)).build();
+
+      Set<NodeMetadata> deadNodesGroup2 = ImmutableSet.<NodeMetadata> builder()
+              .add(new IdAndGroupOnlyNodeMetadata("b", "2", NodeMetadata.Status.TERMINATED)).build();
+
+      Set<NodeMetadata> allDeadNodes = Sets.union(deadNodesGroup1, deadNodesGroup2);
+
+      ComputeService mock = createMock(ComputeService.class);
+      expect(mock.listNodesDetailsMatching(EasyMock.<Predicate<ComputeMetadata>>anyObject()))
+              .andReturn((Set) ImmutableSet.of()).once();
+      expect(mock.listNodesDetailsMatching(EasyMock.<Predicate<ComputeMetadata>>anyObject()))
+              .andReturn((Set) ImmutableSet.of()).once();
+
+      replay(mock);
+
+      OrphanedGroupsFromDeadNodes orphanedGroupsFromDeadNodes = new OrphanedGroupsFromDeadNodes(
+              allNodesInGroupTerminated(mock));
+
+      Set<String> orphanedGroups = orphanedGroupsFromDeadNodes.apply(allDeadNodes);
+
+      assertSame(orphanedGroups.size(), 2);
       assertTrue(orphanedGroups.contains("1"));
+      assertTrue(orphanedGroups.contains("2"));
    }
 
    private Predicate<String> allNodesInGroupTerminated(final ComputeService mock) {
@@ -141,6 +167,6 @@ public class OrphanedGroupsFromDeadNodesTest {
          @Override protected void configure() {
             bind(ComputeService.class).toInstance(mock);
          }
-      }).getInstance(AllNodesInGroupTerminated.class); // rather than opening ctor.
+      }).getInstance(GroupIsEmpty.class); // rather than opening ctor.
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ResourcesMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ResourcesMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ResourcesMockTest.java
new file mode 100644
index 0000000..8ad0f03
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ResourcesMockTest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.googlecomputeengine.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+
+import org.jclouds.googlecomputeengine.domain.Instance;
+import org.jclouds.googlecomputeengine.domain.Network;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.parse.ParseInstanceTest;
+import org.jclouds.googlecomputeengine.parse.ParseNetworkTest;
+import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "ResourcesMockTest", singleThreaded = true)
+public class ResourcesMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void testInstance() throws Exception {
+      server.enqueue(jsonResponse("/instance_get.json"));
+
+      Instance instance = resourceApi().instance(server.getUrl("/foo/bar").toURI());
+      assertEquals(instance, new ParseInstanceTest().expected(url("/projects")));
+      assertSent(server, "GET", "/foo/bar");
+   }
+   
+   public void testInstanceReturns404() throws Exception {
+      server.enqueue(response404());
+
+      Instance instance = resourceApi().instance(server.getUrl("/foo/bar").toURI());
+      assertNull(instance);
+      assertSent(server, "GET", "/foo/bar");
+   }
+   
+   public void testNetwork() throws Exception {
+      server.enqueue(jsonResponse("/network_get.json"));
+
+      Network network = resourceApi().network(server.getUrl("/foo/bar").toURI());
+      assertEquals(network, new ParseNetworkTest().expected(url("/projects")));
+      assertSent(server, "GET", "/foo/bar");
+   }
+   
+   public void testNetworkReturns404() throws Exception {
+      server.enqueue(response404());
+
+      Network network = resourceApi().network(server.getUrl("/foo/bar").toURI());
+      assertNull(network);
+      assertSent(server, "GET", "/foo/bar");
+   }
+   
+   public void testOperation() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      Operation operation = resourceApi().operation(server.getUrl("/foo/bar").toURI());
+      assertEquals(operation, new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "GET", "/foo/bar");
+   }
+   
+   public void testOperationReturns404() throws Exception {
+      server.enqueue(response404());
+
+      Operation operation = resourceApi().operation(server.getUrl("/foo/bar").toURI());
+      assertNull(operation);
+      assertSent(server, "GET", "/foo/bar");
+   }
+   
+   public void testDelete() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      Operation operation = resourceApi().delete(server.getUrl("/foo/bar").toURI());
+      assertEquals(operation, new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/foo/bar");
+   }
+   
+   public void testDeleteReturns404() throws Exception {
+      server.enqueue(response404());
+
+      Operation operation = resourceApi().delete(server.getUrl("/foo/bar").toURI());
+      assertNull(operation);
+      assertSent(server, "DELETE", "/foo/bar");
+   }
+   
+   public void testResetInstance() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      Operation operation = resourceApi().resetInstance(server.getUrl("/foo/bar").toURI());
+      assertEquals(operation, new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/foo/bar/reset");
+   }
+   
+   public void testStopInstance() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      Operation operation = resourceApi().stopInstance(server.getUrl("/foo/bar").toURI());
+      assertEquals(operation, new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/foo/bar/stop");
+   }
+   
+   public void testStartInstance() throws Exception {
+      server.enqueue(jsonResponse("/operation.json"));
+
+      Operation operation = resourceApi().startInstance(server.getUrl("/foo/bar").toURI());
+      assertEquals(operation, new ParseOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/foo/bar/start");
+   }
+   
+   private Resources resourceApi() {
+      return builder().build().utils().injector().getInstance(Resources.class);
+   }
+}
+

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
index 8907be9..23ed532 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiMockTest.java
@@ -20,6 +20,7 @@ import static com.google.common.base.Charsets.UTF_8;
 import static com.google.common.base.Throwables.propagate;
 import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
 import static org.jclouds.googlecloud.config.GoogleCloudProperties.CREDENTIAL_TYPE;
 import static org.jclouds.googlecloud.config.GoogleCloudProperties.PROJECT_NAME;
 import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperties.IMAGE_PROJECTS;
@@ -36,9 +37,9 @@ import org.jclouds.ContextBuilder;
 import org.jclouds.compute.ComputeService;
 import org.jclouds.compute.ComputeServiceContext;
 import org.jclouds.concurrent.config.ExecutorServiceModule;
-import org.jclouds.http.okhttp.config.OkHttpCommandExecutorServiceModule;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineProviderMetadata;
+import org.jclouds.http.okhttp.config.OkHttpCommandExecutorServiceModule;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
@@ -72,6 +73,7 @@ public class BaseGoogleComputeEngineApiMockTest {
       Properties overrides = new Properties();
       overrides.put(PROJECT_NAME, "party");
       overrides.put(IMAGE_PROJECTS, "debian-cloud");
+      overrides.put(TIMEOUT_NODE_TERMINATED, "0"); // Avoid retry & polling in mock tests
       overrides.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString());
       return ContextBuilder.newBuilder(new GoogleComputeEngineProviderMetadata())
             .credentials(identity, credential)

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json b/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json
deleted file mode 100644
index 0ad66be..0000000
--- a/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
-   "kind": "compute#firewallList",
-   "id": "projects/google/firewalls",
-   "selfLink": "https://www.googleapis.com/compute/v1/projects/google/global/firewalls",
-   "items": [
-      {
-         "kind": "compute#firewall",
-         "id": "12862241031274216284",
-         "creationTimestamp": "2012-04-13T03:05:02.855",
-         "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",
-         "name": "jclouds-test-delete-34sf",
-         "description": "Internal traffic from default allowed",
-         "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/jclouds-test-delete",
-         "sourceRanges": [
-            "10.0.0.0/8"
-         ],
-         "allowed": [
-            {
-               "IPProtocol": "tcp",
-               "ports": [
-                  "1-65535"
-               ]
-            },
-            {
-               "IPProtocol": "udp",
-               "ports": [
-                  "1-65535"
-               ]
-            },
-            {
-               "IPProtocol": "icmp"
-            }
-         ]
-      }
-   ]
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/network_get.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/network_get.json b/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/network_get.json
deleted file mode 100644
index c16b959..0000000
--- a/providers/google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/network_get.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-   "kind": "compute#network",
-   "id": "13024414170909937976",
-   "creationTimestamp": "2012-10-24T20:13:19.967",
-   "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/networks/jclouds-test-delete",
-   "name": "jclouds-test-delete",
-   "description": "Default network for the project",
-   "IPv4Range": "10.0.0.0/8",
-   "gatewayIPv4": "10.0.0.1"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/test/resources/firewall_list_compute.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/firewall_list_compute.json b/providers/google-compute-engine/src/test/resources/firewall_list_compute.json
new file mode 100644
index 0000000..0ad66be
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/firewall_list_compute.json
@@ -0,0 +1,36 @@
+{
+   "kind": "compute#firewallList",
+   "id": "projects/google/firewalls",
+   "selfLink": "https://www.googleapis.com/compute/v1/projects/google/global/firewalls",
+   "items": [
+      {
+         "kind": "compute#firewall",
+         "id": "12862241031274216284",
+         "creationTimestamp": "2012-04-13T03:05:02.855",
+         "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",
+         "name": "jclouds-test-delete-34sf",
+         "description": "Internal traffic from default allowed",
+         "network": "https://www.googleapis.com/compute/v1/projects/party/global/networks/jclouds-test-delete",
+         "sourceRanges": [
+            "10.0.0.0/8"
+         ],
+         "allowed": [
+            {
+               "IPProtocol": "tcp",
+               "ports": [
+                  "1-65535"
+               ]
+            },
+            {
+               "IPProtocol": "udp",
+               "ports": [
+                  "1-65535"
+               ]
+            },
+            {
+               "IPProtocol": "icmp"
+            }
+         ]
+      }
+   ]
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/2e7ca20f/providers/google-compute-engine/src/test/resources/test
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/test b/providers/google-compute-engine/src/test/resources/test
new file mode 100644
index 0000000..5de8a47
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/test
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEAnJvA40x4OK+9nVYTS0N916VMjC6/qYe/IuDUdy6hdW1wz9IO
+MTS3CPxlE0KuoNO1/M7O7yFso6IragTxUkNqJ2mUOqV0Bf0CEkUIKzeYRGfpx+QM
+PorHbLQXjjFinWKwibZuv6lqtvqwcsrjW7bpWsz9x+0qqKM0o0UhjUMhTRqZoYxo
+E2zUH7WA8JRatE/bQkjv/nWBfI+/WzSDhJn7AjIql0Nd4Q+bxohIJEZu8yDw1H6T
+pd7mw83m6UYBk4eZH79r3d2euuQMUKIunyLbw7vNJJ8qYTJQuNYIiJuWKnzzjxuJ
+UfumhdOqfjSobznhAjTLUbA/btZCiQ/TasV4cQIDAQABAoIBAEeOn1b8ZN455qDS
+aKR2JTT4cX6ICckznnEYW9xNMTcPl4FN0HBJTuzLLn/bcyFHOxtVf5YiJpqqCb46
+ne1hokp54mHdoaLu1Rh19GKS139CH77XA4U8Mh0IOM8e35lcM5/o/LeUeI89Aoyh
+CbupWvzDN543TsuZLv7/InKCXt/0dXhAQpq3UiBT63EITQbyom5fSPnMzqM3F8jD
+E9ZqkX4JsnTPC7FQDIpPCaKjG9YCZqoljz+1ssli3mN66V/JKefcCiVoubalmmT2
+dpvmRtFaKvhAmkWYakYybYg8aDi3YygAHSU1bzxlY4TNiQgPdnTTDAPyeqqVrE1D
+Chi+18UCgYEAzlk7c+tFwxZ3ryycOe0loFudUNE5rviHhPgbOHoSTooXh0Hq1Vrb
+2ic+4FbRpoPHLpcLM9LX+arezUdeFBZ8qunjUG6MbUhAeAm/3cfMk+nZg3Skpg8+
+C1D3hxGX4qdhURHvc2QUH7VIUWbucvPgtL8pt1z5Su/EE1Cb2XVsvu8CgYEAwkqZ
+4vTZxI0XqJo6BfUnKGJEDC8xeWr10ELPdXLTCuNDpLSYNedQAxZi9XzvbnbWZ/MF
+Z7IWkzzyAjsX0gpI56cxxtas/chxUboBlUo6ZW8QcPDcU2sKJi318wzElqqvRMNM
+InfLf8nuPC9hyhe49/lFBBSZJeIo396DuqnTPp8CgYBO4NVVLm5wcLo3gDoH+psT
+fXHZXuFJ/T7wmVbuc9tjom30CkKWZDD+Z1olr4pcuKr/KEXj/YkJq0OX/Nv9mcr2
+GooGSPvtGl1qhW+Oe728HPxEv+XghJsXAFBelV8WCR2uO8jotyzqIgYO9+XWk1sm
+PJzZtvSkrJqrN3kb20NCiQKBgDDVP0hj8jgMnl2qJdtJesYTrLbDRdQWpiHqKOqE
+Kbca1+2V1ov1z453GfhJpoRFKi6GTl15zWLEdq9I2vvXyesvgrtPSbufnZvE/JDh
+TzwfZip832O4C5z9AExOcTrNO7A0xfYD1goQXuiRoCqDO+JXrJkR9EwpQ8zAyKsp
+9AZRAoGAGq3TYpmlI5oucEURHKsHOrIBirHFD+RaXMynxzgwkRnt6Z5Mg10I7Ddr
+LiGK8/IrF8bg1F7weLVmj93zjvhQTh5yvb1jwVdFGXM2rbR7/P7F6n2f7xM4+lmv
+Tq7E9Sv8UVuraAwJihlKCuBtpZM1t2JhcuNjXAZngj7R9j5HIZg=
+-----END RSA PRIVATE KEY-----


[46/50] [abbrv] jclouds git commit: JCLOUDS-934. Add support for specifying boot disk type in compute service

Posted by na...@apache.org.
JCLOUDS-934. Add support for specifying boot disk type in compute service


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

Branch: refs/heads/master
Commit: f3555cba1b5753f4be954194026d2f307fe37b8f
Parents: c1b1cfb
Author: Andrew Bayer <an...@gmail.com>
Authored: Mon Jun 15 15:55:03 2015 -0700
Committer: Andrew Bayer <an...@gmail.com>
Committed: Mon Jun 15 15:55:03 2015 -0700

----------------------------------------------------------------------
 .../GoogleComputeEngineServiceAdapter.java      | 41 +++++++++------
 .../GoogleComputeEngineTemplateOptions.java     | 19 ++++++-
 .../googlecomputeengine/domain/AttachDisk.java  |  8 +++
 .../GoogleComputeEngineServiceLiveTest.java     | 44 +++++++++++++++--
 .../GoogleComputeEngineServiceMockTest.java     | 52 ++++++++++++++++++++
 .../src/test/resources/disktype_ssd.json        | 11 +++++
 .../src/test/resources/instance_insert_ssd.json | 40 +++++++++++++++
 7 files changed, 195 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/f3555cba/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index 7e3d74e..e7035ba 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -22,9 +22,11 @@ import static com.google.common.collect.Iterables.filter;
 import static com.google.common.collect.Lists.newArrayList;
 import static java.lang.String.format;
 import static org.jclouds.googlecloud.internal.ListPages.concat;
-import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperties.IMAGE_PROJECTS;
 import static org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet.simplifyPorts;
+import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperties.IMAGE_PROJECTS;
 
+import javax.inject.Inject;
+import javax.inject.Named;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -32,9 +34,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicReference;
 
-import javax.inject.Inject;
-import javax.inject.Named;
-
+import com.google.common.base.Predicate;
+import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.Atomics;
+import com.google.common.util.concurrent.UncheckedTimeoutException;
 import org.jclouds.compute.ComputeServiceAdapter;
 import org.jclouds.compute.domain.Hardware;
 import org.jclouds.compute.domain.NodeMetadata;
@@ -49,6 +56,7 @@ import org.jclouds.googlecomputeengine.compute.functions.FirewallTagNamingConven
 import org.jclouds.googlecomputeengine.compute.functions.Resources;
 import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
 import org.jclouds.googlecomputeengine.domain.AttachDisk;
+import org.jclouds.googlecomputeengine.domain.DiskType;
 import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
@@ -62,15 +70,6 @@ import org.jclouds.googlecomputeengine.domain.Zone;
 import org.jclouds.googlecomputeengine.features.InstanceApi;
 import org.jclouds.location.suppliers.all.JustProvider;
 
-import com.google.common.base.Predicate;
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.Atomics;
-import com.google.common.util.concurrent.UncheckedTimeoutException;
-
 /**
  * This implementation maps the following:
  * <ul>
@@ -120,8 +119,10 @@ public final class GoogleComputeEngineServiceAdapter
       checkNotNull(template.getHardware().getUri(), "hardware must have a URI");
       checkNotNull(template.getImage().getUri(), "image URI is null");
 
+      String zone = template.getLocation().getId();
+
       List<AttachDisk> disks = Lists.newArrayList();
-      disks.add(AttachDisk.newBootDisk(template.getImage().getUri()));
+      disks.add(AttachDisk.newBootDisk(template.getImage().getUri(), getDiskTypeArgument(options, zone)));
 
       Iterator<String> networks = options.getNetworks().iterator();
 
@@ -156,7 +157,6 @@ public final class GoogleComputeEngineServiceAdapter
                format("%s:%s %s@localhost", credentials.getUser(), options.getPublicKey(), credentials.getUser()));
       }
 
-      String zone = template.getLocation().getId();
       InstanceApi instanceApi = api.instancesInZone(zone);
       Operation create = instanceApi.create(newInstance);
 
@@ -303,4 +303,15 @@ public final class GoogleComputeEngineServiceAdapter
       String path = link.getPath();
       return path.substring(path.lastIndexOf('/') + 1);
    }
+
+   private URI getDiskTypeArgument(GoogleComputeEngineTemplateOptions options, String zone) {
+      if (options.bootDiskType() != null) {
+         DiskType diskType = api.diskTypesInZone(zone).get(options.bootDiskType());
+         if (diskType != null) {
+            return diskType.selfLink();
+         }
+      }
+
+      return null;
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f3555cba/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
index 1923c3a..a2cbd1f 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
@@ -21,14 +21,15 @@ import java.util.Map;
 
 import org.jclouds.compute.options.TemplateOptions;
 import org.jclouds.domain.LoginCredentials;
-import org.jclouds.scriptbuilder.domain.Statement;
 import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
+import org.jclouds.scriptbuilder.domain.Statement;
 
 /** Instance options specific to Google Compute Engine. */
 public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
 
    private boolean autoCreateKeyPair = true;
    private List<ServiceAccount> serviceAccounts;
+   private String bootDiskType;
 
    @Override
    public GoogleComputeEngineTemplateOptions clone() {
@@ -44,10 +45,26 @@ public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
          GoogleComputeEngineTemplateOptions eTo = GoogleComputeEngineTemplateOptions.class.cast(to);
          eTo.autoCreateKeyPair(autoCreateKeyPair());
          eTo.serviceAccounts(serviceAccounts());
+         eTo.bootDiskType(bootDiskType());
       }
    }
 
    /**
+    * Sets the boot disk type.
+    */
+   public GoogleComputeEngineTemplateOptions bootDiskType(String diskType) {
+      this.bootDiskType = diskType;
+      return this;
+   }
+
+   /**
+    * Gets the boot disk type.
+    */
+   public String bootDiskType() {
+      return bootDiskType;
+   }
+
+   /**
     * Sets whether an SSH key pair should be created automatically.
     */
    public GoogleComputeEngineTemplateOptions autoCreateKeyPair(boolean autoCreateKeyPair) {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f3555cba/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
index 198b815..5c34818 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AttachDisk.java
@@ -43,6 +43,10 @@ public abstract class AttachDisk {
          return create(null, null, sourceImage, null);
       }
 
+      static InitializeParams create(URI sourceImage, URI diskType) {
+         return create(null, null, sourceImage, diskType);
+      }
+
       @SerializedNames({ "diskName", "diskSizeGb", "sourceImage", "diskType" })
       public static InitializeParams create(String diskName, Long diskSizeGb, URI sourceImage, URI diskType) {
          return new AutoValue_AttachDisk_InitializeParams(diskName, diskSizeGb, sourceImage, diskType);
@@ -103,6 +107,10 @@ public abstract class AttachDisk {
       return create(Type.PERSISTENT, null, InitializeParams.create(sourceImage), true, true);
    }
 
+   public static AttachDisk newBootDisk(URI sourceImage, URI diskType) {
+      return create(Type.PERSISTENT, null, InitializeParams.create(sourceImage, diskType), true, true);
+   }
+
    public static AttachDisk existingDisk(URI existingDisk) {
       return create(Type.PERSISTENT, existingDisk, null, false, false);
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f3555cba/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
index 1801408..afaa5bb 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java
@@ -18,27 +18,34 @@ package org.jclouds.googlecomputeengine.compute;
 
 import static com.google.common.collect.Iterables.contains;
 import static org.jclouds.util.Strings2.toStringAndClose;
+import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 
+import java.net.URI;
 import java.util.Properties;
 import java.util.Set;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.inject.Module;
 import org.jclouds.compute.ComputeServiceContext;
 import org.jclouds.compute.domain.Hardware;
 import org.jclouds.compute.domain.NodeMetadata;
 import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.compute.predicates.NodePredicates;
 import org.jclouds.googlecloud.internal.TestProperties;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
+import org.jclouds.googlecomputeengine.domain.Disk;
+import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.MachineType;
 import org.jclouds.rest.AuthorizationException;
 import org.jclouds.sshj.config.SshjSshClientModule;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
 @Test(groups = "live", singleThreaded = true)
 public class GoogleComputeEngineServiceLiveTest extends BaseComputeServiceLiveTest {
 
@@ -67,6 +74,29 @@ public class GoogleComputeEngineServiceLiveTest extends BaseComputeServiceLiveTe
       }
    }
 
+   public void testCreateNodeWithSsd() throws Exception {
+      String group = this.group + "ssd";
+      try {
+         TemplateOptions options = client.templateOptions();
+
+         options.as(GoogleComputeEngineTemplateOptions.class).bootDiskType("pd-ssd");
+
+         // create a node
+         Set<? extends NodeMetadata> nodes =
+               client.createNodesInGroup(group, 1, options);
+         assertEquals(nodes.size(), 1, "One node should have been created");
+
+         // Verify the disk on the instance is an ssd.
+         NodeMetadata node = Iterables.get(nodes, 0);
+         GoogleComputeEngineApi api = client.getContext().unwrapApi(GoogleComputeEngineApi.class);
+         Instance instance = api.instancesInZone(node.getLocation().getId()).get(node.getName());
+         Disk disk = api.disksInZone(node.getLocation().getId()).get(toName(instance.disks().get(0).source()));
+         assertTrue(disk.type().toString().endsWith("pd-ssd"));
+
+      } finally {
+         client.destroyNodesMatching(NodePredicates.inGroup(group));
+      }
+   }
    /**
     * Nodes may have additional metadata entries (particularly they may have an "sshKeys" entry)
     */
@@ -110,4 +140,10 @@ public class GoogleComputeEngineServiceLiveTest extends BaseComputeServiceLiveTe
          assert nodeTags.contains(tag) : String.format("node tags did not match %s %s node:", tags, nodeTags, node);
       }
    }
+
+   private static String toName(URI link) {
+      String path = link.getPath();
+      return path.substring(path.lastIndexOf('/') + 1);
+   }
+
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f3555cba/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
index d9e53f9..d374f93 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java
@@ -184,12 +184,64 @@ public class GoogleComputeEngineServiceMockTest extends BaseGoogleComputeEngineA
       assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-1");
    }
 
+   public void createNodeWithSpecificDiskType() throws Exception {
+      server.enqueue(singleRegionSingleZoneResponse());
+      server.enqueue(jsonResponse("/image_list.json"));
+      server.enqueue(jsonResponse("/image_list_debian.json")); // per IMAGE_PROJECTS = "debian-cloud"
+      server.enqueue(jsonResponse("/aggregated_machinetype_list.json"));
+      server.enqueue(jsonResponse("/network_get_default.json"));
+      server.enqueue(new MockResponse().setResponseCode(404)); // Get Firewall
+      server.enqueue(jsonResponse("/operation.json")); // Create Firewall
+      server.enqueue(jsonResponse("/zone_operation.json"));
+      server.enqueue(aggregatedListWithInstanceNetworkAndStatus("test-0", "test-network", RUNNING));
+      server.enqueue(jsonResponse("/disktype_ssd.json"));
+      server.enqueue(jsonResponse("/operation.json")); // Create Instance
+      server.enqueue(instanceWithNetworkAndStatusAndSsd("test-1", "test-network", RUNNING));
+
+      ComputeService computeService = computeService();
+
+      GoogleComputeEngineTemplateOptions options = computeService.templateOptions()
+            .as(GoogleComputeEngineTemplateOptions.class).autoCreateKeyPair(false)
+            .tags(ImmutableSet.of("aTag")).blockUntilRunning(false)
+            .bootDiskType("pd-ssd");
+
+      Template template = computeService.templateBuilder().options(options).build();
+      NodeMetadata node = getOnlyElement(computeService.createNodesInGroup("test", 1, template));
+
+      // prove our caching works.
+      assertEquals(node.getImageId(), template.getImage().getId());
+      assertEquals(node.getLocation().getId(), template.getLocation().getId());
+
+      assertSent(server, "GET", "/projects/party/regions");
+      assertSent(server, "GET", "/projects/party/global/images");
+      assertSent(server, "GET", "/projects/debian-cloud/global/images");
+      assertSent(server, "GET", "/projects/party/aggregated/machineTypes");
+      assertSent(server, "GET", "/projects/party/global/networks/default");
+      assertSent(server, "GET", "/projects/party/global/firewalls/jclouds-test-65f"); // Get Firewall
+      assertSent(server, "POST", "/projects/party/global/firewalls", // Create Firewall
+            stringFromResource("/firewall_insert_2.json"));
+
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/operations/operation-1354084865060");
+      assertSent(server, "GET", "/projects/party/aggregated/instances");
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/diskTypes/pd-ssd");
+      assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances",
+            String.format(stringFromResource("/instance_insert_ssd.json"), template.getHardware().getId(), template.getImage().getId()));
+
+      assertSent(server, "GET", "/projects/party/zones/us-central1-a/instances/test-1");
+   }
+
    private MockResponse instanceWithNetworkAndStatus(String instanceName, String networkName, Instance.Status status) {
       return new MockResponse().setBody(
             stringFromResource("/instance_get.json").replace("test-0", instanceName).replace("default", networkName)
                   .replace("RUNNING", status.toString()));
    }
 
+   private MockResponse instanceWithNetworkAndStatusAndSsd(String instanceName, String networkName, Instance.Status status) {
+      return new MockResponse().setBody(
+            stringFromResource("/instance_get.json").replace("test-0", instanceName).replace("default", networkName)
+                  .replace("RUNNING", status.toString()).replace("pd-standard", "pd-ssd"));
+   }
+
    private MockResponse aggregatedListWithInstanceNetworkAndStatus(String instanceName, String networkName,
          Instance.Status status) {
       return new MockResponse().setBody(

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f3555cba/providers/google-compute-engine/src/test/resources/disktype_ssd.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/disktype_ssd.json b/providers/google-compute-engine/src/test/resources/disktype_ssd.json
new file mode 100644
index 0000000..fcedefb
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/disktype_ssd.json
@@ -0,0 +1,11 @@
+{
+ "kind": "compute#diskType",
+ "creationTimestamp": "2014-06-02T11:07:28.529-07:00",
+ "name": "pd-ssd",
+ "description": "SSD Persistent Disk",
+ "validDiskSize": "10GB-1TB",
+ "zone": "https://content.googleapis.com/compute/v1/projects/party/zones/us-central1-a",
+ "selfLink": "https://content.googleapis.com/compute/v1/projects/party/zones/us-central1-a/diskTypes/pd-ssd",
+ "defaultDiskSizeGb": "100"
+}
+

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f3555cba/providers/google-compute-engine/src/test/resources/instance_insert_ssd.json
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/resources/instance_insert_ssd.json b/providers/google-compute-engine/src/test/resources/instance_insert_ssd.json
new file mode 100644
index 0000000..7a5080d
--- /dev/null
+++ b/providers/google-compute-engine/src/test/resources/instance_insert_ssd.json
@@ -0,0 +1,40 @@
+{
+  "machineType": "%s",
+  "name": "test-1",
+  "networkInterfaces": [
+    {
+      "network": "https://www.googleapis.com/compute/v1/projects/party/networks/default",
+      "accessConfigs": [
+        {
+          "type": "ONE_TO_ONE_NAT"
+        }
+      ]
+    }
+  ],
+  "disks": [
+    {
+      "type": "PERSISTENT",
+      "initializeParams": {
+        "sourceImage": "%s",
+        "diskType": "https://content.googleapis.com/compute/v1/projects/party/zones/us-central1-a/diskTypes/pd-ssd"
+      },
+      "boot": true,
+      "autoDelete": true
+    }
+  ],
+  "description": "test",
+  "tags": {
+    "items": [
+      "aTag",
+      "jclouds-test-65f"
+    ]
+  },
+  "metadata": {
+    "items": [
+      {
+        "key": "jclouds-group",
+        "value": "test"
+      }
+    ]
+  }
+}
\ No newline at end of file


[29/50] [abbrv] jclouds git commit: Updated DiskCreationOptions to AutoValue + Builder

Posted by na...@apache.org.
Updated DiskCreationOptions to AutoValue + Builder


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

Branch: refs/heads/master
Commit: a26a721575c5358e70b0064f2f19b318fd1a8aef
Parents: adf6999
Author: Daniel Broudy <br...@google.com>
Authored: Fri Jan 30 17:27:34 2015 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Feb 18 10:58:37 2015 +0100

----------------------------------------------------------------------
 .../options/DiskCreationOptions.java            | 122 +++++++++----------
 .../options/ImageCreationOptions.java           |   2 +-
 .../binders/DiskCreationBinderTest.java         |   4 +-
 .../features/DiskApiLiveTest.java               |   4 +-
 .../features/DiskApiMockTest.java               |   8 +-
 .../features/ImageApiLiveTest.java              |   2 +-
 .../features/InstanceApiLiveTest.java           |   4 +-
 .../features/SnapshotApiLiveTest.java           |   2 +-
 8 files changed, 73 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/a26a7215/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DiskCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DiskCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DiskCreationOptions.java
index 166d021..5acb015 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DiskCreationOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DiskCreationOptions.java
@@ -18,79 +18,77 @@ package org.jclouds.googlecomputeengine.options;
 
 import java.net.URI;
 
-public final class DiskCreationOptions {
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
 
-   private URI type;
-   private Integer sizeGb;
-   private URI sourceSnapshot;
-   private String description;
+import com.google.auto.value.AutoValue;
 
+@AutoValue
+public abstract class DiskCreationOptions {
 
-   /**
-    * The disk type, fully qualified URL for the disk type.
-    *
-    * @return the disk type
-    */
-   public URI type() {
-      return type;
-   }
+   @Nullable public abstract URI type();
+   @Nullable public abstract Integer sizeGb();
+   @Nullable public abstract URI sourceSnapshot();
+   @Nullable public abstract String description();
 
-   /**
-    * Size of the persistent disk, specified in GB.
-    * You can also specify this when creating a persistent disk
-    * using the sourceImage or sourceSnapshot parameter.
-    */
-   public Integer sizeGb() {
-      return sizeGb;
+   @SerializedNames({"type", "sizeGb", "sourceSnapshot", "description"})
+   static DiskCreationOptions create(URI type, Integer sizeGb, URI sourceSnapshot,
+         String description){
+      return new AutoValue_DiskCreationOptions(type, sizeGb, sourceSnapshot, description);
    }
 
-   /**
-    * The source snapshot
-    *
-    * @return sourceSnapshot, fully qualified URL for the snapshot to be copied.
-    */
-   public URI sourceSnapshot() {
-      return sourceSnapshot;
+   DiskCreationOptions(){
    }
 
-   /**
-    * The description
-    *
-    * @return description, An optional textual description of the resource.
-    */
-   public String description() {
-      return description;
-   }
+   public static class Builder {
 
-   /**
-    * @see DiskCreationOptions#type()
-    */
-   public DiskCreationOptions type(URI type) {
-      this.type = type;
-      return this;
-   }
+      private URI type;
+      private Integer sizeGb;
+      private URI sourceSnapshot;
+      private String description;
 
-   /**
-    * @see DiskCreationOptions#sizeGb()
-    */
-   public DiskCreationOptions sizeGb(Integer sizeGb) {
-      this.sizeGb = sizeGb;
-      return this;
-   }
+      /**
+       * The disk type, fully qualified URL for the disk type.
+       *
+       * @return the disk type
+       */
+      public Builder type(URI type) {
+         this.type = type;
+         return this;
+      }
 
-   /**
-    * @see DiskCreationOptions#sourceSnapshot()
-    */
-   public DiskCreationOptions sourceSnapshot(URI sourceSnapshot) {
-      this.sourceSnapshot = sourceSnapshot;
-      return this;
-   }
+      /**
+       * Size of the persistent disk, specified in GB.
+       * You can also specify this when creating a persistent disk
+       * using the sourceImage or sourceSnapshot parameter.
+       */
+      public Builder sizeGb(Integer sizeGb) {
+         this.sizeGb = sizeGb;
+         return this;
+      }
+
+      /**
+       * The source snapshot
+       *
+       * @return sourceSnapshot, fully qualified URL for the snapshot to be copied.
+       */
+      public Builder sourceSnapshot(URI sourceSnapshot) {
+         this.sourceSnapshot = sourceSnapshot;
+         return this;
+      }
+
+      /**
+       * The description
+       *
+       * @return description, An optional textual description of the resource.
+       */
+      public Builder description(String description) {
+         this.description = description;
+         return this;
+      }
 
-   /**
-    * @see DiskCreationOptions#description()
-    */
-   public DiskCreationOptions description(String description) {
-      this.description = description;
-      return this;
+      public DiskCreationOptions build(){
+         return create(type, sizeGb, sourceSnapshot, description);
+      }
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a26a7215/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ImageCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ImageCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ImageCreationOptions.java
index cb75d1d..0a33ada 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ImageCreationOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ImageCreationOptions.java
@@ -42,7 +42,7 @@ public abstract class ImageCreationOptions {
       return new AutoValue_ImageCreationOptions(name, description, sourceType, rawDisk, deprecated, sourceDisk);
    }
 
-   public static class Builder{
+   public static class Builder {
       public String name;
       public String description;
       public String sourceType;

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a26a7215/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinderTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinderTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinderTest.java
index 3467ab4..a8b614e 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinderTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/DiskCreationBinderTest.java
@@ -38,8 +38,8 @@ public class DiskCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Ob
 
    @Test
    public void testMap() throws SecurityException, NoSuchMethodException {
-      DiskCreationOptions diskCreationOptions = new DiskCreationOptions()
-         .sourceSnapshot(URI.create(FAKE_SOURCE_SNAPSHOT)).sizeGb(15).description(null);
+      DiskCreationOptions diskCreationOptions = new DiskCreationOptions.Builder()
+         .sourceSnapshot(URI.create(FAKE_SOURCE_SNAPSHOT)).sizeGb(15).description(null).build();
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
       Map<String, Object> postParams = ImmutableMap.of("name", "testName", "options", diskCreationOptions);

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a26a7215/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
index b071f20..ec020bc 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
@@ -42,7 +42,7 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    @Test(groups = "live")
    public void testInsertDisk() {
-      DiskCreationOptions options = new DiskCreationOptions().sizeGb( SIZE_GB);
+      DiskCreationOptions options = new DiskCreationOptions.Builder().sizeGb( SIZE_GB).build();
       assertOperationDoneSuccessfully(api().create(DISK_NAME, options));
    }
 
@@ -78,7 +78,7 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    @Test(groups = "live")
    public void testInsertSSDDisk() {
       URI diskType = getDiskTypeUrl(DEFAULT_ZONE_NAME, "pd-ssd");
-      DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(diskType).sizeGb(SIZE_GB);
+      DiskCreationOptions diskCreationOptions = new DiskCreationOptions.Builder().type(diskType).sizeGb(SIZE_GB).build();
       assertOperationDoneSuccessfully(api().create(SSD_DISK_NAME, diskCreationOptions));
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a26a7215/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
index 9c5a1e6..13f9d25 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiMockTest.java
@@ -52,7 +52,7 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
    public void insert() throws Exception {
       server.enqueue(jsonResponse("/zone_operation.json"));
 
-      DiskCreationOptions options = new DiskCreationOptions().sizeGb(1);
+      DiskCreationOptions options = new DiskCreationOptions.Builder().sizeGb(1).build();
       assertEquals(diskApi().create("testimage1", options),
             new ParseZoneOperationTest().expected(url("/projects")));
 
@@ -63,7 +63,7 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
    public void insertFromImage() throws Exception {
       server.enqueue(jsonResponse("/zone_operation.json"));
 
-      DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sizeGb(1).description("testing 123");
+      DiskCreationOptions diskCreationOptions = new DiskCreationOptions.Builder().sizeGb(1).description("testing 123").build();
 
       assertEquals(diskApi().create("testimage1", url(IMAGE_URL), diskCreationOptions),
             new ParseZoneOperationTest().expected(url("/projects")));
@@ -76,8 +76,8 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
    public void insertFromSSD() throws Exception {
       server.enqueue(jsonResponse("/zone_operation.json"));
 
-      DiskCreationOptions diskCreationOptions = new DiskCreationOptions()
-         .type(URI.create(url(SSD_URL))).sizeGb(1);
+      DiskCreationOptions diskCreationOptions = new DiskCreationOptions.Builder()
+         .type(URI.create(url(SSD_URL))).sizeGb(1).build();
 
       assertEquals(diskApi().create("testimage1", diskCreationOptions),
             new ParseZoneOperationTest().expected(url("/projects")));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a26a7215/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
index 3b6494d..db6346d 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
@@ -70,7 +70,7 @@ public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    @Test(groups = "live")
    public void testInsertDisk() {
       assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
-            new DiskCreationOptions().sizeGb(sizeGb)));
+            new DiskCreationOptions.Builder().sizeGb(sizeGb).build()));
       Disk disk = diskApi().get(DISK_NAME);
       diskURI = disk.selfLink();
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a26a7215/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index 266d759..4c74a3d 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -122,7 +122,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
               (INSTANCE_NETWORK_NAME, IPV4_RANGE));
 
       assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
-            new DiskCreationOptions().sizeGb(DEFAULT_DISK_SIZE_GB)));
+            new DiskCreationOptions.Builder().sizeGb(DEFAULT_DISK_SIZE_GB).build()));
       assertOperationDoneSuccessfully(api().create(instance));
       assertOperationDoneSuccessfully(api().create(instance2));
    }
@@ -236,7 +236,7 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    @Test(groups = "live", dependsOnMethods = "testSetMetadataForInstance")
    public void testAttachDiskToInstance() {
       assertOperationDoneSuccessfully(diskApi().create(ATTACH_DISK_NAME,
-            new DiskCreationOptions().sizeGb(1)));
+            new DiskCreationOptions.Builder().sizeGb(1).build()));
 
       Instance originalInstance = api().get(INSTANCE_NAME);
       assertOperationDoneSuccessfully(api().attachDisk(INSTANCE_NAME,

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a26a7215/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
index cec6ffa..57c76cb 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java
@@ -46,7 +46,7 @@ public class SnapshotApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    @Test(groups = "live")
    public void testCreateSnapshot() {
       assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
-            new DiskCreationOptions().sizeGb(1)));
+            new DiskCreationOptions.Builder().sizeGb(1).build()));
       disk = diskApi().get(DISK_NAME);
 
       assertOperationDoneSuccessfully(diskApi().createSnapshot(DISK_NAME, SNAPSHOT_NAME));


[32/50] [abbrv] jclouds git commit: Apache jclouds 1.9.0 release

Posted by na...@apache.org.
Apache jclouds 1.9.0 release


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

Branch: refs/heads/master
Commit: 121ea203d81737d72d0ca7747db1680cfd438f07
Parents: 9c3ceff
Author: Ignasi Barrera <na...@apache.org>
Authored: Tue Mar 24 11:06:18 2015 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Mar 24 11:06:18 2015 +0100

----------------------------------------------------------------------
 common/googlecloud/pom.xml              | 2 +-
 providers/google-compute-engine/pom.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/121ea203/common/googlecloud/pom.xml
----------------------------------------------------------------------
diff --git a/common/googlecloud/pom.xml b/common/googlecloud/pom.xml
index 8e06883..e4564e2 100644
--- a/common/googlecloud/pom.xml
+++ b/common/googlecloud/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.jclouds.labs</groupId>
         <artifactId>jclouds-labs-google</artifactId>
-        <version>2.0.0-SNAPSHOT</version>
+        <version>1.9.0</version>
     </parent>
 
     <!-- TODO: when out of labs, switch to org.jclouds.provider -->

http://git-wip-us.apache.org/repos/asf/jclouds/blob/121ea203/providers/google-compute-engine/pom.xml
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/pom.xml b/providers/google-compute-engine/pom.xml
index 2cf38fb..55ced6f 100644
--- a/providers/google-compute-engine/pom.xml
+++ b/providers/google-compute-engine/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.jclouds.labs</groupId>
         <artifactId>jclouds-labs-google</artifactId>
-        <version>2.0.0-SNAPSHOT</version>
+        <version>1.9.0</version>
     </parent>
 
     <!-- TODO: when out of labs, switch to org.jclouds.provider -->


[27/50] [abbrv] jclouds git commit: Updated DeprecateOptions to AutoValue + Builder

Posted by na...@apache.org.
Updated DeprecateOptions to AutoValue + Builder


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

Branch: refs/heads/master
Commit: adf699989966f67142d29b522564f62c8ccaa986
Parents: a9eecfa
Author: Daniel Broudy <br...@google.com>
Authored: Fri Jan 30 17:13:52 2015 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Feb 18 10:58:36 2015 +0100

----------------------------------------------------------------------
 .../options/DeprecateOptions.java               | 152 +++++++++----------
 .../features/ImageApiLiveTest.java              |   5 +-
 .../features/ImageApiMockTest.java              |   5 +-
 3 files changed, 78 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/adf69998/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DeprecateOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DeprecateOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DeprecateOptions.java
index ce19ded..9f4a5ef 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DeprecateOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/DeprecateOptions.java
@@ -18,104 +18,96 @@ package org.jclouds.googlecomputeengine.options;
 
 import java.net.URI;
 import java.util.Date;
+
 import org.jclouds.googlecomputeengine.domain.Deprecated.State;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
 
 /**
  * Options to set the deprecation status of a resource. Currently only for images.
  *
  * @see <a href="https://developers.google.com/compute/docs/reference/latest/images/deprecate" />
  */
-public class DeprecateOptions {
+@AutoValue
+public abstract class DeprecateOptions {
 
-   private State state;
-   private URI replacement;
-   private Date deprecated;
-   private Date obsolete;
-   private Date deleted;
+   @Nullable public abstract State state();
+   @Nullable public abstract URI replacement();
+   @Nullable public abstract Date deprecated();
+   @Nullable public abstract Date obsolete();
+   @Nullable public abstract Date deleted();
 
-   /**
-    * The new deprecation state.
-    *
-    * @return the new deprecation state.
-    */
-   public State getState() {
-      return state;
+   @SerializedNames({"state", "replacement", "deprecated", "obsolete", "deleted"})
+   static DeprecateOptions create(State state, URI replacement, Date deprecated,
+         Date obsolete, Date deleted){
+      return new AutoValue_DeprecateOptions(state, replacement, deprecated, obsolete, deleted);
    }
 
-   /**
-    * Optional URL for replacement of deprecated resource.
-    *
-    * @return the URL
-    */
-   public URI getReplacement() {
-      return replacement;
+   DeprecateOptions(){
    }
 
-   /**
-    * Optional RFC3339 timestamp for when the deprecation state was changed to DEPRECATED.
-    *
-    * @return the timestamp
-    */
-   public Date getDeprecated() {
-      return deprecated;
-   }
+   public static class Builder {
+      private State state;
+      private URI replacement;
+      private Date deprecated;
+      private Date obsolete;
+      private Date deleted;
 
-   /**
-    * Optional RFC3339 timestamp for when the deprecation state was changed to OBSOLETE.
-    *
-    * @return the timestamp
-    */
-   public Date getObsolete() {
-      return obsolete;
-   }
+      /**
+       * The new deprecation state.
+       *
+       * @return the new deprecation state.
+       */
+      public Builder state(State state) {
+         this.state = state;
+         return this;
+      }
 
-   /**
-    * Optional RFC3339 timestamp for when the deprecation state was changed to DELETED.
-    *
-    * @return the timestamp
-    */
-   public Date getDeleted() {
-      return deleted;
-   }
+      /**
+       * Optional URL for replacement of deprecated resource.
+       *
+       * @return the URL
+       */
+      public Builder replacement(URI replacement) {
+         this.replacement = replacement;
+         return this;
+      }
 
-   /**
-    * @see DeprecateOptions#getState()
-    */
-   public DeprecateOptions state(State state) {
-      this.state = state;
-      return this;
-   }
+      /**
+       * Optional RFC3339 timestamp for when the deprecation state was changed to DEPRECATED.
+       *
+       * @return the timestamp
+       */
+      public Builder deprecated(Date deprecated) {
+         this.deprecated = deprecated;
+         return this;
+      }
 
-   /**
-    * @see DeprecateOptions#getReplacement()
-    */
-   public DeprecateOptions replacement(URI replacement) {
-      this.replacement = replacement;
-      return this;
-   }
+      /**
+       * Optional RFC3339 timestamp for when the deprecation state was changed to OBSOLETE.
+       *
+       * @return the timestamp
+       */
+      public Builder obsolete(Date obsolete) {
+         this.obsolete = obsolete;
+         return this;
+      }
 
-   /**
-    * @see DeprecateOptions#getDeprecated()
-    */
-   public DeprecateOptions deprecated(Date deprecated) {
-      this.deprecated = deprecated;
-      return this;
-   }
+      /**
+       * Optional RFC3339 timestamp for when the deprecation state was changed to DELETED.
+       *
+       * @return the timestamp
+       */
+      public Builder deleted(Date deleted) {
+         this.deleted = deleted;
+         return this;
+      }
 
-   /**
-    * @see DeprecateOptions#getObsolete()
-    */
-   public DeprecateOptions obsolete(Date obsolete) {
-      this.obsolete = obsolete;
-      return this;
+      public DeprecateOptions build(){
+         return create(state, replacement, deprecated,
+               obsolete, deleted);
+      }
    }
-
-   /**
-    * @see DeprecateOptions#getDeleted()
-    */
-   public DeprecateOptions deleted(Date deleted) {
-      this.deleted = deleted;
-      return this;
-   }
-
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/adf69998/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
index 486e701..3b6494d 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
@@ -96,11 +96,12 @@ public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
       URI replacement = URI.create("https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326test");
 
-      DeprecateOptions deprecateOptions = new DeprecateOptions().state(State.DEPRECATED)
+      DeprecateOptions deprecateOptions = new DeprecateOptions.Builder().state(State.DEPRECATED)
             .replacement(replacement)
             .deprecated(new SimpleDateFormatDateService().iso8601DateParse(deprecated))
             .obsolete(new SimpleDateFormatDateService().iso8601DateParse(obsolete))
-            .deleted(new SimpleDateFormatDateService().iso8601DateParse(deleted));
+            .deleted(new SimpleDateFormatDateService().iso8601DateParse(deleted))
+            .build();
 
       assertOperationDoneSuccessfully(api().deprecate(IMAGE_NAME, deprecateOptions));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/adf69998/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
index 7d9e9c0..7af2b8e 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiMockTest.java
@@ -136,11 +136,12 @@ public class ImageApiMockTest extends BaseGoogleComputeEngineApiMockTest {
       String imageName = "test-image";
       server.enqueue(jsonResponse("/operation.json"));
 
-      DeprecateOptions options = new DeprecateOptions().state(State.DEPRECATED)
+      DeprecateOptions options = new DeprecateOptions.Builder().state(State.DEPRECATED)
             .replacement(URI.create(url("/projects/centos-cloud/global/images/centos-6-2-v20120326test")))
             .deprecated(new SimpleDateFormatDateService().iso8601DateParse("2014-07-16T22:16:13.468Z"))
             .obsolete(new SimpleDateFormatDateService().iso8601DateParse("2014-10-16T22:16:13.468Z"))
-            .deleted(new SimpleDateFormatDateService().iso8601DateParse("2015-01-16T22:16:13.468Z"));
+            .deleted(new SimpleDateFormatDateService().iso8601DateParse("2015-01-16T22:16:13.468Z"))
+            .build();
 
       assertEquals(imageApi().deprecate(imageName, options),
             new ParseOperationTest().expected(url("/projects")));


[14/50] [abbrv] jclouds git commit: Added targetPool:AggregatedList, getHealth. Updated HttpHealthCheck

Posted by na...@apache.org.
Added targetPool:AggregatedList, getHealth. Updated HttpHealthCheck


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

Branch: refs/heads/master
Commit: dd5c4c5c6bf2102cda4abaeb05becbdb57ea00e6
Parents: 94d42c3
Author: Daniel Broudy <br...@google.com>
Authored: Mon Dec 1 12:24:03 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Dec 9 21:46:11 2014 +0100

----------------------------------------------------------------------
 .../binders/HttpHealthCheckCreationBinder.java  |   4 +-
 .../domain/BackendServiceGroupHealth.java       |  56 ----
 .../domain/HealthStatus.java                    |  56 ++++
 .../domain/HttpHealthCheck.java                 |  24 +-
 .../features/AggregatedListApi.java             |  51 ++++
 .../features/BackendServiceApi.java             |   4 +-
 .../features/HttpHealthCheckApi.java            |   2 +-
 .../features/TargetPoolApi.java                 |  22 +-
 .../options/HttpHealthCheckCreationOptions.java | 289 ++++++++++---------
 .../HttpHealthCheckCreationBinderTest.java      |  16 +-
 .../features/AggregatedListApiLiveTest.java     |  18 ++
 .../features/AggregatedListApiMockTest.java     |  34 ++-
 .../features/BackendServiceApiMockTest.java     |   6 +-
 .../features/HttpHealthCheckApiExpectTest.java  |   4 +-
 .../features/HttpHealthCheckApiLiveTest.java    |  43 +--
 .../features/HttpHealthCheckApiMockTest.java    |   8 +-
 .../features/TargetPoolApiExpectTest.java       | 263 -----------------
 .../features/TargetPoolApiLiveTest.java         |  73 +++--
 .../features/TargetPoolApiMockTest.java         | 178 ++++++++++++
 .../parse/ParseBackendServiceGetHealthTest.java |  58 ----
 .../parse/ParseHealthStatusTest.java            |  58 ++++
 .../parse/ParseTargetPoolListTest.java          |   7 +-
 .../parse/ParseTargetPoolTest.java              |   9 +-
 .../resources/aggregated_target_pool_list.json  |  46 +++
 .../aggregated_target_pool_list_empty.json      |  43 +++
 .../resources/backend_service_get_health.json   |  10 -
 .../resources/health_status_get_health.json     |  10 +
 .../test/resources/httphealthcheck_insert.json  |   2 +-
 .../test/resources/httphealthcheck_patch.json   |   1 +
 29 files changed, 773 insertions(+), 622 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinder.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinder.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinder.java
index 7b23a33..636cced 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinder.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinder.java
@@ -38,7 +38,7 @@ public class HttpHealthCheckCreationBinder extends BindToJsonPayload {
       HttpHealthCheckBinderHelper helper = new HttpHealthCheckBinderHelper(name, options);
       return super.bindToRequest(request, helper);
    }
-   
+
    private class HttpHealthCheckBinderHelper{
 
       /**
@@ -62,7 +62,7 @@ public class HttpHealthCheckCreationBinder extends BindToJsonPayload {
       private Integer healthyThreshold;
       @SuppressWarnings("unused")
       private String description;
-      
+
       private HttpHealthCheckBinderHelper(String name, HttpHealthCheckCreationOptions httpHealthCheckCreationOptions){
          this.name = name;
          this.host = httpHealthCheckCreationOptions.host();

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/BackendServiceGroupHealth.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/BackendServiceGroupHealth.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/BackendServiceGroupHealth.java
deleted file mode 100644
index c31f64c..0000000
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/BackendServiceGroupHealth.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.domain;
-
-import java.net.URI;
-import java.util.List;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.json.SerializedNames;
-
-import com.google.auto.value.AutoValue;
-
-@AutoValue
-public abstract class BackendServiceGroupHealth {
-
-   public abstract List<HealthStatus> healthStatus();
-
-   @SerializedNames({"healthStatus"})
-   public static BackendServiceGroupHealth create(List<HealthStatus> healthStatus){
-      return new AutoValue_BackendServiceGroupHealth(healthStatus);
-   }
-
-   BackendServiceGroupHealth(){
-   }
-
-   @AutoValue
-   public abstract static class HealthStatus {
-
-      @Nullable public abstract String ipAddress();
-      public abstract Integer port();
-      public abstract URI instance();
-      public abstract String healthState();
-
-      @SerializedNames({"ipAddress", "port", "instance", "healthState"})
-      public static HealthStatus create(String ipAddress, int port, URI instance, String healthState) {
-         return new AutoValue_BackendServiceGroupHealth_HealthStatus(ipAddress, port, instance, healthState);
-      }
-
-      HealthStatus(){
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HealthStatus.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HealthStatus.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HealthStatus.java
new file mode 100644
index 0000000..9d8f65b
--- /dev/null
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HealthStatus.java
@@ -0,0 +1,56 @@
+/*
+ * 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.googlecomputeengine.domain;
+
+import java.net.URI;
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class HealthStatus {
+
+   public abstract List<HealthStatusInternal> healthStatus();
+
+   @SerializedNames({"healthStatus"})
+   public static HealthStatus create(List<HealthStatusInternal> healthStatus){
+      return new AutoValue_HealthStatus(healthStatus);
+   }
+
+   HealthStatus(){
+   }
+
+   @AutoValue
+   public abstract static class HealthStatusInternal {
+
+      @Nullable public abstract String ipAddress();
+      public abstract Integer port();
+      public abstract URI instance();
+      public abstract String healthState();
+
+      @SerializedNames({"ipAddress", "port", "instance", "healthState"})
+      public static HealthStatusInternal create(String ipAddress, int port, URI instance, String healthState) {
+         return new AutoValue_HealthStatus_HealthStatusInternal(ipAddress, port, instance, healthState);
+      }
+
+      HealthStatusInternal(){
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
index 0d49756..00553f7 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
@@ -40,31 +40,23 @@ public abstract class HttpHealthCheck {
     */
    @Nullable public abstract String host();
 
-   public abstract String requestPath();
+   @Nullable public abstract String requestPath();
 
    /** The TCP port number for the HTTP health check request. */
-   public abstract int port();
+   @Nullable public abstract Integer port();
 
    /** How often (in seconds) to send a health check. */
-   public abstract int checkIntervalSec();
+   @Nullable public abstract Integer checkIntervalSec();
 
    /** How long (in seconds) to wait before claiming failure. */
-   public abstract int timeoutSec();
+   @Nullable public abstract Integer timeoutSec();
 
    /** A so-far healthy VM will be marked unhealthy after this many consecutive failures. */
-   public abstract int unhealthyThreshold();
+   @Nullable public abstract Integer unhealthyThreshold();
 
    /** An unhealthy VM will be marked healthy after this many consecutive successes. */
-   public abstract int healthyThreshold();
+   @Nullable public abstract Integer healthyThreshold();
 
-   /**
-    * @param requestPath Defaults to "/" when null.
-    * @param port Defaults to 80 when null.
-    * @param checkIntervalSec Defaults to 5 when null.
-    * @param timeoutSec Defaults to 5 when null.
-    * @param unhealthyThreshold Defaults to 2 when null.
-    * @param healthyThreshold Defaults to 2 when null.
-    */
    @SerializedNames(
          { "id", "selfLink", "name", "description", "host", "requestPath", "port", "checkIntervalSec", "timeoutSec",
                "unhealthyThreshold", "healthyThreshold" })
@@ -72,9 +64,7 @@ public abstract class HttpHealthCheck {
          String requestPath, Integer port, Integer checkIntervalSec, Integer timeoutSec, Integer unhealthyThreshold,
          Integer healthyThreshold) {
       return new AutoValue_HttpHealthCheck(id, selfLink, name, description, host,
-            requestPath != null ? requestPath : "/", port != null ? port : 80,
-            checkIntervalSec != null ? checkIntervalSec : 5, timeoutSec != null ? timeoutSec : 5,
-            unhealthyThreshold != null ? unhealthyThreshold : 2, healthyThreshold != null ? healthyThreshold : 2);
+            requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold);
    }
 
    HttpHealthCheck() {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java
index 55ff6b2..a663e42 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java
@@ -37,6 +37,7 @@ import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.MachineType;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.domain.TargetInstance;
+import org.jclouds.googlecomputeengine.domain.TargetPool;
 import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
 import org.jclouds.googlecomputeengine.options.ListOptions;
 import org.jclouds.javax.annotation.Nullable;
@@ -447,4 +448,54 @@ public interface AggregatedListApi {
             };
       }
    }
+
+   /**
+    * Retrieves the list of TargetPool resources available to the
+    * specified project. By default the list as a maximum size of 100, if no
+    * options are provided or ListOptions#getMaxResults() has not been set.
+    *
+    * @param pageToken
+    *           marks the beginning of the next list page
+    * @param listOptions
+    *           listing options
+    * @return a page of the list
+    */
+   @Named("TargetPool:aggregatedList")
+   @GET
+   @Path("/targetPools")
+   ListPage<TargetPool> pageOfTargetPools(@Nullable @QueryParam("pageToken") String pageToken,
+         ListOptions listOptions);
+
+   /** @see #pageOfTargetPools(String, ListOptions) */
+   @Named("TargetPool:aggregatedList")
+   @GET
+   @Path("/targetPools")
+   @Transform(TargetPoolPages.class)
+   Iterator<ListPage<TargetPool>> targetPools();
+
+   /** @see #pageOfTargetPools(String, ListOptions) */
+   @Named("TargetPool:aggregatedList")
+   @GET
+   @Path("/targetPools")
+   @Transform(TargetPoolPages.class)
+   Iterator<ListPage<TargetPool>> targetPools(ListOptions options);
+
+   static final class TargetPoolPages extends BaseToIteratorOfListPage<TargetPool, TargetPoolPages> {
+      private final GoogleComputeEngineApi api;
+
+      @Inject
+      TargetPoolPages(GoogleComputeEngineApi api) {
+         this.api = api;
+      }
+
+      @Override
+      protected Function<String, ListPage<TargetPool>> fetchNextPage(final ListOptions options) {
+            return new Function<String, ListPage<TargetPool>>() {
+               @Override
+               public ListPage<TargetPool> apply(String pageToken) {
+                  return api.aggregatedList().pageOfTargetPools(pageToken, options);
+               }
+            };
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/BackendServiceApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/BackendServiceApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/BackendServiceApi.java
index f1e3776..629a342 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/BackendServiceApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/BackendServiceApi.java
@@ -37,7 +37,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
 import org.jclouds.googlecloud.domain.ListPage;
 import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.domain.BackendService;
-import org.jclouds.googlecomputeengine.domain.BackendServiceGroupHealth;
+import org.jclouds.googlecomputeengine.domain.HealthStatus;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
 import org.jclouds.googlecomputeengine.options.BackendServiceOptions;
@@ -136,7 +136,7 @@ public interface BackendServiceApi {
    @Produces(APPLICATION_JSON)
    @Path("/{backendService}/getHealth")
    @MapBinder(BindToJsonPayload.class)
-   BackendServiceGroupHealth getHealth(@PathParam("backendService") String backendServiceName,
+   HealthStatus getHealth(@PathParam("backendService") String backendServiceName,
                                        @PayloadParam("group") URI group);
 
    /**

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
index c1153b1..17be6788 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
@@ -122,7 +122,7 @@ public interface HttpHealthCheckApi {
    /**
     * Updates a HttpHealthCheck resource in the specified project using the data included in the request.
     * Any options left blank will be overwritten!
-    * 
+    *
     * @param name the name of the forwarding rule.
     * @param options the options to set for the healthCheck
     * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
index 206a66b..e623c12 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
@@ -39,6 +39,7 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
 import org.jclouds.googlecomputeengine.binders.TargetPoolChangeHealthChecksBinder;
 import org.jclouds.googlecomputeengine.binders.TargetPoolChangeInstancesBinder;
 import org.jclouds.googlecomputeengine.binders.TargetPoolCreationBinder;
+import org.jclouds.googlecomputeengine.domain.HealthStatus;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.domain.TargetPool;
 import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPage;
@@ -105,7 +106,6 @@ public interface TargetPoolApi {
    @POST
    @Path("/{targetPool}/addInstance")
    @MapBinder(TargetPoolChangeInstancesBinder.class)
-   @Nullable
    Operation addInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instances") List<URI> instances);
 
    /**
@@ -121,7 +121,6 @@ public interface TargetPoolApi {
    @POST
    @Path("/{targetPool}/removeInstance")
    @MapBinder(TargetPoolChangeInstancesBinder.class)
-   @Nullable
    Operation removeInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instances") List<URI> instances);
 
    /**
@@ -137,7 +136,6 @@ public interface TargetPoolApi {
    @POST
    @Path("/{targetPool}/addHealthCheck")
    @MapBinder(TargetPoolChangeHealthChecksBinder.class)
-   @Nullable
    Operation addHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthChecks") List<URI> healthChecks);
 
 
@@ -150,13 +148,27 @@ public interface TargetPoolApi {
     * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
     *         you, and look for the status field.
     */
-   @Named("TargetPools:removeHealthChek")
+   @Named("TargetPools:removeHealthCheck")
    @POST
    @Path("/{targetPool}/removeHealthCheck")
    @MapBinder(TargetPoolChangeHealthChecksBinder.class)
-   @Nullable
    Operation removeHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthChecks") List<URI> healthChecks);
 
+   /**
+    * Gets the HealthStatus of an instance in a targetPool.
+    *
+    * @param targetPool the name of the target pool.
+    * @param healthChecks the self-links of the health checks to be removed from the targetPool.
+    *
+    * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
+    *         you, and look for the status field.
+    */
+   @Named("TargetPools:getHealth")
+   @POST
+   @Path("/{targetPool}/getHealth")
+   @MapBinder(BindToJsonPayload.class)
+   HealthStatus getHealth(@PathParam("targetPool") String targetPool, @PayloadParam("instance") URI instance);
+
 
    /**
     * Changes backup pool configurations.

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
index 705b01b..a7af465 100644
--- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
+++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
@@ -16,145 +16,154 @@
  */
 package org.jclouds.googlecomputeengine.options;
 
-public class HttpHealthCheckCreationOptions {
-
-   private String host;
-   private String requestPath;
-   private Integer port;
-   private Integer checkIntervalSec;
-   private Integer timeoutSec;
-   private Integer unhealthyThreshold;
-   private Integer healthyThreshold;
-   private String description;
-
-   /**
-    * The value of the host header in the HTTP health check request.
-    * @return host
-    */
-   public String host(){
-      return host;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class HttpHealthCheckCreationOptions {
+
+   @Nullable public abstract String host();
+   @Nullable public abstract String requestPath();
+   @Nullable public abstract Integer port();
+   @Nullable public abstract Integer checkIntervalSec();
+   @Nullable public abstract Integer timeoutSec();
+   @Nullable public abstract Integer unhealthyThreshold();
+   @Nullable public abstract Integer healthyThreshold();
+   @Nullable public abstract String description();
+
+   static final String DEFAULT_REQUEST_PATH = "/";
+   static final Integer DEFAULT_PORT = 80;
+   static final Integer DEFAULT_CHECK_INTERVAL_SEC = 5;
+   static final Integer DEFAULT_TIMEOUT_SEC = 5;
+   static final Integer DEFAULT_UNHEALTHY_THRESHOLD = 2;
+   static final Integer DEFAULT_HEALTHY_THRESHOLD = 2;
+
+   /*
+    * Currently GCE is not setting the advertised defaults so we do so here.
+    * This only leads to trouble in the case of a PATCH operation which we now
+    * have a workaround for.
+    */
+   /**
+    * @param requestPath Defaults to {@value #DEFAULT_REQUEST_PATH} when null.
+    * @param port Defaults to {@value #DEFAULT_PORT} when null.
+    * @param checkIntervalSec Defaults to {@value #DEFAULT_CHECK_INTERVAL_SEC} when null.
+    * @param timeoutSec Defaults to {@value #DEFAULT_TIMEOUT_SEC} when null.
+    * @param unhealthyThreshold Defaults to {@value #DEFAULT_UNHEALTHY_THRESHOLD} when null.
+    * @param healthyThreshold Defaults to {@value #DEFAULT_HEALTHY_THRESHOLD} when null.
+    */
+   static HttpHealthCheckCreationOptions createWithDefaults(String host,
+         String requestPath, Integer port, Integer checkIntervalSec, Integer timeoutSec, Integer unhealthyThreshold,
+         Integer healthyThreshold, String description) {
+      return create(host, requestPath != null ? requestPath : DEFAULT_REQUEST_PATH, port != null ? port : DEFAULT_PORT,
+            checkIntervalSec != null ? checkIntervalSec : DEFAULT_CHECK_INTERVAL_SEC,
+            timeoutSec != null ? timeoutSec : DEFAULT_TIMEOUT_SEC,
+            unhealthyThreshold != null ? unhealthyThreshold : DEFAULT_UNHEALTHY_THRESHOLD,
+            healthyThreshold != null ? healthyThreshold : DEFAULT_HEALTHY_THRESHOLD, description);
+   }
+
+   @SerializedNames(
+         { "host", "requestPath", "port", "checkIntervalSec", "timeoutSec",
+               "unhealthyThreshold", "healthyThreshold", "description"})
+   static HttpHealthCheckCreationOptions create(String host, String requestPath, Integer port,
+         Integer checkIntervalSec, Integer timeoutSec, Integer unhealthyThreshold,
+         Integer healthyThreshold, String description) {
+      return new AutoValue_HttpHealthCheckCreationOptions(host, requestPath, port,
+            checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description);
+   }
+
+   HttpHealthCheckCreationOptions() {
+   }
+
+   public static class Builder {
+
+      private String host;
+      private String requestPath;
+      private Integer port;
+      private Integer checkIntervalSec;
+      private Integer timeoutSec;
+      private Integer unhealthyThreshold;
+      private Integer healthyThreshold;
+      private String description;
+
+
+      /** The value of the host header in the HTTP health check request. */
+      public Builder host(String host){
+         this.host = host;
+         return this;
+      }
+
+      /** The request path of the HTTP health check request. The default value is {@value #DEFAULT_REQUEST_PATH}. */
+      public Builder requestPath(String requestPath){
+         this.requestPath = requestPath;
+         return this;
+      }
+
+      /** The TCP port number for the HTTP health check request. The default value is {@value #DEFAULT_PORT}. */
+      public Builder port(Integer port){
+         this.port = port;
+         return this;
+      }
+
+      /** How often (in seconds) to send a health check. The default value is {@value #DEFAULT_CHECK_INTERVAL_SEC} seconds. */
+      public Builder checkIntervalSec(Integer checkIntervalSec){
+         this.checkIntervalSec = checkIntervalSec;
+         return this;
+      }
+
+      /** How long (in seconds) to wait before claiming failure. The default value is {@value #DEFAULT_TIMEOUT_SEC} seconds. */
+      public Builder timeoutSec(Integer timeoutSec){
+         this.timeoutSec = timeoutSec;
+         return this;
+      }
+
+      /**
+       * A so-far healthy VM will be marked unhealthy after this many consecutive failures.
+       * The default value is {@value #DEFAULT_UNHEALTHY_THRESHOLD}.
+       */
+      public Builder unhealthyThreshold(Integer unhealthyThreshold){
+         this.unhealthyThreshold = unhealthyThreshold;
+         return this;
+      }
+
+      /**
+       * An unhealthy VM will be marked healthy after this many consecutive successes.
+       * The default value is {@value #DEFAULT_HEALTHY_THRESHOLD}.
+       */
+      public Builder healthyThreshold(Integer healthyThreshold){
+         this.healthyThreshold = healthyThreshold;
+         return this;
+      }
+
+      /** An optional textual description of the TargetPool. */
+      public Builder description(String description){
+         this.description = description;
+         return this;
+      }
+
+      /**
+       * Fields left as null will be replaced with their default before the request
+       * is made.
+       * @param requestPath Defaults to {@value #DEFAULT_REQUEST_PATH} when null.
+       * @param port Defaults to {@value #DEFAULT_PORT} when null.
+       * @param checkIntervalSec Defaults to {@value #DEFAULT_CHECK_INTERVAL_SEC} when null.
+       * @param timeoutSec Defaults to {@value #DEFAULT_TIMEOUT_SEC} when null.
+       * @param unhealthyThreshold Defaults to {@value #DEFAULT_UNHEALTHY_THRESHOLD} when null.
+       * @param healthyThreshold Defaults to {@value #DEFAULT_HEALTHY_THRESHOLD} when null.
+       */
+      public HttpHealthCheckCreationOptions buildWithDefaults() {
+         return HttpHealthCheckCreationOptions.createWithDefaults(host, requestPath, port,
+               checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description);
+      }
+
+      /**
+       * Useful when performing a PATCH operation and you do not want to overwrite
+       * unspecified values with the default values.
+       */
+      public HttpHealthCheckCreationOptions buildNoDefaults() {
+         return HttpHealthCheckCreationOptions.create(host, requestPath, port,
+               checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description);
+      }
    }
-
-   /**
-    * The request path of the HTTP health check request. The default value is /.
-    * @return requestPath
-    */
-   public String requestPath(){
-      return requestPath;
-   }
-
-   /**
-    * The TCP port number for the HTTP health check request. The default value is 80.
-    * @return port
-    */
-   public Integer port(){
-      return port;
-   }
-
-   /**
-    * How often (in seconds) to send a health check. The default value is 5 seconds.
-    * @return checkIntervalSec
-    */
-   public Integer checkIntervalSec(){
-      return checkIntervalSec;
-   }
-
-   /**
-    * How long (in seconds) to wait before claiming failure. The default value is 5 seconds. 
-    * @return timeoutSec
-    */
-   public Integer timeoutSec(){
-      return timeoutSec;
-   }
-
-   /**
-    * A so-far healthy VM will be marked unhealthy after this many consecutive failures.
-    * The default value is 2.
-    * @return unhealthyThreashold
-    */
-   public Integer unhealthyThreshold(){
-      return unhealthyThreshold;
-   }
-
-   /**
-    * An unhealthy VM will be marked healthy after this many consecutive successes.
-    * The default value is 2.
-    * @return healthyThreashold
-    */
-   public Integer healthyThreshold(){
-      return healthyThreshold;
-   }
-
-   /**
-    * An optional textual description of the TargetPool.
-    * @return description, provided by the client.
-    */
-   public String description(){
-      return description;
-   }
-
-   /**
-    * @see HttpHealthCheckCreationOptions#host()
-    */
-   public HttpHealthCheckCreationOptions host(String host){
-      this.host = host;
-      return this;
-   }
-
-   /**
-    * @see HttpHealthCheckCreationOptions#requestPath()
-    */
-   public HttpHealthCheckCreationOptions requestPath(String requestPath){
-      this.requestPath = requestPath;
-      return this;
-   }
-
-   /**
-    * @see HttpHealthCheckCreationOptions#port()
-    */
-   public HttpHealthCheckCreationOptions port(Integer port){
-      this.port = port;
-      return this;
-   }
-
-   /**
-    * @see HttpHealthCheckCreationOptions#checkIntervalSec()
-    */
-   public HttpHealthCheckCreationOptions checkIntervalSec(Integer checkIntervalSec){
-      this.checkIntervalSec = checkIntervalSec;
-      return this;
-   }
-
-   /**
-    * @see HttpHealthCheckCreationOptions#timeoutSec()
-    */
-   public HttpHealthCheckCreationOptions timeoutSec(Integer timeoutSec){
-      this.timeoutSec = timeoutSec;
-      return this;
-   }
-
-   /**
-    * @see HttpHealthCheckCreationOptions#unhealthyThreshold()
-    */
-   public HttpHealthCheckCreationOptions unhealthyThreshold(Integer unhealthyThreshold){
-      this.unhealthyThreshold = unhealthyThreshold;
-      return this;
-   }
-
-   /**
-    * @see HttpHealthCheckCreationOptions#healthyThreshold()
-    */
-   public HttpHealthCheckCreationOptions healthyThreshold(Integer healthyThreshold){
-      this.healthyThreshold = healthyThreshold;
-      return this;
-   }
-
-   /**
-    * @see HttpHealthCheckCreationOptions#description()
-    */
-   public HttpHealthCheckCreationOptions description(String description){
-      this.description = description;
-      return this;
-   }
-
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinderTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinderTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinderTest.java
index e9a8fe4..fa4466f 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinderTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/binders/HttpHealthCheckCreationBinderTest.java
@@ -32,7 +32,7 @@ import com.google.gson.Gson;
 
 @Test(groups = "unit", testName = "HttpHealthCheckCreationBinderTest")
 public class HttpHealthCheckCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
-   
+
    private String NAME = "testHttpHealthCheck";
    private Integer TIMEOUTSEC = 3;
    private Integer UNHEALTHYTHRESHOLD = 5;
@@ -40,15 +40,16 @@ public class HttpHealthCheckCreationBinderTest extends BaseGoogleComputeEngineEx
    private static String DESCRIPTION = "This is a test!";
 
    Json json = new GsonWrapper(new Gson());
- 
+
    @Test
    public void testMap() throws SecurityException, NoSuchMethodException {
       HttpHealthCheckCreationBinder binder = new HttpHealthCheckCreationBinder(json);
-      HttpHealthCheckCreationOptions httpHealthCheckCreationOptions = new HttpHealthCheckCreationOptions()
+      HttpHealthCheckCreationOptions httpHealthCheckCreationOptions = new HttpHealthCheckCreationOptions.Builder()
                                                                               .timeoutSec(TIMEOUTSEC)
                                                                               .unhealthyThreshold(UNHEALTHYTHRESHOLD)
                                                                               .healthyThreshold(HEALTHYTHRESHOLD)
-                                                                              .description(DESCRIPTION);
+                                                                              .description(DESCRIPTION)
+                                                                              .buildWithDefaults();
 
       HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
       Map<String, Object> postParams = ImmutableMap.of("name", NAME, "options", httpHealthCheckCreationOptions);
@@ -56,8 +57,11 @@ public class HttpHealthCheckCreationBinderTest extends BaseGoogleComputeEngineEx
       binder.bindToRequest(request, postParams);
 
       assertEquals(request.getPayload().getRawContent(),
-            "{\""
-            + "name\":\"" + NAME + "\","
+            "{"
+            + "\"name\":\"" + NAME + "\","
+            + "\"requestPath\":\"/\","
+            + "\"port\":80,"
+            + "\"checkIntervalSec\":5,"
             + "\"timeoutSec\":" + TIMEOUTSEC + ","
             + "\"unhealthyThreshold\":" + UNHEALTHYTHRESHOLD + ","
             + "\"healthyThreshold\":" + HEALTHYTHRESHOLD + ","

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
index c1e2f62..00bb650 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiLiveTest.java
@@ -31,6 +31,7 @@ import org.jclouds.googlecomputeengine.domain.ForwardingRule;
 import org.jclouds.googlecomputeengine.domain.MachineType;
 import org.jclouds.googlecomputeengine.domain.Operation;
 import org.jclouds.googlecomputeengine.domain.TargetInstance;
+import org.jclouds.googlecomputeengine.domain.TargetPool;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
 import org.testng.SkipException;
 import org.testng.annotations.Test;
@@ -147,4 +148,21 @@ public class AggregatedListApiLiveTest extends BaseGoogleComputeEngineApiLiveTes
       }
       assertEquals(count, 2);
    }
+
+   public void targetPools() {
+      Iterator<ListPage<TargetPool>> pageIterator = api().targetPools(maxResults(1));
+      // make sure that in spite of having only one result per page we get at
+      // least two results
+      int count = 0;
+      for (; count < 2 && pageIterator.hasNext();) {
+         ListPage<TargetPool> result = pageIterator.next();
+         if (!result.isEmpty()) {
+            count++;
+         }
+      }
+      if (count < 2) {
+         throw new SkipException("Not enough target pools");
+      }
+      assertEquals(count, 2);
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
index a02ec07..1d8bf0a 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
@@ -35,7 +35,7 @@ public class AggregatedListApiMockTest extends BaseGoogleComputeEngineApiMockTes
       assertSent(server, "GET", "/projects/party/aggregated/machineTypes");
    }
 
-   public void machineTypesResponseIs4xx() throws Exception {
+   public void machineTypes_4xx() throws Exception {
       server.enqueue(jsonResponse("/aggregated_instance_list_empty.json"));
 
       AggregatedListApi aggregatedList = api().aggregatedList();
@@ -55,7 +55,7 @@ public class AggregatedListApiMockTest extends BaseGoogleComputeEngineApiMockTes
       assertSent(server, "GET", "/projects/party/aggregated/instances");
    }
 
-   public void instancesResponseIs4xx() throws Exception {
+   public void instances_4xx() throws Exception {
       server.enqueue(jsonResponse("/aggregated_instance_list_empty.json"));
 
       AggregatedListApi aggregatedList = api().aggregatedList();
@@ -75,7 +75,7 @@ public class AggregatedListApiMockTest extends BaseGoogleComputeEngineApiMockTes
       assertSent(server, "GET", "/projects/party/aggregated/addresses");
    }
 
-   public void addressesResponseIs4xx() throws Exception {
+   public void addresses_4xx() throws Exception {
       server.enqueue(jsonResponse("/aggregated_address_list_empty.json"));
 
       AggregatedListApi aggregatedList = api().aggregatedList();
@@ -95,7 +95,7 @@ public class AggregatedListApiMockTest extends BaseGoogleComputeEngineApiMockTes
       assertSent(server, "GET", "/projects/party/aggregated/disks");
    }
 
-   public void disksResponseIs4xx() throws Exception {
+   public void disks_4xx() throws Exception {
       server.enqueue(jsonResponse("/aggregated_disk_list_empty.json"));
 
       AggregatedListApi aggregatedList = api().aggregatedList();
@@ -115,7 +115,7 @@ public class AggregatedListApiMockTest extends BaseGoogleComputeEngineApiMockTes
       assertSent(server, "GET", "/projects/party/aggregated/diskTypes");
    }
 
-   public void diskTypesResponseIs4xx() throws Exception {
+   public void diskTypes_4xx() throws Exception {
       server.enqueue(jsonResponse("/aggregated_disktype_list_empty.json"));
 
       AggregatedListApi aggregatedList = api().aggregatedList();
@@ -135,7 +135,7 @@ public class AggregatedListApiMockTest extends BaseGoogleComputeEngineApiMockTes
       assertSent(server, "GET", "/projects/party/aggregated/operations");
    }
 
-   public void globalOperationsResponseIs4xx() throws Exception {
+   public void globalOperations_4xx() throws Exception {
       server.enqueue(jsonResponse("/aggregated_global_operation_list_empty.json"));
 
       AggregatedListApi aggregatedList = api().aggregatedList();
@@ -175,7 +175,7 @@ public class AggregatedListApiMockTest extends BaseGoogleComputeEngineApiMockTes
       assertSent(server, "GET", "/projects/party/aggregated/targetInstances");
    }
 
-   public void targetInstancesResponseIs4xx() throws Exception {
+   public void targetInstances_4xx() throws Exception {
       server.enqueue(jsonResponse("/aggregated_target_instance_list_empty.json"));
 
       AggregatedListApi aggregatedList = api().aggregatedList();
@@ -184,4 +184,24 @@ public class AggregatedListApiMockTest extends BaseGoogleComputeEngineApiMockTes
 
       assertSent(server, "GET", "/projects/party/aggregated/targetInstances");
    }
+
+   public void targetPools() throws Exception {
+      server.enqueue(jsonResponse("/aggregated_target_pool_list.json"));
+
+      AggregatedListApi aggregatedList = api().aggregatedList();
+
+      assertTrue(aggregatedList.targetPools().hasNext());
+
+      assertSent(server, "GET", "/projects/party/aggregated/targetPools");
+   }
+
+   public void targetPools_4xx() throws Exception {
+      server.enqueue(jsonResponse("/aggregated_target_pool_list_empty.json"));
+
+      AggregatedListApi aggregatedList = api().aggregatedList();
+
+      assertFalse(aggregatedList.targetPools().hasNext());
+
+      assertSent(server, "GET", "/projects/party/aggregated/targetPools");
+   }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
index 0434401..ba5bfe0 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/BackendServiceApiMockTest.java
@@ -25,7 +25,7 @@ import java.util.List;
 
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
 import org.jclouds.googlecomputeengine.options.BackendServiceOptions;
-import org.jclouds.googlecomputeengine.parse.ParseBackendServiceGetHealthTest;
+import org.jclouds.googlecomputeengine.parse.ParseHealthStatusTest;
 import org.jclouds.googlecomputeengine.parse.ParseBackendServiceListTest;
 import org.jclouds.googlecomputeengine.parse.ParseBackendServiceTest;
 import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
@@ -118,13 +118,13 @@ public class BackendServiceApiMockTest extends BaseGoogleComputeEngineApiMockTes
    }
 
    public void getHealth() throws Exception {
-      server.enqueue(jsonResponse("/backend_service_get_health.json"));
+      server.enqueue(jsonResponse("/health_status_get_health.json"));
 
       URI group = URI.create("https://www.googleapis.com/resourceviews/v1beta1/"
             + "projects/myproject/zones/us-central1-a/"
             + "resourceViews/jclouds-test");
       assertEquals(backendServiceApi().getHealth("jclouds-test", group),
-            new ParseBackendServiceGetHealthTest().expected(url("/projects")));
+            new ParseHealthStatusTest().expected(url("/projects")));
 
       assertSent(server, "POST", "/projects/party/global/backendServices/jclouds-test/getHealth",
             stringFromResource("/backend_service_get_health_request.json"));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
index 1e1549a..2b50537 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
@@ -39,7 +39,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineExpectT
             .endpoint(BASE_URL + "/party/global/httpHealthChecks/" + healthCheckName)
             .addHeader("Accept", "application/json")
             .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
+            .payload(payloadFromResourceWithContentType("/httphealthcheck_patch.json", MediaType.APPLICATION_JSON))
             .build();
 
        HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200)
@@ -48,7 +48,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineExpectT
        HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
                TOKEN_RESPONSE, patch,
                insertHttpHealthCheckResponse).httpHeathChecks();
-       HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
+       HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions.Builder().timeoutSec(0).unhealthyThreshold(0).buildNoDefaults();
        assertEquals(api.patch(healthCheckName, options), new ParseGlobalOperationTest().expected());
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
index e8863da..ec2cad8 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java
@@ -32,7 +32,7 @@ import com.google.common.collect.Iterables;
 public class HttpHealthCheckApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    private static final String HTTP_HEALTH_CHECK_NAME = "http-health-check-api-live-test";
-   private static final int OFFSET = 2;
+   private static final Integer OFFSET = 2;
 
    private HttpHealthCheckCreationOptions options;
 
@@ -42,13 +42,14 @@ public class HttpHealthCheckApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
 
    @Test(groups = "live")
    public void testInsertHttpHealthCheck() {
-      options = new HttpHealthCheckCreationOptions()
+      options = new HttpHealthCheckCreationOptions.Builder()
                      .port(56)
                      .checkIntervalSec(40)
                      .timeoutSec(40)
                      .healthyThreshold(30)
                      .unhealthyThreshold(15)
-                     .description("A First Health Check!");
+                     .description("A First Health Check!")
+                     .buildWithDefaults();
       assertOperationDoneSuccessfully(api().insert(HTTP_HEALTH_CHECK_NAME, options));
    }
 
@@ -57,11 +58,11 @@ public class HttpHealthCheckApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
       HttpHealthCheck httpHealthCheck = api().get(HTTP_HEALTH_CHECK_NAME);
       assertNotNull(httpHealthCheck);
       assertEquals(httpHealthCheck.name(), HTTP_HEALTH_CHECK_NAME);
-      assertEquals(httpHealthCheck.port(), options.port().intValue());
-      assertEquals(httpHealthCheck.checkIntervalSec(), options.checkIntervalSec().intValue());
-      assertEquals(httpHealthCheck.timeoutSec(), options.timeoutSec().intValue());
-      assertEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold().intValue());
-      assertEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold().intValue());
+      assertEquals(httpHealthCheck.port(), options.port());
+      assertEquals(httpHealthCheck.checkIntervalSec(), options.checkIntervalSec());
+      assertEquals(httpHealthCheck.timeoutSec(), options.timeoutSec());
+      assertEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold());
+      assertEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold());
       assertEquals(httpHealthCheck.description(), options.description());
    }
 
@@ -73,44 +74,46 @@ public class HttpHealthCheckApiLiveTest extends BaseGoogleComputeEngineApiLiveTe
 
    @Test(groups = "live", dependsOnMethods = "testGetHttpHealthCheck")
    public void testPatchHttpHealthCheck() {
-      HttpHealthCheckCreationOptions newOptions = new HttpHealthCheckCreationOptions()
+      HttpHealthCheckCreationOptions newOptions = new HttpHealthCheckCreationOptions.Builder()
          .port(options.port() + OFFSET)
          .checkIntervalSec(options.checkIntervalSec() + OFFSET)
-         .timeoutSec(options.timeoutSec() + OFFSET);
+         .timeoutSec(options.timeoutSec() + OFFSET)
+         .buildNoDefaults();
       assertOperationDoneSuccessfully(api().patch(HTTP_HEALTH_CHECK_NAME, newOptions));
 
       // Check changes happened and others unchanged.
       HttpHealthCheck httpHealthCheck = api().get(HTTP_HEALTH_CHECK_NAME);
       assertNotNull(httpHealthCheck);
       assertEquals(httpHealthCheck.name(), HTTP_HEALTH_CHECK_NAME);
-      assertEquals(httpHealthCheck.port(), newOptions.port().intValue());
-      assertEquals(httpHealthCheck.checkIntervalSec(), newOptions.checkIntervalSec().intValue());
-      assertEquals(httpHealthCheck.timeoutSec(), newOptions.timeoutSec().intValue());
-      assertEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold().intValue());
-      assertEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold().intValue());
+      assertEquals(httpHealthCheck.port(), newOptions.port());
+      assertEquals(httpHealthCheck.checkIntervalSec(), newOptions.checkIntervalSec());
+      assertEquals(httpHealthCheck.timeoutSec(), newOptions.timeoutSec());
+      assertEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold());
+      assertEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold());
       assertEquals(httpHealthCheck.description(), options.description());
    }
 
    @Test(groups = "live", dependsOnMethods = "testPatchHttpHealthCheck")
    public void testUpdateHttpHealthCheck() {
-      HttpHealthCheckCreationOptions newOptions = new HttpHealthCheckCreationOptions()
+      HttpHealthCheckCreationOptions newOptions = new HttpHealthCheckCreationOptions.Builder()
          .checkIntervalSec(options.checkIntervalSec() - OFFSET)
-         .timeoutSec(options.timeoutSec() - OFFSET);
+         .timeoutSec(options.timeoutSec() - OFFSET)
+         .buildWithDefaults();
       assertOperationDoneSuccessfully(api().update(HTTP_HEALTH_CHECK_NAME, newOptions));
 
       // Check changes happened.
       HttpHealthCheck httpHealthCheck = api().get(HTTP_HEALTH_CHECK_NAME);
       assertNotNull(httpHealthCheck);
       assertEquals(httpHealthCheck.name(), HTTP_HEALTH_CHECK_NAME);
-      assertEquals(httpHealthCheck.checkIntervalSec(), newOptions.checkIntervalSec().intValue());
-      assertEquals(httpHealthCheck.timeoutSec(), newOptions.timeoutSec().intValue());
+      assertEquals(httpHealthCheck.checkIntervalSec(), newOptions.checkIntervalSec());
+      assertEquals(httpHealthCheck.timeoutSec(), newOptions.timeoutSec());
       // Update overwrites unspecified parameters to their defaults.
       assertNotEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold());
       assertNotEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold());
       assertNotEquals(httpHealthCheck.description(), options.description());
    }
 
-   @Test(groups = "live", dependsOnMethods = {"testListHttpHealthCheck", "testUpdateHttpHealthCheck"})
+   @Test(groups = "live", dependsOnMethods = {"testListHttpHealthCheck", "testUpdateHttpHealthCheck"}, alwaysRun = true)
    public void testDeleteHttpHealthCheck() {
       assertOperationDoneSuccessfully(api().delete(HTTP_HEALTH_CHECK_NAME));
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
index 35b4e03..2943a33 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiMockTest.java
@@ -49,8 +49,8 @@ public class HttpHealthCheckApiMockTest extends BaseGoogleComputeEngineApiMockTe
    public void insert() throws Exception {
       server.enqueue(jsonResponse("/global_operation.json"));
 
-      HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions()
-         .timeoutSec(0).unhealthyThreshold(0);
+      HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions.Builder()
+         .timeoutSec(0).unhealthyThreshold(0).buildWithDefaults();
       assertEquals(httpHealthCheckApi().insert("http-health-check", options),
             new ParseGlobalOperationTest().expected(url("/projects")));
 
@@ -78,8 +78,8 @@ public class HttpHealthCheckApiMockTest extends BaseGoogleComputeEngineApiMockTe
    public void update() throws Exception {
       server.enqueue(jsonResponse("/global_operation.json"));
 
-      HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions()
-         .timeoutSec(0).unhealthyThreshold(0);
+      HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions.Builder()
+         .timeoutSec(0).unhealthyThreshold(0).buildWithDefaults();
       assertEquals(httpHealthCheckApi().update("http-health-check", options),
             new ParseGlobalOperationTest().expected(url("/projects")));
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java
deleted file mode 100644
index 6d5c4a7..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
-import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
-import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
-import org.jclouds.googlecomputeengine.parse.ParseTargetPoolListTest;
-import org.jclouds.googlecomputeengine.parse.ParseTargetPoolTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "TargetPoolApiExpectTest")
-public class TargetPoolApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
-
-   private static final List<URI> INSTANCES = ImmutableList
-         .of(URI.create(BASE_URL + "/party/zones/europe-west1-a/instances/test"));
-
-   private static final List<URI> HEALTH_CHECKS = ImmutableList
-         .of(URI.create(BASE_URL + "/party/global/httpHealthChecks/health-check-1"));
-   
-   private static final URI TARGET_POOL = URI.create(BASE_URL + "/party/regions/us-central1/targetPools/tpool");
-   
-   public void testGetTargetPoolResponseIs2xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/regions/us-central1/targetPools/test")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/targetpool_get.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).targetPoolsInRegion("us-central1");
-
-      assertEquals(api.get("test"), new ParseTargetPoolTest().expected());
-   }
-
-   public void testGetTargetPoolResponseIs4xx() throws Exception {
-      HttpRequest get = HttpRequest
-              .builder()
-              .method("GET")
-              .endpoint(BASE_URL + "/party/regions/us-central1/targetPools/test")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse response = HttpResponse.builder().statusCode(404).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, get, response).targetPoolsInRegion("us-central1");
-
-      assertNull(api.get("test"));
-   }
-
-   public void testInsertTargetPoolResponseIs2xx() {
-      HttpRequest insert = HttpRequest
-              .builder()
-              .method("POST")
-              .endpoint(BASE_URL + "/party/regions/us-central1/targetPools")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN)
-              .payload(payloadFromResourceWithContentType("/targetpool_insert.json", MediaType.APPLICATION_JSON))
-              .build();
-
-      HttpResponse insertTargetPoolResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/region_operation.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, insert,
-              insertTargetPoolResponse).targetPoolsInRegion("us-central1");
-      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions();
-      assertEquals(api.create("test", targetPoolCreationOptions), new ParseRegionOperationTest().expected());
-   }
-
-   public void testDeleteTargetPoolResponseIs2xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/regions/us-central1/targetPools/test-targetPool")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/region_operation.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).targetPoolsInRegion("us-central1");
-
-      assertEquals(api.delete("test-targetPool"),
-              new ParseRegionOperationTest().expected());
-   }
-
-   public void testDeleteTargetPoolResponseIs4xx() {
-      HttpRequest delete = HttpRequest
-              .builder()
-              .method("DELETE")
-              .endpoint(BASE_URL + "/party/regions/us-central1/targetPools/test-targetPool")
-              .addHeader("Accept", "application/json")
-              .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-      HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, delete, deleteResponse).targetPoolsInRegion("us-central1");
-
-      assertNull(api.delete("test-targetPool"));
-   }
-
-   HttpRequest list = HttpRequest
-         .builder()
-         .method("GET")
-         .endpoint(BASE_URL + "/party/regions/us-central1/targetPools")
-         .addHeader("Accept", "application/json")
-         .addHeader("Authorization", "Bearer " + TOKEN).build();
-
-   public void list() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/targetpool_list.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).targetPoolsInRegion("us-central1");
-
-      assertEquals(api.list().next(), new ParseTargetPoolListTest().expected());
-   }
-
-   public void listEmpty() {
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/list_empty.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
-              TOKEN_RESPONSE, list, response).targetPoolsInRegion("us-central1");
-
-      assertFalse(api.list().hasNext());
-   }
-
-   public void testAddInstanceResponseIs2xx() throws Exception {
-      HttpRequest addInstance = makeGenericRequest("POST", "addInstance", "/targetpool_addinstance.json");
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/region_operation.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, addInstance, response).targetPoolsInRegion("us-central1");
-
-      assertEquals(api.addInstance("test", INSTANCES),
-              new ParseRegionOperationTest().expected());
-   }
-   
-   public void testRemoveInstanceResponseIs2xx(){
-      HttpRequest removeInstance = makeGenericRequest("POST", "removeInstance", "/targetpool_addinstance.json");
-      
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, removeInstance, response).targetPoolsInRegion("us-central1");
-
-      assertEquals(api.removeInstance("test", INSTANCES),
-            new ParseRegionOperationTest().expected());
-   }
-   
-   public void testAddHealthCheckResponseIs2xx(){
-      HttpRequest addHealthCheck = makeGenericRequest("POST", "addHealthCheck", "/targetpool_changehealthcheck.json");
-      
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, addHealthCheck, response).targetPoolsInRegion("us-central1");
-
-      assertEquals(api.addHealthCheck("test", HEALTH_CHECKS), new ParseRegionOperationTest().expected());
-   }
-
-   public void testRemoveHealthCheckResponseIs2xx(){
-      HttpRequest removeHealthCheck = makeGenericRequest("POST", "removeHealthCheck", "/targetpool_changehealthcheck.json");
-      
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, removeHealthCheck, response).targetPoolsInRegion("us-central1");
-
-      assertEquals(api.removeHealthCheck("test", HEALTH_CHECKS), new ParseRegionOperationTest().expected());
-   }
-
-   public void testSetBackupResponseIs2xx(){
-      HttpRequest SetBackup = HttpRequest
-            .builder()
-            .method("POST")
-            .endpoint(BASE_URL + "/party/regions/us-central1/targetPools/testpool/setBackup")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType("/targetpool_setbackup.json", MediaType.APPLICATION_JSON))
-            .build();
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, SetBackup, response).targetPoolsInRegion("us-central1");
-
-      assertEquals(api.setBackup("testpool", TARGET_POOL), new ParseRegionOperationTest().expected());
-   }
-   
-   public void testSetBackupWithFailoverRatioResponseIs2xx(){
-      HttpRequest SetBackup = HttpRequest
-            .builder()
-            .method("POST")
-            .endpoint(BASE_URL + "/party/regions/"
-                    + "us-central1/targetPools/testpool/setBackup?failoverRatio=0.5")
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType("/targetpool_setbackup.json", MediaType.APPLICATION_JSON))
-            .build();
-      HttpResponse response = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResource("/region_operation.json")).build();
-
-      TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-            TOKEN_RESPONSE, SetBackup, response).targetPoolsInRegion("us-central1");
-
-      Float failoverRatio = Float.valueOf("0.5");
-      assertEquals(api.setBackup("testpool", failoverRatio, TARGET_POOL), new ParseRegionOperationTest().expected());
-   }
-
-   public HttpRequest makeGenericRequest(String method, String endpoint, String requestPayloadFile){
-      HttpRequest request = HttpRequest
-            .builder()
-            .method(method)
-            .endpoint(BASE_URL + "/party/regions/us-central1/targetPools/test/" + endpoint)
-            .addHeader("Accept", "application/json")
-            .addHeader("Authorization", "Bearer " + TOKEN)
-            .payload(payloadFromResourceWithContentType(requestPayloadFile, MediaType.APPLICATION_JSON))
-            .build();
-      return request;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
index 1744076..d94a616 100644
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java
@@ -26,12 +26,15 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.jclouds.googlecloud.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.HealthStatus;
 import org.jclouds.googlecomputeengine.domain.HttpHealthCheck;
 import org.jclouds.googlecomputeengine.domain.Image;
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.NewInstance;
 import org.jclouds.googlecomputeengine.domain.TargetPool;
+import org.jclouds.googlecomputeengine.domain.ForwardingRule.IPProtocol;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
 import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
 import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
 import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
@@ -54,8 +57,7 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    private static final String INSTANCE_NAME = "target-pool-api-live-test-instance";
    private static final String IPV4_RANGE = "10.0.0.0/8";
    private static final String HEALTHCHECK_NAME = "target-pool-test-health-check";
-
-   private static final int DEFAULT_DISK_SIZE_GB = 10;
+   private static final String FORWARDING_RULE_NAME = "target-pool-api-forwarding-rule";
 
    private List<URI> instances;
    private List<URI> httpHealthChecks;
@@ -64,7 +66,7 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       return api.targetPoolsInRegion(DEFAULT_REGION_NAME);
    }
 
-   @Test(groups = "live")
+   @Test(groups = "live", dependsOnMethods = "testInsertTargetPool2")
    public void testCreateInstanceAndHealthCheck(){
       InstanceApi instanceApi = api.instancesInZone(DEFAULT_ZONE_NAME);
       HttpHealthCheckApi httpHealthCheckApi = api.httpHeathChecks();
@@ -99,14 +101,27 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       instances.add(instance.selfLink());
 
       // Create a healthCheck
-      HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions()
-         .checkIntervalSec(30)
-         .timeoutSec(20)
-         .description("A test HealthCheck for adding to targetPools");
+      HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions.Builder()
+         .checkIntervalSec(3)
+         .timeoutSec(2)
+         .description("A test HealthCheck for adding to targetPools")
+         .buildWithDefaults();
       assertOperationDoneSuccessfully(httpHealthCheckApi.insert(HEALTHCHECK_NAME, options));
       HttpHealthCheck healthCheck = httpHealthCheckApi.get(HEALTHCHECK_NAME);
       httpHealthChecks = new ArrayList<URI>();
       httpHealthChecks.add(healthCheck.selfLink());
+
+      // Create a forwarding rule
+      TargetPool targetPool = api().get(TARGETPOOL_NAME);
+      URI target = targetPool.selfLink();
+
+      ForwardingRuleCreationOptions forwardingRuleOptions = new ForwardingRuleCreationOptions()
+         .ipProtocol(IPProtocol.TCP)
+         .portRange("80-80")
+         .target(target);
+
+      assertOperationDoneSuccessfully(api.forwardingRulesInRegion(DEFAULT_REGION_NAME)
+               .create(FORWARDING_RULE_NAME, forwardingRuleOptions));
    }
 
    @Test(groups = "live")
@@ -148,24 +163,13 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    @Test(groups = "live", dependsOnMethods = {"testInsertTargetPool", "testCreateInstanceAndHealthCheck"})
    public void testAddInstanceTargetPool() {
-      assertOperationDoneSuccessfully(api().addInstance(BACKUP_TARGETPOOL_NAME, instances));
-      TargetPool targetPool = api().get(BACKUP_TARGETPOOL_NAME);
+      assertOperationDoneSuccessfully(api().addInstance(TARGETPOOL_NAME, instances));
+      TargetPool targetPool = api().get(TARGETPOOL_NAME);
       assertNotNull(targetPool);
-      assertEquals(targetPool.name(), BACKUP_TARGETPOOL_NAME);
+      assertEquals(targetPool.name(), TARGETPOOL_NAME);
       assertEquals(targetPool.instances(), instances);
    }
 
-   @Test(groups = "live", dependsOnMethods = "testAddInstanceTargetPool")
-   public void testRemoveInstanceTargetPool() {
-      assertOperationDoneSuccessfully(api().removeInstance(BACKUP_TARGETPOOL_NAME, instances));
-
-      TargetPool targetPool = api().get(BACKUP_TARGETPOOL_NAME);
-
-      assertNotNull(targetPool);
-      assertEquals(targetPool.name(), BACKUP_TARGETPOOL_NAME);
-      assertNotEquals(targetPool.instances(), instances);
-   }
-
    @Test(groups = "live", dependsOnMethods = {"testInsertTargetPool2", "testCreateInstanceAndHealthCheck"})
    public void testAddHealthCheckTargetPool() {
       assertOperationDoneSuccessfully(api().addHealthCheck(TARGETPOOL_NAME, httpHealthChecks));
@@ -175,7 +179,31 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       assertEquals(targetPool.healthChecks(), httpHealthChecks);
    }
 
-   @Test(groups = "live", dependsOnMethods = "testAddHealthCheckTargetPool")
+   @Test(groups = "live", dependsOnMethods = {"testAddHealthCheckTargetPool", "testAddInstanceTargetPool"} )
+   public void testGetHealthTargetPool() {
+      TargetPool targetPool = api().get(TARGETPOOL_NAME);
+      assertNotNull(targetPool);
+      assertEquals(targetPool.instances(), instances);
+      assertEquals(targetPool.healthChecks(), httpHealthChecks);
+
+      HealthStatus healthStatus = api().getHealth(TARGETPOOL_NAME, instances.get(0));
+      assertNotNull(healthStatus);
+      assertEquals(healthStatus.healthStatus().get(0).instance(), instances.get(0));
+      assertEquals(healthStatus.healthStatus().get(0).healthState(), "UNHEALTHY");
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testGetHealthTargetPool")
+   public void testRemoveInstanceTargetPool() {
+      assertOperationDoneSuccessfully(api().removeInstance(TARGETPOOL_NAME, instances));
+
+      TargetPool targetPool = api().get(TARGETPOOL_NAME);
+
+      assertNotNull(targetPool);
+      assertEquals(targetPool.name(), TARGETPOOL_NAME);
+      assertNotEquals(targetPool.instances(), instances);
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testGetHealthTargetPool")
    public void testRemoveHealthCheckTargetPool() {
       assertOperationDoneSuccessfully(api().removeHealthCheck(TARGETPOOL_NAME, httpHealthChecks));
 
@@ -220,6 +248,7 @@ public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    public void testDeleteTargetPool() {
       // Note: This ordering matters due one being the backup of the other ect.
       assertOperationDoneSuccessfully(api().delete(THIRD_TARGETPOOL_NAME));
+      assertOperationDoneSuccessfully(api.forwardingRulesInRegion(DEFAULT_REGION_NAME).delete(FORWARDING_RULE_NAME));
       assertOperationDoneSuccessfully(api().delete(TARGETPOOL_NAME));
       assertOperationDoneSuccessfully(api().delete(BACKUP_TARGETPOOL_NAME));
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiMockTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiMockTest.java
new file mode 100644
index 0000000..f45a384
--- /dev/null
+++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiMockTest.java
@@ -0,0 +1,178 @@
+/*
+ * 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.googlecomputeengine.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+
+import java.net.URI;
+import java.util.List;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
+import org.jclouds.googlecomputeengine.parse.ParseHealthStatusTest;
+import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
+import org.jclouds.googlecomputeengine.parse.ParseTargetPoolListTest;
+import org.jclouds.googlecomputeengine.parse.ParseTargetPoolTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+@Test(groups = "unit", testName = "TargetPoolApiMockTest", singleThreaded = true)
+public class TargetPoolApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+   public void get() throws Exception {
+      server.enqueue(jsonResponse("/targetpool_get.json"));
+
+      assertEquals(targetPoolApi().get("test"),
+            new ParseTargetPoolTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/regions/us-central1/targetPools/test");
+   }
+
+   public void get_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(targetPoolApi().get("test"));
+      assertSent(server, "GET", "/projects/party/regions/us-central1/targetPools/test");
+   }
+
+   public void insert() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      TargetPoolCreationOptions targetPoolCreationOptions = new TargetPoolCreationOptions();
+      assertEquals(targetPoolApi().create("test", targetPoolCreationOptions),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/regions/us-central1/targetPools",
+            stringFromResource("/targetpool_insert.json"));
+   }
+
+   public void delete() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      assertEquals(targetPoolApi().delete("test-targetPool"),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "DELETE", "/projects/party/regions/us-central1/targetPools/test-targetPool");
+   }
+
+   public void delete_4xx() throws Exception {
+      server.enqueue(response404());
+
+      assertNull(targetPoolApi().delete("test-targetPool"));
+      assertSent(server, "DELETE", "/projects/party/regions/us-central1/targetPools/test-targetPool");
+   }
+
+   public void list() throws Exception {
+      server.enqueue(jsonResponse("/targetpool_list.json"));
+
+      assertEquals(targetPoolApi().list().next(), new ParseTargetPoolListTest().expected(url("/projects")));
+      assertSent(server, "GET", "/projects/party/regions/us-central1/targetPools");
+   }
+
+   public void list_empty() throws Exception {
+      server.enqueue(jsonResponse("/list_empty.json"));
+
+      assertFalse(targetPoolApi().list().hasNext());
+      assertSent(server, "GET", "/projects/party/regions/us-central1/targetPools");
+   }
+
+   public void addInstance() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      List<URI> instances = ImmutableList
+            .of(URI.create(url("/projects/party/zones/europe-west1-a/instances/test")));
+
+      assertEquals(targetPoolApi().addInstance("test", instances),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/regions/us-central1/targetPools/test/addInstance",
+            stringFromResource("/targetpool_addinstance.json"));
+   }
+
+   public void removeInstance() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      List<URI> instances = ImmutableList
+            .of(URI.create(url("/projects/party/zones/europe-west1-a/instances/test")));
+
+      assertEquals(targetPoolApi().removeInstance("test", instances),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/regions/us-central1/targetPools/test/removeInstance",
+            stringFromResource("/targetpool_addinstance.json"));
+   }
+
+   public void addHealthCheck() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      List<URI> healthChecks = ImmutableList
+            .of(URI.create(url("/projects/party/global/httpHealthChecks/health-check-1")));
+
+      assertEquals(targetPoolApi().addHealthCheck("test", healthChecks),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/regions/us-central1/targetPools/test/addHealthCheck",
+            stringFromResource("/targetpool_changehealthcheck.json"));
+   }
+
+   public void removeHealthCheck() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      List<URI> healthChecks = ImmutableList
+            .of(URI.create(url("/projects/party/global/httpHealthChecks/health-check-1")));
+
+      assertEquals(targetPoolApi().removeHealthCheck("test", healthChecks),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/regions/us-central1/targetPools/test/removeHealthCheck",
+            stringFromResource("/targetpool_changehealthcheck.json"));
+   }
+
+   public void setBackup() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      URI backup = URI.create(url("/projects/party/regions/us-central1/targetPools/tpool"));
+
+      assertEquals(targetPoolApi().setBackup("test", backup),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/regions/us-central1/targetPools/test/setBackup",
+            stringFromResource("/targetpool_setbackup.json"));
+   }
+
+   public void setBackup_FailoverRatio() throws Exception {
+      server.enqueue(jsonResponse("/region_operation.json"));
+
+      URI backup = URI.create(url("/projects/party/regions/us-central1/targetPools/tpool"));
+
+      Float failoverRatio = Float.valueOf("0.5");
+      assertEquals(targetPoolApi().setBackup("test", failoverRatio, backup),
+            new ParseRegionOperationTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/regions/us-central1/targetPools/"
+            + "test/setBackup?failoverRatio=0.5",
+            stringFromResource("/targetpool_setbackup.json"));
+   }
+
+   public void getHealth() throws Exception {
+      server.enqueue(jsonResponse("/health_status_get_health.json"));
+
+      URI instance = URI.create(url("/party/zones/us-central1-a/instances/jclouds-test"));
+      assertEquals(targetPoolApi().getHealth("test-pool", instance),
+            new ParseHealthStatusTest().expected(url("/projects")));
+      assertSent(server, "POST", "/projects/party/regions/us-central1/targetPools/test-pool/getHealth",
+            "{\"instance\": \"" + instance.toString() + "\"}");
+   }
+
+   public TargetPoolApi targetPoolApi() {
+      return api().targetPoolsInRegion("us-central1");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd5c4c5c/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceGetHealthTest.java
----------------------------------------------------------------------
diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceGetHealthTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceGetHealthTest.java
deleted file mode 100644
index 5eab529..0000000
--- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseBackendServiceGetHealthTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.parse;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-
-import java.net.URI;
-import javax.ws.rs.Consumes;
-
-import org.jclouds.googlecomputeengine.domain.BackendServiceGroupHealth;
-import org.jclouds.googlecomputeengine.domain.BackendServiceGroupHealth.HealthStatus;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit")
-public class ParseBackendServiceGetHealthTest extends BaseGoogleComputeEngineParseTest<BackendServiceGroupHealth> {
-
-   @Override
-   public String resource() {
-      return "/backend_service_get_health.json";
-   }
-
-   @Override
-   @Consumes(APPLICATION_JSON)
-   public BackendServiceGroupHealth expected() {
-      return expected(BASE_URL);
-   }
-
-   @Consumes(APPLICATION_JSON)
-   public BackendServiceGroupHealth expected(String baseUrl) {
-      URI uri = URI.create(baseUrl + "/myproject/zones/us-central1-a/instances/"
-                           + "jclouds-test");
-      return BackendServiceGroupHealth.create(
-            ImmutableList.of(HealthStatus.create(
-                  null, // ipAddress
-                  80, // port
-                  uri, // instance
-                  "HEALTHY" //healthState
-                  )) //healthStatuses
-            );
-   }
-}