diff options
Diffstat (limited to 'branches/sca-java-1.2.1/samples/implementation-pojo')
10 files changed, 0 insertions, 475 deletions
diff --git a/branches/sca-java-1.2.1/samples/implementation-pojo/README b/branches/sca-java-1.2.1/samples/implementation-pojo/README deleted file mode 100644 index e6b285d82d..0000000000 --- a/branches/sca-java-1.2.1/samples/implementation-pojo/README +++ /dev/null @@ -1,72 +0,0 @@ -Implementation POJO Sample -========================== -This sample demonstrates how to use the new implementation type -implementation-pojo. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -Sample Overview ---------------- -This sample contains a POJO implementation type as an example of how to create -new implementation types. - -implementation-pojo-extension/ - src/ - main/ - java/ - helloworld/ - client application artifacts - resources/ - helloworld.composite - the SCA assembly used during unit testing - - test/ - java/ - helloworld/ - HelloWorldTestCase.java - JUnit test case - - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample extension can be built using Ant as -follows - -cd implementation-pojo -ant compile -ant run - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built -using Maven as follows. - -cd implementation-pojo -mvn - -Maven will also test that the sample extension built properly. You should see -the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.HelloWorldTestCase -Initializing POJO -Initializing POJO -Executing POJO sayHello -Destroying POJO -Destroying POJO -Initializing POJO -Initializing POJO -Executing POJO sayHello -Destroying POJO -Destroying POJO -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.463 sec - -Results : - -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 - - -This shows that the Junit test cases have run successfully. diff --git a/branches/sca-java-1.2.1/samples/implementation-pojo/build.xml b/branches/sca-java-1.2.1/samples/implementation-pojo/build.xml deleted file mode 100644 index ee61db0467..0000000000 --- a/branches/sca-java-1.2.1/samples/implementation-pojo/build.xml +++ /dev/null @@ -1,74 +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. ---> -<project name="implementation-pojo-extension" default="compile"> - <property name="test.class" value="helloworld.HelloWorldClient" /> - <property name="test.jar" value="sample-implementation-pojo-extension.jar" /> - - <target name="init"> - <mkdir dir="target/classes"/> - </target> - - <target name="compile" depends="init"> - <javac srcdir="src/main/java" - destdir="target/classes" - debug="on" - source="1.5" - target="1.5"> - <classpath> - <pathelement location="../../lib/tuscany-sca-manifest.jar"/> - </classpath> - </javac> - <copy todir="target/classes"> - <fileset dir="src/main/resources"/> - </copy> - <jar destfile="target/${test.jar}" basedir="target/classes"> - <manifest> - <attribute name="Main-Class" value="${test.class}" /> - </manifest> - </jar> - </target> - - <target name="run-classes"> - <java classname="${test.class}" - fork="true"> - <classpath> - <pathelement path="target/classes"/> - <pathelement location="../implementation-pojo-extension/target/sample-implementation-pojo-extension.jar"/> - <pathelement location="../../lib/tuscany-sca-manifest.jar"/> - </classpath> - </java> - </target> - - <target name="run"> - <java classname="${test.class}" - fork="true"> - <classpath> - <pathelement location="target/${test.jar}"/> - <pathelement location="../implementation-pojo-extension/target/sample-implementation-pojo-extension.jar"/> - <pathelement location="../../lib/tuscany-sca-manifest.jar"/> - </classpath> - </java> - </target> - - <target name="clean"> - <delete quiet="true" includeemptydirs="true"> - <fileset dir="target"/> - </delete> - </target> -</project> diff --git a/branches/sca-java-1.2.1/samples/implementation-pojo/pom.xml b/branches/sca-java-1.2.1/samples/implementation-pojo/pom.xml deleted file mode 100644 index dbd04b9344..0000000000 --- a/branches/sca-java-1.2.1/samples/implementation-pojo/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * 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. ---> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-sca</artifactId> - <version>1.2.1-incubating-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - <artifactId>sample-implementation-pojo</artifactId> - <name>Apache Tuscany SCA POJO Implementation Extension Sample</name> - - <repositories> - <repository> - <id>apache.incubator</id> - <url>http://people.apache.org/repo/m2-incubating-repository</url> - </repository> - </repositories> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>sample-implementation-pojo-extension</artifactId> - <version>1.2.1-incubating-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-assembly-xml</artifactId> - <version>1.2.1-incubating-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface-java-xml</artifactId> - <version>1.2.1-incubating-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core-spi</artifactId> - <version>1.2.1-incubating-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-embedded</artifactId> - <version>1.2.1-incubating-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.2</version> - <scope>test</scope> - </dependency> - - </dependencies> - - <build> - <finalName>${artifactId}</finalName> - </build> - -</project> diff --git a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorld.java b/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorld.java deleted file mode 100644 index cc32929f09..0000000000 --- a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorld.java +++ /dev/null @@ -1,26 +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 helloworld; - -public interface HelloWorld { - - String sayHello(String name); - -} diff --git a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorldClient.java b/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorldClient.java deleted file mode 100644 index 34d9e3a463..0000000000 --- a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorldClient.java +++ /dev/null @@ -1,37 +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 helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * Tests the POJO implementation extension. - */ -public class HelloWorldClient { - - public static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworld/helloworld.composite"); - HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent"); - helloworld.sayHello("petra"); - - HelloWorld helloworld2 = scaDomain.getService(HelloWorld.class, "HelloWorldComponent2/HelloWorld2"); - helloworld2.sayHello("petra"); - - } -} diff --git a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index 0580e30aba..0000000000 --- a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,37 +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 helloworld; - -public class HelloWorldImpl { - - public void init() { - System.out.println("Initializing POJO"); - } - - public void destroy() { - System.out.println("Destroying POJO"); - } - - public String sayHello(String name) { - System.out.println("Executing POJO sayHello"); - return "Hello " + name; - } - -} diff --git a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl2.java b/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl2.java deleted file mode 100644 index 69ab1f567e..0000000000 --- a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl2.java +++ /dev/null @@ -1,37 +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 helloworld; - -public class HelloWorldImpl2 { - - public void init() { - System.out.println("Initializing POJO"); - } - - public void destroy() { - System.out.println("Destroying POJO"); - } - - public String sayHello(String name) { - System.out.println("Executing POJO sayHello"); - return "Hello " + name; - } - -} diff --git a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/resources/helloworld/HelloWorldImpl2.componentType b/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/resources/helloworld/HelloWorldImpl2.componentType deleted file mode 100644 index a92c5ab8db..0000000000 --- a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/resources/helloworld/HelloWorldImpl2.componentType +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * 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. ---> -<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"> - - <service name="HelloWorld2"> - <interface.java interface="helloworld.HelloWorld"/> - </service> - -</componentType>
\ No newline at end of file diff --git a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/resources/helloworld/helloworld.composite b/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/resources/helloworld/helloworld.composite deleted file mode 100644 index c38094dfc9..0000000000 --- a/branches/sca-java-1.2.1/samples/implementation-pojo/src/main/resources/helloworld/helloworld.composite +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * 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. ---> -<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - targetNamespace="http://test/helloworld" - xmlns:p="http://pojo" - name="helloworld"> - - <component name="HelloWorldComponent"> - <p:implementation.pojo class="helloworld.HelloWorldImpl" /> - </component> - - <component name="HelloWorldComponent2"> - <p:implementation.pojo class="helloworld.HelloWorldImpl2" /> - </component> - -</composite> diff --git a/branches/sca-java-1.2.1/samples/implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java b/branches/sca-java-1.2.1/samples/implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java deleted file mode 100644 index d8b5f41adc..0000000000 --- a/branches/sca-java-1.2.1/samples/implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * Tests the POJO implementation extension. - */ -public class HelloWorldTestCase extends TestCase { - - private SCADomain scaDomain; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("helloworld/helloworld.composite"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testHello() throws Exception { - HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent"); - assertEquals("Hello petra", helloworld.sayHello("petra")); - } - - public void testHello2() throws Exception { - HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent2/HelloWorld2"); - assertEquals("Hello petra", helloworld.sayHello("petra")); - } -} |