Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAK-10339: Migrate to SLF4J 2.x #1343

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions oak-it-osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@
<artifactId>pax-url-wrap</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.paxexam</artifactId>
<version>3.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import org.apache.jackrabbit.oak.plugins.document.spi.lease.LeaseFailureHandler;
import org.apache.jackrabbit.oak.spi.state.NodeStore;
import org.apache.sling.testing.paxexam.SlingOptions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
Expand Down Expand Up @@ -71,13 +72,16 @@ public Option[] configuration() throws IOException, URISyntaxException {
mavenBundle( "org.apache.felix", "org.apache.felix.configadmin", "1.9.20" ),
mavenBundle( "org.apache.felix", "org.apache.felix.fileinstall", "3.2.6" ),
mavenBundle( "org.ops4j.pax.logging", "pax-logging-api", "1.7.2" ),
mavenBundle("jakarta.servlet", "jakarta.servlet-api", "5.0.0"),
// required for slf4j 2.0.x
SlingOptions.spyfly(),
frameworkProperty("repository.home").value("target"),
systemProperties(new SystemPropertyOption("felix.fileinstall.dir").value(getConfigDir())),
jarBundles(),
jpmsOptions());
}

private Option jpmsOptions(){
static Option jpmsOptions(){
DefaultCompositeOption composite = new DefaultCompositeOption();
if (Version.parseVersion(System.getProperty("java.specification.version")).getMajor() > 1){
if (java.nio.file.Files.exists(java.nio.file.FileSystems.getFileSystem(URI.create("jrt:/")).getPath("modules", "java.se.ee"))){
Expand All @@ -98,11 +102,11 @@ private Option jpmsOptions(){
return composite;
}

private String getConfigDir(){
static String getConfigDir(){
return new File(new File("src", "test"), "config").getAbsolutePath();
}

private Option jarBundles() throws MalformedURLException {
static Option jarBundles() throws MalformedURLException {
DefaultCompositeOption composite = new DefaultCompositeOption();
for (File bundle : new File("target", "test-bundles").listFiles()) {
if (bundle.getName().endsWith(".jar") && bundle.isFile()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,58 @@
*/
package org.apache.jackrabbit.oak.osgi;

import org.apache.sling.testing.paxexam.SlingOptions;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.parser.AutoDetectParser;
import org.apache.tika.parser.Parser;
import org.apache.tika.sax.WriteOutContentHandler;

import org.junit.Test;
import org.junit.runner.RunWith;

import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.CoreOptions;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.options.DefaultCompositeOption;
import org.ops4j.pax.exam.options.SystemPropertyOption;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Version;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.xml.sax.ContentHandler;

import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;

import javax.inject.Inject;

import static java.util.Arrays.stream;
import static org.junit.Assert.*;
import static org.ops4j.pax.exam.CoreOptions.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;

import static org.ops4j.pax.exam.CoreOptions.bundle;
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.frameworkProperty;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperties;
import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;

import static org.apache.jackrabbit.oak.osgi.OSGiIT.getConfigDir;

@RunWith(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
Expand All @@ -74,38 +91,30 @@ public class TikaExtractionOsgiIT {
public Option[] configuration() throws IOException {
return CoreOptions.options(
junitBundles(),
mavenBundle( "org.ops4j.pax.logging", "pax-logging-api", "2.2.3" ),
frameworkProperty("repository.home").value("target"),
mavenBundle("org.apache.felix", "org.apache.felix.scr", "2.1.28"),
// transitive deps of Felix SCR 2.1.x
mavenBundle("org.osgi", "org.osgi.util.promise", "1.1.1"),
mavenBundle("org.osgi", "org.osgi.util.function", "1.1.0"),
mavenBundle("org.apache.felix", "org.apache.felix.jaas", "1.0.2"),
mavenBundle("org.osgi", "org.osgi.dto", "1.0.0"),
// require at least ConfigAdmin 1.6 supported by felix.configadmin 1.9.0+
mavenBundle( "org.apache.felix", "org.apache.felix.configadmin", "1.9.20" ),
mavenBundle( "org.apache.felix", "org.apache.felix.fileinstall", "3.2.6" ),
mavenBundle( "org.ops4j.pax.logging", "pax-logging-api", "1.7.2" ),
mavenBundle("org.apache.logging.log4j", "log4j-api", "2.23.0"),
mavenBundle("jakarta.servlet", "jakarta.servlet-api", "5.0.0"),
SlingOptions.spyfly(),
setupTikaAndPoi(),
jpmsOptions()
frameworkProperty("repository.home").value("target"),
systemProperties(new SystemPropertyOption("felix.fileinstall.dir").value(getConfigDir())),
OSGiIT.jpmsOptions()
// to debug a test, un-comment this and "run" the test which would block due to suspend="y"
// then run debugger on a remote app with specified port
// , vmOption( "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" )
);
}

private Option jpmsOptions(){
DefaultCompositeOption composite = new DefaultCompositeOption();
if (Version.parseVersion(System.getProperty("java.specification.version")).getMajor() > 1){
if (java.nio.file.Files.exists(java.nio.file.FileSystems.getFileSystem(URI.create("jrt:/")).getPath("modules", "java.se.ee"))){
composite.add(vmOption("--add-modules=java.se.ee"));
}
composite.add(vmOption("--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED"));
composite.add(vmOption("--add-opens=java.base/java.lang=ALL-UNNAMED"));
composite.add(vmOption("--add-opens=java.base/java.lang.invoke=ALL-UNNAMED"));
composite.add(vmOption("--add-opens=java.base/java.io=ALL-UNNAMED"));
composite.add(vmOption("--add-opens=java.base/java.net=ALL-UNNAMED"));
composite.add(vmOption("--add-opens=java.base/java.nio=ALL-UNNAMED"));
composite.add(vmOption("--add-opens=java.base/java.util=ALL-UNNAMED"));
composite.add(vmOption("--add-opens=java.base/java.util.jar=ALL-UNNAMED"));
composite.add(vmOption("--add-opens=java.base/java.util.regex=ALL-UNNAMED"));
composite.add(vmOption("--add-opens=java.base/java.util.zip=ALL-UNNAMED"));
composite.add(vmOption("--add-opens=java.base/sun.nio.ch=ALL-UNNAMED"));
}
return composite;
}

private Option setupTikaAndPoi() throws IOException {
private static Option setupTikaAndPoi() throws IOException {
Map<String, String> versions = setupVersions();
return composite(
composite(
Expand All @@ -127,24 +136,10 @@ private Option setupTikaAndPoi() throws IOException {
, mavenBundle("org.apache.commons", "commons-math3", versions.get(MATH3_VERSION))
// poi dependency end
)
, jarBundles()
, OSGiIT.jarBundles()
);
}

private Option jarBundles() throws MalformedURLException {
String[] jarNames = new String[]{"commons-io.jar", "commons-codec.jar"};
File jarDir = new File("target", "test-bundles");

DefaultCompositeOption composite = new DefaultCompositeOption();

List<File> jarFiles = stream(jarNames).map(jarName -> new File(jarDir, jarName)).collect(Collectors.toList());
for (File jar : jarFiles) {
composite.add(bundle(jar.toURI().toURL().toString()));
}

return composite;
}

private static Map<String, String> setupVersions() throws IOException {
Properties props = new Properties();
props.load(TikaExtractionOsgiIT.class.getClassLoader().getResourceAsStream(VERSION_PROP_RESOURCE_NAME));
Expand Down
10 changes: 5 additions & 5 deletions oak-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
<lucene.version>4.7.1</lucene.version>
<solr.version>8.11.1</solr.version>
<mongo.driver.version>3.12.11</mongo.driver.version>
<slf4j.api.version>1.7.36</slf4j.api.version>
<slf4j.version>1.7.36</slf4j.version> <!-- sync with logback version -->
<logback.version>1.2.10</logback.version>
<slf4j.api.version>2.0.12</slf4j.api.version>
<slf4j.version>2.0.12</slf4j.version> <!-- sync with logback version -->
<logback.version>1.5.2</logback.version>
<h2.version>2.1.214</h2.version>
<tika.version>1.28.5</tika.version>
<derby.version>10.15.2.0</derby.version>
Expand Down Expand Up @@ -794,13 +794,13 @@
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<version>2.6.9</version>
<version>2.6.14</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-wrap</artifactId>
<version>2.6.1</version>
<version>2.6.14</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion oak-run-elastic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
85 MB : remove Elasticsearch RHLC
103.5 MB: Azure Identity client library for Java (OAK-10604)
-->
<max.jar.size>103500000</max.jar.size>
<max.jar.size>103700000</max.jar.size>

</properties>

Expand Down
1 change: 1 addition & 0 deletions oak-solr-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.12</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ public static Option jackrabbit() {
protected static Option logging(String level) {
return composite(
mavenBundle("org.ops4j.pax.logging", "pax-logging-api", "1.11.13"),
SlingOptions.spyfly(),
mavenBundle("org.slf4j", "slf4j-api", "2.0.12"),
mavenBundle("org.slf4j", "slf4j-simple", "2.0.12"),
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(level),
SlingOptions.logback()
);
Expand Down