summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/node2-impl/src/test
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-08-18 19:59:14 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-08-18 19:59:14 +0000
commit400713c5c4c89dfcc7e77f502003af63e1098c15 (patch)
tree1965c0b682d58f90155c1b0e27ecb0a2d35659d7 /java/sca/modules/node2-impl/src/test
parent9baa2dd9ba3cb463b412ea874058a93b00b1dfde (diff)
Fix the webapp regression where the no explicit deployable composite is passed into the Node API
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@686861 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/node2-impl/src/test')
-rw-r--r--java/sca/modules/node2-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java51
-rw-r--r--java/sca/modules/node2-impl/src/test/resources/META-INF/sca-contribution.xml23
2 files changed, 56 insertions, 18 deletions
diff --git a/java/sca/modules/node2-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java b/java/sca/modules/node2-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java
index bdf3dfca4f..38fe211e7d 100644
--- a/java/sca/modules/node2-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java
+++ b/java/sca/modules/node2-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java
@@ -48,24 +48,33 @@ public class NodeImplTestCase {
@Test
public void testNodeWithCompositeContent() {
SCANode2Factory factory = new NodeFactoryImpl();
- SCAContribution contribution = new SCAContribution("c1", new File("target/classes").toURI().toString());
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
SCANode2 node = factory.createSCANode("HelloWorld.composite", composite, contribution);
- node.start();
- HelloWorld hw = ((SCAClient)node).getService(HelloWorld.class, "HelloWorld");
- Assert.assertEquals("Hello, Node", hw.hello("Node"));
- node.stop();
+ testNode(node);
}
+
+ @Test
+ public void testNodeWithCompositeContentAndNoContribution() {
+ SCANode2Factory factory = new NodeFactoryImpl();
+ SCANode2 node = factory.createSCANode("HelloWorld.composite", composite);
+ testNode(node);
+ }
@Test
+ public void testNodeWithoutCompositeURI() {
+ SCANode2Factory factory = new NodeFactoryImpl();
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
+ SCANode2 node = factory.createSCANode(null, contribution);
+ testNode(node);
+ }
+
+ @Test
public void testNodeWithCompositeURI() {
SCANode2Factory factory = new NodeFactoryImpl();
- SCAContribution contribution = new SCAContribution("c1", new File("target/classes").toURI().toString());
+ SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
String compositeURI = new File("target/test-classes/HelloWorld.composite").toURI().toString();
SCANode2 node = factory.createSCANode(compositeURI, contribution);
- node.start();
- HelloWorld hw = ((SCAClient)node).getService(HelloWorld.class, "HelloWorld");
- Assert.assertEquals("Hello, Node", hw.hello("Node"));
- node.stop();
+ testNode(node);
}
@Test
@@ -74,10 +83,7 @@ public class NodeImplTestCase {
SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
String compositeURI = "HelloWorld.composite";
SCANode2 node = factory.createSCANode(compositeURI, contribution);
- node.start();
- HelloWorld hw = ((SCAClient)node).getService(HelloWorld.class, "HelloWorld");
- Assert.assertEquals("Hello, Node", hw.hello("Node"));
- node.stop();
+ testNode(node);
}
@Test
@@ -85,10 +91,7 @@ public class NodeImplTestCase {
SCANode2Factory factory = new NodeFactoryImpl();
String compositeURI = "HelloWorld.composite";
SCANode2 node = factory.createSCANode(compositeURI, new SCAContribution[0]);
- node.start();
- HelloWorld hw = ((SCAClient)node).getService(HelloWorld.class, "HelloWorld");
- Assert.assertEquals("Hello, Node", hw.hello("Node"));
- node.stop();
+ testNode(node);
}
@Test
@@ -96,9 +99,21 @@ public class NodeImplTestCase {
SCANode2Factory factory = new NodeFactoryImpl();
String compositeURI = "HelloWorld.composite";
SCANode2 node = factory.createSCANodeFromClassLoader(compositeURI, HelloWorld.class.getClassLoader());
+ testNode(node);
+ }
+
+ @Test
+ public void testNodeWithClassLoaderAndNullComposite() {
+ SCANode2Factory factory = new NodeFactoryImpl();
+ SCANode2 node = factory.createSCANodeFromClassLoader(null, HelloWorld.class.getClassLoader());
+ testNode(node);
+ }
+
+ private void testNode(SCANode2 node) {
node.start();
HelloWorld hw = ((SCAClient)node).getService(HelloWorld.class, "HelloWorld");
Assert.assertEquals("Hello, Node", hw.hello("Node"));
node.stop();
}
+
}
diff --git a/java/sca/modules/node2-impl/src/test/resources/META-INF/sca-contribution.xml b/java/sca/modules/node2-impl/src/test/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..1d37bcebe0
--- /dev/null
+++ b/java/sca/modules/node2-impl/src/test/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+-->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:sc="http://sample/composite">
+ <deployable composite="sc:HelloWorld" />
+</contribution>