http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/features/KeyApiExpectTest.java ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/features/KeyApiExpectTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/features/KeyApiExpectTest.java deleted file mode 100644 index a90de7e..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/features/KeyApiExpectTest.java +++ /dev/null @@ -1,86 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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 ${package}.features; - -import static org.testng.Assert.assertEquals; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import ${package}.${providerName}Api; -import ${package}.internal.Base${providerName}ApiExpectTest; -import ${package}.parse.ParseKeyListTest; -import ${package}.parse.ParseKeyTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * @author ${author} - */ -@Test(groups = "unit", testName = "KeyApiExpectTest") -public class KeyApiExpectTest extends Base${providerName}ApiExpectTest { - public HttpRequest list = HttpRequest.builder().method("GET") - .endpoint("${providerEndpoint}/my/keys") - .addHeader("X-Api-Version", "${providerApiVersion}") - .addHeader("Accept", "application/json") - .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build(); - - public HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload( - payloadFromResource("/key_list.json")).build(); - - public void testListKeysWhenResponseIs2xx() { - - ${providerName}Api apiWhenKeysExists = requestSendsResponse(list, listResponse); - - assertEquals(apiWhenKeysExists.getKeyApi().list(), new ParseKeyListTest().expected()); - } - - public void testListKeysWhenResponseIs404() { - HttpResponse listResponse = HttpResponse.builder().statusCode(404).build(); - - ${providerName}Api listWhenNone = requestSendsResponse(list, listResponse); - - assertEquals(listWhenNone.getKeyApi().list(), ImmutableSet.of()); - } - - public void testCreateKeyWhenResponseIs202() throws Exception { - HttpRequest create = HttpRequest.builder() - .method("POST") - .endpoint("${providerEndpoint}/my/keys") - .addHeader("X-Api-Version", "${providerApiVersion}") - .addHeader("Accept", "application/json") - .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==") - .payload( - payloadFromStringWithContentType( - "{\"name\":\"rsa\",\"key\":\"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0A5Pf5Cq...\"}", - "application/json")).build(); - - HttpResponse createResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted") - .payload(payloadFromResourceWithContentType("/key.json", "application/json; charset=UTF-8")) - .build(); - - ${providerName}Api apiWithNewKey = requestSendsResponse(create, createResponse); - - assertEquals(apiWithNewKey.getKeyApi().create(new ParseKeyTest().expected()) - .toString(), new ParseKeyTest().expected().toString()); - } -}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/features/KeyApiLiveTest.java ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/features/KeyApiLiveTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/features/KeyApiLiveTest.java deleted file mode 100644 index 0bb913f..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/features/KeyApiLiveTest.java +++ /dev/null @@ -1,90 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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 ${package}.features; - -import static org.testng.Assert.assertEquals; - -import java.util.Set; - -import org.jclouds.crypto.SshKeys; -import ${package}.domain.Key; -import ${package}.features.KeyApi; -import ${package}.internal.Base${providerName}ApiLiveTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -/** - * @author ${author} - */ -@Test(groups = "live", singleThreaded = true, testName = "KeyApiLiveTest") -public class KeyApiLiveTest extends Base${providerName}ApiLiveTest { - - @Test - public void testListAndGetKeys() throws Exception { - KeyApi api = context.getApi().getKeyApi(); - Set<Key> response = api.list(); - assert null != response; - for (Key key : response) { - Key newDetails = api.get(key.getName()); - assertEquals(newDetails.getName(), key.getName()); - assertEquals(newDetails.get(), key.get()); - assertEquals(newDetails.getCreated(), key.getCreated()); - } - - } - - private String keyText; - private String fingerprint; - - @BeforeTest - public void initKeys() { - keyText = SshKeys.generate().get("public"); - fingerprint = SshKeys.fingerprintPublicKey(keyText); - } - - public void testCreateKey() { - KeyApi api = context.getApi().getKeyApi(); - - Key newKey = api.create(Key.builder().name(fingerprint).key(keyText).build()); - assertEquals(newKey.getName(), fingerprint); - assertEquals(newKey.get(), keyText); - - newKey = api.get(fingerprint); - assertEquals(newKey.getName(), fingerprint); - assertEquals(newKey.get(), keyText); - } - - @Test(dependsOnMethods = "testCreateKey", expectedExceptions = IllegalStateException.class) - public void testDuplicateKey() { - KeyApi api = context.getApi().getKeyApi(); - api.create(Key.builder().name(fingerprint).key(keyText).build()); - } - - @Test(dependsOnMethods = "testDuplicateKey") - public void testDestroyKey() { - final KeyApi api = context.getApi().getKeyApi(); - api.delete(fingerprint); - // not that eventhough the key is destroyed it is visible via GET for at - // least 45 seconds. This may be a cache issue on the server - } - -} http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/handlers/__providerName__ErrorHandlerTest.java ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/handlers/__providerName__ErrorHandlerTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/handlers/__providerName__ErrorHandlerTest.java deleted file mode 100644 index 9b79f80..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/handlers/__providerName__ErrorHandlerTest.java +++ /dev/null @@ -1,100 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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 ${package}.handlers; - -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; - -import java.net.URI; - -import org.easymock.IArgumentMatcher; -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import org.testng.annotations.Test; - -/** - * - * @author ${author} - */ -@Test(groups = "unit", testName = "${providerName}ErrorHandlerTest") -public class ${providerName}ErrorHandlerTest { - - @Test - public void test409MakesIllegalStateException() { - assertCodeMakes( - "POST", - URI.create("${providerEndpoint}"), - 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) { - - ${providerName}ErrorHandler function = new ${providerName}ErrorHandler(); - - 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/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ApiExpectTest.java ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ApiExpectTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ApiExpectTest.java deleted file mode 100644 index 3b08f9b..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ApiExpectTest.java +++ /dev/null @@ -1,31 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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 ${package}.internal; - -import ${package}.${providerName}Api; - -/** - * @author ${author} - */ -public class Base${providerName}ApiExpectTest extends Base${providerName}ExpectTest<${providerName}Api> { - -} http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ApiLiveTest.java ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ApiLiveTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ApiLiveTest.java deleted file mode 100644 index 1314c00..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ApiLiveTest.java +++ /dev/null @@ -1,49 +0,0 @@ -#set( $lcaseProviderName = ${providerName.toLowerCase()} ) -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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 ${package}.internal; - -import org.jclouds.apis.BaseContextLiveTest; -import ${package}.${providerName}ApiMetadata; -import ${package}.${providerName}AsyncApi; -import ${package}.${providerName}Api; -import org.jclouds.rest.RestContext; - -import com.google.common.reflect.TypeToken; - - -/** - * @author ${author} - */ -public class Base${providerName}ApiLiveTest extends BaseContextLiveTest<RestContext<${providerName}Api, ${providerName}AsyncApi>> { - - public Base${providerName}ApiLiveTest() { - provider = "${lcaseProviderName}"; - } - - @Override - protected TypeToken<RestContext<${providerName}Api, ${providerName}AsyncApi>> contextType() { - return ${providerName}ApiMetadata.CONTEXT_TOKEN; - } - -} - http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__AsyncApiExpectTest.java ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__AsyncApiExpectTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__AsyncApiExpectTest.java deleted file mode 100644 index 2fde98b..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__AsyncApiExpectTest.java +++ /dev/null @@ -1,40 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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 ${package}.internal; - -import java.util.Properties; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import ${package}.${providerName}AsyncApi; - -import com.google.common.base.Function; -import com.google.inject.Module; - -/** - * @author ${author} - */ -public class Base${providerName}AsyncApiExpectTest extends Base${providerName}ExpectTest<${providerName}AsyncApi> { - public ${providerName}AsyncApi createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) { - return createInjector(fn, module, props).getInstance(${providerName}AsyncApi.class); - } -} http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ExpectTest.java ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ExpectTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ExpectTest.java deleted file mode 100644 index 71c8126..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/internal/Base__providerName__ExpectTest.java +++ /dev/null @@ -1,35 +0,0 @@ -#set( $lcaseProviderName = ${providerName.toLowerCase()} ) -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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 ${package}.internal; - -import org.jclouds.rest.internal.BaseRestApiExpectTest; - -/** - * @author ${author} - */ -public class Base${providerName}ExpectTest<T> extends BaseRestApiExpectTest<T> { - - public Base${providerName}ExpectTest() { - provider = "${lcaseProviderName}"; - } -} http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/parse/ParseKeyListTest.java ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/parse/ParseKeyListTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/parse/ParseKeyListTest.java deleted file mode 100644 index c0a5f75..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/parse/ParseKeyListTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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 ${package}.parse; - -import java.util.Set; - -import javax.ws.rs.Consumes; -import javax.ws.rs.core.MediaType; - -import org.jclouds.date.internal.SimpleDateFormatDateService; -import ${package}.domain.Key; -import org.jclouds.json.BaseSetParserTest; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * @author ${author} - */ -@Test(groups = "unit", testName = "ParseKeyListTest") -public class ParseKeyListTest extends BaseSetParserTest<Key> { - - @Override - public String resource() { - return "/key_list.json"; - } - - @Override - @Consumes(MediaType.APPLICATION_JSON) - public Set<Key> expected() { - return ImmutableSet.of( - Key.builder() - .name("rsa") - .key("ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0A5Pf5Cq...") - .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-04-13T22:14:46+00:00")) - .build() - ); - } - - protected Injector injector() { - return Guice.createInjector(new GsonModule() { - - @Override - protected void configure() { - bind(DateAdapter.class).to(Iso8601DateAdapter.class); - super.configure(); - } - - }); - } -} http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/parse/ParseKeyTest.java ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/parse/ParseKeyTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/parse/ParseKeyTest.java deleted file mode 100644 index 8ab13d0..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/parse/ParseKeyTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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 ${package}.parse; - -import javax.ws.rs.Consumes; -import javax.ws.rs.core.MediaType; - -import org.jclouds.date.internal.SimpleDateFormatDateService; -import ${package}.domain.Key; -import org.jclouds.json.BaseItemParserTest; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * @author ${author} - */ -@Test(groups = "unit", testName = "ParseKeyTest") -public class ParseKeyTest extends BaseItemParserTest<Key> { - - @Override - public String resource() { - return "/key.json"; - } - - @Override - @Consumes(MediaType.APPLICATION_JSON) - public Key expected() { - return Key.builder() - .name("rsa") - .key("ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0A5Pf5Cq...") - .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-04-13T22:14:46+00:00")) - .build(); - } - - protected Injector injector() { - return Guice.createInjector(new GsonModule() { - - @Override - protected void configure() { - bind(DateAdapter.class).to(Iso8601DateAdapter.class); - super.configure(); - } - - }); - } -} http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/key.json ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/key.json b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/key.json deleted file mode 100644 index 5957f79..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/key.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "rsa", - "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0A5Pf5Cq...", - "created": "2011-04-13T22:14:46+00:00" -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/key_list.json ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/key_list.json b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/key_list.json deleted file mode 100644 index 503dd9c..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/key_list.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "name": "rsa", - "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0A5Pf5Cq...", - "created": "2011-04-13T22:14:46+00:00" - } -] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/logback.xml ---------------------------------------------------------------------- diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/logback.xml b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/logback.xml deleted file mode 100644 index 9679b2e..0000000 --- a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/logback.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<configuration scan="false"> - <appender name="FILE" class="ch.qos.logback.core.FileAppender"> - <file>target/test-data/jclouds.log</file> - - <encoder> - <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern> - </encoder> - </appender> - - <appender name="WIREFILE" class="ch.qos.logback.core.FileAppender"> - <file>target/test-data/jclouds-wire.log</file> - - <encoder> - <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern> - </encoder> - </appender> - - <root> - <level value="warn" /> - </root> - - <logger name="org.jclouds"> - <level value="DEBUG" /> - <appender-ref ref="FILE" /> - </logger> - - <logger name="jclouds.wire"> - <level value="DEBUG" /> - <appender-ref ref="WIREFILE" /> - </logger> - - <logger name="jclouds.headers"> - <level value="DEBUG" /> - <appender-ref ref="WIREFILE" /> - </logger> - -</configuration> http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/assemblies/pom.xml ---------------------------------------------------------------------- diff --git a/assemblies/pom.xml b/assemblies/pom.xml deleted file mode 100644 index e59cac3..0000000 --- a/assemblies/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - -Licensed to jclouds, Inc. (jclouds) under one or more -contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. jclouds 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. - ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>jclouds-project</artifactId> - <groupId>org.apache.jclouds</groupId> - <version>1.6.1-SNAPSHOT</version> - <relativePath>../project/pom.xml</relativePath> - </parent> - <artifactId>jclouds-assemblies</artifactId> - <name>jclouds shared Maven assembly descriptors</name> - - <!-- Cannot be run with '-Pdistribution' on a clean repo, because of a - self-dependency. Install into the local repo with 'mvn clean install' first. --> -</project> http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/assemblies/src/main/resources/assemblies/jar-with-dependencies-descriptor.xml ---------------------------------------------------------------------- diff --git a/assemblies/src/main/resources/assemblies/jar-with-dependencies-descriptor.xml b/assemblies/src/main/resources/assemblies/jar-with-dependencies-descriptor.xml deleted file mode 100644 index cfb3a07..0000000 --- a/assemblies/src/main/resources/assemblies/jar-with-dependencies-descriptor.xml +++ /dev/null @@ -1,40 +0,0 @@ -<!-- - -Licensed to jclouds, Inc. (jclouds) under one or more -contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. jclouds 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. - ---> -<?xml version="1.0" encoding="UTF-8"?> -<assembly> - <id>jar-with-dependencies</id> - <formats> - <format>jar</format> - </formats> - <includeBaseDirectory>false</includeBaseDirectory> - <dependencySets> - <dependencySet> - <unpack>true</unpack> - <scope>runtime</scope> - </dependencySet> - </dependencySets> - <fileSets> - <fileSet> - <directory>${project.build.outputDirectory}</directory> - <outputDirectory /> - </fileSet> - </fileSets> -</assembly> http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/8c91fe0f/assemblies/src/main/resources/assemblies/jar-with-dependencies-no-core-no-apis-descriptor.xml ---------------------------------------------------------------------- diff --git a/assemblies/src/main/resources/assemblies/jar-with-dependencies-no-core-no-apis-descriptor.xml b/assemblies/src/main/resources/assemblies/jar-with-dependencies-no-core-no-apis-descriptor.xml deleted file mode 100644 index 1528967..0000000 --- a/assemblies/src/main/resources/assemblies/jar-with-dependencies-no-core-no-apis-descriptor.xml +++ /dev/null @@ -1,60 +0,0 @@ -<!-- - -Licensed to jclouds, Inc. (jclouds) under one or more -contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. jclouds 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. - ---> -<?xml version="1.0" encoding="UTF-8"?> -<assembly> - <id>jar-with-dependencies</id> - <formats> - <format>jar</format> - </formats> - <includeBaseDirectory>false</includeBaseDirectory> - <dependencySets> - <dependencySet> - <unpack>true</unpack> - <scope>runtime</scope> - <excludes> - <exclude>org.jclouds:jclouds-core</exclude> - <exclude>org.jclouds:jclouds-blobstore</exclude> - <exclude>org.jclouds:jclouds-compute</exclude> - <exclude>org.jclouds:jclouds-loadbalancer</exclude> - <exclude>org.jclouds.api:*</exclude> - <!-- excluding optional Clojure dependencies --> - <exclude>org.clojure:clojure*</exclude> - </excludes> - <!-- exclude all transitive dependencies of core too --> - <useTransitiveFiltering>true</useTransitiveFiltering> - <useProjectArtifact>false</useProjectArtifact> - </dependencySet> - </dependencySets> - <fileSets> - <fileSet> - <directory>${project.build.outputDirectory}</directory> - <outputDirectory /> - </fileSet> - <!-- Hack to get Maven assembly to build even if there are no files to include. - See http://jira.codehaus.org/browse/MASSEMBLY-457. --> - <fileSet> - <includes> - <include>pom.xml</include> - </includes> - <outputDirectory>META-INF/maven/${project.groupId}/${project.artifactId}</outputDirectory> - </fileSet> - </fileSets> -</assembly>
