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:52 UTC
[03/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/ZoneOperationApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiExpectTest.java
new file mode 100644
index 0000000..d5d5362
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiExpectTest.java
@@ -0,0 +1,196 @@
+/*
+ * 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 java.net.URI;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.Resource;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.options.ListOptions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.testng.annotations.Test;
+
+/**
+ * @author David Alves
+ */
+@Test(groups = "unit")
+public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+
+ private static final String OPERATIONS_URL_PREFIX = "https://www.googleapis" +
+ ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/operations";
+
+ public static final HttpRequest GET_ZONE_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_ZONE_OPERATION_RESPONSE = HttpResponse.builder().statusCode(200)
+ .payload(staticPayloadFromResource("/zone_operation.json")).build();
+
+ private Operation expected() {
+ SimpleDateFormatDateService dateService = new SimpleDateFormatDateService();
+ return Operation.builder().id("13053095055850848306")
+ .selfLink(URI.create("https://www.googleapis" +
+ ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/operations/operation-1354084865060-4cf88735faeb8" +
+ "-bbbb12cb"))
+ .name("operation-1354084865060-4cf88735faeb8-bbbb12cb")
+ .targetLink(URI.create("https://www.googleapis" +
+ ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/instances/instance-api-live-test-instance"))
+ .targetId("13053094017547040099")
+ .status(Operation.Status.DONE)
+ .user("user@developer.gserviceaccount.com")
+ .progress(100)
+ .insertTime(dateService.iso8601DateParse("2012-11-28T06:41:05.060"))
+ .startTime(dateService.iso8601DateParse("2012-11-28T06:41:05.142"))
+ .endTime(dateService.iso8601DateParse("2012-11-28T06:41:06.142"))
+ .operationType("insert")
+ .zone(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a"))
+ .build();
+ }
+
+ private ListPage<Operation> expectedList() {
+ return ListPage.<Operation>builder()
+ .kind(Resource.Kind.OPERATION_LIST)
+ .id("projects/myproject/zones/us-central1-a/operations")
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/operations"))
+ .addItem(expected())
+ .build();
+ }
+
+ public void testGetOperationResponseIs2xx() throws Exception {
+
+ ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, GET_ZONE_OPERATION_REQUEST, GET_ZONE_OPERATION_RESPONSE).getZoneOperationApiForProject("myproject");
+
+ assertEquals(zoneOperationApi.getInZone("us-central1-a", "operation-1354084865060-4cf88735faeb8-bbbb12cb"),
+ expected());
+ }
+
+ public void testGetOperationResponseIs4xx() throws Exception {
+
+ HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
+
+ ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, GET_ZONE_OPERATION_REQUEST, operationResponse).getZoneOperationApiForProject("myproject");
+
+ assertNull(zoneOperationApi.getInZone("us-central1-a", "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();
+
+ ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, delete, operationResponse).getZoneOperationApiForProject("myproject");
+
+ zoneOperationApi.deleteInZone("us-central1-a", "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();
+
+ ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
+ TOKEN_RESPONSE, delete, operationResponse).getZoneOperationApiForProject("myproject");
+
+ zoneOperationApi.deleteInZone("us-central1-a", "operation-1352178598164-4cdcc9d031510-4aa46279");
+ }
+
+ public void testListOperationWithNoOptionsResponseIs2xx() {
+ 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("/zone_operation_list.json")).build();
+
+ ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, get, operationResponse).getZoneOperationApiForProject("myproject");
+
+ assertEquals(zoneOperationApi.listFirstPageInZone("us-central1-a").toString(),
+ expectedList().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("/zone_operation_list.json")).build();
+
+ ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, get, operationResponse).getZoneOperationApiForProject("myproject");
+
+ assertEquals(zoneOperationApi.listAtMarkerInZone("us-central1-a",
+ "CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1Mj" +
+ "I0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz",
+ new ListOptions.Builder().filter("status eq done").maxResults(3)).toString(),
+ expectedList().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();
+
+ ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
+ TOKEN_RESPONSE, get, operationResponse).getZoneOperationApiForProject("myproject");
+
+ assertTrue(zoneOperationApi.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/ZoneOperationApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiLiveTest.java
new file mode 100644
index 0000000..6ea4774
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneOperationApiLiveTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.DiskApiLiveTest.TIME_WAIT;
+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 Andrew Bayer
+ */
+public class ZoneOperationApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
+
+ private static final String DISK_NAME = "zone-operations-api-live-test-disk";
+ private Operation addOperation;
+ private Operation deleteOperation;
+
+ private ZoneOperationApi api() {
+ return api.getZoneOperationApiForProject(userProject.get());
+ }
+
+ private DiskApi diskApi() {
+ return api.getDiskApiForProject(userProject.get());
+ }
+
+ @Test(groups = "live")
+ public void testCreateOperations() {
+ //create some operations by creating and deleting a disk
+ // this will make sure there is stuff to listFirstPage
+ addOperation = assertZoneOperationDoneSucessfully(diskApi().createInZone(DISK_NAME, 1, DEFAULT_ZONE_NAME), TIME_WAIT);
+ deleteOperation = assertZoneOperationDoneSucessfully(diskApi().deleteInZone(DEFAULT_ZONE_NAME, DISK_NAME), TIME_WAIT);
+
+ assertNotNull(addOperation);
+ assertNotNull(deleteOperation);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testCreateOperations")
+ public void testGetOperation() {
+ Operation operation = api().getInZone(DEFAULT_ZONE_NAME, addOperation.getName());
+ assertNotNull(operation);
+ assertOperationEquals(operation, this.addOperation);
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testCreateOperations")
+ public void testListOperationsWithFiltersAndPagination() {
+ PagedIterable<Operation> operations = api().listInZone(DEFAULT_ZONE_NAME, new ListOptions.Builder()
+// .filter("operationType eq insert")
+ .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/handlers/GoogleComputeEngineErrorHandlerTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/handlers/GoogleComputeEngineErrorHandlerTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/handlers/GoogleComputeEngineErrorHandlerTest.java
index e4f4cbb..ccad321 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/handlers/GoogleComputeEngineErrorHandlerTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/handlers/GoogleComputeEngineErrorHandlerTest.java
@@ -16,20 +16,20 @@
*/
package org.jclouds.googlecomputeengine.handlers;
-import org.easymock.IArgumentMatcher;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-import java.net.URI;
-
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.reportMatcher;
import static org.easymock.EasyMock.verify;
+import java.net.URI;
+
+import org.easymock.IArgumentMatcher;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.testng.annotations.Test;
+
/**
* @author Adrian Cole
*/
@@ -40,7 +40,7 @@ public class GoogleComputeEngineErrorHandlerTest {
public void test409MakesIllegalStateException() {
assertCodeMakes(
"POST",
- URI.create("https://www.googleapis.com/compute/v1beta13"),
+ URI.create("https://www.googleapis.com/compute/v1beta15"),
409,
"HTTP/1.1 409 Conflict",
"\"{\"code\":\"InvalidState\",\"message\":\"An incompatible transition has already been queued for this" +
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiExpectTest.java
index f6760fb..ae7be6a 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiExpectTest.java
@@ -16,10 +16,10 @@
*/
package org.jclouds.googlecomputeengine.internal;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-
import java.util.Properties;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+
/**
* @author Adrian Cole
*/
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
index 07a8fab..93567b8 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiLiveTest.java
@@ -36,6 +36,7 @@ import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.TypeLiteral;
+import com.google.inject.name.Names;
/**
@@ -43,20 +44,28 @@ import com.google.inject.TypeLiteral;
*/
public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleComputeEngineApi> {
- protected static final String API_URL_PREFIX = "https://www.googleapis.com/compute/v1beta13/projects/";
+ protected static final String API_URL_PREFIX = "https://www.googleapis.com/compute/v1beta15/projects/";
protected static final String ZONE_API_URL_SUFFIX = "/zones/";
protected static final String DEFAULT_ZONE_NAME = "us-central1-a";
- protected static final String NETWORK_API_URL_SUFFIX = "/networks/";
+ protected static final String REGION_API_URL_SUFFIX = "/region/";
+ protected static final String DEFAULT_REGION_NAME = "us-central1";
+
+ protected static final String NETWORK_API_URL_SUFFIX = "/global/networks/";
protected static final String DEFAULT_NETWORK_NAME = "live-test-network";
protected static final String MACHINE_TYPE_API_URL_SUFFIX = "/machineTypes/";
protected static final String DEFAULT_MACHINE_TYPE_NAME = "n1-standard-1";
+ protected static final String GATEWAY_API_URL_SUFFIX = "/global/gateways/";
+ protected static final String DEFAULT_GATEWAY_NAME = "default-internet-gateway";
+
protected static final String GOOGLE_PROJECT = "google";
protected Supplier<String> userProject;
- protected Predicate<AtomicReference<Operation>> operationDonePredicate;
+ protected Predicate<AtomicReference<Operation>> globalOperationDonePredicate;
+ protected Predicate<AtomicReference<Operation>> regionOperationDonePredicate;
+ protected Predicate<AtomicReference<Operation>> zoneOperationDonePredicate;
public BaseGoogleComputeEngineApiLiveTest() {
@@ -67,20 +76,46 @@ public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleCo
Injector injector = newBuilder().modules(modules).overrides(props).buildInjector();
userProject = injector.getInstance(Key.get(new TypeLiteral<Supplier<String>>() {
}, UserProject.class));
- operationDonePredicate = injector.getInstance(Key.get(new TypeLiteral<Predicate<AtomicReference<Operation>>>() {
- }));
+ globalOperationDonePredicate = injector.getInstance(Key.get(new TypeLiteral<Predicate<AtomicReference<Operation>>>() {
+ }, Names.named("global")));
+ regionOperationDonePredicate = injector.getInstance(Key.get(new TypeLiteral<Predicate<AtomicReference<Operation>>>() {
+ }, Names.named("region")));
+ zoneOperationDonePredicate = injector.getInstance(Key.get(new TypeLiteral<Predicate<AtomicReference<Operation>>>() {
+ }, Names.named("zone")));
return injector.getInstance(GoogleComputeEngineApi.class);
}
- protected Operation assertOperationDoneSucessfully(Operation operation, long maxWaitSeconds) {
- operation = waitOperationDone(operation, maxWaitSeconds);
+ protected Operation assertGlobalOperationDoneSucessfully(Operation operation, long maxWaitSeconds) {
+ operation = waitGlobalOperationDone(operation, maxWaitSeconds);
+ assertEquals(operation.getStatus(), Operation.Status.DONE);
+ assertTrue(operation.getErrors().isEmpty());
+ return operation;
+ }
+
+ protected Operation waitGlobalOperationDone(Operation operation, long maxWaitSeconds) {
+ return waitOperationDone(globalOperationDonePredicate, operation, maxWaitSeconds);
+ }
+
+ protected Operation assertRegionOperationDoneSucessfully(Operation operation, long maxWaitSeconds) {
+ operation = waitRegionOperationDone(operation, maxWaitSeconds);
assertEquals(operation.getStatus(), Operation.Status.DONE);
assertTrue(operation.getErrors().isEmpty());
return operation;
}
- protected Operation waitOperationDone(Operation operation, long maxWaitSeconds) {
- return waitOperationDone(operationDonePredicate, operation, maxWaitSeconds);
+ protected Operation waitRegionOperationDone(Operation operation, long maxWaitSeconds) {
+ return waitOperationDone(regionOperationDonePredicate, operation, maxWaitSeconds);
+ }
+
+ protected Operation assertZoneOperationDoneSucessfully(Operation operation, long maxWaitSeconds) {
+ operation = waitZoneOperationDone(operation, maxWaitSeconds);
+ assertEquals(operation.getStatus(), Operation.Status.DONE);
+ assertTrue(operation.getErrors().isEmpty());
+ return operation;
+ }
+
+ protected Operation waitZoneOperationDone(Operation operation, long maxWaitSeconds) {
+ return waitOperationDone(zoneOperationDonePredicate, operation, maxWaitSeconds);
}
protected URI getDefaultZoneUrl(String project) {
@@ -99,22 +134,28 @@ public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleCo
return URI.create(API_URL_PREFIX + project + NETWORK_API_URL_SUFFIX + network);
}
- protected URI getDefaultMachineTypekUrl(String project) {
- return gettMachineTypeUrl(project, DEFAULT_MACHINE_TYPE_NAME);
+ protected URI getGatewayUrl(String project, String gateway) {
+ return URI.create(API_URL_PREFIX + project + GATEWAY_API_URL_SUFFIX + gateway);
+ }
+
+ protected URI getDefaultMachineTypeUrl(String project) {
+ return getMachineTypeUrl(project, DEFAULT_MACHINE_TYPE_NAME);
}
- protected URI gettMachineTypeUrl(String project, String machineType) {
- return URI.create(API_URL_PREFIX + project + MACHINE_TYPE_API_URL_SUFFIX + machineType);
+ protected URI getMachineTypeUrl(String project, String machineType) {
+ return URI.create(API_URL_PREFIX + project + ZONE_API_URL_SUFFIX
+ + DEFAULT_ZONE_NAME + MACHINE_TYPE_API_URL_SUFFIX + machineType);
}
protected URI getDiskUrl(String project, String diskName) {
- return URI.create(API_URL_PREFIX + project + "/disks/" + diskName);
+ return URI.create(API_URL_PREFIX + project + ZONE_API_URL_SUFFIX
+ + DEFAULT_ZONE_NAME + "/disks/" + diskName);
}
protected static Operation waitOperationDone(Predicate<AtomicReference<Operation>> operationDonePredicate,
Operation operation, long maxWaitSeconds) {
AtomicReference<Operation> operationReference = new AtomicReference<Operation>(operation);
- retry(operationDonePredicate, maxWaitSeconds, 1, SECONDS).apply(operationReference);
+ retry(operationDonePredicate, maxWaitSeconds, 1, SECONDS).apply(operationReference);
return operationReference.get();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineExpectTest.java
index 7ca8ac1..bb2eec1 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineExpectTest.java
@@ -16,25 +16,19 @@
*/
package org.jclouds.googlecomputeengine.internal;
-import com.google.common.base.Joiner;
-import com.google.common.base.Supplier;
-import com.google.common.base.Ticker;
-import com.google.inject.Binder;
-import com.google.inject.Module;
-import com.google.inject.TypeLiteral;
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.collect.PagedIterables;
-import org.jclouds.crypto.Crypto;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.io.Payload;
-import org.jclouds.oauth.v2.OAuthConstants;
-import org.jclouds.rest.internal.BaseRestApiExpectTest;
-import org.jclouds.ssh.SshKeys;
-import org.jclouds.util.Strings2;
+import static com.google.common.base.Charsets.UTF_8;
+import static com.google.common.base.Throwables.propagate;
+import static com.google.common.io.BaseEncoding.base64Url;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.jclouds.crypto.Pems.privateKeySpec;
+import static org.jclouds.crypto.Pems.publicKeySpec;
+import static org.jclouds.crypto.PemsTest.PRIVATE_KEY;
+import static org.jclouds.crypto.PemsTest.PUBLIC_KEY;
+import static org.jclouds.io.Payloads.newStringPayload;
-import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.net.URI;
import java.security.KeyFactory;
@@ -49,18 +43,26 @@ import java.security.spec.InvalidKeySpecException;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicInteger;
-import static com.google.common.base.Charsets.UTF_8;
-import static com.google.common.base.Throwables.propagate;
-import static com.google.common.io.BaseEncoding.base64Url;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.jclouds.crypto.Pems.privateKeySpec;
-import static org.jclouds.crypto.Pems.publicKeySpec;
-import static org.jclouds.crypto.PemsTest.PRIVATE_KEY;
-import static org.jclouds.crypto.PemsTest.PUBLIC_KEY;
-import static org.jclouds.io.Payloads.newStringPayload;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.collect.PagedIterable;
+import org.jclouds.collect.PagedIterables;
+import org.jclouds.crypto.Crypto;
+import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.io.Payload;
+import org.jclouds.oauth.v2.OAuthConstants;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
+import org.jclouds.ssh.SshKeys;
+import org.jclouds.util.Strings2;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Supplier;
+import com.google.common.base.Ticker;
+import com.google.inject.Binder;
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
/**
* @author Adrian Cole
@@ -151,6 +153,17 @@ public class BaseGoogleComputeEngineExpectTest<T> extends BaseRestApiExpectTest<
return props;
}
+ @Override
+ protected HttpRequestComparisonType compareHttpRequestAsType(HttpRequest input) {
+ HttpRequestComparisonType reqType = HttpRequestComparisonType.DEFAULT;
+ if (input.getPayload() != null) {
+ if (input.getPayload().getContentMetadata().getContentType().equals(MediaType.APPLICATION_JSON)) {
+ reqType = HttpRequestComparisonType.JSON;
+ }
+ }
+ return reqType;
+ }
+
protected HttpRequest requestForScopes(String... scopes) {
String claims = String.format(CLAIMS_TEMPLATE, Joiner.on(",").join(scopes));
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineParseTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineParseTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineParseTest.java
index e24e279..5dfa34c 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineParseTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineParseTest.java
@@ -16,12 +16,13 @@
*/
package org.jclouds.googlecomputeengine.internal;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
import org.jclouds.googlecomputeengine.config.GoogleComputeEngineParserModule;
import org.jclouds.json.BaseItemParserTest;
import org.jclouds.json.config.GsonModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
/**
* @author David Alves
*/
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceContextExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceContextExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceContextExpectTest.java
index 12caaf6..21ddff3 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceContextExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceContextExpectTest.java
@@ -16,15 +16,16 @@
*/
package org.jclouds.googlecomputeengine.internal;
-import com.google.common.base.Function;
-import com.google.inject.Module;
+import java.util.Properties;
+
import org.jclouds.apis.ApiMetadata;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.googlecomputeengine.GoogleComputeEngineApiMetadata;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
-import java.util.Properties;
+import com.google.common.base.Function;
+import com.google.inject.Module;
/**
* @author David Alves
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
new file mode 100644
index 0000000..4043d23
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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 java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.Address;
+import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.Resource.Kind;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author David Alves
+ */
+@Test(groups = "unit")
+public class ParseAddressListTest extends BaseGoogleComputeEngineParseTest<ListPage<Address>> {
+
+ @Override
+ public String resource() {
+ return "/address_list.json";
+ }
+
+ @Override
+ @Consumes(MediaType.APPLICATION_JSON)
+ public ListPage<Address> expected() {
+ return ListPage.<Address>builder()
+ .kind(Kind.ADDRESS_LIST)
+ .id("projects/myproject/regions/us-central1/addresses")
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/regions/us-central1/addresses"))
+ .items(ImmutableSet.of(new ParseAddressTest().expected(),
+ Address.builder()
+ .id("4881363978908129158")
+ .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T14:08:21.552-07:00"))
+ .status("RESERVED")
+ .region(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/regions/us-central1"))
+ .name("test-ip2")
+ .description("")
+ .address("173.255.118.115")
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/regions/us-central1/addresses/test-ip2"))
+ .build())
+ ).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
new file mode 100644
index 0000000..0441012
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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 java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.Address;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author David Alves
+ */
+@Test(groups = "unit")
+public class ParseAddressTest extends BaseGoogleComputeEngineParseTest<Address> {
+
+ @Override
+ public String resource() {
+ return "/address_get.json";
+ }
+
+ @Override
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Address expected() {
+ return Address.builder()
+ .id("4439373783165447583")
+ .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T13:57:20.204-07:00"))
+ .status("RESERVED")
+ .region(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/regions/us-central1"))
+ .name("test-ip1")
+ .description("")
+ .address("173.255.115.190")
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/regions/us-central1/addresses/test-ip1"))
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java
index ebde5e4..7b83d8e 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java
@@ -16,7 +16,11 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import com.google.common.collect.ImmutableSet;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Disk;
import org.jclouds.googlecomputeengine.domain.ListPage;
@@ -24,9 +28,7 @@ import org.jclouds.googlecomputeengine.domain.Resource;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
+import com.google.common.collect.ImmutableSet;
/**
* @author David Alves
@@ -44,17 +46,17 @@ public class ParseDiskListTest extends BaseGoogleComputeEngineParseTest<ListPage
public ListPage<Disk> expected() {
return ListPage.<Disk>builder()
.kind(Resource.Kind.DISK_LIST)
- .id("projects/myproject/disks")
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/disks"))
+ .id("projects/myproject/zones/us-central1-a/disks")
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks"))
.items(ImmutableSet.of(Disk.builder()
.id("13050421646334304115")
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306"))
.selfLink(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/myproject/disks/testimage1"))
+ ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks/testimage1"))
.name("testimage1")
.sizeGb(1)
.zone(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/myproject/zones/us-central1-a"))
+ ".com/compute/v1beta15/projects/myproject/zones/us-central1-a"))
.status("READY")
.build())
).build();
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
index 31a9501..83cea8d 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java
@@ -16,15 +16,16 @@
*/
package org.jclouds.googlecomputeengine.parse;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Disk;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
-
/**
* @author David Alves
*/
@@ -42,10 +43,10 @@ public class ParseDiskTest extends BaseGoogleComputeEngineParseTest<Disk> {
return Disk.builder()
.id("13050421646334304115")
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306"))
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/disks/testimage1"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks/testimage1"))
.name("testimage1")
.sizeGb(1)
- .zone(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/zones/us-central1-a"))
+ .zone(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a"))
.status("READY")
.build();
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
index 1f0b39e..a90f17b 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java
@@ -16,7 +16,11 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import com.google.common.collect.ImmutableSet;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Firewall;
import org.jclouds.googlecomputeengine.domain.ListPage;
@@ -24,9 +28,7 @@ import org.jclouds.googlecomputeengine.domain.Resource;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
+import com.google.common.collect.ImmutableSet;
/**
* @author David Alves
@@ -45,18 +47,18 @@ public class ParseFirewallListTest extends BaseGoogleComputeEngineParseTest<List
return ListPage.<Firewall>builder()
.kind(Resource.Kind.FIREWALL_LIST)
.id("projects/google/firewalls")
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/google/firewalls"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/google/global/firewalls"))
.items(ImmutableSet.of(
new ParseFirewallTest().expected()
, Firewall.builder()
.id("12862241067393040785")
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-04-13T03:05:04.365"))
.selfLink(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/google/firewalls/default-ssh"))
+ ".com/compute/v1beta15/projects/google/global/firewalls/default-ssh"))
.name("default-ssh")
.description("SSH allowed from anywhere")
.network(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/google/networks/default"))
+ ".com/compute/v1beta15/projects/google/global/networks/default"))
.addSourceRange("0.0.0.0/0")
.addAllowed(Firewall.Rule.builder()
.IPProtocol(Firewall.Rule.IPProtocol.TCP)
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
index 1b9b8e2..187380f 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java
@@ -16,16 +16,17 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
-import org.testng.annotations.Test;
+import static org.jclouds.googlecomputeengine.domain.Firewall.Rule.IPProtocol;
+
+import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
-import java.net.URI;
-import static org.jclouds.googlecomputeengine.domain.Firewall.Rule.IPProtocol;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.Firewall;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import org.testng.annotations.Test;
/**
* @author David Alves
@@ -44,10 +45,10 @@ public class ParseFirewallTest extends BaseGoogleComputeEngineParseTest<Firewall
return Firewall.builder()
.id("12862241031274216284")
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-04-13T03:05:02.855"))
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/firewalls/jclouds-test"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/global/firewalls/jclouds-test"))
.name("jclouds-test")
.description("Internal traffic from default allowed")
- .network(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/networks/jclouds-test"))
+ .network(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/global/networks/jclouds-test"))
.addSourceRange("10.0.0.0/8")
.addAllowed(Firewall.Rule.builder()
.IPProtocol(IPProtocol.TCP)
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageListTest.java
index 245f0d2..1f57299 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageListTest.java
@@ -16,17 +16,20 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import com.google.common.collect.ImmutableSet;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.Deprecated;
import org.jclouds.googlecomputeengine.domain.Image;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Resource;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
+import com.google.common.collect.ImmutableSet;
/**
* @author David Alves
@@ -44,18 +47,22 @@ public class ParseImageListTest extends BaseGoogleComputeEngineParseTest<ListPag
public ListPage<Image> expected() {
return ListPage.<Image>builder()
.kind(Resource.Kind.IMAGE_LIST)
- .id("projects/google/images")
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/google/images"))
+ .id("projects/google/global/images")
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/google/global/images"))
.items(ImmutableSet.of(Image.builder()
.id("12941197498378735318")
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-07-16T22:16:13.468"))
.selfLink(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/google/images/centos-6-2-v20120326"))
+ ".com/compute/v1beta15/projects/google/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")
.preferredKernel(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/google/kernels/gce-20120326"))
+ ".com/compute/v1beta15/projects/google/kernels/gce-20120326"))
+ .deprecated(Deprecated.builder()
+ .state("DEPRECATED")
+ .replacement(URI.create("https://www.googleapis.com/compute/v1beta15/projects/google/global/images/centos-6-v20130104"))
+ .build())
.rawDisk(
Image.RawDisk.builder()
.source("")
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java
index 22c0016..a62e59a 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java
@@ -16,15 +16,16 @@
*/
package org.jclouds.googlecomputeengine.parse;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Image;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
-
/**
* @author David Alves
*/
@@ -42,13 +43,13 @@ public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> {
return Image.builder()
.id("12941197498378735318")
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-07-16T22:16:13.468"))
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/google/images/centos-6-2" +
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/google/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")
.preferredKernel(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/google/kernels/gce-20120326"))
+ ".com/compute/v1beta15/projects/google/kernels/gce-20120326"))
.rawDisk(
Image.RawDisk.builder()
.source("")
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java
index 9917914..3bd010d 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java
@@ -16,15 +16,17 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import com.google.common.collect.ImmutableSet;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.googlecomputeengine.domain.Instance;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Resource;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
+import com.google.common.collect.ImmutableSet;
/**
* @author David Alves
@@ -41,8 +43,8 @@ public class ParseInstanceListTest extends BaseGoogleComputeEngineParseTest<List
public ListPage<Instance> expected() {
return ListPage.<Instance>builder()
.kind(Resource.Kind.INSTANCE_LIST)
- .id("projects/myproject/instances")
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/instances"))
+ .id("projects/myproject/zones/us-central1-a/instances")
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/instances"))
.items(ImmutableSet.of(new ParseInstanceTest().expected()))
.build();
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java
index f6091ba..c64fca3 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java
@@ -16,12 +16,12 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import org.jclouds.googlecomputeengine.domain.Instance;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
+import org.jclouds.googlecomputeengine.domain.Instance;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+
/**
* @author David Alves
*/
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
index 1940f86..26fa0ce 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java
@@ -16,14 +16,17 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import com.google.common.collect.ImmutableMap;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Instance;
+import org.jclouds.googlecomputeengine.domain.Metadata;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
+import com.google.common.collect.ImmutableMap;
/**
* @author David Alves
@@ -42,21 +45,21 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
.id("13051190678907570425")
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T23:48:20.758"))
.selfLink(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/myproject/instances/test-0"))
+ ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/instances/test-0"))
.description("desc")
.name("test-0")
.image(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/google/images/gcel-12-04-v20121106"))
- .machineType(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/machineTypes/n1" +
+ ".com/compute/v1beta15/projects/google/global/images/gcel-12-04-v20121106"))
+ .machineType(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/machineTypes/n1" +
"-standard-1"))
.status(Instance.Status.RUNNING)
- .zone(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/zones/us-central1-a"))
+ .zone(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a"))
.addNetworkInterface(
Instance.NetworkInterface.builder()
.name("nic0")
.networkIP("10.240.121.115")
.network(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/myproject/networks/default"))
+ ".com/compute/v1beta15/projects/myproject/global/networks/default"))
.build()
)
.addDisk(
@@ -65,11 +68,14 @@ public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance
.mode(Instance.PersistentAttachedDisk.Mode.READ_WRITE)
.deviceName("test")
.source(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/myproject/disks/test"))
+ ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/disks/test"))
.build()
)
- .addTag("aTag")
- .metadata(ImmutableMap.of("aKey", "aValue"))
+ .tags(Instance.Tags.builder().fingerprint("abcd").addItem("aTag").build())
+ .metadata(Metadata.builder()
+ .items(ImmutableMap.of("aKey", "aValue"))
+ .fingerprint("efgh")
+ .build())
.addServiceAccount(Instance.ServiceAccount.builder().email("default").addScopes("myscope").build())
.build();
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseKernelListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseKernelListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseKernelListTest.java
index 67f7069..f95540d 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseKernelListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseKernelListTest.java
@@ -16,17 +16,17 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import com.google.common.collect.ImmutableSet;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecomputeengine.domain.Kernel;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.domain.Resource;
+import org.jclouds.googlecomputeengine.domain.*;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
+import com.google.common.collect.ImmutableSet;
/**
* @author David Alves
@@ -44,15 +44,15 @@ public class ParseKernelListTest extends BaseGoogleComputeEngineParseTest<ListPa
public ListPage<Kernel> expected() {
return ListPage.<Kernel>builder()
.kind(Resource.Kind.KERNEL_LIST)
- .id("projects/google/kernels")
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/google/kernels"))
+ .id("projects/google/global/kernels")
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/google/global/kernels"))
.items(ImmutableSet.of(
Kernel.builder()
.id("12941177846308850718")
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse
("2012-07-16T21:42:16.950"))
.selfLink(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/google/kernels/gce-20110524"))
+ ".com/compute/v1beta15/projects/google/global/kernels/gce-20110524"))
.name("gce-20110524")
.description("DEPRECATED. Created Tue, 24 May 2011 00:48:22 +0000").build(),
Kernel.builder()
@@ -60,9 +60,14 @@ public class ParseKernelListTest extends BaseGoogleComputeEngineParseTest<ListPa
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse
("2012-07-16T21:42:31.166"))
.selfLink(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/google/kernels/gce-20110728"))
+ ".com/compute/v1beta15/projects/google/global/kernels/gce-20110728"))
.name("gce-20110728")
- .description("DEPRECATED. Created Thu, 28 Jul 2011 16:44:38 +0000").build()
+ .description("DEPRECATED. Created Thu, 28 Jul 2011 16:44:38 +0000")
+ .deprecated(org.jclouds.googlecomputeengine.domain.Deprecated.builder()
+ .state("OBSOLETE")
+ .replacement(URI.create("https://www.googleapis.com/compute/v1beta15/projects/google/global/kernels/gce-v20130603"))
+ .build())
+ .build()
)).build();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseKernelTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseKernelTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseKernelTest.java
index b857d8b..84fdd89 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseKernelTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseKernelTest.java
@@ -16,15 +16,16 @@
*/
package org.jclouds.googlecomputeengine.parse;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Kernel;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
-
/**
* @author David Alves
*/
@@ -42,7 +43,7 @@ public class ParseKernelTest extends BaseGoogleComputeEngineParseTest<Kernel> {
return Kernel.builder()
.id("12941177846308850718")
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-07-16T21:42:16.950"))
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/google/kernels/gce-20110524"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/google/global/kernels/gce-20110524"))
.name("gce-20110524")
.description("DEPRECATED. Created Tue, 24 May 2011 00:48:22 +0000")
.build();
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
index 9804377..e854d6b 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java
@@ -16,16 +16,17 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.domain.MachineType;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import static org.jclouds.googlecomputeengine.domain.Resource.Kind.MACHINE_TYPE_LIST;
+
+import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
-import java.net.URI;
-import static org.jclouds.googlecomputeengine.domain.Resource.Kind.MACHINE_TYPE_LIST;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.googlecomputeengine.domain.MachineType;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
/**
* @author David Alves
@@ -45,12 +46,27 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
return ListPage.<MachineType>builder()
.kind(MACHINE_TYPE_LIST)
.id("projects/myproject/machineTypes")
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/machineTypes"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/machineTypes"))
+ .addItem(MachineType.builder()
+ .id("4618642685664990776")
+ .creationTimestamp(dateService.iso8601DateParse("2013-04-25T13:32:49.088-07:00"))
+ .selfLink(URI.create("https://www.googleapis" +
+ ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/machineTypes/f1-micro"))
+ .zone("us-central1-a")
+ .name("f1-micro")
+ .description("1 vCPU (shared physical core) and 0.6 GB RAM")
+ .guestCpus(1)
+ .memoryMb(614)
+ .imageSpaceGb(0)
+ .maximumPersistentDisks(4)
+ .maximumPersistentDisksSizeGb(3072)
+ .build())
.addItem(MachineType.builder()
.id("12907738072351752276")
.creationTimestamp(dateService.iso8601DateParse("2012-06-07T20:48:14.670"))
.selfLink(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/myproject/machineTypes/n1-standard-1"))
+ ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/machineTypes/n1-standard-1"))
+ .zone("us-central1-a")
.name("n1-standard-1")
.description("1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk")
.guestCpus(1)
@@ -63,15 +79,16 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
.id("12908560709887590691")
.creationTimestamp(dateService.iso8601DateParse("2012-06-07T20:51:19.936"))
.selfLink(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/myproject/machineTypes/n1-standard-8-d"))
+ ".com/compute/v1beta15/projects/myproject/zones/us-central1-a/machineTypes/n1-standard-8-d"))
+ .zone("us-central1-a")
.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)
.imageSpaceGb(10)
- .addEphemeralDisk(1770)
- .addEphemeralDisk(1770)
+ .addScratchDisk(1770)
+ .addScratchDisk(1770)
.maximumPersistentDisks(16)
.maximumPersistentDisksSizeGb(1024)
.build())
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
index b53c445..e55cd5c 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java
@@ -16,13 +16,14 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecomputeengine.domain.MachineType;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
-import java.net.URI;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.MachineType;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
/**
* @author David Alves
@@ -42,15 +43,16 @@ public class ParseMachineTypeTest extends BaseGoogleComputeEngineParseTest<Machi
return MachineType.builder()
.id("12907738072351752276")
.creationTimestamp(dateService.iso8601DateParse("2012-06-07T20:48:14.670"))
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/machineTypes/n1" +
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/zones/us-central1-a/machineTypes/n1" +
"-standard-1"))
+ .zone("us-central1-a")
.name("n1-standard-1")
.description("1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk")
.guestCpus(1)
.memoryMb(3840)
.imageSpaceGb(10)
- .addEphemeralDisk(1770)
- .addEphemeralDisk(1770)
+ .addScratchDisk(1770)
+ .addScratchDisk(1770)
.maximumPersistentDisks(16)
.maximumPersistentDisksSizeGb(128)
.build();
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMetadataTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMetadataTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMetadataTest.java
index 52defb7..ebd5298 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMetadataTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMetadataTest.java
@@ -16,19 +16,20 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import com.google.common.collect.ImmutableMap;
-import org.jclouds.googlecomputeengine.config.GoogleComputeEngineParserModule;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.googlecomputeengine.domain.Metadata;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
+import com.google.common.collect.ImmutableMap;
/**
* @author David Alves
*/
@Test(groups = "unit")
-public class ParseMetadataTest extends BaseGoogleComputeEngineParseTest<GoogleComputeEngineParserModule.Metadata> {
+public class ParseMetadataTest extends BaseGoogleComputeEngineParseTest<Metadata> {
@Override
public String resource() {
@@ -37,8 +38,8 @@ public class ParseMetadataTest extends BaseGoogleComputeEngineParseTest<GoogleCo
@Override
@Consumes(MediaType.APPLICATION_JSON)
- public GoogleComputeEngineParserModule.Metadata expected() {
- return new GoogleComputeEngineParserModule.Metadata(
+ public Metadata expected() {
+ return new Metadata("efgh",
ImmutableMap.<String, String>builder()
.put("propA", "valueA")
.put("propB", "valueB")
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java
index 1d2c78f..b271e91 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java
@@ -16,15 +16,17 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import com.google.common.collect.ImmutableSet;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Network;
import org.jclouds.googlecomputeengine.domain.Resource;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
+import com.google.common.collect.ImmutableSet;
/**
* @author David Alves
@@ -42,7 +44,7 @@ public class ParseNetworkListTest extends BaseGoogleComputeEngineParseTest<ListP
return ListPage.<Network>builder()
.kind(Resource.Kind.NETWORK_LIST)
.id("projects/myproject/networks")
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/networks"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/networks"))
.items(ImmutableSet.of(new ParseNetworkTest().expected()))
.build();
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
index 4a4592a..da6992a 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java
@@ -16,13 +16,14 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecomputeengine.domain.Network;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
+import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
-import java.net.URI;
+
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.googlecomputeengine.domain.Network;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
/**
* @author David Alves
@@ -40,7 +41,7 @@ public class ParseNetworkTest extends BaseGoogleComputeEngineParseTest<Network>
return Network.builder()
.id("13024414170909937976")
.creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-10-24T20:13:19.967"))
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/networks/jclouds-test"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/networks/jclouds-test"))
.name("default")
.description("Default network for the project")
.IPv4Range("10.0.0.0/8")
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationListTest.java
index d8e1e26..c62b49a 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationListTest.java
@@ -16,15 +16,16 @@
*/
package org.jclouds.googlecomputeengine.parse;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.domain.Resource;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
-
/**
* @author David Alves
*/
@@ -32,7 +33,7 @@ public class ParseOperationListTest extends BaseGoogleComputeEngineParseTest<Lis
@Override
public String resource() {
- return "/operation_list.json";
+ return "/global_operation_list.json";
}
@Override
@@ -40,8 +41,8 @@ public class ParseOperationListTest extends BaseGoogleComputeEngineParseTest<Lis
public ListPage<Operation> expected() {
return ListPage.<Operation>builder()
.kind(Resource.Kind.OPERATION_LIST)
- .id("projects/myproject/operations")
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject/operations"))
+ .id("projects/myproject/global/operations")
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject/global/operations"))
.addItem(new ParseOperationTest().expected())
.build();
}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
index 0813038..c3b1e90 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
@@ -16,15 +16,16 @@
*/
package org.jclouds.googlecomputeengine.parse;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
-
/**
* @author David Alves
*/
@@ -33,7 +34,7 @@ public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operati
@Override
public String resource() {
- return "/operation.json";
+ return "/global_operation.json";
}
@Override
@@ -42,12 +43,11 @@ public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operati
SimpleDateFormatDateService dateService = new SimpleDateFormatDateService();
return Operation.builder().id("13053095055850848306")
.selfLink(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/myproject/operations/operation-1354084865060-4cf88735faeb8" +
+ ".com/compute/v1beta15/projects/myproject/global/operations/operation-1354084865060-4cf88735faeb8" +
"-bbbb12cb"))
.name("operation-1354084865060-4cf88735faeb8-bbbb12cb")
.targetLink(URI.create("https://www.googleapis" +
- ".com/compute/v1beta13/projects/myproject/instances/instance-api-live" +
- "-test-instance"))
+ ".com/compute/v1beta15/projects/myproject/global/firewalls/jclouds-test-delete"))
.targetId("13053094017547040099")
.status(Operation.Status.DONE)
.user("user@developer.gserviceaccount.com")
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-google/blob/53386380/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java
index 5d0c173..76acc08 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java
@@ -16,15 +16,18 @@
*/
package org.jclouds.googlecomputeengine.parse;
-import com.google.common.collect.ImmutableMap;
+import java.net.URI;
+import java.util.Date;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.googlecomputeengine.domain.Metadata;
import org.jclouds.googlecomputeengine.domain.Project;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-import java.net.URI;
-import java.util.Date;
+import com.google.common.collect.ImmutableMap;
/**
* @author David Alves
@@ -43,14 +46,16 @@ public class ParseProjectTest extends BaseGoogleComputeEngineParseTest<Project>
return Project.builder()
.id("13024414184846275913")
.creationTimestamp(new Date(Long.parseLong("1351109596252")))
- .selfLink(URI.create("https://www.googleapis.com/compute/v1beta13/projects/myproject"))
+ .selfLink(URI.create("https://www.googleapis.com/compute/v1beta15/projects/myproject"))
.name("myproject")
.description("")
- .commonInstanceMetadata(
- ImmutableMap.<String, String>builder()
+ .commonInstanceMetadata(Metadata.builder()
+ .items(ImmutableMap.<String, String>builder()
.put("propA", "valueA")
.put("propB", "valueB")
.build())
+ .fingerprint("efgh")
+ .build())
.addQuota("INSTANCES", 0, 8)
.addQuota("CPUS", 0, 8)
.addQuota("EPHEMERAL_ADDRESSES", 0, 8)