You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2014/12/15 22:41:52 UTC
jclouds-labs-google git commit: added CreationTimestamp to
HttpHealthCheck and TargetPool + refactor Warning
Repository: jclouds-labs-google
Updated Branches:
refs/heads/master 672b94269 -> 2a724044b
added CreationTimestamp to HttpHealthCheck and TargetPool + refactor Warning
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/commit/2a724044
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/tree/2a724044
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/diff/2a724044
Branch: refs/heads/master
Commit: 2a724044b5aa76a66e043067811eb5e05df0f1f7
Parents: 672b942
Author: Daniel Broudy <br...@google.com>
Authored: Tue Dec 9 13:46:07 2014 -0800
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Dec 15 22:38:53 2014 +0100
----------------------------------------------------------------------
.../domain/HttpHealthCheck.java | 9 ++-
.../domain/KeyValuePair.java | 37 +++++++++++
.../googlecomputeengine/domain/Metadata.java | 30 +++------
.../googlecomputeengine/domain/Operation.java | 33 ----------
.../googlecomputeengine/domain/Route.java | 27 ++------
.../googlecomputeengine/domain/TargetPool.java | 9 ++-
.../googlecomputeengine/domain/Warning.java | 40 ++++++++++++
.../features/InstanceApi.java | 2 +-
.../options/HttpHealthCheckCreationOptions.java | 10 +--
.../options/RouteOptions.java | 16 +++++
.../features/ForwardingRuleApiMockTest.java | 10 +++
.../features/InstanceApiLiveTest.java | 23 ++++++-
.../features/InstanceApiMockTest.java | 2 +-
.../parse/ParseHttpHealthCheckListTest.java | 2 +
.../parse/ParseHttpHealthCheckTest.java | 15 +++--
.../parse/ParseOperationTest.java | 8 +--
.../parse/ParseRouteListTest.java | 3 +-
.../parse/ParseRouteTest.java | 7 +-
.../parse/ParseTargetPoolTest.java | 1 +
.../src/test/resources/httphealthcheck_get.json | 17 +++--
.../test/resources/httphealthcheck_list.json | 67 +++++++++++---------
21 files changed, 229 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
index 00553f7..0e3d955 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
@@ -17,6 +17,7 @@
package org.jclouds.googlecomputeengine.domain;
import java.net.URI;
+import java.util.Date;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
@@ -30,6 +31,8 @@ public abstract class HttpHealthCheck {
public abstract URI selfLink();
+ public abstract Date creationTimestamp();
+
public abstract String name();
@Nullable public abstract String description();
@@ -58,12 +61,12 @@ public abstract class HttpHealthCheck {
@Nullable public abstract Integer healthyThreshold();
@SerializedNames(
- { "id", "selfLink", "name", "description", "host", "requestPath", "port", "checkIntervalSec", "timeoutSec",
+ { "id", "selfLink", "creationTimestamp", "name", "description", "host", "requestPath", "port", "checkIntervalSec", "timeoutSec",
"unhealthyThreshold", "healthyThreshold" })
- public static HttpHealthCheck create(String id, URI selfLink, String name, String description, String host,
+ public static HttpHealthCheck create(String id, URI selfLink, Date creationTimestamp, String name, String description, String host,
String requestPath, Integer port, Integer checkIntervalSec, Integer timeoutSec, Integer unhealthyThreshold,
Integer healthyThreshold) {
- return new AutoValue_HttpHealthCheck(id, selfLink, name, description, host,
+ return new AutoValue_HttpHealthCheck(id, selfLink, creationTimestamp, name, description, host,
requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/KeyValuePair.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/KeyValuePair.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/KeyValuePair.java
new file mode 100644
index 0000000..823b55e
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/KeyValuePair.java
@@ -0,0 +1,37 @@
+/*
+ * 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.domain;
+
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class KeyValuePair {
+
+ public abstract String key();
+
+ public abstract String value();
+
+ @SerializedNames({ "key", "value" })
+ public static KeyValuePair create(String key, String value) {
+ return new AutoValue_KeyValuePair(key, value);
+ }
+
+ KeyValuePair(){
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
index 60b8abd..b512cbe 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java
@@ -33,25 +33,13 @@ import com.google.auto.value.AutoValue;
@AutoValue
public abstract class Metadata implements Cloneable {
- @AutoValue
- public abstract static class Entry {
- abstract String key();
-
- abstract String value();
-
- @SerializedNames({ "key", "value" })
- public static Entry create(String key, String value) {
- return new AutoValue_Metadata_Entry(key, value);
- }
- }
-
/** The fingerprint for the items - needed for updating them. */
@Nullable public abstract String fingerprint();
/** Adds or replaces a metadata entry. */
public Metadata put(String key, String value) {
remove(key);
- items().add(Entry.create(key, value));
+ items().add(KeyValuePair.create(key, value));
return this;
}
@@ -77,9 +65,9 @@ public abstract class Metadata implements Cloneable {
/** Copies the metadata into a new mutable map. */
public Map<String, String> asMap() {
Map<String, String> result = new LinkedHashMap<String, String>();
- ArrayList<Entry> items = items();
+ ArrayList<KeyValuePair> items = items();
for (int i = 0, length = items.size(); i < length; i++) {
- Entry item = items.get(i);
+ KeyValuePair item = items.get(i);
result.put(item.key(), item.value());
}
return result;
@@ -87,9 +75,9 @@ public abstract class Metadata implements Cloneable {
/** Returns the value with the supplied key, or null. */
@Nullable public String get(String key) {
- ArrayList<Entry> items = items();
+ ArrayList<KeyValuePair> items = items();
for (int i = 0, length = items.size(); i < length; i++) {
- Entry item = items.get(i);
+ KeyValuePair item = items.get(i);
if (item.key().equals(key)) {
return item.value();
}
@@ -106,7 +94,7 @@ public abstract class Metadata implements Cloneable {
}
/** Mutable list of metadata. */
- abstract ArrayList<Entry> items();
+ abstract ArrayList<KeyValuePair> items();
public static Metadata create() {
return Metadata.create(null, null);
@@ -117,14 +105,14 @@ public abstract class Metadata implements Cloneable {
}
@SerializedNames({ "fingerprint", "items" })
- static Metadata create(String fingerprint, ArrayList<Entry> items) { // Dictates the type when created from json!
- return new AutoValue_Metadata(fingerprint, items != null ? items : new ArrayList<Entry>());
+ static Metadata create(String fingerprint, ArrayList<KeyValuePair> items) { // Dictates the type when created from json!
+ return new AutoValue_Metadata(fingerprint, items != null ? items : new ArrayList<KeyValuePair>());
}
Metadata() {
}
@Override public Metadata clone() {
- return Metadata.create(fingerprint(), new ArrayList<Entry>(items()));
+ return Metadata.create(fingerprint(), new ArrayList<KeyValuePair>(items()));
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
index 0c99535..b36dc64 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import org.jclouds.googlecomputeengine.domain.Metadata.Entry;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
@@ -68,38 +67,6 @@ public abstract class Operation {
}
}
- @AutoValue
- public abstract static class Warning {
-
- // TODO: combine this with Metadata.Entry
- @AutoValue
- public abstract static class Entry {
- abstract String key();
-
- abstract String value();
-
- @SerializedNames({ "key", "value" })
- public static Entry create(String key, String value) {
- return new AutoValue_Operation_Warning_Entry(key, value);
- }
-
- Entry(){
- }
- }
-
- public abstract String code();
- @Nullable public abstract String message();
- public abstract List<Entry> data();
-
- @SerializedNames({"code", "message", "data"})
- public static Warning create(String code, String message, List<Entry> data){
- return new AutoValue_Operation_Warning(code, message, data);
- }
-
- Warning() {
- }
- }
-
public static enum Status {
PENDING,
RUNNING,
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
index ed0737e..a99d0fd 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
@@ -30,24 +30,6 @@ import com.google.auto.value.AutoValue;
@AutoValue
public abstract class Route {
- @AutoValue
- public abstract static class Warning {
- public abstract String code(); // TODO: enum
-
- // TODO: create common Warning resource.
- @Nullable public abstract String message();
-
- public abstract List<Metadata.Entry> data();
-
- @SerializedNames({ "code", "message", "data" })
- public static Warning create(String code, String message, List<Metadata.Entry> data) {
- return new AutoValue_Route_Warning(code, message, copyOf(data));
- }
-
- Warning() {
- }
- }
-
public abstract String id();
public abstract Date creationTimestamp();
@@ -88,14 +70,17 @@ public abstract class Route {
/** Potential misconfigurations are detected for this route. */
public abstract List<Warning> warnings();
+ /** The URL to a VpnTunnel that should handle matching packets. */
+ @Nullable public abstract URI nextHopVpnTunnel();
+
@SerializedNames(
{ "id", "creationTimestamp", "selfLink", "name", "description", "network", "tags", "destRange", "priority", "nextHopInstance",
- "nextHopIp", "nextHopNetwork", "nextHopGateway", "warnings" })
+ "nextHopIp", "nextHopNetwork", "nextHopGateway", "warnings", "nextHopVpnTunnel" })
public static Route create(String id, Date creationTimestamp, URI selfLink, String name, String description, URI network, List<String> tags,
String destRange, int priority, URI nextHopInstance, String nextHopIp, URI nextHopNetwork, URI nextHopGateway,
- List<Warning> warnings) {
+ List<Warning> warnings, URI nextHopVpnTunnel) {
return new AutoValue_Route(id, creationTimestamp, selfLink, name, description, network, copyOf(tags), destRange, priority,
- nextHopInstance, nextHopIp, nextHopNetwork, nextHopGateway, copyOf(warnings));
+ nextHopInstance, nextHopIp, nextHopNetwork, nextHopGateway, copyOf(warnings), nextHopVpnTunnel);
}
Route() {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
index ee7fe7b..4fa447b 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
@@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.domain;
import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
import java.net.URI;
+import java.util.Date;
import java.util.List;
import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions.SessionAffinityValue;
@@ -34,6 +35,8 @@ public abstract class TargetPool {
public abstract URI selfLink();
+ public abstract Date creationTimestamp();
+
public abstract String name();
@Nullable public abstract String description();
@@ -83,12 +86,12 @@ public abstract class TargetPool {
*/
@Nullable public abstract URI backupPool();
- @SerializedNames({ "id", "selfLink", "name", "description", "region", "healthChecks", "instances", "sessionAffinity",
+ @SerializedNames({ "id", "selfLink", "creationTimestamp", "name", "description", "region", "healthChecks", "instances", "sessionAffinity",
"failoverRatio", "backupPool" })
- public static TargetPool create(String id, URI selfLink, String name, String description, URI region,
+ public static TargetPool create(String id, URI selfLink, Date creationTimestamp, String name, String description, URI region,
List<URI> healthChecks, List<URI> instances, SessionAffinityValue sessionAffinity, Float failoverRatio,
URI backupPool) {
- return new AutoValue_TargetPool(id, selfLink, name, description, region, copyOf(healthChecks), copyOf(instances),
+ return new AutoValue_TargetPool(id, selfLink, creationTimestamp, name, description, region, copyOf(healthChecks), copyOf(instances),
sessionAffinity, failoverRatio, backupPool);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Warning.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Warning.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Warning.java
new file mode 100644
index 0000000..ec2f4b9
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Warning.java
@@ -0,0 +1,40 @@
+/*
+ * 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.domain;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class Warning {
+
+ public abstract String code();
+ @Nullable public abstract String message();
+ public abstract List<KeyValuePair> data();
+
+ @SerializedNames({"code", "message", "data"})
+ public static Warning create(String code, String message, List<KeyValuePair> data){
+ return new AutoValue_Warning(code, message, data);
+ }
+
+ Warning() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
index 7097191..03e690b 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
@@ -119,7 +119,7 @@ public interface InstanceApi {
* you, and look for the status field.
*/
@Named("Instances:deleteAccessConfig")
- @DELETE
+ @POST
@Path("/{instance}/deleteAccessConfig")
Operation deleteAccessConfigFromNic(@PathParam("instance") String instance,
@QueryParam("accessConfig") String accessConfigName,
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
index a7af465..1e49f2b 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/HttpHealthCheckCreationOptions.java
@@ -34,11 +34,11 @@ public abstract class HttpHealthCheckCreationOptions {
@Nullable public abstract String description();
static final String DEFAULT_REQUEST_PATH = "/";
- static final Integer DEFAULT_PORT = 80;
- static final Integer DEFAULT_CHECK_INTERVAL_SEC = 5;
- static final Integer DEFAULT_TIMEOUT_SEC = 5;
- static final Integer DEFAULT_UNHEALTHY_THRESHOLD = 2;
- static final Integer DEFAULT_HEALTHY_THRESHOLD = 2;
+ static final int DEFAULT_PORT = 80;
+ static final int DEFAULT_CHECK_INTERVAL_SEC = 5;
+ static final int DEFAULT_TIMEOUT_SEC = 5;
+ static final int DEFAULT_UNHEALTHY_THRESHOLD = 2;
+ static final int DEFAULT_HEALTHY_THRESHOLD = 2;
/*
* Currently GCE is not setting the advertised defaults so we do so here.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
index 98f3f03..6661fcd 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/RouteOptions.java
@@ -37,6 +37,7 @@ public class RouteOptions {
private URI nextHopGateway;
private String description;
private Integer priority;
+ private URI nextHopVpnTunnel;
private ImmutableList.Builder<String> tags = ImmutableList.builder();
@@ -116,6 +117,14 @@ public class RouteOptions {
}
/**
+ * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopVpnTunnel()
+ */
+ public RouteOptions nextHopVpnTunnel(URI nextHopVpnTunnel){
+ this.nextHopVpnTunnel = nextHopVpnTunnel;
+ return this;
+ }
+
+ /**
* @see org.jclouds.googlecomputeengine.domain.Route#getNetwork()
*/
public RouteOptions network(URI network) {
@@ -176,6 +185,13 @@ public class RouteOptions {
}
/**
+ * @see org.jclouds.googlecomputeengine.domain.Route#getNextHopVpnTunnel()
+ */
+ public URI getNextHopVpnTunnel() {
+ return nextHopVpnTunnel;
+ }
+
+ /**
* @see org.jclouds.googlecomputeengine.domain.Route#getTags()
*/
public List<String> getTags() {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
index f66a141..8c90711 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiMockTest.java
@@ -98,6 +98,16 @@ public class ForwardingRuleApiMockTest extends BaseGoogleComputeEngineApiMockTes
stringFromResource("/forwardingrule_set_target.json"));
}
+ public void setTarget_partialUrl() throws Exception {
+ server.enqueue(jsonResponse("/region_operation.json"));
+
+ URI newTarget = URI.create("projects/project-id/regions/region/targetPools/target-pool");
+ assertEquals(forwardingRuleApi().setTarget("testForwardingRule", newTarget), new ParseRegionOperationTest().expected(url("/projects")));
+
+ assertSent(server, "POST", "/projects/party/regions/us-central1/forwardingRules/testForwardingRule/setTarget",
+ "{\"target\":\"projects/project-id/regions/region/targetPools/target-pool\"}");
+ }
+
ForwardingRuleApi forwardingRuleApi() {
return api().forwardingRulesInRegion("us-central1");
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
index bcff586..9add978 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiLiveTest.java
@@ -32,8 +32,10 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
import org.jclouds.googlecomputeengine.domain.Image;
import org.jclouds.googlecomputeengine.domain.Instance;
import org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
+import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig.Type;
import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
import org.jclouds.googlecomputeengine.domain.Instance.SerialPortOutput;
+import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
import org.jclouds.googlecomputeengine.domain.Metadata;
import org.jclouds.googlecomputeengine.domain.NewInstance;
import org.jclouds.googlecomputeengine.domain.AttachDisk;
@@ -123,6 +125,24 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
}
@Test(groups = "live", dependsOnMethods = "testInsertInstance")
+ public void testAddAccessConfig() {
+ AccessConfig config = AccessConfig.create("test-config", Type.ONE_TO_ONE_NAT, null);
+ assertOperationDoneSuccessfully(api().addAccessConfigToNic(INSTANCE_NAME, config, "nic0"));
+ Instance instance = api().get(INSTANCE_NAME);
+ assertNotNull(instance);
+ assertEquals(instance.networkInterfaces().get(0).accessConfigs().get(0).name(), "test-config");
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testAddAccessConfig")
+ public void testDeleteAccessConfig() {
+ Instance instance = api().get(INSTANCE_NAME);
+ assertOperationDoneSuccessfully(api().deleteAccessConfigFromNic(INSTANCE_NAME, "test-config", "nic0"));
+ instance = api().get(INSTANCE_NAME);
+ assertNotNull(instance);
+ assertTrue(instance.networkInterfaces().get(0).accessConfigs().isEmpty());
+ }
+
+ @Test(groups = "live", dependsOnMethods = "testInsertInstance")
public void testGetSerialPortOutput() {
SerialPortOutput output = api().getSerialPortOutput(INSTANCE_NAME);
assertNotNull(output);
@@ -258,7 +278,8 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
assertOperationDoneSuccessfully(api().reset(INSTANCE_NAME));
}
- @Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling", "testGetInstance", "testGetSerialPortOutput"}, alwaysRun = true)
+ @Test(groups = "live", dependsOnMethods = {"testSetDiskAutoDelete", "testResetInstance", "testSetScheduling",
+ "testGetInstance", "testGetSerialPortOutput", "testDeleteAccessConfig"}, alwaysRun = true)
public void testDeleteInstance() {
assertOperationDoneSuccessfully(api().delete(INSTANCE_NAME));
assertOperationDoneSuccessfully(diskApi().delete(DISK_NAME));
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
index 50e7426..db3f6eb 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiMockTest.java
@@ -119,7 +119,7 @@ public class InstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
assertEquals(instanceApi().deleteAccessConfigFromNic("test-instance", "test-access", "test-network"),
new ParseZoneOperationTest().expected(url("/projects")));
- assertSent(server, "DELETE", "/projects/party/zones/us-central1-a/instances/test-instance/"
+ assertSent(server, "POST", "/projects/party/zones/us-central1-a/instances/test-instance/"
+ "deleteAccessConfig?accessConfig=test-access&networkInterface=test-network");
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/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
index 687f10f..360bc2b 100644
--- 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
@@ -50,6 +50,7 @@ public class ParseHttpHealthCheckListTest extends BaseGoogleComputeEngineParseTe
"1035854271083519643", // id
URI.create(baseUrl + "/party-gce/global/httpHealthChecks/myname-andrea-kmzmi1bh-http-health-check"),
// selfLink
+ parse("2014-01-08T14:38:29.363-08:00"),
"myname-andrea-kmzmi1bh-http-health-check", // name
null, // description
null, // host
@@ -64,6 +65,7 @@ public class ParseHttpHealthCheckListTest extends BaseGoogleComputeEngineParseTe
"7006563292274658743", // id
URI.create(baseUrl + "/party-gce/global/httpHealthChecks/myname-andrea-zk7gadwq-http-health-check"),
// selfLink
+ parse("2014-01-08T14:48:03.276-08:00"), // creationTimestamp
"myname-andrea-zk7gadwq-http-health-check", // name
null, // description
null, // host
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/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
index 62138b5..2e655f7 100644
--- 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
@@ -44,15 +44,16 @@ public class ParseHttpHealthCheckTest extends BaseGoogleComputeEngineParseTest<H
return HttpHealthCheck.create( //
"2761502483700014319", // id
URI.create(baseUrl + "/party-gce/global/httpHealthChecks/http-health-check-api-live-test"), // selfLink
+ parse("2014-01-14T05:55:54.910-08:00"), // creationTimestamp
"http-health-check-api-live-test", // name
- null, // description
+ "Test Health Check", // description
null, // host
- null, // requestPath
- null, // port
- null, // checkIntervalSec
- null, // timeoutSec
- null, // unhealthyThreshold
- null // healthyThreshold
+ "/", // requestPath
+ 80, // port
+ 5, // checkIntervalSec
+ 5, // timeoutSec
+ 2, // unhealthyThreshold
+ 2 // healthyThreshold
);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
index 2e24e0c..8d138a9 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java
@@ -22,8 +22,9 @@ import java.net.URI;
import javax.ws.rs.Consumes;
+import org.jclouds.googlecomputeengine.domain.KeyValuePair;
import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.domain.Operation.Warning;
+import org.jclouds.googlecomputeengine.domain.Warning;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
@@ -68,9 +69,8 @@ public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operati
"Invalid value for field 'resource.urlMaps': "
+ "'projects/party/global/urlMaps/target-http-proxy-api-live-test-url-map-2'."
+ " Resource was not found."))), // errors
- ImmutableList.of(Warning
- .create("NO_RESULTS_ON_PAGE", "This is an example warning",
- ImmutableList.of(Warning.Entry
+ ImmutableList.of(Warning.create("NO_RESULTS_ON_PAGE", "This is an example warning",
+ ImmutableList.of(KeyValuePair
.create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))), // warnings
URI.create(baseUrl + "/party/regions/us-central1"), // region
URI.create(baseUrl + "/party/zones/us-central1-a") // zone
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
index 5aac869..e447e4e 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java
@@ -59,7 +59,8 @@ public class ParseRouteListTest extends BaseGoogleComputeEngineParseTest<ListPag
null, // nextHopIp
null, // nextHopNetwork
URI.create(baseUrl + "/party/global/gateways/default-internet-gateway"), // nextHopGateway
- null // warnings
+ null, // warnings
+ null // nextHopVpnTunnel
);
return ForwardingListPage.create( //
ImmutableList.of(route1, route2), // items
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
index 22ab3a5..4f952c1 100644
--- a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
+++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java
@@ -22,9 +22,9 @@ import java.net.URI;
import javax.ws.rs.Consumes;
-import org.jclouds.googlecomputeengine.domain.Metadata;
+import org.jclouds.googlecomputeengine.domain.KeyValuePair;
import org.jclouds.googlecomputeengine.domain.Route;
-import org.jclouds.googlecomputeengine.domain.Route.Warning;
+import org.jclouds.googlecomputeengine.domain.Warning;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test;
@@ -60,7 +60,8 @@ public class ParseRouteTest extends BaseGoogleComputeEngineParseTest<Route> {
URI.create(baseUrl + "/party/global/networks/default"), // nextHopNetwork
null, // nextHopGateway
ImmutableList.of(Warning.create("NO_RESULTS_ON_PAGE", "This is an example warning", ImmutableList.of(
- Metadata.Entry.create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))) // warnings
+ KeyValuePair.create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))), // warnings
+ null // nextHopVpnTunnel
);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/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
index efa2ee9..febd33c 100644
--- 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
@@ -44,6 +44,7 @@ public class ParseTargetPoolTest extends BaseGoogleComputeEngineParseTest<Target
return TargetPool.create( //
"5199309593612841404", // id
URI.create(baseUrl + "/party/regions/us-central1/targetPools/test-targetpool"), // selfLink
+ parse("2014-01-07T05:25:27.783-08:00"), // creationTimestamp
"test-targetpool", // name
null, // description
URI.create(baseUrl + "/party/regions/us-central1"), // region
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/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
index 37f09d8..fc3007d 100644
--- a/google-compute-engine/src/test/resources/httphealthcheck_get.json
+++ b/google-compute-engine/src/test/resources/httphealthcheck_get.json
@@ -1,7 +1,14 @@
{
- "kind": "compute#httpHealthCheck",
- "selfLink": "https://www.googleapis.com/compute/v1/projects/party-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/party-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",
+ "description": "Test Health Check",
+ "requestPath": "/",
+ "port": 80,
+ "checkIntervalSec": 5,
+ "timeoutSec": 5,
+ "unhealthyThreshold": 2,
+ "healthyThreshold": 2
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/2a724044/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
index cc74e80..45aaeb1 100644
--- a/google-compute-engine/src/test/resources/httphealthcheck_list.json
+++ b/google-compute-engine/src/test/resources/httphealthcheck_list.json
@@ -1,32 +1,39 @@
{
- "kind": "compute#httpHealthCheckList",
- "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks",
- "id": "projects/party-gce/global/httpHealthChecks",
- "items": [
- {
- "kind": "compute#httpHealthCheck",
- "selfLink": "https://www.googleapis.com/compute/v1/projects/party-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/party-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/party-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
- }
- ]
+ "kind": "compute#httpHealthCheckList",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/party-gce/global/httpHealthChecks",
+ "id": "projects/party-gce/global/httpHealthChecks",
+ "items": [
+ {
+ "kind": "compute#httpHealthCheck",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/party-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",
+ "description": "Test Health Check",
+ "requestPath": "/",
+ "port": 80,
+ "checkIntervalSec": 5,
+ "timeoutSec": 5,
+ "unhealthyThreshold": 2,
+ "healthyThreshold": 2
+ },
+ {
+ "kind": "compute#httpHealthCheck",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/party-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/party-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