Repository: jclouds-labs-google Updated Branches: refs/heads/master fbf8eb244 -> d147afdc8
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewListRegionTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewListRegionTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewListRegionTest.java new file mode 100644 index 0000000..cc6cae4 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewListRegionTest.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.ListPage; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.domain.ResourceView; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseResourceViewListRegionTest extends BaseGoogleComputeEngineParseTest<ListPage<ResourceView>> { + + @Override + public String resource() { + return "/resource_view_list_region.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<ResourceView> expected() { + return ListPage.<ResourceView>builder() + .kind(Resource.Kind.RESOURCE_VIEW_LIST) + .id("") + .selfLink(URI.create("")) + .items(ImmutableSet.of( + new ParseResourceViewRegionTest().expected() + , ResourceView.builder() + .id("13050421646334304116") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306")) + .selfLink(URI.create("https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/regions/" + + "us-central1/resourceViews/jclouds-test-2")) + .name("jclouds-test-2") + .description("Simple resource view") + .addMember(URI.create("https://www.googleapis.com/compute/projects/myproject/zones/" + + "us-central1-a/instances/jclouds-test")) + .numMembers(1) + .build() + )) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewListZoneTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewListZoneTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewListZoneTest.java new file mode 100644 index 0000000..07ab864 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewListZoneTest.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.ListPage; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.domain.ResourceView; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseResourceViewListZoneTest extends BaseGoogleComputeEngineParseTest<ListPage<ResourceView>> { + + @Override + public String resource() { + return "/resource_view_list_zone.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<ResourceView> expected() { + return ListPage.<ResourceView>builder() + .kind(Resource.Kind.RESOURCE_VIEW_LIST) + .id("") + .selfLink(URI.create("")) + .items(ImmutableSet.of( + new ParseResourceViewZoneTest().expected() + , ResourceView.builder() + .id("13050421646334304116") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306")) + .selfLink(URI.create("https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/zones/" + + "us-central1-a/resourceViews/jclouds-test-2")) + .name("jclouds-test-2") + .description("Simple resource view") + .addMember(URI.create("https://www.googleapis.com/compute/projects/myproject/zones/" + + "us-central1-a/instances/jclouds-test")) + .numMembers(1) + .build() + )) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewRegionTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewRegionTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewRegionTest.java new file mode 100644 index 0000000..02e32d0 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewRegionTest.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.ResourceView; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseResourceViewRegionTest extends BaseGoogleComputeEngineParseTest<ResourceView> { + + @Override + public String resource() { + return "/resource_view_get_region.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ResourceView expected() { + return ResourceView.builder() + .id("13050421646334304115") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306")) + .selfLink(URI.create("https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/regions/" + + "us-central1/resourceViews/jclouds-test")) + .name("jclouds-test") + .description("Simple resource view") + .numMembers(0) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewResourceListTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewResourceListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewResourceListTest.java new file mode 100644 index 0000000..f4d8056 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewResourceListTest.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.googlecomputeengine.domain.ListPage; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseResourceViewResourceListTest extends BaseGoogleComputeEngineParseTest<ListPage<URI>> { + + @Override + public String resource() { + return "/resource_view_resources_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<URI> expected() { + String base = "https://googleapis.com/compute/projects/myproject/zones/us-central1-a/instances/"; + return ListPage.<URI>builder() + .kind(Resource.Kind.RESOURCE_VIEW_MEMBER_LIST) + .id("") + .selfLink(URI.create("")) + .items(ImmutableSet.<URI>of(URI.create(base + "jclouds-test-1"), + URI.create(base + "jclouds-test-2")) + ).build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewZoneTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewZoneTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewZoneTest.java new file mode 100644 index 0000000..9324a4d --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseResourceViewZoneTest.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.ResourceView; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseResourceViewZoneTest extends BaseGoogleComputeEngineParseTest<ResourceView> { + + @Override + public String resource() { + return "/resource_view_get_zone.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ResourceView expected() { + return ResourceView.builder() + .id("13050421646334304115") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306")) + .selfLink(URI.create("https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/zones/" + + "us-central1-a/resourceViews/jclouds-test")) + .name("jclouds-test") + .description("Simple resource view") + .numMembers(0) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyListTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyListTest.java new file mode 100644 index 0000000..dbd1ea6 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyListTest.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.ListPage; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.domain.TargetHttpProxy; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseTargetHttpProxyListTest extends BaseGoogleComputeEngineParseTest<ListPage<TargetHttpProxy>> { + + @Override + public String resource() { + return "/target_http_proxy_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<TargetHttpProxy> expected() { + return ListPage.<TargetHttpProxy>builder() + .kind(Resource.Kind.TARGET_HTTP_PROXY_LIST) + .id("projects/myproject/targetHttpProxies") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies")) + .items(ImmutableSet.of( + new ParseTargetHttpProxyTest().expected() + , TargetHttpProxy.builder() + .id("13050421646334304116") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test-2")) + .name("jclouds-test-2") + .description("Simple proxy") + .urlMap(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test-2")) + .build() + )) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyTest.java new file mode 100644 index 0000000..66ff65e --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseTargetHttpProxyTest.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.TargetHttpProxy; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseTargetHttpProxyTest extends BaseGoogleComputeEngineParseTest<TargetHttpProxy> { + + @Override + public String resource() { + return "/target_http_proxy_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public TargetHttpProxy expected() { + return TargetHttpProxy.builder() + .id("13050421646334304115") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test")) + .name("jclouds-test") + .urlMap(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test")) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapListTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapListTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapListTest.java new file mode 100644 index 0000000..73dd7ec --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapListTest.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.ListPage; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.domain.UrlMap; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseUrlMapListTest extends BaseGoogleComputeEngineParseTest<ListPage<UrlMap>> { + + @Override + public String resource() { + return "/url_map_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<UrlMap> expected() { + return ListPage.<UrlMap>builder() + .kind(Resource.Kind.URL_MAP_LIST) + .id("projects/myproject/global/urlMaps") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps")) + .items(ImmutableSet.of(new ParseUrlMapTest().expected(), + UrlMap.builder() + .id("13741966667737398120") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-07-23T12:39:50.022-07:00")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/global/urlMaps/jclouds-test-2")) + .name("jclouds-test-2") + .description("Basic url map") + .defaultService(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test")) + .fingerprint("EDqhvJucpz4=") + .build())) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapTest.java new file mode 100644 index 0000000..ffeccb8 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapTest.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.UrlMap; +import org.jclouds.googlecomputeengine.domain.UrlMap.HostRule; +import org.jclouds.googlecomputeengine.domain.UrlMap.PathMatcher; +import org.jclouds.googlecomputeengine.domain.UrlMap.PathRule; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseUrlMapTest extends BaseGoogleComputeEngineParseTest<UrlMap> { + + @Override + public String resource() { + return "/url_map_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public UrlMap expected() { + URI service = URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test"); + return UrlMap.builder() + .id("13741966667737398119") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2014-07-23T12:39:50.022-07:00")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test")) + .name("jclouds-test") + .description("Sample url map") + .hostRules(ImmutableSet.<HostRule>of(HostRule.builder().hosts(ImmutableSet.<String>of("jclouds-test")).pathMatcher("path").build())) + .pathMatchers(ImmutableSet.<PathMatcher>of(PathMatcher.builder().name("path") + .defaultService(service) + .pathRules(ImmutableSet.<PathRule>of(PathRule.builder().service(service) + .addPath("/") + .build())) + .build())) + .urlMapTests(ImmutableSet.<UrlMap.UrlMapTest>of(UrlMap.UrlMapTest.builder().host("jclouds-test") + .path("/test/path") + .service(service) + .build())) + .defaultService(service) + .fingerprint("EDmhvJucpz4=") + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapValidateTest.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapValidateTest.java b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapValidateTest.java new file mode 100644 index 0000000..953f448 --- /dev/null +++ b/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseUrlMapValidateTest.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.googlecomputeengine.domain.UrlMapValidateResult; +import org.jclouds.googlecomputeengine.domain.UrlMapValidateResult.TestFailure; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseUrlMapValidateTest extends BaseGoogleComputeEngineParseTest<UrlMapValidateResult> { + + @Override + public String resource() { + return "/url_map_validate.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public UrlMapValidateResult expected() { + return UrlMapValidateResult.builder() + .loadSucceeded(false) + .addLoadError("jclouds-test") + .testPassed(false) + .addTestFailure(TestFailure.builder().host("jclouds-test") + .path("/test/path") + .expectedService(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test")) + .actualService(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test-2")) + .build()) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/backend_service_get.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/backend_service_get.json b/google-compute-engine/src/test/resources/backend_service_get.json new file mode 100644 index 0000000..6551fc7 --- /dev/null +++ b/google-compute-engine/src/test/resources/backend_service_get.json @@ -0,0 +1,24 @@ +{ + "kind": "compute#backendService", + "id": "15448612110458377529", + "creationTimestamp": "2014-07-18T13:37:48.574-07:00", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test", + "name": "jclouds-test", + "description": "Backend service", + "backends": [ + { + "balancingMode": "UTILIZATION", + "capacityScaler": 1.0, + "description": "A resource view", + "group": "https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/zones/us-central1-a/resourceViews/jclouds-test", + "maxUtilization": 0.8 + } + ], + "healthChecks": [ + "https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/jclouds-test" + ], + "port": 80, + "protocol": "HTTP", + "timeoutSec": 30, + "fingerprint": "I6n5NPSXn8g=" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/backend_service_get_health.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/backend_service_get_health.json b/google-compute-engine/src/test/resources/backend_service_get_health.json new file mode 100644 index 0000000..7548971 --- /dev/null +++ b/google-compute-engine/src/test/resources/backend_service_get_health.json @@ -0,0 +1,9 @@ +{ + "kind": "compute#backendServiceGroupHealth", + "healthStatus": [ + { + "instance": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/instances/jclouds-test", + "healthState": "HEALTHY" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/backend_service_get_health_request.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/backend_service_get_health_request.json b/google-compute-engine/src/test/resources/backend_service_get_health_request.json new file mode 100644 index 0000000..d71f001 --- /dev/null +++ b/google-compute-engine/src/test/resources/backend_service_get_health_request.json @@ -0,0 +1 @@ +{"group":"https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/zones/us-central1-a/resourceViews/jclouds-test"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/backend_service_insert.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/backend_service_insert.json b/google-compute-engine/src/test/resources/backend_service_insert.json new file mode 100644 index 0000000..ce0b0c8 --- /dev/null +++ b/google-compute-engine/src/test/resources/backend_service_insert.json @@ -0,0 +1,9 @@ +{ + "name": "jclouds-test", + "healthChecks": [ + "https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/jclouds-test" + ], + "timeoutSec": 30, + "port": 80, + "protocol": "HTTP" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/backend_service_list.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/backend_service_list.json b/google-compute-engine/src/test/resources/backend_service_list.json new file mode 100644 index 0000000..d258de2 --- /dev/null +++ b/google-compute-engine/src/test/resources/backend_service_list.json @@ -0,0 +1,45 @@ +{ + "kind": "compute#backendServiceList", + "id": "projects/myproject/backendServices", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices", + "items": [ + { + "kind": "compute#backendService", + "id": "15448612110458377529", + "creationTimestamp": "2014-07-18T13:37:48.574-07:00", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test", + "name": "jclouds-test", + "description": "Backend service", + "backends": [ + { + "balancingMode": "UTILIZATION", + "capacityScaler": 1.0, + "description": "A resource view", + "group": "https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/zones/us-central1-a/resourceViews/jclouds-test", + "maxUtilization": 0.8 + } + ], + "healthChecks": [ + "https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/jclouds-test" + ], + "port": 80, + "protocol": "HTTP", + "timeoutSec": 30, + "fingerprint": "I6n5NPSXn8g=" + }, + { + "kind": "compute#backendService", + "id": "12862241067393040785", + "creationTimestamp": "2012-04-13T03:05:04.365", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test-2", + "name": "jclouds-test-2", + "description": "Backend Service 2", + "port": 80, + "healthChecks": [ + "https://www.googleapis.com/compute/v1/projects/myproject/global/httpHealthChecks/jclouds-test" + ], + "protocol": "HTTP", + "timeoutSec": 45 + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/global_forwarding_rule_get.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/global_forwarding_rule_get.json b/google-compute-engine/src/test/resources/global_forwarding_rule_get.json new file mode 100644 index 0000000..e29984d --- /dev/null +++ b/google-compute-engine/src/test/resources/global_forwarding_rule_get.json @@ -0,0 +1,12 @@ +{ + "kind": "compute#forwardingRule", + "id": "8192211304399313984", + "creationTimestamp": "2014-07-18T09:47:30.826-07:00", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/forwardingRules/jclouds-test", + "name": "jclouds-test", + "description": "tcp forwarding rule", + "IPAddress": "107.178.255.156", + "IPProtocol": "TCP", + "portRange": "80-80", + "target": "https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/global_forwarding_rule_insert.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/global_forwarding_rule_insert.json b/google-compute-engine/src/test/resources/global_forwarding_rule_insert.json new file mode 100644 index 0000000..23e6375 --- /dev/null +++ b/google-compute-engine/src/test/resources/global_forwarding_rule_insert.json @@ -0,0 +1 @@ +{"name":"jclouds-test","target":"https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test", "portRange":"80"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/global_forwarding_rule_list.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/global_forwarding_rule_list.json b/google-compute-engine/src/test/resources/global_forwarding_rule_list.json new file mode 100644 index 0000000..53f95db --- /dev/null +++ b/google-compute-engine/src/test/resources/global_forwarding_rule_list.json @@ -0,0 +1,19 @@ +{ + "kind": "compute#forwardingRuleList", + "id": "projects/myproject/global/forwardingRules", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/forwardingRules", + "items": [ + { + "kind": "compute#forwardingRule", + "id": "8192211304399313984", + "creationTimestamp": "2014-07-18T09:47:30.826-07:00", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/forwardingRules/jclouds-test", + "name": "jclouds-test", + "description": "tcp forwarding rule", + "IPAddress": "107.178.255.156", + "IPProtocol": "TCP", + "portRange": "80-80", + "target": "https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/global_forwarding_rule_setTarget.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/global_forwarding_rule_setTarget.json b/google-compute-engine/src/test/resources/global_forwarding_rule_setTarget.json new file mode 100644 index 0000000..4dba051 --- /dev/null +++ b/google-compute-engine/src/test/resources/global_forwarding_rule_setTarget.json @@ -0,0 +1,3 @@ +{ + "target": "https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test-2" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/resource_view_get_region.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/resource_view_get_region.json b/google-compute-engine/src/test/resources/resource_view_get_region.json new file mode 100644 index 0000000..264a26a --- /dev/null +++ b/google-compute-engine/src/test/resources/resource_view_get_region.json @@ -0,0 +1,9 @@ +{ + "kind": "compute#resourceView", + "id": "13050421646334304115", + "creationTime": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/regions/us-central1/resourceViews/jclouds-test", + "name": "jclouds-test", + "description": "Simple resource view", + "numMembers": 0 +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/resource_view_get_zone.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/resource_view_get_zone.json b/google-compute-engine/src/test/resources/resource_view_get_zone.json new file mode 100644 index 0000000..97f384d --- /dev/null +++ b/google-compute-engine/src/test/resources/resource_view_get_zone.json @@ -0,0 +1,9 @@ +{ + "kind": "compute#resourceView", + "id": "13050421646334304115", + "creationTime": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/zones/us-central1-a/resourceViews/jclouds-test", + "name": "jclouds-test", + "description": "Simple resource view", + "numMembers": 0 +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/resource_view_insert.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/resource_view_insert.json b/google-compute-engine/src/test/resources/resource_view_insert.json new file mode 100644 index 0000000..b49c07e --- /dev/null +++ b/google-compute-engine/src/test/resources/resource_view_insert.json @@ -0,0 +1 @@ +{"name":"jclouds-test","description":"Simple resource view"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/resource_view_list_region.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/resource_view_list_region.json b/google-compute-engine/src/test/resources/resource_view_list_region.json new file mode 100644 index 0000000..88ccb8d --- /dev/null +++ b/google-compute-engine/src/test/resources/resource_view_list_region.json @@ -0,0 +1,25 @@ +{ + "resourceViews": [ + { + "kind": "compute#resourceView", + "id": "13050421646334304115", + "creationTime": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/regions/us-central1/resourceViews/jclouds-test", + "name": "jclouds-test", + "description": "Simple resource view", + "numMembers": 0 + }, + { + "kind": "compute#resourceView", + "id": "13050421646334304116", + "creationTime": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/regions/us-central1/resourceViews/jclouds-test-2", + "name": "jclouds-test-2", + "description": "Simple resource view", + "numMembers": 1, + "members": [ + "https://www.googleapis.com/compute/projects/myproject/zones/us-central1-a/instances/jclouds-test" + ] + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/resource_view_list_zone.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/resource_view_list_zone.json b/google-compute-engine/src/test/resources/resource_view_list_zone.json new file mode 100644 index 0000000..04268cd --- /dev/null +++ b/google-compute-engine/src/test/resources/resource_view_list_zone.json @@ -0,0 +1,25 @@ +{ + "resourceViews": [ + { + "kind": "compute#resourceView", + "id": "13050421646334304115", + "creationTime": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/zones/us-central1-a/resourceViews/jclouds-test", + "name": "jclouds-test", + "description": "Simple resource view", + "numMembers": 0 + }, + { + "kind": "compute#resourceView", + "id": "13050421646334304116", + "creationTime": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/resourceviews/v1beta1/projects/myproject/zones/us-central1-a/resourceViews/jclouds-test-2", + "name": "jclouds-test-2", + "description": "Simple resource view", + "numMembers": 1, + "members": [ + "https://www.googleapis.com/compute/projects/myproject/zones/us-central1-a/instances/jclouds-test" + ] + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/resource_view_resources_list.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/resource_view_resources_list.json b/google-compute-engine/src/test/resources/resource_view_resources_list.json new file mode 100644 index 0000000..53f46f1 --- /dev/null +++ b/google-compute-engine/src/test/resources/resource_view_resources_list.json @@ -0,0 +1,6 @@ +{ + "members": [ + "https://googleapis.com/compute/projects/myproject/zones/us-central1-a/instances/jclouds-test-1", + "https://googleapis.com/compute/projects/myproject/zones/us-central1-a/instances/jclouds-test-2" + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/target_http_proxy_get.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/target_http_proxy_get.json b/google-compute-engine/src/test/resources/target_http_proxy_get.json new file mode 100644 index 0000000..45a67f7 --- /dev/null +++ b/google-compute-engine/src/test/resources/target_http_proxy_get.json @@ -0,0 +1,8 @@ +{ + "kind": "compute#targetHttpProxy", + "id": "13050421646334304115", + "creationTimestamp": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test", + "name": "jclouds-test", + "urlMap": "https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/target_http_proxy_insert.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/target_http_proxy_insert.json b/google-compute-engine/src/test/resources/target_http_proxy_insert.json new file mode 100644 index 0000000..b296e71 --- /dev/null +++ b/google-compute-engine/src/test/resources/target_http_proxy_insert.json @@ -0,0 +1 @@ +{"name":"jclouds-test","urlMap":"https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/target_http_proxy_list.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/target_http_proxy_list.json b/google-compute-engine/src/test/resources/target_http_proxy_list.json new file mode 100644 index 0000000..4c66239 --- /dev/null +++ b/google-compute-engine/src/test/resources/target_http_proxy_list.json @@ -0,0 +1,24 @@ +{ + "kind": "compute#targetHttpProxyList", + "id": "projects/myproject/targetHttpProxies", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies", + "items": [ + { + "kind": "compute#targetHttpProxy", + "id": "13050421646334304115", + "creationTimestamp": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test", + "name": "jclouds-test", + "urlMap": "https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test" + }, + { + "kind": "compute#targetHttpProxy", + "id": "13050421646334304116", + "creationTimestamp": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/targetHttpProxies/jclouds-test-2", + "name": "jclouds-test-2", + "description": "Simple proxy", + "urlMap": "https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test-2" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/target_http_proxy_set_url_map.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/target_http_proxy_set_url_map.json b/google-compute-engine/src/test/resources/target_http_proxy_set_url_map.json new file mode 100644 index 0000000..12ac072 --- /dev/null +++ b/google-compute-engine/src/test/resources/target_http_proxy_set_url_map.json @@ -0,0 +1 @@ +{"urlMap":"https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/url_map_get.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/url_map_get.json b/google-compute-engine/src/test/resources/url_map_get.json new file mode 100644 index 0000000..96ff1bc --- /dev/null +++ b/google-compute-engine/src/test/resources/url_map_get.json @@ -0,0 +1,39 @@ +{ + "kind": "compute#urlMap", + "id": "13741966667737398119", + "creationTimestamp": "2014-07-23T12:39:50.022-07:00", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test", + "name": "jclouds-test", + "description": "Sample url map", + "hostRules": [ + { + "hosts": [ + "jclouds-test" + ], + "pathMatcher": "path" + } + ], + "pathMatchers": [ + { + "name": "path", + "defaultService": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test", + "pathRules": [ + { + "service": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test", + "paths": [ + "/" + ] + } + ] + } + ], + "tests": [ + { + "host": "jclouds-test", + "path": "/test/path", + "service": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test" + } + ], + "defaultService": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test", + "fingerprint": "EDmhvJucpz4=" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/url_map_insert.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/url_map_insert.json b/google-compute-engine/src/test/resources/url_map_insert.json new file mode 100644 index 0000000..69cad5b --- /dev/null +++ b/google-compute-engine/src/test/resources/url_map_insert.json @@ -0,0 +1 @@ +{"name":"jclouds-test","description":"Sample url map","hostRules":[{"hosts":["jclouds-test"],"pathMatcher":"path"}],"pathMatchers":[{"name":"path","defaultService":"https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test","pathRules":[{"service":"https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test","paths":["/"]}]}],"tests":[{"host":"jclouds-test","path":"/test/path","service":"https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test"}],"defaultService":"https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/url_map_list.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/url_map_list.json b/google-compute-engine/src/test/resources/url_map_list.json new file mode 100644 index 0000000..9042bce --- /dev/null +++ b/google-compute-engine/src/test/resources/url_map_list.json @@ -0,0 +1,56 @@ +{ + "kind": "compute#urlMapList", + "id": "projects/myproject/global/urlMaps", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps", + "items": [ + { + "kind": "compute#urlMap", + "id": "13741966667737398119", + "creationTimestamp": "2014-07-23T12:39:50.022-07:00", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test", + "name": "jclouds-test", + "description": "Sample url map", + "hostRules": [ + { + "hosts": [ + "jclouds-test" + ], + "pathMatcher": "path" + } + ], + "pathMatchers": [ + { + "name": "path", + "defaultService": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test", + "pathRules": [ + { + "service": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test", + "paths": [ + "/" + ] + } + ] + } + ], + "tests": [ + { + "host": "jclouds-test", + "path": "/test/path", + "service": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test" + } + ], + "defaultService": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test", + "fingerprint": "EDmhvJucpz4=" + }, + { + "kind": "compute#urlMap", + "id": "13741966667737398120", + "creationTimestamp": "2014-07-23T12:39:50.022-07:00", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/urlMaps/jclouds-test-2", + "name": "jclouds-test-2", + "description": "Basic url map", + "defaultService": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test", + "fingerprint": "EDqhvJucpz4=" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/url_map_validate.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/url_map_validate.json b/google-compute-engine/src/test/resources/url_map_validate.json new file mode 100644 index 0000000..083b44e --- /dev/null +++ b/google-compute-engine/src/test/resources/url_map_validate.json @@ -0,0 +1,17 @@ +{ + "result": { + "loadSucceeded": false, + "loadErrors": [ + "jclouds-test" + ], + "testPassed": false, + "testFailures": [ + { + "host": "jclouds-test", + "path": "/test/path", + "expectedService": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test", + "actualService": "https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test-2" + } + ] + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/google-compute-engine/src/test/resources/url_map_validate_request.json ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/test/resources/url_map_validate_request.json b/google-compute-engine/src/test/resources/url_map_validate_request.json new file mode 100644 index 0000000..be963fa --- /dev/null +++ b/google-compute-engine/src/test/resources/url_map_validate_request.json @@ -0,0 +1 @@ +{"resource":{"name":"jclouds-test","description":"Sample url map","hostRules":[{"hosts":["jclouds-test"],"pathMatcher":"path"}],"pathMatchers":[{"name":"path","defaultService":"https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test","pathRules":[{"service":"https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test","paths":["/"]}]}],"tests":[{"host":"jclouds-test","path":"/test/path","service":"https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test"}],"defaultService":"https://www.googleapis.com/compute/v1/projects/myproject/global/backendServices/jclouds-test"}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/29f4013d/googlecloud/src/main/java/org/jclouds/googlecloud/internal/AdvancingIterator.java ---------------------------------------------------------------------- diff --git a/googlecloud/src/main/java/org/jclouds/googlecloud/internal/AdvancingIterator.java b/googlecloud/src/main/java/org/jclouds/googlecloud/internal/AdvancingIterator.java index 0010804..fd6b7a8 100644 --- a/googlecloud/src/main/java/org/jclouds/googlecloud/internal/AdvancingIterator.java +++ b/googlecloud/src/main/java/org/jclouds/googlecloud/internal/AdvancingIterator.java @@ -18,6 +18,8 @@ package org.jclouds.googlecloud.internal; import org.jclouds.googlecloud.domain.ListPage; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest; + import com.google.common.base.Function; import com.google.common.collect.AbstractIterator;
