From e94d037281ca0b2f6bd06659d1c073b1f9e8d55b Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 18 Apr 2022 12:07:02 +1000 Subject: [PATCH] use jetty bom to manage Jetty dependencies (#81) * use jetty bom to manage Jetty dependencies * simplify code and do write in a log file in /tmp when running tests Signed-off-by: Olivier Lamy --- .../services/AbstractArchivaRestTest.java | 40 +++---------------- .../src/test/resources/log4j2-test.xml | 18 ++------- .../src/test/resources/log4j2-test.xml | 10 ----- pom.xml | 27 ++----------- 4 files changed, 11 insertions(+), 84 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java index efd48408d..439b9ffd8 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java @@ -46,7 +46,6 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.WebClient; -import org.junit.After; import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; @@ -74,17 +73,6 @@ public abstract class AbstractArchivaRestTest private AtomicReference appServerBase = new AtomicReference<>( ); private AtomicReference basePath = new AtomicReference<>( ); - private boolean reuseServer = true; - - - protected void setReuseServer(boolean value) { - this.reuseServer = value; - } - - protected boolean isReuseServer() { - return this.reuseServer; - } - /* * Used by tryAssert to allow to throw exceptions in the lambda expression. */ @@ -179,31 +167,13 @@ public abstract class AbstractArchivaRestTest public void startServer() throws Exception { - if ( (!isReuseServer()) || (isReuseServer() && !isServerRunning())) { - log.info("Starting new server reuse={}, running={}, instance={}, server={}", isReuseServer(), isServerRunning(), this.hashCode(), getServer()==null ? "" : getServer().hashCode()); - Path appServerBase = getAppserverBase( ); - removeAppsubFolder(appServerBase, "jcr"); - removeAppsubFolder(appServerBase, "conf"); - removeAppsubFolder(appServerBase, "data"); - super.startServer(); - } else { - log.info("Reusing running server instance reuse={}, running={}", isReuseServer(), isServerRunning()); - } - } + Path appServerBase = getAppserverBase(); + removeAppsubFolder(appServerBase, "jcr"); + removeAppsubFolder(appServerBase, "conf"); + removeAppsubFolder(appServerBase, "data"); + super.startServer(); - @Override - @After - public void stopServer() - throws Exception - { - if ( !isReuseServer() ) - { - log.info("Stopping server reuse={}, running={}, instance={}, server={}", isReuseServer(), isServerRunning(), this.hashCode(), getServer()==null ? "" : getServer().hashCode()); - super.stopServer(); - } else { - log.info("Server not stopping reuse={}, running={}", isReuseServer(), isServerRunning()); - } } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml index c0414be38..c4093cb41 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml @@ -24,33 +24,21 @@ - - - %d [%t] %-5p %c %x - %m%n - - - - - - - - + + + - - diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/log4j2-test.xml index 254f26841..8641749d5 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/log4j2-test.xml @@ -24,16 +24,6 @@ - - - %d [%t] %-5p %c %x - %m%n - - - - - diff --git a/pom.xml b/pom.xml index 50ff533ab..4bea6c4ac 100644 --- a/pom.xml +++ b/pom.xml @@ -51,18 +51,12 @@ 3.0.0-SNAPSHOT - - - 3.8.1 1.4.1 6.0.1-SNAPSHOT 2.3 3.3.3 - - - 1.14.2 1.16.0 @@ -1551,26 +1545,11 @@ org.eclipse.jetty - jetty-server + jetty-bom ${jetty.version} - - - javax.servlet - javax.servlet-api - - + pom + import - - org.eclipse.jetty - jetty-plus - ${jetty.version} - - - org.eclipse.jetty - jetty-servlet - ${jetty.version} - -