http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiExpectTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiExpectTest.java index bfd7a9b..a47c62b 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiExpectTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiExpectTest.java @@ -84,7 +84,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe public void testGetOperationResponseIs2xx() throws Exception { RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, GET_OPERATION_REQUEST, GET_OPERATION_RESPONSE).getRegionOperationApiForProject("myproject"); + TOKEN_RESPONSE, GET_OPERATION_REQUEST, GET_OPERATION_RESPONSE).getRegionOperationApi("myproject"); assertEquals(regionOperationApi.getInRegion("us-central1", "operation-1354084865060-4cf88735faeb8-bbbb12cb"), expected()); @@ -95,7 +95,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, GET_OPERATION_REQUEST, operationResponse).getRegionOperationApiForProject("myproject"); + TOKEN_RESPONSE, GET_OPERATION_REQUEST, operationResponse).getRegionOperationApi("myproject"); assertNull(regionOperationApi.getInRegion("us-central1", "operation-1354084865060-4cf88735faeb8-bbbb12cb")); } @@ -110,7 +110,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpResponse operationResponse = HttpResponse.builder().statusCode(204).build(); RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), - TOKEN_RESPONSE, delete, operationResponse).getRegionOperationApiForProject("myproject"); + TOKEN_RESPONSE, delete, operationResponse).getRegionOperationApi("myproject"); regionOperationApi.deleteInRegion("us-central1", "operation-1352178598164-4cdcc9d031510-4aa46279"); } @@ -125,7 +125,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), - TOKEN_RESPONSE, delete, operationResponse).getRegionOperationApiForProject("myproject"); + TOKEN_RESPONSE, delete, operationResponse).getRegionOperationApi("myproject"); regionOperationApi.deleteInRegion("us-central1", "operation-1352178598164-4cdcc9d031510-4aa46279"); } @@ -142,7 +142,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe .payload(payloadFromResource("/region_operation_list.json")).build(); RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, get, operationResponse).getRegionOperationApiForProject("myproject"); + TOKEN_RESPONSE, get, operationResponse).getRegionOperationApi("myproject"); assertEquals(regionOperationApi.listFirstPageInRegion("us-central1").toString(), expectedList().toString()); @@ -165,7 +165,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe .payload(payloadFromResource("/region_operation_list.json")).build(); RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, get, operationResponse).getRegionOperationApiForProject("myproject"); + TOKEN_RESPONSE, get, operationResponse).getRegionOperationApi("myproject"); assertEquals(regionOperationApi.listAtMarkerInRegion("us-central1", "CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1Mj" + "I0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz", @@ -184,7 +184,7 @@ public class RegionOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); RegionOperationApi regionOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, get, operationResponse).getRegionOperationApiForProject("myproject"); + TOKEN_RESPONSE, get, operationResponse).getRegionOperationApi("myproject"); assertTrue(regionOperationApi.listInRegion("us-central1").concat().isEmpty()); }
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiLiveTest.java index 118d879..a698aee 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiLiveTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionOperationApiLiveTest.java @@ -38,16 +38,16 @@ public class RegionOperationApiLiveTest extends BaseGoogleComputeEngineApiLiveTe private Operation deleteOperation; private RegionOperationApi api() { - return api.getRegionOperationApiForProject(userProject.get()); + return api.getRegionOperationApi(userProject.get()); } private AddressApi addressApi() { - return api.getAddressApiForProject(userProject.get()); + return api.getAddressApi(userProject.get()); } @Test(groups = "live") public void testCreateOperations() { - //create some operations by adding and deleting metadata items + //insert some operations by adding and deleting metadata items // this will make sure there is stuff to listFirstPage addOperation = assertRegionOperationDoneSucessfully(addressApi().createInRegion(DEFAULT_REGION_NAME, ADDRESS_NAME), 20); http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java index 6e9fa6e..0d64d14 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java @@ -50,7 +50,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { .payload(payloadFromResource("/route_get.json")).build(); RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, get, operationResponse).getRouteApiForProject("myproject"); + TOKEN_RESPONSE, get, operationResponse).getRouteApi("myproject"); assertEquals(api.get("default-route-c99ebfbed0e1f375"), new ParseRouteTest().expected()); @@ -67,7 +67,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, get, operationResponse).getRouteApiForProject("myproject"); + TOKEN_RESPONSE, get, operationResponse).getRouteApi("myproject"); assertNull(api.get("default-route-c99ebfbed0e1f375")); } @@ -88,7 +88,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), TOKEN_RESPONSE, insert, - insertRouteResponse).getRouteApiForProject("myproject"); + insertRouteResponse).getRouteApi("myproject"); assertEquals(api.createInNetwork("default-route-c99ebfbed0e1f375", URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default"), @@ -114,7 +114,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { .payload(payloadFromResource("/global_operation.json")).build(); RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), - TOKEN_RESPONSE, delete, deleteResponse).getRouteApiForProject("myproject"); + TOKEN_RESPONSE, delete, deleteResponse).getRouteApi("myproject"); assertEquals(api.delete("default-route-c99ebfbed0e1f375"), new ParseOperationTest().expected()); @@ -132,7 +132,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build(); RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), - TOKEN_RESPONSE, delete, deleteResponse).getRouteApiForProject("myproject"); + TOKEN_RESPONSE, delete, deleteResponse).getRouteApi("myproject"); assertNull(api.delete("default-route-c99ebfbed0e1f375")); } @@ -150,7 +150,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { .payload(payloadFromResource("/route_list.json")).build(); RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, list, operationResponse).getRouteApiForProject("myproject"); + TOKEN_RESPONSE, list, operationResponse).getRouteApi("myproject"); assertEquals(api.listFirstPage().toString(), new ParseRouteListTest().expected().toString()); @@ -168,7 +168,7 @@ public class RouteApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); RouteApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, list, operationResponse).getRouteApiForProject("myproject"); + TOKEN_RESPONSE, list, operationResponse).getRouteApi("myproject"); assertTrue(api.list().concat().isEmpty()); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiLiveTest.java index 8269ec8..a57a8c3 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiLiveTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiLiveTest.java @@ -41,12 +41,12 @@ public class RouteApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { public static final int TIME_WAIT = 30; private RouteApi api() { - return api.getRouteApiForProject(userProject.get()); + return api.getRouteApi(userProject.get()); } @Test(groups = "live") public void testInsertRoute() { - assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()).createInIPv4Range + assertGlobalOperationDoneSucessfully(api.getNetworkApi(userProject.get()).createInIPv4Range (ROUTE_NETWORK_NAME, IPV4_RANGE), TIME_WAIT); assertGlobalOperationDoneSucessfully(api().createInNetwork(ROUTE_NAME, getNetworkUrl(userProject.get(), ROUTE_NETWORK_NAME), @@ -84,7 +84,7 @@ public class RouteApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { @Test(groups = "live", dependsOnMethods = "testListRoute") public void testDeleteRoute() { assertGlobalOperationDoneSucessfully(api().delete(ROUTE_NAME), TIME_WAIT); - assertGlobalOperationDoneSucessfully(api.getNetworkApiForProject(userProject.get()) + assertGlobalOperationDoneSucessfully(api.getNetworkApi(userProject.get()) .delete(ROUTE_NETWORK_NAME), TIME_WAIT); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java index 4caedc5..9fcfde3 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java @@ -57,7 +57,7 @@ public class SnapshotApiExpectTest extends BaseGoogleComputeEngineApiExpectTest .payload(payloadFromResource("/snapshot_get.json")).build(); SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, GET_SNAPSHOT_REQ, operationResponse).getSnapshotApiForProject("myproject"); + TOKEN_RESPONSE, GET_SNAPSHOT_REQ, operationResponse).getSnapshotApi("myproject"); assertEquals(api.get("test-snap"), new ParseSnapshotTest().expected()); @@ -68,7 +68,7 @@ public class SnapshotApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, GET_SNAPSHOT_REQ, operationResponse).getSnapshotApiForProject("myproject"); + TOKEN_RESPONSE, GET_SNAPSHOT_REQ, operationResponse).getSnapshotApi("myproject"); assertNull(api.get("test-snap")); } @@ -76,7 +76,7 @@ public class SnapshotApiExpectTest extends BaseGoogleComputeEngineApiExpectTest public void testListSnapshotNoOptionsResponseIs2xx() throws Exception { SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, LIST_SNAPSHOTS_REQ, LIST_SNAPSHOTS_RESPONSE).getSnapshotApiForProject("myproject"); + TOKEN_RESPONSE, LIST_SNAPSHOTS_REQ, LIST_SNAPSHOTS_RESPONSE).getSnapshotApi("myproject"); assertEquals(api.listFirstPage().toString(), new ParseSnapshotListTest().expected().toString()); @@ -87,7 +87,7 @@ public class SnapshotApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); SnapshotApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, LIST_SNAPSHOTS_REQ, operationResponse).getSnapshotApiForProject("myproject"); + TOKEN_RESPONSE, LIST_SNAPSHOTS_REQ, operationResponse).getSnapshotApi("myproject"); assertTrue(api.list().concat().isEmpty()); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java index 3f833a9..cb8d330 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiLiveTest.java @@ -38,11 +38,11 @@ public class SnapshotApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { private Disk disk; private SnapshotApi api() { - return api.getSnapshotApiForProject(userProject.get()); + return api.getSnapshotApi(userProject.get()); } private DiskApi diskApi() { - return api.getDiskApiForProject(userProject.get()); + return api.getDiskApi(userProject.get()); } @Test(groups = "live") http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java new file mode 100644 index 0000000..e8545f2 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java @@ -0,0 +1,198 @@ +/* + * 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 org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest; +import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest; +import org.jclouds.googlecomputeengine.parse.ParseTargetPoolListTest; +import org.jclouds.googlecomputeengine.parse.ParseTargetPoolTest; +import org.jclouds.http.HttpRequest; +import org.jclouds.http.HttpResponse; +import org.testng.annotations.Test; + +import javax.ws.rs.core.MediaType; + +import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; +import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; +import static org.testng.AssertJUnit.assertNull; + +@Test(groups = "unit") +public class TargetPoolApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { + + public void testGetTargetPoolResponseIs2xx() throws Exception { + HttpRequest get = HttpRequest + .builder() + .method("GET") + .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test") + .addHeader("Accept", "application/json") + .addHeader("Authorization", "Bearer " + TOKEN).build(); + + HttpResponse operationResponse = HttpResponse.builder().statusCode(200) + .payload(payloadFromResource("/targetpool_get.json")).build(); + + TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), + TOKEN_RESPONSE, get, operationResponse).getTargetPoolApi("myproject", "us-central1"); + + assertEquals(api.get("test"), + new ParseTargetPoolTest().expected()); + } + + public void testGetTargetPoolResponseIs4xx() throws Exception { + HttpRequest get = HttpRequest + .builder() + .method("GET") + .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test") + .addHeader("Accept", "application/json") + .addHeader("Authorization", "Bearer " + TOKEN).build(); + + HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); + + TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), + TOKEN_RESPONSE, get, operationResponse).getTargetPoolApi("myproject", "us-central1"); + + assertNull(api.get("test")); + } + + public void testInsertTargetPoolResponseIs2xx() { + HttpRequest insert = HttpRequest + .builder() + .method("POST") + .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools") + .addHeader("Accept", "application/json") + .addHeader("Authorization", "Bearer " + TOKEN) + .payload(payloadFromResourceWithContentType("/targetpool_insert.json", MediaType.APPLICATION_JSON)) + .build(); + + HttpResponse insertTargetPoolResponse = HttpResponse.builder().statusCode(200) + .payload(payloadFromResource("/region_operation.json")).build(); + + TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), + TOKEN_RESPONSE, insert, + insertTargetPoolResponse).getTargetPoolApi("myproject", "us-central1"); + assertEquals(api.create("test"), new ParseRegionOperationTest().expected()); + } + + public void testDeleteTargetPoolResponseIs2xx() { + HttpRequest delete = HttpRequest + .builder() + .method("DELETE") + .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetPool") + .addHeader("Accept", "application/json") + .addHeader("Authorization", "Bearer " + TOKEN).build(); + + HttpResponse deleteResponse = HttpResponse.builder().statusCode(200) + .payload(payloadFromResource("/region_operation.json")).build(); + + TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), + TOKEN_RESPONSE, delete, deleteResponse).getTargetPoolApi("myproject", "us-central1"); + + assertEquals(api.delete("test-targetPool"), + new ParseRegionOperationTest().expected()); + } + + public void testDeleteTargetPoolResponseIs4xx() { + HttpRequest delete = HttpRequest + .builder() + .method("DELETE") + .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetPool") + .addHeader("Accept", "application/json") + .addHeader("Authorization", "Bearer " + TOKEN).build(); + + HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build(); + + TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), + TOKEN_RESPONSE, delete, deleteResponse).getTargetPoolApi("myproject", "us-central1"); + + assertNull(api.delete("test-targetPool")); + } + + public void testListTargetPoolsResponseIs2xx() { + HttpRequest list = HttpRequest + .builder() + .method("GET") + .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools") + .addHeader("Accept", "application/json") + .addHeader("Authorization", "Bearer " + TOKEN).build(); + + HttpResponse operationResponse = HttpResponse.builder().statusCode(200) + .payload(payloadFromResource("/targetpool_list.json")).build(); + + TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), + TOKEN_RESPONSE, list, operationResponse).getTargetPoolApi("myproject", "us-central1"); + + assertEquals(api.list().toString(), + new ParseTargetPoolListTest().expected().toString()); + } + + public void testListTargetPoolsResponseIs4xx() { + HttpRequest list = HttpRequest + .builder() + .method("GET") + .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools") + .addHeader("Accept", "application/json") + .addHeader("Authorization", "Bearer " + TOKEN).build(); + + HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); + + TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), + TOKEN_RESPONSE, list, operationResponse).getTargetPoolApi("myproject", "us-central1"); + + assertTrue(api.list().concat().isEmpty()); + } + + public void testAddInstanceResponseIs2xx() throws Exception { + HttpRequest addInstance = HttpRequest + .builder() + .method("POST") + .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test/addInstance") + .addHeader("Accept", "application/json") + .addHeader("Authorization", "Bearer " + TOKEN) + .payload(payloadFromResourceWithContentType("/targetpool_addinstance.json", MediaType.APPLICATION_JSON)) + .build(); + + HttpResponse operationResponse = HttpResponse.builder().statusCode(200) + .payload(payloadFromResource("/region_operation.json")).build(); + + TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), + TOKEN_RESPONSE, addInstance, operationResponse).getTargetPoolApi("myproject", "us-central1"); + + assertEquals(api.addInstance("test", + "https://www.googleapis.com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test"), + new ParseRegionOperationTest().expected()); + } + + public void testAddInstanceResponseIs4xx() throws Exception { + HttpRequest addInstance = HttpRequest + .builder() + .method("POST") + .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test/addInstance") + .addHeader("Accept", "application/json") + .addHeader("Authorization", "Bearer " + TOKEN) + .payload(payloadFromResourceWithContentType("/targetpool_addinstance.json", MediaType.APPLICATION_JSON)) + .build(); + + HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); + + TargetPoolApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), + TOKEN_RESPONSE, addInstance, operationResponse).getTargetPoolApi("myproject", "us-central1"); + + assertNull(api.addInstance("test", "https://www.googleapis" + + ".com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test")); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java new file mode 100644 index 0000000..5126b65 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiLiveTest.java @@ -0,0 +1,61 @@ +/* + * 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 org.jclouds.collect.IterableWithMarker; +import org.jclouds.googlecomputeengine.domain.TargetPool; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest; +import org.jclouds.googlecomputeengine.options.ListOptions; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + +public class TargetPoolApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { + + private static final String TARGETPOOL_NAME = "targetpool-api-live-test"; + private static final int TIME_WAIT = 30; + + private TargetPoolApi api() { + return api.getTargetPoolApi(userProject.get(), DEFAULT_REGION_NAME); + } + + @Test(groups = "live") + public void testInsertTargetPool() { + assertRegionOperationDoneSucessfully(api().create(TARGETPOOL_NAME), TIME_WAIT); + } + + @Test(groups = "live", dependsOnMethods = "testInsertTargetPool") + public void testGetTargetPool() { + TargetPool targetPool = api().get(TARGETPOOL_NAME); + assertNotNull(targetPool); + assertEquals(targetPool.getName(), TARGETPOOL_NAME); + } + + @Test(groups = "live", dependsOnMethods = "testGetTargetPool") + public void testListTargetPool() { + + IterableWithMarker<TargetPool> targetPool = api().list(new ListOptions.Builder() + .filter("name eq " + TARGETPOOL_NAME)); + assertEquals(targetPool.toList().size(), 1); + } + + @Test(groups = "live", dependsOnMethods = "testListTargetPool") + public void testDeleteTargetPool() { + assertRegionOperationDoneSucessfully(api().delete(TARGETPOOL_NAME), TIME_WAIT); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java index 0a26bd6..19036dd 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java @@ -60,7 +60,7 @@ public class ZoneApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { .payload(payloadFromResource("/zone_get.json")).build(); ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, GET_ZONE_REQ, operationResponse).getZoneApiForProject("myproject"); + TOKEN_RESPONSE, GET_ZONE_REQ, operationResponse).getZoneApi("myproject"); assertEquals(api.get("us-central1-a"), new ParseZoneTest().expected()); @@ -71,7 +71,7 @@ public class ZoneApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, GET_ZONE_REQ, operationResponse).getZoneApiForProject("myproject"); + TOKEN_RESPONSE, GET_ZONE_REQ, operationResponse).getZoneApi("myproject"); assertNull(api.get("us-central1-a")); } @@ -79,7 +79,7 @@ public class ZoneApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { public void testListZoneNoOptionsResponseIs2xx() throws Exception { ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, LIST_ZONES_REQ, LIST_ZONES_RESPONSE).getZoneApiForProject("myproject"); + TOKEN_RESPONSE, LIST_ZONES_REQ, LIST_ZONES_RESPONSE).getZoneApi("myproject"); assertEquals(api.listFirstPage().toString(), new ParseZoneListTest().expected().toString()); @@ -90,7 +90,7 @@ public class ZoneApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); ZoneApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, LIST_ZONES_REQ, operationResponse).getZoneApiForProject("myproject"); + TOKEN_RESPONSE, LIST_ZONES_REQ, operationResponse).getZoneApi("myproject"); assertTrue(api.list().concat().isEmpty()); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiLiveTest.java index 934e93a..a6b56d4 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiLiveTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiLiveTest.java @@ -39,7 +39,7 @@ public class ZoneApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { private Zone zone; private ZoneApi api() { - return api.getZoneApiForProject(userProject.get()); + return api.getZoneApi(userProject.get()); } @Test(groups = "live") http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/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 index c3698bf..8866770 100644 --- 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 @@ -81,7 +81,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect public void testGetOperationResponseIs2xx() throws Exception { ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, GET_ZONE_OPERATION_REQUEST, GET_ZONE_OPERATION_RESPONSE).getZoneOperationApiForProject("myproject"); + TOKEN_RESPONSE, GET_ZONE_OPERATION_REQUEST, GET_ZONE_OPERATION_RESPONSE).getZoneOperationApi("myproject"); assertEquals(zoneOperationApi.getInZone("us-central1-a", "operation-1354084865060-4cf88735faeb8-bbbb12cb"), expected()); @@ -92,7 +92,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, GET_ZONE_OPERATION_REQUEST, operationResponse).getZoneOperationApiForProject("myproject"); + TOKEN_RESPONSE, GET_ZONE_OPERATION_REQUEST, operationResponse).getZoneOperationApi("myproject"); assertNull(zoneOperationApi.getInZone("us-central1-a", "operation-1354084865060-4cf88735faeb8-bbbb12cb")); } @@ -107,7 +107,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect HttpResponse operationResponse = HttpResponse.builder().statusCode(204).build(); ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), - TOKEN_RESPONSE, delete, operationResponse).getZoneOperationApiForProject("myproject"); + TOKEN_RESPONSE, delete, operationResponse).getZoneOperationApi("myproject"); zoneOperationApi.deleteInZone("us-central1-a", "operation-1352178598164-4cdcc9d031510-4aa46279"); } @@ -122,7 +122,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), - TOKEN_RESPONSE, delete, operationResponse).getZoneOperationApiForProject("myproject"); + TOKEN_RESPONSE, delete, operationResponse).getZoneOperationApi("myproject"); zoneOperationApi.deleteInZone("us-central1-a", "operation-1352178598164-4cdcc9d031510-4aa46279"); } @@ -139,7 +139,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect .payload(payloadFromResource("/zone_operation_list.json")).build(); ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, get, operationResponse).getZoneOperationApiForProject("myproject"); + TOKEN_RESPONSE, get, operationResponse).getZoneOperationApi("myproject"); assertEquals(zoneOperationApi.listFirstPageInZone("us-central1-a").toString(), expectedList().toString()); @@ -162,7 +162,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect .payload(payloadFromResource("/zone_operation_list.json")).build(); ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, get, operationResponse).getZoneOperationApiForProject("myproject"); + TOKEN_RESPONSE, get, operationResponse).getZoneOperationApi("myproject"); assertEquals(zoneOperationApi.listAtMarkerInZone("us-central1-a", "CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1Mj" + @@ -182,7 +182,7 @@ public class ZoneOperationApiExpectTest extends BaseGoogleComputeEngineApiExpect HttpResponse operationResponse = HttpResponse.builder().statusCode(404).build(); ZoneOperationApi zoneOperationApi = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), - TOKEN_RESPONSE, get, operationResponse).getZoneOperationApiForProject("myproject"); + TOKEN_RESPONSE, get, operationResponse).getZoneOperationApi("myproject"); assertTrue(zoneOperationApi.listInZone("us-central1-a").concat().isEmpty()); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/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 index 4d30272..9dd5c93 100644 --- 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 @@ -39,16 +39,16 @@ public class ZoneOperationApiLiveTest extends BaseGoogleComputeEngineApiLiveTest private Operation deleteOperation; private ZoneOperationApi api() { - return api.getZoneOperationApiForProject(userProject.get()); + return api.getZoneOperationApi(userProject.get()); } private DiskApi diskApi() { - return api.getDiskApiForProject(userProject.get()); + return api.getDiskApi(userProject.get()); } @Test(groups = "live") public void testCreateOperations() { - //create some operations by creating and deleting a disk + //insert 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); http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeededTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeededTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeededTest.java index 292f9d4..e77f35a 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeededTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeededTest.java @@ -59,16 +59,16 @@ public class CreateNetworkIfNeededTest { } }; - expect(api.getNetworkApiForProject(userProject.get())).andReturn(nwApi).atLeastOnce(); - expect(api.getGlobalOperationApiForProject(userProject.get())).andReturn(globalApi).atLeastOnce(); + expect(api.getNetworkApi(userProject.get())).andReturn(nwApi).atLeastOnce(); + expect(api.getGlobalOperationApi(userProject.get())).andReturn(globalApi).atLeastOnce(); expect(nwApi.createInIPv4Range("this-network", "0.0.0.0/0")) .andReturn(createOp); - expect(globalApi.get("create-op")).andReturn(createOp); + expect(globalApi.get("insert-op")).andReturn(createOp); expect(nwApi.get("this-network")).andReturn(null); expect(nwApi.get("this-network")).andReturn(network); - expect(createOp.getName()).andReturn("create-op"); + expect(createOp.getName()).andReturn("insert-op"); expect(createOp.getStatus()).andReturn(Operation.Status.DONE); expect(createOp.getHttpError()).andReturn(fromNullable((HttpResponse)null)); replay(api, nwApi, createOp, globalApi); @@ -104,16 +104,16 @@ public class CreateNetworkIfNeededTest { } }; - expect(api.getNetworkApiForProject(userProject.get())).andReturn(nwApi).atLeastOnce(); - expect(api.getGlobalOperationApiForProject(userProject.get())).andReturn(globalApi).atLeastOnce(); + expect(api.getNetworkApi(userProject.get())).andReturn(nwApi).atLeastOnce(); + expect(api.getGlobalOperationApi(userProject.get())).andReturn(globalApi).atLeastOnce(); expect(nwApi.createInIPv4RangeWithGateway("this-network", "0.0.0.0/0", "1.2.3.4")) .andReturn(createOp); - expect(globalApi.get("create-op")).andReturn(createOp); + expect(globalApi.get("insert-op")).andReturn(createOp); expect(nwApi.get("this-network")).andReturn(null); expect(nwApi.get("this-network")).andReturn(network); - expect(createOp.getName()).andReturn("create-op"); + expect(createOp.getName()).andReturn("insert-op"); expect(createOp.getStatus()).andReturn(Operation.Status.DONE); expect(createOp.getHttpError()).andReturn(fromNullable((HttpResponse)null)); replay(api, nwApi, createOp, globalApi); http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/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 bb4e136..972f591 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 @@ -17,6 +17,7 @@ package org.jclouds.googlecomputeengine.internal; import static java.util.concurrent.TimeUnit.SECONDS; +import static org.jclouds.oauth.v2.OAuthTestUtils.setCredential; import static org.jclouds.util.Predicates2.retry; import static org.testng.Assert.assertEquals; import static org.testng.AssertJUnit.assertTrue; @@ -70,11 +71,17 @@ public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleCo protected Predicate<AtomicReference<Operation>> regionOperationDonePredicate; protected Predicate<AtomicReference<Operation>> zoneOperationDonePredicate; - public BaseGoogleComputeEngineApiLiveTest() { provider = "google-compute-engine"; } + @Override + protected Properties setupProperties() { + Properties props = super.setupProperties(); + setCredential(props, provider + ".credential"); + return props; + } + protected GoogleComputeEngineApi create(Properties props, Iterable<Module> modules) { Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); userProject = injector.getInstance(Key.get(new TypeLiteral<Supplier<String>>() { http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java new file mode 100644 index 0000000..8b6a0ee --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleListTest.java @@ -0,0 +1,59 @@ +/* + * 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 com.google.common.collect.ImmutableSet; +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.ForwardingRule; +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; + +@Test(groups = "unit") +public class ParseForwardingRuleListTest extends BaseGoogleComputeEngineParseTest<ListPage<ForwardingRule>> { + + @Override + public String resource() { + return "/forwardingrule_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<ForwardingRule> expected() { + return ListPage.<ForwardingRule>builder() + .kind(Resource.Kind.FORWARDING_RULE_LIST) + .items(ImmutableSet.of(ForwardingRule.builder() + .id("6732523704970219884") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-08T06:51:10.809-08:00")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules/test-forwarding-rule")) + .name("test-forwarding-rule") + .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1")) + .ipAddress("23.251.129.77") + .ipProtocol("TCP") + .target(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool")) + .portRange("1-65535") + .build()) + ).build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java new file mode 100644 index 0000000..712e0ee --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseForwardingRuleTest.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.ForwardingRule; +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; + +@Test(groups = "unit") +public class ParseForwardingRuleTest extends BaseGoogleComputeEngineParseTest<ForwardingRule> { + + @Override + public String resource() { + return "/forwardingrule_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ForwardingRule expected() { + return ForwardingRule.builder() + .id("6732523704970219884") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-08T06:51:10.809-08:00")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules/test-forwarding-rule")) + .name("test-forwarding-rule") + .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1")) + .target(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool")) + .ipAddress("23.251.129.77") + .ipProtocol("TCP") + .portRange("1-65535") + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java new file mode 100644 index 0000000..f726320 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckListTest.java @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import 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.HttpHealthCheck; +import org.jclouds.googlecomputeengine.domain.ListPage; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseHttpHealthCheckListTest extends BaseGoogleComputeEngineParseTest<ListPage<HttpHealthCheck>> { + + @Override + public String resource() { + return "/httphealthcheck_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<HttpHealthCheck> expected() { + return ListPage.<HttpHealthCheck>builder() + .kind(Resource.Kind.HTTP_HEALTH_CHECK_LIST) + .items(ImmutableSet.of(HttpHealthCheck.builder() + .id("2761502483700014319") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-14T05:55:54.910-08:00")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/http-health-check-api-live-test")) + .name("http-health-check-api-live-test") + .port(0) + .checkIntervalSec(0) + .timeoutSec(0) + .unhealthyThreshold(0) + .healthyThreshold(0) + .build(), + HttpHealthCheck.builder() + .id("1035854271083519643") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-08T14:38:29.363-08:00")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check")) + .name("myname-andrea-kmzmi1bh-http-health-check") + .port(0) + .checkIntervalSec(0) + .timeoutSec(5) + .unhealthyThreshold(2) + .healthyThreshold(0) + .build(), + HttpHealthCheck.builder() + .id("7006563292274658743") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-08T14:48:03.276-08:00")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check")) + .name("myname-andrea-zk7gadwq-http-health-check") + .port(0) + .checkIntervalSec(0) + .timeoutSec(5) + .unhealthyThreshold(2) + .healthyThreshold(0) + .build() + )) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java new file mode 100644 index 0000000..d492544 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseHttpHealthCheckTest.java @@ -0,0 +1,53 @@ +/* + * 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.HttpHealthCheck; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseHttpHealthCheckTest extends BaseGoogleComputeEngineParseTest<HttpHealthCheck> { + + @Override + public String resource() { + return "/httphealthcheck_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public HttpHealthCheck expected() { + return HttpHealthCheck.builder() + .id("2761502483700014319") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-14T05:55:54.910-08:00")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/http-health-check-api-live-test")) + .name("http-health-check-api-live-test") + .port(0) + .checkIntervalSec(0) + .timeoutSec(0) + .unhealthyThreshold(0) + .healthyThreshold(0) + .build(); + + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java new file mode 100644 index 0000000..b0f59cf --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionOperationTest.java @@ -0,0 +1,55 @@ +/* + * 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 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; + +@Test(groups = "unit") +public class ParseRegionOperationTest extends BaseGoogleComputeEngineParseTest<Operation> { + + @Override + public String resource() { + return "/region_operation.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Operation expected() { + SimpleDateFormatDateService dateService = new SimpleDateFormatDateService(); + return Operation.builder().id("13053095055850848306") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/operations/operation-1354084865060-4cf88735faeb8-bbbb12cb")) + .name("operation-1354084865060-4cf88735faeb8-bbbb12cb") + .targetLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/addresses/test-address")) + .targetId("13053094017547040099") + .status(Operation.Status.DONE) + .user("[email protected]") + .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") + .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1")) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.java new file mode 100644 index 0000000..0bf743f --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolListTest.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 com.google.common.collect.ImmutableSet; +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.ListPage; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.domain.TargetPool; +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; + +@Test(groups = "unit") +public class ParseTargetPoolListTest extends BaseGoogleComputeEngineParseTest<ListPage<TargetPool>> { + + @Override + public String resource() { + return "/targetpool_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<TargetPool> expected() { + return ListPage.<TargetPool>builder() + .kind(Resource.Kind.TARGET_POOL_LIST) + .items(ImmutableSet.of(TargetPool.builder() + .id("5199309593612841404") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-07T05:25:27.783-08:00")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetpool")) + .name("test-targetpool") + .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1")) + .sessionAffinity("NONE") + .build()) + ).build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java new file mode 100644 index 0000000..faf7a77 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetPoolTest.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.TargetPool; +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; + +@Test(groups = "unit") +public class ParseTargetPoolTest extends BaseGoogleComputeEngineParseTest<TargetPool> { + + @Override + public String resource() { + return "/targetpool_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public TargetPool expected() { + return TargetPool.builder() + .id("5199309593612841404") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-01-07T05:25:27.783-08:00")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetpool")) + .name("test-targetpool") + .sessionAffinity("NONE") + .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1")) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/forwardingrule_get.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/forwardingrule_get.json b/google-compute-engine/src/test/resources/forwardingrule_get.json new file mode 100644 index 0000000..c3e29e5 --- /dev/null +++ b/google-compute-engine/src/test/resources/forwardingrule_get.json @@ -0,0 +1,12 @@ +{ +"kind": "compute#forwardingRule", +"id": "6732523704970219884", +"creationTimestamp": "2014-01-08T06:51:10.809-08:00", +"name": "test-forwarding-rule", +"region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1", +"IPAddress": "23.251.129.77", +"IPProtocol": "TCP", +"portRange": "1-65535", +"target": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool", +"selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules/test-forwarding-rule" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/forwardingrule_insert.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/forwardingrule_insert.json b/google-compute-engine/src/test/resources/forwardingrule_insert.json new file mode 100644 index 0000000..62c6090 --- /dev/null +++ b/google-compute-engine/src/test/resources/forwardingrule_insert.json @@ -0,0 +1,4 @@ +{ +"name": "test-forwarding-rule", +"target": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/forwardingrule_list.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/forwardingrule_list.json b/google-compute-engine/src/test/resources/forwardingrule_list.json new file mode 100644 index 0000000..59f1204 --- /dev/null +++ b/google-compute-engine/src/test/resources/forwardingrule_list.json @@ -0,0 +1,19 @@ +{ +"kind": "compute#forwardingRuleList", +"selfLink": "https://content.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules", +"id": "projects/myproject/regions/europe-west1/forwardingRules", +"items": [ +{ +"kind": "compute#forwardingRule", +"id": "6732523704970219884", +"creationTimestamp": "2014-01-08T06:51:10.809-08:00", +"name": "test-forwarding-rule", +"region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1", +"IPAddress": "23.251.129.77", +"IPProtocol": "TCP", +"portRange": "1-65535", +"target": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/targetPools/test-target-pool", +"selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/europe-west1/forwardingRules/test-forwarding-rule" +} +] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/httphealthcheck_get.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/httphealthcheck_get.json b/google-compute-engine/src/test/resources/httphealthcheck_get.json new file mode 100644 index 0000000..4a7cd84 --- /dev/null +++ b/google-compute-engine/src/test/resources/httphealthcheck_get.json @@ -0,0 +1,7 @@ +{ + "kind": "compute#httpHealthCheck", + "selfLink": "https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/http-health-check-api-live-test", + "id": "2761502483700014319", + "creationTimestamp": "2014-01-14T05:55:54.910-08:00", + "name": "http-health-check-api-live-test" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/httphealthcheck_insert.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/httphealthcheck_insert.json b/google-compute-engine/src/test/resources/httphealthcheck_insert.json new file mode 100644 index 0000000..0564f1d --- /dev/null +++ b/google-compute-engine/src/test/resources/httphealthcheck_insert.json @@ -0,0 +1 @@ +{"name":"http-health-check","timeoutSec":0,"unhealthyThreshold":0} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/httphealthcheck_list.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/httphealthcheck_list.json b/google-compute-engine/src/test/resources/httphealthcheck_list.json new file mode 100644 index 0000000..4436a26 --- /dev/null +++ b/google-compute-engine/src/test/resources/httphealthcheck_list.json @@ -0,0 +1,32 @@ +{ + "kind": "compute#httpHealthCheckList", + "selfLink": "https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks", + "id": "projects/jclouds-gce/global/httpHealthChecks", + "items": [ + { + "kind": "compute#httpHealthCheck", + "selfLink": "https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/http-health-check-api-live-test", + "id": "2761502483700014319", + "creationTimestamp": "2014-01-14T05:55:54.910-08:00", + "name": "http-health-check-api-live-test" + }, + { + "kind": "compute#httpHealthCheck", + "selfLink": "https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check", + "id": "1035854271083519643", + "creationTimestamp": "2014-01-08T14:38:29.363-08:00", + "name": "myname-andrea-kmzmi1bh-http-health-check", + "timeoutSec": 5, + "unhealthyThreshold": 2 + }, + { + "kind": "compute#httpHealthCheck", + "selfLink": "https://www.googleapis.com/compute/v1/projects/jclouds-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check", + "id": "7006563292274658743", + "creationTimestamp": "2014-01-08T14:48:03.276-08:00", + "name": "myname-andrea-zk7gadwq-http-health-check", + "timeoutSec": 5, + "unhealthyThreshold": 2 + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/targetpool_addinstance.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/targetpool_addinstance.json b/google-compute-engine/src/test/resources/targetpool_addinstance.json new file mode 100644 index 0000000..63fc50f --- /dev/null +++ b/google-compute-engine/src/test/resources/targetpool_addinstance.json @@ -0,0 +1 @@ +{"instance":"https://www.googleapis.com/compute/v1/projects/myproject/zones/europe-west1-a/instances/test"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/targetpool_get.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/targetpool_get.json b/google-compute-engine/src/test/resources/targetpool_get.json new file mode 100644 index 0000000..6ff1696 --- /dev/null +++ b/google-compute-engine/src/test/resources/targetpool_get.json @@ -0,0 +1,9 @@ +{ + "kind": "compute#targetPool", + "id": "5199309593612841404", + "creationTimestamp": "2014-01-07T05:25:27.783-08:00", + "name": "test-targetpool", + "region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1", + "sessionAffinity": "NONE", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetpool" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/targetpool_insert.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/targetpool_insert.json b/google-compute-engine/src/test/resources/targetpool_insert.json new file mode 100644 index 0000000..cdbc2f7 --- /dev/null +++ b/google-compute-engine/src/test/resources/targetpool_insert.json @@ -0,0 +1,3 @@ +{ + "name": "test" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/test/resources/targetpool_list.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/targetpool_list.json b/google-compute-engine/src/test/resources/targetpool_list.json new file mode 100644 index 0000000..dd65458 --- /dev/null +++ b/google-compute-engine/src/test/resources/targetpool_list.json @@ -0,0 +1,17 @@ +{ + "kind": "compute#targetPoolList", + "selfLink": "https://content.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools", + "id": "projects/myproject/regions/us-central1/targetPools", + "items": [ + { + + "kind": "compute#targetPool", + "id": "5199309593612841404", + "creationTimestamp": "2014-01-07T05:25:27.783-08:00", + "name": "test-targetpool", + "region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1", + "sessionAffinity": "NONE", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/targetPools/test-targetpool" + } + ] +} \ No newline at end of file
