From f05fc0277fd9ea45b63b0fbb2f9b93a00aba11b8 Mon Sep 17 00:00:00 2001 From: slaws Date: Mon, 1 Nov 2010 13:13:25 +0000 Subject: TUSCANY-3674 - Add some rudimentary function to the helloworld apps so that the very first time user at least has a chance of working out what's going on. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1029640 13f79535-47bb-0310-9956-ffa450edef68 --- .../helloworld-contribution/pom.xml | 4 +-- .../main/resources/META-INF/sca-contribution.xml | 1 + .../src/main/resources/helloworldws.composite | 2 +- .../src/test/java/sample/HelloworldTestCase.java | 19 +++++++++++-- .../getting-started/helloworld-webapp/pom.xml | 5 ++-- .../helloworld-webapp/src/main/webapp/hello.html | 32 ++++++++++++++++++++++ 6 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-webapp/src/main/webapp/hello.html diff --git a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/pom.xml b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/pom.xml index 6b2f595d3d..bcae29012b 100644 --- a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/pom.xml +++ b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/pom.xml @@ -33,9 +33,9 @@ org.apache.tuscany.sca - tuscany-sca-api + tuscany-base-runtime-pom 2.0-Beta1-SNAPSHOT - provided + pom junit diff --git a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/main/resources/META-INF/sca-contribution.xml index 589b9d25c7..61053aa92e 100644 --- a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/main/resources/META-INF/sca-contribution.xml +++ b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -21,5 +21,6 @@ xmlns:sample="http://sample"> + diff --git a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/main/resources/helloworldws.composite b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/main/resources/helloworldws.composite index 52436d8b0a..abefee7360 100644 --- a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/main/resources/helloworldws.composite +++ b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/main/resources/helloworldws.composite @@ -22,7 +22,7 @@ targetNamespace="http://sample" name="helloworldws"> - + diff --git a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java index 7e679ec0e9..ded7418469 100644 --- a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java +++ b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java @@ -20,14 +20,29 @@ package sample; import static org.junit.Assert.assertEquals; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; import org.junit.Test; public class HelloworldTestCase { @Test public void testSayHello() { - HelloworldImpl helloworld = new HelloworldImpl(); - assertEquals("Hello Petra", helloworld.sayHello("Petra")); + // Start up the Tuscany runtime with this modules as the contribution + Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "target/classes")); + node.start(); + + // This contribution is configured to deploy the helloworld.composite file + // automatically. This defines the HelloworldComponent. Get a local proxy to it + // and call the sayHello service operation. + Helloworld helloworld = node.getService(Helloworld.class, "HelloworldComponent"); + String response = helloworld.sayHello("Petra"); + System.out.println("Response from helloworld.sayHello(\"Petra\") = " + response); + assertEquals("Hello Petra", response); + + // Stop the Tuscany runtime + node.stop(); } } diff --git a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-webapp/pom.xml b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-webapp/pom.xml index 5ddcd80310..ebb470a875 100644 --- a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-webapp/pom.xml +++ b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-webapp/pom.xml @@ -34,9 +34,10 @@ org.apache.tuscany.sca - tuscany-base-runtime + tuscany-base-runtime-pom 2.0-Beta1-SNAPSHOT - + pom + junit diff --git a/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-webapp/src/main/webapp/hello.html b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-webapp/src/main/webapp/hello.html new file mode 100644 index 0000000000..05038391a0 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta1/samples/getting-started/helloworld-webapp/src/main/webapp/hello.html @@ -0,0 +1,32 @@ + + + + +Apache Tuscany Helloworld Servlet Sample + + + + +

Apache Tuscany Helloworld Servlet Sample

+ +WSDL for binding.ws of the Helloworld service of the HelloWorldWS component + + + \ No newline at end of file -- cgit v1.2.3