update to OpenJDK 11, Gradle 5.3.1

This commit is contained in:
Jörg Prante 2019-08-12 11:11:29 +02:00
parent 455f053c1e
commit ff71163df3
15 changed files with 216 additions and 257 deletions

View file

@ -1,52 +1,37 @@
plugins { plugins {
id "com.github.spotbugs" version "1.7.0" id "com.github.spotbugs" version "2.0.0"
id "org.sonarqube" version '2.6.1' id "org.sonarqube" version '2.6.1'
id "io.codearte.nexus-staging" version "0.11.0" id "io.codearte.nexus-staging" version "0.11.0"
} }
printf "Host: %s\nOS: %s %s %s\nJVM: %s %s %s %s\nGradle: %s Groovy: %s Java: %s\n" +
"Build: group: ${project.group} name: ${project.name} version: ${project.version}\n",
InetAddress.getLocalHost(),
System.getProperty("os.name"),
System.getProperty("os.arch"),
System.getProperty("os.version"),
System.getProperty("java.version"),
System.getProperty("java.vm.version"),
System.getProperty("java.vm.vendor"),
System.getProperty("java.vm.name"),
gradle.gradleVersion,
GroovySystem.getVersion(),
JavaVersion.current()
subprojects { subprojects {
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'maven' apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'checkstyle' apply plugin: 'checkstyle'
apply plugin: 'pmd' apply plugin: 'pmd'
apply plugin: "com.github.spotbugs" apply plugin: "com.github.spotbugs"
configurations {
wagon
}
dependencies { dependencies {
testCompile "junit:junit:${project.property('junit.version')}" testImplementation "org.junit.jupiter:junit-jupiter-api:${project.property('junit.version')}"
wagon "org.apache.maven.wagon:wagon-ssh:${project.property('wagon.version')}" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${project.property('junit.version')}"
testImplementation "org.xbib:bibliographic-character-sets:${project.property('xbib-bibliographic-character-sets.version')}"
} }
compileJava { compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
compileTestJava { compileTestJava {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all,-fallthrough" options.compilerArgs << "-Xlint:all,-fallthrough"
if (!options.compilerArgs.contains("-processor")) {
options.compilerArgs << '-proc:none'
}
} }
clean { clean {
@ -54,10 +39,20 @@ subprojects {
} }
test { test {
useJUnitPlatform()
systemProperty 'java.util.logging.config.file', project.file('src/test/resources/logging.properties') systemProperty 'java.util.logging.config.file', project.file('src/test/resources/logging.properties')
failFast = false
testLogging { testLogging {
showStandardStreams = true events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED'
exceptionFormat = 'full' }
afterSuite { desc, result ->
if (!desc.parent) {
println "\nTest result: ${result.resultType}"
println "Test summary: ${result.testCount} tests, " +
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped"
}
} }
} }
@ -73,12 +68,7 @@ subprojects {
artifacts { artifacts {
archives sourcesJar, javadocJar archives sourcesJar, javadocJar
} }
if (project.hasProperty('signing.keyId')) {
signing {
sign configurations.archives
}
}
ext { ext {
user = 'xbib' user = 'xbib'
projectName = 'z3950' projectName = 'z3950'
@ -88,7 +78,105 @@ subprojects {
scmDeveloperConnection = 'scm:git:git://github.com/xbib/z3950.git' scmDeveloperConnection = 'scm:git:git://github.com/xbib/z3950.git'
} }
apply from: "${rootProject.projectDir}/gradle/publish.gradle" spotbugs {
apply from: "${rootProject.projectDir}/gradle/sonarqube.gradle" toolVersion = '3.1.12'
sourceSets = [sourceSets.main]
ignoreFailures = true
effort = "max"
reportLevel = "high"
}
spotbugsMain.reports {
xml.enabled = false
html.enabled = true
}
spotbugsTest.reports {
xml.enabled = false
html.enabled = true
}
tasks.withType(Pmd) {
ignoreFailures = true
reports {
xml.enabled = true
html.enabled = true
}
}
tasks.withType(Checkstyle) {
ignoreFailures = true
exclude '**/PQF*java'
reports {
xml.enabled = true
html.enabled = true
}
}
sonarqube {
properties {
property "sonar.projectName", "${project.group} ${project.name}"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.tests", "src/test/java"
property "sonar.scm.provider", "git"
property "sonar.junit.reportsPath", "build/test-results/test/"
}
}
task sonatypeUpload(type: Upload, dependsOn: build) {
group = 'publish'
configuration = configurations.archives
uploadDescriptor = true
repositories {
if (project.hasProperty('ossrhUsername')) {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: uri(ossrhReleaseUrl)) {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: uri(ossrhSnapshotUrl)) {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
groupId project.group
artifactId project.name
version project.version
name project.name
description projectDescription
packaging 'jar'
inceptionYear '2017'
url scmUrl
organization {
name 'xbib'
url 'http://xbib.org'
}
developers {
developer {
id user
name 'Jörg Prante'
email 'joergprante@gmail.com'
url 'https://github.com/jprante'
}
}
scm {
url scmUrl
connection scmConnection
developerConnection scmDeveloperConnection
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
}
}
}
nexusStaging {
packageGroup = "org.xbib"
}
} }

View file

@ -1,11 +1,11 @@
group = org.xbib group = org.xbib
name = z3950 name = z3950
version = 1.3.0 version = 2.0.0
xbib-cql.version = 1.2.0 netty.version = 4.1.38.Final
netty.version = 4.1.34.Final xbib-cql.version = 2.0.0
xbib-bibliographic-character-sets.version = 1.0.0
junit.version = 4.12 junit.version = 5.5.1
wagon.version = 3.0.0
org.gradle.warning.mode = all org.gradle.warning.mode = all

View file

@ -1,105 +0,0 @@
task xbibUpload(type: Upload, dependsOn: build) {
group = 'publish'
configuration = configurations.archives
uploadDescriptor = true
repositories {
if (project.hasProperty('xbibUsername')) {
mavenDeployer {
configuration = configurations.wagon
repository(url: uri(project.property('xbibUrl'))) {
authentication(userName: xbibUsername, privateKey: xbibPrivateKey)
}
pom.project {
groupId project.group
artifactId project.name
version project.version
name project.name
description projectDescription
packaging 'jar'
inceptionYear '2017'
url scmUrl
organization {
name 'xbib'
url 'http://xbib.org'
}
developers {
developer {
id user
name 'Jörg Prante'
email 'joergprante@gmail.com'
url 'https://github.com/jprante'
}
}
scm {
url scmUrl
connection scmConnection
developerConnection scmDeveloperConnection
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
}
}
}
task sonatypeUpload(type: Upload, dependsOn: build) {
group = 'publish'
configuration = configurations.archives
uploadDescriptor = true
repositories {
if (project.hasProperty('ossrhUsername')) {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: uri(ossrhReleaseUrl)) {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: uri(ossrhSnapshotUrl)) {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
groupId project.group
artifactId project.name
version project.version
name project.name
description projectDescription
packaging 'jar'
inceptionYear '2017'
url scmUrl
organization {
name 'xbib'
url 'http://xbib.org'
}
developers {
developer {
id user
name 'Jörg Prante'
email 'joergprante@gmail.com'
url 'https://github.com/jprante'
}
}
scm {
url scmUrl
connection scmConnection
developerConnection scmDeveloperConnection
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
}
}
}
nexusStaging {
packageGroup = "org.xbib"
}

View file

@ -1,44 +0,0 @@
spotbugs {
toolVersion = '3.1.12'
sourceSets = [sourceSets.main]
ignoreFailures = true
effort = "max"
reportLevel = "high"
}
spotbugsMain.reports {
xml.enabled = false
html.enabled = true
}
spotbugsTest.reports {
xml.enabled = false
html.enabled = true
}
tasks.withType(Pmd) {
ignoreFailures = true
reports {
xml.enabled = true
html.enabled = true
}
}
tasks.withType(Checkstyle) {
ignoreFailures = true
exclude '**/PQF*java'
reports {
xml.enabled = true
html.enabled = true
}
}
sonarqube {
properties {
property "sonar.projectName", "${project.group} ${project.name}"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.tests", "src/test/java"
property "sonar.scm.provider", "git"
property "sonar.junit.reportsPath", "build/test-results/test/"
}
}

Binary file not shown.

View file

@ -1,6 +1,6 @@
#Thu Mar 14 15:23:27 CET 2019 #Mon Aug 12 10:34:07 CEST 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip zipStoreBase=GRADLE_USER_HOME

18
gradlew vendored
View file

@ -1,5 +1,21 @@
#!/usr/bin/env sh #!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################## ##############################################################################
## ##
## Gradle start up script for UN*X ## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"

18
gradlew.bat vendored
View file

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome

View file

@ -1,6 +1,6 @@
package org.xbib.z3950.client.test; package org.xbib.z3950.client.test;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.xbib.z3950.client.DefaultClient; import org.xbib.z3950.client.DefaultClient;
import java.io.IOException; import java.io.IOException;
@ -15,12 +15,12 @@ import java.util.logging.Logger;
/** /**
* *
*/ */
public class DefaultClientTest { class DefaultClientTest {
private static final Logger logger = Logger.getLogger(DefaultClientTest.class.getName()); private static final Logger logger = Logger.getLogger(DefaultClientTest.class.getName());
@Test @Test
public void testCQL() { void testCQL() {
for (String serviceName : Arrays.asList("LIBRIS", "SWB")) { for (String serviceName : Arrays.asList("LIBRIS", "SWB")) {
String query = "bib.identifierISSN = 00280836"; String query = "bib.identifierISSN = 00280836";
int from = 1; int from = 1;
@ -39,7 +39,7 @@ public class DefaultClientTest {
} }
@Test @Test
public void testPQF() { void testPQF() {
for (String serviceName : Arrays.asList("LIBRIS", "SWB")) { for (String serviceName : Arrays.asList("LIBRIS", "SWB")) {
String query = "@attr 1=8 \"00280836\""; String query = "@attr 1=8 \"00280836\"";
int from = 1; int from = 1;
@ -106,5 +106,4 @@ public class DefaultClientTest {
} }
return builder.build(); return builder.build();
} }
} }

View file

@ -1,6 +1,6 @@
package org.xbib.z3950.client.test; package org.xbib.z3950.client.test;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.xbib.z3950.client.DefaultClient; import org.xbib.z3950.client.DefaultClient;
import java.io.IOException; import java.io.IOException;
@ -11,17 +11,17 @@ import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
/** /**
* GBV test. * GBV test.
*/ */
public class GBVZClientTest { class GBVZClientTest {
private static final Logger logger = Logger.getLogger(GBVZClientTest.class.getName()); private static final Logger logger = Logger.getLogger(GBVZClientTest.class.getName());
@Test @Test
public void testGBV() { void testGBV() {
String query = "@attr 1=4 linux"; String query = "@attr 1=4 linux";
int from = 1; int from = 1;
int size = 10; int size = 10;
@ -38,7 +38,7 @@ public class GBVZClientTest {
} }
@Test @Test
public void testControlNumberZDB() { void testControlNumberZDB() {
String serviceName = "GBV"; String serviceName = "GBV";
String query = "bib.controlNumberZDB = 1413423-8"; String query = "bib.controlNumberZDB = 1413423-8";
int from = 1; int from = 1;

View file

@ -1,6 +1,6 @@
package org.xbib.z3950.client.test; package org.xbib.z3950.client.test;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.xbib.z3950.common.exceptions.MessageSizeTooSmallException; import org.xbib.z3950.common.exceptions.MessageSizeTooSmallException;
import org.xbib.z3950.common.exceptions.NoRecordsReturnedException; import org.xbib.z3950.common.exceptions.NoRecordsReturnedException;
import org.xbib.z3950.client.DefaultClient; import org.xbib.z3950.client.DefaultClient;
@ -12,12 +12,12 @@ import java.util.logging.Logger;
/** /**
* *
*/ */
public class SearchTest { class SearchTest {
private static final Logger logger = Logger.getLogger(SearchTest.class.getName()); private static final Logger logger = Logger.getLogger(SearchTest.class.getName());
@Test @Test
public void testCopac() throws Exception { void testCopac() throws Exception {
String host = "z3950.copac.ac.uk"; String host = "z3950.copac.ac.uk";
int port = 210; int port = 210;
String database = "COPAC"; String database = "COPAC";

View file

@ -1,6 +1,6 @@
package org.xbib.z3950.common; package org.xbib.z3950.common;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -10,12 +10,12 @@ import java.util.logging.Logger;
/** /**
* *
*/ */
public class Bib1Test { class Bib1Test {
private static final Logger logger = Logger.getLogger(Bib1Test.class.getName()); private static final Logger logger = Logger.getLogger(Bib1Test.class.getName());
@Test @Test
public void testBibUse() { void testBibUse() {
ResourceBundle bundle = ResourceBundle.getBundle("org.xbib.z3950.common.bib-1"); ResourceBundle bundle = ResourceBundle.getBundle("org.xbib.z3950.common.bib-1");
ArrayList<String> values = new ArrayList<>(); ArrayList<String> values = new ArrayList<>();
for (String key : bundle.keySet()) { for (String key : bundle.keySet()) {

View file

@ -1,39 +0,0 @@
package org.xbib.z3950.common;
import org.junit.Assert;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
/**
*
*/
public abstract class ParserTest extends Assert {
/**
* Helper method for reading a text file with queries.
*
* @param path the path
*
* @return a string iterable
*
* @throws IOException if the text file can not be read
*/
protected Iterable<String> readFromResource(String path)
throws IOException {
final ArrayList<String> lines = new ArrayList<>();
InputStream in = getClass().getResourceAsStream(path);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = br.readLine()) != null) {
if (line.length() > 0) {
lines.add(line);
}
}
br.close();
return lines;
}
}

View file

@ -1,15 +1,15 @@
package org.xbib.z3950.common.cql; package org.xbib.z3950.common.cql;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.xbib.cql.CQLParser; import org.xbib.cql.CQLParser;
/** /**
* *
*/ */
public class CQL2RPNTest { class CQL2RPNTest {
@Test @Test
public void testCQL2RPN() { void testCQL2RPN() {
String cql = "dc.title = Test"; String cql = "dc.title = Test";
CQLParser parser = new CQLParser(cql); CQLParser parser = new CQLParser(cql);
parser.parse(); parser.parse();

View file

@ -1,22 +1,27 @@
package org.xbib.z3950.common.pqf; package org.xbib.z3950.common.pqf;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.xbib.z3950.common.ParserTest;
import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader; import java.io.StringReader;
import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import static org.junit.jupiter.api.Assertions.assertEquals;
/** /**
* *
*/ */
public class PQFParserTest extends ParserTest { class PQFParserTest {
private static final Logger logger = Logger.getLogger(PQFParserTest.class.getName()); private static final Logger logger = Logger.getLogger(PQFParserTest.class.getName());
@Test @Test
public void testSucceed() throws SyntaxException, IOException { void testSucceed() throws SyntaxException, IOException {
int ok = 0; int ok = 0;
int errors = 0; int errors = 0;
for (String q : readFromResource("pqf-must-succeed")) { for (String q : readFromResource("pqf-must-succeed")) {
@ -33,4 +38,27 @@ public class PQFParserTest extends ParserTest {
assertEquals(ok, 17); assertEquals(ok, 17);
} }
/**
* Helper method for reading a text file with queries.
*
* @param path the path
*
* @return a string iterable
*
* @throws IOException if the text file can not be read
*/
private Iterable<String> readFromResource(String path)
throws IOException {
final ArrayList<String> lines = new ArrayList<>();
InputStream in = getClass().getResourceAsStream(path);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = br.readLine()) != null) {
if (line.length() > 0) {
lines.add(line);
}
}
br.close();
return lines;
}
} }