[cxf] branch master updated: systests: fix launch Jetty on Windows

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[cxf] branch master updated: systests: fix launch Jetty on Windows

buhhunyx
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 9485e3b  systests: fix launch Jetty on Windows
9485e3b is described below

commit 9485e3b46125c9102610aa6dcab6e330952b2fb0
Author: Alexey Markevich <[hidden email]>
AuthorDate: Mon Nov 16 13:57:54 2020 +0300

    systests: fix launch Jetty on Windows
---
 .../cxf/systests/cdi/base/jetty/AbstractJettyServer.java     |  3 ++-
 .../jaxrs/servlet/jetty/JettyEmptyPathApplicationTest.java   |  3 +--
 .../cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java      |  2 +-
 .../apache/cxf/systest/jaxrs/security/oauth/OAuthServer.java | 12 ++----------
 .../cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java     |  3 ++-
 5 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/jetty/AbstractJettyServer.java b/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/jetty/AbstractJettyServer.java
index 75a8989..2645851 100644
--- a/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/jetty/AbstractJettyServer.java
+++ b/systests/cdi/base/src/main/java/org/apache/cxf/systests/cdi/base/jetty/AbstractJettyServer.java
@@ -28,6 +28,7 @@ import org.eclipse.jetty.server.handler.DefaultHandler;
 import org.eclipse.jetty.server.handler.HandlerCollection;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.resource.Resource;
 import org.eclipse.jetty.webapp.WebAppContext;
 
 import static org.junit.Assert.fail;
@@ -70,7 +71,7 @@ public abstract class AbstractJettyServer extends AbstractBusTestServerBase {
             } else {
                 final WebAppContext context = new WebAppContext();
                 context.setContextPath(contextPath);
-                context.setWar(getClass().getResource(resourcePath).toURI().getPath());
+                context.setBaseResource(Resource.newClassPathResource(resourcePath));
                 context.setServerClasses(new String[] {
                     "org.eclipse.jetty.servlet.ServletContextHandler.Decorator"
                 });
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyPathApplicationTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyPathApplicationTest.java
index fe03dd9..5ea6513 100644
--- a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyPathApplicationTest.java
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyEmptyPathApplicationTest.java
@@ -50,8 +50,7 @@ public class JettyEmptyPathApplicationTest extends AbstractSciTest {
 
         @Override
         protected void configureContext(final WebAppContext context) throws Exception {
-            context.setDescriptor(Resource
-                .newClassPathResource("/WEB-INF/web-subclass.xml").getFile().toURI().getPath());
+            context.setDescriptor(getClass().getResource("/WEB-INF/web-subclass.xml").toString());
         }
     }
 
diff --git a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java
index dc90554..2531dad 100644
--- a/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java
+++ b/systests/rs-http-sci/src/test/java/org/apache/cxf/jaxrs/servlet/jetty/JettyNoApplicationTest.java
@@ -48,7 +48,7 @@ public class JettyNoApplicationTest extends AbstractSciTest {
 
         @Override
         protected void configureContext(final WebAppContext context) throws Exception {
-            context.setDescriptor(Resource.newClassPathResource("/WEB-INF/web.xml").getFile().toURI().getPath());
+            context.setDescriptor(getClass().getResource("/WEB-INF/web.xml").toString());
         }
     }
 
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth/OAuthServer.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth/OAuthServer.java
index e3ff147..05c607e 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth/OAuthServer.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth/OAuthServer.java
@@ -19,13 +19,12 @@
 
 package org.apache.cxf.systest.jaxrs.security.oauth;
 
-import java.net.URISyntaxException;
-
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.cxf.testutil.common.TestUtil;
 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;
 
 
@@ -42,15 +41,8 @@ public class OAuthServer extends AbstractBusTestServerBase {
         server = new org.eclipse.jetty.server.Server(PORT);
 
         WebAppContext webappcontext = new WebAppContext();
-        String contextPath = null;
-        try {
-            contextPath = getClass().getResource(RESOURCE_PATH).toURI().getPath();
-        } catch (URISyntaxException e1) {
-            e1.printStackTrace();
-        }
         webappcontext.setContextPath("/");
-
-        webappcontext.setWar(contextPath);
+        webappcontext.setBaseResource(Resource.newClassPathResource(RESOURCE_PATH));
 
         HandlerCollection handlers = new HandlerCollection();
         handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
diff --git a/systests/rs-sse/rs-sse-jetty/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java b/systests/rs-sse/rs-sse-jetty/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java
index 8e7f456..e81d026 100644
--- a/systests/rs-sse/rs-sse-jetty/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java
+++ b/systests/rs-sse/rs-sse-jetty/src/test/java/org/apache/cxf/systest/jaxrs/sse/jetty/AbstractJettyServer.java
@@ -31,6 +31,7 @@ import org.eclipse.jetty.server.handler.DefaultHandler;
 import org.eclipse.jetty.server.handler.HandlerCollection;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.resource.Resource;
 import org.eclipse.jetty.webapp.WebAppContext;
 
 import static org.junit.Assert.fail;
@@ -72,7 +73,7 @@ public abstract class AbstractJettyServer extends AbstractBusTestServerBase {
             } else {
                 final WebAppContext context = new WebAppContext();
                 context.setContextPath(contextPath);
-                context.setWar(getClass().getResource(resourcePath).toURI().getPath());
+                context.setBaseResource(Resource.newClassPathResource(resourcePath));
 
                 HandlerCollection handlers = new HandlerCollection();
                 handlers.setHandlers(new Handler[] {context, new DefaultHandler()});