diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-15 20:17:11 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-15 20:17:11 +0000 |
commit | 4e1be687f324ef95c463b5af3769fdc84ce1c858 (patch) | |
tree | 09a20c0dd3708ac129aeb787e779702d5149f397 /sca-java-2.x/trunk/modules/domain-node/src/test | |
parent | 38a5ed16a93072e74662c76b6089ed6e92e46d7d (diff) |
Update for the new ContributionListener, to support adding composites to a contribution, and so that any errors during peeking into a contribution are ignored
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1103533 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/domain-node/src/test')
-rw-r--r-- | sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java | 27 |
1 files changed, 27 insertions, 0 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 71912710a7..34f6b8760e 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 @@ -18,14 +18,17 @@ */
package org.apache.tuscany.sca.impl;
+import java.io.StringReader;
import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
import junit.framework.Assert;
import org.apache.tuscany.sca.TuscanyRuntime;
+import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.contribution.Contribution;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.monitor.ValidationException;
@@ -178,4 +181,28 @@ public class Node2TestCase { node.stopComposite("sample-helloworld", "helloworld.composite");
}
+ @Test
+ public void addDeploymentCompositeTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException {
+ NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("addDeploymentCompositeTest");
+ String curi = node.installContribution("src/test/resources/sample-helloworld.jar");
+
+ String compositeXML =
+ "<composite xmlns=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\""
+ + " xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.1\""
+ + " targetNamespace=\"http://test/composite\""
+ + " name=\"TestComposite\">"
+ + " <component name=\"TestComponent\">"
+ + " <implementation.java class=\"sample.HelloworldImpl\"/>"
+ + " </component>"
+ + "</composite>";
+ String compositeURI = node.addDeploymentComposite(curi, new StringReader(compositeXML));
+
+ node.startComposite(curi, compositeURI);
+ Assert.assertEquals(1, node.getStartedComposites().size());
+
+ Composite dc = node.getDomainComposite();
+ Assert.assertEquals(1, dc.getIncludes().size());
+ Composite runningComposite = dc.getIncludes().get(0);
+ Assert.assertEquals("TestComposite", runningComposite.getName().getLocalPart());
+ }
}
|