diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-12-05 00:48:31 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-12-05 00:48:31 +0000 |
commit | f44c07576a61f6f4915ea8fd2aa5af9fee71745f (patch) | |
tree | da023390d4bb97f353cdff9e6ca11a3f2eb9236b /java/sca/itest/wires | |
parent | 10a9f2e5c0be26d6a44f1f90b677b9c5b7f985a9 (diff) |
Convert, clean and bring up a set of itests
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@723537 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/itest/wires')
3 files changed, 40 insertions, 22 deletions
diff --git a/java/sca/itest/wires/pom.xml b/java/sca/itest/wires/pom.xml index 4e14bcaeb6..1554df045f 100644 --- a/java/sca/itest/wires/pom.xml +++ b/java/sca/itest/wires/pom.xml @@ -31,15 +31,23 @@ <dependencies> <dependency> <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-embedded</artifactId> + <artifactId>tuscany-node-api</artifactId> <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-implementation-java-runtime</artifactId> <version>2.0-SNAPSHOT</version> - <scope>runtime</scope> + <scope>test</scope> </dependency> + </dependencies> </project> diff --git a/java/sca/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java b/java/sca/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java index f0964ebb93..9cb845d4b2 100644 --- a/java/sca/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java +++ b/java/sca/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java @@ -19,8 +19,7 @@ package org.apache.tuscany.sca.itest; -import junit.framework.Assert; - +import org.junit.Assert; import org.osoa.sca.annotations.Reference; import org.osoa.sca.annotations.Service; @@ -41,10 +40,10 @@ public class WireClientImpl implements WireClient { public void runTests() { // Make sure the wire has injected a reference Assert.assertNotNull(aWireService); - + // Test the injected reference String msg = aWireService.sayHello("MCC"); - + // Validate the response Assert.assertNotNull(msg); Assert.assertEquals("Hello MCC", msg); diff --git a/java/sca/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java b/java/sca/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java index 95f721cd8e..cd1b22ba91 100644 --- a/java/sca/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java +++ b/java/sca/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java @@ -19,10 +19,16 @@ package org.apache.tuscany.sca.itest; -import junit.framework.Assert; import junit.framework.TestCase; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; /** * This test case will attempt to use a wire @@ -30,10 +36,10 @@ import org.apache.tuscany.sca.host.embedded.SCADomain; public class WireTestCase extends TestCase { /** - * The SCADomain we are using + * The Node we are using */ - private SCADomain domain; - + private Node node; + /** * The client the tests should use */ @@ -42,28 +48,33 @@ public class WireTestCase extends TestCase { /** * Run the wire tests */ + @Test public void testWire() { - aWireClient.runTests(); + aWireClient.runTests(); } /** * Load the Wire composite and look up the client. */ - @Override - protected void setUp() throws Exception { - domain = SCADomain.newInstance("WireTest.composite"); - aWireClient = domain.getService(WireClient.class, "WireClient"); + + @Before + public void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("WireTest.composite"); + node = NodeFactory.newInstance().createNode("WireTest.composite", new Contribution("c1", location)); + node.start(); + aWireClient = node.getService(WireClient.class, "WireClient"); Assert.assertNotNull(aWireClient); - - aWireClient = domain.getService(WireClient.class, "AnotherWireClient"); + + aWireClient = node.getService(WireClient.class, "AnotherWireClient"); Assert.assertNotNull(aWireClient); } /** - * Shutdown the SCA domain + * Shutdown the SCA node */ - @Override - protected void tearDown() throws Exception { - domain.close(); + + @After + public void tearDown() throws Exception { + node.stop(); } } |