Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 @@ -314,6 +314,12 @@
<artifactId>pax-url-wrap</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.paxexam</artifactId>
<version>4.1.2</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 @@ -299,7 +299,10 @@ public Option[] configuration() throws IOException, URISyntaxException {
// mavenBundle().groupId("com.fasterxml.jackson.core").artifactId("jackson-databind").version("2.22.0"),

mavenBundle().groupId("com.github.ben-manes.caffeine").artifactId("caffeine").version("3.1.8"),
mavenBundle("jakarta.servlet", "jakarta.servlet-api", "5.0.0"),

// required for slf4j 2.0.x
OSGiIT.spyflyOptions(),
frameworkProperty("repository.home").value("target"),

systemProperties(new SystemPropertyOption("felix.fileinstall.dir").value(getConfigDir())),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.junit.Assert.assertEquals;
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;
Expand Down Expand Up @@ -72,6 +73,7 @@ public Option[] configuration() throws IOException, URISyntaxException {
mavenBundle( "org.apache.felix", "org.apache.felix.fileinstall", "3.2.6" ),

mavenBundle( "org.ops4j.pax.logging", "pax-logging-api", "1.7.2" ),

// Jackson dependency for object serialisation.
// (these only need to be defined here when the versions are different from the ones
// defined in the project -- otherwise -> "bundle symbolic name and version are not unique")
Expand All @@ -80,14 +82,34 @@ public Option[] configuration() throws IOException, URISyntaxException {
// mavenBundle().groupId("com.fasterxml.jackson.core").artifactId("jackson-databind").version("2.22.0"),

mavenBundle().groupId("com.github.ben-manes.caffeine").artifactId("caffeine").version("3.1.8"),
mavenBundle("jakarta.servlet", "jakarta.servlet-api", "5.0.0"),

// required for slf4j 2.0.x
spyflyOptions(),
frameworkProperty("repository.home").value("target"),
systemProperties(new SystemPropertyOption("felix.fileinstall.dir").value(getConfigDir())),
jarBundles(),
jpmsOptions());
}

private Option jpmsOptions(){
/**
* Provides Apache Aries SPI Fly 1.3.x for SLF4J 2.x service-loader mediation in OSGi.
* SPI Fly 1.2.x (bundled by sling.testing.paxexam 3.1.0) embeds ASM 5.x and cannot
* weave Java 11+ bytecode. Version 1.3.7 uses external ASM 9.x and supports modern class files.
*/
static Option spyflyOptions() {
return composite(
mavenBundle("org.apache.aries", "org.apache.aries.util", "1.1.3"),
mavenBundle("org.ow2.asm", "asm", "9.7.1"),
mavenBundle("org.ow2.asm", "asm-tree", "9.7.1"),
mavenBundle("org.ow2.asm", "asm-analysis", "9.7.1"),
mavenBundle("org.ow2.asm", "asm-commons", "9.7.1"),
mavenBundle("org.ow2.asm", "asm-util", "9.7.1"),
mavenBundle("org.apache.aries.spifly", "org.apache.aries.spifly.dynamic.bundle", "1.3.7")
);
}

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 @@ -108,11 +130,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 @@ -20,37 +20,53 @@
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;

Check warning on line 31 in oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import 'org.ops4j.pax.exam.options.DefaultCompositeOption'.

See more on https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&issues=AaA-nF6ROR04KyFQCqpq&open=AaA-nF6ROR04KyFQCqpq&pullRequest=1343
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;

Check warning on line 44 in oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import 'java.io.File'.

See more on https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&issues=AaA-nF6ROR04KyFQCqpr&open=AaA-nF6ROR04KyFQCqpr&pullRequest=1343
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;

Check warning on line 47 in oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import 'java.net.MalformedURLException'.

See more on https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&issues=AaA-nF6ROR04KyFQCqps&open=AaA-nF6ROR04KyFQCqps&pullRequest=1343
import java.net.URI;
import java.util.HashMap;
import java.util.List;

Check warning on line 49 in oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import 'java.util.List'.

See more on https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&issues=AaA-nF6ROR04KyFQCqpt&open=AaA-nF6ROR04KyFQCqpt&pullRequest=1343
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;

Check warning on line 52 in oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import 'java.util.stream.Collectors'.

See more on https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&issues=AaA-nF6ROR04KyFQCqpu&open=AaA-nF6ROR04KyFQCqpu&pullRequest=1343

import javax.inject.Inject;

import static java.util.Arrays.stream;

Check warning on line 56 in oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import 'java.util.Arrays.stream'.

See more on https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&issues=AaA-nF6ROR04KyFQCqpv&open=AaA-nF6ROR04KyFQCqpv&pullRequest=1343
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;

Check warning on line 61 in oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import 'org.ops4j.pax.exam.CoreOptions.bundle'.

See more on https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&issues=AaA-nF6ROR04KyFQCqpw&open=AaA-nF6ROR04KyFQCqpw&pullRequest=1343
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 @@ -60,14 +76,10 @@
private static final String VERSION_PROP_RESOURCE_NAME = "versions.properties";
private static final String TIKA_VERSION = "tika";
private static final String POI_VERSION = "poi";
private static final String COLLECTIONS4_VERSION = "commons-collections4";
private static final String COMPRESS_VERSION = "commons-compress";
private static final String LANG3_VERSION = "commons-lang3";
private static final String MATH3_VERSION = "commons-math3";
private static final String COMMONS_CSV_VERSION = "commons-csv";
private static final String[] VERSION_KEYS = new String[]{TIKA_VERSION, POI_VERSION
, COLLECTIONS4_VERSION, COMPRESS_VERSION
, LANG3_VERSION, MATH3_VERSION, COMMONS_CSV_VERSION};
private static final String[] VERSION_KEYS = new String[]{TIKA_VERSION, POI_VERSION, COMPRESS_VERSION,
COMMONS_CSV_VERSION};

private static final String EXPECTED_TEXT_FRAGMENT = "A sample document";
private static final String EXPECTED_CSV_FRAGMENT =
Expand All @@ -80,43 +92,37 @@
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"),
mavenBundle().groupId("com.github.ben-manes.caffeine").artifactId("caffeine").version("3.1.8"),

// required for slf4j 2.0.x
OSGiIT.spyflyOptions(),
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(
mavenBundle("org.apache.tika", "tika-core", versions.get(TIKA_VERSION))
, mavenBundle("org.apache.tika", "tika-parsers", versions.get(TIKA_VERSION))
mavenBundle("org.apache.tika", "tika-parsers", versions.get(TIKA_VERSION))
// for csv parsing
, mavenBundle("org.apache.commons", "commons-csv", versions.get(COMMONS_CSV_VERSION))
// poi dependency start
Expand All @@ -128,30 +134,13 @@
, wrappedBundle(mavenBundle("org.apache.poi", "ooxml-security", "1.0"))
, wrappedBundle(mavenBundle("org.apache.xmlbeans", "xmlbeans", "5.0.3"))
, wrappedBundle(mavenBundle("com.drewnoakes", "metadata-extractor", "2.6.2"))
, mavenBundle("org.apache.commons", "commons-collections4", versions.get(COLLECTIONS4_VERSION))
, mavenBundle("org.apache.commons", "commons-compress", versions.get(COMPRESS_VERSION))
, mavenBundle("org.apache.commons", "commons-lang3", versions.get(LANG3_VERSION))
, 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
3 changes: 0 additions & 3 deletions oak-it-osgi/src/test/resources/versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@
#
tika=${tika.version}
poi=5.2.2
commons-collections4=4.4
commons-compress=1.28.0
commons-lang3=3.18.0
commons-math3=3.6.1
commons-csv=1.14.1
1 change: 1 addition & 0 deletions oak-it-osgi/test-bundles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<include>com.fasterxml.jackson.core:jackson-annotations</include>
<include>com.fasterxml.jackson.core:jackson-core</include>
<include>com.fasterxml.jackson.core:jackson-databind</include>
<include>com.fasterxml.jackson.core:jackson-annotations</include>
<include>org.apache.commons:commons-lang3</include>
<include>org.apache.commons:commons-math3</include>
<include>org.apache.commons:commons-text</include>
Expand Down
6 changes: 3 additions & 3 deletions oak-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
<segment.db>SegmentMK</segment.db>
<lucene.version>4.7.2</lucene.version>
<mongo.driver.version>5.3.1</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.13</logback.version>
<slf4j.api.version>2.0.18</slf4j.api.version>
<slf4j.version>2.0.18</slf4j.version> <!-- sync with logback version -->
<logback.version>1.6.3</logback.version>
<h2.version>2.1.214</h2.version>
<tika.version>1.28.5</tika.version>
<derby.version>10.16.1.1</derby.version>
Expand Down
1 change: 0 additions & 1 deletion oak-run-elastic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
142 MB: jackson update (OAK-12276)
-->
<max.jar.size>142000000</max.jar.size>

</properties>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,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
Loading