From ed4ec30a0b7ac58429052c16ace943fe5c29c19a Mon Sep 17 00:00:00 2001 From: antelder Date: Fri, 4 Jun 2010 15:48:25 +0000 Subject: Add support for generated sca-contribution.xml metadata git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@951457 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/something/DeployerTestCase.java | 3 +-- .../tuscany/sca/something/Section10TestCase.java | 27 ++++++++++++++++------ .../test/resources/sca-contribution-generated.xml | 23 ++++++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 sca-java-2.x/trunk/modules/domain/src/test/resources/sca-contribution-generated.xml (limited to 'sca-java-2.x/trunk/modules/domain/src/test') diff --git a/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java b/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java index 9cac4a1e28..b07a70b950 100644 --- a/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java +++ b/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java @@ -28,7 +28,6 @@ import javax.xml.stream.XMLStreamException; import junit.framework.Assert; import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.contribution.Artifact; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.deployment.Deployer; @@ -60,7 +59,7 @@ public class DeployerTestCase { public void testAddDeploymentComposite() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException, XMLStreamException { Section10 section10 = Section10Factory.createSection10(); - section10.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, true); + section10.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true); Deployer deployer = section10.getDeployer(); Monitor monitor = deployer.createMonitor(); diff --git a/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java b/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java index efd0ec9143..e0ec581157 100644 --- a/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java +++ b/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java @@ -26,6 +26,7 @@ import junit.framework.Assert; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.monitor.ValidationException; import org.apache.tuscany.sca.runtime.ActivationException; +import org.apache.tuscany.sca.something.impl.Section10Impl; import org.junit.Ignore; import org.junit.Test; import org.oasisopen.sca.NoSuchDomainException; @@ -36,7 +37,7 @@ public class Section10TestCase { @Test public void testInstallDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { Section10 section10 = Section10Factory.createSection10(); - section10.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, true); + section10.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true); // Helloworld helloworldService = section10.getService(Helloworld.class, "HelloworldComponent"); // Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); @@ -46,8 +47,8 @@ public class Section10TestCase { @Test public void testInstallWithDependent() throws NoSuchServiceException, ContributionReadException, ActivationException, ValidationException { Section10 section10 = Section10Factory.createSection10(); - section10.installContribution("store", "/Tuscany/svn/2.x-trunk/itest/T3558/src/test/resources/sample-store.jar", null, true); - section10.installContribution("store-client", "/Tuscany/svn/2.x-trunk/itest/T3558/src/test/resources/sample-store-client.jar", null, true); + section10.installContribution("store", "/Tuscany/svn/2.x-trunk/itest/T3558/src/test/resources/sample-store.jar", null, null, true); + section10.installContribution("store-client", "/Tuscany/svn/2.x-trunk/itest/T3558/src/test/resources/sample-store-client.jar", null, null, true); // Helloworld helloworldService = section10.getService(Helloworld.class, "HelloworldComponent"); // Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); @@ -56,7 +57,7 @@ public class Section10TestCase { @Test public void testInstallNoDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { Section10 section10 = Section10Factory.createSection10(); - section10.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", null, true); + section10.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true); // SCAClientFactory scaClientFactory = section10.getSCAClientFactory(); // try { @@ -74,7 +75,7 @@ public class Section10TestCase { @Test public void testGetInstalledContributions() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { Section10 section10 = Section10Factory.createSection10(); - section10.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, true); + section10.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true); List ics = section10.getInstalledContributions(); Assert.assertEquals(1, ics.size()); Assert.assertEquals("foo", ics.get(0)); @@ -83,7 +84,7 @@ public class Section10TestCase { @Test public void testGetDeployedCompostes() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException { Section10 section10 = Section10Factory.createSection10(); - section10.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, true); + section10.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null, true); List dcs = section10.getDeployedCompostes("foo"); Assert.assertEquals(1, dcs.size()); Assert.assertEquals("foo/helloworld.composite", dcs.get(0)); @@ -92,10 +93,22 @@ public class Section10TestCase { @Test public void testRemoveComposte() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException { Section10 section10 = Section10Factory.createSection10(); - section10.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, true); + section10.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null, true); section10.removeFromDomainLevelComposite("foo/helloworld.composite"); List dcs = section10.getDeployedCompostes("foo"); Assert.assertEquals(0, dcs.size()); } + @Test + public void testInstallWithMetaData() throws ContributionReadException, ActivationException, ValidationException { + Section10 section10 = Section10Factory.createSection10(); + ((Section10Impl)section10).installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", "src/test/resources/sca-contribution-generated.xml", null, true); + + List dcs = section10.getDeployedCompostes("helloworld"); + Assert.assertEquals(1, dcs.size()); + Assert.assertEquals("helloworld/helloworld.composite", dcs.get(0)); + +// Helloworld helloworldService = scaClientFactory.getService(Helloworld.class, "HelloworldComponent"); +// Assert.assertEquals("Hello petra", helloworldService.sayHello("petra")); + } } diff --git a/sca-java-2.x/trunk/modules/domain/src/test/resources/sca-contribution-generated.xml b/sca-java-2.x/trunk/modules/domain/src/test/resources/sca-contribution-generated.xml new file mode 100644 index 0000000000..5b3d81cb97 --- /dev/null +++ b/sca-java-2.x/trunk/modules/domain/src/test/resources/sca-contribution-generated.xml @@ -0,0 +1,23 @@ + + + + + -- cgit v1.2.3