update to OpenJDK 11, Gradle 5.3.1
This commit is contained in:
parent
455f053c1e
commit
ff71163df3
15 changed files with 216 additions and 257 deletions
160
build.gradle
160
build.gradle
|
@ -1,52 +1,37 @@
|
|||
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 "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 {
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
apply plugin: 'checkstyle'
|
||||
apply plugin: 'pmd'
|
||||
apply plugin: "com.github.spotbugs"
|
||||
|
||||
configurations {
|
||||
wagon
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile "junit:junit:${project.property('junit.version')}"
|
||||
wagon "org.apache.maven.wagon:wagon-ssh:${project.property('wagon.version')}"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:${project.property('junit.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 {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
compileTestJava {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs << "-Xlint:all,-fallthrough"
|
||||
if (!options.compilerArgs.contains("-processor")) {
|
||||
options.compilerArgs << '-proc:none'
|
||||
}
|
||||
}
|
||||
|
||||
clean {
|
||||
|
@ -54,10 +39,20 @@ subprojects {
|
|||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
systemProperty 'java.util.logging.config.file', project.file('src/test/resources/logging.properties')
|
||||
failFast = false
|
||||
testLogging {
|
||||
showStandardStreams = true
|
||||
exceptionFormat = 'full'
|
||||
events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED'
|
||||
}
|
||||
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 {
|
||||
archives sourcesJar, javadocJar
|
||||
}
|
||||
|
||||
if (project.hasProperty('signing.keyId')) {
|
||||
signing {
|
||||
sign configurations.archives
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
user = 'xbib'
|
||||
projectName = 'z3950'
|
||||
|
@ -88,7 +78,105 @@ subprojects {
|
|||
scmDeveloperConnection = 'scm:git:git://github.com/xbib/z3950.git'
|
||||
}
|
||||
|
||||
apply from: "${rootProject.projectDir}/gradle/publish.gradle"
|
||||
apply from: "${rootProject.projectDir}/gradle/sonarqube.gradle"
|
||||
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/"
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
group = org.xbib
|
||||
name = z3950
|
||||
version = 1.3.0
|
||||
version = 2.0.0
|
||||
|
||||
xbib-cql.version = 1.2.0
|
||||
netty.version = 4.1.34.Final
|
||||
netty.version = 4.1.38.Final
|
||||
xbib-cql.version = 2.0.0
|
||||
xbib-bibliographic-character-sets.version = 1.0.0
|
||||
|
||||
junit.version = 4.12
|
||||
wagon.version = 3.0.0
|
||||
junit.version = 5.5.1
|
||||
|
||||
org.gradle.warning.mode = all
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -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/"
|
||||
}
|
||||
}
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -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
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
18
gradlew
vendored
18
gradlew
vendored
|
@ -1,5 +1,21 @@
|
|||
#!/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
|
||||
|
@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
|||
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.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m"'
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
|
18
gradlew.bat
vendored
18
gradlew.bat
vendored
|
@ -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
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
|
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
|||
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.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m"
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.xbib.z3950.client.test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.xbib.z3950.client.DefaultClient;
|
||||
|
||||
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());
|
||||
|
||||
@Test
|
||||
public void testCQL() {
|
||||
void testCQL() {
|
||||
for (String serviceName : Arrays.asList("LIBRIS", "SWB")) {
|
||||
String query = "bib.identifierISSN = 00280836";
|
||||
int from = 1;
|
||||
|
@ -39,7 +39,7 @@ public class DefaultClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testPQF() {
|
||||
void testPQF() {
|
||||
for (String serviceName : Arrays.asList("LIBRIS", "SWB")) {
|
||||
String query = "@attr 1=8 \"00280836\"";
|
||||
int from = 1;
|
||||
|
@ -106,5 +106,4 @@ public class DefaultClientTest {
|
|||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.xbib.z3950.client.test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.xbib.z3950.client.DefaultClient;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -11,17 +11,17 @@ import java.util.Properties;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* GBV test.
|
||||
*/
|
||||
public class GBVZClientTest {
|
||||
class GBVZClientTest {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(GBVZClientTest.class.getName());
|
||||
|
||||
@Test
|
||||
public void testGBV() {
|
||||
void testGBV() {
|
||||
String query = "@attr 1=4 linux";
|
||||
int from = 1;
|
||||
int size = 10;
|
||||
|
@ -38,7 +38,7 @@ public class GBVZClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testControlNumberZDB() {
|
||||
void testControlNumberZDB() {
|
||||
String serviceName = "GBV";
|
||||
String query = "bib.controlNumberZDB = 1413423-8";
|
||||
int from = 1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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.NoRecordsReturnedException;
|
||||
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());
|
||||
|
||||
@Test
|
||||
public void testCopac() throws Exception {
|
||||
void testCopac() throws Exception {
|
||||
String host = "z3950.copac.ac.uk";
|
||||
int port = 210;
|
||||
String database = "COPAC";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.xbib.z3950.common;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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());
|
||||
|
||||
@Test
|
||||
public void testBibUse() {
|
||||
void testBibUse() {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle("org.xbib.z3950.common.bib-1");
|
||||
ArrayList<String> values = new ArrayList<>();
|
||||
for (String key : bundle.keySet()) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
package org.xbib.z3950.common.cql;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.xbib.cql.CQLParser;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class CQL2RPNTest {
|
||||
class CQL2RPNTest {
|
||||
|
||||
@Test
|
||||
public void testCQL2RPN() {
|
||||
void testCQL2RPN() {
|
||||
String cql = "dc.title = Test";
|
||||
CQLParser parser = new CQLParser(cql);
|
||||
parser.parse();
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
package org.xbib.z3950.common.pqf;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.xbib.z3950.common.ParserTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
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());
|
||||
|
||||
@Test
|
||||
public void testSucceed() throws SyntaxException, IOException {
|
||||
void testSucceed() throws SyntaxException, IOException {
|
||||
int ok = 0;
|
||||
int errors = 0;
|
||||
for (String q : readFromResource("pqf-must-succeed")) {
|
||||
|
@ -33,4 +38,27 @@ public class PQFParserTest extends ParserTest {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue