diff --git a/.travis.yml b/.travis.yml index abaadfddb..341896e0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,6 +42,7 @@ jobs: - env: JOB=sonatype - env: JOB=docker - env: JOB=aws + - env: JOB=jpms include: # JDK 8 @@ -57,6 +58,13 @@ jobs: jdk: openjdk11 script: travis_retry ./gradlew check install + # JDK 11 (modules) + - name: "Java 11 (modules)" + stage: test + jdk: openjdk11 + env: JOB=jpms + script: ./gradlew clean check install --continue -Pjpms + # deploy JDK 8 builds to Sonatype - name: "Publish to Sonatype" stage: deploy diff --git a/auth/basic/build.gradle b/auth/basic/build.gradle index 35495c15d..08224dd79 100644 --- a/auth/basic/build.gradle +++ b/auth/basic/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis Basic authentication filter' ext { moduleName = 'org.trellisldp.auth.basic' + testModules = ['tamaya.core'] } dependencies { @@ -14,8 +15,8 @@ dependencies { implementation("org.apache.tamaya:tamaya-api:$tamayaVersion") implementation("org.slf4j:slf4j-api:$slf4jVersion") + implementation("javax.xml.bind:jaxb-api:$jaxbVersion") - testRuntime("javax.xml.bind:jaxb-api:$jaxbVersion") testRuntime("javax.activation:javax.activation-api:$activationApiVersion") testImplementation("ch.qos.logback:logback-classic:$logbackVersion") diff --git a/auth/basic/src/main/java/module-info.java b/auth/basic/src/main/java/module-info.java new file mode 100644 index 000000000..3447d2d05 --- /dev/null +++ b/auth/basic/src/main/java/module-info.java @@ -0,0 +1,25 @@ +/* + * Licensed 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. + */ +module org.trellisldp.auth.basic { + exports org.trellisldp.auth.basic; + + requires slf4j.api; + requires tamaya.api; + requires javax.inject; + requires java.ws.rs; + requires java.xml.bind; + requires java.annotation; + + uses org.apache.tamaya.spi.ConfigurationProviderSpi; +} diff --git a/auth/oauth/build.gradle b/auth/oauth/build.gradle index 6baa858d0..38b71ceca 100644 --- a/auth/oauth/build.gradle +++ b/auth/oauth/build.gradle @@ -8,18 +8,19 @@ ext { } dependencies { - api("io.jsonwebtoken:jjwt-api:$jjwtVersion") api("javax.annotation:javax.annotation-api:$javaxAnnotationsVersion") api("javax.ws.rs:javax.ws.rs-api:$jaxrsVersion") api("org.glassfish.hk2.external:javax.inject:$javaxInjectVersion") + implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") implementation("commons-io:commons-io:$commonsIoVersion") - implementation("io.jsonwebtoken:jjwt-impl:$jjwtVersion") - implementation("io.jsonwebtoken:jjwt-jackson:$jjwtVersion") implementation("org.apache.tamaya:tamaya-api:$tamayaVersion") implementation("org.slf4j:slf4j-api:$slf4jVersion") + implementation("javax.xml.bind:jaxb-api:$jaxbVersion") + implementation("io.jsonwebtoken:jjwt-jackson:$jjwtVersion") + implementation("io.jsonwebtoken:jjwt-api:$jjwtVersion") + implementation("io.jsonwebtoken:jjwt-impl:$jjwtVersion") - testRuntime("javax.xml.bind:jaxb-api:$jaxbVersion") testRuntime("javax.activation:javax.activation-api:$activationApiVersion") testImplementation("ch.qos.logback:logback-classic:$logbackVersion") @@ -28,4 +29,3 @@ dependencies { testImplementation("org.glassfish.jersey.core:jersey-server:$jerseyVersion") testImplementation("org.mockito:mockito-core:$mockitoVersion") } - diff --git a/build.gradle b/build.gradle index fc3ce9bad..0005683ec 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,8 @@ ext { commonsRdfVersion = '0.5.0' javaxAnnotationsVersion = '1.3.2' javaxInjectVersion = '2.5.0-b62' + javaxJmsVersion = '2.0.1' + javaxManagementVersion = '1.1.2' jaxrsVersion = '2.1.1' metricsVersion = '4.0.5' slf4jVersion = '1.7.25' @@ -43,6 +45,7 @@ ext { kafkaVersion = '2.0.0' mustacheVersion = '0.9.5' rabbitMqVersion = '5.5.2' + validationVersion = '2.0.1.Final' /* Testing */ apiguardianVersion = '1.0.0' @@ -51,6 +54,7 @@ ext { commonsTextVersion = '1.6' junitVersion = '5.3.2' junitLauncherVersion = '1.3.2' + hamcrestVersion = '2.1' logbackVersion = '1.2.3' mockitoVersion = '2.23.4' qpidVersion = '7.1.0' @@ -149,8 +153,11 @@ allprojects { subproj -> } configurations.all { + exclude group: 'commons-logging', module: 'commons-logging' resolutionStrategy.dependencySubstitution { substitute module("org.apache.geronimo.specs:geronimo-annotation_1.2_spec") with module ("javax.annotation:javax.annotation-api:$javaxAnnotationsVersion") + substitute module("org.apache.geronimo.specs:geronimo-jms_1.1_spec") with module("javax.jms:javax.jms-api:$javaxJmsVersion") + substitute module("org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec") with module("javax.management.j2ee:javax.management.j2ee-api:$javaxManagementVersion") } resolutionStrategy.eachDependency { DependencyResolveDetails details -> if (details.requested.group.startsWith('com.fasterxml.jackson.')) { @@ -163,8 +170,70 @@ allprojects { subproj -> subprojects { subproj -> - sourceCompatibility = 1.8 - targetCompatibility = 1.8 + def jpms = JavaVersion.current().isJava11Compatible() && subproj.hasProperty("jpms") && + sourceSets.main.allJava.getFiles().stream().map { file -> file.getName() } + .anyMatch { file -> file == "module-info.java"} + + sourceCompatibility = jpms ? 11 : 8 + targetCompatibility = jpms ? 11 : 8 + + afterEvaluate { + if (jpms) { + compileJava { + inputs.property("moduleName", moduleName) + doFirst { + options.compilerArgs = [ + '--module-path', classpath.asPath, + ] + classpath = files() + } + } + compileTestJava { + inputs.property("moduleName", moduleName) + def mods = subproj.ext.has("testModules") ? subproj.ext.get("testModules") : [] + mods.add('org.junit.jupiter.api') + doFirst { + options.compilerArgs = [ + '--module-path', classpath.asPath, + '--add-modules', mods.join(','), + '--patch-module', "$moduleName=" + files(sourceSets.test.java.srcDirs).asPath, + ] + mods.forEach { mod -> options.compilerArgs += [ '--add-reads', "$moduleName=$mod"] } + classpath = files() + } + } + test { + inputs.property("moduleName", moduleName) + def mods = subproj.ext.has("testModules") ? subproj.ext.get("testModules") : [] + mods.add('org.junit.jupiter.api') + doFirst { + jvmArgs = [ + '--module-path', classpath.asPath, + '--add-modules', 'ALL-MODULE-PATH', + '--add-opens', "$moduleName/$moduleName=org.junit.platform.commons", + '--add-opens', "$moduleName/$moduleName=org.mockito", + '--patch-module', "$moduleName=" + files(sourceSets.main.output.resourcesDir, sourceSets.test.output).asPath, + ] + mods.forEach { mod -> jvmArgs += [ '--add-reads', "$moduleName=$mod"] } + classpath = files() + } + } + + javadoc { + options.addStringOption('-module-path', classpath.asPath) + } + } + } + + sourceSets { + main { + java { + if (!jpms) { + exclude '**/module-info.java' + } + } + } + } jar { from("$rootDir/LICENSE") { @@ -172,6 +241,10 @@ subprojects { subproj -> } } + test { + useJUnitPlatform() + } + checkstyle { configFile = rootProject.file('buildtools/src/main/resources/checkstyle/checkstyle.xml') configProperties.checkstyleConfigDir = rootProject.file('buildtools/src/main/resources/checkstyle/') @@ -337,7 +410,7 @@ subprojects { subproj -> links 'https://www.dropwizard.io/1.3.5/dropwizard-core/apidocs/' } - if (JavaVersion.current().isJava9Compatible()) { + if (JavaVersion.current().isJava11Compatible()) { options.addBooleanOption('html5', true) } } @@ -347,7 +420,7 @@ subprojects { subproj -> "implSpec:a:Implementation Requirements:", "implNote:a:Implementation Note:"] - if (JavaVersion.current().isJava9Compatible()) { + if (JavaVersion.current().isJava11Compatible()) { options.addBooleanOption('html5', true) } } @@ -356,10 +429,6 @@ subprojects { subproj -> skipProject = JavaVersion.current().isJava10Compatible() } - test { - useJUnitPlatform() - } - afterReleaseBuild.dependsOn docs afterReleaseBuild.dependsOn publish diff --git a/components/agent/build.gradle b/components/agent/build.gradle index 34d549765..3da3ca00c 100644 --- a/components/agent/build.gradle +++ b/components/agent/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis Agent' ext { moduleName = 'org.trellisldp.agent' + testModules = ['org.apache.commons.rdf.simple'] } dependencies { @@ -15,4 +16,3 @@ dependencies { testImplementation("ch.qos.logback:logback-classic:$logbackVersion") testImplementation("org.apache.commons:commons-rdf-simple:$commonsRdfVersion") } - diff --git a/components/agent/src/main/java/module-info.java b/components/agent/src/main/java/module-info.java new file mode 100644 index 000000000..36c59042f --- /dev/null +++ b/components/agent/src/main/java/module-info.java @@ -0,0 +1,24 @@ +/* + * Licensed 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. + */ +module org.trellisldp.agent { + exports org.trellisldp.agent; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.rdf.api; + + provides org.trellisldp.api.AgentService + with org.trellisldp.agent.SimpleAgentService; +} diff --git a/components/app-triplestore/build.gradle b/components/app-triplestore/build.gradle index 2782a01c7..ad391d6f4 100644 --- a/components/app-triplestore/build.gradle +++ b/components/app-triplestore/build.gradle @@ -6,12 +6,17 @@ ext { moduleName = 'org.trellisldp.app.triplestore' } +configurations.all { + exclude group: 'javax.el', module: 'javax.el-api' + exclude group: 'com.google.code.findbugs', module: 'jsr305' +} + dependencies { - compile("com.github.jsonld-java:jsonld-java:$jsonldVersion") + compile("com.github.jsonld-java:jsonld-java:$jsonldVersion") { + exclude group: 'org.apache.httpcomponents', module: 'httpclient-osgi' + exclude group: 'org.apache.httpcomponents', module: 'httpcore-osgi' + } compile("commons-codec:commons-codec:$commonsCodecVersion") - compile("io.dropwizard:dropwizard-core:$dropwizardVersion") - compile("io.dropwizard:dropwizard-metrics:$dropwizardVersion") - compile("io.dropwizard:dropwizard-http2:$dropwizardVersion") compile("javax.activation:javax.activation-api:$activationApiVersion") compile("javax.jms:javax.jms-api:$jmsApiVersion") compile("org.apache.activemq:activemq-client:$activeMqVersion") @@ -20,6 +25,10 @@ dependencies { compile("org.apache.jena:jena-tdb2:$jenaVersion") compile("org.apache.tamaya:tamaya-core:$tamayaVersion") compile("org.slf4j:slf4j-api:$slf4jVersion") + compile("javax.jms:javax.jms-api:$jmsApiVersion") + compile("javax.xml.bind:jaxb-api:$jaxbVersion") + compile("javax.validation:validation-api:$validationVersion") + compile("org.apache.commons:commons-rdf-api:$commonsRdfVersion") compile("org.apache.commons:commons-rdf-jena:$commonsRdfVersion") { exclude group: 'org.apache.jena', module: 'jena-osgi' exclude group: 'org.apache.servicemix.bundles', module: 'org.apache.servicemix.bundles.xerces' @@ -29,6 +38,7 @@ dependencies { compile project(':trellis-io-jena') compile project(':trellis-api') compile project(':trellis-http') + compile project(':trellis-app') compile project(':trellis-vocabulary') compile project(':trellis-file') compile project(':trellis-namespaces') @@ -40,19 +50,24 @@ dependencies { compile project(':trellis-jms') compile project(':trellis-rdfa') compile project(':trellis-kafka') - compile project(':trellis-app') compile project(':trellis-auth-oauth') compile project(':trellis-auth-basic') - runtime ("javax.xml.bind:jaxb-api:$jaxbVersion") + compile("io.dropwizard:dropwizard-core:$dropwizardVersion") + compile("io.dropwizard:dropwizard-metrics:$dropwizardVersion") + compile("io.dropwizard:dropwizard-http2:$dropwizardVersion") - testCompile("io.dropwizard:dropwizard-client:$dropwizardVersion") - testCompile("io.dropwizard:dropwizard-testing:$dropwizardVersion") - testCompile("org.apache.activemq:activemq-broker:$activeMqVersion") - testCompile("org.awaitility:awaitility:$awaitilityVersion") + testCompile("org.awaitility:awaitility:$awaitilityVersion") { + exclude group: "org.hamcrest", module: 'hamcrest-core' + exclude group: 'org.hamcrest', module: 'hamcrest-library' + } + testCompile("org.hamcrest:hamcrest:$hamcrestVersion") testCompile("ch.qos.logback:logback-classic:$logbackVersion") testCompile("org.mockito:mockito-core:$mockitoVersion") testCompile project(':trellis-test') + testCompile("io.dropwizard:dropwizard-client:$dropwizardVersion") + testCompile("io.dropwizard:dropwizard-testing:$dropwizardVersion") + testCompile("org.apache.activemq:activemq-broker:$activeMqVersion") } jar { @@ -60,3 +75,4 @@ jar { attributes('Automatic-Module-Name': moduleName) } } + diff --git a/components/app-triplestore/src/test/java/org/trellisldp/app/triplestore/TrellisApplicationTest.java b/components/app-triplestore/src/test/java/org/trellisldp/app/triplestore/TrellisApplicationTest.java index d5539e09e..52aa1fc7b 100644 --- a/components/app-triplestore/src/test/java/org/trellisldp/app/triplestore/TrellisApplicationTest.java +++ b/components/app-triplestore/src/test/java/org/trellisldp/app/triplestore/TrellisApplicationTest.java @@ -251,9 +251,9 @@ private static DropwizardTestSupport buildApplication() { config("notifications.type", "JMS"), config("notifications.connectionString", "vm://localhost"), config("auth.basic.usersFile", resourceFilePath("users.auth")), - config("binaries", resourceFilePath("data") + "/binaries"), - config("mementos", resourceFilePath("data") + "/mementos"), - config("namespaces", resourceFilePath("data/namespaces.json"))); + config("binaries", resourceFilePath("app-data") + "/binaries"), + config("mementos", resourceFilePath("app-data") + "/mementos"), + config("namespaces", resourceFilePath("app-data/namespaces.json"))); } private Graph convertToGraph(final Message msg) { diff --git a/components/app-triplestore/src/test/resources/data/namespaces.json b/components/app-triplestore/src/test/resources/app-data/namespaces.json similarity index 100% rename from components/app-triplestore/src/test/resources/data/namespaces.json rename to components/app-triplestore/src/test/resources/app-data/namespaces.json diff --git a/components/app/build.gradle b/components/app/build.gradle index 106125068..22990984d 100644 --- a/components/app/build.gradle +++ b/components/app/build.gradle @@ -10,6 +10,9 @@ dependencies { api("io.dropwizard:dropwizard-core:$dropwizardVersion") api project(':trellis-api') + implementation("javax.xml.bind:jaxb-api:$jaxbVersion") + implementation("javax.validation:validation-api:2.0.1.Final") + implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") implementation("org.apache.tamaya:tamaya-api:$tamayaVersion") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation project(':trellis-http') @@ -19,12 +22,10 @@ dependencies { implementation project(':trellis-auth-basic') implementation project(':trellis-auth-oauth') - testRuntime("javax.xml.bind:jaxb-api:$jaxbVersion") testRuntime("javax.activation:javax.activation-api:$activationApiVersion") testImplementation("ch.qos.logback:logback-classic:$logbackVersion") - testImplementation("io.dropwizard:dropwizard-client:$dropwizardVersion") - testImplementation("io.dropwizard:dropwizard-testing:$dropwizardVersion") + testImplementation("org.hamcrest:hamcrest:$hamcrestVersion") testImplementation("org.apache.commons:commons-rdf-jena:$commonsRdfVersion") { exclude group: 'org.apache.jena', module: 'jena-osgi' exclude group: 'org.apache.servicemix.bundles', module: 'org.apache.servicemix.bundles.xerces' @@ -32,12 +33,19 @@ dependencies { testImplementation("org.apache.jena:jena-arq:$jenaVersion") testImplementation("org.apache.jena:jena-rdfconnection:$jenaVersion") testImplementation("org.apache.tamaya:tamaya-core:$tamayaVersion") - testImplementation("org.awaitility:awaitility:$awaitilityVersion") + testImplementation("org.awaitility:awaitility:$awaitilityVersion") { + exclude group: 'org.hamcrest', module: 'hamcrest-core' + exclude group: 'org.hamcrest', module: 'hamcrest-library' + } testImplementation("org.bouncycastle:bcprov-jdk15on:$bouncycastleVersion") testImplementation("org.mockito:mockito-core:$mockitoVersion") testImplementation project(':trellis-triplestore') testImplementation project(':trellis-io-jena') testImplementation project(':trellis-file') + testImplementation("io.dropwizard:dropwizard-client:$dropwizardVersion") + testImplementation("io.dropwizard:dropwizard-testing:$dropwizardVersion") { + exclude group: 'org.hamcrest', module: 'hamcrest-core' + } } jar { diff --git a/components/audit/build.gradle b/components/audit/build.gradle index bf2364187..9e7e9bbfe 100644 --- a/components/audit/build.gradle +++ b/components/audit/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis Audit' ext { moduleName = 'org.trellisldp.audit' + testModules = ['org.apache.commons.rdf.simple'] } dependencies { @@ -15,4 +16,3 @@ dependencies { testImplementation("org.mockito:mockito-core:$mockitoVersion") testImplementation("org.apache.commons:commons-rdf-simple:$commonsRdfVersion") } - diff --git a/components/audit/src/main/java/module-info.java b/components/audit/src/main/java/module-info.java new file mode 100644 index 000000000..ee9518fba --- /dev/null +++ b/components/audit/src/main/java/module-info.java @@ -0,0 +1,24 @@ +/* + * Licensed 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. + */ +module org.trellisldp.audit { + exports org.trellisldp.audit; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.rdf.api; + + provides org.trellisldp.api.AuditService + with org.trellisldp.audit.DefaultAuditService; +} diff --git a/components/constraint-rules/build.gradle b/components/constraint-rules/build.gradle index b2f9574fb..9be064548 100644 --- a/components/constraint-rules/build.gradle +++ b/components/constraint-rules/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis Constraint Rules' ext { moduleName = 'org.trellisldp.constraint' + testModules = ['org.apache.commons.rdf.jena'] } dependencies { @@ -17,6 +18,6 @@ dependencies { exclude group: 'org.apache.servicemix.bundles', module: 'org.apache.servicemix.bundles.xerces' } testImplementation("org.apache.jena:jena-arq:$jenaVersion") + testImplementation("ch.qos.logback:logback-classic:$logbackVersion") testImplementation("org.mockito:mockito-core:$mockitoVersion") } - diff --git a/components/constraint-rules/src/main/java/module-info.java b/components/constraint-rules/src/main/java/module-info.java new file mode 100644 index 000000000..c2d79d60e --- /dev/null +++ b/components/constraint-rules/src/main/java/module-info.java @@ -0,0 +1,24 @@ +/* + * Licensed 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. + */ +module org.trellisldp.constraint { + exports org.trellisldp.constraint; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.rdf.api; + + provides org.trellisldp.api.ConstraintService + with org.trellisldp.constraint.LdpConstraints; +} diff --git a/components/event-serialization/build.gradle b/components/event-serialization/build.gradle index cab68df03..5f63080b2 100644 --- a/components/event-serialization/build.gradle +++ b/components/event-serialization/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis Event Serialization Module' ext { moduleName = 'org.trellisldp.event' + testModules = ['org.apache.commons.rdf.simple'] } dependencies { @@ -18,4 +19,3 @@ dependencies { testImplementation("org.mockito:mockito-core:$mockitoVersion") testImplementation("org.apache.commons:commons-rdf-simple:$commonsRdfVersion") } - diff --git a/components/event-serialization/src/main/java/module-info.java b/components/event-serialization/src/main/java/module-info.java new file mode 100644 index 000000000..9c30e8640 --- /dev/null +++ b/components/event-serialization/src/main/java/module-info.java @@ -0,0 +1,29 @@ +/* + * Licensed 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. + */ +module org.trellisldp.event { + exports org.trellisldp.event; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.rdf.api; + requires com.fasterxml.jackson.core; + requires com.fasterxml.jackson.databind; + requires com.fasterxml.jackson.datatype.jsr310; + + opens org.trellisldp.event to com.fasterxml.jackson.databind; + + provides org.trellisldp.api.ActivityStreamService + with org.trellisldp.event.EventSerializer; +} diff --git a/components/file/build.gradle b/components/file/build.gradle index 20b4f4152..f0689a53b 100644 --- a/components/file/build.gradle +++ b/components/file/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis File-based service implementations' ext { moduleName = 'org.trellisldp.file' + testModules = ['tamaya.core'] } dependencies { @@ -23,10 +24,7 @@ dependencies { implementation project(':trellis-vocabulary') testImplementation("ch.qos.logback:logback-classic:$logbackVersion") - //Note JSON-LD is transitive dependency, but the version can be managed here - testImplementation("com.github.jsonld-java:jsonld-java:$jsonldVersion") testImplementation("org.apache.tamaya:tamaya-core:$tamayaVersion") testImplementation("javax.annotation:javax.annotation-api:$javaxAnnotationsVersion") testImplementation("org.mockito:mockito-core:$mockitoVersion") } - diff --git a/components/file/src/main/java/module-info.java b/components/file/src/main/java/module-info.java new file mode 100644 index 000000000..d9735ea7f --- /dev/null +++ b/components/file/src/main/java/module-info.java @@ -0,0 +1,36 @@ +/* + * Licensed 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. + */ +module org.trellisldp.file { + exports org.trellisldp.file; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.codec; + requires org.apache.commons.io; + requires org.apache.commons.rdf.api; + requires org.apache.commons.rdf.jena; + requires org.apache.jena.arq; + requires javax.inject; + requires tamaya.api; + requires slf4j.api; + + provides org.trellisldp.api.BinaryService + with org.trellisldp.file.FileBinaryService; + provides org.trellisldp.api.MementoService + with org.trellisldp.file.FileMementoService; + + uses org.trellisldp.api.IdentifierService; + uses org.apache.tamaya.spi.ConfigurationProviderSpi; +} diff --git a/components/io-jena/build.gradle b/components/io-jena/build.gradle index 39f03a921..f73c70436 100644 --- a/components/io-jena/build.gradle +++ b/components/io-jena/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis IO Module (Jena)' ext { moduleName = 'org.trellisldp.io' + testModules = ['tamaya.core'] } dependencies { @@ -17,7 +18,9 @@ dependencies { exclude group: 'org.apache.servicemix.bundles', module: 'org.apache.servicemix.bundles.xerces' } implementation("org.apache.jena:jena-arq:$jenaVersion") - implementation("org.apache.tamaya:tamaya-api:$tamayaVersion") + implementation("org.apache.tamaya:tamaya-api:$tamayaVersion") { + exclude group: "org.apache.geronimo.specs", module: "geronimo-annotation_1.2_spec" + } implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation project(':trellis-vocabulary') @@ -25,4 +28,3 @@ dependencies { testImplementation("org.apache.tamaya:tamaya-core:$tamayaVersion") testImplementation("org.mockito:mockito-core:$mockitoVersion") } - diff --git a/components/io-jena/src/main/java/module-info.java b/components/io-jena/src/main/java/module-info.java new file mode 100644 index 000000000..ace02e453 --- /dev/null +++ b/components/io-jena/src/main/java/module-info.java @@ -0,0 +1,34 @@ +/* + * Licensed 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. + */ +module org.trellisldp.io { + exports org.trellisldp.io; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.io; + requires org.apache.commons.rdf.api; + requires org.apache.commons.rdf.jena; + requires org.apache.jena.arq; + requires javax.inject; + requires tamaya.api; + requires slf4j.api; + + provides org.trellisldp.api.IOService + with org.trellisldp.io.JenaIOService; + + uses org.trellisldp.api.NamespaceService; + uses org.trellisldp.api.RDFaWriterService; + uses org.apache.tamaya.spi.ConfigurationProviderSpi; +} diff --git a/components/namespaces/build.gradle b/components/namespaces/build.gradle index 0803f881a..00d0b1a45 100644 --- a/components/namespaces/build.gradle +++ b/components/namespaces/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis Namespace Manageer' ext { moduleName = 'org.trellisldp.namespaces' + testModules = ['org.apache.commons.rdf.simple', 'tamaya.core', 'org.trellisldp.vocabulary'] } dependencies { @@ -20,4 +21,3 @@ dependencies { testImplementation("org.apache.commons:commons-rdf-simple:$commonsRdfVersion") testImplementation project(':trellis-vocabulary') } - diff --git a/components/namespaces/src/main/java/module-info.java b/components/namespaces/src/main/java/module-info.java new file mode 100644 index 000000000..f1c0020ff --- /dev/null +++ b/components/namespaces/src/main/java/module-info.java @@ -0,0 +1,27 @@ +/* + * Licensed 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. + */ +module org.trellisldp.namespaces { + exports org.trellisldp.namespaces; + + requires transitive org.trellisldp.api; + + requires org.apache.commons.rdf.api; + requires com.fasterxml.jackson.core; + requires com.fasterxml.jackson.databind; + requires javax.inject; + requires tamaya.api; + + provides org.trellisldp.api.NamespaceService + with org.trellisldp.namespaces.NamespacesJsonContext; +} diff --git a/components/rdfa/build.gradle b/components/rdfa/build.gradle index 9c2ee51db..926e33403 100644 --- a/components/rdfa/build.gradle +++ b/components/rdfa/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis RDFa Module' ext { moduleName = 'org.trellisldp.rdfa' + testModules = ['org.apache.commons.rdf.jena', 'tamaya.core'] } dependencies { @@ -21,6 +22,7 @@ dependencies { exclude group: 'org.apache.servicemix.bundles', module: 'org.apache.servicemix.bundles.xerces' } testImplementation("org.apache.jena:jena-arq:$jenaVersion") + testImplementation("ch.qos.logback:logback-classic:$logbackVersion") testImplementation("org.apache.tamaya:tamaya-core:$tamayaVersion") testImplementation("org.mockito:mockito-core:$mockitoVersion") } diff --git a/components/rdfa/src/main/java/module-info.java b/components/rdfa/src/main/java/module-info.java new file mode 100644 index 000000000..49ae02071 --- /dev/null +++ b/components/rdfa/src/main/java/module-info.java @@ -0,0 +1,32 @@ +/* + * Licensed 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. + */ +module org.trellisldp.rdfa { + exports org.trellisldp.rdfa; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.rdf.api; + requires org.apache.jena.arq; + requires javax.inject; + requires tamaya.api; + requires compiler; + + uses org.trellisldp.api.NamespaceService; + + opens org.trellisldp.rdfa to compiler; + + provides org.trellisldp.api.RDFaWriterService + with org.trellisldp.rdfa.HtmlSerializer; +} diff --git a/components/test/build.gradle b/components/test/build.gradle index 89f0a56a9..b99b6bb7d 100644 --- a/components/test/build.gradle +++ b/components/test/build.gradle @@ -2,6 +2,10 @@ apply plugin: 'java-library' description = """Common tests for Trellis components""" +ext { + moduleName = 'org.trellisldp.test' +} + sonarqube { skipProject = true } @@ -11,13 +15,20 @@ dependencies { implementation("commons-io:commons-io:$commonsIoVersion") implementation("io.jsonwebtoken:jjwt-api:$jjwtVersion") implementation("javax.ws.rs:javax.ws.rs-api:$jaxrsVersion") + implementation("javax.xml.bind:jaxb-api:$jaxbVersion") implementation("org.apache.commons:commons-text:$commonsTextVersion") implementation("org.apache.commons:commons-rdf-jena:$commonsRdfVersion") { exclude group: "org.apache.jena", module: "jena-osgi" exclude group: 'org.apache.servicemix.bundles', module: 'org.apache.servicemix.bundles.xerces' } implementation("org.apache.jena:jena-arq:$jenaVersion") - implementation("org.awaitility:awaitility:$awaitilityVersion") + implementation("javax.xml.bind:jaxb-api:$jaxbVersion") + implementation("org.awaitility:awaitility:$awaitilityVersion") { + exclude group: 'org.hamcrest', module: 'hamcrest-library' + exclude group: 'org.hamcrest', module: 'hamcrest-core' + } + implementation("org.hamcrest:hamcrest:$hamcrestVersion") + implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation("org.junit.jupiter:junit-jupiter-api:$junitVersion") implementation project(':trellis-api') implementation project(':trellis-http') @@ -26,6 +37,13 @@ dependencies { runtime("org.junit.jupiter:junit-jupiter-engine:$junitVersion") - testCompile("org.mockito:mockito-core:$mockitoVersion") + testImplementation("ch.qos.logback:logback-classic:$logbackVersion") + testImplementation("org.mockito:mockito-core:$mockitoVersion") +} + +jar { + manifest { + attributes('Automatic-Module-Name': moduleName) + } } diff --git a/components/test/src/main/java/module-info.java b/components/test/src/main/java/module-info.java new file mode 100644 index 000000000..ac4df2a7f --- /dev/null +++ b/components/test/src/main/java/module-info.java @@ -0,0 +1,33 @@ +/* + * Licensed 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. + */ +module org.trellisldp.test { + exports org.trellisldp.test; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.http; + requires transitive org.trellisldp.io; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.codec; + requires org.apache.commons.io; + requires org.apache.commons.rdf.api; + requires org.apache.commons.rdf.jena; + requires org.apache.jena.arq; + + requires java.annotation; + requires java.ws.rs; + requires java.xml.bind; + requires javax.inject; + requires slf4j.api; +} diff --git a/components/triplestore/build.gradle b/components/triplestore/build.gradle index b267c20ce..1dea3bd9b 100644 --- a/components/triplestore/build.gradle +++ b/components/triplestore/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis Triplestore' ext { moduleName = 'org.trellisldp.triplestore' + testModules = ['tamaya.core', 'org.trellisldp.test'] } dependencies { @@ -25,8 +26,11 @@ dependencies { testImplementation("ch.qos.logback:logback-classic:$logbackVersion") testImplementation("org.apache.tamaya:tamaya-core:$tamayaVersion") - testImplementation("org.awaitility:awaitility:$awaitilityVersion") testImplementation("org.mockito:mockito-core:$mockitoVersion") testImplementation project(':trellis-test'); + testImplementation("org.awaitility:awaitility:$awaitilityVersion") { + exclude group: "org.hamcrest", module: 'hamcrest-core' + exclude group: 'org.hamcrest', module: 'hamcrest-library' + } + testImplementation("org.hamcrest:hamcrest:$hamcrestVersion") } - diff --git a/components/triplestore/src/main/java/module-info.java b/components/triplestore/src/main/java/module-info.java new file mode 100644 index 000000000..3e48c3244 --- /dev/null +++ b/components/triplestore/src/main/java/module-info.java @@ -0,0 +1,38 @@ +/* + * Licensed 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. + */ +module org.trellisldp.triplestore { + exports org.trellisldp.triplestore; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.audit; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.io; + requires org.apache.commons.rdf.api; + requires org.apache.commons.rdf.jena; + requires org.apache.jena.arq; + + requires javax.inject; + requires slf4j.api; + requires tamaya.api; + + provides org.trellisldp.api.ResourceService + with org.trellisldp.triplestore.TriplestoreResourceService; + + provides org.trellisldp.api.AuditService + with org.trellisldp.triplestore.TriplestoreResourceService; + + uses org.trellisldp.api.IdentifierService; + uses org.apache.tamaya.spi.ConfigurationProviderSpi; +} diff --git a/components/webac/build.gradle b/components/webac/build.gradle index 34460e45a..8f1488f0c 100644 --- a/components/webac/build.gradle +++ b/components/webac/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis WebAC Module' ext { moduleName = 'org.trellisldp.webac' + testModules = ['org.apache.commons.rdf.jena', 'tamaya.core'] } dependencies { @@ -26,4 +27,3 @@ dependencies { testImplementation("org.mockito:mockito-core:$mockitoVersion") testImplementation project(':trellis-triplestore') } - diff --git a/components/webac/src/main/java/module-info.java b/components/webac/src/main/java/module-info.java new file mode 100644 index 000000000..a2ee62081 --- /dev/null +++ b/components/webac/src/main/java/module-info.java @@ -0,0 +1,31 @@ +/* + * Licensed 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. + */ +module org.trellisldp.webac { + exports org.trellisldp.webac; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.rdf.api; + + requires javax.inject; + requires slf4j.api; + requires tamaya.api; + + provides org.trellisldp.api.AccessControlService + with org.trellisldp.webac.WebACService; + + uses org.trellisldp.api.ResourceService; + uses org.apache.tamaya.spi.ConfigurationProviderSpi; +} diff --git a/core/api/build.gradle b/core/api/build.gradle index 7755d8b11..f782837f3 100644 --- a/core/api/build.gradle +++ b/core/api/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis API' ext { moduleName = 'org.trellisldp.api' + testModules = ['org.trellisldp.vocabulary', 'org.apache.commons.rdf.jena'] } dependencies { @@ -19,7 +20,8 @@ dependencies { } testImplementation("org.apache.jena:jena-arq:$jenaVersion") testImplementation("org.apache.commons:commons-text:$commonsTextVersion") - testImplementation("org.slf4j:slf4j-api:$slf4jVersion") testImplementation project(':trellis-vocabulary') + + testRuntimeClasspath("ch.qos.logback:logback-classic:$logbackVersion") } diff --git a/core/api/src/main/java/module-info.java b/core/api/src/main/java/module-info.java new file mode 100644 index 000000000..2a2c94d89 --- /dev/null +++ b/core/api/src/main/java/module-info.java @@ -0,0 +1,20 @@ +/* + * Licensed 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. + */ +module org.trellisldp.api { + exports org.trellisldp.api; + + requires org.apache.commons.rdf.api; + + uses org.apache.commons.rdf.api.RDF; +} diff --git a/core/api/src/test/resources/logback-test.xml b/core/api/src/test/resources/logback-test.xml new file mode 100644 index 000000000..aa2e08364 --- /dev/null +++ b/core/api/src/test/resources/logback-test.xml @@ -0,0 +1,16 @@ + + + + + + %p %d{HH:mm:ss.SSS} \(%c{0}\) %m%n + + + + + + + + + + diff --git a/core/http/build.gradle b/core/http/build.gradle index 4efe76300..5db634eb0 100644 --- a/core/http/build.gradle +++ b/core/http/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis HTTP API' ext { moduleName = 'org.trellisldp.http' + testModules = ['org.trellisldp.io', 'org.trellisldp.audit', 'org.trellisldp.agent'] } dependencies { @@ -18,13 +19,13 @@ dependencies { implementation("commons-codec:commons-codec:$commonsCodecVersion") implementation("commons-io:commons-io:$commonsIoVersion") + implementation("javax.xml.bind:jaxb-api:$jaxbVersion") implementation("org.apache.tamaya:tamaya-api:$tamayaVersion") implementation("org.slf4j:slf4j-api:$slf4jVersion") implementation project(':trellis-vocabulary') testImplementation("com.fasterxml.jackson.core:jackson-core:$jacksonVersion") testImplementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - testImplementation("com.google.guava:guava:$guavaVersion") testImplementation("org.apache.commons:commons-rdf-simple:$commonsRdfVersion") testImplementation("org.apache.tamaya:tamaya-core:$tamayaVersion") testImplementation("org.glassfish.jersey.core:jersey-server:$jerseyVersion") @@ -38,8 +39,21 @@ dependencies { testImplementation project(':trellis-event-serialization') testImplementation project(':trellis-io-jena') - testRuntimeClasspath("javax.xml.bind:jaxb-api:$jaxbVersion") testRuntimeClasspath("javax.activation:javax.activation-api:$activationApiVersion") testRuntimeClasspath("ch.qos.logback:logback-classic:$logbackVersion") } +if (project.sourceCompatibility.isJava11Compatible()) { + test { + inputs.property("moduleName", moduleName) + doFirst { + jvmArgs += [ + '--add-opens', "$moduleName/org.trellisldp.http.impl=org.junit.platform.commons", + '--add-opens', "$moduleName/org.trellisldp.http.impl=org.mockito", + '--add-opens', "$moduleName/org.trellisldp.http.core=org.junit.platform.commons", + '--add-opens', "$moduleName/org.trellisldp.http.core=org.mockito", + '--add-opens', "java.base/java.net=jersey.client", + ] + } + } +} diff --git a/core/http/src/main/java/module-info.java b/core/http/src/main/java/module-info.java new file mode 100644 index 000000000..b170d1116 --- /dev/null +++ b/core/http/src/main/java/module-info.java @@ -0,0 +1,35 @@ +/* + * Licensed 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. + */ +module org.trellisldp.http { + exports org.trellisldp.http; + exports org.trellisldp.http.core; + + requires transitive org.trellisldp.api; + requires transitive org.trellisldp.vocabulary; + + requires org.apache.commons.codec; + requires org.apache.commons.io; + requires org.apache.commons.rdf.api; + + requires slf4j.api; + requires tamaya.api; + requires javax.inject; + requires java.ws.rs; + requires java.xml.bind; + requires java.annotation; + requires cdi.api; + + uses org.trellisldp.api.ConstraintService; + uses org.trellisldp.http.core.TimemapGenerator; +} diff --git a/core/http/src/test/java/org/trellisldp/http/BaseTrellisHttpResourceTest.java b/core/http/src/test/java/org/trellisldp/http/BaseTrellisHttpResourceTest.java index 1b5aca5b2..da4d5d099 100644 --- a/core/http/src/test/java/org/trellisldp/http/BaseTrellisHttpResourceTest.java +++ b/core/http/src/test/java/org/trellisldp/http/BaseTrellisHttpResourceTest.java @@ -13,7 +13,6 @@ */ package org.trellisldp.http; -import static com.google.common.collect.Sets.newHashSet; import static java.nio.charset.StandardCharsets.UTF_8; import static java.time.Instant.MAX; import static java.time.Instant.ofEpochSecond; @@ -121,14 +120,14 @@ abstract class BaseTrellisHttpResourceTest extends JerseyTest { protected static final IRI childIdentifier = rdf.createIRI(TRELLIS_DATA_PREFIX + CHILD_PATH); protected static final IRI deletedIdentifier = rdf.createIRI(TRELLIS_DATA_PREFIX + DELETED_PATH); protected static final IRI userDeletedIdentifier = rdf.createIRI(TRELLIS_DATA_PREFIX + USER_DELETED_PATH); - protected static final Set allInteractionModels = newHashSet(LDP.Resource, LDP.RDFSource, LDP.NonRDFSource, - LDP.Container, LDP.BasicContainer, LDP.DirectContainer, LDP.IndirectContainer); + protected static final Set allInteractionModels = new HashSet<>(asList(LDP.Resource, LDP.RDFSource, + LDP.NonRDFSource, LDP.Container, LDP.BasicContainer, LDP.DirectContainer, LDP.IndirectContainer)); protected static final String BASE_URL = "http://example.org/"; protected static final String HUB = "http://hub.example.org/"; - protected static final Set allModes = newHashSet(ACL.Append, ACL.Control, ACL.Read, ACL.Write); + protected static final Set allModes = new HashSet<>(asList(ACL.Append, ACL.Control, ACL.Read, ACL.Write)); protected static final BinaryMetadata testBinary = BinaryMetadata.builder(binaryInternalIdentifier) .mimeType(BINARY_MIME_TYPE).build(); diff --git a/core/http/src/test/java/org/trellisldp/http/impl/BaseTestHandler.java b/core/http/src/test/java/org/trellisldp/http/impl/BaseTestHandler.java index 5346bad2f..c8b736ff1 100644 --- a/core/http/src/test/java/org/trellisldp/http/impl/BaseTestHandler.java +++ b/core/http/src/test/java/org/trellisldp/http/impl/BaseTestHandler.java @@ -13,7 +13,6 @@ */ package org.trellisldp.http.impl; -import static com.google.common.collect.Sets.newHashSet; import static java.nio.charset.StandardCharsets.UTF_8; import static java.time.Instant.ofEpochSecond; import static java.util.Arrays.asList; @@ -105,8 +104,8 @@ abstract class BaseTestHandler { protected static final String baseUrl = "http://example.org/"; protected static final RDF rdf = getInstance(); protected static final IRI root = rdf.createIRI(TRELLIS_DATA_PREFIX); - protected static final Set allInteractionModels = newHashSet(LDP.Resource, LDP.RDFSource, - LDP.NonRDFSource, LDP.Container, LDP.BasicContainer, LDP.DirectContainer, LDP.IndirectContainer); + protected static final Set allInteractionModels = new HashSet<>(asList(LDP.Resource, LDP.RDFSource, + LDP.NonRDFSource, LDP.Container, LDP.BasicContainer, LDP.DirectContainer, LDP.IndirectContainer)); protected static final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + "resource"); protected static final Instant time = ofEpochSecond(1496262729); diff --git a/core/vocabulary/build.gradle b/core/vocabulary/build.gradle index e69e662f8..50dcea950 100644 --- a/core/vocabulary/build.gradle +++ b/core/vocabulary/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis Vocabularies' ext { moduleName = 'org.trellisldp.vocabulary' + testModules = ['org.apache.commons.rdf.jena'] } dependencies { @@ -19,4 +20,3 @@ dependencies { testRuntimeClasspath("ch.qos.logback:logback-classic:$logbackVersion") } - diff --git a/core/vocabulary/src/main/java/module-info.java b/core/vocabulary/src/main/java/module-info.java new file mode 100644 index 000000000..1fe1d8af8 --- /dev/null +++ b/core/vocabulary/src/main/java/module-info.java @@ -0,0 +1,20 @@ +/* + * Licensed 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. + */ +module org.trellisldp.vocabulary { + exports org.trellisldp.vocabulary; + + requires org.apache.commons.rdf.api; + + uses org.apache.commons.rdf.api.RDF; +} diff --git a/notifications/amqp/build.gradle b/notifications/amqp/build.gradle index 2c368b862..e70fcc29a 100644 --- a/notifications/amqp/build.gradle +++ b/notifications/amqp/build.gradle @@ -3,8 +3,13 @@ apply plugin: 'biz.aQute.bnd.builder' description = 'Trellis Notifications (AMQP)' +configurations { + qpid +} + ext { moduleName = 'org.trellisldp.amqp' + testModules = ['tamaya.core', 'org.trellisldp.vocabulary', 'org.trellisldp.event', 'org.apache.commons.rdf.simple'] } dependencies { @@ -18,11 +23,28 @@ dependencies { testImplementation("ch.qos.logback:logback-classic:$logbackVersion") testImplementation("com.sleepycat:je:$sleepycatVersion") testImplementation("org.apache.commons:commons-rdf-simple:$commonsRdfVersion") - testImplementation("org.apache.qpid:qpid-broker:$qpidVersion") testImplementation("org.apache.tamaya:tamaya-core:$tamayaVersion") testImplementation("org.mockito:mockito-core:$mockitoVersion") testImplementation project(':trellis-event-serialization') testImplementation project(':trellis-vocabulary') + + qpid "org.apache.qpid:qpid-broker:$qpidVersion" + + if (!project.sourceCompatibility.isJava11Compatible()) { + testImplementation("org.apache.qpid:qpid-broker:$qpidVersion") + } +} + +configurations.all { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + if (details.requested.group.startsWith('com.fasterxml.jackson.')) { + details.useVersion jacksonVersion + details.because 'Jackson modules should use a consistent version' + } + if (details.requested.group == 'com.sleepycat') { + details.useVersion sleepycatVersion + } + } } test { @@ -32,3 +54,24 @@ test { systemProperty 'trellis.amqp.uri', "amqp://guest:guest@localhost:${port}/testing" } +if (project.sourceCompatibility.isJava11Compatible()) { + compileTestJava { + inputs.property("moduleName", moduleName) + doFirst { + options.compilerArgs += [ + '--add-reads', "$moduleName=ALL-UNNAMED", + ] + classpath = files(configurations.qpid) + } + } + + test { + inputs.property("moduleName", moduleName) + doFirst { + jvmArgs += [ + '--add-reads', "$moduleName=ALL-UNNAMED", + ] + classpath = files(configurations.qpid) + } + } +} diff --git a/notifications/amqp/src/main/java/module-info.java b/notifications/amqp/src/main/java/module-info.java new file mode 100644 index 000000000..42b0ecf51 --- /dev/null +++ b/notifications/amqp/src/main/java/module-info.java @@ -0,0 +1,28 @@ +/* + * Licensed 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. + */ +module org.trellisldp.amqp { + exports org.trellisldp.amqp; + + requires org.trellisldp.api; + requires org.apache.commons.rdf.api; + requires javax.inject; + requires tamaya.api; + requires slf4j.api; + + provides org.trellisldp.api.EventService + with org.trellisldp.amqp.AmqpPublisher; + + uses org.trellisldp.api.ActivityStreamService; + uses org.apache.tamaya.spi.ConfigurationProviderSpi; +} diff --git a/notifications/jms/build.gradle b/notifications/jms/build.gradle index 769eae48f..11f607626 100644 --- a/notifications/jms/build.gradle +++ b/notifications/jms/build.gradle @@ -3,8 +3,13 @@ apply plugin: 'biz.aQute.bnd.builder' description = 'Trellis Notifications (JMS)' +configurations { + activemq +} + ext { moduleName = 'org.trellisldp.jms' + testModules = ['tamaya.core', 'org.trellisldp.vocabulary', 'org.trellisldp.event', 'org.apache.commons.rdf.simple'] } dependencies { @@ -17,11 +22,37 @@ dependencies { implementation("org.slf4j:slf4j-api:$slf4jVersion") testImplementation("ch.qos.logback:logback-classic:$logbackVersion") - testImplementation("org.apache.activemq:activemq-broker:$activeMqVersion") testImplementation("org.apache.commons:commons-rdf-simple:$commonsRdfVersion") testImplementation("org.apache.tamaya:tamaya-core:$tamayaVersion") testImplementation("org.mockito:mockito-core:$mockitoVersion") testImplementation project(':trellis-event-serialization') testImplementation project(':trellis-vocabulary') + + activemq("org.apache.activemq:activemq-broker:$activeMqVersion") { + exclude group: "com.fasterxml.jackson.core", module: "jackson-databind" + exclude group: "org.apache.activemq", module: "activemq-client" + } + + if (!project.sourceCompatibility.isJava11Compatible()) { + testImplementation("org.apache.activemq:activemq-broker:$activeMqVersion") + } } +if (project.sourceCompatibility.isJava11Compatible()) { + compileTestJava { + doFirst { + options.compilerArgs += [ + '--patch-module', "activemq.client=" + files(configurations.activemq).asPath, + ] + } + } + + test { + inputs.property("moduleName", moduleName) + doFirst { + jvmArgs += [ + '--patch-module', "activemq.client=" + files(configurations.activemq).asPath, + ] + } + } +} diff --git a/notifications/jms/src/main/java/module-info.java b/notifications/jms/src/main/java/module-info.java new file mode 100644 index 000000000..d155fc5d8 --- /dev/null +++ b/notifications/jms/src/main/java/module-info.java @@ -0,0 +1,31 @@ +/* + * Licensed 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. + */ +module org.trellisldp.jms { + exports org.trellisldp.jms; + + requires org.trellisldp.api; + requires org.apache.commons.rdf.api; + requires activemq.client; + requires java.naming; + requires javax.jms.api; + requires javax.inject; + requires tamaya.api; + requires slf4j.api; + + provides org.trellisldp.api.EventService + with org.trellisldp.jms.JmsPublisher; + + uses org.trellisldp.api.ActivityStreamService; + uses org.apache.tamaya.spi.ConfigurationProviderSpi; +} diff --git a/notifications/kafka/build.gradle b/notifications/kafka/build.gradle index 6a01d4861..fbc8addd4 100644 --- a/notifications/kafka/build.gradle +++ b/notifications/kafka/build.gradle @@ -5,6 +5,7 @@ description = 'Trellis Notifications (Kafka)' ext { moduleName = 'org.trellisldp.kafka' + testModules = ['tamaya.core', 'org.trellisldp.vocabulary', 'org.trellisldp.event', 'org.apache.commons.rdf.simple'] } dependencies { diff --git a/notifications/kafka/src/main/java/module-info.java b/notifications/kafka/src/main/java/module-info.java new file mode 100644 index 000000000..fc1ea5261 --- /dev/null +++ b/notifications/kafka/src/main/java/module-info.java @@ -0,0 +1,29 @@ +/* + * Licensed 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. + */ +module org.trellisldp.kafka { + exports org.trellisldp.kafka; + + requires org.trellisldp.api; + requires org.apache.commons.rdf.api; + requires kafka.clients; + requires javax.inject; + requires tamaya.api; + requires slf4j.api; + + provides org.trellisldp.api.EventService + with org.trellisldp.kafka.KafkaPublisher; + + uses org.trellisldp.api.ActivityStreamService; + uses org.apache.tamaya.spi.ConfigurationProviderSpi; +} diff --git a/platform/osgi/build.gradle b/platform/osgi/build.gradle index ec73f1d28..20b5d16a6 100644 --- a/platform/osgi/build.gradle +++ b/platform/osgi/build.gradle @@ -33,6 +33,7 @@ sonarqube { dependencies { compile("org.apache.jena:jena-osgi:$jenaVersion") compile("org.apache.commons:commons-compress:$commonsCompressVersion") + compile("javax.xml.bind:jaxb-api:$jaxbVersion") compile project(':trellis-api') compile project(':trellis-http') compile project(':trellis-io-jena') diff --git a/platform/server/build.gradle b/platform/server/build.gradle index 6b0076a13..14f1c7981 100644 --- a/platform/server/build.gradle +++ b/platform/server/build.gradle @@ -11,6 +11,16 @@ dependencies { compile project(':trellis-app-triplestore') runtime("javax.xml.bind:jaxb-api:$jaxbVersion") + + if (project.sourceCompatibility.isJava11Compatible()) { + runtime("io.dropwizard:dropwizard-core:$dropwizardVersion") + runtime("io.dropwizard:dropwizard-metrics:$dropwizardVersion") + runtime("io.dropwizard:dropwizard-http2:$dropwizardVersion") + + runtime("io.jsonwebtoken:jjwt-jackson:$jjwtVersion") + runtime("io.jsonwebtoken:jjwt-impl:$jjwtVersion") + runtime("io.jsonwebtoken:jjwt-api:$jjwtVersion") + } } ospackage {