From 4e1be687f324ef95c463b5af3769fdc84ce1c858 Mon Sep 17 00:00:00 2001 From: antelder Date: Sun, 15 May 2011 20:17:11 +0000 Subject: 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 --- .../org/apache/tuscany/sca/impl/Node2TestCase.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'sca-java-2.x/trunk/modules/domain-node/src/test') 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 = + "" + + " " + + " " + + " " + + ""; + 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()); + } } -- cgit v1.2.3