tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1133382 - 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/Node2TestCase.java test/resources/helloworld-invalidComposite.jar
Date Wed, 08 Jun 2011 13:04:07 GMT
Author: antelder
Date: Wed Jun  8 13:04:07 2011
New Revision: 1133382

URL: http://svn.apache.org/viewvc?rev=1133382&view=rev
Log:
Add a test with a contribution containing an invalid composite and update the code to not
fail with that

Added:
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/helloworld-invalidComposite.jar
  (with props)
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/Node2TestCase.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=1133382&r1=1133381&r2=1133382&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
Wed Jun  8 13:04:07 2011
@@ -302,7 +302,9 @@ public class NodeImpl implements Node {
         if (contribution == null) {
             Monitor monitor = deployer.createMonitor();
             contribution = deployer.loadContribution(IOHelper.createURI(cd.getURI()), IOHelper.getLocationAsURL(cd.getURL()),
monitor);
-            monitor.analyzeProblems();
+            
+            // TODO: should the monitor be checked? If it is then the peek in to get the
metadata doesn't work if there's a problem 
+            // monitor.analyzeProblems();
             if (cd.getAdditionalDeployables().size() > 0) {
                 for (String uri : cd.getAdditionalDeployables().keySet()) {
                     String compositeXML = cd.getAdditionalDeployables().get(uri);

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java?rev=1133382&r1=1133381&r2=1133382&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java
Wed Jun  8 13:04:07 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.tuscany.sca.impl;
 
+import java.io.Reader;
 import java.io.StringReader;
 import java.util.List;
 import java.util.Map;
@@ -251,4 +252,38 @@ public class Node2TestCase {
         Composite runningComposite = dc.getIncludes().get(0);
         Assert.assertEquals("TestComposite", runningComposite.getName().getLocalPart());
     }
+
+    @Test
+    public void invalidCompositeStartTest() throws NoSuchServiceException, NoSuchDomainException,
ContributionReadException, ActivationException, ValidationException, XMLStreamException {
+        Node node = TuscanyRuntime.newInstance().createNode("invalidCompositeStartTest");
+        String curi = node.installContribution("src/test/resources/helloworld-invalidComposite.jar");
+        Assert.assertEquals(1, node.getInstalledContributionURIs().size());
+        Assert.assertEquals(0, node.getStartedCompositeURIs().size());
+        ContributionDescription cd = node.getInstalledContribution(curi);
+        Assert.assertEquals(1, cd.getDeployables().size());
+        
+        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);
+
+//        node.startComposite("sample-helloworld", "helloworld.composite");
+//        Assert.assertEquals(1, node.getStartedCompositeURIs().size());
+//        Assert.assertEquals("helloworld.composite", node.getStartedCompositeURIs().get("sample-helloworld").get(0));
+//        
+//        node.stopComposite("sample-helloworld", "helloworld.composite");
+////        Assert.assertEquals(0, node.getStartedComposites().size());
+//        node.startComposite("sample-helloworld", "helloworld.composite");
+//        Assert.assertEquals(1, node.getStartedCompositeURIs().size());
+//        Assert.assertEquals("helloworld.composite", node.getStartedCompositeURIs().get("sample-helloworld").get(0));
+//        node.stopComposite("sample-helloworld", "helloworld.composite");
+    }
+
 }

Added: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/helloworld-invalidComposite.jar
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/helloworld-invalidComposite.jar?rev=1133382&view=auto
==============================================================================
Binary file - no diff available.

Propchange: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/helloworld-invalidComposite.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message