You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2010/04/24 09:36:14 UTC

svn commit: r937601 - in /tuscany/sca-java-2.x/trunk/samples/webapps/helloworld: ./ src/test/ src/test/java/ src/test/java/itest/ src/test/resources/

Author: antelder
Date: Sat Apr 24 07:36:14 2010
New Revision: 937601

URL: http://svn.apache.org/viewvc?rev=937601&view=rev
Log:
Add testcase that uses SCAClient to invoke service. Named FIXME as it doesn't work till the config URI support in the runtime is finished

Added:
    tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/
    tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/
    tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/
    tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/Helloworld.java
    tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/HelloworldTestCaseFIXME.java
    tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/resources/
    tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/resources/test-web.xml
Modified:
    tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/pom.xml

Modified: tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/pom.xml?rev=937601&r1=937600&r2=937601&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/pom.xml Sat Apr 24 07:36:14 2010
@@ -38,6 +38,13 @@
             <version>2.0-SNAPSHOT</version>
         </dependency>
 
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.1</version>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
     <build>
@@ -86,6 +93,7 @@
                        <goal>run</goal>
                    </goals>
                    <configuration>
+                       <overrideWebXml>src/test/resources/test-web.xml</overrideWebXml>
                        <scanIntervalSeconds>0</scanIntervalSeconds>
                        <daemon>true</daemon>
                        <connectors>

Added: tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/Helloworld.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/Helloworld.java?rev=937601&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/Helloworld.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/Helloworld.java Sat Apr 24 07:36:14 2010
@@ -0,0 +1,27 @@
+/*
+ * 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.Remotable;
+
+@Remotable
+public interface Helloworld {
+    String sayHello(String name);
+}

Added: tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/HelloworldTestCaseFIXME.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/HelloworldTestCaseFIXME.java?rev=937601&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/HelloworldTestCaseFIXME.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/java/itest/HelloworldTestCaseFIXME.java Sat Apr 24 07:36:14 2010
@@ -0,0 +1,44 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.junit.Test;
+import org.oasisopen.sca.NoSuchDomainException;
+import org.oasisopen.sca.NoSuchServiceException;
+import org.oasisopen.sca.client.SCAClientFactory;
+
+/**
+ */
+public class HelloworldTestCaseFIXME {
+
+    @Test
+    public void testHelloworld() throws NoSuchDomainException, NoSuchServiceException {
+// TODO: need to fix the config URI so it works properly
+//        SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("uri:default?remote=127.0.0.1:54321"));
+        SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("tuscany:default?remotes=192.168.1.64"));
+        Helloworld helloworld = factory.getService(Helloworld.class, "HelloworldComponent");
+        assertEquals("Hello World", helloworld.sayHello("World"));
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/resources/test-web.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/resources/test-web.xml?rev=937601&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/resources/test-web.xml (added)
+++ tuscany/sca-java-2.x/trunk/samples/webapps/helloworld/src/test/resources/test-web.xml Sat Apr 24 07:36:14 2010
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<web-app version="2.4"
+         xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+  <context-param>
+    <param-name>org.apache.tuscany.sca.config</param-name>
+    <param-value>uri:default?bind=127.0.0.1:54321</param-value>
+  </context-param>
+
+</web-app>