use junit bom and simplify poms (#33) master
authorOlivier Lamy <olamy@apache.org>
Sat, 6 Aug 2022 11:04:11 +0000 (21:04 +1000)
committerGitHub <noreply@github.com>
Sat, 6 Aug 2022 11:04:11 +0000 (21:04 +1000)
Signed-off-by: Olivier Lamy <olamy@apache.org>
.github/workflows/maven.yml
pom.xml
spring-cache/spring-cache-test/pom.xml
spring-cache/spring-cache-test/src/main/java/org/apache/archiva/components/cache/test/AbstractCacheTestCase.java
spring-quartz/src/test/java/org/apache/archiva/components/scheduler/SchedulerTest.java
spring-taskqueue/src/test/java/org/apache/archiva/components/taskqueue/execution/TaskQueueExecutorTest.java

index d0aff8ae32b410d9d2b3a2eed577319cb90244e6..3ae4a11117ff346aa794347543fe598e680246d7 100644 (file)
@@ -28,7 +28,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest]
-        java: [8, 11]
+        java: [11, 17]
       fail-fast: false
 
     runs-on: ${{ matrix.os }}
diff --git a/pom.xml b/pom.xml
index aecae55bf851486999528cdb18d066e71155f8c1..bf1879899d00e40471cb127781e02b134f5b48af 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -63,9 +63,9 @@
     <scmPublishPath>/components</scmPublishPath>
 
 
-    <slf4j.version>1.7.32</slf4j.version>
-    <log4j.version>2.17.2</log4j.version>
-    <spring.version>5.3.20</spring.version>
+    <slf4j.version>1.7.36</slf4j.version>
+    <log4j.version>2.18.0</log4j.version>
+    <spring.version>5.3.22</spring.version>
     <ehcache.version>3.9.9</ehcache.version>
     <io.swagger.version>2.1.10</io.swagger.version>
 
@@ -85,7 +85,6 @@
     <apacheds.shared.version>0.9.7</apacheds.shared.version>
 
     <!-- junit -->
-    <junit.platform.version>1.8.2</junit.platform.version>
     <junit.jupiter.version>5.8.2</junit.jupiter.version>
 
   </properties>
       <!-- spring -->
       <dependency>
         <groupId>org.springframework</groupId>
-        <artifactId>spring-core</artifactId>
+        <artifactId>spring-framework-bom</artifactId>
         <version>${spring.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
       </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-web</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-beans</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-context</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-context-support</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-aop</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-test</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-
-
+      
       <dependency>
         <groupId>jakarta.inject</groupId>
         <artifactId>jakarta.inject-api</artifactId>
 
       <!-- JUNIT 5 -->
       <dependency>
-        <groupId>org.junit.platform</groupId>
-        <artifactId>junit-platform-launcher</artifactId>
-        <version>${junit.platform.version}</version>
-        <scope>test</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.junit.platform</groupId>
-        <artifactId>junit-platform-console-standalone</artifactId>
-        <version>${junit.platform.version}</version>
-        <scope>test</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.junit.jupiter</groupId>
-        <artifactId>junit-jupiter-engine</artifactId>
+        <groupId>org.junit</groupId>
+        <artifactId>junit-bom</artifactId>
         <version>${junit.jupiter.version}</version>
-        <scope>test</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.junit.vintage</groupId>
-        <artifactId>junit-vintage-engine</artifactId>
-        <version>${junit.jupiter.version}</version>
-        <scope>test</scope>
+        <type>pom</type>
+        <scope>import</scope>
       </dependency>
 
       <dependency>
         <artifactId>swagger-annotations</artifactId>
         <version>${io.swagger.version}</version>
       </dependency>
-
+      <dependency>
+        <groupId>org.awaitility</groupId>
+        <artifactId>awaitility</artifactId>
+        <version>4.2.0</version>
+      </dependency>
     </dependencies>
   </dependencyManagement>
   <dependencies>
       <scope>test</scope>
     </dependency>
 
-    <!-- JUNIT 5 -->
     <dependency>
-      <groupId>org.junit.platform</groupId>
-      <artifactId>junit-platform-launcher</artifactId>
-      <version>${junit.platform.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.junit.platform</groupId>
-      <artifactId>junit-platform-console-standalone</artifactId>
-      <version>${junit.platform.version}</version>
+      <groupId>org.awaitility</groupId>
+      <artifactId>awaitility</artifactId>
       <scope>test</scope>
     </dependency>
+
+    <!-- JUNIT 5 -->
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-engine</artifactId>
-      <version>${junit.jupiter.version}</version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.junit.vintage</groupId>
       <artifactId>junit-vintage-engine</artifactId>
-      <version>${junit.jupiter.version}</version>
       <scope>test</scope>
     </dependency>
 
           <version>${javadocPluginVersion}</version>
           <configuration>
             <notimestamp>true</notimestamp>
-            <javadocVersion>${javaFullVersion}</javadocVersion>
-            <source>${compiler.source}</source>
+            <javadocVersion>${maven.compiler.release}</javadocVersion>
+            <source>${maven.compiler.release}</source>
             <doclint>none</doclint>
             <detectLinks>true</detectLinks>
             <detectJavaApiLink>true</detectJavaApiLink>
           <outputEncoding>UTF-8</outputEncoding>
           <skipDeploy>true</skipDeploy>
           <stagingDirectory>${site.staging.base}/target/staging${scmPublishPath}</stagingDirectory>
-          <asciidoc>
-            <!-- optional site-wide AsciiDoc attributes -->
-            <attributes>
-              <icons>font</icons>
-              <source-highlighter>coderay</source-highlighter>
-              <coderay-css>style</coderay-css>
-              <toclevels>2</toclevels>
-            </attributes>
-          </asciidoc>
+<!--          <asciidoc>-->
+<!--            &lt;!&ndash; optional site-wide AsciiDoc attributes &ndash;&gt;-->
+<!--            <attributes>-->
+<!--              <icons>font</icons>-->
+<!--              <source-highlighter>coderay</source-highlighter>-->
+<!--              <coderay-css>style</coderay-css>-->
+<!--              <toclevels>2</toclevels>-->
+<!--            </attributes>-->
+<!--          </asciidoc>-->
         </configuration>
         <dependencies>
           <dependency>
         <inherited>false</inherited>
         <configuration>
           <notimestamp>true</notimestamp>
-          <javadocVersion>${javaFullVersion}</javadocVersion>
-          <source>${compiler.source}</source>
+          <javadocVersion>${maven.compiler.release}</javadocVersion>
+          <source>${maven.compiler.release}</source>
           <doclint>none</doclint>
           <detectLinks>true</detectLinks>
           <detectJavaApiLink>true</detectJavaApiLink>
@@ -576,7 +525,7 @@ The executor runs a shell script.
           <plugin>
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>exec-maven-plugin</artifactId>
-            <version>3.0.0</version>
+            <version>3.1.0</version>
             <inherited>false</inherited>
             <executions>
               <execution>
index b5c293cbd88ff11010b7462f908be709b1a92979..852786365ee094e77b9e1c923636c8ff8e578647 100644 (file)
     </dependency>
 
     <!-- JUNIT 5 -->
-    <dependency>
-      <groupId>org.junit.platform</groupId>
-      <artifactId>junit-platform-launcher</artifactId>
-      <version>${junit.platform.version}</version>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.junit.platform</groupId>
-      <artifactId>junit-platform-console-standalone</artifactId>
-      <version>${junit.platform.version}</version>
-      <scope>compile</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-engine</artifactId>
-      <version>${junit.jupiter.version}</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>org.junit.vintage</groupId>
       <artifactId>junit-vintage-engine</artifactId>
-      <version>${junit.jupiter.version}</version>
       <scope>compile</scope>
     </dependency>
   </dependencies>
index f096897ca7ba25b20d1e0f2b77d06208c907968c..86ed50c1059ec7044472ec139b26f331f26d4f5b 100644 (file)
@@ -47,14 +47,6 @@ import java.util.List;
 public abstract class AbstractCacheTestCase
     extends TestCase
 {
-//    static
-//    {
-//        Logger logger = Logger.getLogger( "org.codehaus.plexus.cache" );
-//        logger.setLevel( Level.ALL );
-//        ConsoleHandler handler = new ConsoleHandler( );
-//        handler.setLevel( Level.ALL );
-//        logger.addHandler( handler );
-//    }
 
     private static final Logger log = LoggerFactory.getLogger( AbstractCacheTestCase.class );
 
index 1ea8ee2ea8d4cb77a2173a7cb2d4b10cea228def..63c2b20c4fc6527a5c4a15edf93fb67cef77b5bf 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.archiva.components.scheduler;
  */
 
 import junit.framework.TestCase;
+import org.awaitility.Awaitility;
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -37,6 +38,7 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 import javax.inject.Inject;
+import java.util.concurrent.TimeUnit;
 
 @RunWith ( SpringJUnit4ClassRunner.class )
 @ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
@@ -81,10 +83,8 @@ public class SchedulerTest
 
         scheduler.scheduleJob( jobDetail, trigger );
 
-        while ( !triggerFired )
-        {
-            Thread.sleep( 10 );
-        }
+        Awaitility.await().atLeast( 100, TimeUnit.MILLISECONDS ).until( () -> triggerFired );
+
         logger.info( "ok triggerFired" );
     }
 
index 3eded887b538b7441e42fad1f11d5862fbd27991..8ea4b125d54edea0b2c80b0455c527769373c799 100644 (file)
@@ -23,6 +23,7 @@ import junit.framework.TestCase;
 import org.apache.archiva.components.taskqueue.BuildProjectTask;
 import org.apache.archiva.components.taskqueue.TaskQueue;
 import org.apache.archiva.components.taskqueue.TaskQueueException;
+import org.awaitility.Awaitility;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
@@ -30,6 +31,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 import javax.inject.Inject;
 import javax.inject.Named;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
@@ -90,16 +92,7 @@ public class TaskQueueExecutorTest
     {
         // thread scheduling may take some time, so we want to wait until the task
         // is actually running before starting to count the timeout.
-        for ( int i = 0; i < 500; i++ )
-        {
-            if ( task.wasStarted( ) )
-            {
-                break;
-            }
-            Thread.sleep( 10 );
-        }
-
-        assertTrue( "Task not started in 5 seconds - heavy load?", task.isStarted( ) );
+        Awaitility.await().atMost( 5, TimeUnit.SECONDS ).until( () -> task.isStarted() );
 
         Thread.sleep( task.getMaxExecutionTime( ) );
     }