summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java
diff options
context:
space:
mode:
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.java70
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());
+ }
+
}