From 221db4662021e7f5c7e5cf64b127fdff8ccda8ff Mon Sep 17 00:00:00 2001 From: antelder Date: Sun, 19 Jun 2011 06:37:19 +0000 Subject: Add another test for recursive composites git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1137302 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/impl/UsedCompositesTestCase.java | 29 +++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'sca-java-2.x/trunk/modules/domain-node/src/test/java') 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 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 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 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")); } } -- cgit v1.2.3