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

CORE-15310: Use custom SLF4J bundle in OSGi tests #6248

Merged
merged 1 commit into from
Jul 2, 2024
Merged
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
11 changes: 9 additions & 2 deletions buildSrc/src/main/groovy/corda.osgi-test-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@ Test-Cases: \${classes;HIERARCHY_INDIRECTLY_ANNOTATED;org.junit.platform.commons
}
}

def slf4j2Dependency = libs.slf4j.api.get()

def bundlesSet = files(sourceSets.integrationTest.runtimeClasspath.filter {
// Filter out SLF4J bundle as it will be conflicting with special bundle we provide for OSGi testing purposes: slf4jv1
!(it.path.contains("${slf4j2Dependency.name}-${slf4j2Dependency.version}"))
}, configurations.archives.artifacts.files)

def resolve = tasks.register('resolve', Resolve) {
dependsOn jar, testingBundle
bundles = files(sourceSets.integrationTest.runtimeClasspath, configurations.archives.artifacts.files)
bundles = bundlesSet
bndrun = file('test.bndrun')
outputBndrun = layout.buildDirectory.file('resolved-test.bndrun')
doFirst {
Expand All @@ -81,7 +88,7 @@ def testOSGi = tasks.register('testOSGi', TestOSGi) {
languageVersion = of(17)
}
resultsDirectory = file("$testResultsDir/integrationTest")
bundles = files(sourceSets.integrationTest.runtimeClasspath, configurations.archives.artifacts.files)
bundles = bundlesSet
bndrun = resolve.flatMap { it.outputBndrun }

// These properties are for Quasar's framework extension, should it be present.
Expand Down
2 changes: 1 addition & 1 deletion components/ledger/ledger-verification/test.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
bnd.identity;id='net.bytebuddy.byte-buddy',\
bnd.identity;id='junit-jupiter-engine',\
bnd.identity;id='junit-platform-launcher',\
bnd.identity;id='slf4j.api',\
bnd.identity;id='net.corda.slf4jv1',\
bnd.identity;id='slf4j.simple',\
bnd.identity;id='org.liquibase.core',\
bnd.identity;id='com.opencsv',\
Expand Down
2 changes: 1 addition & 1 deletion components/security-manager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies {
integrationTestImplementation "org.osgi:org.osgi.service.component:$osgiServiceComponentVersion"
integrationTestImplementation project(':testing:security-manager-utilities')
integrationTestImplementation "net.corda:corda-application"
integrationTestImplementation 'org.slf4j:slf4j-api'
integrationTestRuntimeOnly project(':testing:slf4jv1')
integrationTestRuntimeOnly("org.apache.felix:org.apache.felix.framework.security:$felixSecurityVersion") {
exclude group: 'org.osgi'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
bnd.identity;id='net.corda.test-impl-two',\
bnd.identity;id='junit-jupiter-engine',\
bnd.identity;id='junit-platform-launcher',\
bnd.identity;id='slf4j.api',\
bnd.identity;id='net.corda.slf4jv1',\
bnd.identity;id='slf4j.simple'

-runstartlevel: \
Expand Down
1 change: 1 addition & 0 deletions libs/configuration/configuration-validation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ dependencies {
because "Version bundled with current version of 'com.networknt:json-schema-validator' does not have OSGi manifest."
}
}
integrationTestRuntimeOnly project(':testing:slf4jv1')
}
2 changes: 1 addition & 1 deletion libs/kotlin-reflection/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ dependencies {
testRuntimeOnly "org.ow2.asm:asm:$asmVersion"

integrationTestImplementation project(':libs:kotlin-reflection:kotlin-reflection-test-example')
integrationTestImplementation 'org.slf4j:slf4j-api'
integrationTestImplementation "org.apache.felix:org.apache.felix.framework:$felixVersion"
integrationTestImplementation project(':testing:slf4jv1')
integrationTestImplementation libs.junit
integrationTestRuntimeOnly libs.junit.engine
integrationTestRuntimeOnly libs.junit.platform
Expand Down
1 change: 1 addition & 0 deletions libs/layered-property-map/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ dependencies {
testImplementation project(":testing:test-utilities")

integrationTestImplementation project(":libs:layered-property-map:layered-property-map-test-converter")
integrationTestRuntimeOnly project(':testing:slf4jv1')
}
2 changes: 1 addition & 1 deletion libs/sandbox-internal/test.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
bnd.identity;id='co.paralleluniverse.quasar-core',\
bnd.identity;id='junit-jupiter-engine',\
bnd.identity;id='junit-platform-launcher',\
bnd.identity;id='slf4j.api',\
bnd.identity;id='net.corda.slf4jv1',\
bnd.identity;id='slf4j.simple'

-runstartlevel: \
Expand Down
1 change: 1 addition & 0 deletions testing/p2p/inmemory-messaging-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ dependencies {

integrationTestApi project(":testing:test-utilities")
testImplementation project(":libs:lifecycle:lifecycle-impl")
integrationTestRuntimeOnly project(':testing:slf4jv1')
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SandboxSetupImpl @Activate constructor(
"org.apache.felix.scr",
"org.hibernate.orm.core",
"org.jetbrains.kotlin.osgi-bundle",
"slf4j.api"
"net.corda.slf4jv1"
))

private val REPLACEMENT_SERVICES = unmodifiableSet(setOf(
Expand Down
2 changes: 1 addition & 1 deletion testing/slf4jv1/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tasks.named('jar', Jar) {
archiveBaseName = 'corda-slf4jv1'

ext {
bundleVersion = parseMavenString(antlrVersion).OSGiVersion
bundleVersion = parseMavenString(libs.slf4j.api.get().version).OSGiVersion
}

bundle {
Expand Down