summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-05-13 14:41:29 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-05-13 14:41:29 +0000
commite0134ba6862381dc899d3f05d780aec9e582a162 (patch)
treeb9af8e52436f75680a0a4c481245ce72af256197 /sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany
parent40f3ad5b2d364b8594bfaac788ef184d07e92958 (diff)
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
Diffstat (limited to 'sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany')
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java47
1 files changed, 32 insertions, 15 deletions
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");
}
-
-
+
}