diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-05-22 06:49:50 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-05-22 06:49:50 +0000 |
commit | 7250f4158b1bdfa9f82760cebf0269a40ad21acd (patch) | |
tree | 1ed38f22e8f58bdc5ae808cef35d2cd5b13ade84 /sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java | |
parent | 263ea309c7e5ca7d7e17e84b5186bfab3fbc90df (diff) |
Update with code to deploy composites, add getInstalledContributions and getDeployedComposites. Refactor code to have a separate DeployedComposite class
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@947252 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java')
-rw-r--r-- | sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java | 70 |
1 files changed, 50 insertions, 20 deletions
diff --git a/sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java b/sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java index 76bc7c066d..4fee3a07a4 100644 --- a/sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java +++ b/sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java @@ -19,36 +19,39 @@ package org.apache.tuscany.sca.something;
import java.net.MalformedURLException;
+import java.util.List;
+
+import junit.framework.Assert;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.runtime.ActivationException;
import org.junit.Test;
import org.oasisopen.sca.NoSuchDomainException;
import org.oasisopen.sca.NoSuchServiceException;
public class Section10TestCase {
-// @Test
-// public void testInstallDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException {
-// Section10 section10 = Section10Factory.createSection10();
-// section10.installContribution("src/test/resources/sample-helloworld.jar");
-//
-//// Helloworld helloworldService = section10.getService(Helloworld.class, "HelloworldComponent");
-//// Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
-// }
-//
-// @Test
-// public void testInstallWithDependent() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException {
-// Section10 section10 = Section10Factory.createSection10();
-// section10.installContribution("/Tuscany/svn/2.x-trunk/itest/T3558/src/test/resources/sample-store.jar");
-// section10.installContribution("/Tuscany/svn/2.x-trunk/itest/T3558/src/test/resources/sample-store-client.jar");
-//
-//// Helloworld helloworldService = section10.getService(Helloworld.class, "HelloworldComponent");
-//// Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
-// }
+ @Test
+ public void testInstallDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException {
+ Section10 section10 = Section10Factory.createSection10();
+ section10.installContribution("src/test/resources/sample-helloworld.jar");
+
+// Helloworld helloworldService = section10.getService(Helloworld.class, "HelloworldComponent");
+// Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
+ }
+
+ @Test
+ public void testInstallWithDependent() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException {
+ Section10 section10 = Section10Factory.createSection10();
+ section10.installContribution("/Tuscany/svn/2.x-trunk/itest/T3558/src/test/resources/sample-store.jar");
+ section10.installContribution("/Tuscany/svn/2.x-trunk/itest/T3558/src/test/resources/sample-store-client.jar");
+
+// Helloworld helloworldService = section10.getService(Helloworld.class, "HelloworldComponent");
+// Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
+ }
-// Doesnt work yet as addToDomainLevelComposite doesn't work
@Test
- public void testInstallNoDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException {
+ public void testInstallNoDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException {
Section10 section10 = Section10Factory.createSection10();
String contributionURI = section10.installContribution("src/test/resources/sample-helloworld-nodeployable.jar");
@@ -65,4 +68,31 @@ public class Section10TestCase { // Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
}
+ @Test
+ public void testGetInstalledContributions() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException {
+ Section10 section10 = Section10Factory.createSection10();
+ section10.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar");
+ List<String> ics = section10.getInstalledContributions();
+ Assert.assertEquals(1, ics.size());
+ Assert.assertEquals("foo", ics.get(0));
+ }
+
+ @Test
+ public void testGetDeployedCompostes() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException {
+ Section10 section10 = Section10Factory.createSection10();
+ section10.installContribution("foo", "src/test/resources/sample-helloworld.jar");
+ List<String> dcs = section10.getDeployedCompostes("foo");
+ Assert.assertEquals(1, dcs.size());
+ Assert.assertEquals("foo/helloworld.composite", dcs.get(0));
+ }
+
+ // @Test
+ public void testRemoveComposte() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException {
+ Section10 section10 = Section10Factory.createSection10();
+ section10.installContribution("foo", "src/test/resources/sample-helloworld.jar");
+ section10.removeFromDomainLevelComposite("foo/helloworld.composite");
+ List<String> dcs = section10.getDeployedCompostes("foo");
+ Assert.assertEquals(0, dcs.size());
+ }
+
}
|