You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ab...@apache.org on 2013/09/06 19:39:54 UTC

[05/11] JCLOUDS-209. Move to GCE v1beta15 API, with new features/methods included

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
index 6429275..4627f9a 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java
@@ -16,6 +16,14 @@
  */
 package org.jclouds.googlecomputeengine.features;
 
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertNull;
+
+import javax.ws.rs.core.MediaType;
+
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
 import org.jclouds.googlecomputeengine.parse.ParseDiskListTest;
 import org.jclouds.googlecomputeengine.parse.ParseDiskTest;
@@ -24,15 +32,6 @@ import org.jclouds.http.HttpRequest;
 import org.jclouds.http.HttpResponse;
 import org.testng.annotations.Test;
 
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
-
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.AssertJUnit.assertNull;
-
 /**
  * @author David Alves
  */
@@ -43,7 +42,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
       HttpRequest get = HttpRequest
               .builder()
               .method("GET")
-              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/disks/testimage1")
+              .endpoint("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks/testimage1")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -53,7 +52,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
       DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
               TOKEN_RESPONSE, get, operationResponse).getDiskApiForProject("myproject");
 
-      assertEquals(api.get("testimage1"),
+      assertEquals(api.getInZone("us-central1-a", "testimage1"),
               new ParseDiskTest().expected());
    }
 
@@ -61,7 +60,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
       HttpRequest get = HttpRequest
               .builder()
               .method("GET")
-              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/disks/testimage1")
+              .endpoint("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks/testimage1")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -70,29 +69,68 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
       DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
               TOKEN_RESPONSE, get, operationResponse).getDiskApiForProject("myproject");
 
-      assertNull(api.get("testimage1"));
+      assertNull(api.getInZone("us-central1-a", "testimage1"));
    }
 
    public void testInsertDiskResponseIs2xx() {
       HttpRequest insert = HttpRequest
               .builder()
               .method("POST")
-              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/disks")
+              .endpoint("https://www.googleapis.com/compute/v1beta15/projects/myproject/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("/operation.json")).build();
+              .payload(payloadFromResource("/zone_operation.json")).build();
 
       DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
               TOKEN_RESPONSE, insert,
               insertDiskResponse).getDiskApiForProject("myproject");
 
-      assertEquals(api.createInZone("testimage1", 1, URI.create("https://www.googleapis" +
-              ".com/compute/v1beta13/projects/myproject/zones/us-central1-a"))
-              , new ParseOperationTest().expected());
+      assertEquals(api.createInZone("testimage1", 1, "us-central1-a"), new ParseOperationTest().expected());
+   }
+
+   public void testCreateSnapshotResponseIs2xx() {
+      HttpRequest createSnapshotRequest = HttpRequest
+              .builder()
+              .method("POST")
+              .endpoint("https://www.googleapis.com/compute/v1beta15/projects/myproject/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).getDiskApiForProject("myproject");
+
+      assertEquals(api.createSnapshotInZone("us-central1-a", "testimage1", "test-snap"), new ParseOperationTest().expected());
+   }
+
+   public void testCreateSnapshotResponseIs4xx() {
+      HttpRequest createSnapshotRequest = HttpRequest
+              .builder()
+              .method("POST")
+              .endpoint("https://www.googleapis.com/compute/v1beta15/projects/myproject/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(404).build();
+
+      DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+              TOKEN_RESPONSE, createSnapshotRequest,
+              createSnapshotResponse).getDiskApiForProject("myproject");
+
+      assertNull(api.createSnapshotInZone("us-central1-a", "testimage1", "test-snap"));
    }
 
    public void testDeleteDiskResponseIs2xx() {
@@ -100,17 +138,17 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("DELETE")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/disks/testimage1")
+                      ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks/testimage1")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
       HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/operation.json")).build();
+              .payload(payloadFromResource("/zone_operation.json")).build();
 
       DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
               TOKEN_RESPONSE, delete, deleteResponse).getDiskApiForProject("myproject");
 
-      assertEquals(api.delete("testimage1"),
+      assertEquals(api.deleteInZone("us-central1-a", "testimage1"),
               new ParseOperationTest().expected());
    }
 
@@ -119,7 +157,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("DELETE")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/disks/testimage1")
+                      ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks/testimage1")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -128,7 +166,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
       DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
               TOKEN_RESPONSE, delete, deleteResponse).getDiskApiForProject("myproject");
 
-      assertNull(api.delete("testimage1"));
+      assertNull(api.deleteInZone("us-central1-a", "testimage1"));
    }
 
    public void testListDisksResponseIs2xx() {
@@ -136,7 +174,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/disks")
+                      ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -146,7 +184,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
       DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
               TOKEN_RESPONSE, list, operationResponse).getDiskApiForProject("myproject");
 
-      assertEquals(api.listFirstPage().toString(),
+      assertEquals(api.listFirstPageInZone("us-central1-a").toString(),
               new ParseDiskListTest().expected().toString());
    }
 
@@ -155,7 +193,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/disks")
+                      ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -164,6 +202,6 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
       DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
               TOKEN_RESPONSE, list, operationResponse).getDiskApiForProject("myproject");
 
-      assertTrue(api.list().concat().isEmpty());
+      assertTrue(api.listInZone("us-central1-a").concat().isEmpty());
    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
index 2b42cd7..86aefb1 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiLiveTest.java
@@ -19,7 +19,6 @@ package org.jclouds.googlecomputeengine.features;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 
-import java.net.URI;
 import java.util.List;
 
 import org.jclouds.collect.PagedIterable;
@@ -37,11 +36,9 @@ import com.google.common.collect.Lists;
  */
 public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
-   private static final String DISK_NAME = "disk-api-live-test-disk";
-   private static final int TIME_WAIT = 10;
-
-   private URI zoneUrl;
-   private int sizeGb = 1;
+   public static final String DISK_NAME = "disk-api-live-test-disk";
+   public static final int TIME_WAIT = 30;
+   public static final int sizeGb = 1;
 
    private DiskApi api() {
       return api.getDiskApiForProject(userProject.get());
@@ -50,15 +47,14 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    @Test(groups = "live")
    public void testInsertDisk() {
       Project project = api.getProjectApi().get(userProject.get());
-      zoneUrl = getDefaultZoneUrl(project.getName());
-      assertOperationDoneSucessfully(api().createInZone(DISK_NAME, sizeGb, zoneUrl), TIME_WAIT);
+      assertZoneOperationDoneSucessfully(api().createInZone(DISK_NAME, sizeGb, DEFAULT_ZONE_NAME), TIME_WAIT);
 
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertDisk")
    public void testGetDisk() {
 
-      Disk disk = api().get(DISK_NAME);
+      Disk disk = api().getInZone(DEFAULT_ZONE_NAME, DISK_NAME);
       assertNotNull(disk);
       assertDiskEquals(disk);
    }
@@ -66,7 +62,7 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    @Test(groups = "live", dependsOnMethods = "testGetDisk")
    public void testListDisk() {
 
-      PagedIterable<Disk> disks = api().list(new ListOptions.Builder()
+      PagedIterable<Disk> disks = api().listInZone(DEFAULT_ZONE_NAME, new ListOptions.Builder()
               .filter("name eq " + DISK_NAME));
 
       List<Disk> disksAsList = Lists.newArrayList(disks.concat());
@@ -80,13 +76,13 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    @Test(groups = "live", dependsOnMethods = "testListDisk")
    public void testDeleteDisk() {
 
-      assertOperationDoneSucessfully(api().delete(DISK_NAME), TIME_WAIT);
+      assertZoneOperationDoneSucessfully(api().deleteInZone(DEFAULT_ZONE_NAME, DISK_NAME), TIME_WAIT);
    }
 
    private void assertDiskEquals(Disk result) {
       assertEquals(result.getName(), DISK_NAME);
       assertEquals(result.getSizeGb(), sizeGb);
-      assertEquals(result.getZone(), zoneUrl);
+      assertEquals(result.getZone(), getDefaultZoneUrl(userProject.get()));
    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
index 5dc6fdf..6345c51 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java
@@ -16,24 +16,6 @@
  */
 package org.jclouds.googlecomputeengine.features;
 
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableSet;
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
-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;
-import org.jclouds.io.Payload;
-import org.testng.annotations.Test;
-
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Set;
-
 import static com.google.common.base.Joiner.on;
 import static com.google.common.collect.Iterables.transform;
 import static java.lang.String.format;
@@ -46,6 +28,26 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.AssertJUnit.assertNull;
 
+import java.io.IOException;
+import java.net.URI;
+import java.util.Set;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.googlecomputeengine.domain.Firewall;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+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;
+import org.jclouds.io.Payload;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableSet;
+
 /**
  * @author David Alves
  */
@@ -56,7 +58,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
            .builder()
            .method("GET")
            .endpoint("https://www.googleapis" +
-                   ".com/compute/v1beta13/projects/myproject/firewalls/jclouds-test")
+                   ".com/compute/v1beta15/projects/myproject/global/firewalls/jclouds-test")
            .addHeader("Accept", "application/json")
            .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -106,7 +108,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/firewalls/jclouds-test")
+                      ".com/compute/v1beta15/projects/myproject/global/firewalls/jclouds-test")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -123,7 +125,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
       HttpRequest request = HttpRequest
               .builder()
               .method("POST")
-              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/firewalls")
+              .endpoint("https://www.googleapis.com/compute/v1beta15/projects/myproject/global/firewalls")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN)
               .payload(firewallPayloadFirewallOfName(
@@ -142,7 +144,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               TOKEN_RESPONSE, request, insertFirewallResponse).getFirewallApiForProject("myproject");
 
       assertEquals(api.createInNetwork("myfw", URI.create("https://www.googleapis" +
-              ".com/compute/v1beta13/projects/myproject/networks/default"),
+              ".com/compute/v1beta15/projects/myproject/global/networks/default"),
               new FirewallOptions()
                       .addAllowedRule(Firewall.Rule.builder()
                               .IPProtocol(IPProtocol.TCP)
@@ -158,7 +160,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
       HttpRequest update = HttpRequest
               .builder()
               .method("PUT")
-              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/firewalls/myfw")
+              .endpoint("https://www.googleapis.com/compute/v1beta15/projects/myproject/global/firewalls/myfw")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN)
               .payload(firewallPayloadFirewallOfName(
@@ -181,7 +183,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               new FirewallOptions()
                       .name("myfw")
                       .network(URI.create("https://www.googleapis" +
-                              ".com/compute/v1beta13/projects/myproject/networks/default"))
+                              ".com/compute/v1beta15/projects/myproject/global/networks/default"))
                       .addAllowedRule(Firewall.Rule.builder()
                               .IPProtocol(IPProtocol.TCP)
                               .addPort(22)
@@ -195,7 +197,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
       HttpRequest update = HttpRequest
               .builder()
               .method("PATCH")
-              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/firewalls/myfw")
+              .endpoint("https://www.googleapis.com/compute/v1beta15/projects/myproject/global/firewalls/myfw")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN)
               .payload(firewallPayloadFirewallOfName(
@@ -218,7 +220,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               new FirewallOptions()
                       .name("myfw")
                       .network(URI.create("https://www.googleapis" +
-                              ".com/compute/v1beta13/projects/myproject/networks/default"))
+                              ".com/compute/v1beta15/projects/myproject/global/networks/default"))
                       .addAllowedRule(Firewall.Rule.builder()
                               .IPProtocol(IPProtocol.TCP)
                               .addPort(22)
@@ -233,7 +235,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               .builder()
               .method("DELETE")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/firewalls/default-allow-internal")
+                      ".com/compute/v1beta15/projects/myproject/global/firewalls/default-allow-internal")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -252,7 +254,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               .builder()
               .method("DELETE")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/firewalls/default-allow-internal")
+                      ".com/compute/v1beta15/projects/myproject/global/firewalls/default-allow-internal")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -269,7 +271,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/firewalls")
+                      ".com/compute/v1beta15/projects/myproject/global/firewalls")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -288,7 +290,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/firewalls")
+                      ".com/compute/v1beta15/projects/myproject/global/firewalls")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java
index 72c903f..8c550b7 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java
@@ -16,8 +16,13 @@
  */
 package org.jclouds.googlecomputeengine.features;
 
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
+import static com.google.common.collect.Iterables.getOnlyElement;
+import static org.jclouds.googlecomputeengine.domain.Firewall.Rule.IPProtocol;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.util.List;
+
 import org.jclouds.collect.PagedIterable;
 import org.jclouds.googlecomputeengine.domain.Firewall;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
@@ -25,12 +30,8 @@ import org.jclouds.googlecomputeengine.options.FirewallOptions;
 import org.jclouds.googlecomputeengine.options.ListOptions;
 import org.testng.annotations.Test;
 
-import java.util.List;
-
-import static com.google.common.collect.Iterables.getOnlyElement;
-import static org.jclouds.googlecomputeengine.domain.Firewall.Rule.IPProtocol;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
 
 /**
  * @author David Alves
@@ -50,7 +51,7 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    public void testInsertFirewall() {
 
       // need to create the network first
-      assertOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).createInIPv4Range
+      assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).createInIPv4Range
               (FIREWALL_NETWORK_NAME, IPV4_RANGE), TIME_WAIT);
 
       FirewallOptions firewall = new FirewallOptions()
@@ -62,7 +63,7 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
               .addSourceTag("tag1")
               .addTargetTag("tag2");
 
-      assertOperationDoneSucessfully(api().createInNetwork(FIREWALL_NAME, getNetworkUrl(userProject.get(),
+      assertGlobalOperationDoneSucessfully(api().createInNetwork(FIREWALL_NAME, getNetworkUrl(userProject.get(),
               FIREWALL_NETWORK_NAME), firewall), TIME_WAIT);
 
    }
@@ -72,7 +73,7 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
       FirewallOptions firewall = new FirewallOptions()
               .name(FIREWALL_NAME)
-              .network(getNetworkUrl(userProject.get(),FIREWALL_NETWORK_NAME))
+              .network(getNetworkUrl(userProject.get(), FIREWALL_NETWORK_NAME))
               .addSourceRange("10.0.0.0/8")
               .addSourceTag("tag1")
               .addTargetTag("tag2")
@@ -83,7 +84,7 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
                               .build()));
 
 
-      assertOperationDoneSucessfully(api().update(FIREWALL_NAME, firewall), TIME_WAIT);
+      assertGlobalOperationDoneSucessfully(api().update(FIREWALL_NAME, firewall), TIME_WAIT);
 
    }
 
@@ -92,7 +93,7 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
       FirewallOptions firewall = new FirewallOptions()
               .name(FIREWALL_NAME)
-              .network(getNetworkUrl(userProject.get(),FIREWALL_NETWORK_NAME))
+              .network(getNetworkUrl(userProject.get(), FIREWALL_NETWORK_NAME))
               .allowedRules(ImmutableSet.of(
                       Firewall.Rule.builder()
                               .IPProtocol(IPProtocol.TCP)
@@ -106,7 +107,7 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
               .addSourceTag("tag1")
               .addTargetTag("tag2");
 
-      assertOperationDoneSucessfully(api().update(FIREWALL_NAME, firewall), TIME_WAIT);
+      assertGlobalOperationDoneSucessfully(api().update(FIREWALL_NAME, firewall), TIME_WAIT);
 
    }
 
@@ -149,8 +150,8 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    @Test(groups = "live", dependsOnMethods = "testListFirewall")
    public void testDeleteFirewall() {
 
-      assertOperationDoneSucessfully(api().delete(FIREWALL_NAME), TIME_WAIT);
-      assertOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).delete
+      assertGlobalOperationDoneSucessfully(api().delete(FIREWALL_NAME), TIME_WAIT);
+      assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).delete
               (FIREWALL_NETWORK_NAME), TIME_WAIT);
    }
 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java
new file mode 100644
index 0000000..412dc32
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.googlecomputeengine.parse.ParseOperationListTest;
+import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.testng.annotations.Test;
+
+/**
+ * @author David Alves
+ */
+@Test(groups = "unit")
+public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+
+   private static final String OPERATIONS_URL_PREFIX = "https://www.googleapis" +
+           ".com/compute/v1beta15/projects/myproject/global/operations";
+
+   public static final HttpRequest GET_GLOBAL_OPERATION_REQUEST = HttpRequest
+           .builder()
+           .method("GET")
+           .endpoint(OPERATIONS_URL_PREFIX + "/operation-1354084865060-4cf88735faeb8-bbbb12cb")
+           .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 testGetOperationResponseIs2xx() throws Exception {
+
+      GlobalOperationApi operationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+              TOKEN_RESPONSE, GET_GLOBAL_OPERATION_REQUEST, GET_GLOBAL_OPERATION_RESPONSE).getGlobalOperationApiForProject("myproject");
+
+      assertEquals(operationApi.get("operation-1354084865060-4cf88735faeb8-bbbb12cb"),
+              new ParseOperationTest().expected());
+   }
+
+   public void testGetOperationResponseIs4xx() throws Exception {
+
+      HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+      GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+              TOKEN_RESPONSE, GET_GLOBAL_OPERATION_REQUEST, operationResponse).getGlobalOperationApiForProject("myproject");
+
+      assertNull(globalOperationApi.get("operation-1354084865060-4cf88735faeb8-bbbb12cb"));
+   }
+
+   public void testDeleteOperationResponseIs2xx() throws Exception {
+      HttpRequest delete = HttpRequest
+              .builder()
+              .method("DELETE")
+              .endpoint(OPERATIONS_URL_PREFIX + "/operation-1352178598164-4cdcc9d031510-4aa46279")
+              .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+      HttpResponse operationResponse = HttpResponse.builder().statusCode(204).build();
+
+      GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+              TOKEN_RESPONSE, delete, operationResponse).getGlobalOperationApiForProject("myproject");
+
+      globalOperationApi.delete("operation-1352178598164-4cdcc9d031510-4aa46279");
+   }
+
+   public void testDeleteOperationResponseIs4xx() throws Exception {
+      HttpRequest delete = HttpRequest
+              .builder()
+              .method("DELETE")
+              .endpoint(OPERATIONS_URL_PREFIX + "/operation-1352178598164-4cdcc9d031510-4aa46279")
+              .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+      HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+      GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+              TOKEN_RESPONSE, delete, operationResponse).getGlobalOperationApiForProject("myproject");
+
+      globalOperationApi.delete("operation-1352178598164-4cdcc9d031510-4aa46279");
+   }
+
+   public void testLisOperationWithNoOptionsResponseIs2xx() {
+      HttpRequest get = HttpRequest
+              .builder()
+              .method("GET")
+              .endpoint(OPERATIONS_URL_PREFIX)
+              .addHeader("Accept", "application/json")
+              .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+      HttpResponse operationResponse = HttpResponse.builder().statusCode(200)
+              .payload(payloadFromResource("/global_operation_list.json")).build();
+
+      GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+              TOKEN_RESPONSE, get, operationResponse).getGlobalOperationApiForProject("myproject");
+
+      assertEquals(globalOperationApi.listFirstPage().toString(),
+              new ParseOperationListTest().expected().toString());
+   }
+
+   public void testListOperationWithPaginationOptionsResponseIs2xx() {
+      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 operationResponse = HttpResponse.builder().statusCode(200)
+              .payload(payloadFromResource("/global_operation_list.json")).build();
+
+      GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+              TOKEN_RESPONSE, get, operationResponse).getGlobalOperationApiForProject("myproject");
+
+      assertEquals(globalOperationApi.listAtMarker("CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1Mj" +
+              "I0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz",
+              new ListOptions.Builder().filter("status eq done").maxResults(3)).toString(),
+              new ParseOperationListTest().expected().toString());
+   }
+
+   public void testListOperationWithPaginationOptionsResponseIs4xx() {
+      HttpRequest get = HttpRequest
+              .builder()
+              .method("GET")
+              .endpoint(OPERATIONS_URL_PREFIX)
+              .addHeader("Accept", "application/json")
+              .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+      HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+      GlobalOperationApi globalOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+              TOKEN_RESPONSE, get, operationResponse).getGlobalOperationApiForProject("myproject");
+
+      assertTrue(globalOperationApi.list().concat().isEmpty());
+   }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java
new file mode 100644
index 0000000..42adbe6
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.ProjectApiLiveTest.addItemToMetadata;
+import static org.jclouds.googlecomputeengine.features.ProjectApiLiveTest.deleteItemFromMetadata;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+/**
+ * @author David Alves
+ */
+public class GlobalOperationApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
+
+   private static final String METADATA_ITEM_KEY = "operationLiveTestTestProp";
+   private static final String METADATA_ITEM_VALUE = "operationLiveTestTestValue";
+   private Operation addOperation;
+   private Operation deleteOperation;
+
+   private GlobalOperationApi api() {
+      return api.getGlobalOperationApiForProject(userProject.get());
+   }
+
+
+   @Test(groups = "live")
+   public void testCreateOperations() {
+      //create some operations by adding and deleting metadata items
+      // this will make sure there is stuff to listFirstPage
+      addOperation = assertGlobalOperationDoneSucessfully(addItemToMetadata(api.getProjectApi(),
+              userProject.get(), METADATA_ITEM_KEY, METADATA_ITEM_VALUE), 20);
+      deleteOperation = assertGlobalOperationDoneSucessfully(deleteItemFromMetadata(api
+              .getProjectApi(), userProject.get(), METADATA_ITEM_KEY), 20);
+
+      assertNotNull(addOperation);
+      assertNotNull(deleteOperation);
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testCreateOperations")
+   public void testGetOperation() {
+      Operation operation = api().get(addOperation.getName());
+      assertNotNull(operation);
+      assertOperationEquals(operation, this.addOperation);
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testCreateOperations")
+   public void testListOperationsWithFiltersAndPagination() {
+      PagedIterable<Operation> operations = api().list(new ListOptions.Builder()
+              .filter("operationType eq setMetadata")
+              .maxResults(1));
+
+      // make sure that in spite of having only one result per page we get at least two results
+      final AtomicInteger counter = new AtomicInteger();
+      operations.firstMatch(new Predicate<IterableWithMarker<Operation>>() {
+
+         @Override
+         public boolean apply(IterableWithMarker<Operation> input) {
+            counter.addAndGet(Iterables.size(input));
+            return counter.get() == 2;
+         }
+      });
+   }
+
+   private void assertOperationEquals(Operation result, Operation expected) {
+      assertEquals(result.getName(), expected.getName());
+   }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java
index fe7e41f..d8baecf 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java
@@ -16,6 +16,12 @@
  */
 package org.jclouds.googlecomputeengine.features;
 
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertNull;
+
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
 import org.jclouds.googlecomputeengine.parse.ParseImageListTest;
 import org.jclouds.googlecomputeengine.parse.ParseImageTest;
@@ -24,12 +30,6 @@ import org.jclouds.http.HttpRequest;
 import org.jclouds.http.HttpResponse;
 import org.testng.annotations.Test;
 
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.AssertJUnit.assertNull;
-
 /**
  * @author David Alves
  */
@@ -40,19 +40,30 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
            .builder()
            .method("GET")
            .endpoint("https://www.googleapis" +
-                   ".com/compute/v1beta13/projects/myproject/images")
+                   ".com/compute/v1beta15/projects/myproject/global/images")
            .addHeader("Accept", "application/json")
            .addHeader("Authorization", "Bearer " + TOKEN).build();
 
    public static final HttpResponse LIST_PROJECT_IMAGES_RESPONSE = HttpResponse.builder().statusCode(200)
            .payload(staticPayloadFromResource("/image_list.json")).build();
 
+   public static final HttpRequest LIST_GOOGLE_IMAGES_REQUEST = HttpRequest
+           .builder()
+           .method("GET")
+           .endpoint("https://www.googleapis.com/compute/v1beta15/projects/google/global/images")
+           .addHeader("Accept", "application/json")
+           .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+   public static final HttpResponse LIST_GOOGLE_IMAGES_RESPONSE = HttpResponse.builder().statusCode(200)
+           .payload(staticPayloadFromResource("/image_list_single_page.json")).build();
+
+
    public void testGetImageResponseIs2xx() throws Exception {
       HttpRequest get = HttpRequest
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/google/images/centos-6-2-v20120326")
+                      ".com/compute/v1beta15/projects/google/global/images/centos-6-2-v20120326")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -71,7 +82,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/google/images/centos-6-2-v20120326")
+                      ".com/compute/v1beta15/projects/google/global/images/centos-6-2-v20120326")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -88,7 +99,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("DELETE")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/images/centos-6-2-v20120326")
+                      ".com/compute/v1beta15/projects/myproject/global/images/centos-6-2-v20120326")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -107,7 +118,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("DELETE")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/images/centos-6-2-v20120326")
+                      ".com/compute/v1beta15/projects/myproject/global/images/centos-6-2-v20120326")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
index f26b8bb..1180949 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java
@@ -16,8 +16,14 @@
  */
 package org.jclouds.googlecomputeengine.features;
 
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Iterator;
+import java.util.List;
+
 import org.jclouds.collect.IterableWithMarker;
 import org.jclouds.collect.PagedIterable;
 import org.jclouds.googlecomputeengine.domain.Image;
@@ -25,17 +31,10 @@ import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTe
 import org.jclouds.googlecomputeengine.options.ListOptions;
 import org.testng.annotations.Test;
 
-import java.util.Iterator;
-import java.util.List;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertSame;
-import static org.testng.Assert.assertTrue;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
 
 /**
- * TODO figure out how to test insert and delete as this requires an image .tar.gz to be present in GCS
- *
  * @author David Alves
  */
 public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
index 05a2034..1fdf20b 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java
@@ -16,9 +16,25 @@
  */
 package org.jclouds.googlecomputeengine.features;
 
+import static java.net.URI.create;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+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.assertTrue;
+import static org.testng.AssertJUnit.assertNull;
+
+import java.net.URI;
+
+import javax.ws.rs.core.MediaType;
+
 import org.jclouds.googlecomputeengine.domain.Instance;
 import org.jclouds.googlecomputeengine.domain.InstanceTemplate;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.options.AttachDiskOptions;
+import org.jclouds.googlecomputeengine.options.AttachDiskOptions.DiskMode;
+import org.jclouds.googlecomputeengine.options.AttachDiskOptions.DiskType;
 import org.jclouds.googlecomputeengine.parse.ParseInstanceListTest;
 import org.jclouds.googlecomputeengine.parse.ParseInstanceSerialOutputTest;
 import org.jclouds.googlecomputeengine.parse.ParseInstanceTest;
@@ -27,15 +43,7 @@ import org.jclouds.http.HttpRequest;
 import org.jclouds.http.HttpResponse;
 import org.testng.annotations.Test;
 
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
-
-import static java.net.URI.create;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.AssertJUnit.assertNull;
+import com.google.common.collect.ImmutableMap;
 
 /**
  * @author David Alves
@@ -47,7 +55,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
            .builder()
            .method("GET")
            .endpoint("https://www.googleapis" +
-                   ".com/compute/v1beta13/projects/myproject/instances/test-1")
+                   ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/instances/test-1")
            .addHeader("Accept", "application/json")
            .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -59,15 +67,26 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
            .builder()
            .method("GET")
            .endpoint("https://www.googleapis" +
-                   ".com/compute/v1beta13/projects/myproject/instances")
+                   ".com/compute/v1beta15/projects/myproject/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 HttpRequest LIST_CENTRAL1B_INSTANCES_REQUEST = HttpRequest
+           .builder()
+           .method("GET")
+           .endpoint("https://www.googleapis" +
+                   ".com/compute/v1beta15/projects/myproject/zones/us-central1-b/instances")
+           .addHeader("Accept", "application/json")
+           .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+   public static final HttpResponse LIST_CENTRAL1B_INSTANCES_RESPONSE = HttpResponse.builder().statusCode(200)
+           .payload(staticPayloadFromResource("/instance_list_central1b_empty.json")).build();
+
    public static final HttpResponse CREATE_INSTANCE_RESPONSE = HttpResponse.builder().statusCode(200)
-           .payload(staticPayloadFromResource("/operation.json")).build();
+           .payload(staticPayloadFromResource("/zone_operation.json")).build();
 
 
    public void testGetInstanceResponseIs2xx() throws Exception {
@@ -76,7 +95,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE,
               GET_INSTANCE_REQUEST, GET_INSTANCE_RESPONSE).getInstanceApiForProject("myproject");
 
-      assertEquals(api.get("test-1"), new ParseInstanceTest().expected());
+      assertEquals(api.getInZone("us-central1-a", "test-1"), new ParseInstanceTest().expected());
    }
 
    public void testGetInstanceResponseIs4xx() throws Exception {
@@ -86,7 +105,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
       InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
               TOKEN_RESPONSE, GET_INSTANCE_REQUEST, operationResponse).getInstanceApiForProject("myproject");
 
-      assertNull(api.get("test-1"));
+      assertNull(api.getInZone("us-central1-a", "test-1"));
    }
 
    public void testGetInstanceSerialPortOutput() throws Exception {
@@ -94,7 +113,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/instances/test-1/serialPort")
+                      ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/instances/test-1/serialPort")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -105,59 +124,63 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
       InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
               TOKEN_RESPONSE, get, operationResponse).getInstanceApiForProject("myproject");
 
-      assertEquals(api.getSerialPortOutput("test-1"), new ParseInstanceSerialOutputTest().expected());
+      assertEquals(api.getSerialPortOutputInZone("us-central1-a", "test-1"), new ParseInstanceSerialOutputTest().expected());
    }
 
    public void testInsertInstanceResponseIs2xxNoOptions() {
       HttpRequest insert = HttpRequest
               .builder()
               .method("POST")
-              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/instances")
+              .endpoint("https://www.googleapis.com/compute/v1beta15/projects/myproject/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(requestForScopes(COMPUTE_SCOPE),
+      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).getInstanceApiForProject("myproject");
+              CREATE_INSTANCE_RESPONSE)).getInstanceApiForProject("myproject");
 
-      InstanceTemplate options = InstanceTemplate.builder().forMachineType("n1-standard-1")
+      InstanceTemplate options = InstanceTemplate.builder().forMachineType("us-central1-a/n1-standard-1")
+              .image(URI.create("https://www.googleapis.com/compute/v1beta15/projects/google/global/images/gcel-12-04-v20121106"))
               .addNetworkInterface(URI.create("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/networks/default"));
+                      ".com/compute/v1beta15/projects/myproject/global/networks/default"));
 
-      assertEquals(api.createInZone("test-1", options, "us-central1-a"), new ParseOperationTest().expected());
+      assertEquals(api.createInZone("test-1", "us-central1-a", options), new ParseOperationTest().expected());
    }
 
    public void testInsertInstanceResponseIs2xxAllOptions() {
       HttpRequest insert = HttpRequest
               .builder()
               .method("POST")
-              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/instances")
+              .endpoint("https://www.googleapis.com/compute/v1beta15/projects/myproject/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("/operation.json")).build();
+              .payload(payloadFromResource("/zone_operation.json")).build();
 
-      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
-              TOKEN_RESPONSE, insert, insertInstanceResponse).getInstanceApiForProject("myproject");
+      InstanceApi api = requestsSendResponses(ImmutableMap.of(requestForScopes(COMPUTE_READONLY_SCOPE),
+              TOKEN_RESPONSE, GET_PROJECT_REQUEST, GET_PROJECT_RESPONSE,
+              requestForScopes(COMPUTE_SCOPE),
+              TOKEN_RESPONSE, insert, insertInstanceResponse)).getInstanceApiForProject("myproject");
 
-      InstanceTemplate options = InstanceTemplate.builder().forMachineType("n1-standard-1")
+      InstanceTemplate options = InstanceTemplate.builder().forMachineType("us-central1-a/n1-standard-1")
               .addNetworkInterface(URI.create("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/networks/default"), Instance.NetworkInterface.AccessConfig.Type.ONE_TO_ONE_NAT)
+                      ".com/compute/v1beta15/projects/myproject/global/networks/default"), Instance.NetworkInterface.AccessConfig.Type.ONE_TO_ONE_NAT)
               .description("desc")
               .image(URI.create("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/google/images/gcel-12-04-v20121106"))
+                      ".com/compute/v1beta15/projects/google/global/images/gcel-12-04-v20121106"))
               .addDisk(InstanceTemplate.PersistentDisk.Mode.READ_WRITE,
-                      create("https://www.googleapis.com/compute/v1beta13/projects/myproject/disks/test"))
-              .addTag("aTag")
+                      create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks/test"))
               .addServiceAccount(Instance.ServiceAccount.builder().email("default").addScopes("myscope").build())
               .addMetadata("aKey", "aValue");
 
-      assertEquals(api.createInZone("test-0", options, "us-central1-a"),
+      assertEquals(api.createInZone("test-0", "us-central1-a", options),
               new ParseOperationTest().expected());
    }
 
@@ -166,17 +189,17 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               .builder()
               .method("DELETE")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/instances/test-1")
+                      ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/instances/test-1")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
       HttpResponse deleteResponse = HttpResponse.builder().statusCode(200)
-              .payload(payloadFromResource("/operation.json")).build();
+              .payload(payloadFromResource("/zone_operation.json")).build();
 
       InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
               TOKEN_RESPONSE, delete, deleteResponse).getInstanceApiForProject("myproject");
 
-      assertEquals(api.delete("test-1"),
+      assertEquals(api.deleteInZone("us-central1-a", "test-1"),
               new ParseOperationTest().expected());
    }
 
@@ -185,7 +208,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               .builder()
               .method("DELETE")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/instances/test-1")
+                      ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/instances/test-1")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -194,7 +217,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
       InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
               TOKEN_RESPONSE, delete, deleteResponse).getInstanceApiForProject("myproject");
 
-      assertNull(api.delete("test-1"));
+      assertNull(api.deleteInZone("us-central1-a", "test-1"));
    }
 
    public void testListInstancesResponseIs2xx() {
@@ -203,7 +226,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE,
               LIST_INSTANCES_REQUEST, LIST_INSTANCES_RESPONSE).getInstanceApiForProject("myproject");
 
-      assertEquals(api.listFirstPage().toString(),
+      assertEquals(api.listFirstPageInZone("us-central1-a").toString(),
               new ParseInstanceListTest().expected().toString());
    }
 
@@ -212,7 +235,7 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/instances")
+                      ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/instances")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -221,7 +244,172 @@ public class InstanceApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
       InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
               TOKEN_RESPONSE, list, operationResponse).getInstanceApiForProject("myproject");
 
-      assertTrue(api.list().concat().isEmpty());
+      assertTrue(api.listInZone("us-central1-a").concat().isEmpty());
+   }
+
+   public void testSetInstanceMetadataResponseIs2xx() {
+      HttpRequest setMetadata = HttpRequest
+              .builder()
+              .method("POST")
+              .endpoint("https://www.googleapis" +
+                      ".com/compute/v1beta15/projects/myproject/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).getInstanceApiForProject("myproject");
+
+      assertEquals(api.setMetadataInZone("us-central1-a", "test-1", ImmutableMap.of("foo", "bar"), "efgh"),
+              new ParseOperationTest().expected());
+   }
+
+   public void testSetInstanceMetadataResponseIs4xx() {
+      HttpRequest setMetadata = HttpRequest
+              .builder()
+              .method("POST")
+              .endpoint("https://www.googleapis" +
+                      ".com/compute/v1beta15/projects/myproject/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(404).build();
+
+      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+              TOKEN_RESPONSE, setMetadata, setMetadataResponse).getInstanceApiForProject("myproject");
+
+      assertNull(api.setMetadataInZone("us-central1-a", "test-1", ImmutableMap.of("foo", "bar"), "efgh"));
+   }
+
+   public void testResetInstanceResponseIs2xx() {
+      HttpRequest reset = HttpRequest
+              .builder()
+              .method("POST")
+              .endpoint("https://www.googleapis" +
+                      ".com/compute/v1beta15/projects/myproject/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).getInstanceApiForProject("myproject");
+
+      assertEquals(api.resetInZone("us-central1-a", "test-1"),
+              new ParseOperationTest().expected());
+   }
+
+   public void testResetInstanceResponseIs4xx() {
+      HttpRequest reset = HttpRequest
+              .builder()
+              .method("POST")
+              .endpoint("https://www.googleapis" +
+                      ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/instances/test-1/reset")
+              .addHeader("Accept", "application/json")
+              .addHeader("Authorization", "Bearer " + TOKEN).build();
+
+      HttpResponse resetResponse = HttpResponse.builder().statusCode(404).build();
+
+      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+              TOKEN_RESPONSE, reset, resetResponse).getInstanceApiForProject("myproject");
+
+      assertNull(api.resetInZone("us-central1-a", "test-1"));
+   }
+
+   public void testAttachDiskResponseIs2xx() {
+      HttpRequest attach = HttpRequest
+              .builder()
+              .method("POST")
+              .endpoint("https://www.googleapis" +
+                      ".com/compute/v1beta15/projects/myproject/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).getInstanceApiForProject("myproject");
+
+      assertEquals(api.attachDiskInZone("us-central1-a", "test-1",
+              new AttachDiskOptions()
+                      .mode(DiskMode.READ_ONLY)
+                      .source(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks/testimage1"))
+                      .type(DiskType.PERSISTENT)),
+              new ParseOperationTest().expected());
+   }
+
+   public void testAttachDiskResponseIs4xx() {
+      HttpRequest attach = HttpRequest
+              .builder()
+              .method("POST")
+              .endpoint("https://www.googleapis" +
+                      ".com/compute/v1beta15/projects/myproject/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(404).build();
+
+      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+              TOKEN_RESPONSE, attach, attachResponse).getInstanceApiForProject("myproject");
+
+      assertNull(api.attachDiskInZone("us-central1-a", "test-1",
+              new AttachDiskOptions()
+                      .mode(DiskMode.READ_ONLY)
+                      .source(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks/testimage1"))
+                      .type(DiskType.PERSISTENT)));
+
+   }
+
+   public void testDetachDiskResponseIs2xx() {
+      HttpRequest detach = HttpRequest
+              .builder()
+              .method("POST")
+              .endpoint("https://www.googleapis" +
+                      ".com/compute/v1beta15/projects/myproject/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).getInstanceApiForProject("myproject");
+
+      assertEquals(api.detachDiskInZone("us-central1-a", "test-1", "test-disk-1"),
+              new ParseOperationTest().expected());
+   }
+
+   public void testDetachDiskResponseIs4xx() {
+      HttpRequest detach = HttpRequest
+              .builder()
+              .method("POST")
+              .endpoint("https://www.googleapis" +
+                      ".com/compute/v1beta15/projects/myproject/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(404).build();
+
+      InstanceApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+              TOKEN_RESPONSE, detach, detachResponse).getInstanceApiForProject("myproject");
+
+      assertNull(api.detachDiskInZone("us-central1-a", "test-1", "test-disk-1"));
    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index e4ea6f7..8be4a54 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -18,18 +18,28 @@ package org.jclouds.googlecomputeengine.features;
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
 
+import java.net.URI;
 import java.util.List;
 import java.util.Properties;
 
 import org.jclouds.collect.PagedIterable;
 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.PersistentAttachedDisk;
 import org.jclouds.googlecomputeengine.domain.InstanceTemplate;
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
+import org.jclouds.googlecomputeengine.options.AttachDiskOptions;
+import org.jclouds.googlecomputeengine.options.AttachDiskOptions.DiskMode;
+import org.jclouds.googlecomputeengine.options.AttachDiskOptions.DiskType;
 import org.jclouds.googlecomputeengine.options.ListOptions;
 import org.testng.annotations.Test;
 
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.inject.Module;
@@ -43,22 +53,44 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
    private static final String INSTANCE_NAME = "instance-api-live-test-instance";
    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";
+   private static final String METADATA_ITEM_VALUE = "instanceLiveTestTestValue";
+   private static final String ATTACH_DISK_NAME = "instance-api-live-test-attach-disk";
+   private static final String ATTACH_DISK_DEVICE_NAME = "attach-disk-1";
+
    private static final int TIME_WAIT = 600;
 
    private InstanceTemplate instance;
-   
+
    @Override
    protected GoogleComputeEngineApi create(Properties props, Iterable<Module> modules) {
       GoogleComputeEngineApi api = super.create(props, modules);
+      URI imageUri = api.getImageApiForProject("google")
+              .list(new ListOptions.Builder().filter("name eq gcel.*"))
+              .concat()
+              .filter(new Predicate<Image>() {
+                 @Override
+                 public boolean apply(Image input) {
+                    // filter out only images with deprecation state other than "DEPRECATED"
+                    if (input.getDeprecated().isPresent() && input.getDeprecated().get().getState().isPresent()) {
+                       return input.getDeprecated().get().getState().get().equals("DEPRECATED");
+                    }
+                    return true;
+
+                 }
+              })
+              .first()
+              .get()
+              .getSelfLink();
       instance = InstanceTemplate.builder()
-            .forMachineType(getDefaultMachineTypekUrl(userProject.get()))
-            .addNetworkInterface(getNetworkUrl(userProject.get(), INSTANCE_NETWORK_NAME),
-                    Instance.NetworkInterface.AccessConfig.Type.ONE_TO_ONE_NAT)
-            .addMetadata("mykey", "myvalue")
-            .addTag("atag")
-            .description("a description")
-            .addDisk(InstanceTemplate.PersistentDisk.Mode.READ_WRITE, getDiskUrl(userProject.get(), DISK_NAME))
-            .zone(getDefaultZoneUrl(userProject.get()));
+              .forMachineType(getDefaultMachineTypeUrl(userProject.get()))
+              .addNetworkInterface(getNetworkUrl(userProject.get(), INSTANCE_NETWORK_NAME),
+                      Instance.NetworkInterface.AccessConfig.Type.ONE_TO_ONE_NAT)
+              .addMetadata("mykey", "myvalue")
+              .description("a description")
+              .addDisk(InstanceTemplate.PersistentDisk.Mode.READ_WRITE, getDiskUrl(userProject.get(), DISK_NAME))
+              .image(imageUri);
+
       return api;
    }
 
@@ -66,32 +98,91 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
       return api.getInstanceApiForProject(userProject.get());
    }
 
+   private DiskApi diskApi() {
+      return api.getDiskApiForProject(userProject.get());
+   }
+
    @Test(groups = "live")
    public void testInsertInstance() {
 
       // need to create the network first
-      assertOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).createInIPv4Range
+      assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).createInIPv4Range
               (INSTANCE_NETWORK_NAME, IPV4_RANGE), TIME_WAIT);
 
-      assertOperationDoneSucessfully(api.getDiskApiForProject(userProject.get()).createInZone
-              ("instance-live-test-disk", 1, getDefaultZoneUrl(userProject.get())), TIME_WAIT);
+      assertZoneOperationDoneSucessfully(diskApi().createInZone
+              ("instance-live-test-disk", 10, DEFAULT_ZONE_NAME), TIME_WAIT);
 
-      assertOperationDoneSucessfully(api().createInZone(INSTANCE_NAME, instance, DEFAULT_ZONE_NAME), TIME_WAIT);
+      assertZoneOperationDoneSucessfully(api().createInZone(INSTANCE_NAME, DEFAULT_ZONE_NAME, instance), TIME_WAIT);
 
    }
 
    @Test(groups = "live", dependsOnMethods = "testInsertInstance")
    public void testGetInstance() {
 
-      Instance instance = api().get(INSTANCE_NAME);
+      Instance instance = api().getInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME);
       assertNotNull(instance);
       assertInstanceEquals(instance, this.instance);
    }
 
+   @Test(groups = "live", dependsOnMethods = "testListInstance")
+   public void testSetMetadataForInstance() {
+      Instance originalInstance = api().getInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME);
+      assertZoneOperationDoneSucessfully(api().setMetadataInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME,
+              ImmutableMap.of(METADATA_ITEM_KEY, METADATA_ITEM_VALUE),
+              originalInstance.getMetadata().getFingerprint()),
+              TIME_WAIT);
+
+      Instance modifiedInstance = api().getInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME);
+
+      assertTrue(modifiedInstance.getMetadata().getItems().containsKey(METADATA_ITEM_KEY));
+      assertEquals(modifiedInstance.getMetadata().getItems().get(METADATA_ITEM_KEY),
+              METADATA_ITEM_VALUE);
+      assertNotNull(modifiedInstance.getMetadata().getFingerprint());
+
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testSetMetadataForInstance")
+   public void testAttachDiskToInstance() {
+      assertZoneOperationDoneSucessfully(diskApi().createInZone(ATTACH_DISK_NAME, 1, DEFAULT_ZONE_NAME), TIME_WAIT);
+
+      Instance originalInstance = api().getInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME);
+      assertZoneOperationDoneSucessfully(api().attachDiskInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME,
+              new AttachDiskOptions().type(DiskType.PERSISTENT)
+                      .source(getDiskUrl(userProject.get(), ATTACH_DISK_NAME))
+                      .mode(DiskMode.READ_ONLY)
+                      .deviceName(ATTACH_DISK_DEVICE_NAME)),
+              TIME_WAIT);
+
+      Instance modifiedInstance = api().getInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME);
+
+      assertTrue(modifiedInstance.getDisks().size() > originalInstance.getDisks().size());
+      assertTrue(Iterables.any(modifiedInstance.getDisks(), new Predicate<AttachedDisk>() {
+
+         @Override
+         public boolean apply(AttachedDisk disk) {
+            return disk instanceof PersistentAttachedDisk &&
+                    ((PersistentAttachedDisk) disk).getDeviceName().orNull().equals(ATTACH_DISK_DEVICE_NAME);
+         }
+      }));
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testAttachDiskToInstance")
+   public void testDetachDiskFromInstance() {
+      Instance originalInstance = api().getInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME);
+      assertZoneOperationDoneSucessfully(api().detachDiskInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME,
+              ATTACH_DISK_DEVICE_NAME), TIME_WAIT);
+
+      Instance modifiedInstance = api().getInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME);
+
+      assertTrue(modifiedInstance.getDisks().size() < originalInstance.getDisks().size());
+
+      assertZoneOperationDoneSucessfully(diskApi().deleteInZone(DEFAULT_ZONE_NAME, ATTACH_DISK_NAME), TIME_WAIT);
+   }
+
    @Test(groups = "live", dependsOnMethods = "testInsertInstance")
    public void testListInstance() {
 
-      PagedIterable<Instance> instances = api().list(new ListOptions.Builder()
+      PagedIterable<Instance> instances = api().listInZone(DEFAULT_ZONE_NAME, new ListOptions.Builder()
               .filter("name eq " + INSTANCE_NAME));
 
       List<Instance> instancesAsList = Lists.newArrayList(instances.concat());
@@ -102,19 +193,24 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
 
    }
 
-   @Test(groups = "live", dependsOnMethods = "testListInstance")
+   @Test(groups = "live", dependsOnMethods = "testDetachDiskFromInstance")
+   public void testResetInstance() {
+      assertZoneOperationDoneSucessfully(api().resetInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME),
+              TIME_WAIT);
+   }
+
+   @Test(groups = "live", dependsOnMethods = "testResetInstance")
    public void testDeleteInstance() {
 
-      assertOperationDoneSucessfully(api().delete(INSTANCE_NAME), TIME_WAIT);
-      assertOperationDoneSucessfully(api.getDiskApiForProject(userProject.get()).delete(DISK_NAME),
+      assertZoneOperationDoneSucessfully(api().deleteInZone(DEFAULT_ZONE_NAME, INSTANCE_NAME), TIME_WAIT);
+      assertZoneOperationDoneSucessfully(api.getDiskApiForProject(userProject.get()).deleteInZone(DEFAULT_ZONE_NAME, DISK_NAME),
               TIME_WAIT);
-      assertOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).delete
+      assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).delete
               (INSTANCE_NETWORK_NAME), TIME_WAIT);
    }
 
    private void assertInstanceEquals(Instance result, InstanceTemplate expected) {
       assertEquals(result.getName(), expected.getName());
-      assertEquals(result.getTags(), expected.getTags());
-      assertEquals(result.getMetadata(), expected.getMetadata());
+      assertEquals(result.getMetadata().getItems(), expected.getMetadata());
    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/KernelApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/KernelApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/KernelApiExpectTest.java
index 89e3958..d6f2f5c 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/KernelApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/KernelApiExpectTest.java
@@ -16,6 +16,11 @@
  */
 package org.jclouds.googlecomputeengine.features;
 
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
 import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
 import org.jclouds.googlecomputeengine.parse.ParseKernelListTest;
 import org.jclouds.googlecomputeengine.parse.ParseKernelTest;
@@ -23,11 +28,6 @@ import org.jclouds.http.HttpRequest;
 import org.jclouds.http.HttpResponse;
 import org.testng.annotations.Test;
 
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
 /**
  * @author David Alves
  */
@@ -39,7 +39,7 @@ public class KernelApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/kernels/12941177846308850718")
+                      ".com/compute/v1beta15/projects/myproject/global/kernels/12941177846308850718")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -58,7 +58,7 @@ public class KernelApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/kernels/12941177846308850718")
+                      ".com/compute/v1beta15/projects/myproject/global/kernels/12941177846308850718")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -75,7 +75,7 @@ public class KernelApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/kernels")
+                      ".com/compute/v1beta15/projects/myproject/global/kernels")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 
@@ -94,7 +94,7 @@ public class KernelApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
               .builder()
               .method("GET")
               .endpoint("https://www.googleapis" +
-                      ".com/compute/v1beta13/projects/myproject/kernels")
+                      ".com/compute/v1beta15/projects/myproject/global/kernels")
               .addHeader("Accept", "application/json")
               .addHeader("Authorization", "Bearer " + TOKEN).build();
 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/KernelApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/KernelApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/KernelApiLiveTest.java
index f1476f8..8e9f971 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/KernelApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/KernelApiLiveTest.java
@@ -16,8 +16,14 @@
  */
 package org.jclouds.googlecomputeengine.features;
 
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Iterator;
+import java.util.List;
+
 import org.jclouds.collect.IterableWithMarker;
 import org.jclouds.collect.PagedIterable;
 import org.jclouds.googlecomputeengine.domain.Kernel;
@@ -25,13 +31,8 @@ import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTe
 import org.jclouds.googlecomputeengine.options.ListOptions;
 import org.testng.annotations.Test;
 
-import java.util.Iterator;
-import java.util.List;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertSame;
-import static org.testng.Assert.assertTrue;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
 
 /**
  * @author David Alves