cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buhhu...@apache.org
Subject [cxf] branch master updated: cxf-systests-transports: run tests without internet connection
Date Mon, 07 Jan 2019 19:45:07 GMT
This is an automated email from the ASF dual-hosted git repository.

buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 246a43a  cxf-systests-transports: run tests without internet connection
246a43a is described below

commit 246a43a7b7ccc813ec4137078fdd939f1d6f2b17
Author: amarkevich <amarkevich@talend.com>
AuthorDate: Fri Jan 4 19:12:28 2019 +0300

    cxf-systests-transports: run tests without internet connection
---
 .../cxf/systest/http/auth/DigestAuthTest.java      |  2 --
 .../apache/cxf/systest/http/auth/DigestServer.java | 29 +++++-----------------
 .../cxf/systest/servlet/resolver/ResolverTest.java | 12 ++-------
 .../test/resources/digestauth/WEB-INF/beans.xml    | 10 +++++++-
 .../src/test/resources/digestauth/WEB-INF/web.xml  |  6 ++---
 .../src/test/resources/resolver/WEB-INF/beans.xml  |  8 +++++-
 .../src/test/resources/resolver/WEB-INF/web.xml    |  5 ++--
 7 files changed, 30 insertions(+), 42 deletions(-)

diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthTest.java
b/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthTest.java
index 21098a0..eeb67e6 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestAuthTest.java
@@ -49,8 +49,6 @@ public class DigestAuthTest extends AbstractBusClientServerTestBase {
         new QName("http://apache.org/hello_world", "SOAPService");
     private final QName mortimerQ =
         new QName("http://apache.org/hello_world", "Mortimer");
-    public DigestAuthTest() {
-    }
 
     @BeforeClass
     public static void startServer() throws Exception {
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestServer.java
b/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestServer.java
index 250c69d..2087799 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestServer.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/http/auth/DigestServer.java
@@ -18,8 +18,6 @@
  */
 package org.apache.cxf.systest.http.auth;
 
-import java.io.File;
-import java.net.URISyntaxException;
 import java.net.URL;
 
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
@@ -28,6 +26,7 @@ import org.eclipse.jetty.security.LoginService;
 import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.handler.DefaultHandler;
 import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.util.resource.Resource;
 import org.eclipse.jetty.webapp.WebAppContext;
 
 public class DigestServer extends AbstractBusTestServerBase {
@@ -35,36 +34,20 @@ public class DigestServer extends AbstractBusTestServerBase {
 
     private org.eclipse.jetty.server.Server server;
 
-    public DigestServer() {
-    }
-
-    protected void configureServer() throws Exception {
-        URL resource = getClass()
-            .getResource("jetty-realm.properties");
-        File file = new File(resource.toURI());
+    private void configureServer() throws Exception {
+        URL resource = getClass().getResource("jetty-realm.properties");
 
         LoginService realm =
-            new HashLoginService("BookStoreRealm", file.getAbsolutePath());
+            new HashLoginService("BookStoreRealm", resource.toString());
         server.addBean(realm);
     }
 
     protected void run() {
-        //System.out.println("Starting Server");
-
         server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
 
         WebAppContext webappcontext = new WebAppContext();
         webappcontext.setContextPath("/digestauth");
-
-        String warPath = null;
-        try {
-            URL res = getClass().getResource("/digestauth");
-            warPath = res.toURI().getPath();
-        } catch (URISyntaxException e1) {
-            e1.printStackTrace();
-        }
-
-        webappcontext.setWar(warPath);
+        webappcontext.setBaseResource(Resource.newClassPathResource("/digestauth"));
 
         HandlerCollection handlers = new HandlerCollection();
         handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
@@ -75,7 +58,7 @@ public class DigestServer extends AbstractBusTestServerBase {
             configureServer();
             server.start();
         } catch (Exception e) {
-            e.printStackTrace();
+            throw new RuntimeException(e);
         }
     }
     public void tearDown() throws Exception {
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/resolver/ResolverTest.java
b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/resolver/ResolverTest.java
index 63b5c69..61fd428 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/servlet/resolver/ResolverTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/servlet/resolver/ResolverTest.java
@@ -20,13 +20,12 @@
 package org.apache.cxf.systest.servlet.resolver;
 
 
-import java.net.URL;
-
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.handler.DefaultHandler;
 import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.util.resource.Resource;
 import org.eclipse.jetty.webapp.WebAppContext;
 
 import org.junit.Test;
@@ -35,20 +34,13 @@ import org.junit.Test;
 public class ResolverTest extends AbstractBusClientServerTestBase {
     public static final String PORT = allocatePort(ResolverTest.class);
 
-    public ResolverTest() {
-    }
-
     @Test
     public void startServer() throws Throwable {
         Server server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
 
         WebAppContext webappcontext = new WebAppContext();
         webappcontext.setContextPath("/resolver");
-
-        URL res = getClass().getResource("/resolver");
-        String warPath = res.toURI().getPath();
-
-        webappcontext.setWar(warPath);
+        webappcontext.setBaseResource(Resource.newClassPathResource("/resolver"));
 
         HandlerCollection handlers = new HandlerCollection();
         handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
diff --git a/systests/transports/src/test/resources/digestauth/WEB-INF/beans.xml b/systests/transports/src/test/resources/digestauth/WEB-INF/beans.xml
index b865cf8..9c42d17 100644
--- a/systests/transports/src/test/resources/digestauth/WEB-INF/beans.xml
+++ b/systests/transports/src/test/resources/digestauth/WEB-INF/beans.xml
@@ -17,7 +17,15 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation="                    http://cxf.apache.org/configuration/security
                      http://cxf.apache.org/schemas/configuration/security.xsd           
http://cxf.apache.org/tra [...]
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:http="http://cxf.apache.org/transports/http/configuration"
+    xmlns:jaxws="http://cxf.apache.org/jaxws"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+    ">
     <import resource="classpath:META-INF/cxf/cxf.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
     <http:destination name="{http://apache.org/hello_world}Mortimer.http-destination">
diff --git a/systests/transports/src/test/resources/digestauth/WEB-INF/web.xml b/systests/transports/src/test/resources/digestauth/WEB-INF/web.xml
index 067e43d..0262241 100644
--- a/systests/transports/src/test/resources/digestauth/WEB-INF/web.xml
+++ b/systests/transports/src/test/resources/digestauth/WEB-INF/web.xml
@@ -1,5 +1,4 @@
 <?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 
@@ -10,7 +9,9 @@
         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>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+    version="3.0">
     <context-param>
         <param-name>contextConfigLocation</param-name>
         <param-value>WEB-INF/beans.xml</param-value>
@@ -22,7 +23,6 @@
     </listener>
     <servlet>
         <servlet-name>CXFServlet</servlet-name>
-        <display-name>CXF Servlet</display-name>
         <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
         <load-on-startup>1</load-on-startup>
     </servlet>
diff --git a/systests/transports/src/test/resources/resolver/WEB-INF/beans.xml b/systests/transports/src/test/resources/resolver/WEB-INF/beans.xml
index 5208909..8308652 100644
--- a/systests/transports/src/test/resources/resolver/WEB-INF/beans.xml
+++ b/systests/transports/src/test/resources/resolver/WEB-INF/beans.xml
@@ -17,7 +17,13 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation="                    http://cxf.apache.org/configuration/security
                      http://cxf.apache.org/schemas/configuration/security.xsd           
http://cxf.apache.org/tra [...]
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:jaxws="http://cxf.apache.org/jaxws"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+    ">
     <import resource="classpath:META-INF/cxf/cxf.xml"/>
     <!--  Resolve wsdl using the classloader -->
     <jaxws:endpoint id="greeter1" address="/greeter" implementor="org.apache.hello_world_soap_http.GreeterImpl"
wsdlLocation="/org/apache/cxf/systest/servlet/hello_world.wsdl"/>
diff --git a/systests/transports/src/test/resources/resolver/WEB-INF/web.xml b/systests/transports/src/test/resources/resolver/WEB-INF/web.xml
index 6208161..199b070 100644
--- a/systests/transports/src/test/resources/resolver/WEB-INF/web.xml
+++ b/systests/transports/src/test/resources/resolver/WEB-INF/web.xml
@@ -1,5 +1,4 @@
 <?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 
@@ -10,7 +9,9 @@
         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>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+    version="3.0">
     <context-param>
         <param-name>contextConfigLocation</param-name>
         <param-value>WEB-INF/beans.xml</param-value>


Mime
View raw message