You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ma...@apache.org on 2019/12/15 22:53:22 UTC

[archiva-redback-core] 04/05: Dependency cleanup for jpa

This is an automated email from the ASF dual-hosted git repository.

martin_s pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/archiva-redback-core.git

commit 7373e1535d71c5bc04a8057f860242d40bdc109a
Author: Martin Stockhammer <ma...@apache.org>
AuthorDate: Sat Dec 14 21:28:20 2019 +0100

    Dependency cleanup for jpa
---
 pom.xml                                            |  30 ++++++
 redback-common/redback-common-jpa/pom.xml          |  42 +++++++++
 .../src/main/resources/META-INF/persistence.xml    |   2 +-
 redback-common/redback-common-ldap/pom.xml         |   4 +
 .../redback-keys-jpa/pom.xml                       |   5 +
 .../redback-rbac-jpa/pom.xml                       |   5 +
 .../redback-users-cached/pom.xml                   |  75 +++++++++++----
 .../src/test/resources/log4j2-test.xml             |  35 +++++++
 .../redback-users-jpa/pom.xml                      | 103 +++++++++++++++++++--
 .../src/test/resources/log4j2-test.xml             |  36 +++++++
 .../src/test/resources/spring-context.xml          |   2 +-
 11 files changed, 311 insertions(+), 28 deletions(-)

diff --git a/pom.xml b/pom.xml
index a6849a1..21174c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,6 +83,7 @@
 
     <junit.platform.version>1.5.2</junit.platform.version>
     <junit.jupiter.version>5.5.2</junit.jupiter.version>
+    <junit.4.version>4.12</junit.4.version>
 
     <!--
     <redbackTestJdbcUrl>jdbc:derby:memory:users-test;create=true</redbackTestJdbcUrl>
@@ -324,6 +325,23 @@
         <scope>provided</scope>
       </dependency>
       <dependency>
+        <groupId>javax.persistence</groupId>
+        <artifactId>javax.persistence-api</artifactId>
+        <version>2.2</version>
+        <scope>compile</scope>
+      </dependency>
+      <dependency>
+        <groupId>javax.transaction</groupId>
+        <artifactId>javax.transaction-api</artifactId>
+        <version>1.3</version>
+        <scope>compile</scope>
+      </dependency>
+      <dependency>
+        <groupId>commons-logging</groupId>
+        <artifactId>commons-logging</artifactId>
+        <version>1.2</version>
+      </dependency>
+      <dependency>
         <groupId>org.apache.archiva.components.cache</groupId>
         <artifactId>archiva-components-spring-cache-api</artifactId>
         <version>${archiva.comp.version}</version>
@@ -596,11 +614,23 @@
         <scope>test</scope>
       </dependency>
       <dependency>
+        <groupId>org.junit.jupiter</groupId>
+        <artifactId>junit-jupiter-api</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>
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>${junit.4.version}</version>
+        <scope>test</scope>
+      </dependency>
 
 
       <dependency>
diff --git a/redback-common/redback-common-jpa/pom.xml b/redback-common/redback-common-jpa/pom.xml
index 63f31cf..30086bc 100644
--- a/redback-common/redback-common-jpa/pom.xml
+++ b/redback-common/redback-common-jpa/pom.xml
@@ -48,7 +48,49 @@
       <groupId>org.apache.openjpa</groupId>
       <artifactId>openjpa</artifactId>
       <version>${openjpa.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-jpa_2.0_spec</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-jms_1.1_spec</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-jta_1.1_spec</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
+
+    <dependency>
+      <groupId>javax.persistence</groupId>
+      <artifactId>javax.persistence-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.transaction</groupId>
+      <artifactId>javax.transaction-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-orm</artifactId>
+    </dependency>
+
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-jcl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+
     <dependency>
       <groupId>org.hsqldb</groupId>
       <artifactId>hsqldb</artifactId>
diff --git a/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence.xml b/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence.xml
index 61ddb14..76a72e6 100644
--- a/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence.xml
+++ b/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence.xml
@@ -33,7 +33,7 @@
           <property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)" />
           <property name="openjpa.jdbc.MappingDefaults"
                       value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>
-          <property name="openjpa.Log" value="DefaultLevel=INFO,Runtime=INFO,Tool=INFO,SQL=ERROR,Schema=ERROR,MetaData=ERROR"/>
+          <property name="openjpa.Log" value="commons"/>
           <property name="openjpa.jdbc.DBDictionary" value="(disableSchemaFactoryColumnTypeErrors=true,BitTypeName=CHAR(1),BooleanTypeName=CHAR(1),BooleanRepresentation=STRING_YN)"/>
         </properties>
     </persistence-unit>
diff --git a/redback-common/redback-common-ldap/pom.xml b/redback-common/redback-common-ldap/pom.xml
index b44dfec..95d383c 100644
--- a/redback-common/redback-common-ldap/pom.xml
+++ b/redback-common/redback-common-ldap/pom.xml
@@ -86,6 +86,10 @@
       <artifactId>log4j-slf4j-impl</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-jcl</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.assertj</groupId>
diff --git a/redback-keys/redback-keys-providers/redback-keys-jpa/pom.xml b/redback-keys/redback-keys-providers/redback-keys-jpa/pom.xml
index c70d94e..74fde80 100644
--- a/redback-keys/redback-keys-providers/redback-keys-jpa/pom.xml
+++ b/redback-keys/redback-keys-providers/redback-keys-jpa/pom.xml
@@ -112,6 +112,11 @@
             <!-- set the version to be the same as the level in your runtime -->
             <version>${openjpa.version}</version>
           </dependency>
+          <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
+          </dependency>
         </dependencies>
       </plugin>
     </plugins>
diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-jpa/pom.xml b/redback-rbac/redback-rbac-providers/redback-rbac-jpa/pom.xml
index d9adc5d..b3f6f7e 100644
--- a/redback-rbac/redback-rbac-providers/redback-rbac-jpa/pom.xml
+++ b/redback-rbac/redback-rbac-providers/redback-rbac-jpa/pom.xml
@@ -107,6 +107,11 @@
             <!-- set the version to be the same as the level in your runtime -->
             <version>${openjpa.version}</version>
           </dependency>
+          <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
+          </dependency>
         </dependencies>
       </plugin>
     </plugins>
diff --git a/redback-users/redback-users-providers/redback-users-cached/pom.xml b/redback-users/redback-users-providers/redback-users-cached/pom.xml
index 7d605af..a70b039 100644
--- a/redback-users/redback-users-providers/redback-users-cached/pom.xml
+++ b/redback-users/redback-users-providers/redback-users-cached/pom.xml
@@ -34,10 +34,7 @@
   <name>Redback :: Users Provider :: Cached</name>
 
   <dependencies>
-    <dependency>
-      <groupId>org.apache.archiva.redback</groupId>
-      <artifactId>redback-policy</artifactId>
-    </dependency>
+
     <dependency>
       <groupId>org.apache.archiva.components.cache</groupId>
       <artifactId>archiva-components-spring-cache-api</artifactId>
@@ -46,31 +43,68 @@
       <groupId>org.apache.archiva.components.cache</groupId>
       <artifactId>archiva-components-spring-cache-ehcache</artifactId>
     </dependency>
+
     <dependency>
-      <groupId>org.apache.archiva.components.registry</groupId>
-      <artifactId>archiva-components-spring-registry-commons</artifactId>
-      <scope>test</scope>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva.redback</groupId>
+      <artifactId>redback-users-jpa</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva.redback</groupId>
+      <artifactId>redback-common-jpa</artifactId>
     </dependency>
     <dependency>
       <groupId>net.sf.ehcache</groupId>
       <artifactId>ehcache</artifactId>
-    </dependency>     
+    </dependency>
+
+
+    <!-- JUNIT 5 -->
     <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context-support</artifactId>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-aop</artifactId>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>javax.annotation</groupId>
-      <artifactId>jsr250-api</artifactId>
+      <groupId>org.junit.vintage</groupId>
+      <artifactId>junit-vintage-engine</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.archiva.redback</groupId>
-      <artifactId>redback-users-jpa</artifactId>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
     </dependency>
+
+
+    <dependency>
+      <groupId>org.apache.archiva.components.registry</groupId>
+      <artifactId>archiva-components-spring-registry-commons</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context-support</artifactId>
+      <scope>test</scope>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.archiva.redback</groupId>
       <artifactId>redback-users-tests</artifactId>
@@ -82,8 +116,13 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-simple</artifactId>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-jcl</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/redback-users/redback-users-providers/redback-users-cached/src/test/resources/log4j2-test.xml b/redback-users/redback-users-providers/redback-users-cached/src/test/resources/log4j2-test.xml
new file mode 100644
index 0000000..91af3f0
--- /dev/null
+++ b/redback-users/redback-users-providers/redback-users-cached/src/test/resources/log4j2-test.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<configuration>
+    <appenders>
+        <Console name="console" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%t] %-5p %c %x - %m%n"/>
+        </Console>
+    </appenders>
+    <loggers>
+        <logger name="org.apache.archiva" level="info"/>
+
+        <root level="error" includeLocation="true">
+            <appender-ref ref="console"/>
+        </root>
+    </loggers>
+</configuration>
+
+
diff --git a/redback-users/redback-users-providers/redback-users-jpa/pom.xml b/redback-users/redback-users-providers/redback-users-jpa/pom.xml
index 6c3b505..020b769 100644
--- a/redback-users/redback-users-providers/redback-users-jpa/pom.xml
+++ b/redback-users/redback-users-providers/redback-users-jpa/pom.xml
@@ -35,14 +35,6 @@
 
   <dependencies>
     <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context-support</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>javax.annotation</groupId>
-      <artifactId>jsr250-api</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.archiva.redback</groupId>
       <artifactId>redback-policy</artifactId>
     </dependency>
@@ -51,6 +43,40 @@
       <artifactId>redback-common-jpa</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.persistence</groupId>
+      <artifactId>javax.persistence-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.transaction</groupId>
+      <artifactId>javax.transaction-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+
+
+    <dependency>
       <groupId>org.apache.archiva.components.registry</groupId>
       <artifactId>archiva-components-spring-registry-commons</artifactId>
       <scope>test</scope>
@@ -69,17 +95,73 @@
           <groupId>junit</groupId>
           <artifactId>junit</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-jpa_2.0_spec</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-jms_1.1_spec</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-jta_1.1_spec</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
+
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-tx</artifactId>
       <version>${springVersion}</version>
     </dependency>
+
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-orm</artifactId>
       <version>${springVersion}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context-support</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- JUNIT 5 -->
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.vintage</groupId>
+      <artifactId>junit-vintage-engine</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-jcl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
     </dependency>
 
     <dependency>
@@ -119,6 +201,11 @@
             <!-- set the version to be the same as the level in your runtime -->
             <version>${openjpa.version}</version>
           </dependency>
+          <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
+          </dependency>
         </dependencies>
       </plugin>
     </plugins>
diff --git a/redback-users/redback-users-providers/redback-users-jpa/src/test/resources/log4j2-test.xml b/redback-users/redback-users-providers/redback-users-jpa/src/test/resources/log4j2-test.xml
new file mode 100644
index 0000000..8a13bc5
--- /dev/null
+++ b/redback-users/redback-users-providers/redback-users-jpa/src/test/resources/log4j2-test.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<configuration>
+    <appenders>
+        <Console name="console" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%t] %-5p %c %x - %m%n"/>
+        </Console>
+    </appenders>
+    <loggers>
+        <logger name="org.apache.archiva" level="info"/>
+        <logger name="openjpa" level="error" />
+
+        <root level="error" includeLocation="true">
+            <appender-ref ref="console"/>
+        </root>
+    </loggers>
+</configuration>
+
+
diff --git a/redback-users/redback-users-providers/redback-users-jpa/src/test/resources/spring-context.xml b/redback-users/redback-users-providers/redback-users-jpa/src/test/resources/spring-context.xml
index aedda06..9c88628 100644
--- a/redback-users/redback-users-providers/redback-users-jpa/src/test/resources/spring-context.xml
+++ b/redback-users/redback-users-providers/redback-users-jpa/src/test/resources/spring-context.xml
@@ -62,7 +62,7 @@
         <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" />
         <entry key="openjpa.ConnectionUserName" value="sa" />
         <entry key="openjpa.ConnectionPassword" value="" />
-        <entry key="openjpa.Log" value="${openjpa.Log:DefaultLevel=INFO,Runtime=ERROR,Tool=ERROR,SQL=ERROR,Schema=ERROR,MetaData=ERROR}" />
+        <entry key="openjpa.Log" value="commons" />
         <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" />
         <entry key="openjpa.jdbc.MappingDefaults"
                   value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>