You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/11/09 19:17:04 UTC
[5/8] jclouds-labs-google git commit: * Rewrites InstanceTemplate as
NewInstance,
strictly from docs. * Rewrites Metadata to have the same shape as in json,
avoid really complicated json parser. * Rewrites
GoogleComputeEngineServiceAdapter.createNodeW
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/6b5643c9/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
new file mode 100644
index 0000000..297eafd
--- /dev/null
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AggregatedListApiMockTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecomputeengine.features;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "AggregatedListApiMockTest", singleThreaded = true)
+public class AggregatedListApiMockTest extends BaseGoogleComputeEngineApiMockTest {
+
+ public void machineTypes() throws Exception {
+ server.enqueue(jsonResponse("/aggregated_machinetype_list.json"));
+
+ AggregatedListApi aggregatedList = api().aggregatedList("party");
+
+ assertTrue(aggregatedList.machineTypes().hasNext());
+
+ assertSent(server, "GET", "/projects/party/aggregated/machineTypes");
+ }
+
+ public void machineTypesResponseIs4xx() throws Exception {
+ server.enqueue(jsonResponse("/aggregated_instance_list_empty.json"));
+
+ AggregatedListApi aggregatedList = api().aggregatedList("party");
+
+ assertFalse(aggregatedList.machineTypes().hasNext());
+
+ assertSent(server, "GET", "/projects/party/aggregated/machineTypes");
+ }
+
+ public void instances() throws Exception {
+ server.enqueue(jsonResponse("/aggregated_instance_list.json"));
+
+ AggregatedListApi aggregatedList = api().aggregatedList("party");
+
+ assertTrue(aggregatedList.instances().hasNext());
+
+ assertSent(server, "GET", "/projects/party/aggregated/instances");
+ }
+
+ public void instancesResponseIs4xx() throws Exception {
+ server.enqueue(jsonResponse("/aggregated_instance_list_empty.json"));
+
+ AggregatedListApi aggregatedList = api().aggregatedList("party");
+
+ assertFalse(aggregatedList.instances().hasNext());
+
+ assertSent(server, "GET", "/projects/party/aggregated/instances");
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/6b5643c9/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 6122b2b..a3c9d45 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
@@ -26,7 +26,8 @@ import java.net.URI;
import javax.ws.rs.core.MediaType;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
import org.jclouds.googlecomputeengine.parse.ParseDiskListTest;
import org.jclouds.googlecomputeengine.parse.ParseDiskTest;
@@ -37,15 +38,15 @@ import org.jclouds.rest.ResourceNotFoundException;
import org.testng.annotations.Test;
@Test(groups = "unit", testName = "DiskApiExpectTest")
-public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
- public static final String IMAGE_URL = BASE_URL + "/myproject/zones/us-central1-a/images/foo";
- public static final String SSD_URL = BASE_URL + "/myproject/zones/us-central1-a/diskTypes/pd-ssd";
+public class DiskApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
+ public static final String IMAGE_URL = BASE_URL + "/party/zones/us-central1-a/images/foo";
+ public static final String SSD_URL = BASE_URL + "/party/zones/us-central1-a/diskTypes/pd-ssd";
public void testGetDiskResponseIs2xx() throws Exception {
HttpRequest get = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks/testimage1")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -53,7 +54,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/disk_get.json")).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getDiskApi("myproject", "us-central1-a");
+ TOKEN_RESPONSE, get, operationResponse).getDiskApi("party", "us-central1-a");
assertEquals(api.get("testimage1"),
new ParseDiskTest().expected());
@@ -63,14 +64,14 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest get = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks/testimage1")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getDiskApi("myproject", "us-central1-a");
+ TOKEN_RESPONSE, get, operationResponse).getDiskApi("party", "us-central1-a");
assertNull(api.get("testimage1"));
}
@@ -79,7 +80,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest insert = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/disk_insert.json", MediaType.APPLICATION_JSON))
@@ -90,7 +91,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertDiskResponse).getDiskApi("myproject", "us-central1-a");
+ insertDiskResponse).getDiskApi("party", "us-central1-a");
assertEquals(api.create("testimage1", 1), new ParseZoneOperationTest().expected());
}
@@ -99,7 +100,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest insert = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/disk_insert_sourceImage.json", MediaType.APPLICATION_JSON))
@@ -110,7 +111,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertDiskResponse).getDiskApi("myproject", "us-central1-a");
+ insertDiskResponse).getDiskApi("party", "us-central1-a");
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sourceImage(URI.create(IMAGE_URL));
assertEquals(api.create("testimage1", 1, diskCreationOptions), new ParseZoneOperationTest().expected());
@@ -120,7 +121,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest insert = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/disk_insert_ssd.json", MediaType.APPLICATION_JSON))
@@ -131,7 +132,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertDiskResponse).getDiskApi("myproject", "us-central1-a");
+ insertDiskResponse).getDiskApi("party", "us-central1-a");
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(URI.create(SSD_URL));
assertEquals(api.create("testimage1", 1, diskCreationOptions), new ParseZoneOperationTest().expected());
@@ -141,7 +142,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest createSnapshotRequest = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks/testimage1/createSnapshot")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1/createSnapshot")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/disk_create_snapshot.json", MediaType.APPLICATION_JSON))
@@ -152,7 +153,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, createSnapshotRequest,
- createSnapshotResponse).getDiskApi("myproject", "us-central1-a");
+ createSnapshotResponse).getDiskApi("party", "us-central1-a");
assertEquals(api.createSnapshot("testimage1", "test-snap"),
new ParseZoneOperationTest().expected());
@@ -163,7 +164,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest createSnapshotRequest = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks/testimage1/createSnapshot")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1/createSnapshot")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/disk_create_snapshot.json", MediaType.APPLICATION_JSON))
@@ -173,7 +174,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, createSnapshotRequest,
- createSnapshotResponse).getDiskApi("myproject", "us-central1-a");
+ createSnapshotResponse).getDiskApi("party", "us-central1-a");
api.createSnapshot("testimage1", "test-snap");
}
@@ -182,7 +183,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest delete = HttpRequest
.builder()
.method("DELETE")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks/testimage1")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -190,7 +191,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/zone_operation.json")).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getDiskApi("myproject", "us-central1-a");
+ TOKEN_RESPONSE, delete, deleteResponse).getDiskApi("party", "us-central1-a");
assertEquals(api.delete("testimage1"),
new ParseZoneOperationTest().expected());
@@ -200,14 +201,14 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest delete = HttpRequest
.builder()
.method("DELETE")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks/testimage1")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks/testimage1")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getDiskApi("myproject", "us-central1-a");
+ TOKEN_RESPONSE, delete, deleteResponse).getDiskApi("party", "us-central1-a");
assertNull(api.delete("testimage1"));
}
@@ -216,7 +217,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest list = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -224,7 +225,7 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/disk_list.json")).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getDiskApi("myproject", "us-central1-a");
+ TOKEN_RESPONSE, list, operationResponse).getDiskApi("party", "us-central1-a");
assertEquals(api.list().next().toString(), new ParseDiskListTest().expected().toString());
}
@@ -233,14 +234,14 @@ public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest list = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/disks")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/disks")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
DiskApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getDiskApi("myproject", "us-central1-a");
+ TOKEN_RESPONSE, list, operationResponse).getDiskApi("party", "us-central1-a");
assertFalse(api.list().hasNext());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/6b5643c9/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
index a6ae5ac..451f819 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java
@@ -22,7 +22,8 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
import org.jclouds.googlecomputeengine.parse.ParseDiskTypeListTest;
import org.jclouds.googlecomputeengine.parse.ParseDiskTypeTest;
import org.jclouds.http.HttpRequest;
@@ -30,12 +31,12 @@ import org.jclouds.http.HttpResponse;
import org.testng.annotations.Test;
@Test(groups = "unit", testName = "DiskTypeApiExpectTest")
-public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
public static final HttpRequest LIST_DISK_TYPES_REQUEST = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/diskTypes")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/diskTypes")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -48,7 +49,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpRequest get = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/diskTypes/pd-standard")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/diskTypes/pd-standard")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -56,7 +57,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/disktype.json")).build();
DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getDiskTypeApi("myproject", "us-central1-a");
+ TOKEN_RESPONSE, get, operationResponse).getDiskTypeApi("party", "us-central1-a");
assertEquals(diskTypeApi.get("pd-standard"),
new ParseDiskTypeTest().expected());
@@ -66,14 +67,14 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpRequest get = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/zones/us-central1-a/diskTypes/pd-standard")
+ .endpoint(BASE_URL + "/party/zones/us-central1-a/diskTypes/pd-standard")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getDiskTypeApi("myproject", "us-central1-a");
+ TOKEN_RESPONSE, get, operationResponse).getDiskTypeApi("party", "us-central1-a");
assertNull(diskTypeApi.get("pd-standard"));
}
@@ -82,7 +83,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
TOKEN_RESPONSE, LIST_DISK_TYPES_REQUEST, LIST_DISK_TYPES_RESPONSE).getDiskTypeApi
- ("myproject", "us-central1-a");
+ ("party", "us-central1-a");
assertEquals(diskTypeApi.list().next().toString(), new ParseDiskTypeListTest().expected().toString());
}
@@ -95,7 +96,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.endpoint(LIST_DISK_TYPES_REQUEST.getEndpoint() + "?maxResults=1").build();
DiskTypeApi diskTypeApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, listRequestWithOptions, operationResponse).getDiskTypeApi("myproject", "us-central1-a");
+ TOKEN_RESPONSE, listRequestWithOptions, operationResponse).getDiskTypeApi("party", "us-central1-a");
assertFalse(diskTypeApi.list(maxResults(1)).hasNext());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/6b5643c9/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 1fc0497..3d0d878 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
@@ -33,8 +33,9 @@ import java.util.List;
import javax.ws.rs.core.MediaType;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
import org.jclouds.googlecomputeengine.options.FirewallOptions;
import org.jclouds.googlecomputeengine.parse.ParseFirewallListTest;
import org.jclouds.googlecomputeengine.parse.ParseFirewallTest;
@@ -48,12 +49,12 @@ import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
@Test(groups = "unit", testName = "FirewallApiExpectTest")
-public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+public class FirewallApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
public static final HttpRequest GET_FIREWALL_REQUEST = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/global/firewalls/jclouds-test")
+ .endpoint(BASE_URL + "/party/global/firewalls/jclouds-test")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -63,7 +64,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
public void testGetFirewallResponseIs2xx() throws Exception {
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, GET_FIREWALL_REQUEST, GET_FIREWALL_RESPONSE).getFirewallApi("myproject");
+ TOKEN_RESPONSE, GET_FIREWALL_REQUEST, GET_FIREWALL_RESPONSE).getFirewallApi("party");
assertEquals(api.get("jclouds-test"), new ParseFirewallTest().expected());
}
@@ -101,14 +102,14 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpRequest get = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/global/firewalls/jclouds-test")
+ .endpoint(BASE_URL + "/party/global/firewalls/jclouds-test")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getFirewallApi("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getFirewallApi("party");
assertNull(api.get("jclouds-test"));
}
@@ -118,7 +119,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpRequest request = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/global/firewalls")
+ .endpoint(BASE_URL + "/party/global/firewalls")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(firewallPayloadFirewallOfName(
@@ -134,9 +135,9 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/operation.json")).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, request, insertFirewallResponse).getFirewallApi("myproject");
+ TOKEN_RESPONSE, request, insertFirewallResponse).getFirewallApi("party");
- assertEquals(api.createInNetwork("myfw", URI.create(BASE_URL + "/myproject/global/networks/default"),
+ assertEquals(api.createInNetwork("myfw", URI.create(BASE_URL + "/party/global/networks/default"),
new FirewallOptions()
.addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24")))
.addSourceTag("tag1")
@@ -149,7 +150,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpRequest update = HttpRequest
.builder()
.method("PUT")
- .endpoint(BASE_URL + "/myproject/global/firewalls/myfw")
+ .endpoint(BASE_URL + "/party/global/firewalls/myfw")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(firewallPayloadFirewallOfName(
@@ -166,12 +167,12 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, update,
- updateFirewallResponse).getFirewallApi("myproject");
+ updateFirewallResponse).getFirewallApi("party");
assertEquals(api.update("myfw",
new FirewallOptions()
.name("myfw")
- .network(URI.create(BASE_URL + "/myproject/global/networks/default"))
+ .network(URI.create(BASE_URL + "/party/global/networks/default"))
.addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24")))
.addSourceTag("tag1")
.addSourceRange("10.0.1.0/32")
@@ -182,7 +183,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpRequest update = HttpRequest
.builder()
.method("PATCH")
- .endpoint(BASE_URL + "/myproject/global/firewalls/myfw")
+ .endpoint(BASE_URL + "/party/global/firewalls/myfw")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(firewallPayloadFirewallOfName(
@@ -199,12 +200,12 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, update,
- updateFirewallResponse).getFirewallApi("myproject");
+ updateFirewallResponse).getFirewallApi("party");
assertEquals(api.patch("myfw",
new FirewallOptions()
.name("myfw")
- .network(URI.create(BASE_URL + "/myproject/global/networks/default"))
+ .network(URI.create(BASE_URL + "/party/global/networks/default"))
.addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24")))
.addSourceTag("tag1")
.addSourceRange("10.0.1.0/32")
@@ -215,7 +216,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpRequest delete = HttpRequest
.builder()
.method("DELETE")
- .endpoint(BASE_URL + "/myproject/global/firewalls/default-allow-internal")
+ .endpoint(BASE_URL + "/party/global/firewalls/default-allow-internal")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -223,7 +224,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/operation.json")).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getFirewallApi("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getFirewallApi("party");
assertEquals(api.delete("default-allow-internal"),
new ParseOperationTest().expected());
@@ -233,14 +234,14 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpRequest delete = HttpRequest
.builder()
.method("DELETE")
- .endpoint(BASE_URL + "/myproject/global/firewalls/default-allow-internal")
+ .endpoint(BASE_URL + "/party/global/firewalls/default-allow-internal")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getFirewallApi("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getFirewallApi("party");
assertNull(api.delete("default-allow-internal"));
}
@@ -249,7 +250,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpRequest list = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/global/firewalls")
+ .endpoint(BASE_URL + "/party/global/firewalls")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -257,7 +258,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
.payload(payloadFromResource("/firewall_list.json")).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getFirewallApi("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getFirewallApi("party");
assertEquals(api.list().next().toString(), new ParseFirewallListTest().expected().toString());
}
@@ -266,14 +267,14 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest
HttpRequest list = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/global/firewalls")
+ .endpoint(BASE_URL + "/party/global/firewalls")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getFirewallApi("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getFirewallApi("party");
assertFalse(api.list().hasNext());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/6b5643c9/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
index 161d27d..d395868 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java
@@ -26,7 +26,8 @@ import java.net.URI;
import javax.ws.rs.core.MediaType;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleListTest;
import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleTest;
@@ -36,13 +37,13 @@ import org.jclouds.http.HttpResponse;
import org.testng.annotations.Test;
@Test(groups = "unit", testName = "ForwardingRuleApiExpectTest")
-public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
public void testGetForwardingRuleResponseIs2xx() throws Exception {
HttpRequest get = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
+ .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules/test-forwarding-rule")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -50,7 +51,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
.payload(payloadFromResource("/forwardingrule_get.json")).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("party", "us-central1");
assertEquals(api.get("test-forwarding-rule"), new ParseForwardingRuleTest().expected());
}
@@ -59,14 +60,14 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
HttpRequest get = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
+ .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules/test-forwarding-rule")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("party", "us-central1");
assertNull(api.get("test-forwarding-rule"));
}
@@ -75,7 +76,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
HttpRequest insert = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules")
+ .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/forwardingrule_insert.json", MediaType.APPLICATION_JSON))
@@ -86,10 +87,10 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertForwardingRuleResponse).getForwardingRuleApi("myproject", "us-central1");
+ insertForwardingRuleResponse).getForwardingRuleApi("party", "us-central1");
ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions()
- .target(URI.create(BASE_URL + "/myproject/regions/europe-west1/targetPools/test-target-pool"));
+ .target(URI.create(BASE_URL + "/party/regions/europe-west1/targetPools/test-target-pool"));
assertEquals(api.create("test-forwarding-rule", forwardingRuleCreationOptions),
new ParseRegionOperationTest().expected());
}
@@ -98,7 +99,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
HttpRequest delete = HttpRequest
.builder()
.method("DELETE")
- .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules/test-forwarding-rule")
+ .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules/test-forwarding-rule")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -106,7 +107,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
.payload(payloadFromResource("/region_operation.json")).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("party", "us-central1");
assertEquals(api.delete("test-forwarding-rule"), new ParseRegionOperationTest().expected());
}
@@ -115,14 +116,14 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
HttpRequest delete = HttpRequest
.builder()
.method("DELETE")
- .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules/test-targetPool")
+ .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules/test-targetPool")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("party", "us-central1");
assertNull(api.delete("test-targetPool"));
}
@@ -131,7 +132,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
HttpRequest list = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules")
+ .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -139,7 +140,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
.payload(payloadFromResource("/forwardingrule_list.json")).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("party", "us-central1");
assertEquals(api.list().next().toString(), new ParseForwardingRuleListTest().expected().toString());
}
@@ -148,14 +149,14 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
HttpRequest list = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules")
+ .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("party", "us-central1");
assertFalse(api.list().hasNext());
}
@@ -165,7 +166,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
HttpRequest setTarget = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules/" + ruleName + "/setTarget")
+ .endpoint(BASE_URL + "/party/regions/us-central1/forwardingRules/" + ruleName + "/setTarget")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/forwardingrule_set_target.json", MediaType.APPLICATION_JSON))
@@ -175,9 +176,9 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec
.payload(payloadFromResource("/region_operation.json")).build();
ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, setTarget, setTargetResponse).getForwardingRuleApi("myproject", "us-central1");
+ TOKEN_RESPONSE, setTarget, setTargetResponse).getForwardingRuleApi("party", "us-central1");
- URI newTarget = URI.create(BASE_URL + "/myproject/regions/europe-west1/targetPools/test-target-pool");
+ URI newTarget = URI.create(BASE_URL + "/party/regions/europe-west1/targetPools/test-target-pool");
assertEquals(api.setTarget(ruleName, newTarget), new ParseRegionOperationTest().expected());
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/6b5643c9/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
index 24a2011..ccab042 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java
@@ -24,7 +24,8 @@ import static org.testng.AssertJUnit.assertNull;
import javax.ws.rs.core.MediaType;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest;
import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckListTest;
@@ -35,13 +36,13 @@ import org.jclouds.rest.ResourceNotFoundException;
import org.testng.annotations.Test;
@Test(groups = "unit", testName = "HttpHealthCheckApiExpectTest")
-public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
public void testGetHttpHealthCheckResponseIs2xx() throws Exception {
HttpRequest get = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/http-health-check-api-live-test")
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks/http-health-check-api-live-test")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -49,7 +50,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
.payload(payloadFromResource("/httphealthcheck_get.json")).build();
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getHttpHealthCheckApi("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getHttpHealthCheckApi("party");
assertEquals(api.get("http-health-check-api-live-test"),
new ParseHttpHealthCheckTest().expected());
@@ -59,14 +60,14 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest get = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/http-health-check-test")
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks/http-health-check-test")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, get, operationResponse).getHttpHealthCheckApi("myproject");
+ TOKEN_RESPONSE, get, operationResponse).getHttpHealthCheckApi("party");
assertNull(api.get("http-health-check-test"));
}
@@ -75,7 +76,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest insert = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks")
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
@@ -86,7 +87,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, insert,
- insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ insertHttpHealthCheckResponse).getHttpHealthCheckApi("party");
HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
assertEquals(api.insert("http-health-check", options), new ParseGlobalOperationTest().expected());
}
@@ -96,7 +97,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest create = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks")
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
@@ -105,7 +106,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(404).build();
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, create, insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ TOKEN_RESPONSE, create, insertHttpHealthCheckResponse).getHttpHealthCheckApi("party");
HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
@@ -116,7 +117,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest delete = HttpRequest
.builder()
.method("DELETE")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/http-health-check")
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks/http-health-check")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -124,7 +125,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
.payload(payloadFromResource("/global_operation.json")).build();
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getHttpHealthCheckApi("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getHttpHealthCheckApi("party");
assertEquals(api.delete("http-health-check"),
new ParseGlobalOperationTest().expected());
@@ -134,14 +135,14 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest delete = HttpRequest
.builder()
.method("DELETE")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/http-health-check")
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks/http-health-check")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getHttpHealthCheckApi("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getHttpHealthCheckApi("party");
assertNull(api.delete("http-health-check"));
}
@@ -150,7 +151,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest list = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks")
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -158,7 +159,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
.payload(payloadFromResource("/httphealthcheck_list.json")).build();
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getHttpHealthCheckApi("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getHttpHealthCheckApi("party");
assertEquals(api.list().next().toString(), new ParseHttpHealthCheckListTest().expected().toString());
}
@@ -167,14 +168,14 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest list = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks")
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, list, operationResponse).getHttpHealthCheckApi("myproject");
+ TOKEN_RESPONSE, list, operationResponse).getHttpHealthCheckApi("party");
assertFalse(api.list().hasNext());
}
@@ -184,7 +185,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest patch = HttpRequest
.builder()
.method("PATCH")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/" + healthCheckName)
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks/" + healthCheckName)
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
@@ -195,7 +196,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, patch,
- insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ insertHttpHealthCheckResponse).getHttpHealthCheckApi("party");
HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
assertEquals(api.patch(healthCheckName, options), new ParseGlobalOperationTest().expected());
}
@@ -206,7 +207,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest patch = HttpRequest
.builder()
.method("PATCH")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/" + healthCheckName)
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks/" + healthCheckName)
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
@@ -216,7 +217,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, patch,
- insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ insertHttpHealthCheckResponse).getHttpHealthCheckApi("party");
HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
api.patch(healthCheckName, options);
@@ -227,7 +228,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest patch = HttpRequest
.builder()
.method("PUT")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/" + healthCheckName)
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks/" + healthCheckName)
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
@@ -238,7 +239,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, patch,
- insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ insertHttpHealthCheckResponse).getHttpHealthCheckApi("party");
HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
assertEquals(api.update(healthCheckName, options), new ParseGlobalOperationTest().expected());
}
@@ -249,7 +250,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpRequest patch = HttpRequest
.builder()
.method("PUT")
- .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/" + healthCheckName)
+ .endpoint(BASE_URL + "/party/global/httpHealthChecks/" + healthCheckName)
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON))
@@ -259,7 +260,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe
HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
TOKEN_RESPONSE, patch,
- insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject");
+ insertHttpHealthCheckResponse).getHttpHealthCheckApi("party");
HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0);
api.update(healthCheckName, options);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/6b5643c9/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 3383125..4c1214c 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
@@ -22,7 +22,8 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertNull;
-import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
import org.jclouds.googlecomputeengine.parse.ParseImageListTest;
import org.jclouds.googlecomputeengine.parse.ParseImageTest;
import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
@@ -32,12 +33,12 @@ import org.jclouds.rest.ResourceNotFoundException;
import org.testng.annotations.Test;
@Test(groups = "unit", testName = "ImageApiExpectTest")
-public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
+public class ImageApiExpectTest extends BaseGoogleComputeEngineExpectTest<GoogleComputeEngineApi> {
public static final HttpRequest LIST_PROJECT_IMAGES_REQUEST = HttpRequest
.builder()
.method("GET")
- .endpoint(BASE_URL + "/myproject/global/images")
+ .endpoint(BASE_URL + "/party/global/images")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -103,7 +104,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest delete = HttpRequest
.builder()
.method("DELETE")
- .endpoint(BASE_URL + "/myproject/global/images/centos-6-2-v20120326")
+ .endpoint(BASE_URL + "/party/global/images/centos-6-2-v20120326")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
@@ -111,7 +112,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/operation.json")).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getImageApi("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getImageApi("party");
assertEquals(imageApi.delete("centos-6-2-v20120326"),
new ParseOperationTest().expected());
@@ -121,14 +122,14 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest delete = HttpRequest
.builder()
.method("DELETE")
- .endpoint(BASE_URL + "/myproject/global/images/centos-6-2-v20120326")
+ .endpoint(BASE_URL + "/party/global/images/centos-6-2-v20120326")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN).build();
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getImageApi("myproject");
+ TOKEN_RESPONSE, delete, deleteResponse).getImageApi("party");
assertNull(imageApi.delete("centos-6-2-v20120326"));
}
@@ -137,7 +138,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
TOKEN_RESPONSE, LIST_PROJECT_IMAGES_REQUEST, LIST_PROJECT_IMAGES_RESPONSE).getImageApi
- ("myproject");
+ ("party");
assertEquals(imageApi.list().next().toString(), new ParseImageListTest().expected().toString());
}
@@ -147,7 +148,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE),
- TOKEN_RESPONSE, LIST_PROJECT_IMAGES_REQUEST, operationResponse).getImageApi("myproject");
+ TOKEN_RESPONSE, LIST_PROJECT_IMAGES_REQUEST, operationResponse).getImageApi("party");
assertFalse(imageApi.list().hasNext());
}
@@ -156,7 +157,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest createImage = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/global/images")
+ .endpoint(BASE_URL + "/party/global/images")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResource("/image_insert_from_pd.json"))
@@ -166,9 +167,9 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
.payload(payloadFromResource("/operation.json")).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, createImage, createImageResponse).getImageApi("myproject");
+ TOKEN_RESPONSE, createImage, createImageResponse).getImageApi("party");
- assertEquals(imageApi.createFromDisk("my-image", BASE_URL + "/myproject/zones/us-central1-a/disks/mydisk"),
+ assertEquals(imageApi.createFromDisk("my-image", BASE_URL + "/party/zones/us-central1-a/disks/mydisk"),
new ParseOperationTest().expected());
}
@@ -177,7 +178,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpRequest createImage = HttpRequest
.builder()
.method("POST")
- .endpoint(BASE_URL + "/myproject/global/images")
+ .endpoint(BASE_URL + "/party/global/images")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + TOKEN)
.payload(payloadFromResource("/image_insert_from_pd.json"))
@@ -186,8 +187,8 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {
HttpResponse createImageResponse = HttpResponse.builder().statusCode(404).build();
ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE),
- TOKEN_RESPONSE, createImage, createImageResponse).getImageApi("myproject");
+ TOKEN_RESPONSE, createImage, createImageResponse).getImageApi("party");
- imageApi.createFromDisk("my-image", BASE_URL + "/myproject/zones/us-central1-a/disks/mydisk");
+ imageApi.createFromDisk("my-image", BASE_URL + "/party/zones/us-central1-a/disks/mydisk");
}
}