http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/features/OAuthApiLiveTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/features/OAuthApiLiveTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/features/OAuthApiLiveTest.java new file mode 100644 index 0000000..4ac5950 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/features/OAuthApiLiveTest.java @@ -0,0 +1,80 @@ +/* + * 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.oauth.v2.features; + +import static com.google.common.base.Preconditions.checkState; +import static org.jclouds.oauth.v2.OAuthTestUtils.getMandatoryProperty; +import static org.jclouds.oauth.v2.config.OAuthProperties.AUDIENCE; +import static org.jclouds.oauth.v2.config.OAuthProperties.SCOPES; +import static org.jclouds.oauth.v2.config.OAuthProperties.SIGNATURE_OR_MAC_ALGORITHM; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + +import java.util.Properties; + +import org.jclouds.oauth.v2.OAuthConstants; +import org.jclouds.oauth.v2.domain.ClaimSet; +import org.jclouds.oauth.v2.domain.Header; +import org.jclouds.oauth.v2.domain.Token; +import org.jclouds.oauth.v2.domain.TokenRequest; +import org.jclouds.oauth.v2.internal.BaseOAuthApiLiveTest; +import org.testng.annotations.Test; + +/** + * A live test for authentication. Requires the following properties to be set: + * - test.oauth.endpoint + * - test.oauth.identity + * - test.oauth.credential + * - test.jclouds.oauth.audience + * - test.jclouds.oauth.scopes + * - test.jclouds.oauth.signature-or-mac-algorithm + */ +@Test(groups = "live", singleThreaded = true) +public class OAuthApiLiveTest extends BaseOAuthApiLiveTest { + + private Properties properties; + + @Override + protected Properties setupProperties() { + properties = super.setupProperties(); + return properties; + + } + + @Test(groups = "live", singleThreaded = true) + public void testAuthenticateJWTToken() throws Exception { + assertTrue(properties != null, "properties were not set"); + String signatureAlgorithm = getMandatoryProperty(properties, SIGNATURE_OR_MAC_ALGORITHM); + checkState(OAuthConstants.OAUTH_ALGORITHM_NAMES_TO_SIGNATURE_ALGORITHM_NAMES.containsKey(signatureAlgorithm) + , String.format("Algorithm not supported: " + signatureAlgorithm)); + + Header header = Header.builder().signerAlgorithm(signatureAlgorithm).type("JWT").build(); + + String scopes = getMandatoryProperty(properties, SCOPES); + String audience = getMandatoryProperty(properties, AUDIENCE); + + long now = nowInSeconds(); + + ClaimSet claimSet = ClaimSet.builder().addClaim("aud", audience).addClaim("scope", scopes).addClaim("iss", + identity).emissionTime(now).expirationTime(now + 3600).build(); + + TokenRequest tokenRequest = TokenRequest.builder().header(header).claimSet(claimSet).build(); + Token token = api.authenticate(tokenRequest); + + assertNotNull(token, "no token when authenticating " + tokenRequest); + } +}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/OAuthCredentialsFromPKTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/OAuthCredentialsFromPKTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/OAuthCredentialsFromPKTest.java new file mode 100644 index 0000000..e3794d6 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/OAuthCredentialsFromPKTest.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.oauth.v2.functions; + +import static com.google.common.base.Suppliers.ofInstance; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + +import java.io.File; +import java.io.IOException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.spec.InvalidKeySpecException; + +import com.google.common.base.Charsets; +import com.google.common.io.Files; + +import org.jclouds.domain.Credentials; +import org.jclouds.oauth.v2.domain.OAuthCredentials; +import org.jclouds.oauth.v2.functions.OAuthCredentialsSupplier.OAuthCredentialsForCredentials; +import org.testng.annotations.Test; + +/** + * Test loading the credentials by extracting a pk from a PKCS12 keystore. + */ +@Test(groups = "unit") +public class OAuthCredentialsFromPKTest { + + public static OAuthCredentials loadOAuthCredentials() throws IOException, NoSuchAlgorithmException, + CertificateException, InvalidKeySpecException { + OAuthCredentialsSupplier loader = new OAuthCredentialsSupplier(ofInstance(new Credentials("foo", + Files.asCharSource(new File("src/test/resources/testpk.pem"), Charsets.UTF_8).read())), + new OAuthCredentialsForCredentials("RS256"), "RS256"); + return loader.get(); + } + + + public void testLoadPKString() throws IOException, NoSuchAlgorithmException, KeyStoreException, + CertificateException, UnrecoverableKeyException, InvalidKeySpecException { + OAuthCredentials creds = loadOAuthCredentials(); + assertNotNull(creds); + assertEquals(creds.identity, "foo"); + assertNotNull(creds.privateKey); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/OAuthCredentialsSupplierTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/OAuthCredentialsSupplierTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/OAuthCredentialsSupplierTest.java new file mode 100644 index 0000000..2b3d094 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/OAuthCredentialsSupplierTest.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.oauth.v2.functions; + +import com.google.common.base.Suppliers; +import org.jclouds.domain.Credentials; +import org.jclouds.oauth.v2.OAuthTestUtils; +import org.jclouds.rest.AuthorizationException; +import org.testng.annotations.Test; + +import java.util.Properties; + +import static org.jclouds.oauth.v2.functions.OAuthCredentialsSupplier.OAuthCredentialsForCredentials; +import static org.testng.Assert.assertNotNull; + +@Test(groups = "unit") +public class OAuthCredentialsSupplierTest { + + @Test(expectedExceptions = AuthorizationException.class) + public void testAuthorizationExceptionIsThrownOnBadKeys() { + OAuthCredentialsSupplier supplier = new OAuthCredentialsSupplier(Suppliers.ofInstance(new Credentials("MOMMA", + "MIA")), new OAuthCredentialsForCredentials("RS256"), "RS256"); + supplier.get(); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGSEChildExceptionsPropagateAsAuthorizationException() { + OAuthCredentialsSupplier supplier = new OAuthCredentialsSupplier(Suppliers.ofInstance(new Credentials("MOMMA", + "MIA")), new OAuthCredentialsForCredentials("MOMMA"), "MOMMA"); + supplier.get(); + } + + public void testCredentialsAreLoadedOnRightAlgoAndCredentials() { + Properties propertied = OAuthTestUtils.defaultProperties(new Properties()); + Credentials validCredentials = new Credentials(propertied.getProperty("oauth.identity"), + propertied.getProperty("oauth.credential")); + OAuthCredentialsSupplier supplier = new OAuthCredentialsSupplier(Suppliers.ofInstance(validCredentials), + new OAuthCredentialsForCredentials("RS256"), "RS256"); + assertNotNull(supplier.get()); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/SignerFunctionTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/SignerFunctionTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/SignerFunctionTest.java new file mode 100644 index 0000000..2a64822 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/functions/SignerFunctionTest.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.oauth.v2.functions; +import static com.google.common.base.Charsets.UTF_8; +import static com.google.common.base.Suppliers.ofInstance; +import static com.google.common.io.BaseEncoding.base64Url; +import static org.testng.Assert.assertNotNull; +import static org.testng.AssertJUnit.assertEquals; + +import java.io.IOException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.spec.InvalidKeySpecException; + +import org.testng.annotations.Test; + +/** + * Tests the SignOrProduceMacForToken + */ +@Test(groups = "unit") +public class SignerFunctionTest { + + private static final String PAYLOAD = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.\n" + + "eyJpc3MiOiI3NjEzMjY3OTgwNjktcjVtbGpsbG4xcmQ0bHJiaGc3NWVmZ2lncDM2bTc4ajVAZ" + + "GV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJzY29wZSI6Imh0dHBzOi8vd3d3Lmdvb2ds" + + "ZWFwaXMuY29tL2F1dGgvcHJlZGljdGlvbiIsImF1ZCI6Imh0dHBzOi8vYWNjb3VudHMuZ29vZ2x" + + "lLmNvbS9vL29hdXRoMi90b2tlbiIsImV4cCI6MTMyODU1NDM4NSwiaWF0IjoxMzI4NTUwNzg1fQ"; + + private static final String SHA256withRSA_PAYLOAD_SIGNATURE_RESULT = + "bmQrCv4gjkLWDK1JNJni74_kPiSDUMF_FImgqKJMUIgkDX1m2Sg3bH1yjF-cjBN7CvfAscnageo" + + "GtL2TGbwoTjJgUO5Yy0esavUUF-mBQHQtSw-2nL-9TNyM4SNi6fHPbgr83GGKOgA86r" + + "I9-nj3oUGd1fQty2k4Lsd-Zdkz6es"; + + + public void testSignPayload() throws InvalidKeyException, IOException, NoSuchAlgorithmException, + CertificateException, InvalidKeySpecException { + SignOrProduceMacForToken signer = new SignOrProduceMacForToken("RS256", + ofInstance(OAuthCredentialsFromPKTest + .loadOAuthCredentials())); + signer.loadSignatureOrMacOrNone(); + byte[] payloadSignature = signer.apply(PAYLOAD.getBytes(UTF_8)); + assertNotNull(payloadSignature); + + assertEquals(base64Url().omitPadding().encode(payloadSignature), SHA256withRSA_PAYLOAD_SIGNATURE_RESULT); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/handlers/OAuthErrorHandlerTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/handlers/OAuthErrorHandlerTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/handlers/OAuthErrorHandlerTest.java new file mode 100644 index 0000000..255c5c7 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/handlers/OAuthErrorHandlerTest.java @@ -0,0 +1,92 @@ +/* + * 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.oauth.v2.handlers; + +import org.easymock.IArgumentMatcher; +import org.jclouds.http.HttpCommand; +import org.jclouds.http.HttpRequest; +import org.jclouds.http.HttpResponse; +import org.testng.annotations.Test; + +import java.net.URI; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.reportMatcher; +import static org.easymock.EasyMock.verify; + +@Test(groups = "unit") +public class OAuthErrorHandlerTest { + + @Test + public void test409MakesIllegalStateException() { + assertCodeMakes( + "POST", + URI.create("http://oauth.org"), + 409, + "HTTP/1.1 409 Conflict", + "\"{\"code\":\"InvalidState\",\"message\":\"An incompatible transition has already been queued for this" + + " resource\"}\"", + IllegalStateException.class); + } + + private void assertCodeMakes(String method, URI uri, int statusCode, String message, String content, + Class<? extends Exception> expected) { + assertCodeMakes(method, uri, statusCode, message, "application/json", content, expected); + } + + private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType, + String content, Class<? extends Exception> expected) { + + OAuthErrorHandler function = new OAuthErrorHandler(); + + HttpCommand command = createMock(HttpCommand.class); + HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build(); + HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); + response.getPayload().getContentMetadata().setContentType(contentType); + + expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); + command.setException(classEq(expected)); + + replay(command); + + function.handleError(command, response); + + verify(command); + } + + public static Exception classEq(final Class<? extends Exception> in) { + reportMatcher(new IArgumentMatcher() { + + @Override + public void appendTo(StringBuffer buffer) { + buffer.append("classEq("); + buffer.append(in); + buffer.append(")"); + } + + @Override + public boolean matches(Object arg) { + return arg.getClass() == in; + } + + }); + return null; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/Base64UrlSafeTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/Base64UrlSafeTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/Base64UrlSafeTest.java new file mode 100644 index 0000000..f6d938a --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/Base64UrlSafeTest.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.oauth.v2.internal; + +import static com.google.common.base.Charsets.UTF_8; +import static com.google.common.io.BaseEncoding.base64Url; +import static org.testng.Assert.assertTrue; + +import org.testng.annotations.Test; + +/** + * Tests that the Base64 implementations used to Base64 encode the tokens are Url safe. + */ +@Test(groups = "unit") +public class Base64UrlSafeTest { + + public static final String STRING_THAT_GENERATES_URL_UNSAFE_BASE64_ENCODING = "§1234567890'+±!\"#$%&/()" + + "=?*qwertyuiopº´WERTYUIOPªà sdfghjklç~ASDFGHJKLÃ^<zxcvbnm,.->ZXCVBNM;:_@â¬"; + + public void testUsedBase64IsUrlSafe() { + String encoded = base64Url().omitPadding().encode(STRING_THAT_GENERATES_URL_UNSAFE_BASE64_ENCODING.getBytes(UTF_8)); + assertTrue(!encoded.contains("+")); + assertTrue(!encoded.contains("/")); + assertTrue(!encoded.endsWith("=")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthApiExpectTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthApiExpectTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthApiExpectTest.java new file mode 100644 index 0000000..a44bad1 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthApiExpectTest.java @@ -0,0 +1,23 @@ +/* + * 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.oauth.v2.internal; + +import org.jclouds.oauth.v2.OAuthApi; + +public class BaseOAuthApiExpectTest extends BaseOAuthExpectTest<OAuthApi> { + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthApiLiveTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthApiLiveTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthApiLiveTest.java new file mode 100644 index 0000000..ba1c616 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthApiLiveTest.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.oauth.v2.internal; + +import static com.google.common.base.Preconditions.checkNotNull; +import static org.jclouds.oauth.v2.OAuthTestUtils.setCredential; +import static org.jclouds.oauth.v2.config.OAuthProperties.AUDIENCE; +import static org.jclouds.oauth.v2.config.OAuthProperties.SCOPES; +import static org.jclouds.oauth.v2.config.OAuthProperties.SIGNATURE_OR_MAC_ALGORITHM; + +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +import org.jclouds.apis.BaseApiLiveTest; +import org.jclouds.oauth.v2.OAuthApi; +import org.testng.annotations.Test; + + +@Test(groups = "live") +public class BaseOAuthApiLiveTest extends BaseApiLiveTest<OAuthApi> { + + public BaseOAuthApiLiveTest() { + provider = "oauth"; + } + + @Override + protected Properties setupProperties() { + Properties props = super.setupProperties(); + setCredential(props, "oauth.credential"); + checkNotNull(setIfTestSystemPropertyPresent(props, "oauth.endpoint"), "test.oauth.endpoint must be set"); + checkNotNull(setIfTestSystemPropertyPresent(props, AUDIENCE), "test.jclouds.oauth.audience must be set"); + setIfTestSystemPropertyPresent(props, SCOPES); + setIfTestSystemPropertyPresent(props, SIGNATURE_OR_MAC_ALGORITHM); + return props; + } + + protected long nowInSeconds() { + return TimeUnit.SECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS); + } + +} + http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthAuthenticatedApiLiveTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthAuthenticatedApiLiveTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthAuthenticatedApiLiveTest.java new file mode 100644 index 0000000..aefdcdd --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthAuthenticatedApiLiveTest.java @@ -0,0 +1,110 @@ +/* + * 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.oauth.v2.internal; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.jclouds.oauth.v2.config.OAuthProperties.AUDIENCE; +import static org.jclouds.oauth.v2.config.OAuthProperties.SIGNATURE_OR_MAC_ALGORITHM; +import static org.testng.Assert.assertNotNull; + +import java.io.Closeable; +import java.util.Properties; + +import org.jclouds.apis.BaseApiLiveTest; +import org.jclouds.config.ValueOfConfigurationKeyOrNull; +import org.jclouds.oauth.v2.OAuthApi; +import org.jclouds.oauth.v2.OAuthConstants; +import org.jclouds.oauth.v2.domain.ClaimSet; +import org.jclouds.oauth.v2.domain.Header; +import org.jclouds.oauth.v2.domain.Token; +import org.jclouds.oauth.v2.domain.TokenRequest; +import org.testng.annotations.Test; + +import com.google.common.base.Function; +import com.google.common.reflect.TypeToken; +import com.google.inject.Injector; +import com.google.inject.Key; +import com.google.inject.Module; + +/** + * A base test of oauth authenticated rest providers. Providers must set the following properties: + * <p/> + * - oauth.endpoint + * - oauth.audience + * - oauth.signature-or-mac-algorithm + * <p/> + * - oauth.scopes is provided by the subclass + * <p/> + * This test asserts that a provider can authenticate with oauth for a given scope, or more simply + * that authentication/authorization is working. + */ + +@Test(groups = "live") +public abstract class BaseOAuthAuthenticatedApiLiveTest<A extends Closeable> extends BaseApiLiveTest<A> { + + protected abstract String getScopes(); + + private OAuthApi oauthApi; + + public void testAuthenticate() { + // obtain the necessary properties from the context + String signatureAlgorithm = checkNotNull(propFunction.apply(SIGNATURE_OR_MAC_ALGORITHM), + SIGNATURE_OR_MAC_ALGORITHM); + + checkState(OAuthConstants.OAUTH_ALGORITHM_NAMES_TO_SIGNATURE_ALGORITHM_NAMES.containsKey(signatureAlgorithm) + , String.format("Algorithm not supported: " + signatureAlgorithm)); + + String audience = checkNotNull(propFunction.apply(AUDIENCE), AUDIENCE); + + // obtain the scopes from the subclass + String scopes = getScopes(); + + Header header = Header.builder().signerAlgorithm(signatureAlgorithm).type("JWT").build(); + + long now = SECONDS.convert(System.currentTimeMillis(), MILLISECONDS); + + ClaimSet claimSet = ClaimSet.builder() + .addClaim("aud", audience) + .addClaim("scope", scopes) + .addClaim("iss", identity) + .emissionTime(now) + .expirationTime(now + 3600).build(); + + TokenRequest tokenRequest = TokenRequest.builder().header(header).claimSet(claimSet).build(); + + Token token = oauthApi.authenticate(tokenRequest); + + assertNotNull(token, "no token when authenticating " + tokenRequest); + } + + @SuppressWarnings({ "unchecked", "serial" }) + protected A create(Properties props, Iterable<Module> modules) { + Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); + propFunction = injector.getInstance(ValueOfConfigurationKeyOrNull.class); + try { + oauthApi = injector.getInstance(OAuthApi.class); + } catch (Exception e) { + throw new IllegalStateException("Provider has no OAuthApi bound. Was the OAuthAuthenticationModule added?"); + } + return (A) injector.getInstance(Key.get(new TypeToken<A>(getClass()) { + }.getType())); + } + + private Function<String, String> propFunction; +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthExpectTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthExpectTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthExpectTest.java new file mode 100644 index 0000000..18fe151 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthExpectTest.java @@ -0,0 +1,26 @@ +/* + * 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.oauth.v2.internal; + +import org.jclouds.rest.internal.BaseRestApiExpectTest; + +public class BaseOAuthExpectTest<T> extends BaseRestApiExpectTest<T> { + + public BaseOAuthExpectTest() { + provider = "oauth"; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/json/JWTTokenRequestFormatTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/json/JWTTokenRequestFormatTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/json/JWTTokenRequestFormatTest.java new file mode 100644 index 0000000..fa3307f --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/json/JWTTokenRequestFormatTest.java @@ -0,0 +1,69 @@ +/* + * 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.oauth.v2.json; + +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertSame; +import static org.testng.Assert.assertTrue; + +import java.io.IOException; + +import org.jclouds.ContextBuilder; +import org.jclouds.http.HttpRequest; +import org.jclouds.oauth.v2.OAuthApiMetadata; +import org.jclouds.oauth.v2.OAuthTestUtils; +import org.jclouds.oauth.v2.domain.ClaimSet; +import org.jclouds.oauth.v2.domain.Header; +import org.jclouds.oauth.v2.domain.TokenRequest; +import org.jclouds.oauth.v2.domain.TokenRequestFormat; +import org.jclouds.util.Strings2; +import org.testng.annotations.Test; + +import com.google.common.base.Splitter; +import com.google.common.collect.Iterables; + +@Test(groups = "unit") +public class JWTTokenRequestFormatTest { + public static final String STRING_THAT_GENERATES_URL_UNSAFE_BASE64_ENCODING = "§1234567890'+±!\"#$%&/()" + + "=?*qwertyuiopº´WERTYUIOPªà sdfghjklç~ASDFGHJKLÃ^<zxcvbnm," + + ".->ZXCVBNM;:_@â¬"; + + public void testPayloadIsUrlSafe() throws IOException { + + TokenRequestFormat tokenRequestFormat = ContextBuilder.newBuilder(new OAuthApiMetadata()).overrides + (OAuthTestUtils.defaultProperties(null)).build().utils() + .injector().getInstance(TokenRequestFormat.class); + Header header = new Header.Builder().signerAlgorithm("a").type("b").build(); + ClaimSet claimSet = new ClaimSet.Builder().addClaim("ist", STRING_THAT_GENERATES_URL_UNSAFE_BASE64_ENCODING) + .build(); + TokenRequest tokenRequest = new TokenRequest.Builder().claimSet(claimSet).header(header).build(); + HttpRequest request = tokenRequestFormat.formatRequest(HttpRequest.builder().method("GET").endpoint + ("http://localhost").build(), tokenRequest); + + assertNotNull(request.getPayload()); + + String payload = Strings2.toStringAndClose(request.getPayload().getInput()); + + // make sure the paylod is in the format {header}.{claims}.{signature} + Iterable<String> parts = Splitter.on(".").split(payload); + + assertSame(Iterables.size(parts), 3); + + assertTrue(!payload.contains("+")); + assertTrue(!payload.contains("/")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/parse/ParseTokenTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/parse/ParseTokenTest.java b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/parse/ParseTokenTest.java new file mode 100644 index 0000000..bcaa9e4 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/java/org/jclouds/oauth/v2/parse/ParseTokenTest.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.oauth.v2.parse; + +import org.jclouds.json.BaseItemParserTest; +import org.jclouds.oauth.v2.domain.Token; +import org.testng.annotations.Test; + +import javax.ws.rs.Consumes; +import javax.ws.rs.core.MediaType; + +@Test(groups = "unit") +public class ParseTokenTest extends BaseItemParserTest<Token> { + + @Override + public String resource() { + return "/tokenResponse.json"; + } + + @Override + @Consumes(MediaType.APPLICATION_JSON) + public Token expected() { + return Token.builder().expiresIn(3600).tokenType("Bearer").accessToken + ("1/8xbJqaOZXSUZbHLl5EOtu1pxz3fmmetKx9W8CV4t79M").build(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json new file mode 100644 index 0000000..c965349 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json @@ -0,0 +1,37 @@ +{ + "kind": "compute#firewallList", + "id": "projects/google/firewalls", + "selfLink": "https://www.googleapis.com/compute/v1/projects/google/global/firewalls", + "items": [ + { + + "kind": "compute#firewall", + "id": "12862241031274216284", + "creationTimestamp": "2012-04-13T03:05:02.855", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/firewalls/jclouds-test-delete", + "name": "jclouds-test-delete", + "description": "Internal traffic from default allowed", + "network": "https://www.googleapis.com/compute/v1/projects/myproject/global/networks/jclouds-test-delete", + "sourceRanges": [ + "10.0.0.0/8" + ], + "allowed": [ + { + "IPProtocol": "tcp", + "ports": [ + "1-65535" + ] + }, + { + "IPProtocol": "udp", + "ports": [ + "1-65535" + ] + }, + { + "IPProtocol": "icmp" + } + ] + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/GoogleComputeEngineServiceExpectTest/network_get.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/GoogleComputeEngineServiceExpectTest/network_get.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/GoogleComputeEngineServiceExpectTest/network_get.json new file mode 100644 index 0000000..e9308f0 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/GoogleComputeEngineServiceExpectTest/network_get.json @@ -0,0 +1,10 @@ +{ + "kind": "compute#network", + "id": "13024414170909937976", + "creationTimestamp": "2012-10-24T20:13:19.967", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/networks/jclouds-test-delete", + "name": "jclouds-test-delete", + "description": "Default network for the project", + "IPv4Range": "10.0.0.0/8", + "gatewayIPv4": "10.0.0.1" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_get.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_get.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_get.json new file mode 100644 index 0000000..f93e497 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_get.json @@ -0,0 +1,12 @@ +{ + + "kind": "compute#address", + "id": "4439373783165447583", + "creationTimestamp": "2013-07-26T13:57:20.204-07:00", + "status": "RESERVED", + "region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1", + "name": "test-ip1", + "description": "", + "address": "173.255.115.190", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/addresses/test-ip1" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_insert.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_insert.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_insert.json new file mode 100644 index 0000000..4bccf63 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_insert.json @@ -0,0 +1 @@ +{"name":"test-ip1"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_list.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_list.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_list.json new file mode 100644 index 0000000..cbfa9d5 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/address_list.json @@ -0,0 +1,31 @@ +{ + "kind": "compute#addressList", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/addresses", + "id": "projects/myproject/regions/us-central1/addresses", + "items": [ + { + + "kind": "compute#address", + "id": "4439373783165447583", + "creationTimestamp": "2013-07-26T13:57:20.204-07:00", + "status": "RESERVED", + "region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1", + "name": "test-ip1", + "description": "", + "address": "173.255.115.190", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/addresses/test-ip1" + }, + { + + "kind": "compute#address", + "id": "4881363978908129158", + "creationTimestamp": "2013-07-26T14:08:21.552-07:00", + "status": "RESERVED", + "region": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1", + "name": "test-ip2", + "description": "", + "address": "173.255.118.115", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/regions/us-central1/addresses/test-ip2" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_create_snapshot.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_create_snapshot.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_create_snapshot.json new file mode 100644 index 0000000..6499744 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_create_snapshot.json @@ -0,0 +1 @@ +{"name":"test-snap"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_get.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_get.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_get.json new file mode 100644 index 0000000..88ddd54 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_get.json @@ -0,0 +1,10 @@ +{ + "kind": "compute#disk", + "id": "13050421646334304115", + "creationTimestamp": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/disks/testimage1", + "name": "testimage1", + "sizeGb": "1", + "zone": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a", + "status": "READY" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_insert.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_insert.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_insert.json new file mode 100644 index 0000000..8699cdd --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_insert.json @@ -0,0 +1 @@ +{"name":"testimage1","sizeGb":1} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_list.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_list.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_list.json new file mode 100644 index 0000000..bdca33d --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/disk_list.json @@ -0,0 +1,17 @@ +{ + "kind": "compute#diskList", + "id": "projects/myproject/zones/us-central1-a/disks", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/disks", + "items": [ + { + "kind": "compute#disk", + "id": "13050421646334304115", + "creationTimestamp": "2012-11-25T01:38:48.306", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/disks/testimage1", + "name": "testimage1", + "sizeGb": "1", + "zone": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a", + "status": "READY" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_get.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_get.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_get.json new file mode 100644 index 0000000..74ced74 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_get.json @@ -0,0 +1,30 @@ +{ + + "kind": "compute#firewall", + "id": "12862241031274216284", + "creationTimestamp": "2012-04-13T03:05:02.855", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/firewalls/jclouds-test", + "name": "jclouds-test", + "description": "Internal traffic from default allowed", + "network": "https://www.googleapis.com/compute/v1/projects/myproject/global/networks/jclouds-test", + "sourceRanges": [ + "10.0.0.0/8" + ], + "allowed": [ + { + "IPProtocol": "tcp", + "ports": [ + "1-65535" + ] + }, + { + "IPProtocol": "udp", + "ports": [ + "1-65535" + ] + }, + { + "IPProtocol": "icmp" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_insert.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_insert.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_insert.json new file mode 100644 index 0000000..fabe1bd --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_insert.json @@ -0,0 +1 @@ +{"name":"%s","network":"https://www.googleapis.com/compute/v1/projects/myproject/global/networks/%s","sourceRanges":[%s],"sourceTags":[%s],"targetTags":[%s],"allowed":[{"IPProtocol":"tcp","ports":[%s]}]} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_list.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_list.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_list.json new file mode 100644 index 0000000..ab7d0b7 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/firewall_list.json @@ -0,0 +1,58 @@ +{ + "kind": "compute#firewallList", + "id": "projects/google/firewalls", + "selfLink": "https://www.googleapis.com/compute/v1/projects/google/global/firewalls", + "items": [ + { + + "kind": "compute#firewall", + "id": "12862241031274216284", + "creationTimestamp": "2012-04-13T03:05:02.855", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/firewalls/jclouds-test", + "name": "jclouds-test", + "description": "Internal traffic from default allowed", + "network": "https://www.googleapis.com/compute/v1/projects/myproject/global/networks/jclouds-test", + "sourceRanges": [ + "10.0.0.0/8" + ], + "allowed": [ + { + "IPProtocol": "tcp", + "ports": [ + "1-65535" + ] + }, + { + "IPProtocol": "udp", + "ports": [ + "1-65535" + ] + }, + { + "IPProtocol": "icmp" + } + ] + }, + { + + "kind": "compute#firewall", + "id": "12862241067393040785", + "creationTimestamp": "2012-04-13T03:05:04.365", + "selfLink": "https://www.googleapis.com/compute/v1/projects/google/global/firewalls/default-ssh", + "name": "default-ssh", + "description": "SSH allowed from anywhere", + "network": "https://www.googleapis.com/compute/v1/projects/google/global/networks/default", + "sourceRanges": [ + "0.0.0.0/0" + ], + "allowed": [ + { + "IPProtocol": "tcp", + "ports": [ + "22" + ] + } + ] + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/global_operation.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/global_operation.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/global_operation.json new file mode 100644 index 0000000..17d77483 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/global_operation.json @@ -0,0 +1,15 @@ +{ + "kind": "compute#operation", + "id": "13053095055850848306", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/operations/operation-1354084865060-4cf88735faeb8-bbbb12cb", + "name": "operation-1354084865060-4cf88735faeb8-bbbb12cb", + "targetLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/firewalls/jclouds-test-delete", + "targetId": "13053094017547040099", + "status": "DONE", + "user": "[email protected]", + "progress": 100, + "insertTime": "2012-11-28T06:41:05.060", + "startTime": "2012-11-28T06:41:05.142", + "endTime": "2012-11-28T06:41:06.142", + "operationType": "insert" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/global_operation_list.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/global_operation_list.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/global_operation_list.json new file mode 100644 index 0000000..32b881a --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/global_operation_list.json @@ -0,0 +1,22 @@ +{ + "kind": "compute#operationList", + "id": "projects/myproject/global/operations", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/operations", + "items": [ + { + "kind": "compute#operation", + "id": "13053095055850848306", + "selfLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/operations/operation-1354084865060-4cf88735faeb8-bbbb12cb", + "name": "operation-1354084865060-4cf88735faeb8-bbbb12cb", + "targetLink": "https://www.googleapis.com/compute/v1/projects/myproject/global/firewalls/jclouds-test-delete", + "targetId": "13053094017547040099", + "status": "DONE", + "user": "[email protected]", + "progress": 100, + "insertTime": "2012-11-28T06:41:05.060", + "startTime": "2012-11-28T06:41:05.142", + "endTime": "2012-11-28T06:41:06.142", + "operationType": "insert" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_get.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_get.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_get.json new file mode 100644 index 0000000..23cb0d2 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_get.json @@ -0,0 +1,13 @@ +{ + "kind": "compute#image", + "id": "12941197498378735318", + "creationTimestamp": "2012-07-16T22:16:13.468", + "selfLink": "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": { + "source": "", + "containerType": "TAR" + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_insert.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_insert.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_insert.json new file mode 100644 index 0000000..fd030a7 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_insert.json @@ -0,0 +1,4 @@ +{"sourceType": "RAW", "rawDisk": { + "source": "https://storage.googleapis.com/mybuket/myimage.image.tar.gz", + "containerType": "TAR" +}, "kind": "compute#image", "name": "myimage"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list.json new file mode 100644 index 0000000..6010f5a --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list.json @@ -0,0 +1,24 @@ +{ + "kind": "compute#imageList", + "id": "projects/centos-cloud/global/images", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images", + "items": [ + { + "kind": "compute#image", + "id": "12941197498378735318", + "creationTimestamp": "2012-07-16T22:16:13.468", + "selfLink": "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": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104" + }, + "rawDisk": { + "source": "", + "containerType": "TAR" + } + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_centos.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_centos.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_centos.json new file mode 100644 index 0000000..55e1b21 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_centos.json @@ -0,0 +1,183 @@ +{ + "kind": "compute#imageList", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images", + "id": "projects/centos-cloud/global/images", + "items": [ + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20131120", + "id": "11748647391859510935", + "creationTimestamp": "2013-11-25T15:13:50.611-08:00", + "name": "centos-6-v20131120", + "description": "SCSI-enabled CentOS 6 built on 2013-11-20", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140318" + }, + "status": "READY", + "archiveSizeBytes": "269993565", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140318", + "id": "11743140967858608122", + "creationTimestamp": "2014-03-19T15:01:13.388-07:00", + "name": "centos-6-v20140318", + "description": "CentOS 6.5 x86_64 built on 2014-03-18", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140408" + }, + "status": "READY", + "archiveSizeBytes": "341230444", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140408", + "id": "18033188469723077298", + "creationTimestamp": "2014-04-09T10:31:57.518-07:00", + "name": "centos-6-v20140408", + "description": "CentOS 6.5 x86_64 built on 2014-04-08", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140415" + }, + "status": "READY", + "archiveSizeBytes": "342252847", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140415", + "id": "10463166969914166288", + "creationTimestamp": "2014-04-22T12:05:16.927-07:00", + "name": "centos-6-v20140415", + "description": "CentOS 6.5 x86_64 built on 2014-04-15", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140522" + }, + "status": "READY", + "archiveSizeBytes": "1026663807", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140522", + "id": "14390164727436022001", + "creationTimestamp": "2014-06-03T10:21:42.109-07:00", + "name": "centos-6-v20140522", + "description": "CentOS 6.5 x86_64 built on 2014-05-22", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140606" + }, + "status": "READY", + "archiveSizeBytes": "1028292810", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140605", + "id": "16310166269920012092", + "creationTimestamp": "2014-06-05T11:04:45.767-07:00", + "name": "centos-6-v20140605", + "description": "CentOS 6.5 x86_64 built on 2014-06-05", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140606" + }, + "status": "READY", + "archiveSizeBytes": "1028745777", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140606", + "id": "6290630306542078308", + "creationTimestamp": "2014-06-06T13:16:42.265-07:00", + "name": "centos-6-v20140606", + "description": "CentOS 6.5 x86_64 built on 2014-06-06", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140619" + }, + "status": "READY", + "archiveSizeBytes": "1028757792", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140619", + "id": "3614861379648377676", + "creationTimestamp": "2014-06-24T13:28:11.552-07:00", + "name": "centos-6-v20140619", + "description": "CentOS 6.5 x86_64 built on 2014-06-19", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140718" + }, + "status": "READY", + "archiveSizeBytes": "1029860991", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140718", + "id": "16259951858818091437", + "creationTimestamp": "2014-07-24T09:02:18.298-07:00", + "name": "centos-6-v20140718", + "description": "CentOS 6.5 x86_64 built on 2014-07-18", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "status": "READY", + "archiveSizeBytes": "1031630715", + "diskSizeGb": "10" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_debian.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_debian.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_debian.json new file mode 100644 index 0000000..c2614c9 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_debian.json @@ -0,0 +1,400 @@ +{ + "kind": "compute#imageList", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images", + "id": "projects/debian-cloud/global/images", + "items": [ + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20131127", + "id": "12371298324486102144", + "creationTimestamp": "2013-12-02T17:49:01.206-08:00", + "name": "backports-debian-7-wheezy-v20131127", + "description": "Debian GNU/Linux 7.2 (wheezy) with backports kernel built on 2013-11-27", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140318" + }, + "status": "READY", + "archiveSizeBytes": "365056004", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140318", + "id": "4359542978415320596", + "creationTimestamp": "2014-03-19T14:59:48.212-07:00", + "name": "backports-debian-7-wheezy-v20140318", + "description": "Debian GNU/Linux 7.4 (wheezy) amd64 with backports kernel built on 2014-03-18", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140331" + }, + "status": "READY", + "archiveSizeBytes": "363791902", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140331", + "id": "15835408046770346721", + "creationTimestamp": "2014-04-02T13:22:10.344-07:00", + "name": "backports-debian-7-wheezy-v20140331", + "description": "Debian GNU/Linux 7.4 (wheezy) amd64 with backports kernel and SSH packages built on 2014-03-31", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140408" + }, + "status": "READY", + "archiveSizeBytes": "442398181", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140408", + "id": "11347897274148340677", + "creationTimestamp": "2014-04-09T10:34:36.072-07:00", + "name": "backports-debian-7-wheezy-v20140408", + "description": "Debian GNU/Linux 7.4 (wheezy) amd64 with backports kernel and SSH packages built on 2014-04-08", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140415" + }, + "status": "READY", + "archiveSizeBytes": "460293681", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140415", + "id": "1961353585117201359", + "creationTimestamp": "2014-04-22T12:05:21.799-07:00", + "name": "backports-debian-7-wheezy-v20140415", + "description": "Debian GNU/Linux 7.4 (wheezy) amd64 with backports kernel and SSH packages built on 2014-04-15", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140522" + }, + "status": "READY", + "archiveSizeBytes": "1305361944", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140522", + "id": "9086860851120583043", + "creationTimestamp": "2014-06-03T10:22:40.439-07:00", + "name": "backports-debian-7-wheezy-v20140522", + "description": "Debian GNU/Linux 7.5 (wheezy) amd64 with backports kernel and SSH packages built on 2014-05-22", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140606" + }, + "status": "READY", + "archiveSizeBytes": "1291544127", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140605", + "id": "3162880700849242534", + "creationTimestamp": "2014-06-05T11:15:06.942-07:00", + "name": "backports-debian-7-wheezy-v20140605", + "description": "Debian GNU/Linux 7.5 (wheezy) amd64 with backports kernel and SSH packages built on 2014-06-05", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140606" + }, + "status": "READY", + "archiveSizeBytes": "1342678611", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140606", + "id": "10385475893990329896", + "creationTimestamp": "2014-06-06T13:16:42.088-07:00", + "name": "backports-debian-7-wheezy-v20140606", + "description": "Debian GNU/Linux 7.5 (wheezy) amd64 with backports kernel and SSH packages built on 2014-06-06", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140619" + }, + "status": "READY", + "archiveSizeBytes": "1356729999", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140619", + "id": "15689321734978914353", + "creationTimestamp": "2014-06-24T13:29:10.490-07:00", + "name": "backports-debian-7-wheezy-v20140619", + "description": "Debian GNU/Linux 7.5 (wheezy) amd64 with backports kernel and SSH packages built on 2014-06-19", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140718" + }, + "status": "READY", + "archiveSizeBytes": "1281043596", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140718", + "id": "12577251946941921963", + "creationTimestamp": "2014-07-24T09:10:05.365-07:00", + "name": "backports-debian-7-wheezy-v20140718", + "description": "Debian GNU/Linux 7.6 (wheezy) amd64 with backports kernel and SSH packages built on 2014-07-18", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "status": "READY", + "archiveSizeBytes": "1335987075", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20131014", + "id": "2768298251193329825", + "creationTimestamp": "2013-10-28T13:52:08.233-07:00", + "name": "debian-7-wheezy-v20131014", + "description": "Debian GNU/Linux 7.2 (wheezy) built on 2013-10-14", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20131120", + "deprecated": "2013-12-02T12:00:00Z" + }, + "status": "READY", + "archiveSizeBytes": "405683884", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20131120", + "id": "17312518942796567788", + "creationTimestamp": "2013-11-25T15:17:00.436-08:00", + "name": "debian-7-wheezy-v20131120", + "description": "Debian GNU/Linux 7.2 (wheezy) built on 2013-11-20", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140318" + }, + "status": "READY", + "archiveSizeBytes": "341857472", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140318", + "id": "17164003659829548087", + "creationTimestamp": "2014-03-19T15:00:34.317-07:00", + "name": "debian-7-wheezy-v20140318", + "description": "Debian GNU/Linux 7.4 (wheezy) amd64 built on 2014-03-18", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140408" + }, + "status": "READY", + "archiveSizeBytes": "357365652", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140408", + "id": "5009074516965108296", + "creationTimestamp": "2014-04-09T10:32:46.862-07:00", + "name": "debian-7-wheezy-v20140408", + "description": "Debian GNU/Linux 7.4 (wheezy) amd64 built on 2014-04-08", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140415" + }, + "status": "READY", + "archiveSizeBytes": "387525228", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140415", + "id": "17362901286054305778", + "creationTimestamp": "2014-04-22T12:05:19.303-07:00", + "name": "debian-7-wheezy-v20140415", + "description": "Debian GNU/Linux 7.4 (wheezy) amd64 built on 2014-04-15", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140522" + }, + "status": "READY", + "archiveSizeBytes": "1151530332", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140522", + "id": "5741466168076626639", + "creationTimestamp": "2014-06-03T10:22:05.775-07:00", + "name": "debian-7-wheezy-v20140522", + "description": "Debian GNU/Linux 7.5 (wheezy) amd64 built on 2014-05-22", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140606" + }, + "status": "READY", + "archiveSizeBytes": "1129290498", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140605", + "id": "15036511115619902874", + "creationTimestamp": "2014-06-05T11:10:23.037-07:00", + "name": "debian-7-wheezy-v20140605", + "description": "Debian GNU/Linux 7.5 (wheezy) amd64 built on 2014-06-05", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140606" + }, + "status": "READY", + "archiveSizeBytes": "1064425338", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140606", + "id": "16280724435269635469", + "creationTimestamp": "2014-06-06T13:16:42.897-07:00", + "name": "debian-7-wheezy-v20140606", + "description": "Debian GNU/Linux 7.5 (wheezy) amd64 built on 2014-06-06", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140619" + }, + "status": "READY", + "archiveSizeBytes": "1108438332", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140619", + "id": "15990799122418306096", + "creationTimestamp": "2014-06-24T13:28:42.697-07:00", + "name": "debian-7-wheezy-v20140619", + "description": "Debian GNU/Linux 7.5 (wheezy) amd64 built on 2014-06-19", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "deprecated": { + "state": "DEPRECATED", + "replacement": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718" + }, + "status": "READY", + "archiveSizeBytes": "1158839577", + "diskSizeGb": "10" + }, + { + "kind": "compute#image", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718", + "id": "11535450626613878896", + "creationTimestamp": "2014-07-24T09:06:16.694-07:00", + "name": "debian-7-wheezy-v20140718", + "description": "Debian GNU/Linux 7.6 (wheezy) amd64 built on 2014-07-18", + "sourceType": "RAW", + "rawDisk": { + "source": "", + "containerType": "TAR" + }, + "status": "READY", + "archiveSizeBytes": "1195066695", + "diskSizeGb": "10" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_empty.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_empty.json b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_empty.json new file mode 100644 index 0000000..f082e08 --- /dev/null +++ b/dependencies/jclouds/apis/gce/1.8.1-stratos/src/test/resources/image_list_empty.json @@ -0,0 +1,6 @@ +{ + "kind": "compute#imageList", + "id": "projects/debian-cloud/global/images", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images", + "items": [ ] +}
