You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2014/02/25 17:47:02 UTC

git commit: [CXF-5575] Adding a dedicated test

Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 0bd7c311f -> a5cd5a25e


[CXF-5575] Adding a dedicated test


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a5cd5a25
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a5cd5a25
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a5cd5a25

Branch: refs/heads/2.7.x-fixes
Commit: a5cd5a25edc4bc31bbb122181c85c44998902c9c
Parents: 0bd7c31
Author: Sergey Beryozkin <sb...@talend.com>
Authored: Tue Feb 25 16:41:19 2014 +0000
Committer: Sergey Beryozkin <sb...@talend.com>
Committed: Tue Feb 25 16:46:36 2014 +0000

----------------------------------------------------------------------
 rt/pom.xml                                      |  2 +
 .../jaxrs/JAXRSSimpleRequestDispatcherTest.java | 59 ++++++++++++++++++++
 .../jaxrs_dispatch_simple/WEB-INF/web.xml       | 51 +++++++++++++++++
 .../resources/jaxrs_dispatch_simple/welcome.txt |  1 +
 4 files changed, 113 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a5cd5a25/rt/pom.xml
----------------------------------------------------------------------
diff --git a/rt/pom.xml b/rt/pom.xml
index 774c5e4..b86bea3 100644
--- a/rt/pom.xml
+++ b/rt/pom.xml
@@ -63,7 +63,9 @@
         <module>rs/security/oauth-parent</module>
         <module>rs/security/cors</module>
         <module>management</module>
+<!--
         <module>management-web</module>
+-->
         <module>javascript</module>
         <module>security</module>
     </modules>

http://git-wip-us.apache.org/repos/asf/cxf/blob/a5cd5a25/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSimpleRequestDispatcherTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSimpleRequestDispatcherTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSimpleRequestDispatcherTest.java
new file mode 100644
index 0000000..7c6d7c4
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSimpleRequestDispatcherTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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.cxf.systest.jaxrs;
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class JAXRSSimpleRequestDispatcherTest extends AbstractBusClientServerTestBase {
+    public static final String PORT = allocatePort(JAXRSSimpleRequestDispatcherTest.class);
+    
+    @Ignore
+    public static class Server extends AbstractSpringServer {
+        public Server() {
+            super("/jaxrs_dispatch_simple", "/dispatch", Integer.parseInt(PORT));
+        }
+    }
+    
+    @BeforeClass
+    public static void startServers() throws Exception {
+        AbstractResourceInfo.clearAllMaps();
+        assertTrue("server did not launch correctly", launchServer(Server.class, true));
+    }
+    
+    
+    
+    @Test
+    public void testGetTextWelcomeFile() throws Exception {
+        String address = "http://localhost:" + PORT + "/dispatch/welcome.txt";
+        WebClient client = WebClient.create(address);
+        
+        client.accept("text/plain");
+        String welcome = client.get(String.class);
+        assertEquals("Welcome", welcome);
+    }
+    
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/a5cd5a25/systests/jaxrs/src/test/resources/jaxrs_dispatch_simple/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/resources/jaxrs_dispatch_simple/WEB-INF/web.xml b/systests/jaxrs/src/test/resources/jaxrs_dispatch_simple/WEB-INF/web.xml
new file mode 100644
index 0000000..c7203ac
--- /dev/null
+++ b/systests/jaxrs/src/test/resources/jaxrs_dispatch_simple/WEB-INF/web.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<!--
+        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.
+-->
+<!-- START SNIPPET: webxml -->
+<web-app>
+    <servlet>
+    <servlet-name>CXFServlet</servlet-name>
+    <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
+    <init-param>
+      <param-name>jaxrs.serviceClasses</param-name>
+      <param-value>
+           org.apache.cxf.systest.jaxrs.BookStore
+      </param-value>
+    </init-param>  
+    <init-param>
+        <param-name>redirects-list</param-name>
+        <param-value>/welcome.txt</param-value>
+    </init-param>
+    <init-param>
+        <param-name>redirect-servlet-name</param-name>
+        <param-value>default</param-value>
+    </init-param>
+    <init-param>
+        <param-name>redirect-attributes</param-name>
+        <param-value>javax.servlet.include.request_uri</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+   </servlet>
+   <servlet-mapping>
+     <servlet-name>CXFServlet</servlet-name>
+     <url-pattern>/*</url-pattern>
+  </servlet-mapping>
+</web-app>
+<!-- END SNIPPET: webxml -->

http://git-wip-us.apache.org/repos/asf/cxf/blob/a5cd5a25/systests/jaxrs/src/test/resources/jaxrs_dispatch_simple/welcome.txt
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/resources/jaxrs_dispatch_simple/welcome.txt b/systests/jaxrs/src/test/resources/jaxrs_dispatch_simple/welcome.txt
new file mode 100644
index 0000000..01f3f00
--- /dev/null
+++ b/systests/jaxrs/src/test/resources/jaxrs_dispatch_simple/welcome.txt
@@ -0,0 +1 @@
+Welcome
\ No newline at end of file