From 8a0d80d1570c7e38b247e7d70d3a8dc1c1fb971d Mon Sep 17 00:00:00 2001 From: thomas Date: Wed, 14 Apr 2021 23:50:17 +0200 Subject: [PATCH] Add module-info.java, fixes #2 - Bump test dependency + plugin versions - Set project.build.sourceEncoding to fix build warning - Fix FileListTest when run as a module - Bump Travis JDK version to oraclejdk9 - Set scm.url without property reference so it works on search.maven.org --- .travis.yml | 2 +- pom.xml | 34 +++++++++-------- src/main/java/module-info.java | 6 +++ .../rzymek/opczip/reader/FileListTest.java | 37 ++++++++----------- 4 files changed, 40 insertions(+), 39 deletions(-) create mode 100644 src/main/java/module-info.java diff --git a/.travis.yml b/.travis.yml index c0f28cf..3b60663 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,2 +1,2 @@ language: java -jdk: oraclejdk8 +jdk: oraclejdk9 diff --git a/pom.xml b/pom.xml index e33a3eb..03e7b4f 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ https://github.com/rzymek/opczip - ${project.url} + https://github.com/rzymek/opczip @@ -32,15 +32,15 @@ - 1.8 - 1.8 + UTF-8 + 9 org.junit.jupiter junit-jupiter-engine - 5.6.0 + 5.7.1 test @@ -52,13 +52,13 @@ org.assertj assertj-core - 3.15.0 + 3.19.0 test org.junit.jupiter junit-jupiter-params - 5.7.0-M1 + 5.7.1 test @@ -70,7 +70,7 @@ org.openjdk.jmh jmh-generator-annprocess - 1.23 + 1.29 test @@ -78,16 +78,18 @@ maven-surefire-plugin - 2.22.0 + 3.0.0-M5 + + + --add-opens com.github.rzymek.opczip/com.github.rzymek.opczip=ALL-UNNAMED + --add-opens com.github.rzymek.opczip/com.github.rzymek.opczip.reader=ALL-UNNAMED + + org.apache.maven.plugins maven-compiler-plugin - 3.8.0 - - 9 - 9 - + 3.8.1 @@ -100,7 +102,7 @@ org.apache.maven.plugins maven-source-plugin - 3.0.1 + 3.2.1 attach-sources @@ -113,7 +115,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.0.1 + 3.2.0 attach-javadocs @@ -140,7 +142,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.7 + 1.6.8 true ossrh diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..c84b15d --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module com.github.rzymek.opczip { + exports com.github.rzymek.opczip; + exports com.github.rzymek.opczip.reader; + exports com.github.rzymek.opczip.reader.ordered; + exports com.github.rzymek.opczip.reader.skipping; +} diff --git a/src/test/java/com/github/rzymek/opczip/reader/FileListTest.java b/src/test/java/com/github/rzymek/opczip/reader/FileListTest.java index 952b5fd..675f1fd 100644 --- a/src/test/java/com/github/rzymek/opczip/reader/FileListTest.java +++ b/src/test/java/com/github/rzymek/opczip/reader/FileListTest.java @@ -9,10 +9,13 @@ import java.io.IOException; import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.*; -import java.util.stream.Collectors; import java.util.stream.Stream; -import java.util.stream.StreamSupport; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -66,25 +69,15 @@ private InputStream open(String filename) { @Override public Stream provideArguments(ExtensionContext extensionContext) { - InputStream resource = FileListTest.class.getResourceAsStream(XLSX_DIR); - Scanner scanner = new Scanner(resource); - return StreamSupport.stream( - Spliterators.spliteratorUnknownSize(new Iterator<>() { - @Override - public boolean hasNext() { - boolean hasNext = scanner.hasNext(); - if (!hasNext) { - scanner.close(); - } - return hasNext; - } - - @Override - public Arguments next() { - return Arguments.of(scanner.nextLine()); - } - }, Spliterator.ORDERED), - false - ); + try { + URI resource = FileListTest.class.getResource(XLSX_DIR).toURI(); + Path path = Paths.get(resource); + return Files.list(path) + .map(Path::getFileName) + .map(Path::toString) + .map(Arguments::of); + } catch (URISyntaxException | IOException ex) { + throw new IllegalStateException(ex); + } } }