You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2019/01/07 19:45:01 UTC

[GitHub] amarkevich closed pull request #494: cxf-systests-transports: run tests without internet connection

amarkevich closed pull request #494: cxf-systests-transports: run tests without internet connection
URL: https://github.com/apache/cxf/pull/494
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 21098a09c62..eeb67e67683 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 @@
         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 250c69d4d20..20877997a1f 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.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 @@
 
     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 @@ protected void run() {
             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 63b5c693529..61fd428f299 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 @@
 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 b865cf895e7..9c42d17a077 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/transports/http/configuration               http://cxf.apache.org/schemas/configuration/http-conf.xsd            http://cxf.apache.org/transports/http-jetty/configuration               http://cxf.apache.org/schemas/configuration/http-jetty.xsd            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">
+<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 067e43da949..02622418394 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 5208909682a..83086521b73 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/transports/http/configuration               http://cxf.apache.org/schemas/configuration/http-conf.xsd            http://cxf.apache.org/transports/http-jetty/configuration               http://cxf.apache.org/schemas/configuration/http-jetty.xsd            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">
+<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 620816113c8..199b070ed1f 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>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services