You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2019/01/10 18:54:05 UTC

[cxf] branch master updated: cxf-systests-databinding: run tests without internet connection

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 6d072ee  cxf-systests-databinding: run tests without internet connection
6d072ee is described below

commit 6d072ee08353888af17ad06b21da738cf15de2f1
Author: amarkevich <am...@talend.com>
AuthorDate: Thu Jan 10 15:34:35 2019 +0300

    cxf-systests-databinding: run tests without internet connection
---
 .../cxf/systest/aegis/AegisClientServerTest.java    |  3 ---
 .../org/apache/cxf/systest/aegis/AegisServer.java   | 21 ++++-----------------
 .../src/test/resources/webapp/WEB-INF/web.xml       |  5 +++--
 3 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java b/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
index 41a9ca0..ecad231 100644
--- a/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
+++ b/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
@@ -25,14 +25,12 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-import java.util.logging.Logger;
 
 import org.w3c.dom.Document;
 
 import org.apache.cxf.aegis.databinding.AegisDatabinding;
 import org.apache.cxf.authservice.AuthService;
 import org.apache.cxf.authservice.Authenticate;
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
 import org.apache.cxf.ext.logging.LoggingInInterceptor;
@@ -56,7 +54,6 @@ import static org.junit.Assert.assertTrue;
 
 public class AegisClientServerTest extends AbstractBusClientServerTestBase {
     static final String PORT = allocatePort(AegisServer.class);
-    static final Logger LOG = LogUtils.getLogger(AegisClientServerTest.class);
 
     @BeforeClass
     public static void startServers() throws Exception {
diff --git a/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisServer.java b/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisServer.java
index 6718a69..b36920d 100644
--- a/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisServer.java
+++ b/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisServer.java
@@ -19,12 +19,10 @@
 
 package org.apache.cxf.systest.aegis;
 
-import java.net.URISyntaxException;
-
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-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;
 
 
@@ -39,25 +37,14 @@ public class AegisServer extends AbstractBusTestServerBase {
         server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
 
         WebAppContext webappcontext = new WebAppContext();
-        String contextPath = null;
-        try {
-            contextPath = getClass().getResource("/webapp").toURI().getPath();
-        } catch (URISyntaxException e1) {
-            e1.printStackTrace();
-        }
         webappcontext.setContextPath("/");
+        webappcontext.setBaseResource(Resource.newClassPathResource("/webapp"));
 
-        webappcontext.setWar(contextPath);
-
-        HandlerCollection handlers = new HandlerCollection();
-        handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
-
-        server.setHandler(handlers);
+        server.setHandler(new HandlerCollection(webappcontext, new DefaultHandler()));
         try {
             server.start();
-
         } catch (Exception e) {
-            e.printStackTrace();
+            throw new RuntimeException(e);
         }
 
     }
diff --git a/systests/databinding/src/test/resources/webapp/WEB-INF/web.xml b/systests/databinding/src/test/resources/webapp/WEB-INF/web.xml
index a8cae3f..97aba6e 100644
--- a/systests/databinding/src/test/resources/webapp/WEB-INF/web.xml
+++ b/systests/databinding/src/test/resources/webapp/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
@@ -19,7 +18,9 @@
         under the License.
 -->
 <!-- START SNIPPET: webxml -->
-<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>