From 0c00d07fd7c3d3fd50b21fd53d18de45a7109af9 Mon Sep 17 00:00:00 2001 From: antelder Date: Sun, 6 Feb 2011 09:07:24 +0000 Subject: Clean up contribution jar archetype and update to create a standalone project that doesn't use a tuscany parent pom git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1067618 13f79535-47bb-0310-9956-ffa450edef68 --- .../META-INF/maven/archetype-metadata.xml | 43 ++++++---- .../main/resources/META-INF/maven/archetype.xml | 10 +-- .../src/main/resources/archetype-resources/pom.xml | 94 ++++++++++------------ .../src/main/java/Helloworld.java | 28 +++++++ .../src/main/java/HelloworldImpl.java | 2 +- .../src/main/java/HelloworldService.java | 28 ------- .../main/resources/META-INF/sca-contribution.xml | 4 +- .../src/test/java/HelloworldTestCase.java | 48 +++++++++++ 8 files changed, 153 insertions(+), 104 deletions(-) create mode 100644 sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/Helloworld.java delete mode 100644 sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/HelloworldService.java create mode 100644 sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/test/java/HelloworldTestCase.java (limited to 'sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources') diff --git a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/META-INF/maven/archetype-metadata.xml b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/META-INF/maven/archetype-metadata.xml index 46c5cd6dca..1e1c124869 100644 --- a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -18,19 +18,32 @@ * under the License. --> - - - src/main/java - - **/*.java - - - - src/main/resources - - **/*.xml - **/*.composite - - - + + + src/main/java + + **/*.java + + + + src/test/java + + **/*.java + + + + src/main/resources + + **/*.xml + **/*.composite + + + + src/test/resources + + **/*.xml + **/*.composite + + + \ No newline at end of file diff --git a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/META-INF/maven/archetype.xml b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/META-INF/maven/archetype.xml index 69c3fb5ac9..6e0591fbfe 100644 --- a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/META-INF/maven/archetype.xml +++ b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/META-INF/maven/archetype.xml @@ -18,13 +18,5 @@ * under the License. --> - tuscany-contribution-jar - - src/main/java/HelloworldImpl.java - src/main/java/HelloworldService.java - - - src/main/hello.composite - src/main/webapp/META-INF/sca-contribution.xml - + tuscany-contribution-jar \ No newline at end of file diff --git a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/pom.xml b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/pom.xml index 5a2755a325..28a846797c 100644 --- a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/pom.xml +++ b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/pom.xml @@ -18,64 +18,58 @@ * under the License. --> - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 - ${groupId} - ${project.artifactId} - ${project.version} - ${project.artifactId} + ${groupId} + ${artifactId} + ${version} + jar - + ${artifactId} - - org.oasis-open.sca.j - sca-caa-apis - 1.1-CD04 - provided - + + 2.0-SNAPSHOT + UTF-8 + - - junit - junit - 4.8.1 - test - + - + + org.apache.tuscany.sca + tuscany-sca-api + ${tuscany.version} + provided + - - install - ${project.artifactId} + + junit + junit + 4.8.1 + test + - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - true - true - - - - org.apache.tuscany.maven.plugins - maven-tuscany-plugin - - + + org.apache.tuscany.sca + tuscany-base-runtime + ${tuscany.version} + test + - + - - - - oasis.svn - http://tools.oasis-open.org/version-control/svn/sca-j/Release/ - - true - - - + + install + ${artifactId} + + + + org.apache.tuscany.maven.plugins + maven-tuscany-plugin + ${tuscany.version} + + + + diff --git a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/Helloworld.java b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/Helloworld.java new file mode 100644 index 0000000000..68f91f67cd --- /dev/null +++ b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/Helloworld.java @@ -0,0 +1,28 @@ +/* + * 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 ${package}; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Helloworld { + + String sayHello(String name); + +} diff --git a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/HelloworldImpl.java b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/HelloworldImpl.java index 26237c105c..f5af4c7366 100644 --- a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/HelloworldImpl.java +++ b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/HelloworldImpl.java @@ -23,7 +23,7 @@ import org.oasisopen.sca.annotation.Scope; import org.oasisopen.sca.annotation.EagerInit; @Scope("COMPOSITE") @EagerInit -public class HelloworldImpl implements HelloworldService { +public class HelloworldImpl implements Helloworld { public String sayHello(String name) { return "Hello " + name; diff --git a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/HelloworldService.java b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/HelloworldService.java deleted file mode 100644 index d705564334..0000000000 --- a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/java/HelloworldService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package ${package}; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface HelloworldService { - - String sayHello(String name); - -} diff --git a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/resources/META-INF/sca-contribution.xml index 960d6a90ae..d2e633d3d8 100644 --- a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/resources/META-INF/sca-contribution.xml +++ b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/main/resources/META-INF/sca-contribution.xml @@ -19,5 +19,7 @@ --> - + + + diff --git a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/test/java/HelloworldTestCase.java b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/test/java/HelloworldTestCase.java new file mode 100644 index 0000000000..c98112cb93 --- /dev/null +++ b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/src/main/resources/archetype-resources/src/test/java/HelloworldTestCase.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package ${package}; + +import org.junit.Assert; + +import org.apache.tuscany.sca.Node; +import org.apache.tuscany.sca.TuscanyRuntime; +import org.junit.Test; +import org.oasisopen.sca.NoSuchServiceException; + +public class HelloworldTestCase { + + @Test + public void testSayHello() throws NoSuchServiceException { + + // Run the SCA composite in a Tuscany runtime + Node node = TuscanyRuntime.runComposite("helloworld.composite", "target/classes"); + try { + + // Get the Helloworld service proxy + Helloworld helloworld = node.getService(Helloworld.class, "HelloworldComponent"); + + // test that it works as expected + Assert.assertEquals("Hello Amelia", helloworld.sayHello("Amelia")); + + } finally { + // Stop the Tuscany runtime Node + node.stop(); + } + } +} -- cgit v1.2.3