http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/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 f3a38d2..5f8f648 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 @@ -28,13 +28,13 @@ import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; import org.testng.annotations.Test; -@Test(groups = "unit") +@Test(groups = "unit", testName = "DiskTypeApiExpectTest") public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { public static final HttpRequest LIST_DISK_TYPES_REQUEST = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/diskTypes") + .endpoint(BASE_URL + "/myproject/zones/us-central1-a/diskTypes") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -46,7 +46,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest public static final HttpRequest LIST_CENTRAL1B_DISK_TYPES_REQUEST = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-b/diskTypes") + .endpoint(BASE_URL + "/myproject/zones/us-central1-b/diskTypes") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -59,8 +59,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpRequest get = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/zones/us-central1-a/diskTypes/pd-standard") + .endpoint(BASE_URL + "/myproject/zones/us-central1-a/diskTypes/pd-standard") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -78,8 +77,7 @@ public class DiskTypeApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpRequest get = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/zones/us-central1-a/diskTypes/pd-standard") + .endpoint(BASE_URL + "/myproject/zones/us-central1-a/diskTypes/pd-standard") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build();
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiLiveTest.java index 0168549..b97f34e 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiLiveTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiLiveTest.java @@ -32,8 +32,6 @@ import org.jclouds.googlecomputeengine.options.ListOptions; import org.testng.annotations.Test; import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; - public class DiskTypeApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { @@ -53,7 +51,7 @@ public class DiskTypeApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { assertTrue(pageIterator.hasNext()); IterableWithMarker<DiskType> singlePageIterator = pageIterator.next(); - List<DiskType> diskTypeAsList = Lists.newArrayList(singlePageIterator); + List<DiskType> diskTypeAsList = singlePageIterator.toList(); assertSame(diskTypeAsList.size(), 1); @@ -62,16 +60,16 @@ public class DiskTypeApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { @Test(groups = "live", dependsOnMethods = "testDiskType") public void testGetDiskType() { - DiskType diskType = api().getInZone(DEFAULT_ZONE_NAME, this.diskType.getName()); + DiskType diskType = api().getInZone(DEFAULT_ZONE_NAME, this.diskType.name()); assertNotNull(diskType); assertDiskTypeEquals(diskType, this.diskType); } private void assertDiskTypeEquals(DiskType result, DiskType expected) { - assertEquals(result.getName(), expected.getName()); - assertEquals(result.getValidDiskSize(), expected.getValidDiskSize()); - assertEquals(result.getZone(), expected.getZone()); - assertEquals(result.getDefaultDiskSizeGb(), expected.getDefaultDiskSizeGb()); - assertEquals(result.getSelfLink(), expected.getSelfLink()); + assertEquals(result.name(), expected.name()); + assertEquals(result.validDiskSize(), expected.validDiskSize()); + assertEquals(result.zone(), expected.zone()); + assertEquals(result.defaultDiskSizeGb(), expected.defaultDiskSizeGb()); + assertEquals(result.selfLink(), expected.selfLink()); } } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/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 29e46db..1222f58 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 @@ -29,7 +29,7 @@ import static org.testng.AssertJUnit.assertNull; import java.io.IOException; import java.net.URI; -import java.util.Set; +import java.util.List; import javax.ws.rs.core.MediaType; @@ -42,20 +42,18 @@ import org.jclouds.googlecomputeengine.parse.ParseOperationTest; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; import org.jclouds.io.Payload; -import org.jclouds.net.domain.IpProtocol; import org.testng.annotations.Test; import com.google.common.base.Function; -import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableList; -@Test(groups = "unit") +@Test(groups = "unit", testName = "FirewallApiExpectTest") public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { public static final HttpRequest GET_FIREWALL_REQUEST = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/firewalls/jclouds-test") + .endpoint(BASE_URL + "/myproject/global/firewalls/jclouds-test") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -70,13 +68,12 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest assertEquals(api.get("jclouds-test"), new ParseFirewallTest().expected()); } - public static Payload firewallPayloadFirewallOfName(String firewallName, String networkName, - Set<String> sourceRanges, - Set<String> sourceTags, - Set<String> targetTags, - Set<String> portRanges) throws IOException { + List<String> sourceRanges, + List<String> sourceTags, + List<String> targetTags, + List<String> portRanges) throws IOException { Function<String, String> addQuotes = new Function<String, String>() { @Override public String apply(String input) { @@ -104,8 +101,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpRequest get = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/firewalls/jclouds-test") + .endpoint(BASE_URL + "/myproject/global/firewalls/jclouds-test") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -122,16 +118,16 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpRequest request = HttpRequest .builder() .method("POST") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/firewalls") + .endpoint(BASE_URL + "/myproject/global/firewalls") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(firewallPayloadFirewallOfName( "myfw", "default", - ImmutableSet.<String>of("10.0.1.0/32"), - ImmutableSet.<String>of("tag1"), - ImmutableSet.<String>of("tag2"), - ImmutableSet.<String>of("22", "23-24"))) + ImmutableList.of("10.0.1.0/32"), + ImmutableList.of("tag1"), + ImmutableList.of("tag2"), + ImmutableList.of("22", "23-24"))) .build(); HttpResponse insertFirewallResponse = HttpResponse.builder().statusCode(200) @@ -140,13 +136,9 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest FirewallApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), TOKEN_RESPONSE, request, insertFirewallResponse).getFirewallApi("myproject"); - assertEquals(api.createInNetwork("myfw", URI.create("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/networks/default"), + assertEquals(api.createInNetwork("myfw", URI.create(BASE_URL + "/myproject/global/networks/default"), new FirewallOptions() - .addAllowedRule(Firewall.Rule.builder() - .IpProtocol(IpProtocol.TCP) - .addPort(22) - .addPortRange(23, 24).build()) + .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24"))) .addSourceTag("tag1") .addSourceRange("10.0.1.0/32") .addTargetTag("tag2")), new ParseOperationTest().expected()); @@ -157,16 +149,16 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpRequest update = HttpRequest .builder() .method("PUT") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/firewalls/myfw") + .endpoint(BASE_URL + "/myproject/global/firewalls/myfw") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(firewallPayloadFirewallOfName( "myfw", "default", - ImmutableSet.<String>of("10.0.1.0/32"), - ImmutableSet.<String>of("tag1"), - ImmutableSet.<String>of("tag2"), - ImmutableSet.<String>of("22", "23-24"))) + ImmutableList.of("10.0.1.0/32"), + ImmutableList.of("tag1"), + ImmutableList.of("tag2"), + ImmutableList.of("22", "23-24"))) .build(); HttpResponse updateFirewallResponse = HttpResponse.builder().statusCode(200) @@ -179,12 +171,8 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest assertEquals(api.update("myfw", new FirewallOptions() .name("myfw") - .network(URI.create("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/networks/default")) - .addAllowedRule(Firewall.Rule.builder() - .IpProtocol(IpProtocol.TCP) - .addPort(22) - .addPortRange(23, 24).build()) + .network(URI.create(BASE_URL + "/myproject/global/networks/default")) + .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24"))) .addSourceTag("tag1") .addSourceRange("10.0.1.0/32") .addTargetTag("tag2")), new ParseOperationTest().expected()); @@ -194,16 +182,16 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpRequest update = HttpRequest .builder() .method("PATCH") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/firewalls/myfw") + .endpoint(BASE_URL + "/myproject/global/firewalls/myfw") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(firewallPayloadFirewallOfName( "myfw", "default", - ImmutableSet.<String>of("10.0.1.0/32"), - ImmutableSet.<String>of("tag1"), - ImmutableSet.<String>of("tag2"), - ImmutableSet.<String>of("22", "23-24"))) + ImmutableList.of("10.0.1.0/32"), + ImmutableList.of("tag1"), + ImmutableList.of("tag2"), + ImmutableList.of("22", "23-24"))) .build(); HttpResponse updateFirewallResponse = HttpResponse.builder().statusCode(200) @@ -216,12 +204,8 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest assertEquals(api.patch("myfw", new FirewallOptions() .name("myfw") - .network(URI.create("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/networks/default")) - .addAllowedRule(Firewall.Rule.builder() - .IpProtocol(IpProtocol.TCP) - .addPort(22) - .addPortRange(23, 24).build()) + .network(URI.create(BASE_URL + "/myproject/global/networks/default")) + .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22", "23-24"))) .addSourceTag("tag1") .addSourceRange("10.0.1.0/32") .addTargetTag("tag2")), new ParseOperationTest().expected()); @@ -231,8 +215,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpRequest delete = HttpRequest .builder() .method("DELETE") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/firewalls/default-allow-internal") + .endpoint(BASE_URL + "/myproject/global/firewalls/default-allow-internal") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -250,8 +233,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpRequest delete = HttpRequest .builder() .method("DELETE") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/firewalls/default-allow-internal") + .endpoint(BASE_URL + "/myproject/global/firewalls/default-allow-internal") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -267,8 +249,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpRequest list = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/firewalls") + .endpoint(BASE_URL + "/myproject/global/firewalls") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -286,8 +267,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineApiExpectTest HttpRequest list = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/firewalls") + .endpoint(BASE_URL + "/myproject/global/firewalls") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java index f390d9e..652d47a 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiLiveTest.java @@ -27,10 +27,9 @@ import org.jclouds.googlecomputeengine.domain.Firewall; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest; import org.jclouds.googlecomputeengine.options.FirewallOptions; import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.net.domain.IpProtocol; import org.testng.annotations.Test; -import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; @Test(groups = "live", testName = "FirewallApiLiveTest") @@ -53,17 +52,13 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { (FIREWALL_NETWORK_NAME, IPV4_RANGE), TIME_WAIT); FirewallOptions firewall = new FirewallOptions() - .addAllowedRule( - Firewall.Rule.builder() - .IpProtocol(IpProtocol.TCP) - .addPort(22).build()) + .addAllowedRule(Firewall.Rule.create("tcp", ImmutableList.of("22"))) .addSourceRange("10.0.0.0/8") .addSourceTag("tag1") .addTargetTag("tag2"); assertGlobalOperationDoneSucessfully(api().createInNetwork(FIREWALL_NAME, getNetworkUrl(userProject.get(), FIREWALL_NETWORK_NAME), firewall), TIME_WAIT); - } @Test(groups = "live", dependsOnMethods = "testInsertFirewall") @@ -75,15 +70,9 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { .addSourceRange("10.0.0.0/8") .addSourceTag("tag1") .addTargetTag("tag2") - .allowedRules(ImmutableSet.of( - Firewall.Rule.builder() - .IpProtocol(IpProtocol.TCP) - .addPort(23) - .build())); - + .allowedRules(ImmutableList.of(Firewall.Rule.create("tcp", ImmutableList.of("23")))); assertGlobalOperationDoneSucessfully(api().update(FIREWALL_NAME, firewall), TIME_WAIT); - } @Test(groups = "live", dependsOnMethods = "testUpdateFirewall") @@ -92,21 +81,13 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { FirewallOptions firewall = new FirewallOptions() .name(FIREWALL_NAME) .network(getNetworkUrl(userProject.get(), FIREWALL_NETWORK_NAME)) - .allowedRules(ImmutableSet.of( - Firewall.Rule.builder() - .IpProtocol(IpProtocol.TCP) - .addPort(22) - .build(), - Firewall.Rule.builder() - .IpProtocol(IpProtocol.TCP) - .addPort(23) - .build())) + .allowedRules(ImmutableList.of(Firewall.Rule.create("tcp", ImmutableList.of("22")), + Firewall.Rule.create("tcp", ImmutableList.of("23")))) .addSourceRange("10.0.0.0/8") .addSourceTag("tag1") .addTargetTag("tag2"); assertGlobalOperationDoneSucessfully(api().update(FIREWALL_NAME, firewall), TIME_WAIT); - } @Test(groups = "live", dependsOnMethods = "testPatchFirewall") @@ -115,15 +96,8 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { FirewallOptions patchedFirewall = new FirewallOptions() .name(FIREWALL_NAME) .network(getNetworkUrl(userProject.get(), FIREWALL_NETWORK_NAME)) - .allowedRules(ImmutableSet.of( - Firewall.Rule.builder() - .IpProtocol(IpProtocol.TCP) - .addPort(22) - .build(), - Firewall.Rule.builder() - .IpProtocol(IpProtocol.TCP) - .addPort(23) - .build())) + .allowedRules(ImmutableList.of(Firewall.Rule.create("tcp", ImmutableList.of("22")), + Firewall.Rule.create("tcp", ImmutableList.of("23")))) .addSourceRange("10.0.0.0/8") .addSourceTag("tag1") .addTargetTag("tag2"); @@ -154,11 +128,10 @@ public class FirewallApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { } private void assertFirewallEquals(Firewall result, FirewallOptions expected) { - assertEquals(result.getName(), expected.getName()); - assertEquals(getOnlyElement(result.getSourceRanges()), getOnlyElement(expected.getSourceRanges())); - assertEquals(getOnlyElement(result.getSourceTags()), getOnlyElement(expected.getSourceTags())); - assertEquals(getOnlyElement(result.getTargetTags()), getOnlyElement(expected.getTargetTags())); - assertEquals(result.getAllowed(), expected.getAllowed()); + assertEquals(result.name(), expected.name()); + assertEquals(getOnlyElement(result.sourceRanges()), getOnlyElement(expected.sourceRanges())); + assertEquals(getOnlyElement(result.sourceTags()), getOnlyElement(expected.sourceTags())); + assertEquals(getOnlyElement(result.targetTags()), getOnlyElement(expected.targetTags())); + assertEquals(result.allowed(), expected.getAllowed()); } - } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/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 6fc0cdf..866eadd 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 @@ -16,35 +16,34 @@ */ package org.jclouds.googlecomputeengine.features; +import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; +import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; +import static org.testng.AssertJUnit.assertNull; + +import java.net.URI; + +import javax.ws.rs.core.MediaType; + import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest; import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions; import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest; import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleListTest; import org.jclouds.googlecomputeengine.parse.ParseForwardingRuleTest; +import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; import org.testng.annotations.Test; -import javax.ws.rs.core.MediaType; - -import java.net.URI; - -import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; -import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.AssertJUnit.assertNull; - -@Test(groups = "unit") +@Test(groups = "unit", testName = "ForwardingRuleApiExpectTest") public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { public void testGetForwardingRuleResponseIs2xx() throws Exception { HttpRequest get = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule") + .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules/test-forwarding-rule") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -54,16 +53,14 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_READONLY_SCOPE), TOKEN_RESPONSE, get, operationResponse).getForwardingRuleApi("myproject", "us-central1"); - assertEquals(api.get("test-forwarding-rule"), - new ParseForwardingRuleTest().expected()); + assertEquals(api.get("test-forwarding-rule"), new ParseForwardingRuleTest().expected()); } public void testGetForwardingRuleResponseIs4xx() throws Exception { HttpRequest get = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule") + .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules/test-forwarding-rule") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -79,7 +76,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec HttpRequest insert = HttpRequest .builder() .method("POST") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules") + .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromResourceWithContentType("/forwardingrule_insert.json", MediaType.APPLICATION_JSON)) @@ -93,8 +90,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec insertForwardingRuleResponse).getForwardingRuleApi("myproject", "us-central1"); ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions() - .target(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/" - + "europe-west1/targetPools/test-target-pool")); + .target(URI.create(BASE_URL + "/myproject/regions/europe-west1/targetPools/test-target-pool")); assertEquals(api.create("test-forwarding-rule", forwardingRuleCreationOptions), new ParseRegionOperationTest().expected()); } @@ -103,8 +99,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec HttpRequest delete = HttpRequest .builder() .method("DELETE") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-forwarding-rule") + .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules/test-forwarding-rule") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -114,16 +109,14 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), TOKEN_RESPONSE, delete, deleteResponse).getForwardingRuleApi("myproject", "us-central1"); - assertEquals(api.delete("test-forwarding-rule"), - new ParseRegionOperationTest().expected()); + assertEquals(api.delete("test-forwarding-rule"), new ParseRegionOperationTest().expected()); } public void testDeleteForwardingRuleResponseIs4xx() { HttpRequest delete = HttpRequest .builder() .method("DELETE") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/test-targetPool") + .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules/test-targetPool") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -139,7 +132,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec HttpRequest list = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules") + .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -150,15 +143,14 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec TOKEN_RESPONSE, list, operationResponse).getForwardingRuleApi("myproject", "us-central1"); ListOptions options = new ListOptions(); - assertEquals(api.list(options).toString(), - new ParseForwardingRuleListTest().expected().toString()); + assertEquals(api.list(options).toString(), new ParseForwardingRuleListTest().expected().toString()); } public void testListForwardingRulesResponseIs4xx() { HttpRequest list = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules") + .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -175,7 +167,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec HttpRequest setTarget = HttpRequest .builder() .method("POST") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/forwardingRules/" + ruleName + "/setTarget") + .endpoint(BASE_URL + "/myproject/regions/us-central1/forwardingRules/" + ruleName + "/setTarget") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromResourceWithContentType("/forwardingrule_set_target.json", MediaType.APPLICATION_JSON)) @@ -187,8 +179,7 @@ public class ForwardingRuleApiExpectTest extends BaseGoogleComputeEngineApiExpec ForwardingRuleApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), TOKEN_RESPONSE, setTarget, setTargetResponse).getForwardingRuleApi("myproject", "us-central1"); - URI newTarget = URI.create("https://www.googleapis.com/compute/v1/projects/" - + "myproject/regions/europe-west1/targetPools/test-target-pool"); + URI newTarget = URI.create(BASE_URL + "/myproject/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/b41b0d04/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java index ff93ce6..380bfbb 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiLiveTest.java @@ -16,11 +16,13 @@ */ package org.jclouds.googlecomputeengine.features; -import org.jclouds.collect.IterableWithMarker; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + import org.jclouds.googlecomputeengine.domain.Address; import org.jclouds.googlecomputeengine.domain.ForwardingRule; +import org.jclouds.googlecomputeengine.domain.ListPage; import org.jclouds.googlecomputeengine.domain.TargetPool; -import org.jclouds.googlecomputeengine.domain.ForwardingRule.IPProtocolOption; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest; import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions; import org.jclouds.googlecomputeengine.options.ListOptions; @@ -29,10 +31,6 @@ import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static com.google.common.base.Optional.fromNullable; - public class ForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { private static final String FORWARDING_RULE_NAME = "forwarding-rule-api-live-test"; @@ -85,9 +83,9 @@ public class ForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiLiveTes public void testInsertForwardingRule() { ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions() .description(DESCRIPTION) - .ipAddress(address.getAddress()) - .ipProtocol(IPProtocolOption.TCP) - .target(targetPool.getSelfLink()); + .ipAddress(address.address()) + .ipProtocol(ForwardingRule.IPProtocol.TCP) + .target(targetPool.selfLink()); assertRegionOperationDoneSucessfully(api().create(FORWARDING_RULE_NAME, forwardingRuleCreationOptions), TIME_WAIT); } @@ -95,28 +93,28 @@ public class ForwardingRuleApiLiveTest extends BaseGoogleComputeEngineApiLiveTes public void testGetForwardingRule() { ForwardingRule forwardingRule = api().get(FORWARDING_RULE_NAME); assertNotNull(forwardingRule); - assertEquals(forwardingRule.getName(), FORWARDING_RULE_NAME); - assertEquals(forwardingRule.getDescription(), fromNullable(DESCRIPTION)); - assertEquals(forwardingRule.getIpAddress(), fromNullable(address.getAddress())); - assertEquals(forwardingRule.getIpProtocol(), fromNullable(IPProtocolOption.TCP)); - assertEquals(forwardingRule.getTarget(), targetPool.getSelfLink()); + assertEquals(forwardingRule.name(), FORWARDING_RULE_NAME); + assertEquals(forwardingRule.description(), DESCRIPTION); + assertEquals(forwardingRule.ipAddress(), address.address()); + assertEquals(forwardingRule.ipProtocol(), ForwardingRule.IPProtocol.TCP); + assertEquals(forwardingRule.target(), targetPool.selfLink()); } @Test(groups = "live", dependsOnMethods = "testGetForwardingRule") public void testSetTargetForwardingRule(){ - assertRegionOperationDoneSucessfully(api().setTarget(FORWARDING_RULE_NAME, newTargetPool.getSelfLink()), TIME_WAIT); + assertRegionOperationDoneSucessfully(api().setTarget(FORWARDING_RULE_NAME, newTargetPool.selfLink()), TIME_WAIT); ForwardingRule forwardingRule = api().get(FORWARDING_RULE_NAME); assertNotNull(forwardingRule); - assertEquals(forwardingRule.getName(), FORWARDING_RULE_NAME); - assertEquals(forwardingRule.getTarget(), newTargetPool.getSelfLink()); + assertEquals(forwardingRule.name(), FORWARDING_RULE_NAME); + assertEquals(forwardingRule.target(), newTargetPool.selfLink()); } @Test(groups = "live", dependsOnMethods = "testInsertForwardingRule") public void testListForwardingRule() { - IterableWithMarker<ForwardingRule> forwardingRule = api().list(new ListOptions.Builder() + ListPage<ForwardingRule> forwardingRule = api().list(new ListOptions.Builder() .filter("name eq " + FORWARDING_RULE_NAME)); - assertEquals(forwardingRule.toList().size(), 1); + assertEquals(forwardingRule.size(), 1); } @Test(groups = "live", dependsOnMethods = {"testListForwardingRule", "testSetTargetForwardingRule"}, alwaysRun = true) http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java index bf4aa21..a7c6731 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiExpectTest.java @@ -24,17 +24,16 @@ import static org.testng.Assert.assertTrue; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest; import org.jclouds.googlecomputeengine.options.ListOptions; -import org.jclouds.googlecomputeengine.parse.ParseOperationListTest; -import org.jclouds.googlecomputeengine.parse.ParseOperationTest; +import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationListTest; +import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; import org.testng.annotations.Test; -@Test(groups = "unit") +@Test(groups = "unit", testName = "GlobalOperationApiExpectTest") public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { - private static final String OPERATIONS_URL_PREFIX = "https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/operations"; + private static final String OPERATIONS_URL_PREFIX = BASE_URL + "/myproject/global/operations"; public static final HttpRequest GET_GLOBAL_OPERATION_REQUEST = HttpRequest .builder() @@ -52,7 +51,7 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe TOKEN_RESPONSE, GET_GLOBAL_OPERATION_REQUEST, GET_GLOBAL_OPERATION_RESPONSE).getGlobalOperationApi("myproject"); assertEquals(operationApi.get("operation-1354084865060-4cf88735faeb8-bbbb12cb"), - new ParseOperationTest().expected()); + new ParseGlobalOperationTest().expected()); } public void testGetOperationResponseIs4xx() throws Exception { @@ -110,7 +109,7 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe TOKEN_RESPONSE, get, operationResponse).getGlobalOperationApi("myproject"); assertEquals(globalOperationApi.listFirstPage().toString(), - new ParseOperationListTest().expected().toString()); + new ParseGlobalOperationListTest().expected().toString()); } public void testListOperationWithPaginationOptionsResponseIs2xx() { @@ -135,7 +134,7 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe assertEquals(globalOperationApi.listAtMarker("CglPUEVSQVRJT04SOzU5MDQyMTQ4Nzg1Mi5vcGVyYXRpb24tMTM1Mj" + "I0NDI1ODAzMC00Y2RkYmU2YTJkNmIwLWVkMzIyMzQz", new ListOptions.Builder().filter("status eq done").maxResults(3)).toString(), - new ParseOperationListTest().expected().toString()); + new ParseGlobalOperationListTest().expected().toString()); } public void testListOperationWithPaginationOptionsResponseIs4xx() { @@ -153,6 +152,4 @@ public class GlobalOperationApiExpectTest extends BaseGoogleComputeEngineApiExpe assertTrue(globalOperationApi.list().concat().isEmpty()); } - - } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java index 010fcac..526bc26 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/GlobalOperationApiLiveTest.java @@ -60,7 +60,7 @@ public class GlobalOperationApiLiveTest extends BaseGoogleComputeEngineApiLiveTe @Test(groups = "live", dependsOnMethods = "testCreateOperations") public void testGetOperation() { - Operation operation = api().get(addOperation.getName()); + Operation operation = api().get(addOperation.name()); assertNotNull(operation); assertOperationEquals(operation, this.addOperation); } @@ -74,9 +74,7 @@ public class GlobalOperationApiLiveTest extends BaseGoogleComputeEngineApiLiveTe // make sure that in spite of having only one result per page we get at least two results final AtomicInteger counter = new AtomicInteger(); operations.firstMatch(new Predicate<IterableWithMarker<Operation>>() { - - @Override - public boolean apply(IterableWithMarker<Operation> input) { + @Override public boolean apply(IterableWithMarker<Operation> input) { counter.addAndGet(Iterables.size(input)); return counter.get() == 2; } @@ -84,7 +82,7 @@ public class GlobalOperationApiLiveTest extends BaseGoogleComputeEngineApiLiveTe } private void assertOperationEquals(Operation result, Operation expected) { - assertEquals(result.getName(), expected.getName()); + assertEquals(result.name(), expected.name()); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/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 9069619..5c165fd 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 @@ -27,22 +27,22 @@ import javax.ws.rs.core.MediaType; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiExpectTest; import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions; import org.jclouds.googlecomputeengine.options.ListOptions; +import org.jclouds.googlecomputeengine.parse.ParseGlobalOperationTest; import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckListTest; import org.jclouds.googlecomputeengine.parse.ParseHttpHealthCheckTest; -import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; import org.jclouds.rest.ResourceNotFoundException; import org.testng.annotations.Test; -@Test(groups = "unit") +@Test(groups = "unit", testName = "HttpHealthCheckApiExpectTest") public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { public void testGetHttpHealthCheckResponseIs2xx() throws Exception { HttpRequest get = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/http-health-check-api-live-test") + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/http-health-check-api-live-test") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -60,7 +60,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpRequest get = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/http-health-check-test") + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/http-health-check-test") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -76,7 +76,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpRequest insert = HttpRequest .builder() .method("POST") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks") + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON)) @@ -89,7 +89,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe TOKEN_RESPONSE, insert, insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject"); HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0); - assertEquals(api.insert("http-health-check", options), new ParseRegionOperationTest().expected()); + assertEquals(api.insert("http-health-check", options), new ParseGlobalOperationTest().expected()); } @Test(expectedExceptions = ResourceNotFoundException.class) @@ -97,7 +97,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpRequest create = HttpRequest .builder() .method("POST") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks") + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON)) @@ -117,7 +117,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpRequest delete = HttpRequest .builder() .method("DELETE") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/http-health-check") + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/http-health-check") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -128,14 +128,14 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe TOKEN_RESPONSE, delete, deleteResponse).getHttpHealthCheckApi("myproject"); assertEquals(api.delete("http-health-check"), - new ParseRegionOperationTest().expected()); + new ParseGlobalOperationTest().expected()); } public void testDeleteHttpHealthCheckResponseIs4xx() { HttpRequest delete = HttpRequest .builder() .method("DELETE") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/http-health-check") + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/http-health-check") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -151,7 +151,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpRequest list = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks") + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -170,7 +170,7 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpRequest list = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks") + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -187,20 +187,20 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpRequest patch = HttpRequest .builder() .method("PATCH") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/" + healthCheckName) + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/" + healthCheckName) .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON)) .build(); - HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200) - .payload(payloadFromResource("/global_operation.json")).build(); - - HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), - TOKEN_RESPONSE, patch, - insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject"); - HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0); - assertEquals(api.patch(healthCheckName, options), new ParseRegionOperationTest().expected()); + HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200) + .payload(payloadFromResource("/global_operation.json")).build(); + + HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), + TOKEN_RESPONSE, patch, + insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject"); + HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0); + assertEquals(api.patch(healthCheckName, options), new ParseGlobalOperationTest().expected()); } @Test(expectedExceptions = ResourceNotFoundException.class) @@ -209,20 +209,20 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpRequest patch = HttpRequest .builder() .method("PATCH") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/" + healthCheckName) + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/" + healthCheckName) .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON)) .build(); - HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(404).build(); - - HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), - TOKEN_RESPONSE, patch, - insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject"); - HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0); - - api.patch(healthCheckName, options); + HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(404).build(); + + HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), + TOKEN_RESPONSE, patch, + insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject"); + HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0); + + api.patch(healthCheckName, options); } public void testUpdateHttpHealthChecksResponseIs2xx() { @@ -230,20 +230,20 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpRequest patch = HttpRequest .builder() .method("PUT") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/" + healthCheckName) + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/" + healthCheckName) .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON)) .build(); - HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200) - .payload(payloadFromResource("/global_operation.json")).build(); + HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(200) + .payload(payloadFromResource("/global_operation.json")).build(); - HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), - TOKEN_RESPONSE, patch, - insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject"); - HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0); - assertEquals(api.update(healthCheckName, options), new ParseRegionOperationTest().expected()); + HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), + TOKEN_RESPONSE, patch, + insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject"); + HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0); + assertEquals(api.update(healthCheckName, options), new ParseGlobalOperationTest().expected()); } @Test(expectedExceptions = ResourceNotFoundException.class) @@ -252,19 +252,19 @@ public class HttpHealthCheckApiExpectTest extends BaseGoogleComputeEngineApiExpe HttpRequest patch = HttpRequest .builder() .method("PUT") - .endpoint("https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/" + healthCheckName) + .endpoint(BASE_URL + "/myproject/global/httpHealthChecks/" + healthCheckName) .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromResourceWithContentType("/httphealthcheck_insert.json", MediaType.APPLICATION_JSON)) .build(); - HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(404).build(); + HttpResponse insertHttpHealthCheckResponse = HttpResponse.builder().statusCode(404).build(); - HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), - TOKEN_RESPONSE, patch, - insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject"); - HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0); - api.update(healthCheckName, options); + HttpHealthCheckApi api = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), + TOKEN_RESPONSE, patch, + insertHttpHealthCheckResponse).getHttpHealthCheckApi("myproject"); + HttpHealthCheckCreationOptions options = new HttpHealthCheckCreationOptions().timeoutSec(0).unhealthyThreshold(0); + api.update(healthCheckName, options); } } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java index bdcfded..139e610 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiLiveTest.java @@ -16,18 +16,17 @@ */ package org.jclouds.googlecomputeengine.features; -import org.jclouds.collect.IterableWithMarker; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotEquals; +import static org.testng.Assert.assertNotNull; + import org.jclouds.googlecomputeengine.domain.HttpHealthCheck; +import org.jclouds.googlecomputeengine.domain.ListPage; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest; import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions; import org.jclouds.googlecomputeengine.options.ListOptions; import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotEquals; -import static org.testng.Assert.assertNotNull; -import static com.google.common.base.Optional.fromNullable; - public class HttpHealthCheckApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { private static final String HTTP_HEALTH_CHECK_NAME = "http-health-check-api-live-test"; @@ -57,59 +56,59 @@ public class HttpHealthCheckApiLiveTest extends BaseGoogleComputeEngineApiLiveTe public void testGetHttpHealthCheck() { HttpHealthCheck httpHealthCheck = api().get(HTTP_HEALTH_CHECK_NAME); assertNotNull(httpHealthCheck); - assertEquals(httpHealthCheck.getName(), HTTP_HEALTH_CHECK_NAME); - assertEquals(httpHealthCheck.getPort(), fromNullable(options.getPort())); - assertEquals(httpHealthCheck.getCheckIntervalSec(), fromNullable(options.getCheckIntervalSec())); - assertEquals(httpHealthCheck.getTimeoutSec(), fromNullable(options.getTimeoutSec())); - assertEquals(httpHealthCheck.getHealthyThreshold(), fromNullable(options.getHealthyThreshold())); - assertEquals(httpHealthCheck.getUnhealthyThreshold(), fromNullable(options.getUnhealthyThreshold())); - assertEquals(httpHealthCheck.getDescription(), fromNullable(options.getDescription())); + assertEquals(httpHealthCheck.name(), HTTP_HEALTH_CHECK_NAME); + assertEquals(httpHealthCheck.port(), options.port().intValue()); + assertEquals(httpHealthCheck.checkIntervalSec(), options.checkIntervalSec().intValue()); + assertEquals(httpHealthCheck.timeoutSec(), options.timeoutSec().intValue()); + assertEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold().intValue()); + assertEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold().intValue()); + assertEquals(httpHealthCheck.description(), options.description()); } @Test(groups = "live", dependsOnMethods = "testInsertHttpHealthCheck") public void testListHttpHealthCheck() { - IterableWithMarker<HttpHealthCheck> httpHealthCheck = api().list(new ListOptions.Builder() + ListPage<HttpHealthCheck> httpHealthCheck = api().list(new ListOptions.Builder() .filter("name eq " + HTTP_HEALTH_CHECK_NAME)); - assertEquals(httpHealthCheck.toList().size(), 1); + assertEquals(httpHealthCheck.size(), 1); } @Test(groups = "live", dependsOnMethods = "testGetHttpHealthCheck") public void testPatchHttpHealthCheck() { HttpHealthCheckCreationOptions newOptions = new HttpHealthCheckCreationOptions() - .port(options.getPort() + OFFSET) - .checkIntervalSec(options.getCheckIntervalSec() + OFFSET) - .timeoutSec(options.getTimeoutSec() + OFFSET); + .port(options.port() + OFFSET) + .checkIntervalSec(options.checkIntervalSec() + OFFSET) + .timeoutSec(options.timeoutSec() + OFFSET); assertGlobalOperationDoneSucessfully(api().patch(HTTP_HEALTH_CHECK_NAME, newOptions), TIME_WAIT); // Check changes happened and others unchanged. HttpHealthCheck httpHealthCheck = api().get(HTTP_HEALTH_CHECK_NAME); assertNotNull(httpHealthCheck); - assertEquals(httpHealthCheck.getName(), HTTP_HEALTH_CHECK_NAME); - assertEquals(httpHealthCheck.getPort(), fromNullable(newOptions.getPort())); - assertEquals(httpHealthCheck.getCheckIntervalSec(), fromNullable(newOptions.getCheckIntervalSec())); - assertEquals(httpHealthCheck.getTimeoutSec(), fromNullable(newOptions.getTimeoutSec())); - assertEquals(httpHealthCheck.getHealthyThreshold(), fromNullable(options.getHealthyThreshold())); - assertEquals(httpHealthCheck.getUnhealthyThreshold(), fromNullable(options.getUnhealthyThreshold())); - assertEquals(httpHealthCheck.getDescription(), fromNullable(options.getDescription())); + assertEquals(httpHealthCheck.name(), HTTP_HEALTH_CHECK_NAME); + assertEquals(httpHealthCheck.port(), newOptions.port().intValue()); + assertEquals(httpHealthCheck.checkIntervalSec(), newOptions.checkIntervalSec().intValue()); + assertEquals(httpHealthCheck.timeoutSec(), newOptions.timeoutSec().intValue()); + assertEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold().intValue()); + assertEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold().intValue()); + assertEquals(httpHealthCheck.description(), options.description()); } @Test(groups = "live", dependsOnMethods = "testPatchHttpHealthCheck") public void testUpdateHttpHealthCheck() { HttpHealthCheckCreationOptions newOptions = new HttpHealthCheckCreationOptions() - .checkIntervalSec(options.getCheckIntervalSec() - OFFSET) - .timeoutSec(options.getTimeoutSec() - OFFSET); + .checkIntervalSec(options.checkIntervalSec() - OFFSET) + .timeoutSec(options.timeoutSec() - OFFSET); assertGlobalOperationDoneSucessfully(api().update(HTTP_HEALTH_CHECK_NAME, newOptions), TIME_WAIT); // Check changes happened. HttpHealthCheck httpHealthCheck = api().get(HTTP_HEALTH_CHECK_NAME); assertNotNull(httpHealthCheck); - assertEquals(httpHealthCheck.getName(), HTTP_HEALTH_CHECK_NAME); - assertEquals(httpHealthCheck.getCheckIntervalSec(), fromNullable(newOptions.getCheckIntervalSec())); - assertEquals(httpHealthCheck.getTimeoutSec(), fromNullable(newOptions.getTimeoutSec())); + assertEquals(httpHealthCheck.name(), HTTP_HEALTH_CHECK_NAME); + assertEquals(httpHealthCheck.checkIntervalSec(), newOptions.checkIntervalSec().intValue()); + assertEquals(httpHealthCheck.timeoutSec(), newOptions.timeoutSec().intValue()); // Update overwrites unspecified parameters to their defaults. - assertNotEquals(httpHealthCheck.getHealthyThreshold(), fromNullable(options.getHealthyThreshold())); - assertNotEquals(httpHealthCheck.getUnhealthyThreshold(), fromNullable(options.getUnhealthyThreshold())); - assertNotEquals(httpHealthCheck.getDescription(), fromNullable(options.getDescription())); + assertNotEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold()); + assertNotEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold()); + assertNotEquals(httpHealthCheck.description(), options.description()); } @Test(groups = "live", dependsOnMethods = {"testListHttpHealthCheck", "testUpdateHttpHealthCheck"}) http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/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 c1781f1..5f8ed31 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 @@ -31,14 +31,13 @@ import org.jclouds.http.HttpResponse; import org.jclouds.rest.ResourceNotFoundException; import org.testng.annotations.Test; -@Test(groups = "unit") +@Test(groups = "unit", testName = "ImageApiExpectTest") public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { public static final HttpRequest LIST_PROJECT_IMAGES_REQUEST = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/images") + .endpoint(BASE_URL + "/myproject/global/images") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -48,7 +47,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { public static final HttpRequest LIST_CENTOS_IMAGES_REQUEST = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images") + .endpoint(BASE_URL + "/centos-cloud/global/images") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -58,7 +57,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { public static final HttpRequest LIST_DEBIAN_IMAGES_REQUEST = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images") + .endpoint(BASE_URL + "/debian-cloud/global/images") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -70,8 +69,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpRequest get = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326") + .endpoint(BASE_URL + "/centos-cloud/global/images/centos-6-2-v20120326") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -89,8 +87,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpRequest get = HttpRequest .builder() .method("GET") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326") + .endpoint(BASE_URL + "/centos-cloud/global/images/centos-6-2-v20120326") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -106,8 +103,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpRequest delete = HttpRequest .builder() .method("DELETE") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/images/centos-6-2-v20120326") + .endpoint(BASE_URL + "/myproject/global/images/centos-6-2-v20120326") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -125,8 +121,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpRequest delete = HttpRequest .builder() .method("DELETE") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/images/centos-6-2-v20120326") + .endpoint(BASE_URL + "/myproject/global/images/centos-6-2-v20120326") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN).build(); @@ -162,8 +157,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpRequest createImage = HttpRequest .builder() .method("POST") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/images") + .endpoint(BASE_URL + "/myproject/global/images") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromResource("/image_insert_from_pd.json")) @@ -175,8 +169,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), TOKEN_RESPONSE, createImage, createImageResponse).getImageApi("myproject"); - assertEquals(imageApi.createImageFromPD("my-image", "https://www.googleapis.com/" + - "compute/v1/projects/myproject/zones/us-central1-a/disks/mydisk"), + assertEquals(imageApi.createImageFromPD("my-image", BASE_URL + "/myproject/zones/us-central1-a/disks/mydisk"), new ParseOperationTest().expected()); } @@ -185,8 +178,7 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { HttpRequest createImage = HttpRequest .builder() .method("POST") - .endpoint("https://www.googleapis" + - ".com/compute/v1/projects/myproject/global/images") + .endpoint(BASE_URL + "/myproject/global/images") .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromResource("/image_insert_from_pd.json")) @@ -197,7 +189,6 @@ public class ImageApiExpectTest extends BaseGoogleComputeEngineApiExpectTest { ImageApi imageApi = requestsSendResponses(requestForScopes(COMPUTE_SCOPE), TOKEN_RESPONSE, createImage, createImageResponse).getImageApi("myproject"); - imageApi.createImageFromPD("my-image", "https://www.googleapis.com/" + - "compute/v1/projects/myproject/zones/us-central1-a/disks/mydisk"); + imageApi.createImageFromPD("my-image", BASE_URL + "/myproject/zones/us-central1-a/disks/mydisk"); } } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java index c8a8cd7..8c3f0bf 100644 --- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiLiveTest.java @@ -34,7 +34,6 @@ import org.jclouds.googlecomputeengine.options.ListOptions; import org.testng.annotations.Test; import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { @@ -67,7 +66,7 @@ public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { assertTrue(pageIterator.hasNext()); IterableWithMarker<Image> singlePageIterator = pageIterator.next(); - List<Image> imageAsList = Lists.newArrayList(singlePageIterator); + List<Image> imageAsList = singlePageIterator.toList(); assertSame(imageAsList.size(), 1); @@ -77,20 +76,20 @@ public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { @Test(groups = "live", dependsOnMethods = "testListImage") public void testGetImage() { - Image image = api().get(this.image.getName()); + Image image = api().get(this.image.name()); assertNotNull(image); assertImageEquals(image, this.image); } private void assertImageEquals(Image result, Image expected) { - assertEquals(result.getName(), expected.getName()); + assertEquals(result.name(), expected.name()); } @Test(groups = "live") public void testInsertDisk() { assertZoneOperationDoneSucessfully(diskApi().createInZone(DISK_NAME, sizeGb, DEFAULT_ZONE_NAME), TIME_WAIT); Disk disk = diskApi().getInZone(DEFAULT_ZONE_NAME, DISK_NAME); - diskURI = disk.getSelfLink(); + diskURI = disk.selfLink(); } @Test(groups = "live", dependsOnMethods = "testInsertDisk") @@ -111,10 +110,9 @@ public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { } private void assertImageEquals(Image result) { - assertEquals(result.getName(), IMAGE_NAME); - assertEquals(result.getSourceType(), "RAW"); - assertEquals(result.getSelfLink(), getImageUrl(userProject.get(), IMAGE_NAME) ); + assertEquals(result.name(), IMAGE_NAME); + assertEquals(result.sourceType(), "RAW"); + assertEquals(result.selfLink(), getImageUrl(userProject.get(), IMAGE_NAME) ); } - }
