summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-11-09 10:31:31 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-11-09 10:31:31 +0000
commitbceaf5164e13c93d4923fcfe0eec47eaa9acbed7 (patch)
tree3b154587134a010e6658232274470c15d6730e6c /sca-java-2.x/trunk/samples/getting-started/helloworld-contribution
parentdc7accced99cd260d485df939859b4086cde5f2e (diff)
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. (merge from beta1)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1032910 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/samples/getting-started/helloworld-contribution')
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/pom.xml4
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/main/resources/META-INF/sca-contribution.xml1
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/main/resources/helloworldws.composite2
-rw-r--r--sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java19
4 files changed, 21 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/pom.xml b/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/pom.xml
index 30f5a1c4ec..df09091cf7 100644
--- a/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/pom.xml
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/pom.xml
@@ -33,9 +33,9 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
+ <artifactId>tuscany-base-runtime-pom</artifactId>
<version>2.0-SNAPSHOT</version>
- <scope>provided</scope>
+ <type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/main/resources/META-INF/sca-contribution.xml
index 589b9d25c7..61053aa92e 100644
--- a/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/main/resources/META-INF/sca-contribution.xml
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -21,5 +21,6 @@
xmlns:sample="http://sample">
<deployable composite="sample:helloworld"/>
+ <deployable composite="sample:helloworldws"/>
</contribution>
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/main/resources/helloworldws.composite b/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/main/resources/helloworldws.composite
index 52436d8b0a..abefee7360 100644
--- a/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/main/resources/helloworldws.composite
+++ b/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/main/resources/helloworldws.composite
@@ -22,7 +22,7 @@
targetNamespace="http://sample"
name="helloworldws">
- <component name="HelloworldComponent">
+ <component name="HelloworldWSComponent">
<implementation.java class="sample.HelloworldImpl"/>
<service name="Helloworld">
<binding.ws />
diff --git a/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java b/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java
index 7e679ec0e9..ded7418469 100644
--- a/sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java
+++ b/sca-java-2.x/trunk/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();
}
}