diff options
Diffstat (limited to 'sca-java-2.x')
8 files changed, 153 insertions, 104 deletions
diff --git a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/pom.xml b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/pom.xml index 9e9a4f9c75..d262f01b85 100644 --- a/sca-java-2.x/trunk/maven/archetypes/contribution-jar/pom.xml +++ b/sca-java-2.x/trunk/maven/archetypes/contribution-jar/pom.xml @@ -18,34 +18,34 @@ * under the License. --> <project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-sca</artifactId> - <version>2.0-SNAPSHOT</version> - <relativePath>../../../pom.xml</relativePath> - </parent> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca</artifactId> + <version>2.0-SNAPSHOT</version> + <relativePath>../../../pom.xml</relativePath> + </parent> - <artifactId>tuscany-contribution-jar</artifactId> - <packaging>maven-archetype</packaging> - <name>Create an SCA JAR contribution project</name> - <description>Create an SCA JAR contribution project</description> + <artifactId>tuscany-contribution-jar</artifactId> + <packaging>maven-archetype</packaging> + <name>Create an SCA JAR contribution project</name> + <description>Create an SCA JAR contribution project</description> - <build> - <extensions> - <extension> - <groupId>org.apache.maven.archetype</groupId> - <artifactId>archetype-packaging</artifactId> - <version>2.0-alpha-3</version> - </extension> - </extensions> - <plugins> - <plugin> - <artifactId>maven-archetype-plugin</artifactId> - <version>2.0-alpha-3</version> - <extensions>true</extensions> - </plugin> - </plugins> - </build> + <build> + <extensions> + <extension> + <groupId>org.apache.maven.archetype</groupId> + <artifactId>archetype-packaging</artifactId> + <version>2.0-alpha-3</version> + </extension> + </extensions> + <plugins> + <plugin> + <artifactId>maven-archetype-plugin</artifactId> + <version>2.0-alpha-3</version> + <extensions>true</extensions> + </plugin> + </plugins> + </build> </project> 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. --> <archetype-descriptor name="myproject"> - <fileSets> - <fileSet filtered="true" packaged="true" encoding="UTF-8"> - <directory>src/main/java</directory> - <includes> - <include>**/*.java</include> - </includes> - </fileSet> - <fileSet filtered="true" encoding="UTF-8"> - <directory>src/main/resources</directory> - <includes> - <include>**/*.xml</include> - <include>**/*.composite</include> - </includes> - </fileSet> - </fileSets> + <fileSets> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>src/main/java</directory> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>src/test/java</directory> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory>src/main/resources</directory> + <includes> + <include>**/*.xml</include> + <include>**/*.composite</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory>src/test/resources</directory> + <includes> + <include>**/*.xml</include> + <include>**/*.composite</include> + </includes> + </fileSet> + </fileSets> </archetype-descriptor>
\ 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. --> <archetype> - <id>tuscany-contribution-jar</id> - <sources> - <source>src/main/java/HelloworldImpl.java</source> - <source>src/main/java/HelloworldService.java</source> - </sources> - <resources> - <resource>src/main/hello.composite</resource> - <resource>src/main/webapp/META-INF/sca-contribution.xml</resource> - </resources> + <id>tuscany-contribution-jar</id> </archetype>
\ 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. --> <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> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> - <groupId>${groupId}</groupId> - <artifactId>${project.artifactId}</artifactId> - <version>${project.version}</version> - <name>${project.artifactId}</name> + <groupId>${groupId}</groupId> + <artifactId>${artifactId}</artifactId> + <version>${version}</version> + <packaging>jar</packaging> - <dependencies> + <name>${artifactId}</name> - <dependency> - <groupId>org.oasis-open.sca.j</groupId> - <artifactId>sca-caa-apis</artifactId> - <version>1.1-CD04</version> - <scope>provided</scope> - </dependency> + <properties> + <tuscany.version>2.0-SNAPSHOT</tuscany.version> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.1</version> - <scope>test</scope> - </dependency> + <dependencies> - </dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>${tuscany.version}</version> + <scope>provided</scope> + </dependency> - <build> - <defaultGoal>install</defaultGoal> - <finalName>${project.artifactId}</finalName> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.1</version> + <scope>test</scope> + </dependency> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.6</source> - <target>1.6</target> - <optimise>true</optimise> - <debug>true</debug> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.tuscany.maven.plugins</groupId> - <artifactId>maven-tuscany-plugin</artifactId> - </plugin> - </plugins> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-base-runtime</artifactId> + <version>${tuscany.version}</version> + <scope>test</scope> + </dependency> - </build> + </dependencies> - <!-- OASIS SVN repo (for sca-api jar) --> - <repositories> - <repository> - <id>oasis.svn</id> - <url>http://tools.oasis-open.org/version-control/svn/sca-j/Release/</url> - <releases> - <enabled>true</enabled> - </releases> - </repository> - </repositories> + <build> + <defaultGoal>install</defaultGoal> + <finalName>${artifactId}</finalName> + + <plugins> + <plugin> + <groupId>org.apache.tuscany.maven.plugins</groupId> + <artifactId>maven-tuscany-plugin</artifactId> + <version>${tuscany.version}</version> + </plugin> + </plugins> + + </build> </project> 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/Helloworld.java index d705564334..68f91f67cd 100644 --- 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/Helloworld.java @@ -21,7 +21,7 @@ package ${package}; import org.oasisopen.sca.annotation.Remotable; @Remotable -public interface HelloworldService { +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/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 @@ --> <contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:sample="http://${package}"> - <deployable composite="sample:${artifactId}"/> + + <deployable composite="sample:${artifactId}" /> + </contribution> 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(); + } + } +} |