tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1137311 - in /tuscany/sca-java-2.x/trunk/modules/domain-node/src: main/java/org/apache/tuscany/sca/impl/NodeImpl.java test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java
Date Sun, 19 Jun 2011 07:44:31 GMT
Author: antelder
Date: Sun Jun 19 07:44:31 2011
New Revision: 1137311

URL: http://svn.apache.org/viewvc?rev=1137311&view=rev
Log:
Update contribution update to handle additional deployed composites and a testcase for that

Modified:
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java?rev=1137311&r1=1137310&r2=1137311&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
Sun Jun 19 07:44:31 2011
@@ -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);
             }
         }
 

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java?rev=1137311&r1=1137310&r2=1137311&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/ContributionUpdateTestCase.java
Sun Jun 19 07:44:31 2011
@@ -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());
+    }
+
 }



Mime
View raw message