http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineExpectTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineExpectTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineExpectTest.java deleted file mode 100644 index 47a4245..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineExpectTest.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 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.internal; - -import static com.google.common.base.Charsets.UTF_8; -import static com.google.common.base.Throwables.propagate; -import static com.google.common.io.BaseEncoding.base64Url; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; -import static org.easymock.EasyMock.replay; -import static org.jclouds.crypto.Pems.privateKeySpec; -import static org.jclouds.crypto.Pems.publicKeySpec; -import static org.jclouds.crypto.PemsTest.PRIVATE_KEY; -import static org.jclouds.crypto.PemsTest.PUBLIC_KEY; - -import java.io.IOException; -import java.net.URI; -import java.security.KeyFactory; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.SecureRandom; -import java.security.interfaces.RSAPublicKey; -import java.security.spec.InvalidKeySpecException; -import java.util.Properties; -import java.util.concurrent.atomic.AtomicInteger; - -import javax.ws.rs.core.MediaType; - -import org.jclouds.collect.PagedIterable; -import org.jclouds.collect.PagedIterables; -import org.jclouds.crypto.Crypto; -import org.jclouds.googlecomputeengine.domain.ListPage; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import org.jclouds.io.Payload; -import org.jclouds.oauth.v2.OAuthConstants; -import org.jclouds.oauth.v2.config.OAuthProperties; -import org.jclouds.rest.internal.BaseRestApiExpectTest; -import org.jclouds.ssh.SshKeys; -import org.jclouds.util.Strings2; - -import com.google.common.base.Joiner; -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; -import com.google.common.io.ByteSource; -import com.google.inject.Binder; -import com.google.inject.Module; -import com.google.inject.TypeLiteral; - -public class BaseGoogleComputeEngineExpectTest<T> extends BaseRestApiExpectTest<T> { - - private static final String header = "{\"alg\":\"none\",\"typ\":\"JWT\"}"; - - private static final String CLAIMS_TEMPLATE = "{" + - "\"iss\":\"myproject\"," + - "\"scope\":\"%s\"," + - "\"aud\":\"https://accounts.google.com/o/oauth2/token\"," + - "\"exp\":3600," + - "\"iat\":0}"; - - protected static final String TOKEN = "1/8xbJqaOZXSUZbHLl5EOtu1pxz3fmmetKx9W8CV4t79M"; - - protected static final HttpResponse TOKEN_RESPONSE = HttpResponse.builder().statusCode(200).payload( - payloadFromString("{\n" + - " \"access_token\" : \"" + TOKEN + "\",\n" + - " \"token_type\" : \"Bearer\",\n" + - " \"expires_in\" : 3600\n" + - "}")).build(); - - protected String openSshKey; - - - public BaseGoogleComputeEngineExpectTest() { - provider = "google-compute-engine"; - } - - @Override - protected Module createModule() { - - - return new Module() { - @Override - public void configure(Binder binder) { - // Predicatable time - binder.bind(new TypeLiteral<Supplier<Long>>() {}).toInstance(Suppliers.ofInstance(0L)); - try { - KeyFactory keyfactory = KeyFactory.getInstance("RSA"); - PrivateKey privateKey = keyfactory.generatePrivate(privateKeySpec(ByteSource.wrap( - PRIVATE_KEY.getBytes(UTF_8)))); - PublicKey publicKey = keyfactory.generatePublic(publicKeySpec(ByteSource.wrap(PUBLIC_KEY.getBytes(UTF_8)))); - KeyPair keyPair = new KeyPair(publicKey, privateKey); - openSshKey = SshKeys.encodeAsOpenSSH(RSAPublicKey.class.cast(publicKey)); - final Crypto crypto = createMock(Crypto.class); - KeyPairGenerator rsaKeyPairGenerator = createMock(KeyPairGenerator.class); - final SecureRandom secureRandom = createMock(SecureRandom.class); - expect(crypto.rsaKeyPairGenerator()).andReturn(rsaKeyPairGenerator).anyTimes(); - rsaKeyPairGenerator.initialize(2048, secureRandom); - expectLastCall().anyTimes(); - expect(rsaKeyPairGenerator.genKeyPair()).andReturn(keyPair).anyTimes(); - replay(crypto, rsaKeyPairGenerator, secureRandom); - binder.bind(Crypto.class).toInstance(crypto); - binder.bind(SecureRandom.class).toInstance(secureRandom); - } catch (NoSuchAlgorithmException e) { - propagate(e); - } catch (InvalidKeySpecException e) { - propagate(e); - } catch (IOException e) { - propagate(e); - } - // predictable node names - final AtomicInteger suffix = new AtomicInteger(); - binder.bind(new TypeLiteral<Supplier<String>>() { - }).toInstance(new Supplier<String>() { - @Override - public String get() { - return suffix.getAndIncrement() + ""; - } - }); - } - }; - } - - @Override - protected Properties setupProperties() { - Properties props = super.setupProperties(); - // use no sig algorithm for expect tests (means no credential is required either) - props.put(OAuthProperties.SIGNATURE_OR_MAC_ALGORITHM, OAuthConstants.NO_ALGORITHM); - return props; - } - - @Override - protected HttpRequestComparisonType compareHttpRequestAsType(HttpRequest input) { - HttpRequestComparisonType reqType = HttpRequestComparisonType.DEFAULT; - if (input.getPayload() != null) { - if (input.getPayload().getContentMetadata().getContentType().equals(MediaType.APPLICATION_JSON)) { - reqType = HttpRequestComparisonType.JSON; - } - } - return reqType; - } - - protected HttpRequest requestForScopes(String... scopes) { - String claims = String.format(CLAIMS_TEMPLATE, Joiner.on(",").join(scopes)); - - String payload = "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&" + - // Base64 Encoded Header - "assertion=" + base64Url().omitPadding().encode(header.getBytes(UTF_8)) + "." + - // Base64 Encoded Claims - base64Url().omitPadding().encode(claims.getBytes(UTF_8)) + "."; - - return HttpRequest.builder() - .method("POST") - .endpoint(URI.create("https://accounts.google.com/o/oauth2/token")) - .addHeader("Accept", MediaType.APPLICATION_JSON) - .payload(payloadFromStringWithContentType(payload, "application/x-www-form-urlencoded")) - .build(); - } - - /** - * Parse tests don't apply @Transform so we need to apply the transformation to PagedIterable on the result of - * expected() - */ - protected <T> PagedIterable<T> toPagedIterable(ListPage<T> list) { - return PagedIterables.of(list); - } - - protected static Payload staticPayloadFromResource(String resource) { - try { - return payloadFromString(Strings2.toStringAndClose(BaseGoogleComputeEngineExpectTest.class.getResourceAsStream - (resource))); - } catch (IOException e) { - throw propagate(e); - } - } - - -}
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineParseTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineParseTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineParseTest.java deleted file mode 100644 index aba1fc3..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineParseTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.internal; - -import org.jclouds.googlecomputeengine.config.GoogleComputeEngineParserModule; -import org.jclouds.json.BaseItemParserTest; -import org.jclouds.json.config.GsonModule; - -import com.google.inject.Guice; -import com.google.inject.Injector; - -public abstract class BaseGoogleComputeEngineParseTest<T> extends BaseItemParserTest<T> { - - @Override - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new GoogleComputeEngineParserModule()); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceContextExpectTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceContextExpectTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceContextExpectTest.java deleted file mode 100644 index 1b65fc1..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceContextExpectTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.internal; - -import java.util.Properties; - -import org.jclouds.apis.ApiMetadata; -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.googlecomputeengine.GoogleComputeEngineApiMetadata; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; - -import com.google.common.base.Function; -import com.google.inject.Module; - -public abstract class BaseGoogleComputeEngineServiceContextExpectTest<T> extends BaseGoogleComputeEngineExpectTest<T> implements - Function<ComputeServiceContext, T> { - - - @Override - public T createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) { - return apply(createComputeServiceContext(fn, module, props)); - } - - private ComputeServiceContext createComputeServiceContext(Function<HttpRequest, HttpResponse> fn, Module module, - Properties props) { - return createInjector(fn, module, props).getInstance(ComputeServiceContext.class); - } - - @Override - protected ApiMetadata createApiMetadata() { - return new GoogleComputeEngineApiMetadata(); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceExpectTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceExpectTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceExpectTest.java deleted file mode 100644 index 23fa49e..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineServiceExpectTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.internal; - -import org.jclouds.compute.ComputeService; -import org.jclouds.compute.ComputeServiceContext; - -public class BaseGoogleComputeEngineServiceExpectTest extends BaseGoogleComputeEngineServiceContextExpectTest<ComputeService> { - - @Override - public ComputeService apply(ComputeServiceContext input) { - return input.getComputeService(); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/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 deleted file mode 100644 index 8140a18..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressListTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index dd3c3ed..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseAddressTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index 4e0cd43..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskListTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index fe4c2bc..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseDiskTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index a1fc159..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallListTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index 37fc794..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseFirewallTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index 1a364f6..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageListTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index 99cfd6f..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseImageTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index ad6041b..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceListTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index f44baa1..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceSerialOutputTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index 5abdf6a..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseInstanceTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index f8146d2..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index c1f1fad..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index 877bc31..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMetadataTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index 61d56ba..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkListTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index cd0fdcf..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseNetworkTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index ec407a3..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationListTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index cb561bf..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseOperationTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index 3e549df..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseProjectTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index 894dd0e..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseQuotaTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index 8dfdea1..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionListTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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/897edde8/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 deleted file mode 100644 index fab9915..0000000 --- a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/googlecomputeengine/parse/ParseRegionTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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(); - } -}
