From 8435e4751b9caa6c3cc2d9c60e3fca5becf8b5bf Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 17 May 2011 11:09:38 +0000 Subject: Merege the refactoring in nodeImpl2 back into NodeImpl git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1104140 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tuscany/sca/impl/Node2TestCase.java | 31 +++++----- .../tuscany/sca/runtime/DeployerTestCase.java | 30 ++++++++-- .../sca/runtime/DomainCompositeTestCase.java | 21 +++---- .../tuscany/sca/runtime/NodeXMLTestCase.java | 9 ++- .../org/apache/tuscany/sca/runtime/PerfTest.java | 10 ++-- .../sca/runtime/TuscanyRuntimeTestCase.java | 68 ++++++++++++---------- .../tuscany/sca/runtime/TwoNodesTestCase.java | 3 +- 7 files changed, 101 insertions(+), 71 deletions(-) (limited to 'sca-java-2.x/trunk/modules/domain-node/src/test/java') diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java index 34f6b8760e..17963d97c9 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java @@ -27,6 +27,7 @@ import javax.xml.stream.XMLStreamException; import junit.framework.Assert; +import org.apache.tuscany.sca.Node; import org.apache.tuscany.sca.TuscanyRuntime; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.contribution.Contribution; @@ -42,7 +43,7 @@ public class Node2TestCase { @Test public void localInstall() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase"); + Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase"); node.installContribution("src/test/resources/import.jar"); Assert.assertEquals(1, node.getInstalledContributionURIs().size()); @@ -53,7 +54,7 @@ public class Node2TestCase { @Test public void remoteInstall() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase"); + Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase"); node.installContribution("https://repository.apache.org/content/groups/snapshots/org/apache/tuscany/sca/samples/helloworld/2.0-SNAPSHOT/helloworld-2.0-SNAPSHOT.jar"); Assert.assertEquals(1, node.getInstalledContributionURIs().size()); @@ -64,7 +65,7 @@ public class Node2TestCase { @Test public void DistributedInstall() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - NodeImpl2 nodeA = TuscanyRuntime.newInstance().createNode2("uri:DistributedInstall"); + Node nodeA = TuscanyRuntime.newInstance().createNode("uri:DistributedInstall"); nodeA.installContribution("https://repository.apache.org/content/groups/snapshots/org/apache/tuscany/sca/samples/helloworld/2.0-SNAPSHOT/helloworld-2.0-SNAPSHOT.jar"); nodeA.installContribution("src/test/resources/export.jar"); @@ -74,21 +75,21 @@ public class Node2TestCase { Contribution cA = nodeA.getContribution("helloworld"); Assert.assertNotNull(cA); - NodeImpl2 nodeB = TuscanyRuntime.newInstance().createNode2("uri:DistributedInstall"); + Node nodeB = TuscanyRuntime.newInstance().createNode("uri:DistributedInstall"); Assert.assertEquals(2, nodeB.getInstalledContributionURIs().size()); Assert.assertTrue(nodeB.getInstalledContributionURIs().contains("export")); Assert.assertTrue(nodeB.getInstalledContributionURIs().contains("helloworld")); Contribution cB = nodeB.getContribution("helloworld"); Assert.assertNotNull(cB); - InstalledContribution ic = nodeB.getInstalledContribution("export"); + InstalledContribution ic = ((NodeImpl)nodeB).getInstalledContribution("export"); Assert.assertEquals(1, ic.getJavaExports().size()); Assert.assertEquals("sample", ic.getJavaExports().get(0)); } @Test public void deployables() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase"); + Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase"); node.installContribution("src/test/resources/import.jar"); Assert.assertEquals(1, node.getInstalledContributionURIs().size()); @@ -101,27 +102,27 @@ public class Node2TestCase { @Test public void exports() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase"); + Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase"); node.installContribution("src/test/resources/export.jar"); Assert.assertEquals(1, node.getInstalledContributionURIs().size()); Assert.assertEquals("export", node.getInstalledContributionURIs().get(0)); - InstalledContribution ic = node.getInstalledContribution("export"); + InstalledContribution ic = ((NodeImpl)node).getInstalledContribution("export"); Assert.assertEquals(1, ic.getJavaExports().size()); Assert.assertEquals("sample", ic.getJavaExports().get(0)); } @Test public void validValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase"); + Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase"); node.installContribution("src/test/resources/sample-helloworld.jar"); node.validateContribution("sample-helloworld"); } @Test public void invalidValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase"); + Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase"); node.installContribution("src/test/resources/import.jar"); try { node.validateContribution("import"); @@ -132,7 +133,7 @@ public class Node2TestCase { @Test public void importExportValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase"); + Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase"); node.installContribution("src/test/resources/import.jar"); try { node.validateContribution("import"); @@ -148,14 +149,14 @@ public class Node2TestCase { @Test public void importExportDistributedValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - NodeImpl2 nodeA = TuscanyRuntime.newInstance().createNode2("uri:ImportTestCase"); + Node nodeA = TuscanyRuntime.newInstance().createNode("uri:ImportTestCase"); nodeA.installContribution("src/test/resources/import.jar"); try { nodeA.validateContribution("import"); } catch (ValidationException e) { // expected } - NodeImpl2 nodeB = TuscanyRuntime.newInstance().createNode2("uri:ImportTestCase"); + Node nodeB = TuscanyRuntime.newInstance().createNode("uri:ImportTestCase"); nodeB.installContribution("src/test/resources/export.jar"); nodeA.validateContribution("import"); nodeA.startComposite("import", "helloworld.composite"); @@ -165,7 +166,7 @@ public class Node2TestCase { @Test public void startTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase"); + Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase"); node.installContribution("src/test/resources/sample-helloworld.jar"); Assert.assertEquals(0, node.getStartedComposites().size()); @@ -183,7 +184,7 @@ public class Node2TestCase { @Test public void addDeploymentCompositeTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException { - NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("addDeploymentCompositeTest"); + Node node = TuscanyRuntime.newInstance().createNode("addDeploymentCompositeTest"); String curi = node.installContribution("src/test/resources/sample-helloworld.jar"); String compositeXML = diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java index 12204883f8..8713d0b478 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java @@ -19,10 +19,14 @@ package org.apache.tuscany.sca.runtime; import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; import java.net.MalformedURLException; import java.net.URI; import java.util.List; +import java.util.Map; +import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import junit.framework.Assert; @@ -51,7 +55,7 @@ public class DeployerTestCase { Contribution contribution = deployer.loadContribution(URI.create("foo"), new File("src/test/resources/sample-helloworld-nodeployable.jar").toURI().toURL(), monitor); monitor.analyzeProblems(); - node.installContribution(contribution, null, true); + node.installContribution(contribution, null); List ics = node.getInstalledContributionURIs(); Assert.assertEquals(1, ics.size()); Assert.assertEquals("foo", ics.get(0)); @@ -62,17 +66,31 @@ public class DeployerTestCase { TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance(); Node node = tuscanyRuntime.createNode("myDomain"); - node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true); + node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null); Deployer deployer = tuscanyRuntime.getDeployer(); Monitor monitor = deployer.createMonitor(); Composite composite = deployer.loadXMLDocument(new File("src/test/resources/helloworld2.composite").toURI().toURL(), monitor); monitor.analyzeProblems(); - composite.setURI("helloworld2.composite"); - node.start("foo", composite); - List dcs = node.getStartedCompositeURIs("foo"); + String cmpuri = node.addDeploymentComposite("foo", composite); + node.startComposite("foo", cmpuri); + Map> dcs = node.getStartedComposites(); Assert.assertEquals(1, dcs.size()); - Assert.assertEquals("helloworld2.composite", dcs.get(0)); + Assert.assertEquals("helloworld2", dcs.get("foo").get(0).getLocalPart()); + } + + @Test + public void testAddDeploymentCompositeXML() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException, XMLStreamException, FileNotFoundException { + TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance(); + Node node = tuscanyRuntime.createNode("myDomain"); + + node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null); + + String cmpuri = node.addDeploymentComposite("foo", new FileReader(new File("src/test/resources/helloworld2.composite"))); + node.startComposite("foo", cmpuri); + Map> dcs = node.getStartedComposites(); + Assert.assertEquals(1, dcs.size()); + Assert.assertEquals("helloworld2", dcs.get("foo").get(0).getLocalPart()); } } diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java index ce5ba2432c..e4f93ca85d 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java @@ -33,31 +33,32 @@ public class DomainCompositeTestCase { @Test public void localOnlyDomain() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNode("DomainCompositeTestCase.localOnlyDomain"); + Node node = TuscanyRuntime.newInstance().createNode("DomainCompositeTestCase"); testIt(node); } @Test public void distributedDomain() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { - Node node = TuscanyRuntime.newInstance().createNode("uri:DomainCompositeTestCase.distributedDomain"); + Node node = TuscanyRuntime.newInstance().createNode("uri:DomainCompositeTestCase"); testIt(node); } private void testIt(Node node) throws ContributionReadException, ActivationException, ValidationException { - node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true); + node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null); + node.startComposite("helloworld", "helloworld.composite"); - Composite dc = node.getDomainLevelComposite(); - Assert.assertEquals("domainComposite", dc.getName().getLocalPart()); + Composite dc = node.getDomainComposite(); + Assert.assertEquals("DomainCompositeTestCase", dc.getName().getLocalPart()); Assert.assertEquals(1, dc.getIncludes().size()); Composite c = dc.getIncludes().get(0); Assert.assertEquals("helloworld", c.getName().getLocalPart()); - String s = node.getDomainLevelCompositeAsString(); - System.out.println(s); - Assert.assertTrue(s.contains(":helloworld\"")); +// String s = node.getDomainLevelCompositeAsString(); +// System.out.println(s); +// Assert.assertTrue(s.contains(":helloworld\"")); - node.stop("helloworld", "helloworld.composite"); - Assert.assertEquals(0, node.getDomainLevelComposite().getIncludes().size()); + node.stopComposite("helloworld", "helloworld.composite"); + Assert.assertEquals(0, node.getDomainComposite().getIncludes().size()); } } diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java index d245ea2ec6..ca4ea32c4d 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java @@ -19,6 +19,9 @@ package org.apache.tuscany.sca.runtime; import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; import junit.framework.Assert; @@ -37,9 +40,9 @@ public class NodeXMLTestCase { List cs = node.getInstalledContributionURIs(); Assert.assertEquals(1, cs.size()); Assert.assertEquals("sample-helloworld", cs.get(0)); - List compsoites = node.getStartedCompositeURIs("sample-helloworld"); - Assert.assertEquals(1, compsoites.size()); - Assert.assertEquals("helloworld.composite", compsoites.get(0)); + Map> startedComposites = node.getStartedComposites(); + Assert.assertEquals(1, startedComposites.size()); + Assert.assertEquals("helloworld", startedComposites.get("sample-helloworld").get(0).getLocalPart()); } } diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/PerfTest.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/PerfTest.java index 4b889f56bc..97b3755f2e 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/PerfTest.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/PerfTest.java @@ -39,15 +39,15 @@ public class PerfTest { Properties config = new Properties(); config.setProperty(RuntimeProperties.QUIET_LOGGING, "true"); Node node = TuscanyRuntime.newInstance(config).createNode(); - node.installContribution(null, "src/test/resources/sample-helloworld.jar", null, null, false); + node.installContribution(null, "src/test/resources/sample-helloworld.jar", null, null); validate(node); int count = 3000; long start = System.currentTimeMillis(); for (int i=0; i> ci = node.getStartedComposites(); + Assert.assertEquals(1, ci.size()); Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - node.stop("helloworld", ci); + node.stopComposite("helloworld", "helloworld.composite"); try { node.getService(Helloworld.class, "HelloworldComponent"); Assert.fail(); @@ -64,7 +71,7 @@ public class TuscanyRuntimeTestCase { // expected as there is no deployables } - node.start("helloworld", ci); + node.startComposite("helloworld", "helloworld.composite"); helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); } @@ -73,8 +80,10 @@ public class TuscanyRuntimeTestCase { @Ignore("Depdends on itest/T3558 which isn't in the build?") public void testInstallWithDependent() throws NoSuchServiceException, ContributionReadException, ActivationException, ValidationException { Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("store", "../../itest/T3558/src/test/resources/sample-store.jar", null, null, true); - node.installContribution("store-client", "../../itest/T3558/src/test/resources/sample-store-client.jar", null, null, true); + node.installContribution("store", "../../testing/itest/T3558/src/test/resources/sample-store.jar", null, null); + node.installContribution("store-client", "../../testing/itest/T3558/src/test/resources/sample-store-client.jar", null, null); + node.startComposite("store", "store.composite"); + node.startComposite("store-client", "store-client.composite"); Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); @@ -83,7 +92,7 @@ public class TuscanyRuntimeTestCase { @Test public void testInstallNoDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true); + node.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", null, null); try { node.getService(Helloworld.class, "HelloworldComponent"); @@ -92,7 +101,7 @@ public class TuscanyRuntimeTestCase { // expected as there is no deployables } - node.start("helloworld", "helloworld.composite"); + node.startComposite("helloworld", "helloworld.composite"); Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); } @@ -100,7 +109,7 @@ public class TuscanyRuntimeTestCase { @Test public void testGetInstalledContributions() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true); + node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null); List ics = node.getInstalledContributionURIs(); Assert.assertEquals(1, ics.size()); Assert.assertEquals("foo", ics.get(0)); @@ -109,8 +118,8 @@ public class TuscanyRuntimeTestCase { @Test public void testGetDeployedCompostes() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException { Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null, true); - List dcs = node.getStartedCompositeURIs("foo"); + node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null); + List dcs = node.startDeployables("foo"); Assert.assertEquals(1, dcs.size()); Assert.assertEquals("helloworld.composite", dcs.get(0)); } @@ -118,20 +127,25 @@ public class TuscanyRuntimeTestCase { @Test public void testRemoveComposte() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException { Node node = TuscanyRuntime.newInstance().createNode("default"); - node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null, true); - node.stop("foo", "helloworld.composite"); - List dcs = node.getStartedCompositeURIs("foo"); - Assert.assertEquals(0, dcs.size()); + node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null); + List dcs = node.startDeployables("foo"); + Assert.assertEquals(1, dcs.size()); + Map> dcsx = node.getStartedComposites(); + Assert.assertEquals(1, dcsx.size()); + node.stopComposite("foo", "helloworld.composite"); + dcsx = node.getStartedComposites(); + Assert.assertEquals(0, dcsx.size()); } @Test public void testInstallWithMetaData() throws ContributionReadException, ActivationException, ValidationException, NoSuchServiceException { Node node = TuscanyRuntime.newInstance().createNode("default"); - ((NodeImpl)node).installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", "src/test/resources/sca-contribution-generated.xml", null, true); + node.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", "src/test/resources/sca-contribution-generated.xml", null); + node.startComposite("helloworld", "helloworld.composite"); - List dcs = node.getStartedCompositeURIs("helloworld"); + Map> dcs = node.getStartedComposites(); Assert.assertEquals(1, dcs.size()); - Assert.assertEquals("helloworld.composite", dcs.get(0)); + Assert.assertEquals("helloworld", dcs.get("helloworld").get(0).getLocalPart()); Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); @@ -149,9 +163,9 @@ public class TuscanyRuntimeTestCase { Node node = TuscanyRuntime.runComposite("helloworld.composite", "src/test/resources/sample-helloworld.jar"); List cs = node.getInstalledContributionURIs(); Assert.assertEquals(1, cs.size()); - List dcs = node.getStartedCompositeURIs(cs.get(0)); + Map> dcs = node.getStartedComposites(); Assert.assertEquals(1, dcs.size()); - Assert.assertEquals("helloworld.composite", dcs.get(0)); + Assert.assertEquals("helloworld", dcs.get("sample-helloworld").get(0).getLocalPart()); } @Test @@ -159,29 +173,21 @@ public class TuscanyRuntimeTestCase { Node node = TuscanyRuntime.runComposite(null, "src/test/resources/sample-helloworld.jar"); List cs = node.getInstalledContributionURIs(); Assert.assertEquals(1, cs.size()); - List dcs = node.getStartedCompositeURIs(cs.get(0)); + Map> dcs = node.getStartedComposites(); Assert.assertEquals(1, dcs.size()); - Assert.assertEquals("helloworld.composite", dcs.get(0)); + Assert.assertEquals("helloworld", dcs.get("sample-helloworld").get(0).getLocalPart()); } @Test public void testRunComposite() throws NoSuchServiceException { Node node = TuscanyRuntime.runComposite("helloworld.composite", "src/test/resources/sample-helloworld.jar"); - try { Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - } finally { - node.stop(); - } } @Test public void testRunCompositeSharedRuntime() throws NoSuchServiceException { Node node = TuscanyRuntime.runComposite(URI.create("default"), "helloworld.composite", "src/test/resources/sample-helloworld.jar"); - try { Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent"); Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); - } finally { - node.stop(); - } } } diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java index 6205b26a8a..4de9215838 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java @@ -35,7 +35,8 @@ public class TwoNodesTestCase { @Test public void testInstallDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { Node node1 = TuscanyRuntime.newInstance().createNode("uri:TwoNodesTestCase?multicast=off&bind=127.0.0.1:44331"); - node1.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true); + node1.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null); + node1.startComposite("helloworld", "helloworld.composite"); Node node2 = TuscanyRuntime.newInstance().createNode("uri:TwoNodesTestCase?multicast=off&bind=127.0.0.1:44332&wka=127.0.0.1:44331"); -- cgit v1.2.3