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:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-05-21 07:11:35 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-05-21 07:11:35 +0000
commit8ee0725aa706eaa4f30316bcbd010365f455a32f (patch)
tree25beae4a5eed0daaf596545e9d959fbb3da2644a /sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java
parent5d0c1a742830af6063d2899ad576284028f4e581 (diff)
Add start of a basic impl using Node to install contributions. Not much works yet but the helloworld type testcase does run
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@946913 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java72
1 files changed, 72 insertions, 0 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
new file mode 100644
index 0000000000..9838b065a6
--- /dev/null
+++ b/sca-java-2.x/contrib/modules/section10/src/test/java/org/apache/tuscany/sca/something/Section10TestCase.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+package org.apache.tuscany.sca.something;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.oasisopen.sca.NoSuchDomainException;
+import org.oasisopen.sca.NoSuchServiceException;
+import org.oasisopen.sca.client.SCAClientFactory;
+
+import sample.Helloworld;
+
+public class Section10TestCase {
+
+ @Test
+ public void testInstallDeployable() throws NoSuchServiceException, NoSuchDomainException {
+ Section10 section10 = Section10Factory.createSection10();
+ section10.installContribution("src/test/resources/sample-helloworld.jar");
+
+ SCAClientFactory scaClientFactory = section10.getSCAClientFactory();
+ Helloworld helloworldService = scaClientFactory.getService(Helloworld.class, "HelloworldComponent");
+ Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
+ }
+
+ @Test
+ public void testInstallWithDependent() throws NoSuchServiceException, NoSuchDomainException {
+ 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");
+
+ SCAClientFactory scaClientFactory = section10.getSCAClientFactory();
+ Helloworld helloworldService = scaClientFactory.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 {
+// Section10 section10 = Section10Factory.createSection10();
+// String contributionURI = section10.installContribution("src/test/resources/sample-helloworld-nodeployable.jar");
+//
+// SCAClientFactory scaClientFactory = section10.getSCAClientFactory();
+// try {
+// scaClientFactory.getService(Helloworld.class, "HelloworldComponent");
+// Assert.fail();
+// } catch (NoSuchServiceException e) {
+// // expected as there is no deployables
+// }
+//
+// section10.addToDomainLevelComposite(contributionURI + "/helloworld.composite");
+// Helloworld helloworldService = scaClientFactory.getService(Helloworld.class, "HelloworldComponent");
+// Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
+// }
+
+}