From 96f47650b5b12d7ebb44fdb69c6981ab5e25d593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Prante?= Date: Mon, 4 Mar 2024 13:54:05 +0100 Subject: [PATCH] lift tests to module path --- benchmark/src/jmh/java/module-info.java | 5 ++ build.gradle | 10 +-- gradle.properties | 2 +- gradle/compile/java.gradle | 28 ++++++-- gradle/test/junit5.gradle | 1 - net-mime/build.gradle | 12 ++++ net-mime/src/test/java/module-info.java | 6 ++ .../xbib/net/mime/test/MimeMultipartTest.java | 2 +- net-path/build.gradle | 11 +++ net-path/src/test/java/module-info.java | 13 ++++ .../net/path/{ => test}/PathDecoderTest.java | 3 +- .../{ => test}/simple/PathMatcherTest.java | 2 +- .../{ => test}/simple/PathResolverTest.java | 3 +- .../net/path/{ => test}/simple/PathTest.java | 4 +- .../{ => test}/spring/PathMatcherTest.java | 3 +- .../{ => test}/structure/PathMatcherTest.java | 3 +- .../structure/PathResolverTest.java | 3 +- .../path/{ => test}/structure/PathTest.java | 4 +- net-resource/src/test/java/module-info.java | 4 ++ .../net/resource/{ => test}/BuilderTest.java | 4 +- .../net/resource/{ => test}/IRItoURLTest.java | 4 +- .../resource/{ => test}/RelativeEncoding.java | 4 +- .../xbib/net/resource/{ => test}/Test.java | 5 +- net-security/build.gradle | 11 +++ net-security/src/main/java/module-info.java | 1 + .../net/security/eddsa/math/GroupElement.java | 22 +++--- .../math/bigint/BigIntegerFieldElement.java | 2 +- .../math/ed25519/Ed25519FieldElement.java | 2 +- net-security/src/test/java/module-info.java | 14 ++++ .../{ => test}/CertificateReaderTest.java | 3 +- .../{ => test}/CreateKeyStoreTest.java | 4 +- .../{ => test}/PrivateKeyReaderTest.java | 3 +- .../{ => test}/ed25519/Ed25519KeyTest.java | 2 +- .../{ => test}/eddsa/Ed25519TestVectors.java | 4 +- .../{ => test}/eddsa/EdDSAEngineTest.java | 6 +- .../{ => test}/eddsa/EdDSAPrivateKeyTest.java | 4 +- .../{ => test}/eddsa/EdDSAPublicKeyTest.java | 4 +- .../eddsa/EdDSASecurityProviderTest.java | 3 +- .../security/{ => test}/eddsa/UtilsTest.java | 3 +- .../eddsa/math/AbstractFieldElementTest.java | 5 +- .../{ => test}/eddsa/math/ConstantsTest.java | 5 +- .../eddsa/math/GroupElementTest.java | 7 +- .../{ => test}/eddsa/math/MathUtils.java | 8 ++- .../eddsa/math/PrecomputationTestVectors.java | 9 +-- .../bigint/BigIntegerFieldElementTest.java | 8 ++- .../math/bigint/BigIntegerScalarOpsTest.java | 3 +- .../math/ed25519/Ed25519FieldElementTest.java | 7 +- .../Ed25519LittleEndianEncodingTest.java | 5 +- .../math/ed25519/Ed25519ScalarOpsTest.java | 5 +- .../eddsa/spec/EdDSANamedCurveTableTest.java | 5 +- .../eddsa/spec/EdDSAPrivateKeySpecTest.java | 6 +- .../UnsafeX509ExtendedTrustManager.java | 2 +- .../{ => test}/eddsa/math/baseDblPrecmp | 0 .../security/{ => test}/eddsa/math/basePrecmp | 0 .../net/security/{eddsa => test}/test.data | 0 net-socket/build.gradle | 11 +++ net-socket/src/main/java/module-info.java | 1 + net-socket/src/test/java/module-info.java | 8 +++ .../socket/{ => test}/notify/SystemdTest.java | 3 +- .../net/socket/{ => test}/v4/PingTest.java | 2 +- .../net/socket/{ => test}/v6/PingTest.java | 2 +- net/build.gradle | 11 +++ net/src/main/java/module-info.java | 67 +++++++++++++++++++ .../java/org/xbib/net/PercentEncoder.java | 2 +- .../java/org/xbib/net/scheme/DnsScheme.java | 6 +- .../java/org/xbib/net/scheme/FileScheme.java | 4 +- .../java/org/xbib/net/scheme/FtpScheme.java | 6 +- .../java/org/xbib/net/scheme/GitScheme.java | 6 +- .../xbib/net/scheme/GitSecureHttpScheme.java | 6 +- .../org/xbib/net/scheme/GopherScheme.java | 4 +- .../java/org/xbib/net/scheme/HttpScheme.java | 6 +- .../java/org/xbib/net/scheme/HttpsScheme.java | 37 ++++++++++ .../java/org/xbib/net/scheme/ImapScheme.java | 6 +- ...SecureImapScheme.java => ImapsScheme.java} | 4 +- .../java/org/xbib/net/scheme/IrcScheme.java | 6 +- .../java/org/xbib/net/scheme/LdapScheme.java | 6 +- ...SecureLdapScheme.java => LdapsScheme.java} | 4 +- .../java/org/xbib/net/scheme/NewsScheme.java | 6 +- .../java/org/xbib/net/scheme/NntpScheme.java | 4 +- .../java/org/xbib/net/scheme/Pop3Scheme.java | 6 +- .../java/org/xbib/net/scheme/RedisScheme.java | 4 +- .../java/org/xbib/net/scheme/RsyncScheme.java | 4 +- .../java/org/xbib/net/scheme/RtmpScheme.java | 4 +- .../java/org/xbib/net/scheme/RtspScheme.java | 4 +- .../org/xbib/net/scheme/SchemeRegistry.java | 12 ++-- .../org/xbib/net/scheme/SecureHttpScheme.java | 12 ---- .../org/xbib/net/scheme/SecureNewsScheme.java | 4 +- .../org/xbib/net/scheme/SecurePop3Scheme.java | 4 +- .../java/org/xbib/net/scheme/SftpScheme.java | 4 +- .../java/org/xbib/net/scheme/SmtpScheme.java | 6 +- ...SecureSmtpScheme.java => SmtpsScheme.java} | 4 +- .../java/org/xbib/net/scheme/SshScheme.java | 6 +- .../org/xbib/net/scheme/TelnetScheme.java | 4 +- .../java/org/xbib/net/scheme/TftpScheme.java | 4 +- .../java/org/xbib/net/scheme/UrnScheme.java | 4 +- .../{WebSocketScheme.java => WsScheme.java} | 6 +- ...ureWebSocketScheme.java => WssScheme.java} | 4 +- net/src/test/java/module-info.java | 12 ++++ .../test/java/org/xbib/net/package-info.java | 4 -- .../org/xbib/net/template/package-info.java | 4 -- .../xbib/net/{ => test}/NetworkUtilsTest.java | 7 +- .../xbib/net/{ => test}/ParameterTest.java | 8 ++- .../net/{ => test}/PathNormalizerTest.java | 2 +- .../net/{ => test}/PercentDecoderTest.java | 5 +- .../net/{ => test}/PercentEncoderTest.java | 4 +- .../xbib/net/{ => test}/URIComponentTest.java | 2 +- .../xbib/net/{ => test}/URLBuilderTest.java | 5 +- .../xbib/net/{ => test}/URLParserTest.java | 8 ++- .../xbib/net/{ => test}/URLResolverTest.java | 4 +- .../java/org/xbib/net/{ => test}/URLTest.java | 27 +++++--- .../xbib/net/{ => test}/resource/IRITest.java | 2 +- .../{ => test}/template/URITemplateTest.java | 25 ++++--- .../{ => test}/util/JsonFileStoreTest.java | 4 +- .../net/test/template}/extended-tests.json | 0 .../xbib/net/test/template}/lists.json | 0 .../net/test/template}/multipleLists.json | 0 .../net/test/template}/multipleStrings.json | 0 .../net/test/template}/negative-tests.json | 0 .../xbib/net/test/template}/rfcExamples.json | 0 .../template}/spec-examples-by-section.json | 0 .../net/test/template}/spec-examples.json | 0 .../xbib/net/test/template}/strings.json | 0 .../{ => org/xbib/net/test}/urltestdata.json | 0 123 files changed, 522 insertions(+), 214 deletions(-) create mode 100644 benchmark/src/jmh/java/module-info.java create mode 100644 net-mime/build.gradle create mode 100644 net-mime/src/test/java/module-info.java create mode 100644 net-path/src/test/java/module-info.java rename net-path/src/test/java/org/xbib/net/path/{ => test}/PathDecoderTest.java (98%) rename net-path/src/test/java/org/xbib/net/path/{ => test}/simple/PathMatcherTest.java (99%) rename net-path/src/test/java/org/xbib/net/path/{ => test}/simple/PathResolverTest.java (99%) rename net-path/src/test/java/org/xbib/net/path/{ => test}/simple/PathTest.java (98%) rename net-path/src/test/java/org/xbib/net/path/{ => test}/spring/PathMatcherTest.java (99%) rename net-path/src/test/java/org/xbib/net/path/{ => test}/structure/PathMatcherTest.java (98%) rename net-path/src/test/java/org/xbib/net/path/{ => test}/structure/PathResolverTest.java (99%) rename net-path/src/test/java/org/xbib/net/path/{ => test}/structure/PathTest.java (98%) create mode 100644 net-resource/src/test/java/module-info.java rename net-resource/src/test/java/org/xbib/net/resource/{ => test}/BuilderTest.java (99%) rename net-resource/src/test/java/org/xbib/net/resource/{ => test}/IRItoURLTest.java (98%) rename net-resource/src/test/java/org/xbib/net/resource/{ => test}/RelativeEncoding.java (97%) rename net-resource/src/test/java/org/xbib/net/resource/{ => test}/Test.java (99%) create mode 100644 net-security/src/test/java/module-info.java rename net-security/src/test/java/org/xbib/net/security/{ => test}/CertificateReaderTest.java (91%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/CreateKeyStoreTest.java (98%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/PrivateKeyReaderTest.java (98%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/ed25519/Ed25519KeyTest.java (93%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/Ed25519TestVectors.java (95%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/EdDSAEngineTest.java (97%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/EdDSAPrivateKeyTest.java (95%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/EdDSAPublicKeyTest.java (95%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/EdDSASecurityProviderTest.java (90%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/UtilsTest.java (98%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/math/AbstractFieldElementTest.java (97%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/math/ConstantsTest.java (93%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/math/GroupElementTest.java (99%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/math/MathUtils.java (98%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/math/PrecomputationTestVectors.java (94%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/math/bigint/BigIntegerFieldElementTest.java (91%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/math/bigint/BigIntegerScalarOpsTest.java (95%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/math/ed25519/Ed25519FieldElementTest.java (90%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/math/ed25519/Ed25519LittleEndianEncodingTest.java (95%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/math/ed25519/Ed25519ScalarOpsTest.java (94%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/spec/EdDSANamedCurveTableTest.java (78%) rename net-security/src/test/java/org/xbib/net/security/{ => test}/eddsa/spec/EdDSAPrivateKeySpecTest.java (88%) rename net-security/src/test/java/org/xbib/net/security/{ssl => test}/trustmanager/UnsafeX509ExtendedTrustManager.java (98%) rename net-security/src/test/resources/org/xbib/net/security/{ => test}/eddsa/math/baseDblPrecmp (100%) rename net-security/src/test/resources/org/xbib/net/security/{ => test}/eddsa/math/basePrecmp (100%) rename net-security/src/test/resources/org/xbib/net/security/{eddsa => test}/test.data (100%) create mode 100644 net-socket/src/test/java/module-info.java rename net-socket/src/test/java/org/xbib/net/socket/{ => test}/notify/SystemdTest.java (68%) rename net-socket/src/test/java/org/xbib/net/socket/{ => test}/v4/PingTest.java (95%) rename net-socket/src/test/java/org/xbib/net/socket/{ => test}/v6/PingTest.java (96%) create mode 100644 net/src/main/java/org/xbib/net/scheme/HttpsScheme.java rename net/src/main/java/org/xbib/net/scheme/{SecureImapScheme.java => ImapsScheme.java} (70%) rename net/src/main/java/org/xbib/net/scheme/{SecureLdapScheme.java => LdapsScheme.java} (70%) delete mode 100644 net/src/main/java/org/xbib/net/scheme/SecureHttpScheme.java rename net/src/main/java/org/xbib/net/scheme/{SecureSmtpScheme.java => SmtpsScheme.java} (70%) rename net/src/main/java/org/xbib/net/scheme/{WebSocketScheme.java => WsScheme.java} (53%) rename net/src/main/java/org/xbib/net/scheme/{SecureWebSocketScheme.java => WssScheme.java} (55%) create mode 100644 net/src/test/java/module-info.java delete mode 100644 net/src/test/java/org/xbib/net/package-info.java delete mode 100644 net/src/test/java/org/xbib/net/template/package-info.java rename net/src/test/java/org/xbib/net/{ => test}/NetworkUtilsTest.java (89%) rename net/src/test/java/org/xbib/net/{ => test}/ParameterTest.java (97%) rename net/src/test/java/org/xbib/net/{ => test}/PathNormalizerTest.java (98%) rename net/src/test/java/org/xbib/net/{ => test}/PercentDecoderTest.java (97%) rename net/src/test/java/org/xbib/net/{ => test}/PercentEncoderTest.java (96%) rename net/src/test/java/org/xbib/net/{ => test}/URIComponentTest.java (98%) rename net/src/test/java/org/xbib/net/{ => test}/URLBuilderTest.java (98%) rename net/src/test/java/org/xbib/net/{ => test}/URLParserTest.java (98%) rename net/src/test/java/org/xbib/net/{ => test}/URLResolverTest.java (98%) rename net/src/test/java/org/xbib/net/{ => test}/URLTest.java (93%) rename net/src/test/java/org/xbib/net/{ => test}/resource/IRITest.java (99%) rename net/src/test/java/org/xbib/net/{ => test}/template/URITemplateTest.java (94%) rename net/src/test/java/org/xbib/net/{ => test}/util/JsonFileStoreTest.java (95%) rename net/src/test/resources/{ => org/xbib/net/test/template}/extended-tests.json (100%) rename net/src/test/resources/{ => org/xbib/net/test/template}/lists.json (100%) rename net/src/test/resources/{ => org/xbib/net/test/template}/multipleLists.json (100%) rename net/src/test/resources/{ => org/xbib/net/test/template}/multipleStrings.json (100%) rename net/src/test/resources/{ => org/xbib/net/test/template}/negative-tests.json (100%) rename net/src/test/resources/{ => org/xbib/net/test/template}/rfcExamples.json (100%) rename net/src/test/resources/{ => org/xbib/net/test/template}/spec-examples-by-section.json (100%) rename net/src/test/resources/{ => org/xbib/net/test/template}/spec-examples.json (100%) rename net/src/test/resources/{ => org/xbib/net/test/template}/strings.json (100%) rename net/src/test/resources/{ => org/xbib/net/test}/urltestdata.json (100%) diff --git a/benchmark/src/jmh/java/module-info.java b/benchmark/src/jmh/java/module-info.java new file mode 100644 index 0000000..0818b12 --- /dev/null +++ b/benchmark/src/jmh/java/module-info.java @@ -0,0 +1,5 @@ +module org.xbib.net.benchmark.jmh { + requires jmh.core; + requires org.xbib.net; + requires org.xbib.net.path; +} diff --git a/build.gradle b/build.gradle index 174444c..cca8011 100644 --- a/build.gradle +++ b/build.gradle @@ -1,18 +1,14 @@ plugins { - id "checkstyle" - id "pmd" id 'maven-publish' id 'signing' id "io.github.gradle-nexus.publish-plugin" version "2.0.0-rc-1" - id "com.github.spotbugs" version "6.0.0-beta.3" - id "org.cyclonedx.bom" version "1.7.4" id "org.xbib.gradle.plugin.asciidoctor" version "3.0.0" } wrapper { gradleVersion = libs.versions.gradle.get() - distributionType = Wrapper.DistributionType.ALL + distributionType = Wrapper.DistributionType.BIN } ext { @@ -36,11 +32,7 @@ subprojects { apply from: rootProject.file('gradle/compile/java.gradle') apply from: rootProject.file('gradle/test/junit5.gradle') apply from: rootProject.file('gradle/documentation/asciidoc.gradle') - apply from: rootProject.file('gradle/quality/checkstyle.gradle') - apply from: rootProject.file('gradle/quality/pmd.gradle') - //apply from: rootProject.file('gradle/quality/spotbugs.gradle') apply from: rootProject.file('gradle/publish/maven.gradle') } apply from: rootProject.file('gradle/publish/sonatype.gradle') apply from: rootProject.file('gradle/publish/forgejo.gradle') -apply from: rootProject.file('gradle/quality/cyclonedx.gradle') diff --git a/gradle.properties b/gradle.properties index dc81400..45f8bf5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ group = org.xbib name = net -version = 4.2.0 +version = 4.3.0 diff --git a/gradle/compile/java.gradle b/gradle/compile/java.gradle index be4708e..fbf9679 100644 --- a/gradle/compile/java.gradle +++ b/gradle/compile/java.gradle @@ -17,13 +17,29 @@ jar { } tasks.withType(JavaCompile) { - options.fork = true - options.forkOptions.jvmArgs += ['-Duser.language=en','-Duser.country=US'] - options.compilerArgs.add('-Xlint:all') - options.encoding = 'UTF-8' + doFirst { + options.fork = true + options.forkOptions.jvmArgs += ['-Duser.language=en','-Duser.country=US'] + options.encoding = 'UTF-8' + options.compilerArgs.add('-Xlint:all') + // enforce presence of module-info.java + options.compilerArgs.add("--module-path") + options.compilerArgs.add(classpath.asPath) + classpath = files() + } } tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - options.encoding = 'UTF-8' + doFirst { + options.addStringOption('Xdoclint:none', '-quiet') + options.encoding = 'UTF-8' + } +} + +tasks.withType(JavaExec) { + doFirst { + jvmArguments.add("--module-path") + jvmArguments.add(classpath.asPath) + classpath = files() + } } diff --git a/gradle/test/junit5.gradle b/gradle/test/junit5.gradle index 2d244c6..6aaed77 100644 --- a/gradle/test/junit5.gradle +++ b/gradle/test/junit5.gradle @@ -11,7 +11,6 @@ test { jvmArgs '--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED', '--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED', '--add-exports=java.base/sun.nio.ch=ALL-UNNAMED', - '--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED', '--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED', '--add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED', '--add-opens=java.base/java.lang=ALL-UNNAMED', diff --git a/net-mime/build.gradle b/net-mime/build.gradle new file mode 100644 index 0000000..1b8ea61 --- /dev/null +++ b/net-mime/build.gradle @@ -0,0 +1,12 @@ + + +def moduleName = 'org.xbib.net.mime.test' +def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ] + +tasks.named('compileTestJava') { + options.compilerArgs += patchArgs +} + +tasks.named('test') { + jvmArgs += patchArgs +} diff --git a/net-mime/src/test/java/module-info.java b/net-mime/src/test/java/module-info.java new file mode 100644 index 0000000..b20bef3 --- /dev/null +++ b/net-mime/src/test/java/module-info.java @@ -0,0 +1,6 @@ +module org.xbib.net.mime.test { + requires java.logging; + requires org.junit.jupiter.api; + requires org.xbib.net.mime; + exports org.xbib.net.mime.test; +} diff --git a/net-mime/src/test/java/org/xbib/net/mime/test/MimeMultipartTest.java b/net-mime/src/test/java/org/xbib/net/mime/test/MimeMultipartTest.java index 8204536..eb1d274 100644 --- a/net-mime/src/test/java/org/xbib/net/mime/test/MimeMultipartTest.java +++ b/net-mime/src/test/java/org/xbib/net/mime/test/MimeMultipartTest.java @@ -17,7 +17,7 @@ public class MimeMultipartTest { @Test public void multiPartTest() throws MimeException, IOException { - try (InputStream inputStream = getClass().getResourceAsStream("/org/xbib/net/mime/test/msg.txt")) { + try (InputStream inputStream = getClass().getResourceAsStream("msg.txt")) { Objects.requireNonNull(inputStream); MimeMultipartParser parser = new MimeMultipartParser("multipart/mixed; boundary=\"----=_Part_4_910054940.1065629194743\"; charset=\"ISO-8859-1\""); parser.parse(ByteBuffer.wrap(inputStream.readAllBytes()), diff --git a/net-path/build.gradle b/net-path/build.gradle index 3de5ef5..486bf44 100644 --- a/net-path/build.gradle +++ b/net-path/build.gradle @@ -1,3 +1,14 @@ dependencies { api project(':net') } + +def moduleName = 'org.xbib.net.path.test' +def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ] + +tasks.named('compileTestJava') { + options.compilerArgs += patchArgs +} + +tasks.named('test') { + jvmArgs += patchArgs +} diff --git a/net-path/src/test/java/module-info.java b/net-path/src/test/java/module-info.java new file mode 100644 index 0000000..f4b5ef9 --- /dev/null +++ b/net-path/src/test/java/module-info.java @@ -0,0 +1,13 @@ +module org.xbib.net.path.test { + requires transitive org.junit.jupiter.api; + requires org.hamcrest; + requires org.xbib.net.path; + exports org.xbib.net.path.test; + exports org.xbib.net.path.test.simple; + exports org.xbib.net.path.test.spring; + exports org.xbib.net.path.test.structure; + opens org.xbib.net.path.test; + opens org.xbib.net.path.test.simple; + opens org.xbib.net.path.test.spring; + opens org.xbib.net.path.test.structure; +} diff --git a/net-path/src/test/java/org/xbib/net/path/PathDecoderTest.java b/net-path/src/test/java/org/xbib/net/path/test/PathDecoderTest.java similarity index 98% rename from net-path/src/test/java/org/xbib/net/path/PathDecoderTest.java rename to net-path/src/test/java/org/xbib/net/path/test/PathDecoderTest.java index 0620b17..e0ee681 100644 --- a/net-path/src/test/java/org/xbib/net/path/PathDecoderTest.java +++ b/net-path/src/test/java/org/xbib/net/path/test/PathDecoderTest.java @@ -1,8 +1,9 @@ -package org.xbib.net.path; +package org.xbib.net.path.test; import org.junit.jupiter.api.Test; import org.xbib.net.Parameter; import org.xbib.net.URL; +import org.xbib.net.path.PathDecoder; import java.nio.charset.StandardCharsets; diff --git a/net-path/src/test/java/org/xbib/net/path/simple/PathMatcherTest.java b/net-path/src/test/java/org/xbib/net/path/test/simple/PathMatcherTest.java similarity index 99% rename from net-path/src/test/java/org/xbib/net/path/simple/PathMatcherTest.java rename to net-path/src/test/java/org/xbib/net/path/test/simple/PathMatcherTest.java index e6ee1e9..eff33e6 100644 --- a/net-path/src/test/java/org/xbib/net/path/simple/PathMatcherTest.java +++ b/net-path/src/test/java/org/xbib/net/path/test/simple/PathMatcherTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.path.simple; +package org.xbib.net.path.test.simple; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/net-path/src/test/java/org/xbib/net/path/simple/PathResolverTest.java b/net-path/src/test/java/org/xbib/net/path/test/simple/PathResolverTest.java similarity index 99% rename from net-path/src/test/java/org/xbib/net/path/simple/PathResolverTest.java rename to net-path/src/test/java/org/xbib/net/path/test/simple/PathResolverTest.java index a36fcdb..b8c10ed 100644 --- a/net-path/src/test/java/org/xbib/net/path/simple/PathResolverTest.java +++ b/net-path/src/test/java/org/xbib/net/path/test/simple/PathResolverTest.java @@ -1,8 +1,9 @@ -package org.xbib.net.path.simple; +package org.xbib.net.path.test.simple; import org.junit.jupiter.api.Test; import org.xbib.net.Parameter; import org.xbib.net.ParameterException; +import org.xbib.net.path.simple.PathResolver; import java.util.Collections; import java.util.Map; diff --git a/net-path/src/test/java/org/xbib/net/path/simple/PathTest.java b/net-path/src/test/java/org/xbib/net/path/test/simple/PathTest.java similarity index 98% rename from net-path/src/test/java/org/xbib/net/path/simple/PathTest.java rename to net-path/src/test/java/org/xbib/net/path/test/simple/PathTest.java index 985a76d..6a291d6 100644 --- a/net-path/src/test/java/org/xbib/net/path/simple/PathTest.java +++ b/net-path/src/test/java/org/xbib/net/path/test/simple/PathTest.java @@ -1,6 +1,8 @@ -package org.xbib.net.path.simple; +package org.xbib.net.path.test.simple; import org.junit.jupiter.api.Test; +import org.xbib.net.path.simple.Path; +import org.xbib.net.path.simple.PathComparator; import java.util.ArrayList; import java.util.Collections; diff --git a/net-path/src/test/java/org/xbib/net/path/spring/PathMatcherTest.java b/net-path/src/test/java/org/xbib/net/path/test/spring/PathMatcherTest.java similarity index 99% rename from net-path/src/test/java/org/xbib/net/path/spring/PathMatcherTest.java rename to net-path/src/test/java/org/xbib/net/path/test/spring/PathMatcherTest.java index 1ac02ce..901671f 100644 --- a/net-path/src/test/java/org/xbib/net/path/spring/PathMatcherTest.java +++ b/net-path/src/test/java/org/xbib/net/path/test/spring/PathMatcherTest.java @@ -1,7 +1,8 @@ -package org.xbib.net.path.spring; +package org.xbib.net.path.test.spring; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.xbib.net.path.spring.PathPatternParser; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/net-path/src/test/java/org/xbib/net/path/structure/PathMatcherTest.java b/net-path/src/test/java/org/xbib/net/path/test/structure/PathMatcherTest.java similarity index 98% rename from net-path/src/test/java/org/xbib/net/path/structure/PathMatcherTest.java rename to net-path/src/test/java/org/xbib/net/path/test/structure/PathMatcherTest.java index a0b11e7..69ab97b 100644 --- a/net-path/src/test/java/org/xbib/net/path/structure/PathMatcherTest.java +++ b/net-path/src/test/java/org/xbib/net/path/test/structure/PathMatcherTest.java @@ -1,6 +1,7 @@ -package org.xbib.net.path.structure; +package org.xbib.net.path.test.structure; import org.junit.jupiter.api.Test; +import org.xbib.net.path.structure.PathMatcher; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; diff --git a/net-path/src/test/java/org/xbib/net/path/structure/PathResolverTest.java b/net-path/src/test/java/org/xbib/net/path/test/structure/PathResolverTest.java similarity index 99% rename from net-path/src/test/java/org/xbib/net/path/structure/PathResolverTest.java rename to net-path/src/test/java/org/xbib/net/path/test/structure/PathResolverTest.java index 271c69c..1af476d 100644 --- a/net-path/src/test/java/org/xbib/net/path/structure/PathResolverTest.java +++ b/net-path/src/test/java/org/xbib/net/path/test/structure/PathResolverTest.java @@ -1,9 +1,10 @@ -package org.xbib.net.path.structure; +package org.xbib.net.path.test.structure; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.xbib.net.Parameter; import org.xbib.net.ParameterException; +import org.xbib.net.path.structure.PathResolver; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/net-path/src/test/java/org/xbib/net/path/structure/PathTest.java b/net-path/src/test/java/org/xbib/net/path/test/structure/PathTest.java similarity index 98% rename from net-path/src/test/java/org/xbib/net/path/structure/PathTest.java rename to net-path/src/test/java/org/xbib/net/path/test/structure/PathTest.java index 85b9c09..0dcfc5b 100644 --- a/net-path/src/test/java/org/xbib/net/path/structure/PathTest.java +++ b/net-path/src/test/java/org/xbib/net/path/test/structure/PathTest.java @@ -1,6 +1,8 @@ -package org.xbib.net.path.structure; +package org.xbib.net.path.test.structure; import org.junit.jupiter.api.Test; +import org.xbib.net.path.structure.Path; +import org.xbib.net.path.structure.PathComparator; import java.util.ArrayList; import java.util.Collections; diff --git a/net-resource/src/test/java/module-info.java b/net-resource/src/test/java/module-info.java new file mode 100644 index 0000000..6a296a0 --- /dev/null +++ b/net-resource/src/test/java/module-info.java @@ -0,0 +1,4 @@ +module org.xbib.net.resource.test { + requires org.junit.jupiter.api; + requires org.xbib.net.resource; +} diff --git a/net-resource/src/test/java/org/xbib/net/resource/BuilderTest.java b/net-resource/src/test/java/org/xbib/net/resource/test/BuilderTest.java similarity index 99% rename from net-resource/src/test/java/org/xbib/net/resource/BuilderTest.java rename to net-resource/src/test/java/org/xbib/net/resource/test/BuilderTest.java index 3bfb4ee..63975fc 100644 --- a/net-resource/src/test/java/org/xbib/net/resource/BuilderTest.java +++ b/net-resource/src/test/java/org/xbib/net/resource/test/BuilderTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.resource; +package org.xbib.net.resource.test; /* * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,6 +26,8 @@ package org.xbib.net.resource; * @test */ +import org.xbib.net.resource.IRI; + import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; diff --git a/net-resource/src/test/java/org/xbib/net/resource/IRItoURLTest.java b/net-resource/src/test/java/org/xbib/net/resource/test/IRItoURLTest.java similarity index 98% rename from net-resource/src/test/java/org/xbib/net/resource/IRItoURLTest.java rename to net-resource/src/test/java/org/xbib/net/resource/test/IRItoURLTest.java index ad984be..ad2345c 100644 --- a/net-resource/src/test/java/org/xbib/net/resource/IRItoURLTest.java +++ b/net-resource/src/test/java/org/xbib/net/resource/test/IRItoURLTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.resource;/* +package org.xbib.net.resource.test;/* * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -31,6 +31,8 @@ package org.xbib.net.resource;/* * exception with new URL(IRI.toString()) and IRI.toURL() */ +import org.xbib.net.resource.IRI; + import java.net.MalformedURLException; import java.net.URL; diff --git a/net-resource/src/test/java/org/xbib/net/resource/RelativeEncoding.java b/net-resource/src/test/java/org/xbib/net/resource/test/RelativeEncoding.java similarity index 97% rename from net-resource/src/test/java/org/xbib/net/resource/RelativeEncoding.java rename to net-resource/src/test/java/org/xbib/net/resource/test/RelativeEncoding.java index f0c758e..ec210b6 100644 --- a/net-resource/src/test/java/org/xbib/net/resource/RelativeEncoding.java +++ b/net-resource/src/test/java/org/xbib/net/resource/test/RelativeEncoding.java @@ -1,4 +1,4 @@ -package org.xbib.net.resource; +package org.xbib.net.resource.test; /* * Copyright (c) 2003, 2019 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,6 +27,8 @@ package org.xbib.net.resource; * @summary URI.resolve escapes characters in parameter URI */ +import org.xbib.net.resource.IRI; + import java.io.File; import java.net.URISyntaxException; import java.util.Objects; diff --git a/net-resource/src/test/java/org/xbib/net/resource/Test.java b/net-resource/src/test/java/org/xbib/net/resource/test/Test.java similarity index 99% rename from net-resource/src/test/java/org/xbib/net/resource/Test.java rename to net-resource/src/test/java/org/xbib/net/resource/test/Test.java index ee0ff0f..f761c1e 100644 --- a/net-resource/src/test/java/org/xbib/net/resource/Test.java +++ b/net-resource/src/test/java/org/xbib/net/resource/test/Test.java @@ -1,4 +1,4 @@ -package org.xbib.net.resource; +package org.xbib.net.resource.test; /* * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,6 +27,8 @@ package org.xbib.net.resource; * @bug 8019345 6345502 6363889 6345551 6348515 */ +import org.xbib.net.resource.IRI; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -36,7 +38,6 @@ import java.io.PrintStream; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; -import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.MalformedURLException; diff --git a/net-security/build.gradle b/net-security/build.gradle index bd5180c..c8995ba 100644 --- a/net-security/build.gradle +++ b/net-security/build.gradle @@ -2,3 +2,14 @@ dependencies { api project(':net') testImplementation project(':net-bouncycastle') } + +def moduleName = 'org.xbib.net.security.test' +def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ] + +tasks.named('compileTestJava') { + options.compilerArgs += patchArgs +} + +tasks.named('test') { + jvmArgs += patchArgs +} diff --git a/net-security/src/main/java/module-info.java b/net-security/src/main/java/module-info.java index 1a8e45e..6d7b976 100644 --- a/net-security/src/main/java/module-info.java +++ b/net-security/src/main/java/module-info.java @@ -12,5 +12,6 @@ module org.xbib.net.security { exports org.xbib.net.security.signatures; exports org.xbib.net.security.ssl; exports org.xbib.net.security.ssl.trustmanager; + exports org.xbib.net.security.ssl.util; exports org.xbib.net.security.util; } diff --git a/net-security/src/main/java/org/xbib/net/security/eddsa/math/GroupElement.java b/net-security/src/main/java/org/xbib/net/security/eddsa/math/GroupElement.java index de0623e..4dfffaa 100644 --- a/net-security/src/main/java/org/xbib/net/security/eddsa/math/GroupElement.java +++ b/net-security/src/main/java/org/xbib/net/security/eddsa/math/GroupElement.java @@ -22,41 +22,41 @@ public class GroupElement { /** * Variable is package private only so that tests run. */ - final Curve curve; + public final Curve curve; /** * Variable is package private only so that tests run. */ - final Representation repr; + public final Representation repr; /** * Variable is package private only so that tests run. */ - final FieldElement X; + public final FieldElement X; /** * Variable is package private only so that tests run. */ - final FieldElement Y; + public final FieldElement Y; /** * Variable is package private only so that tests run. */ - final FieldElement Z; + public final FieldElement Z; /** * Variable is package private only so that tests run. */ - final FieldElement T; + public final FieldElement T; /** * Precomputed table for {@link #scalarMultiply(byte[])}, * filled if necessary. *

* Variable is package private only so that tests run. */ - GroupElement[][] precmp; + public GroupElement[][] precmp; /** * Precomputed table for {@link #doubleScalarMultiplyVariableTime(GroupElement, byte[], byte[])}, * filled if necessary. *

* Variable is package private only so that tests run. */ - GroupElement[] dblPrecmp; + public GroupElement[] dblPrecmp; /** * Creates a group element for a curve. @@ -243,7 +243,7 @@ public class GroupElement { * @param a $= a[0]+256*a[1]+...+256^{31} a[31]$ * @return 64 bytes, each between -8 and 7 */ - static byte[] toRadix16(final byte[] a) { + public static byte[] toRadix16(final byte[] a) { final byte[] e = new byte[64]; int i; // Radix 16 notation @@ -822,7 +822,7 @@ public class GroupElement { * @param b in $\{0, 1\}$ * @return $u$ if $b == 1$; this if $b == 0$. Results undefined if $b$ is not in $\{0, 1\}$. */ - GroupElement cmov(final GroupElement u, final int b) { + public GroupElement cmov(final GroupElement u, final int b) { return precomp(curve, X.cmov(u.X, b), Y.cmov(u.Y, b), Z.cmov(u.Z, b)); } @@ -840,7 +840,7 @@ public class GroupElement { * @param b $= r_i$ * @return the GroupElement */ - GroupElement select(final int pos, final int b) { + public GroupElement select(final int pos, final int b) { // Is r_i negative? final int bnegative = Utils.negative(b); // |r_i| diff --git a/net-security/src/main/java/org/xbib/net/security/eddsa/math/bigint/BigIntegerFieldElement.java b/net-security/src/main/java/org/xbib/net/security/eddsa/math/bigint/BigIntegerFieldElement.java index 579d0e1..34d351f 100644 --- a/net-security/src/main/java/org/xbib/net/security/eddsa/math/bigint/BigIntegerFieldElement.java +++ b/net-security/src/main/java/org/xbib/net/security/eddsa/math/bigint/BigIntegerFieldElement.java @@ -12,7 +12,7 @@ public class BigIntegerFieldElement extends FieldElement { /** * Variable is package private for encoding. */ - final BigInteger bi; + public final BigInteger bi; public BigIntegerFieldElement(Field f, BigInteger bi) { super(f); diff --git a/net-security/src/main/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519FieldElement.java b/net-security/src/main/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519FieldElement.java index c28778b..2f3a343 100644 --- a/net-security/src/main/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519FieldElement.java +++ b/net-security/src/main/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519FieldElement.java @@ -17,7 +17,7 @@ public class Ed25519FieldElement extends FieldElement { /** * Variable is package private for encoding. */ - final int[] t; + public final int[] t; /** * Creates a field element. diff --git a/net-security/src/test/java/module-info.java b/net-security/src/test/java/module-info.java new file mode 100644 index 0000000..2801713 --- /dev/null +++ b/net-security/src/test/java/module-info.java @@ -0,0 +1,14 @@ +module org.xbib.net.security.test { + requires java.logging; + requires transitive org.junit.jupiter.api; + requires org.hamcrest; + requires org.xbib.net.security; + requires org.bouncycastle.provider; + exports org.xbib.net.security.test; + exports org.xbib.net.security.test.ed25519; + exports org.xbib.net.security.test.eddsa; + exports org.xbib.net.security.test.eddsa.math; + exports org.xbib.net.security.test.eddsa.math.bigint; + exports org.xbib.net.security.test.eddsa.math.ed25519; + exports org.xbib.net.security.test.eddsa.spec; +} diff --git a/net-security/src/test/java/org/xbib/net/security/CertificateReaderTest.java b/net-security/src/test/java/org/xbib/net/security/test/CertificateReaderTest.java similarity index 91% rename from net-security/src/test/java/org/xbib/net/security/CertificateReaderTest.java rename to net-security/src/test/java/org/xbib/net/security/test/CertificateReaderTest.java index 6833314..ff7e979 100644 --- a/net-security/src/test/java/org/xbib/net/security/CertificateReaderTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/CertificateReaderTest.java @@ -1,10 +1,11 @@ -package org.xbib.net.security; +package org.xbib.net.security.test; import java.io.InputStream; import java.security.cert.X509Certificate; import java.util.logging.Level; import java.util.logging.Logger; import org.junit.jupiter.api.Test; +import org.xbib.net.security.CertificateReader; public class CertificateReaderTest { diff --git a/net-security/src/test/java/org/xbib/net/security/CreateKeyStoreTest.java b/net-security/src/test/java/org/xbib/net/security/test/CreateKeyStoreTest.java similarity index 98% rename from net-security/src/test/java/org/xbib/net/security/CreateKeyStoreTest.java rename to net-security/src/test/java/org/xbib/net/security/test/CreateKeyStoreTest.java index e668c6e..075ed76 100644 --- a/net-security/src/test/java/org/xbib/net/security/CreateKeyStoreTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/CreateKeyStoreTest.java @@ -1,7 +1,9 @@ -package org.xbib.net.security; +package org.xbib.net.security.test; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.junit.jupiter.api.Test; +import org.xbib.net.security.CertificateProvider; +import org.xbib.net.security.CertificateReader; import org.xbib.net.security.util.HexUtil; import javax.crypto.SecretKey; diff --git a/net-security/src/test/java/org/xbib/net/security/PrivateKeyReaderTest.java b/net-security/src/test/java/org/xbib/net/security/test/PrivateKeyReaderTest.java similarity index 98% rename from net-security/src/test/java/org/xbib/net/security/PrivateKeyReaderTest.java rename to net-security/src/test/java/org/xbib/net/security/test/PrivateKeyReaderTest.java index ef0be51..f3f3066 100644 --- a/net-security/src/test/java/org/xbib/net/security/PrivateKeyReaderTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/PrivateKeyReaderTest.java @@ -1,6 +1,7 @@ -package org.xbib.net.security; +package org.xbib.net.security.test; import org.junit.jupiter.api.Test; +import org.xbib.net.security.PrivateKeyReader; import java.io.ByteArrayInputStream; import java.io.InputStream; diff --git a/net-security/src/test/java/org/xbib/net/security/ed25519/Ed25519KeyTest.java b/net-security/src/test/java/org/xbib/net/security/test/ed25519/Ed25519KeyTest.java similarity index 93% rename from net-security/src/test/java/org/xbib/net/security/ed25519/Ed25519KeyTest.java rename to net-security/src/test/java/org/xbib/net/security/test/ed25519/Ed25519KeyTest.java index 09620e9..0d88d48 100644 --- a/net-security/src/test/java/org/xbib/net/security/ed25519/Ed25519KeyTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/ed25519/Ed25519KeyTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.security.ed25519; +package org.xbib.net.security.test.ed25519; import java.nio.charset.StandardCharsets; import java.security.KeyPair; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/Ed25519TestVectors.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/Ed25519TestVectors.java similarity index 95% rename from net-security/src/test/java/org/xbib/net/security/eddsa/Ed25519TestVectors.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/Ed25519TestVectors.java index 2422d70..7e614a3 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/Ed25519TestVectors.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/Ed25519TestVectors.java @@ -1,4 +1,6 @@ -package org.xbib.net.security.eddsa; +package org.xbib.net.security.test.eddsa; + +import org.xbib.net.security.eddsa.Utils; import java.io.BufferedReader; import java.io.IOException; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/EdDSAEngineTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSAEngineTest.java similarity index 97% rename from net-security/src/test/java/org/xbib/net/security/eddsa/EdDSAEngineTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSAEngineTest.java index 369ba7a..d28e614 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/EdDSAEngineTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSAEngineTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.security.eddsa; +package org.xbib.net.security.test.eddsa; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; @@ -13,6 +13,10 @@ import java.security.SignatureException; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.xbib.net.security.eddsa.EdDSAEngine; +import org.xbib.net.security.eddsa.EdDSAPrivateKey; +import org.xbib.net.security.eddsa.EdDSAPublicKey; +import org.xbib.net.security.eddsa.Utils; import org.xbib.net.security.eddsa.spec.EdDSANamedCurveTable; import org.xbib.net.security.eddsa.spec.EdDSAParameterSpec; import org.xbib.net.security.eddsa.spec.EdDSAPrivateKeySpec; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/EdDSAPrivateKeyTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSAPrivateKeyTest.java similarity index 95% rename from net-security/src/test/java/org/xbib/net/security/eddsa/EdDSAPrivateKeyTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSAPrivateKeyTest.java index 7869c16..c620941 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/EdDSAPrivateKeyTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSAPrivateKeyTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.security.eddsa; +package org.xbib.net.security.test.eddsa; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; @@ -6,6 +6,8 @@ import static org.hamcrest.Matchers.*; import java.security.spec.PKCS8EncodedKeySpec; import org.junit.jupiter.api.Test; +import org.xbib.net.security.eddsa.EdDSAPrivateKey; +import org.xbib.net.security.eddsa.Utils; import org.xbib.net.security.eddsa.spec.EdDSAPrivateKeySpec; /** diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/EdDSAPublicKeyTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSAPublicKeyTest.java similarity index 95% rename from net-security/src/test/java/org/xbib/net/security/eddsa/EdDSAPublicKeyTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSAPublicKeyTest.java index e3080d9..b5dc63d 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/EdDSAPublicKeyTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSAPublicKeyTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.security.eddsa; +package org.xbib.net.security.test.eddsa; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; @@ -6,6 +6,8 @@ import static org.hamcrest.Matchers.*; import java.security.spec.X509EncodedKeySpec; import org.junit.jupiter.api.Test; +import org.xbib.net.security.eddsa.EdDSAPublicKey; +import org.xbib.net.security.eddsa.Utils; import org.xbib.net.security.eddsa.spec.EdDSAPublicKeySpec; /** diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/EdDSASecurityProviderTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSASecurityProviderTest.java similarity index 90% rename from net-security/src/test/java/org/xbib/net/security/eddsa/EdDSASecurityProviderTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSASecurityProviderTest.java index 1acb14c..6db4ca2 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/EdDSASecurityProviderTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/EdDSASecurityProviderTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.security.eddsa; +package org.xbib.net.security.test.eddsa; import java.security.KeyFactory; import java.security.KeyPairGenerator; @@ -7,6 +7,7 @@ import java.security.Security; import java.security.Signature; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.xbib.net.security.eddsa.EdDSASecurityProvider; /** * diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/UtilsTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/UtilsTest.java similarity index 98% rename from net-security/src/test/java/org/xbib/net/security/eddsa/UtilsTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/UtilsTest.java index 1eb2185..bfa38c9 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/UtilsTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/UtilsTest.java @@ -1,9 +1,10 @@ -package org.xbib.net.security.eddsa; +package org.xbib.net.security.test.eddsa; import org.hamcrest.core.IsEqual; import java.security.SecureRandom; import org.junit.jupiter.api.Test; +import org.xbib.net.security.eddsa.Utils; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/math/AbstractFieldElementTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/AbstractFieldElementTest.java similarity index 97% rename from net-security/src/test/java/org/xbib/net/security/eddsa/math/AbstractFieldElementTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/math/AbstractFieldElementTest.java index ad2f694..08127e7 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/math/AbstractFieldElementTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/AbstractFieldElementTest.java @@ -1,10 +1,13 @@ -package org.xbib.net.security.eddsa.math; +package org.xbib.net.security.test.eddsa.math; import org.hamcrest.core.IsEqual; import org.hamcrest.core.IsNot; import java.math.BigInteger; import org.junit.jupiter.api.Test; +import org.xbib.net.security.eddsa.math.Field; +import org.xbib.net.security.eddsa.math.FieldElement; + import static org.hamcrest.MatcherAssert.assertThat; /** diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/math/ConstantsTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ConstantsTest.java similarity index 93% rename from net-security/src/test/java/org/xbib/net/security/eddsa/math/ConstantsTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ConstantsTest.java index 4d33c3f..e275850 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/math/ConstantsTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ConstantsTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.security.eddsa.math; +package org.xbib.net.security.test.eddsa.math; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; @@ -10,6 +10,9 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.junit.jupiter.api.Test; +import org.xbib.net.security.eddsa.math.Curve; +import org.xbib.net.security.eddsa.math.FieldElement; +import org.xbib.net.security.eddsa.math.GroupElement; import org.xbib.net.security.eddsa.spec.EdDSANamedCurveSpec; import org.xbib.net.security.eddsa.spec.EdDSANamedCurveTable; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/math/GroupElementTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/GroupElementTest.java similarity index 99% rename from net-security/src/test/java/org/xbib/net/security/eddsa/math/GroupElementTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/math/GroupElementTest.java index efc799d..a859f36 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/math/GroupElementTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/GroupElementTest.java @@ -1,9 +1,12 @@ -package org.xbib.net.security.eddsa.math; +package org.xbib.net.security.test.eddsa.math; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.xbib.net.security.eddsa.Ed25519TestVectors; +import org.xbib.net.security.test.eddsa.Ed25519TestVectors; import org.xbib.net.security.eddsa.Utils; +import org.xbib.net.security.eddsa.math.Curve; +import org.xbib.net.security.eddsa.math.FieldElement; +import org.xbib.net.security.eddsa.math.GroupElement; import org.xbib.net.security.eddsa.spec.EdDSANamedCurveSpec; import org.xbib.net.security.eddsa.spec.EdDSANamedCurveTable; import org.hamcrest.core.IsEqual; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/math/MathUtils.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/MathUtils.java similarity index 98% rename from net-security/src/test/java/org/xbib/net/security/eddsa/math/MathUtils.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/math/MathUtils.java index 7d5811d..015fb6b 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/math/MathUtils.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/MathUtils.java @@ -1,7 +1,11 @@ -package org.xbib.net.security.eddsa.math; +package org.xbib.net.security.test.eddsa.math; import org.junit.jupiter.api.Test; import org.xbib.net.security.eddsa.Utils; +import org.xbib.net.security.eddsa.math.Curve; +import org.xbib.net.security.eddsa.math.Field; +import org.xbib.net.security.eddsa.math.FieldElement; +import org.xbib.net.security.eddsa.math.GroupElement; import org.xbib.net.security.eddsa.math.ed25519.Ed25519FieldElement; import org.xbib.net.security.eddsa.math.ed25519.Ed25519LittleEndianEncoding; import org.xbib.net.security.eddsa.spec.EdDSANamedCurveSpec; @@ -416,7 +420,6 @@ public class MathUtils { return GroupElement.p3(g.getCurve(), g.getX().negate(), g.getY(), g.getZ(), g.getT().negate()); } - // Start TODO BR: Remove when finished! @Test public void mathUtilsWorkAsExpected() { final GroupElement neutral = GroupElement.p3(curve, curve.getField().ZERO, curve.getField().ONE, curve.getField().ONE, curve.getField().ZERO); @@ -468,5 +471,4 @@ public class MathUtils { assertThat(curve.getZero(GroupElement.Representation.P3), IsEqual.equalTo(h)); } } - // End TODO BR: Remove when finished! } diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/math/PrecomputationTestVectors.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/PrecomputationTestVectors.java similarity index 94% rename from net-security/src/test/java/org/xbib/net/security/eddsa/math/PrecomputationTestVectors.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/math/PrecomputationTestVectors.java index 3e926b8..d03d8f3 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/math/PrecomputationTestVectors.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/PrecomputationTestVectors.java @@ -1,4 +1,4 @@ -package org.xbib.net.security.eddsa.math; +package org.xbib.net.security.test.eddsa.math; import java.io.BufferedReader; import java.io.IOException; @@ -6,12 +6,13 @@ import java.io.InputStream; import java.io.InputStreamReader; import org.xbib.net.security.eddsa.Utils; +import org.xbib.net.security.eddsa.math.Curve; +import org.xbib.net.security.eddsa.math.Field; +import org.xbib.net.security.eddsa.math.FieldElement; +import org.xbib.net.security.eddsa.math.GroupElement; import org.xbib.net.security.eddsa.spec.EdDSANamedCurveSpec; import org.xbib.net.security.eddsa.spec.EdDSANamedCurveTable; -/** - * - */ public class PrecomputationTestVectors { // Test files were generated using base.py and base2.py from ref10 // (by printing hex(x%q) instead of the radix-255 representation). diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/math/bigint/BigIntegerFieldElementTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/bigint/BigIntegerFieldElementTest.java similarity index 91% rename from net-security/src/test/java/org/xbib/net/security/eddsa/math/bigint/BigIntegerFieldElementTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/math/bigint/BigIntegerFieldElementTest.java index 05ce8fe..4d1b93b 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/math/bigint/BigIntegerFieldElementTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/bigint/BigIntegerFieldElementTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.security.eddsa.math.bigint; +package org.xbib.net.security.test.eddsa.math.bigint; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; @@ -10,8 +10,10 @@ import org.junit.jupiter.api.Test; import org.xbib.net.security.eddsa.Utils; import org.xbib.net.security.eddsa.math.Field; import org.xbib.net.security.eddsa.math.FieldElement; -import org.xbib.net.security.eddsa.math.MathUtils; -import org.xbib.net.security.eddsa.math.AbstractFieldElementTest; +import org.xbib.net.security.test.eddsa.math.MathUtils; +import org.xbib.net.security.test.eddsa.math.AbstractFieldElementTest; +import org.xbib.net.security.eddsa.math.bigint.BigIntegerFieldElement; +import org.xbib.net.security.eddsa.math.bigint.BigIntegerLittleEndianEncoding; /** * diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/math/bigint/BigIntegerScalarOpsTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/bigint/BigIntegerScalarOpsTest.java similarity index 95% rename from net-security/src/test/java/org/xbib/net/security/eddsa/math/bigint/BigIntegerScalarOpsTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/math/bigint/BigIntegerScalarOpsTest.java index 7664a25..992f8f3 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/math/bigint/BigIntegerScalarOpsTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/bigint/BigIntegerScalarOpsTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.security.eddsa.math.bigint; +package org.xbib.net.security.test.eddsa.math.bigint; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; @@ -9,6 +9,7 @@ import org.junit.jupiter.api.Test; import org.xbib.net.security.eddsa.Utils; import org.xbib.net.security.eddsa.math.Field; import org.xbib.net.security.eddsa.math.ScalarOps; +import org.xbib.net.security.eddsa.math.bigint.BigIntegerScalarOps; import org.xbib.net.security.eddsa.spec.EdDSANamedCurveSpec; import org.xbib.net.security.eddsa.spec.EdDSANamedCurveTable; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519FieldElementTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ed25519/Ed25519FieldElementTest.java similarity index 90% rename from net-security/src/test/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519FieldElementTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ed25519/Ed25519FieldElementTest.java index d37361e..40fce63 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519FieldElementTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ed25519/Ed25519FieldElementTest.java @@ -1,12 +1,13 @@ -package org.xbib.net.security.eddsa.math.ed25519; +package org.xbib.net.security.test.eddsa.math.ed25519; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.xbib.net.security.eddsa.math.AbstractFieldElementTest; +import org.xbib.net.security.test.eddsa.math.AbstractFieldElementTest; import org.xbib.net.security.eddsa.math.Field; import org.xbib.net.security.eddsa.math.FieldElement; -import org.xbib.net.security.eddsa.math.MathUtils; +import org.xbib.net.security.test.eddsa.math.MathUtils; import org.hamcrest.core.IsEqual; +import org.xbib.net.security.eddsa.math.ed25519.Ed25519FieldElement; import java.math.BigInteger; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519LittleEndianEncodingTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ed25519/Ed25519LittleEndianEncodingTest.java similarity index 95% rename from net-security/src/test/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519LittleEndianEncodingTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ed25519/Ed25519LittleEndianEncodingTest.java index 8db5455..fd99673 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519LittleEndianEncodingTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ed25519/Ed25519LittleEndianEncodingTest.java @@ -1,9 +1,10 @@ -package org.xbib.net.security.eddsa.math.ed25519; +package org.xbib.net.security.test.eddsa.math.ed25519; import org.junit.jupiter.api.Test; import org.xbib.net.security.eddsa.math.FieldElement; -import org.xbib.net.security.eddsa.math.MathUtils; +import org.xbib.net.security.test.eddsa.math.MathUtils; import org.hamcrest.core.IsEqual; +import org.xbib.net.security.eddsa.math.ed25519.Ed25519FieldElement; import java.math.BigInteger; import java.security.SecureRandom; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519ScalarOpsTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ed25519/Ed25519ScalarOpsTest.java similarity index 94% rename from net-security/src/test/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519ScalarOpsTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ed25519/Ed25519ScalarOpsTest.java index 6068695..c9d30f2 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/math/ed25519/Ed25519ScalarOpsTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/math/ed25519/Ed25519ScalarOpsTest.java @@ -1,9 +1,10 @@ -package org.xbib.net.security.eddsa.math.ed25519; +package org.xbib.net.security.test.eddsa.math.ed25519; import org.junit.jupiter.api.Test; import org.xbib.net.security.eddsa.Utils; -import org.xbib.net.security.eddsa.math.MathUtils; +import org.xbib.net.security.test.eddsa.math.MathUtils; import org.hamcrest.core.IsEqual; +import org.xbib.net.security.eddsa.math.ed25519.Ed25519ScalarOps; import java.math.BigInteger; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/spec/EdDSANamedCurveTableTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/spec/EdDSANamedCurveTableTest.java similarity index 78% rename from net-security/src/test/java/org/xbib/net/security/eddsa/spec/EdDSANamedCurveTableTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/spec/EdDSANamedCurveTableTest.java index 08b1bbd..d16e306 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/spec/EdDSANamedCurveTableTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/spec/EdDSANamedCurveTableTest.java @@ -1,6 +1,9 @@ -package org.xbib.net.security.eddsa.spec; +package org.xbib.net.security.test.eddsa.spec; import org.junit.jupiter.api.Test; +import org.xbib.net.security.eddsa.spec.EdDSANamedCurveSpec; +import org.xbib.net.security.eddsa.spec.EdDSANamedCurveTable; + import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; diff --git a/net-security/src/test/java/org/xbib/net/security/eddsa/spec/EdDSAPrivateKeySpecTest.java b/net-security/src/test/java/org/xbib/net/security/test/eddsa/spec/EdDSAPrivateKeySpecTest.java similarity index 88% rename from net-security/src/test/java/org/xbib/net/security/eddsa/spec/EdDSAPrivateKeySpecTest.java rename to net-security/src/test/java/org/xbib/net/security/test/eddsa/spec/EdDSAPrivateKeySpecTest.java index 0d43445..985748c 100644 --- a/net-security/src/test/java/org/xbib/net/security/eddsa/spec/EdDSAPrivateKeySpecTest.java +++ b/net-security/src/test/java/org/xbib/net/security/test/eddsa/spec/EdDSAPrivateKeySpecTest.java @@ -1,10 +1,14 @@ -package org.xbib.net.security.eddsa.spec; +package org.xbib.net.security.test.eddsa.spec; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.xbib.net.security.eddsa.Utils; +import org.xbib.net.security.eddsa.spec.EdDSANamedCurveSpec; +import org.xbib.net.security.eddsa.spec.EdDSANamedCurveTable; +import org.xbib.net.security.eddsa.spec.EdDSAParameterSpec; +import org.xbib.net.security.eddsa.spec.EdDSAPrivateKeySpec; /** * diff --git a/net-security/src/test/java/org/xbib/net/security/ssl/trustmanager/UnsafeX509ExtendedTrustManager.java b/net-security/src/test/java/org/xbib/net/security/test/trustmanager/UnsafeX509ExtendedTrustManager.java similarity index 98% rename from net-security/src/test/java/org/xbib/net/security/ssl/trustmanager/UnsafeX509ExtendedTrustManager.java rename to net-security/src/test/java/org/xbib/net/security/test/trustmanager/UnsafeX509ExtendedTrustManager.java index dacbbca..1ea587c 100644 --- a/net-security/src/test/java/org/xbib/net/security/ssl/trustmanager/UnsafeX509ExtendedTrustManager.java +++ b/net-security/src/test/java/org/xbib/net/security/test/trustmanager/UnsafeX509ExtendedTrustManager.java @@ -1,4 +1,4 @@ -package org.xbib.net.security.ssl.trustmanager; +package org.xbib.net.security.test.trustmanager; import org.xbib.net.security.ssl.util.TrustManagerUtils; diff --git a/net-security/src/test/resources/org/xbib/net/security/eddsa/math/baseDblPrecmp b/net-security/src/test/resources/org/xbib/net/security/test/eddsa/math/baseDblPrecmp similarity index 100% rename from net-security/src/test/resources/org/xbib/net/security/eddsa/math/baseDblPrecmp rename to net-security/src/test/resources/org/xbib/net/security/test/eddsa/math/baseDblPrecmp diff --git a/net-security/src/test/resources/org/xbib/net/security/eddsa/math/basePrecmp b/net-security/src/test/resources/org/xbib/net/security/test/eddsa/math/basePrecmp similarity index 100% rename from net-security/src/test/resources/org/xbib/net/security/eddsa/math/basePrecmp rename to net-security/src/test/resources/org/xbib/net/security/test/eddsa/math/basePrecmp diff --git a/net-security/src/test/resources/org/xbib/net/security/eddsa/test.data b/net-security/src/test/resources/org/xbib/net/security/test/test.data similarity index 100% rename from net-security/src/test/resources/org/xbib/net/security/eddsa/test.data rename to net-security/src/test/resources/org/xbib/net/security/test/test.data diff --git a/net-socket/build.gradle b/net-socket/build.gradle index 843d0a5..b474da0 100644 --- a/net-socket/build.gradle +++ b/net-socket/build.gradle @@ -1,3 +1,14 @@ dependencies { implementation libs.jna } + +def moduleName = 'org.xbib.net.socket.test' +def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ] + +tasks.named('compileTestJava') { + options.compilerArgs += patchArgs +} + +tasks.named('test') { + jvmArgs += patchArgs +} diff --git a/net-socket/src/main/java/module-info.java b/net-socket/src/main/java/module-info.java index cba6f25..7db8f39 100644 --- a/net-socket/src/main/java/module-info.java +++ b/net-socket/src/main/java/module-info.java @@ -2,6 +2,7 @@ module org.xbib.net.socket { requires java.logging; requires transitive com.sun.jna; exports org.xbib.net.socket; + exports org.xbib.net.socket.notify; exports org.xbib.net.socket.v4; exports org.xbib.net.socket.v4.bsd; exports org.xbib.net.socket.v4.datagram; diff --git a/net-socket/src/test/java/module-info.java b/net-socket/src/test/java/module-info.java new file mode 100644 index 0000000..cf5007b --- /dev/null +++ b/net-socket/src/test/java/module-info.java @@ -0,0 +1,8 @@ +module org.xbib.net.socket.test { + requires java.logging; + requires org.junit.jupiter.api; + requires org.xbib.net.socket; + exports org.xbib.net.socket.test.notify; + exports org.xbib.net.socket.test.v4; + exports org.xbib.net.socket.test.v6; +} diff --git a/net-socket/src/test/java/org/xbib/net/socket/notify/SystemdTest.java b/net-socket/src/test/java/org/xbib/net/socket/test/notify/SystemdTest.java similarity index 68% rename from net-socket/src/test/java/org/xbib/net/socket/notify/SystemdTest.java rename to net-socket/src/test/java/org/xbib/net/socket/test/notify/SystemdTest.java index 9b3dccd..f24ef2b 100644 --- a/net-socket/src/test/java/org/xbib/net/socket/notify/SystemdTest.java +++ b/net-socket/src/test/java/org/xbib/net/socket/test/notify/SystemdTest.java @@ -1,6 +1,7 @@ -package org.xbib.net.socket.notify; +package org.xbib.net.socket.test.notify; import org.junit.jupiter.api.Test; +import org.xbib.net.socket.notify.SystemdNotify; import java.io.IOException; diff --git a/net-socket/src/test/java/org/xbib/net/socket/v4/PingTest.java b/net-socket/src/test/java/org/xbib/net/socket/test/v4/PingTest.java similarity index 95% rename from net-socket/src/test/java/org/xbib/net/socket/v4/PingTest.java rename to net-socket/src/test/java/org/xbib/net/socket/test/v4/PingTest.java index fe44dea..f05cdf0 100644 --- a/net-socket/src/test/java/org/xbib/net/socket/v4/PingTest.java +++ b/net-socket/src/test/java/org/xbib/net/socket/test/v4/PingTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.socket.v4; +package org.xbib.net.socket.test.v4; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/net-socket/src/test/java/org/xbib/net/socket/v6/PingTest.java b/net-socket/src/test/java/org/xbib/net/socket/test/v6/PingTest.java similarity index 96% rename from net-socket/src/test/java/org/xbib/net/socket/v6/PingTest.java rename to net-socket/src/test/java/org/xbib/net/socket/test/v6/PingTest.java index 6778ec2..a8b1b05 100644 --- a/net-socket/src/test/java/org/xbib/net/socket/v6/PingTest.java +++ b/net-socket/src/test/java/org/xbib/net/socket/test/v6/PingTest.java @@ -1,4 +1,4 @@ -package org.xbib.net.socket.v6; +package org.xbib.net.socket.test.v6; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/net/build.gradle b/net/build.gradle index ceb7b2f..df29735 100644 --- a/net/build.gradle +++ b/net/build.gradle @@ -2,3 +2,14 @@ dependencies { api libs.datastructures.common testImplementation libs.jackson } + +def moduleName = 'org.xbib.net.test' +def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ] + +tasks.named('compileTestJava') { + options.compilerArgs += patchArgs +} + +tasks.named('test') { + jvmArgs += patchArgs +} diff --git a/net/src/main/java/module-info.java b/net/src/main/java/module-info.java index f4ae050..36807b0 100644 --- a/net/src/main/java/module-info.java +++ b/net/src/main/java/module-info.java @@ -1,5 +1,38 @@ import org.xbib.net.buffer.DataBufferFactory; import org.xbib.net.buffer.DefaultDataBufferFactory; +import org.xbib.net.scheme.DnsScheme; +import org.xbib.net.scheme.FileScheme; +import org.xbib.net.scheme.FtpScheme; +import org.xbib.net.scheme.GitScheme; +import org.xbib.net.scheme.GitSecureHttpScheme; +import org.xbib.net.scheme.GopherScheme; +import org.xbib.net.scheme.HttpScheme; +import org.xbib.net.scheme.HttpsScheme; +import org.xbib.net.scheme.ImapScheme; +import org.xbib.net.scheme.ImapsScheme; +import org.xbib.net.scheme.IrcScheme; +import org.xbib.net.scheme.LdapScheme; +import org.xbib.net.scheme.LdapsScheme; +import org.xbib.net.scheme.MailtoScheme; +import org.xbib.net.scheme.NewsScheme; +import org.xbib.net.scheme.NntpScheme; +import org.xbib.net.scheme.Pop3Scheme; +import org.xbib.net.scheme.RedisScheme; +import org.xbib.net.scheme.RsyncScheme; +import org.xbib.net.scheme.RtmpScheme; +import org.xbib.net.scheme.RtspScheme; +import org.xbib.net.scheme.Scheme; +import org.xbib.net.scheme.SecureNewsScheme; +import org.xbib.net.scheme.SecurePop3Scheme; +import org.xbib.net.scheme.SftpScheme; +import org.xbib.net.scheme.SmtpScheme; +import org.xbib.net.scheme.SmtpsScheme; +import org.xbib.net.scheme.SshScheme; +import org.xbib.net.scheme.TelnetScheme; +import org.xbib.net.scheme.TftpScheme; +import org.xbib.net.scheme.UrnScheme; +import org.xbib.net.scheme.WsScheme; +import org.xbib.net.scheme.WssScheme; module org.xbib.net { exports org.xbib.net; @@ -18,4 +51,38 @@ module org.xbib.net { requires transitive java.logging; uses DataBufferFactory; provides DataBufferFactory with DefaultDataBufferFactory; + uses Scheme; + provides Scheme with + DnsScheme, + FileScheme, + FtpScheme, + GitScheme, + GitSecureHttpScheme, + GopherScheme, + HttpScheme, + HttpsScheme, + ImapScheme, + ImapsScheme, + IrcScheme, + LdapScheme, + LdapsScheme, + MailtoScheme, + NewsScheme, + NntpScheme, + Pop3Scheme, + RedisScheme, + RsyncScheme, + RtmpScheme, + RtspScheme, + SecureNewsScheme, + SecurePop3Scheme, + SftpScheme, + SmtpScheme, + SmtpsScheme, + SshScheme, + TelnetScheme, + TftpScheme, + UrnScheme, + WsScheme, + WssScheme; } diff --git a/net/src/main/java/org/xbib/net/PercentEncoder.java b/net/src/main/java/org/xbib/net/PercentEncoder.java index 41a625b..152dc1d 100644 --- a/net/src/main/java/org/xbib/net/PercentEncoder.java +++ b/net/src/main/java/org/xbib/net/PercentEncoder.java @@ -36,7 +36,7 @@ public class PercentEncoder { * @param charsetEncoder charset encoder to encode characters with. Make sure to not re-use CharsetEncoder instances * across threads. */ - PercentEncoder(BitSet safeChars, CharsetEncoder charsetEncoder) { + public PercentEncoder(BitSet safeChars, CharsetEncoder charsetEncoder) { this.safeChars = safeChars; this.encoder = charsetEncoder; this.stringHandler = new StringBuilderPercentEncoderOutputHandler(); diff --git a/net/src/main/java/org/xbib/net/scheme/DnsScheme.java b/net/src/main/java/org/xbib/net/scheme/DnsScheme.java index 2bce186..72a2789 100644 --- a/net/src/main/java/org/xbib/net/scheme/DnsScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/DnsScheme.java @@ -4,13 +4,13 @@ package org.xbib.net.scheme; * The DNS URI scheme. * @see DNS RFC */ -class DnsScheme extends HttpScheme { +public class DnsScheme extends HttpScheme { - DnsScheme() { + public DnsScheme() { super("dns", 53); } - DnsScheme(String name, int port) { + public DnsScheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/FileScheme.java b/net/src/main/java/org/xbib/net/scheme/FileScheme.java index 73f17de..f74a753 100644 --- a/net/src/main/java/org/xbib/net/scheme/FileScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/FileScheme.java @@ -3,9 +3,9 @@ package org.xbib.net.scheme; /** * File scheme. */ -class FileScheme extends HttpScheme { +public class FileScheme extends HttpScheme { - FileScheme() { + public FileScheme() { super("file", -1); } diff --git a/net/src/main/java/org/xbib/net/scheme/FtpScheme.java b/net/src/main/java/org/xbib/net/scheme/FtpScheme.java index b280504..2cda083 100644 --- a/net/src/main/java/org/xbib/net/scheme/FtpScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/FtpScheme.java @@ -3,13 +3,13 @@ package org.xbib.net.scheme; /** * FTP scheme. */ -class FtpScheme extends HttpScheme { +public class FtpScheme extends HttpScheme { - FtpScheme() { + public FtpScheme() { super("ftp", 21); } - FtpScheme(String name, int port) { + public FtpScheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/GitScheme.java b/net/src/main/java/org/xbib/net/scheme/GitScheme.java index 40777c5..f525db9 100644 --- a/net/src/main/java/org/xbib/net/scheme/GitScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/GitScheme.java @@ -3,13 +3,13 @@ package org.xbib.net.scheme; /** * Git scheme. */ -class GitScheme extends HttpScheme { +public class GitScheme extends HttpScheme { - GitScheme() { + public GitScheme() { super("git", 443); } - GitScheme(String name, int port) { + public GitScheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/GitSecureHttpScheme.java b/net/src/main/java/org/xbib/net/scheme/GitSecureHttpScheme.java index 75417d6..bd081bc 100644 --- a/net/src/main/java/org/xbib/net/scheme/GitSecureHttpScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/GitSecureHttpScheme.java @@ -3,13 +3,13 @@ package org.xbib.net.scheme; /** * Git secure scheme. */ -class GitSecureHttpScheme extends HttpScheme { +public class GitSecureHttpScheme extends HttpScheme { - GitSecureHttpScheme() { + public GitSecureHttpScheme() { super("git+https", 443); } - GitSecureHttpScheme(String name, int port) { + public GitSecureHttpScheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/GopherScheme.java b/net/src/main/java/org/xbib/net/scheme/GopherScheme.java index e60ebd7..c5d8e7b 100644 --- a/net/src/main/java/org/xbib/net/scheme/GopherScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/GopherScheme.java @@ -3,9 +3,9 @@ package org.xbib.net.scheme; /** * Gopher scheme. */ -class GopherScheme extends AbstractScheme { +public class GopherScheme extends AbstractScheme { - GopherScheme() { + public GopherScheme() { super("gopher", 70); } diff --git a/net/src/main/java/org/xbib/net/scheme/HttpScheme.java b/net/src/main/java/org/xbib/net/scheme/HttpScheme.java index bc62e10..f777542 100644 --- a/net/src/main/java/org/xbib/net/scheme/HttpScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/HttpScheme.java @@ -8,13 +8,13 @@ import java.util.Locale; /** * HTTP scheme. */ -class HttpScheme extends AbstractScheme { +public class HttpScheme extends AbstractScheme { - HttpScheme() { + public HttpScheme() { super("http", 80); } - HttpScheme(String name, int port) { + public HttpScheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/HttpsScheme.java b/net/src/main/java/org/xbib/net/scheme/HttpsScheme.java new file mode 100644 index 0000000..bf58fc5 --- /dev/null +++ b/net/src/main/java/org/xbib/net/scheme/HttpsScheme.java @@ -0,0 +1,37 @@ +package org.xbib.net.scheme; + +import org.xbib.net.PathNormalizer; +import org.xbib.net.URL; + +import java.util.Locale; + +/** + * HTTPS scheme. + */ +public class HttpsScheme extends AbstractScheme { + + public HttpsScheme() { + super("https", 443); + } + + public HttpsScheme(String name, int port) { + super(name, port); + } + + @Override + public URL normalize(URL url) { + String host = url.getHost(); + if (host != null) { + host = host.toLowerCase(Locale.ROOT); + } + return URL.builder() + .scheme(url.getScheme()) + .userInfo(url.getUserInfo()) + .host(host, url.getProtocolVersion()) + .port(url.getPort()) + .path(PathNormalizer.normalize(url.getPath())) + .query(url.getQuery()) + .fragment(url.getFragment()) + .build(); + } +} diff --git a/net/src/main/java/org/xbib/net/scheme/ImapScheme.java b/net/src/main/java/org/xbib/net/scheme/ImapScheme.java index e23d8d0..b71ed1f 100644 --- a/net/src/main/java/org/xbib/net/scheme/ImapScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/ImapScheme.java @@ -5,13 +5,13 @@ package org.xbib.net.scheme; * * @see IMAP RFC */ -class ImapScheme extends AbstractScheme { +public class ImapScheme extends AbstractScheme { - ImapScheme() { + public ImapScheme() { super("imap", 143); } - ImapScheme(String name, int port) { + public ImapScheme(String name, int port) { super(name, port); } } diff --git a/net/src/main/java/org/xbib/net/scheme/SecureImapScheme.java b/net/src/main/java/org/xbib/net/scheme/ImapsScheme.java similarity index 70% rename from net/src/main/java/org/xbib/net/scheme/SecureImapScheme.java rename to net/src/main/java/org/xbib/net/scheme/ImapsScheme.java index e3eb80c..bcea9ce 100644 --- a/net/src/main/java/org/xbib/net/scheme/SecureImapScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/ImapsScheme.java @@ -4,9 +4,9 @@ package org.xbib.net.scheme; * The secure IMAP scheme. * @see IMAP scheme RFC */ -class SecureImapScheme extends ImapScheme { +public class ImapsScheme extends ImapScheme { - SecureImapScheme() { + public ImapsScheme() { super("imaps", 993); } diff --git a/net/src/main/java/org/xbib/net/scheme/IrcScheme.java b/net/src/main/java/org/xbib/net/scheme/IrcScheme.java index 6381b5f..6dcb897 100644 --- a/net/src/main/java/org/xbib/net/scheme/IrcScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/IrcScheme.java @@ -5,13 +5,13 @@ package org.xbib.net.scheme; * * @see IRC draft */ -class IrcScheme extends HttpScheme { +public class IrcScheme extends HttpScheme { - IrcScheme() { + public IrcScheme() { super("irc", 194); } - IrcScheme(String name, int port) { + public IrcScheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/LdapScheme.java b/net/src/main/java/org/xbib/net/scheme/LdapScheme.java index 588dbd6..cf33c00 100644 --- a/net/src/main/java/org/xbib/net/scheme/LdapScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/LdapScheme.java @@ -4,13 +4,13 @@ package org.xbib.net.scheme; * The LDAP scheme. * @see LDAP RFC */ -class LdapScheme extends AbstractScheme { +public class LdapScheme extends AbstractScheme { - LdapScheme() { + public LdapScheme() { super("ldap", 143); } - LdapScheme(String name, int port) { + public LdapScheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/SecureLdapScheme.java b/net/src/main/java/org/xbib/net/scheme/LdapsScheme.java similarity index 70% rename from net/src/main/java/org/xbib/net/scheme/SecureLdapScheme.java rename to net/src/main/java/org/xbib/net/scheme/LdapsScheme.java index bc90cfd..eb6025d 100644 --- a/net/src/main/java/org/xbib/net/scheme/SecureLdapScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/LdapsScheme.java @@ -5,9 +5,9 @@ package org.xbib.net.scheme; * * @see LDAP RFC */ -class SecureLdapScheme extends LdapScheme { +public class LdapsScheme extends LdapScheme { - SecureLdapScheme() { + public LdapsScheme() { super("ldaps", 636); } diff --git a/net/src/main/java/org/xbib/net/scheme/NewsScheme.java b/net/src/main/java/org/xbib/net/scheme/NewsScheme.java index 7cfed9f..2f84fea 100644 --- a/net/src/main/java/org/xbib/net/scheme/NewsScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/NewsScheme.java @@ -5,13 +5,13 @@ package org.xbib.net.scheme; * * @see news RFC */ -class NewsScheme extends AbstractScheme { +public class NewsScheme extends AbstractScheme { - NewsScheme() { + public NewsScheme() { super("nntp", 119); } - NewsScheme(String name, int port) { + public NewsScheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/NntpScheme.java b/net/src/main/java/org/xbib/net/scheme/NntpScheme.java index a5ed746..f28e85c 100644 --- a/net/src/main/java/org/xbib/net/scheme/NntpScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/NntpScheme.java @@ -5,9 +5,9 @@ package org.xbib.net.scheme; * * @see NNTP RFC */ -class NntpScheme extends AbstractScheme { +public class NntpScheme extends AbstractScheme { - NntpScheme() { + public NntpScheme() { super("nntp", 119); } diff --git a/net/src/main/java/org/xbib/net/scheme/Pop3Scheme.java b/net/src/main/java/org/xbib/net/scheme/Pop3Scheme.java index dd7bda6..2467f8b 100644 --- a/net/src/main/java/org/xbib/net/scheme/Pop3Scheme.java +++ b/net/src/main/java/org/xbib/net/scheme/Pop3Scheme.java @@ -5,13 +5,13 @@ package org.xbib.net.scheme; * * @see POP3 RFC */ -class Pop3Scheme extends AbstractScheme { +public class Pop3Scheme extends AbstractScheme { - Pop3Scheme() { + public Pop3Scheme() { super("pop3", 110); } - Pop3Scheme(String name, int port) { + public Pop3Scheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/RedisScheme.java b/net/src/main/java/org/xbib/net/scheme/RedisScheme.java index 916d8a1..ef1c021 100644 --- a/net/src/main/java/org/xbib/net/scheme/RedisScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/RedisScheme.java @@ -3,9 +3,9 @@ package org.xbib.net.scheme; /** * Redis scheme. */ -class RedisScheme extends AbstractScheme { +public class RedisScheme extends AbstractScheme { - RedisScheme() { + public RedisScheme() { super("redis", 6379); } diff --git a/net/src/main/java/org/xbib/net/scheme/RsyncScheme.java b/net/src/main/java/org/xbib/net/scheme/RsyncScheme.java index 3aa6be0..8c15864 100644 --- a/net/src/main/java/org/xbib/net/scheme/RsyncScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/RsyncScheme.java @@ -3,9 +3,9 @@ package org.xbib.net.scheme; /** * Rsync scheme. */ -class RsyncScheme extends SshScheme { +public class RsyncScheme extends SshScheme { - RsyncScheme() { + public RsyncScheme() { super("rsync", 873); } diff --git a/net/src/main/java/org/xbib/net/scheme/RtmpScheme.java b/net/src/main/java/org/xbib/net/scheme/RtmpScheme.java index 7860df6..d35b381 100644 --- a/net/src/main/java/org/xbib/net/scheme/RtmpScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/RtmpScheme.java @@ -3,9 +3,9 @@ package org.xbib.net.scheme; /** * Rtmp scheme. */ -class RtmpScheme extends AbstractScheme { +public class RtmpScheme extends AbstractScheme { - RtmpScheme() { + public RtmpScheme() { super("rtmp", 1935); } diff --git a/net/src/main/java/org/xbib/net/scheme/RtspScheme.java b/net/src/main/java/org/xbib/net/scheme/RtspScheme.java index eaca520..1525c50 100644 --- a/net/src/main/java/org/xbib/net/scheme/RtspScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/RtspScheme.java @@ -5,9 +5,9 @@ package org.xbib.net.scheme; * * @see RTSP RFC */ -class RtspScheme extends AbstractScheme { +public class RtspScheme extends AbstractScheme { - RtspScheme() { + public RtspScheme() { super("rtsp", 554); } diff --git a/net/src/main/java/org/xbib/net/scheme/SchemeRegistry.java b/net/src/main/java/org/xbib/net/scheme/SchemeRegistry.java index d536745..79519c4 100644 --- a/net/src/main/java/org/xbib/net/scheme/SchemeRegistry.java +++ b/net/src/main/java/org/xbib/net/scheme/SchemeRegistry.java @@ -23,12 +23,12 @@ public final class SchemeRegistry { schemes.put(Scheme.GIT_HTTPS, new GitSecureHttpScheme()); schemes.put(Scheme.GOPHER, new GopherScheme()); schemes.put(Scheme.HTTP, new HttpScheme()); - schemes.put(Scheme.HTTPS, new SecureHttpScheme()); + schemes.put(Scheme.HTTPS, new HttpsScheme()); schemes.put(Scheme.IMAP, new ImapScheme()); - schemes.put(Scheme.IMAPS, new SecureImapScheme()); + schemes.put(Scheme.IMAPS, new ImapsScheme()); schemes.put(Scheme.IRC, new IrcScheme()); schemes.put(Scheme.LDAP, new LdapScheme()); - schemes.put(Scheme.LDAPS, new SecureLdapScheme()); + schemes.put(Scheme.LDAPS, new LdapsScheme()); schemes.put(Scheme.MAILTO, new MailtoScheme()); schemes.put(Scheme.NEWS, new NewsScheme()); schemes.put(Scheme.NNTP, new NntpScheme()); @@ -40,14 +40,14 @@ public final class SchemeRegistry { schemes.put(Scheme.RTSP, new RtspScheme()); schemes.put(Scheme.SFTP, new SftpScheme()); schemes.put(Scheme.SMTP, new SmtpScheme()); - schemes.put(Scheme.SMTPS, new SecureSmtpScheme()); + schemes.put(Scheme.SMTPS, new SmtpsScheme()); schemes.put(Scheme.SNEWS, new SecureNewsScheme()); schemes.put(Scheme.SSH, new SshScheme()); schemes.put(Scheme.TELNET, new TelnetScheme()); schemes.put(Scheme.TFTP, new TftpScheme()); schemes.put(Scheme.URN, new UrnScheme()); - schemes.put(Scheme.WS, new WebSocketScheme()); - schemes.put(Scheme.WSS, new SecureWebSocketScheme()); + schemes.put(Scheme.WS, new WsScheme()); + schemes.put(Scheme.WSS, new WssScheme()); for (Scheme scheme : ServiceLoader.load(Scheme.class)) { register(scheme); } diff --git a/net/src/main/java/org/xbib/net/scheme/SecureHttpScheme.java b/net/src/main/java/org/xbib/net/scheme/SecureHttpScheme.java deleted file mode 100644 index a87dfe6..0000000 --- a/net/src/main/java/org/xbib/net/scheme/SecureHttpScheme.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.xbib.net.scheme; - -/** - * Secure HTTP scheme. - */ -class SecureHttpScheme extends HttpScheme { - - SecureHttpScheme() { - super("https", 443); - } - -} diff --git a/net/src/main/java/org/xbib/net/scheme/SecureNewsScheme.java b/net/src/main/java/org/xbib/net/scheme/SecureNewsScheme.java index dda8e41..6397fae 100644 --- a/net/src/main/java/org/xbib/net/scheme/SecureNewsScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/SecureNewsScheme.java @@ -5,9 +5,9 @@ package org.xbib.net.scheme; * * @see news RFC */ -class SecureNewsScheme extends NewsScheme { +public class SecureNewsScheme extends NewsScheme { - SecureNewsScheme() { + public SecureNewsScheme() { super("snews", 563); } diff --git a/net/src/main/java/org/xbib/net/scheme/SecurePop3Scheme.java b/net/src/main/java/org/xbib/net/scheme/SecurePop3Scheme.java index bea7185..930fe55 100644 --- a/net/src/main/java/org/xbib/net/scheme/SecurePop3Scheme.java +++ b/net/src/main/java/org/xbib/net/scheme/SecurePop3Scheme.java @@ -5,9 +5,9 @@ package org.xbib.net.scheme; * * @see POP3 RFC */ -class SecurePop3Scheme extends Pop3Scheme { +public class SecurePop3Scheme extends Pop3Scheme { - SecurePop3Scheme() { + public SecurePop3Scheme() { super("pop3s", 995); } } diff --git a/net/src/main/java/org/xbib/net/scheme/SftpScheme.java b/net/src/main/java/org/xbib/net/scheme/SftpScheme.java index 9233336..d7a0e7e 100644 --- a/net/src/main/java/org/xbib/net/scheme/SftpScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/SftpScheme.java @@ -3,9 +3,9 @@ package org.xbib.net.scheme; /** * Secure FTP scheme. */ -class SftpScheme extends SshScheme { +public class SftpScheme extends SshScheme { - SftpScheme() { + public SftpScheme() { super("sftp", 22); } diff --git a/net/src/main/java/org/xbib/net/scheme/SmtpScheme.java b/net/src/main/java/org/xbib/net/scheme/SmtpScheme.java index f19fc0f..43950de 100644 --- a/net/src/main/java/org/xbib/net/scheme/SmtpScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/SmtpScheme.java @@ -5,13 +5,13 @@ package org.xbib.net.scheme; * * @see SMTP RFC */ -class SmtpScheme extends AbstractScheme { +public class SmtpScheme extends AbstractScheme { - SmtpScheme() { + public SmtpScheme() { super("smtp", 25); } - SmtpScheme(String name, int port) { + public SmtpScheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/SecureSmtpScheme.java b/net/src/main/java/org/xbib/net/scheme/SmtpsScheme.java similarity index 70% rename from net/src/main/java/org/xbib/net/scheme/SecureSmtpScheme.java rename to net/src/main/java/org/xbib/net/scheme/SmtpsScheme.java index fc6d38f..dcae11b 100644 --- a/net/src/main/java/org/xbib/net/scheme/SecureSmtpScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/SmtpsScheme.java @@ -5,9 +5,9 @@ package org.xbib.net.scheme; * * @see SMTP RFC */ -class SecureSmtpScheme extends SmtpScheme { +public class SmtpsScheme extends SmtpScheme { - SecureSmtpScheme() { + public SmtpsScheme() { super("smtps", 587); } diff --git a/net/src/main/java/org/xbib/net/scheme/SshScheme.java b/net/src/main/java/org/xbib/net/scheme/SshScheme.java index 2736049..490af83 100644 --- a/net/src/main/java/org/xbib/net/scheme/SshScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/SshScheme.java @@ -3,13 +3,13 @@ package org.xbib.net.scheme; /** * Secure shell scheme. */ -class SshScheme extends HttpScheme { +public class SshScheme extends HttpScheme { - SshScheme() { + public SshScheme() { super("ssh", 22); } - SshScheme(String name, int port) { + public SshScheme(String name, int port) { super(name, port); } } diff --git a/net/src/main/java/org/xbib/net/scheme/TelnetScheme.java b/net/src/main/java/org/xbib/net/scheme/TelnetScheme.java index a885a30..c017f38 100644 --- a/net/src/main/java/org/xbib/net/scheme/TelnetScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/TelnetScheme.java @@ -5,9 +5,9 @@ package org.xbib.net.scheme; * * @see TELNET RFC */ -class TelnetScheme extends AbstractScheme { +public class TelnetScheme extends AbstractScheme { - TelnetScheme() { + public TelnetScheme() { super("telnet", 23); } diff --git a/net/src/main/java/org/xbib/net/scheme/TftpScheme.java b/net/src/main/java/org/xbib/net/scheme/TftpScheme.java index 42f4797..c0823dc 100644 --- a/net/src/main/java/org/xbib/net/scheme/TftpScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/TftpScheme.java @@ -5,9 +5,9 @@ package org.xbib.net.scheme; * * @see TFTP RFC */ -class TftpScheme extends FtpScheme { +public class TftpScheme extends FtpScheme { - TftpScheme() { + public TftpScheme() { super("tftp", 69); } } diff --git a/net/src/main/java/org/xbib/net/scheme/UrnScheme.java b/net/src/main/java/org/xbib/net/scheme/UrnScheme.java index 246dc84..4c2c737 100644 --- a/net/src/main/java/org/xbib/net/scheme/UrnScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/UrnScheme.java @@ -5,9 +5,9 @@ package org.xbib.net.scheme; * * @see URN RFC */ -class UrnScheme extends AbstractScheme { +public class UrnScheme extends AbstractScheme { - UrnScheme() { + public UrnScheme() { super("urn", -1); } diff --git a/net/src/main/java/org/xbib/net/scheme/WebSocketScheme.java b/net/src/main/java/org/xbib/net/scheme/WsScheme.java similarity index 53% rename from net/src/main/java/org/xbib/net/scheme/WebSocketScheme.java rename to net/src/main/java/org/xbib/net/scheme/WsScheme.java index 5b996de..916220f 100644 --- a/net/src/main/java/org/xbib/net/scheme/WebSocketScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/WsScheme.java @@ -3,13 +3,13 @@ package org.xbib.net.scheme; /** * Web socket scheme. */ -class WebSocketScheme extends HttpScheme { +public class WsScheme extends HttpScheme { - WebSocketScheme() { + public WsScheme() { super("ws", 80); } - WebSocketScheme(String name, int port) { + public WsScheme(String name, int port) { super(name, port); } diff --git a/net/src/main/java/org/xbib/net/scheme/SecureWebSocketScheme.java b/net/src/main/java/org/xbib/net/scheme/WssScheme.java similarity index 55% rename from net/src/main/java/org/xbib/net/scheme/SecureWebSocketScheme.java rename to net/src/main/java/org/xbib/net/scheme/WssScheme.java index 09eb0b5..064b9eb 100644 --- a/net/src/main/java/org/xbib/net/scheme/SecureWebSocketScheme.java +++ b/net/src/main/java/org/xbib/net/scheme/WssScheme.java @@ -3,9 +3,9 @@ package org.xbib.net.scheme; /** * Secure web socket scheme. */ -class SecureWebSocketScheme extends WebSocketScheme { +public class WssScheme extends WsScheme { - SecureWebSocketScheme() { + public WssScheme() { super("wss", 443); } diff --git a/net/src/test/java/module-info.java b/net/src/test/java/module-info.java new file mode 100644 index 0000000..127b541 --- /dev/null +++ b/net/src/test/java/module-info.java @@ -0,0 +1,12 @@ +module org.xbib.net.test { + requires transitive org.junit.jupiter.api; + requires org.xbib.net; + requires com.fasterxml.jackson.core; + requires com.fasterxml.jackson.databind; + exports org.xbib.net.test; + exports org.xbib.net.test.resource; + exports org.xbib.net.test.template; + exports org.xbib.net.test.util; + opens org.xbib.net.test; + opens org.xbib.net.test.template; +} diff --git a/net/src/test/java/org/xbib/net/package-info.java b/net/src/test/java/org/xbib/net/package-info.java deleted file mode 100644 index 9103c39..0000000 --- a/net/src/test/java/org/xbib/net/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Classes for testing URL building und parsing. - */ -package org.xbib.net; diff --git a/net/src/test/java/org/xbib/net/template/package-info.java b/net/src/test/java/org/xbib/net/template/package-info.java deleted file mode 100644 index eb5045e..0000000 --- a/net/src/test/java/org/xbib/net/template/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Classes for testing URL templates. - */ -package org.xbib.net.template; diff --git a/net/src/test/java/org/xbib/net/NetworkUtilsTest.java b/net/src/test/java/org/xbib/net/test/NetworkUtilsTest.java similarity index 89% rename from net/src/test/java/org/xbib/net/NetworkUtilsTest.java rename to net/src/test/java/org/xbib/net/test/NetworkUtilsTest.java index 7baf209..7e43361 100644 --- a/net/src/test/java/org/xbib/net/NetworkUtilsTest.java +++ b/net/src/test/java/org/xbib/net/test/NetworkUtilsTest.java @@ -1,8 +1,8 @@ -package org.xbib.net; +package org.xbib.net.test; import org.junit.jupiter.api.Test; +import org.xbib.net.NetworkUtils; -import java.net.UnixDomainSocketAddress; import java.util.logging.Level; import java.util.logging.Logger; @@ -10,6 +10,9 @@ public class NetworkUtilsTest { private static final Logger logger = Logger.getLogger(NetworkUtilsTest.class.getName()); + public NetworkUtilsTest() { + } + @Test public void testInterfaceProperties() { logger.log(Level.INFO, NetworkUtils.createProperties().toString()); diff --git a/net/src/test/java/org/xbib/net/ParameterTest.java b/net/src/test/java/org/xbib/net/test/ParameterTest.java similarity index 97% rename from net/src/test/java/org/xbib/net/ParameterTest.java rename to net/src/test/java/org/xbib/net/test/ParameterTest.java index a9018db..61329da 100644 --- a/net/src/test/java/org/xbib/net/ParameterTest.java +++ b/net/src/test/java/org/xbib/net/test/ParameterTest.java @@ -1,4 +1,4 @@ -package org.xbib.net; +package org.xbib.net.test; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -6,6 +6,12 @@ import java.util.List; import java.util.Map; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.xbib.net.Parameter; +import org.xbib.net.ParameterBuilder; +import org.xbib.net.ParameterException; +import org.xbib.net.URL; +import org.xbib.net.URLBuilder; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/net/src/test/java/org/xbib/net/PathNormalizerTest.java b/net/src/test/java/org/xbib/net/test/PathNormalizerTest.java similarity index 98% rename from net/src/test/java/org/xbib/net/PathNormalizerTest.java rename to net/src/test/java/org/xbib/net/test/PathNormalizerTest.java index c442842..440c8bf 100644 --- a/net/src/test/java/org/xbib/net/PathNormalizerTest.java +++ b/net/src/test/java/org/xbib/net/test/PathNormalizerTest.java @@ -1,4 +1,4 @@ -package org.xbib.net; +package org.xbib.net.test; import org.junit.jupiter.api.Test; import org.xbib.net.PathNormalizer; diff --git a/net/src/test/java/org/xbib/net/PercentDecoderTest.java b/net/src/test/java/org/xbib/net/test/PercentDecoderTest.java similarity index 97% rename from net/src/test/java/org/xbib/net/PercentDecoderTest.java rename to net/src/test/java/org/xbib/net/test/PercentDecoderTest.java index 38cfd0c..ccf3c34 100644 --- a/net/src/test/java/org/xbib/net/PercentDecoderTest.java +++ b/net/src/test/java/org/xbib/net/test/PercentDecoderTest.java @@ -1,7 +1,10 @@ -package org.xbib.net; +package org.xbib.net.test; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.xbib.net.PercentDecoder; +import org.xbib.net.PercentEncoder; +import org.xbib.net.PercentEncoders; import java.nio.charset.MalformedInputException; import java.nio.charset.StandardCharsets; diff --git a/net/src/test/java/org/xbib/net/PercentEncoderTest.java b/net/src/test/java/org/xbib/net/test/PercentEncoderTest.java similarity index 96% rename from net/src/test/java/org/xbib/net/PercentEncoderTest.java rename to net/src/test/java/org/xbib/net/test/PercentEncoderTest.java index d221f39..8bb15b2 100644 --- a/net/src/test/java/org/xbib/net/PercentEncoderTest.java +++ b/net/src/test/java/org/xbib/net/test/PercentEncoderTest.java @@ -1,7 +1,9 @@ -package org.xbib.net; +package org.xbib.net.test; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.xbib.net.PercentEncoder; +import org.xbib.net.PercentEncoders; import java.nio.charset.StandardCharsets; import java.util.BitSet; diff --git a/net/src/test/java/org/xbib/net/URIComponentTest.java b/net/src/test/java/org/xbib/net/test/URIComponentTest.java similarity index 98% rename from net/src/test/java/org/xbib/net/URIComponentTest.java rename to net/src/test/java/org/xbib/net/test/URIComponentTest.java index db8d899..8115840 100644 --- a/net/src/test/java/org/xbib/net/URIComponentTest.java +++ b/net/src/test/java/org/xbib/net/test/URIComponentTest.java @@ -1,4 +1,4 @@ -package org.xbib.net; +package org.xbib.net.test; import org.junit.jupiter.api.Test; diff --git a/net/src/test/java/org/xbib/net/URLBuilderTest.java b/net/src/test/java/org/xbib/net/test/URLBuilderTest.java similarity index 98% rename from net/src/test/java/org/xbib/net/URLBuilderTest.java rename to net/src/test/java/org/xbib/net/test/URLBuilderTest.java index e5a1303..8b39ca4 100644 --- a/net/src/test/java/org/xbib/net/URLBuilderTest.java +++ b/net/src/test/java/org/xbib/net/test/URLBuilderTest.java @@ -1,6 +1,9 @@ -package org.xbib.net; +package org.xbib.net.test; import org.junit.jupiter.api.Test; +import org.xbib.net.NetworkUtils; +import org.xbib.net.URL; +import org.xbib.net.URLBuilder; import java.net.SocketException; diff --git a/net/src/test/java/org/xbib/net/URLParserTest.java b/net/src/test/java/org/xbib/net/test/URLParserTest.java similarity index 98% rename from net/src/test/java/org/xbib/net/URLParserTest.java rename to net/src/test/java/org/xbib/net/test/URLParserTest.java index d85a2af..b530f80 100644 --- a/net/src/test/java/org/xbib/net/URLParserTest.java +++ b/net/src/test/java/org/xbib/net/test/URLParserTest.java @@ -1,7 +1,11 @@ -package org.xbib.net; +package org.xbib.net.test; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.xbib.net.Parameter; +import org.xbib.net.URL; +import org.xbib.net.URLBuilder; +import org.xbib.net.URLSyntaxException; import java.net.URI; import java.nio.charset.Charset; @@ -18,7 +22,7 @@ class URLParserTest { @Test void testNull() { - assertEquals(URL.nullUrl(), URL.from((String) null)); + Assertions.assertEquals(URL.nullUrl(), URL.from((String) null)); } @Test diff --git a/net/src/test/java/org/xbib/net/URLResolverTest.java b/net/src/test/java/org/xbib/net/test/URLResolverTest.java similarity index 98% rename from net/src/test/java/org/xbib/net/URLResolverTest.java rename to net/src/test/java/org/xbib/net/test/URLResolverTest.java index 6d90f81..5bef418 100644 --- a/net/src/test/java/org/xbib/net/URLResolverTest.java +++ b/net/src/test/java/org/xbib/net/test/URLResolverTest.java @@ -1,6 +1,8 @@ -package org.xbib.net; +package org.xbib.net.test; import org.junit.jupiter.api.Test; +import org.xbib.net.URL; +import org.xbib.net.URLSyntaxException; import java.net.URI; import java.nio.charset.MalformedInputException; diff --git a/net/src/test/java/org/xbib/net/URLTest.java b/net/src/test/java/org/xbib/net/test/URLTest.java similarity index 93% rename from net/src/test/java/org/xbib/net/URLTest.java rename to net/src/test/java/org/xbib/net/test/URLTest.java index e4bdc4a..3844964 100644 --- a/net/src/test/java/org/xbib/net/URLTest.java +++ b/net/src/test/java/org/xbib/net/test/URLTest.java @@ -1,14 +1,22 @@ -package org.xbib.net; +package org.xbib.net.test; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.xbib.net.ProtocolVersion; +import org.xbib.net.URL; +import org.xbib.net.URLSyntaxException; +import java.io.InputStream; import java.text.Normalizer; import java.util.ArrayList; import java.util.List; +import java.util.Objects; +import java.util.logging.Level; +import java.util.logging.Logger; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; @@ -16,9 +24,11 @@ import static org.junit.jupiter.api.Assertions.fail; class URLTest { + private static final Logger logger = Logger.getLogger(URLTest.class.getName()); + @Test void test() throws Exception { - List tests = readTests(fromResource("/urltestdata.json")); + List tests = readTests(fromResource("urltestdata.json")); for (JsonTest test : tests) { String base = test.base; String input = test.input; @@ -50,13 +60,8 @@ class URLTest { if (test.port != null && !test.port.isEmpty() && url.getPort() != null) { assertEquals(Integer.parseInt(test.port), (int) url.getPort()); } - // TODO(jprante) - //if (test.pathname != null && !test.pathname.isEmpty() && url.getPath() != null) { - // assertEquals(test.pathname, url.getPath()); - //} - //System.err.println("passed: " + base + " " + input); } catch (URLSyntaxException e) { - //System.err.println("unable to resolve: " + base + " " + input + " reason: " + e.getMessage()); + logger.log(Level.SEVERE, e.getMessage(), e); } } } @@ -67,7 +72,9 @@ class URLTest { ObjectMapper mapper = new ObjectMapper(); ObjectReader reader = mapper.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, true) .readerFor(JsonNode.class); - return reader.readValue(getClass().getResourceAsStream(path)); + InputStream inputStream = getClass().getResourceAsStream(path); + Objects.requireNonNull(inputStream, path); + return reader.readValue(inputStream); } private List readTests(JsonNode jsonNode) { @@ -127,7 +134,7 @@ class URLTest { @Test void testIpv6() { URL iri = URL.from("http://[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]"); - assertEquals(iri.getProtocolVersion(), ProtocolVersion.IPV6); + Assertions.assertEquals(iri.getProtocolVersion(), ProtocolVersion.IPV6); assertEquals("http://[2001:db8:85a3:8d3:1319:8a2e:370:7344]", iri.toString()); } diff --git a/net/src/test/java/org/xbib/net/resource/IRITest.java b/net/src/test/java/org/xbib/net/test/resource/IRITest.java similarity index 99% rename from net/src/test/java/org/xbib/net/resource/IRITest.java rename to net/src/test/java/org/xbib/net/test/resource/IRITest.java index d6b8794..bf42a56 100644 --- a/net/src/test/java/org/xbib/net/resource/IRITest.java +++ b/net/src/test/java/org/xbib/net/test/resource/IRITest.java @@ -1,4 +1,4 @@ -package org.xbib.net.resource; +package org.xbib.net.test.resource; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/net/src/test/java/org/xbib/net/template/URITemplateTest.java b/net/src/test/java/org/xbib/net/test/template/URITemplateTest.java similarity index 94% rename from net/src/test/java/org/xbib/net/template/URITemplateTest.java rename to net/src/test/java/org/xbib/net/test/template/URITemplateTest.java index a1487de..c2a402a 100644 --- a/net/src/test/java/org/xbib/net/template/URITemplateTest.java +++ b/net/src/test/java/org/xbib/net/test/template/URITemplateTest.java @@ -1,10 +1,11 @@ -package org.xbib.net.template; +package org.xbib.net.test.template; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; import org.junit.jupiter.api.Test; +import org.xbib.net.template.URITemplate; import org.xbib.net.template.expression.ExpressionType; import org.xbib.net.template.expression.TemplateExpression; import org.xbib.net.template.expression.URITemplateExpression; @@ -23,6 +24,7 @@ import org.xbib.net.template.vars.values.NullValue; import org.xbib.net.template.vars.values.ScalarValue; import org.xbib.net.template.vars.values.VariableValue; +import java.io.InputStream; import java.nio.CharBuffer; import java.util.ArrayList; import java.util.Arrays; @@ -31,9 +33,11 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -63,7 +67,7 @@ class URITemplateTest { VariableSpecParser.parse(buffer); fail("No exception thrown"); } catch (Exception ex) { - assertTrue(ex instanceof IllegalArgumentException); + assertInstanceOf(IllegalArgumentException.class, ex); } } } @@ -199,7 +203,7 @@ class URITemplateTest { @Test void testExamples() throws Exception { - JsonNode data = fromResource("/spec-examples.json"); + JsonNode data = fromResource("spec-examples.json"); List> list = new ArrayList<>(); for (JsonNode node : data) { Variables.Builder builder = Variables.builder(); @@ -239,7 +243,7 @@ class URITemplateTest { @Test void testExamplesBySection() throws Exception { - JsonNode data = fromResource("/spec-examples-by-section.json"); + JsonNode data = fromResource("spec-examples-by-section.json"); List> list = new ArrayList<>(); for (JsonNode node : data) { Variables.Builder builder = Variables.builder(); @@ -279,7 +283,7 @@ class URITemplateTest { @Test void extendedTests() throws Exception { - JsonNode data = fromResource("/extended-tests.json"); + JsonNode data = fromResource("extended-tests.json"); List> list = new ArrayList<>(); for (JsonNode node : data) { Variables.Builder builder = Variables.builder(); @@ -319,7 +323,7 @@ class URITemplateTest { @Test void negativeTests() throws Exception { - JsonNode data = fromResource("/negative-tests.json"); + JsonNode data = fromResource("negative-tests.json"); JsonNode node = data.get("Failure Tests").get("variables"); Variables.Builder builder = Variables.builder(); Iterator> it = node.fields(); @@ -346,8 +350,9 @@ class URITemplateTest { @Test void expansionTest() throws Exception { - String[] strings = new String[]{"/rfcExamples.json", "/strings.json", "/multipleStrings.json", - "/lists.json", "/multipleLists.json"}; + String[] strings = new String[]{"rfcExamples.json", + "strings.json", "multipleStrings.json", + "lists.json", "multipleLists.json"}; for (String s : strings) { JsonNode data = fromResource(s); Variables.Builder builder = Variables.builder(); @@ -379,7 +384,9 @@ class URITemplateTest { ObjectMapper mapper = new ObjectMapper(); ObjectReader reader = mapper.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, true) .readerFor(JsonNode.class); - return reader.readValue(getClass().getResourceAsStream(path)); + InputStream inputStream = getClass().getResourceAsStream(path); + Objects.requireNonNull(inputStream, path); + return reader.readValue(inputStream); } private static VariableValue fromJson(JsonNode node) { diff --git a/net/src/test/java/org/xbib/net/util/JsonFileStoreTest.java b/net/src/test/java/org/xbib/net/test/util/JsonFileStoreTest.java similarity index 95% rename from net/src/test/java/org/xbib/net/util/JsonFileStoreTest.java rename to net/src/test/java/org/xbib/net/test/util/JsonFileStoreTest.java index 6d6e9c9..ed63f7b 100644 --- a/net/src/test/java/org/xbib/net/util/JsonFileStoreTest.java +++ b/net/src/test/java/org/xbib/net/test/util/JsonFileStoreTest.java @@ -1,8 +1,10 @@ -package org.xbib.net.util; +package org.xbib.net.test.util; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.xbib.net.util.JsonFileStore; +import org.xbib.net.util.RandomUtil; import java.io.IOException; import java.nio.file.Files; diff --git a/net/src/test/resources/extended-tests.json b/net/src/test/resources/org/xbib/net/test/template/extended-tests.json similarity index 100% rename from net/src/test/resources/extended-tests.json rename to net/src/test/resources/org/xbib/net/test/template/extended-tests.json diff --git a/net/src/test/resources/lists.json b/net/src/test/resources/org/xbib/net/test/template/lists.json similarity index 100% rename from net/src/test/resources/lists.json rename to net/src/test/resources/org/xbib/net/test/template/lists.json diff --git a/net/src/test/resources/multipleLists.json b/net/src/test/resources/org/xbib/net/test/template/multipleLists.json similarity index 100% rename from net/src/test/resources/multipleLists.json rename to net/src/test/resources/org/xbib/net/test/template/multipleLists.json diff --git a/net/src/test/resources/multipleStrings.json b/net/src/test/resources/org/xbib/net/test/template/multipleStrings.json similarity index 100% rename from net/src/test/resources/multipleStrings.json rename to net/src/test/resources/org/xbib/net/test/template/multipleStrings.json diff --git a/net/src/test/resources/negative-tests.json b/net/src/test/resources/org/xbib/net/test/template/negative-tests.json similarity index 100% rename from net/src/test/resources/negative-tests.json rename to net/src/test/resources/org/xbib/net/test/template/negative-tests.json diff --git a/net/src/test/resources/rfcExamples.json b/net/src/test/resources/org/xbib/net/test/template/rfcExamples.json similarity index 100% rename from net/src/test/resources/rfcExamples.json rename to net/src/test/resources/org/xbib/net/test/template/rfcExamples.json diff --git a/net/src/test/resources/spec-examples-by-section.json b/net/src/test/resources/org/xbib/net/test/template/spec-examples-by-section.json similarity index 100% rename from net/src/test/resources/spec-examples-by-section.json rename to net/src/test/resources/org/xbib/net/test/template/spec-examples-by-section.json diff --git a/net/src/test/resources/spec-examples.json b/net/src/test/resources/org/xbib/net/test/template/spec-examples.json similarity index 100% rename from net/src/test/resources/spec-examples.json rename to net/src/test/resources/org/xbib/net/test/template/spec-examples.json diff --git a/net/src/test/resources/strings.json b/net/src/test/resources/org/xbib/net/test/template/strings.json similarity index 100% rename from net/src/test/resources/strings.json rename to net/src/test/resources/org/xbib/net/test/template/strings.json diff --git a/net/src/test/resources/urltestdata.json b/net/src/test/resources/org/xbib/net/test/urltestdata.json similarity index 100% rename from net/src/test/resources/urltestdata.json rename to net/src/test/resources/org/xbib/net/test/urltestdata.json