summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-19 06:37:19 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-19 06:37:19 +0000
commit221db4662021e7f5c7e5cf64b127fdff8ccda8ff (patch)
tree3534752554aed830761e8e3626d87f62fef7db13 /sca-java-2.x
parent980d972a9ea92a13b11c6f1896d467c7a6ac4c46 (diff)
Add another test for recursive composites
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1137302 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x')
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/UsedCompositesTestCase.java29
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/helloworld2.jarbin0 -> 5620 bytes
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/nested.composite28
3 files changed, 51 insertions, 6 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/UsedCompositesTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/UsedCompositesTestCase.java
index 9c1a70bde5..b5c24c4450 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/UsedCompositesTestCase.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/UsedCompositesTestCase.java
@@ -29,6 +29,7 @@ import org.apache.tuscany.sca.TuscanyRuntime;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.monitor.ValidationException;
import org.apache.tuscany.sca.runtime.ActivationException;
+import org.junit.Assert;
import org.junit.Test;
import org.oasisopen.sca.NoSuchDomainException;
import org.oasisopen.sca.NoSuchServiceException;
@@ -36,7 +37,7 @@ import org.oasisopen.sca.NoSuchServiceException;
public class UsedCompositesTestCase {
@Test
- public void UsedTest1() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException, FileNotFoundException {
+ public void includeTest1() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException, FileNotFoundException {
Node node = TuscanyRuntime.newInstance().createNode("localTest");
String curi = node.installContribution("src/test/resources/sample-helloworld.jar");
String compositeURI = node.addDeploymentComposite(curi, new FileReader("src/test/resources/include.composite"));
@@ -44,11 +45,11 @@ public class UsedCompositesTestCase {
node.startComposite(curi, compositeURI);
List<String> xs = ((NodeImpl)node).updateUsingComposites(curi, "helloworld.composite");
- System.out.println(xs);
-// Assert.assertEquals(",mn,mn", s.doit("xyz"));
+ Assert.assertEquals(1, xs.size());
+ Assert.assertEquals("sample-helloworld/include.composite", xs.get(0));
}
@Test
- public void UsedTest2() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException, FileNotFoundException {
+ public void implCompositeTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException, FileNotFoundException {
Node node = TuscanyRuntime.newInstance().createNode("localTest");
String curi = node.installContribution("src/test/resources/sample-helloworld.jar");
String compositeURI = node.addDeploymentComposite(curi, new FileReader("src/test/resources/compositeImpl.composite"));
@@ -56,7 +57,23 @@ public class UsedCompositesTestCase {
node.startComposite(curi, compositeURI);
List<String> xs = ((NodeImpl)node).updateUsingComposites(curi, "helloworld.composite");
- System.out.println(xs);
-// Assert.assertEquals(",mn,mn", s.doit("xyz"));
+ Assert.assertEquals(1, xs.size());
+ Assert.assertEquals("sample-helloworld/compositeImpl.composite", xs.get(0));
+ }
+
+ @Test
+ public void nestedTest1() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException, FileNotFoundException {
+ Node node = TuscanyRuntime.newInstance().createNode("NestedTest");
+ String curi = node.installContribution("src/test/resources/helloworld2.jar");
+
+ node.startComposite(curi, "compositeImpl.composite");
+
+ String compositeURI = node.addDeploymentComposite(curi, new FileReader("src/test/resources/nested.composite"));
+ node.startComposite(curi, compositeURI);
+
+ List<String> xs = ((NodeImpl)node).updateUsingComposites(curi, "helloworld.composite");
+ Assert.assertEquals(2, xs.size());
+ Assert.assertTrue(xs.contains("helloworld2/compositeImpl.composite"));
+ Assert.assertTrue(xs.contains("helloworld2/nested.composite"));
}
}
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/helloworld2.jar b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/helloworld2.jar
new file mode 100644
index 0000000000..2f8e473cd0
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/helloworld2.jar
Binary files differ
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/nested.composite b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/nested.composite
new file mode 100644
index 0000000000..1c31941a83
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/nested.composite
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:sample="http://sample"
+ targetNamespace="http://sample"
+ name="nested">
+
+ <include name="sample:compositeImpl" />
+
+</composite>