]> source.dussan.org Git - archiva.git/commitdiff
use jetty bom to manage Jetty dependencies (#81)
authorOlivier Lamy <olamy@apache.org>
Mon, 18 Apr 2022 02:07:02 +0000 (12:07 +1000)
committerGitHub <noreply@github.com>
Mon, 18 Apr 2022 02:07:02 +0000 (12:07 +1000)
* 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 <olamy@apache.org>
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml
archiva-modules/archiva-web/archiva-webdav/src/test/resources/log4j2-test.xml
pom.xml

index efd48408d6d0e04059242961234202f8b064096d..439b9ffd8a8fe767f5975756809324b3996077c0 100644 (file)
@@ -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<Path> appServerBase = new AtomicReference<>( );
     private AtomicReference<Path> 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());
-        }
     }
 
 
index c0414be389ec71d8a9e4b5dff8c7b7383baca8b3..c4093cb415529dbad38ddaf1d73435b7da151fc9 100644 (file)
     <Console name="console" target="SYSTEM_OUT">
       <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%L] [%t] %-5level %logger{6} - %msg%n}" />
     </Console>
-    <RollingRandomAccessFile name="rolling" fileName="/tmp/archiva.log"
-                             filePattern="/tmp/archiva-%d{yyyyMMdd}.log"
-                             immediateFlush="true" append="true">
-      <PatternLayout>
-        <pattern>%d [%t] %-5p %c %x - %m%n</pattern>
-      </PatternLayout>
-      <Policies>
-        <TimeBasedTriggeringPolicy />
-      </Policies>
-    </RollingRandomAccessFile>
   </appenders>
 
   <loggers>
 
     <logger name="jaxrs" level="info" />
-    <logger name="org.apache.cxf" level="debug" />
-    <logger name="org.apache.archiva" level="debug" />
-    <logger name="org.apache.archiva.redback" level="debug"/>
+    <logger name="org.apache.cxf" level="info" />
+    <logger name="org.apache.archiva" level="info" />
+    <logger name="org.apache.archiva.redback" level="info"/>
     <logger name="com.fasterxml.jackson" level="info" />
     <logger name="org.apache.archiva.components" level="error" />
 
-    <logger name="JPOX" level="error"/>
     <logger name="org.apache.archiva.rest.services" level="info"/>
     <logger name="org.springframework" level="error"/>
     <logger name="org.apache.commons.configuration" level="info"/>
     <logger name="org.apache.archiva.metadata" level="error" />
-    <logger name="org.apache.cxf" level="debug" />
 
     <root level="info">
       <appender-ref ref="console"/>
index 254f26841e6e734b5005997f5e1b95c2174c1d7d..8641749d5e7c0e7149b2a900fe1365eab6450c21 100644 (file)
     <Console name="console" target="SYSTEM_OUT">
       <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%L] [%t] %-5level %logger{3} - %msg%n}" />
     </Console>
-    <RollingRandomAccessFile name="rolling" fileName="/tmp/archiva.log"
-                             filePattern="/tmp/archiva-%d{yyyyMMdd}.log"
-                             immediateFlush="true" append="true">
-      <PatternLayout>
-        <pattern>%d [%t] %-5p %c %x - %m%n</pattern>
-      </PatternLayout>
-      <Policies>
-        <TimeBasedTriggeringPolicy />
-      </Policies>
-    </RollingRandomAccessFile>
   </appenders>
 
   <loggers>
diff --git a/pom.xml b/pom.xml
index 50ff533ab185e287a2ffbe6b9f8da157862f5c31..4bea6c4ac3354e8eca1f09b51a037fb079a8ac8c 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <redback.version>3.0.0-SNAPSHOT</redback.version>
 
     <!-- Java Enterprise APIs -->
-
-
-
     <maven3x.version>3.8.1</maven3x.version>
     <maven.resolver.version>1.4.1</maven.resolver.version>
     <maven.indexer.version>6.0.1-SNAPSHOT</maven.indexer.version>
     <maven-model-converter.version>2.3</maven-model-converter.version>
     <wagon.version>3.3.3</wagon.version>
 
-
-
-
     <!-- dependencies of maven modules -->
     <jsoup.version>1.14.2</jsoup.version>
     <rome.version>1.16.0</rome.version>
 
       <dependency>
         <groupId>org.eclipse.jetty</groupId>
-        <artifactId>jetty-server</artifactId>
-        <version>${jetty.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-          </exclusion>
-        </exclusions>
-      </dependency>
-      <dependency>
-        <groupId>org.eclipse.jetty</groupId>
-        <artifactId>jetty-plus</artifactId>
-        <version>${jetty.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.eclipse.jetty</groupId>
-        <artifactId>jetty-servlet</artifactId>
+        <artifactId>jetty-bom</artifactId>
         <version>${jetty.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
       </dependency>
 
-
       <!-- JCR -->
       <dependency>
         <groupId>javax.jcr</groupId>