summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-19 07:44:31 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-19 07:44:31 +0000
commite0d0f979b56b452bf01ea99e14f8037c633942ae (patch)
treeb195cb1ac65a87252d2d64cb4662280c52caf912 /sca-java-2.x/trunk/modules
parent82d2e8d40f5b562b13faba064cf2b5323343e2ae (diff)
Update contribution update to handle additional deployed composites and a testcase for that
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1137311 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java14
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java20
2 files changed, 31 insertions, 3 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
index 619ec985ab..2614845945 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
@@ -119,15 +119,23 @@ public class NodeImpl implements Node {
uninstallContribution(uri);
installContribution(uri, contributionURL, metaDataURL, dependentContributionURIs);
+
+ // merge in additional deployables
+ if (ic.getAdditionalDeployables().size() > 0) {
+ ContributionDescription newIC = getInstalledContribution(uri);
+ newIC.getAdditionalDeployables().putAll(ic.getAdditionalDeployables());
+ domainRegistry.updateInstalledContribution(newIC);
+ }
// stop/start all started composites using the contribution
for (DeployedComposite dc : new ArrayList<DeployedComposite>(startedComposites.values())) {
if (dc.getContributionURIs().contains(uri)) {
+ String dcContributionURI = dc.getContributionURIs().get(0);
String dcCompositeURI = dc.getURI();
- stopComposite(uri, dcCompositeURI);
- String key = uri + "/" + dcCompositeURI;
+ stopComposite(dcContributionURI, dcCompositeURI);
+ String key = dcContributionURI + "/" + dcCompositeURI;
stoppedComposites.remove(key);
- startComposite(uri, dcCompositeURI);
+ startComposite(dcContributionURI, dcCompositeURI);
}
}
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java
index 105f9c71c8..f270eb3f23 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.impl;
import java.io.FileNotFoundException;
+import java.io.FileReader;
import java.util.Collection;
import javax.xml.stream.XMLStreamException;
@@ -52,4 +53,23 @@ public class ContributionUpdateTestCase {
Assert.assertEquals(1, eps.size());
Assert.assertEquals("Helloworld2Component#service-binding(Helloworld/Helloworld)", eps.iterator().next().getURI());
}
+
+ @Test
+ public void updateWithAdditionalDeployablesTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException, FileNotFoundException {
+ Node node = TuscanyRuntime.newInstance().createNode("updateWithAdditionalDeployablesTest");
+ String curi = node.installContribution("src/test/resources/sample-helloworld.jar");
+ String compURI = node.addDeploymentComposite(curi, new FileReader("src/test/resources/helloworld2.composite"));
+ node.startComposite(curi, compURI);
+
+ Collection<Endpoint> eps = ((NodeImpl)node).getEndpointRegistry().getEndpoints();
+ Assert.assertEquals(1, eps.size());
+ Assert.assertEquals("Helloworld2Component#service-binding(Helloworld/Helloworld)", eps.iterator().next().getURI());
+
+ ((NodeImpl)node).updateContribution(curi, "src/test/resources/sample-helloworld.jar", null, null);
+
+ eps = ((NodeImpl)node).getEndpointRegistry().getEndpoints();
+ Assert.assertEquals(1, eps.size());
+ Assert.assertEquals("Helloworld2Component#service-binding(Helloworld/Helloworld)", eps.iterator().next().getURI());
+ }
+
}