diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-06 10:01:25 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-06 10:01:25 +0000 |
commit | fd63d9f0d320bf6cace9c47b5fec7a407497a743 (patch) | |
tree | 5f1adb2d4171f148ec2756d69f63d4335319181d /sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java | |
parent | c99d4755650a32a9ebece84db7beb63bc867b5c6 (diff) |
Update the getting started contribution to ues the contribution cretaed from the Tuscany contribution-jar Maven archetype
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1067625 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java')
-rw-r--r-- | sca-java-2.x/trunk/samples/getting-started/helloworld-contribution/src/test/java/sample/HelloworldTestCase.java | 40 |
1 files changed, 20 insertions, 20 deletions
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 ded7418469..be27aa68ef 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 @@ -18,31 +18,31 @@ */
package sample;
-import static org.junit.Assert.assertEquals;
+import org.junit.Assert;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
+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() {
- // 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();
- }
+ 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();
+ }
+ }
}
|