summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-01-12 08:56:52 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-01-12 08:56:52 +0000
commit9a4d83faf250efb00160c20c05fb727ad92c555c (patch)
treea249e7ad5933517b6f1f6c0c239547289a62e2b9 /sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca
parente30d27ecbcbfa0c5f08299af755a38f2c2365db0 (diff)
Update to create a service proxy directly instead of using the sca client factory api and update testcases for that, and rename package
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1058025 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca')
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/DeployerTestCase.java2
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeTestCase.java63
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeXMLTestCase.java2
3 files changed, 48 insertions, 19 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/DeployerTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/DeployerTestCase.java
index 40509337c8..6d4467a895 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/DeployerTestCase.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/DeployerTestCase.java
@@ -34,6 +34,8 @@ import org.apache.tuscany.sca.deployment.Deployer;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.ValidationException;
import org.apache.tuscany.sca.runtime.ActivationException;
+import org.apache.tuscany.sca.runtime.Node;
+import org.apache.tuscany.sca.runtime.NodeFactory;
import org.junit.Test;
import org.oasisopen.sca.NoSuchDomainException;
import org.oasisopen.sca.NoSuchServiceException;
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeTestCase.java
index 6637f05979..2fd1cb7a4e 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeTestCase.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeTestCase.java
@@ -25,13 +25,17 @@ import junit.framework.Assert;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.monitor.ValidationException;
-import org.apache.tuscany.sca.node2.impl.NodeImpl;
import org.apache.tuscany.sca.runtime.ActivationException;
+import org.apache.tuscany.sca.runtime.Node;
+import org.apache.tuscany.sca.runtime.NodeFactory;
+import org.apache.tuscany.sca.runtime.impl.NodeImpl;
import org.junit.Ignore;
import org.junit.Test;
import org.oasisopen.sca.NoSuchDomainException;
import org.oasisopen.sca.NoSuchServiceException;
+import sample.Helloworld;
+
public class NodeTestCase {
@Test
@@ -39,8 +43,30 @@ public class NodeTestCase {
Node node = NodeFactory.newInstance().createNode("default");
node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true);
-// Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
-// Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
+ Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
+ Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
+ }
+
+ @Test
+ public void testStopStart() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
+ Node node = NodeFactory.newInstance().createNode("default");
+ node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true);
+ String ci = node.getStartedCompositeURIs("helloworld").get(0);
+
+ Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
+ Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
+
+ node.stop("helloworld", ci);
+ try {
+ node.getService(Helloworld.class, "HelloworldComponent");
+ Assert.fail();
+ } catch (NoSuchServiceException e) {
+ // expected as there is no deployables
+ }
+
+ node.start("helloworld", ci);
+ helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
+ Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
}
@Test
@@ -50,8 +76,8 @@ public class NodeTestCase {
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);
-// Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
-// Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
+ Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
+ Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
}
@Test
@@ -59,17 +85,16 @@ public class NodeTestCase {
Node node = NodeFactory.newInstance().createNode("default");
node.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true);
-// SCAClientFactory scaClientFactory = node.getSCAClientFactory();
-// try {
-// scaClientFactory.getService(Helloworld.class, "HelloworldComponent");
-// Assert.fail();
-// } catch (NoSuchServiceException e) {
-// // expected as there is no deployables
-// }
+ try {
+ node.getService(Helloworld.class, "HelloworldComponent");
+ Assert.fail();
+ } catch (NoSuchServiceException e) {
+ // expected as there is no deployables
+ }
node.start("helloworld", "helloworld.composite");
-// Helloworld helloworldService = scaClientFactory.getService(Helloworld.class, "HelloworldComponent");
-// Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
+ Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
+ Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
}
@Test
@@ -100,7 +125,7 @@ public class NodeTestCase {
}
@Test
- public void testInstallWithMetaData() throws ContributionReadException, ActivationException, ValidationException {
+ public void testInstallWithMetaData() throws ContributionReadException, ActivationException, ValidationException, NoSuchServiceException {
Node node = NodeFactory.newInstance().createNode("default");
((NodeImpl)node).installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", "src/test/resources/sca-contribution-generated.xml", null, true);
@@ -108,8 +133,8 @@ public class NodeTestCase {
Assert.assertEquals(1, dcs.size());
Assert.assertEquals("helloworld.composite", dcs.get(0));
-// Helloworld helloworldService = scaClientFactory.getService(Helloworld.class, "HelloworldComponent");
-// Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
+ Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
+ Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
}
@Test
@@ -121,7 +146,7 @@ public class NodeTestCase {
@Test
public void testStaticCreate() {
- Node node = NodeFactory.newStandaloneNode("helloworld.composite", "src/test/resources/sample-helloworld.jar");
+ Node node = NodeFactory.createStandaloneNode("helloworld.composite", "src/test/resources/sample-helloworld.jar");
List<String> cs = node.getInstalledContributionURIs();
Assert.assertEquals(1, cs.size());
List<String> dcs = node.getStartedCompositeURIs(cs.get(0));
@@ -131,7 +156,7 @@ public class NodeTestCase {
@Test
public void testStaticCreateWithNullComposite() {
- Node node = NodeFactory.newStandaloneNode(null, "src/test/resources/sample-helloworld.jar");
+ Node node = NodeFactory.createStandaloneNode(null, "src/test/resources/sample-helloworld.jar");
List<String> cs = node.getInstalledContributionURIs();
Assert.assertEquals(1, cs.size());
List<String> dcs = node.getStartedCompositeURIs(cs.get(0));
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeXMLTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeXMLTestCase.java
index 5e265a0c8a..694b0b6f6a 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeXMLTestCase.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeXMLTestCase.java
@@ -25,6 +25,8 @@ import junit.framework.Assert;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.monitor.ValidationException;
import org.apache.tuscany.sca.runtime.ActivationException;
+import org.apache.tuscany.sca.runtime.Node;
+import org.apache.tuscany.sca.runtime.NodeFactory;
import org.junit.Test;
public class NodeXMLTestCase {