http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java new file mode 100644 index 0000000..8140a18 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.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.Address; +import org.jclouds.googlecomputeengine.domain.ListPage; +import org.jclouds.googlecomputeengine.domain.Resource.Kind; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseAddressListTest extends BaseGoogleComputeEngineParseTest<ListPage<Address>> { + + @Override + public String resource() { + return "/address_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Address> expected() { + return ListPage.<Address>builder() + .kind(Kind.ADDRESS_LIST) + .id("projects/myproject/regions/us-central1/addresses") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/addresses")) + .items(ImmutableSet.of(new ParseAddressTest().expected(), + Address.builder() + .id("4881363978908129158") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T14:08:21.552-07:00")) + .status("RESERVED") + .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1")) + .name("test-ip2") + .description("") + .address("173.255.118.115") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/addresses/test-ip2")) + .build()) + ).build(); + } +}
http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java new file mode 100644 index 0000000..dd3c3ed --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.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.date.internal.SimpleDateFormatDateService; +import org.jclouds.googlecomputeengine.domain.Address; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseAddressTest extends BaseGoogleComputeEngineParseTest<Address> { + + @Override + public String resource() { + return "/address_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Address expected() { + return Address.builder() + .id("4439373783165447583") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T13:57:20.204-07:00")) + .status("RESERVED") + .region(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1")) + .name("test-ip1") + .description("") + .address("173.255.115.190") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/addresses/test-ip1")) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java new file mode 100644 index 0000000..4e0cd43 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.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.Disk; +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 ParseDiskListTest extends BaseGoogleComputeEngineParseTest<ListPage<Disk>> { + + @Override + public String resource() { + return "/disk_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Disk> expected() { + return ListPage.<Disk>builder() + .kind(Resource.Kind.DISK_LIST) + .id("projects/myproject/zones/us-central1-a/disks") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/disks")) + .items(ImmutableSet.of(Disk.builder() + .id("13050421646334304115") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/zones/us-central1-a/disks/testimage1")) + .name("testimage1") + .sizeGb(1) + .zone(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/zones/us-central1-a")) + .status("READY") + .build()) + ).build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java new file mode 100644 index 0000000..fe4c2bc --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.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.Disk; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseDiskTest extends BaseGoogleComputeEngineParseTest<Disk> { + + @Override + public String resource() { + return "/disk_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Disk expected() { + return Disk.builder() + .id("13050421646334304115") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T01:38:48.306")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/disks/testimage1")) + .name("testimage1") + .sizeGb(1) + .zone(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a")) + .status("READY") + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java new file mode 100644 index 0000000..a1fc159 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java @@ -0,0 +1,68 @@ +/* + * 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.Firewall; +import org.jclouds.googlecomputeengine.domain.ListPage; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.jclouds.net.domain.IpProtocol; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseFirewallListTest extends BaseGoogleComputeEngineParseTest<ListPage<Firewall>> { + + @Override + public String resource() { + return "/firewall_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Firewall> expected() { + return ListPage.<Firewall>builder() + .kind(Resource.Kind.FIREWALL_LIST) + .id("projects/google/firewalls") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/google/global/firewalls")) + .items(ImmutableSet.of( + new ParseFirewallTest().expected() + , Firewall.builder() + .id("12862241067393040785") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-04-13T03:05:04.365")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/google/global/firewalls/default-ssh")) + .name("default-ssh") + .description("SSH allowed from anywhere") + .network(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/google/global/networks/default")) + .addSourceRange("0.0.0.0/0") + .addAllowed(Firewall.Rule.builder() + .IpProtocol(IpProtocol.TCP) + .addPort(22).build()) + .build() + )) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java new file mode 100644 index 0000000..37fc794 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java @@ -0,0 +1,60 @@ +/* + * 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.Firewall; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.jclouds.net.domain.IpProtocol; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseFirewallTest extends BaseGoogleComputeEngineParseTest<Firewall> { + + @Override + public String resource() { + return "/firewall_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Firewall expected() { + return Firewall.builder() + .id("12862241031274216284") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-04-13T03:05:02.855")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/firewalls/jclouds-test")) + .name("jclouds-test") + .description("Internal traffic from default allowed") + .network(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/jclouds-test")) + .addSourceRange("10.0.0.0/8") + .addAllowed(Firewall.Rule.builder() + .IpProtocol(IpProtocol.TCP) + .addPortRange(1, 65535).build()) + .addAllowed(Firewall.Rule.builder() + .IpProtocol(IpProtocol.UDP) + .addPortRange(1, 65535).build()) + .addAllowed(Firewall.Rule.builder() + .IpProtocol(IpProtocol.ICMP).build()) + .build(); + + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageListTest.java new file mode 100644 index 0000000..1a364f6 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageListTest.java @@ -0,0 +1,71 @@ +/* + * 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.Deprecated; +import org.jclouds.googlecomputeengine.domain.Image; +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 ParseImageListTest extends BaseGoogleComputeEngineParseTest<ListPage<Image>> { + + @Override + public String resource() { + return "/image_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Image> expected() { + return ListPage.<Image>builder() + .kind(Resource.Kind.IMAGE_LIST) + .id("projects/centos-cloud/global/images") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images")) + .items(ImmutableSet.of(Image.builder() + .id("12941197498378735318") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-07-16T22:16:13.468")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326")) + .name("centos-6-2-v20120326") + .description("DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000") + .sourceType("RAW") + .deprecated(Deprecated.builder() + .state("DEPRECATED") + .replacement(URI.create("https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104")) + .build()) + .rawDisk( + Image.RawDisk.builder() + .source("") + .containerType("TAR") + .build() + ).build() + + )) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java new file mode 100644 index 0000000..99cfd6f --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.googlecomputeengine.parse; + +import 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.Image; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> { + + @Override + public String resource() { + return "/image_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Image expected() { + return Image.builder() + .id("12941197498378735318") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-07-16T22:16:13.468")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2" + + "-v20120326")) + .name("centos-6-2-v20120326") + .description("DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000") + .sourceType("RAW") + .rawDisk( + Image.RawDisk.builder() + .source("") + .containerType("TAR") + .build() + ).build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java new file mode 100644 index 0000000..ad6041b --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.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.googlecomputeengine.domain.Instance; +import org.jclouds.googlecomputeengine.domain.ListPage; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; + +import com.google.common.collect.ImmutableSet; + +public class ParseInstanceListTest extends BaseGoogleComputeEngineParseTest<ListPage<Instance>> { + + @Override + public String resource() { + return "/instance_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Instance> expected() { + return ListPage.<Instance>builder() + .kind(Resource.Kind.INSTANCE_LIST) + .id("projects/myproject/zones/us-central1-a/instances") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/instances")) + .items(ImmutableSet.of(new ParseInstanceTest().expected())) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java new file mode 100644 index 0000000..f44baa1 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java @@ -0,0 +1,38 @@ +/* + * 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 javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.googlecomputeengine.domain.Instance; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; + +public class ParseInstanceSerialOutputTest extends BaseGoogleComputeEngineParseTest<Instance.SerialPortOutput> { + + @Override + public String resource() { + return "/instance_serial_port.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Instance.SerialPortOutput expected() { + return Instance.SerialPortOutput.builder() + .contents("console output").build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java new file mode 100644 index 0000000..5abdf6a --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java @@ -0,0 +1,81 @@ +/* + * 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.Instance; +import org.jclouds.googlecomputeengine.domain.Metadata; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; + +import com.google.common.collect.ImmutableMap; + +public class ParseInstanceTest extends BaseGoogleComputeEngineParseTest<Instance> { + + @Override + public String resource() { + return "/instance_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Instance expected() { + return Instance.builder() + .id("13051190678907570425") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-11-25T23:48:20.758")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/zones/us-central1-a/instances/test-0")) + .description("desc") + .name("test-0") + .machineType(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/n1" + + "-standard-1")) + .status(Instance.Status.RUNNING) + .zone(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a")) + .addNetworkInterface( + Instance.NetworkInterface.builder() + .name("nic0") + .networkIP("10.240.121.115") + .network(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/global/networks/default")) + .build() + ) + .addDisk( + Instance.PersistentAttachedDisk.builder() + .index(0) + .mode(Instance.PersistentAttachedDisk.Mode.READ_WRITE) + .deviceName("test") + .source(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/zones/us-central1-a/disks/test")) + .boot(true) + .build() + ) + .tags(Instance.Tags.builder().fingerprint("abcd").addItem("aTag").build()) + .metadata(Metadata.builder() + .items(ImmutableMap.of("aKey", "aValue", + "jclouds-image", + "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718", + "jclouds-delete-boot-disk", "true")) + .fingerprint("efgh") + .build()) + .addServiceAccount(Instance.ServiceAccount.builder().email("default").addScopes("myscope").build()) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java new file mode 100644 index 0000000..f8146d2 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java @@ -0,0 +1,91 @@ +/* + * 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 static org.jclouds.googlecomputeengine.domain.Resource.Kind.MACHINE_TYPE_LIST; + +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.MachineType; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; + +public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<ListPage<MachineType>> { + + + @Override + public String resource() { + return "/machinetype_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<MachineType> expected() { + SimpleDateFormatDateService dateService = new SimpleDateFormatDateService(); + return ListPage.<MachineType>builder() + .kind(MACHINE_TYPE_LIST) + .id("projects/myproject/machineTypes") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes")) + .addItem(MachineType.builder() + .id("4618642685664990776") + .creationTimestamp(dateService.iso8601DateParse("2013-04-25T13:32:49.088-07:00")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/f1-micro")) + .zone("us-central1-a") + .name("f1-micro") + .description("1 vCPU (shared physical core) and 0.6 GB RAM") + .guestCpus(1) + .memoryMb(614) + .maximumPersistentDisks(4) + .maximumPersistentDisksSizeGb(3072) + .build()) + .addItem(MachineType.builder() + .id("12907738072351752276") + .creationTimestamp(dateService.iso8601DateParse("2012-06-07T20:48:14.670")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/n1-standard-1")) + .zone("us-central1-a") + .name("n1-standard-1") + .description("1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk") + .guestCpus(1) + .memoryMb(3840) + .maximumPersistentDisks(16) + .maximumPersistentDisksSizeGb(128) + .build()) + .addItem(MachineType.builder() + .id("12908560709887590691") + .creationTimestamp(dateService.iso8601DateParse("2012-06-07T20:51:19.936")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/n1-standard-8-d")) + .zone("us-central1-a") + .name("n1-standard-8-d") + .description("8 vCPUs, 30 GB RAM, a 10 GB ephemeral root disk, " + + "and 2 extra 1770 GB ephemeral disks") + .guestCpus(8) + .memoryMb(30720) + .addScratchDisk(1770) + .addScratchDisk(1770) + .maximumPersistentDisks(16) + .maximumPersistentDisksSizeGb(1024) + .build()) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java new file mode 100644 index 0000000..c1f1fad --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java @@ -0,0 +1,56 @@ +/* + * 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.MachineType; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; + +public class ParseMachineTypeTest extends BaseGoogleComputeEngineParseTest<MachineType> { + + + @Override + public String resource() { + return "/machinetype.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public MachineType expected() { + SimpleDateFormatDateService dateService = new SimpleDateFormatDateService(); + return MachineType.builder() + .id("12907738072351752276") + .creationTimestamp(dateService.iso8601DateParse("2012-06-07T20:48:14.670")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/n1" + + "-standard-1")) + .zone("us-central1-a") + .name("n1-standard-1") + .description("1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk") + .guestCpus(1) + .memoryMb(3840) + .addScratchDisk(1770) + .addScratchDisk(1770) + .maximumPersistentDisks(16) + .maximumPersistentDisksSizeGb(128) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMetadataTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMetadataTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMetadataTest.java new file mode 100644 index 0000000..877bc31 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMetadataTest.java @@ -0,0 +1,45 @@ +/* + * 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 javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.googlecomputeengine.domain.Metadata; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableMap; + +@Test(groups = "unit") +public class ParseMetadataTest extends BaseGoogleComputeEngineParseTest<Metadata> { + + @Override + public String resource() { + return "/metadata.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Metadata expected() { + return new Metadata("efgh", + ImmutableMap.<String, String>builder() + .put("propA", "valueA") + .put("propB", "valueB") + .build()); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java new file mode 100644 index 0000000..61d56ba --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java @@ -0,0 +1,49 @@ +/* + * 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.Network; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; + +import com.google.common.collect.ImmutableSet; + +public class ParseNetworkListTest extends BaseGoogleComputeEngineParseTest<ListPage<Network>> { + + @Override + public String resource() { + return "/network_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Network> expected() { + return ListPage.<Network>builder() + .kind(Resource.Kind.NETWORK_LIST) + .id("projects/myproject/networks") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/networks")) + .items(ImmutableSet.of(new ParseNetworkTest().expected())) + .build(); + + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java new file mode 100644 index 0000000..cd0fdcf --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.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.Network; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; + +public class ParseNetworkTest extends BaseGoogleComputeEngineParseTest<Network> { + + @Override + public String resource() { + return "/network_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Network expected() { + return Network.builder() + .id("13024414170909937976") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2012-10-24T20:13:19.967")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/networks/jclouds-test")) + .name("default") + .description("Default network for the project") + .IPv4Range("10.0.0.0/8") + .gatewayIPv4("10.0.0.1") + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationListTest.java new file mode 100644 index 0000000..ec407a3 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationListTest.java @@ -0,0 +1,46 @@ +/* + * 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.Operation; +import org.jclouds.googlecomputeengine.domain.Resource; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; + +public class ParseOperationListTest extends BaseGoogleComputeEngineParseTest<ListPage<Operation>> { + + @Override + public String resource() { + return "/global_operation_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Operation> expected() { + return ListPage.<Operation>builder() + .kind(Resource.Kind.OPERATION_LIST) + .id("projects/myproject/global/operations") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/operations")) + .addItem(new ParseOperationTest().expected()) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java new file mode 100644 index 0000000..cb561bf --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java @@ -0,0 +1,58 @@ +/* + * 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.Operation; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operation> { + + @Override + public String resource() { + return "/global_operation.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Operation expected() { + SimpleDateFormatDateService dateService = new SimpleDateFormatDateService(); + return Operation.builder().id("13053095055850848306") + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/global/operations/operation-1354084865060-4cf88735faeb8" + + "-bbbb12cb")) + .name("operation-1354084865060-4cf88735faeb8-bbbb12cb") + .targetLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/global/firewalls/jclouds-test-delete")) + .targetId("13053094017547040099") + .status(Operation.Status.DONE) + .user("[email protected]") + .progress(100) + .insertTime(dateService.iso8601DateParse("2012-11-28T06:41:05.060")) + .startTime(dateService.iso8601DateParse("2012-11-28T06:41:05.142")) + .endTime(dateService.iso8601DateParse("2012-11-28T06:41:06.142")) + .operationType("insert") + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java new file mode 100644 index 0000000..3e549df --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.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 java.util.Date; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.googlecomputeengine.domain.Metadata; +import org.jclouds.googlecomputeengine.domain.Project; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableMap; + +@Test(groups = "unit") +public class ParseProjectTest extends BaseGoogleComputeEngineParseTest<Project> { + + @Override + public String resource() { + return "/project.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Project expected() { + return Project.builder() + .id("13024414184846275913") + .creationTimestamp(new Date(Long.parseLong("1351109596252"))) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject")) + .name("myproject") + .description("") + .commonInstanceMetadata(Metadata.builder() + .items(ImmutableMap.<String, String>builder() + .put("propA", "valueA") + .put("propB", "valueB") + .build()) + .fingerprint("efgh") + .build()) + .addQuota("INSTANCES", 0, 8) + .addQuota("CPUS", 0, 8) + .addQuota("EPHEMERAL_ADDRESSES", 0, 8) + .addQuota("DISKS", 0, 8) + .addQuota("DISKS_TOTAL_GB", 0, 100) + .addQuota("SNAPSHOTS", 0, 1000) + .addQuota("NETWORKS", 1, 5) + .addQuota("FIREWALLS", 2, 100) + .addQuota("IMAGES", 0, 100) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseQuotaTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseQuotaTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseQuotaTest.java new file mode 100644 index 0000000..894dd0e --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseQuotaTest.java @@ -0,0 +1,39 @@ +/* + * 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 javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +import org.jclouds.googlecomputeengine.domain.Quota; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseQuotaTest extends BaseGoogleComputeEngineParseTest<Quota> { + + @Override + public String resource() { + return "/quota.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Quota expected() { + return Quota.builder().metric("INSTANCES").usage(0.0).limit(8.0).build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java new file mode 100644 index 0000000..8dfdea1 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java @@ -0,0 +1,72 @@ +/* + * 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.Region; +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 ParseRegionListTest extends BaseGoogleComputeEngineParseTest<ListPage<Region>> { + + @Override + public String resource() { + return "/region_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Region> expected() { + return ListPage.<Region>builder() + .kind(Resource.Kind.REGION_LIST) + .id("projects/myproject/regions") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions")) + .items(ImmutableSet.of( + new ParseRegionTest().expected(), + Region.builder() + .id("6396763663251190992") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse + ("2013-07-08T14:40:37.939-07:00")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/regions/us-central2")) + .name("us-central2") + .description("us-central2") + .status(Region.Status.UP) + .zone(URI.create("https://www.googleapis.com/compute/v1/zones/us-central2-a")) + .addQuota("INSTANCES", 0, 8) + .addQuota("CPUS", 0, 8) + .addQuota("EPHEMERAL_ADDRESSES", 0, 8) + .addQuota("DISKS", 0, 8) + .addQuota("DISKS_TOTAL_GB", 0, 100) + .addQuota("SNAPSHOTS", 0, 1000) + .addQuota("NETWORKS", 1, 5) + .addQuota("FIREWALLS", 2, 100) + .addQuota("IMAGES", 0, 100) + .build())) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java new file mode 100644 index 0000000..fab9915 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.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.Region; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseRegionTest extends BaseGoogleComputeEngineParseTest<Region> { + + @Override + public String resource() { + return "/region_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Region expected() { + return Region.builder() + .id("12912210600542709766") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2013-07-08T14:40:37.939-07:00")) + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1")) + .name("us-central1") + .description("us-central1") + .status(Region.Status.UP) + .zones(ImmutableSet.of(URI.create("https://www.googleapis.com/compute/v1/zones/us-central1-a"), + URI.create("https://www.googleapis.com/compute/v1/zones/us-central1-b"))) + .addQuota("INSTANCES", 0, 8) + .addQuota("CPUS", 0, 8) + .addQuota("EPHEMERAL_ADDRESSES", 0, 8) + .addQuota("DISKS", 0, 8) + .addQuota("DISKS_TOTAL_GB", 0, 100) + .addQuota("SNAPSHOTS", 0, 1000) + .addQuota("NETWORKS", 1, 5) + .addQuota("FIREWALLS", 2, 100) + .addQuota("IMAGES", 0, 100) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.java new file mode 100644 index 0000000..3a378aa --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteListTest.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.Kind; +import org.jclouds.googlecomputeengine.domain.Route; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseRouteListTest extends BaseGoogleComputeEngineParseTest<ListPage<Route>> { + + @Override + public String resource() { + return "/route_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Route> expected() { + return ListPage.<Route>builder() + .kind(Kind.ROUTE_LIST) + .id("projects/myproject/global/routes") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/routes")) + .items(ImmutableSet.of(new ParseRouteTest().expected(), + Route.builder() + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/routes/default-route-fc92a41ecb5a8d17")) + .id("507025480040058551") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2013-07-08T14:40:38.502-07:00")) + .name("default-route-fc92a41ecb5a8d17") + .description("Default route to the Internet.") + .network(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default")) + .destRange("0.0.0.0/0") + .priority(1000) + .nextHopGateway(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/gateways/default-internet-gateway")) + .build()) + ).build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java new file mode 100644 index 0000000..5ffd845 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRouteTest.java @@ -0,0 +1,56 @@ +/* + * 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.Route; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseRouteTest extends BaseGoogleComputeEngineParseTest<Route> { + + @Override + public String resource() { + return "/route_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Route expected() { + return Route.builder() + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/routes/default-route-c99ebfbed0e1f375")) + .id("7241926205630356071") + .name("default-route-c99ebfbed0e1f375") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2013-07-08T14:40:38.502-07:00")) + .description("Default route to the virtual network.") + .network(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default")) + .destRange("10.240.0.0/16") + .priority(1000) + .nextHopNetwork(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default")) + .tags(ImmutableSet.of("fooTag", "barTag")) + .build(); + + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.java new file mode 100644 index 0000000..f52aa3f --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotListTest.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.Kind; +import org.jclouds.googlecomputeengine.domain.Snapshot; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseSnapshotListTest extends BaseGoogleComputeEngineParseTest<ListPage<Snapshot>> { + + @Override + public String resource() { + return "/snapshot_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Snapshot> expected() { + return ListPage.<Snapshot>builder() + .kind(Kind.SNAPSHOT_LIST) + .id("projects/myproject/global/snapshots") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/snapshots")) + .items(ImmutableSet.of( + new ParseSnapshotTest().expected(), Snapshot.builder() + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/global/snapshots/test-snap2")) + .id("13895715048576107883") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse + ("2013-07-26T12:57:01.927-07:00")) + .status("READY") + .sizeGb(10) + .sourceDisk(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/disks/testimage1")) + .name("test-snap2") + .description("") + .sourceDiskId("8243603669926824540") + .build())) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java new file mode 100644 index 0000000..f3e7a01 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseSnapshotTest.java @@ -0,0 +1,52 @@ +/* + * 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.Snapshot; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +@Test(groups = "unit") +public class ParseSnapshotTest extends BaseGoogleComputeEngineParseTest<Snapshot> { + + @Override + public String resource() { + return "/snapshot_get.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Snapshot expected() { + return Snapshot.builder() + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/snapshots/test-snap")) + .id("9734455566806191190") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse("2013-07-26T12:54:23.173-07:00")) + .status("READY") + .sizeGb(10) + .sourceDisk(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/disks/testimage1")) + .name("test-snap") + .description("") + .sourceDiskId("8243603669926824540") + .build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/3ddce9df/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java new file mode 100644 index 0000000..54fe1a2 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseZoneListTest.java @@ -0,0 +1,70 @@ +/* + * 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.Zone; +import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +@Test(groups = "unit") +public class ParseZoneListTest extends BaseGoogleComputeEngineParseTest<ListPage<Zone>> { + + @Override + public String resource() { + return "/zone_list.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public ListPage<Zone> expected() { + return ListPage.<Zone>builder() + .kind(Resource.Kind.ZONE_LIST) + .id("projects/myproject/zones") + .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones")) + .items(ImmutableSet.of( + new ParseZoneTest().expected() + , Zone.builder() + .id("13024414164050619686") + .creationTimestamp(new SimpleDateFormatDateService().iso8601DateParse + ("2012-10-24T20:13:19.271")) + .selfLink(URI.create("https://www.googleapis" + + ".com/compute/v1/projects/myproject/zones/us-central1-b")) + .name("us-central1-b") + .description("us-central1-b") + .status(Zone.Status.UP) + .addMaintenanceWindow(Zone.MaintenanceWindow.builder() + .name("2013-02-17-planned-outage") + .description("maintenance zone") + .beginTime(new SimpleDateFormatDateService().iso8601DateParse + ("2013-02-17T08:00:00.000")) + .endTime(new SimpleDateFormatDateService().iso8601DateParse + ("2013-03-03T08:00:00.000")) + .build()) + .build())) + .build(); + } +}
