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

joerghoh pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git


The following commit(s) were added to refs/heads/master by this push:
     new 26f6ebd  SLING-12642 update dependencies - part 1 (#57)
26f6ebd is described below

commit 26f6ebd3502c8375af4c5f0c6d7990567dff19c3
Author: Jörg Hoh <[email protected]>
AuthorDate: Fri Feb 7 18:30:28 2025 +0100

    SLING-12642 update dependencies - part 1 (#57)
    
    update the dependencies to Oak 1.44.0 which support the necessary API 
extensions
---
 pom.xml                                            | 23 ++++--
 .../sling/jcr/repoinit/it/RepoInitTestSupport.java | 84 ++++++++++++++++++++--
 src/test/resources/logback-it.xml                  | 41 +++++++++++
 3 files changed, 137 insertions(+), 11 deletions(-)

diff --git a/pom.xml b/pom.xml
index 7dbc140..68b034e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@
 
   <properties>
     <jackrabbit.version>2.18.2</jackrabbit.version>
-    <oak.version>1.22.10</oak.version>
+    <oak.version>1.44.0</oak.version>
     <org.ops4j.pax.exam.version>4.13.3</org.ops4j.pax.exam.version>
     <!-- To debug the pax process, override this with -D -->
     <pax.vm.options>-Xmx512M</pax.vm.options>
@@ -143,13 +143,21 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.sling-mock.junit4</artifactId>
-            <version>3.4.10</version>
+            <version>3.5.2</version>
             <scope>test</scope>
+                       <exclusions>
+                               <exclusion>
+                                       
<groupId>org.apache.jackrabbit</groupId><artifactId>oak-jcr</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       
<groupId>org.apache.jackrabbit</groupId><artifactId>oak-jackrabbit-api</artifactId>
+                               </exclusion>
+                       </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.sling-mock-oak</artifactId>
-            <version>3.0.0-1.16.0</version>
+            <version>3.1.10-1.44.0</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -197,8 +205,8 @@
         </dependency>
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
-            <artifactId>jackrabbit-api</artifactId>
-            <version>${jackrabbit.version}</version>
+            <artifactId>oak-jackrabbit-api</artifactId>
+            <version>${oak.version}</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -261,6 +269,11 @@
             <version>1.8.6</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.jetbrains</groupId>
+            <artifactId>annotations</artifactId>
+            <scope>provided</scope>
+        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-api</artifactId>
diff --git 
a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java 
b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java
index 17ade35..0c5bd18 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java
@@ -29,6 +29,8 @@ import org.junit.After;
 import org.junit.Before;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.options.ModifiableCompositeOption;
+import org.ops4j.pax.exam.util.PathUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,8 +42,12 @@ import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.CoreOptions.vmOption;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
 
+import java.util.Collection;
+import java.util.HashSet;
+
 public abstract class RepoInitTestSupport extends TestSupport {
 
     protected Session session;
@@ -50,30 +56,52 @@ public abstract class RepoInitTestSupport extends 
TestSupport {
 
     final String repositoriesURL = "https://repo1.maven.org/maven2@id=central";;
 
+    private static final String JR_GID = "org.apache.jackrabbit";
+
+    // artifact ID of all relevant oak bundles
+    private static final String[] OAK_BUNDLES = new String[] 
{"oak-api","oak-blob",
+            
"oak-blob-plugins","oak-commons","oak-core","oak-core-spi","oak-jcr",
+            
"oak-lucene","oak-query-spi","oak-security-spi","oak-segment-tar","oak-store-composite",
+            "oak-store-document","oak-store-spi", "oak-jackrabbit-api"};
+    private static final String TARGET_OAK_VERSION = "1.44.0";
+
+    private static final String[] JACKRABBIT_2x_BUNDLES = new String[] 
{"jackrabbit-data","jackrabbit-jcr-commons",
+            
"jackrabbit-jcr-rmi","jackrabbit-spi-commons","jackrabbit-spi","jackrabbit-webdav"};
+    private static final String TARGET_JACKRABBIT_VERSION = "2.22.0";
+
     @Inject
     private SlingRepository repository;
 
     @Configuration
     public Option[] configuration() {
-        
SlingOptions.versionResolver.setVersionFromProject("org.apache.jackrabbit", 
"jackrabbit-api");
+
+        // overwrite provided versions
+        Collection<Option> nonExistingJackrabbitBundles = 
updateRepositoryBundleVersions();
         SlingOptions.versionResolver.setVersionFromProject("org.apache.sling", 
"org.apache.sling.repoinit.parser");
         SlingOptions.versionResolver.setVersionFromProject("org.apache.sling", 
"org.apache.sling.commons.metrics");
         
SlingOptions.versionResolver.setVersionFromProject("org.apache.commons", 
"commons-lang3"); // for the metrics
+
         return options(composite(
                         super.baseConfiguration(),
                         vmOption(System.getProperty("pax.vm.options")),
                         slingQuickstart(),
+                        junitBundles(),
+                        SlingOptions.logback(),
+                        systemProperty("logback.configurationFile")
+                            .value("file:" + PathUtils.getBaseDir() + 
"/src/test/resources/logback-it.xml"),
+                        awaitility(),
                         testBundle("bundle.filename"),
+                        
newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
+                            .put("whitelist.bundles.regexp", "^PAXEXAM.*$")
+                            .asOption(),
                         mavenBundle()
                                 .groupId("org.apache.sling")
                                 .artifactId("org.apache.sling.repoinit.parser")
                                 .versionAsInProject(),
-                        junitBundles(),
-                        awaitility(),
-                        
newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
-                                .put("whitelist.bundles.regexp", "^PAXEXAM.*$")
-                                .asOption())
+                        bundlesForNewerRepository()
+                        )
                 .add(additionalOptions())
+                .remove(nonExistingJackrabbitBundles)
                 .remove(
                         // remove our bundle under test to avoid duplication
                         mavenBundle()
@@ -82,6 +110,50 @@ public abstract class RepoInitTestSupport extends 
TestSupport {
                                 .version(versionResolver)));
     }
 
+    /**
+     * Update the version number of all relevant bundles to run a newer 
Oak/Jackrabbit repository; in case that
+     * bundle does not exist in the requested version, it is ignored and added 
to collection returned.
+     * @return the list of bundles which must be removed from the list of 
bundles.
+     */
+    private static Collection<Option> updateRepositoryBundleVersions() {
+        SlingOptions.versionResolver.setVersion("org.apache.sling", 
"org.apache.sling.jcr.oak.server", "1.2.10");
+        for (int i=0;i< OAK_BUNDLES.length;i++) {
+            try {
+                SlingOptions.versionResolver.setVersionFromProject(JR_GID, 
OAK_BUNDLES[i]);
+            } catch (IllegalArgumentException e) {
+                // the version is not explicitly listed in the pom, so use the 
provided default version
+                SlingOptions.versionResolver.setVersion(JR_GID, 
OAK_BUNDLES[i], TARGET_OAK_VERSION);
+            }
+        }
+        Collection<Option> nonExistingBundles = new HashSet<>();
+        for (int i=0;i< JACKRABBIT_2x_BUNDLES.length;i++) {
+            Option existingBundle = null;
+            try {
+                String artifactId=JACKRABBIT_2x_BUNDLES[i];
+                existingBundle = 
mavenBundle().groupId(JR_GID).artifactId(artifactId).versionAsInProject();
+                SlingOptions.versionResolver.setVersion(JR_GID, artifactId, 
TARGET_JACKRABBIT_VERSION);
+            } catch (IllegalArgumentException e) {
+                nonExistingBundles.add(existingBundle);
+            }
+        }
+        return nonExistingBundles;
+    }
+
+    /**
+     * add relevant bundles which are required to run the newer repository 
version
+     * @return
+     */
+    private static ModifiableCompositeOption bundlesForNewerRepository() {
+        return composite(
+                
mavenBundle().groupId(JR_GID).artifactId("oak-jackrabbit-api").version(SlingOptions.versionResolver),
+                
mavenBundle().groupId(JR_GID).artifactId("oak-store-spi").version(SlingOptions.versionResolver),
+                
mavenBundle().groupId("commons-codec").artifactId("commons-codec").version("1.14"),
+                
mavenBundle().groupId("commons-io").artifactId("commons-io").version("2.11.0"),
+                
mavenBundle().groupId("org.apache.tika").artifactId("tika-core").version("1.24.1"),
+                
mavenBundle().groupId(JR_GID).artifactId("jackrabbit-api").version(versionResolver)
+                );
+    }
+    
     protected Option[] additionalOptions() {
         return new Option[] {};
     }
diff --git a/src/test/resources/logback-it.xml 
b/src/test/resources/logback-it.xml
new file mode 100644
index 0000000..4d78073
--- /dev/null
+++ b/src/test/resources/logback-it.xml
@@ -0,0 +1,41 @@
+<?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>
+
+    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+        <layout class="ch.qos.logback.classic.PatternLayout">
+            <Pattern>
+                %d{HH:mm:ss.SSS} [%t] %-5level %logger - %msg%n
+            </Pattern>
+        </layout>
+    </appender>
+    
+    <logger name="org.eclipse.jetty" level="warn">
+        <appender-ref ref="CONSOLE" />
+    </logger>
+    
+    <logger name="org.ops4j.pax.exam.cm.internal" level="warn">
+        <appender-ref ref="CONSOLE" />
+    </logger>
+
+    <root level="info">
+        <appender-ref ref="CONSOLE"/>
+    </root>
+
+</configuration>
\ No newline at end of file

Reply via email to