cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1213812 - in /cxf/trunk/distribution/src/main/release/samples/java_first_jaxws: pom.xml src/test/ src/test/java/ src/test/java/demo/ src/test/java/demo/hw/ src/test/java/demo/hw/server/ src/test/java/demo/hw/server/HelloWorldImplTest.java
Date Tue, 13 Dec 2011 18:01:56 GMT
Author: gmazza
Date: Tue Dec 13 18:01:55 2011
New Revision: 1213812

URL: http://svn.apache.org/viewvc?rev=1213812&view=rev
Log:
JUnit test for HelloWorldImpl added.

Added:
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/test/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/test/java/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/test/java/demo/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/test/java/demo/hw/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/test/java/demo/hw/server/
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/test/java/demo/hw/server/HelloWorldImplTest.java
Modified:
    cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/pom.xml

Modified: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/pom.xml?rev=1213812&r1=1213811&r2=1213812&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/pom.xml (original)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/pom.xml Tue Dec 13 18:01:55
2011
@@ -44,26 +44,26 @@
                     <target>1.5</target>
                 </configuration>
             </plugin>
-                <plugin>
-                    <artifactId>maven-war-plugin</artifactId>
-                    <version>2.1</version>
-                    <configuration>
-                        <webXml>${cxf.release.base}/etc/web.xml</webXml>
-                    </configuration>
-                </plugin>
-                <plugin>
-                    <groupId>org.codehaus.mojo</groupId>
-                    <artifactId>tomcat-maven-plugin</artifactId>
-                    <version>1.1</version>
-                    <configuration>
-                        <server>myTomcat</server>
-                        <!-- if using Tomcat 6 (see README) -->
-                        <!--url>http://localhost:8080/manager</url-->
-                        <!-- if using Tomcat 7 (see README) -->
-                        <url>http://localhost:8080/manager/text</url>
-                        <path>/${project.build.finalName}</path>
-                    </configuration>
-                </plugin>
+            <plugin>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>2.1</version>
+                <configuration>
+                    <webXml>${cxf.release.base}/etc/web.xml</webXml>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>tomcat-maven-plugin</artifactId>
+                <version>1.1</version>
+                <configuration>
+                    <server>myTomcat</server>
+                    <!-- if using Tomcat 6 (see README) -->
+                    <!--url>http://localhost:8080/manager</url -->
+                    <!-- if using Tomcat 7 (see README) -->
+                    <url>http://localhost:8080/manager/text</url>
+                    <path>/${project.build.finalName}</path>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
     <profiles>
@@ -132,5 +132,10 @@
             <artifactId>cxf-rt-transports-http</artifactId>
             <version>2.5.1-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>

Added: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/test/java/demo/hw/server/HelloWorldImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/test/java/demo/hw/server/HelloWorldImplTest.java?rev=1213812&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/test/java/demo/hw/server/HelloWorldImplTest.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws/src/test/java/demo/hw/server/HelloWorldImplTest.java
Tue Dec 13 18:01:55 2011
@@ -0,0 +1,56 @@
+/**
+ * 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 demo.hw.server;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import java.util.Map;
+
+public class HelloWorldImplTest {
+
+    @Test
+    public void testSayHi() {
+        HelloWorldImpl hwi = new HelloWorldImpl();
+        String response = hwi.sayHi("Bob");
+        assertEquals("SayHi isn't returning expected string", "Hello Bob", response);
+    }
+
+    @Test
+    public void testSayHiToUser() {
+        HelloWorldImpl hwi = new HelloWorldImpl();
+        User sam = new UserImpl("Sam");
+        String response = hwi.sayHiToUser(sam);
+        assertEquals("SayHiToUser isn't returning expected string", "Hello Sam", response);
+    }
+
+    @Test
+    public void testGetUsers() {
+        HelloWorldImpl hwi = new HelloWorldImpl();
+        User mike = new UserImpl("Mike");
+        hwi.sayHiToUser(mike);
+
+        User george = new UserImpl("George");
+        hwi.sayHiToUser(george);
+        Map<Integer, User> userMap = hwi.getUsers();
+        assertEquals("getUsers() not returning expected number of users", userMap.size(),
2);
+        assertEquals("Expected user Mike not found", "Mike", userMap.get(1).getName());
+        assertEquals("Expected user George not found", "George", userMap.get(2).getName());
+    }
+
+}



Mime
View raw message