fixes for tests and logging

This commit is contained in:
Jörg Prante 2019-03-15 14:32:29 +01:00
parent b2df8b14ba
commit 03df23e89c
8 changed files with 22 additions and 10 deletions

View file

@ -26,7 +26,6 @@ subprojects {
apply plugin: 'pmd'
apply plugin: "com.github.spotbugs"
configurations {
wagon
}

View file

@ -1,9 +1,9 @@
package org.xbib.z3950.common;
package org.xbib.z3950.client.test;
import org.junit.Test;
import org.xbib.z3950.common.exceptions.MessageSizeTooSmallException;
import org.xbib.z3950.common.exceptions.NoRecordsReturnedException;
import org.xbib.z3950.common.DefaultClient;
import org.xbib.z3950.client.DefaultClient;
import java.util.Collections;
import java.util.logging.Level;
@ -22,7 +22,8 @@ public class SearchTest {
int port = 210;
String database = "COPAC";
String query = "@attr 1=1 smith";
String preferredRecordSyntax = "1.2.840.10003.5.109.10"; // xml // "1.2.840.10003.5.10"; // MARC
// "1.2.840.10003.5.10"; // MARC
String preferredRecordSyntax = "1.2.840.10003.5.109.10"; // xml
int from = 1;
int length = 1;
try {

View file

@ -0,0 +1,5 @@
handlers = java.util.logging.ConsoleHandler
.level = ALL
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format = %1$tFT%1$tT.%1$tL%1$tz [%4$-11s] [%3$s] %5$s %6$s%n

View file

@ -5,22 +5,25 @@ import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.ResourceBundle;
import java.util.logging.Logger;
/**
*
*/
public class Bib1Test {
private static final Logger logger = Logger.getLogger(Bib1Test.class.getName());
@Test
public void testBibUse() {
ResourceBundle bundle = ResourceBundle.getBundle("org.xbib.io.iso23950.bib-1");
ResourceBundle bundle = ResourceBundle.getBundle("org.xbib.z3950.common.bib-1");
ArrayList<String> values = new ArrayList<>();
for (String key : bundle.keySet()) {
values.add(bundle.getString(key) + "=" + key);
}
Collections.sort(values);
for (Object v : values) {
//logger.info(v.toString());
logger.info(v.toString());
}
}
}

View file

@ -25,7 +25,7 @@ public abstract class ParserTest extends Assert {
protected Iterable<String> readFromResource(String path)
throws IOException {
final ArrayList<String> lines = new ArrayList<>();
InputStream in = getClass().getClassLoader().getResourceAsStream(path);
InputStream in = getClass().getResourceAsStream(path);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = br.readLine()) != null) {

View file

@ -2,7 +2,6 @@ package org.xbib.z3950.common.cql;
import org.junit.Test;
import org.xbib.cql.CQLParser;
import org.xbib.z3950.common.cql.CQLRPNGenerator;
/**
*

View file

@ -19,7 +19,7 @@ public class PQFParserTest extends ParserTest {
public void testSucceed() throws SyntaxException, IOException {
int ok = 0;
int errors = 0;
for (String q : readFromResource("org/xbib/io/iso23950/pqf/pqf-must-succeed")) {
for (String q : readFromResource("pqf-must-succeed")) {
PQFParser parser = new PQFParser(new StringReader(q));
try {
parser.parse();

View file

@ -0,0 +1,5 @@
handlers = java.util.logging.ConsoleHandler
.level = ALL
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format = %1$tFT%1$tT.%1$tL%1$tz [%4$-11s] [%3$s] %5$s %6$s%n