tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1238664 - in /tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api: pom.xml src/main/java/itest/SingleServiceImpl.java src/main/resources/Helloworld.composite src/test/java/test/scaclient/SCAClientTestCase.java
Date Tue, 31 Jan 2012 15:26:36 GMT
Author: antelder
Date: Tue Jan 31 15:26:35 2012
New Revision: 1238664

URL: http://svn.apache.org/viewvc?rev=1238664&view=rev
Log:
Add a few more tests for components with multiple services or bindings

Added:
    tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/main/java/itest/SingleServiceImpl.java
Modified:
    tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/pom.xml
    tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/main/resources/Helloworld.composite
    tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java

Modified: tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/pom.xml?rev=1238664&r1=1238663&r2=1238664&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/pom.xml Tue Jan 31 15:26:35 2012
@@ -35,5 +35,20 @@
             <type>pom</type>
             <version>2.0-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-rmi-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-ws-runtime-axis2</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-jetty</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 </project>

Added: tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/main/java/itest/SingleServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/main/java/itest/SingleServiceImpl.java?rev=1238664&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/main/java/itest/SingleServiceImpl.java
(added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/main/java/itest/SingleServiceImpl.java
Tue Jan 31 15:26:35 2012
@@ -0,0 +1,34 @@
+/*
+ * 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 itest;
+
+import org.oasisopen.sca.annotation.EagerInit;
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.Service;
+
+@EagerInit
+@Scope("COMPOSITE")
+@Service(HelloworldService.class)
+public class SingleServiceImpl implements HelloworldService {
+
+    public String sayHello(String name) {
+        return "Hello " + name;
+    }
+
+}

Modified: tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/main/resources/Helloworld.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/main/resources/Helloworld.composite?rev=1238664&r1=1238663&r2=1238664&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/main/resources/Helloworld.composite
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/main/resources/Helloworld.composite
Tue Jan 31 15:26:35 2012
@@ -26,4 +26,24 @@
         <implementation.java class="itest.HelloworldServiceImpl"/>
     </component>
 
+    <component name="SingleServiceComponent">
+        <implementation.java class="itest.SingleServiceImpl"/>
+    </component>
+
+    <component name="OnlyWSBindingComponent">
+        <implementation.java class="itest.HelloworldServiceImpl"/>
+        <service name="RemoteHelloworldService">
+           <binding.ws />
+        </service>           
+    </component>
+
+    <component name="MultipleBindingsComponent">
+        <implementation.java class="itest.HelloworldServiceImpl"/>
+        <service name="RemoteHelloworldService">
+           <binding.ws name="ws" />
+           <binding.sca />
+           <tuscany:binding.rmi name="rmi" />
+        </service>           
+    </component>
+
 </composite>

Modified: tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java?rev=1238664&r1=1238663&r2=1238664&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java
Tue Jan 31 15:26:35 2012
@@ -31,6 +31,7 @@ import org.apache.tuscany.sca.node.NodeF
 import org.junit.Test;
 import org.oasisopen.sca.NoSuchDomainException;
 import org.oasisopen.sca.NoSuchServiceException;
+import org.oasisopen.sca.ServiceRuntimeException;
 import org.oasisopen.sca.client.SCAClientFactory;
 
 /**
@@ -71,15 +72,29 @@ public class SCAClientTestCase extends T
         assertEquals("Hello petra", service.sayHello("petra"));
     }
 
-//    @Test
-//    public void testWithoutServiceName() throws Exception {
-//        node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[]
{"target/classes"});
-//        node.start();
-//
-//        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain"));
-//        HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent");
-//        assertEquals("Hello petra", service.sayHello("petra"));
-//    }
+    @Test
+    public void testWithoutServiceName() throws Exception {
+        node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[]
{"target/classes"});
+        node.start();
+
+        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain"));
+        try {
+            clientFactory.getService(HelloworldService.class, "HelloworldComponent");
+            fail("expecting ServiceRuntimeException");
+        } catch (ServiceRuntimeException e) {
+            assertTrue(e.getMessage().contains("More than one service is declared on component"));
+        }
+    }
+
+    @Test
+    public void testWithoutServiceNameSingleService() throws Exception {
+        node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[]
{"target/classes"});
+        node.start();
+
+        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain"));
+        HelloworldService service = clientFactory.getService(HelloworldService.class, "SingleServiceComponent");
+        assertEquals("Hello petra", service.sayHello("petra"));
+    }
 
     @Test
     public void testWithBadServiceName() throws Exception {
@@ -108,6 +123,26 @@ public class SCAClientTestCase extends T
         }
     }
     
+    @Test
+    public void testOnlyWSBinding() throws Exception {
+        node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[]
{"target/classes"});
+        node.start();
+
+        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain"));
+        RemoteHelloworldService service = clientFactory.getService(RemoteHelloworldService.class,
"OnlyWSBindingComponent/RemoteHelloworldService");
+        assertEquals("Hello petra", service.sayHelloRemote("petra"));
+    }
+
+    @Test
+    public void testMultipleBindings() throws Exception {
+        node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[]
{"target/classes"});
+        node.start();
+
+        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain"));
+        RemoteHelloworldService service = clientFactory.getService(RemoteHelloworldService.class,
"MultipleBindingsComponent/RemoteHelloworldService");
+        assertEquals("Hello petra", service.sayHelloRemote("petra"));
+    }
+
     //    @Test @Ignore
 //    public void testHTTPURI() throws Exception {
 //        node = NodeFactory.getInstance().createNode(URI.create("http://defaultDomain"),
new String[] {"target/classes"});



Mime
View raw message