From e0134ba6862381dc899d3f05d780aec9e582a162 Mon Sep 17 00:00:00 2001 From: antelder Date: Fri, 13 May 2011 14:41:29 +0000 Subject: Add code for handling import/export better, imports now work when the exporting contribution is installed on a distributed remote node, woohoo. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1102763 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tuscany/sca/impl/Node2TestCase.java | 47 +++++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-) (limited to 'sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany') 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 5450682136..fdfb0b2028 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 @@ -77,7 +77,7 @@ public class Node2TestCase { InstalledContribution ic = nodeB.getInstalledContribution("export"); Assert.assertEquals(1, ic.getJavaExports().size()); - Assert.assertEquals("foo", ic.getJavaExports().get(0)); + Assert.assertEquals("sample", ic.getJavaExports().get(0)); } @Test @@ -103,7 +103,7 @@ public class Node2TestCase { InstalledContribution ic = node.getInstalledContribution("export"); Assert.assertEquals(1, ic.getJavaExports().size()); - Assert.assertEquals("foo", ic.getJavaExports().get(0)); + Assert.assertEquals("sample", ic.getJavaExports().get(0)); } @Test @@ -120,20 +120,38 @@ public class Node2TestCase { try { node.validateContribution("import"); } catch (ValidationException e) { - Assert.assertTrue(e.getMessage().endsWith("Unresolved import: Import = foo")); + Assert.assertTrue(e.getMessage().endsWith("Unresolved import: Import = sample")); } } -// @Test -// public void importExportValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { -// NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase"); -// node.installContribution("src/test/resources/import.jar"); -// try { -// node.validateContribution("import"); -// } catch (ValidationException e) { -// Assert.assertTrue(e.getMessage().endsWith("Unresolved import: Import = foo")); -// } -// } + @Test + public void importExportValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { + NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase"); + node.installContribution("src/test/resources/import.jar"); + try { + node.validateContribution("import"); + } catch (ValidationException e) { + // expected + } + node.installContribution("src/test/resources/export.jar"); + node.validateContribution("import"); + node.startComposite("import", "helloworld.composite"); + } + + @Test + public void importExportDistributedValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { + NodeImpl2 nodeA = TuscanyRuntime.newInstance().createNode2("uri:ImportTestCase"); + nodeA.installContribution("src/test/resources/import.jar"); + try { + nodeA.validateContribution("import"); + } catch (ValidationException e) { + // expected + } + NodeImpl2 nodeB = TuscanyRuntime.newInstance().createNode2("uri:ImportTestCase"); + nodeB.installContribution("src/test/resources/export.jar"); + nodeA.validateContribution("import"); + nodeA.startComposite("import", "helloworld.composite"); + } @Test public void startTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { @@ -152,6 +170,5 @@ public class Node2TestCase { Assert.assertEquals("helloworld", node.getStartedComposites().get("sample-helloworld").get(0).getLocalPart()); node.stopComposite("sample-helloworld", "helloworld.composite"); } - - + } -- cgit v1.2.3