diff options
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(); } } |