add logging.properties

This commit is contained in:
Jörg Prante 2023-01-24 17:36:39 +01:00
parent 9e5d8e6775
commit 19f02c350d
3 changed files with 48 additions and 13 deletions

View file

@ -7,9 +7,28 @@ dependencies {
test {
useJUnitPlatform()
failFast = true
failFast = false
ignoreFailures = true
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',
'--add-opens=java.base/java.lang.reflect=ALL-UNNAMED',
'--add-opens=java.base/java.io=ALL-UNNAMED',
'--add-opens=java.base/java.nio=ALL-UNNAMED',
'--add-opens=java.base/java.util=ALL-UNNAMED'
systemProperty 'java.util.logging.config.file', 'src/test/resources/logging.properties'
systemProperty 'io.netty.tryReflectionSetAccessible', 'true'
testLogging {
events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED'
showStandardStreams = true
}
reports {
html.required = false
junitXml.outputLocation.set(layout.buildDirectory.dir("test-junit-xml"))
}
afterSuite { desc, result ->
if (!desc.parent) {
@ -20,5 +39,4 @@ test {
"${result.skippedTestCount} skipped"
}
}
jvmArgs '-Xmx2048m'
}

View file

@ -32,17 +32,23 @@ class DNBClientTest {
@Test
void testBibdatSimpleMetadataHandler() throws Exception {
OAIClient oaiClient = new OAIClient("http://services.dnb.de/oai/repository");
IdentifyResponse identifyResponse = oaiClient.identify();
String granularity = identifyResponse.getGranularity();
logger.log(Level.INFO, "granularity = " + granularity);
DateTimeFormatter dateTimeFormatter = "YYYY-MM-DD".equals(granularity) ?
DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.of("UTC")) : null;
Handler handler = new Handler();
oaiClient.listRecords("PicaPlus-xml", "bib",
dateTimeFormatter, Instant.parse("2016-01-01T00:00:00Z"), Instant.parse("2016-01-10T00:00:00Z"), null,
handler, null);
logger.log(Level.INFO, "count=" + handler.count());
assertTrue(handler.count() > 0);
oaiClient.setUserAgent("Hochschulbibliothekszentrum Nordrhein-Westfalen (prante@hbz-nrw.de)");
Instant base = Instant.parse("2010-01-01T00:00:00Z");
//IdentifyResponse identifyResponse = oaiClient.identify();
//String granularity = identifyResponse.getGranularity();
//logger.log(Level.INFO, "granularity = " + granularity);
//DateTimeFormatter dateTimeFormatter = "YYYY-MM-DD".equals(granularity) ?
// DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.of("UTC")) : null;
SplitWriter splitWriter = new SplitWriter("build/bibdat-test-%d.xml", -1, 8192, false);
oaiClient.setSplitWriter(splitWriter);
// Handler handler = new Handler();
oaiClient.listRecords("PicaPlus-xml", "bib", null,
Instant.parse("2016-01-01T00:00:00Z"),
Instant.parse("2016-02-01T00:00:00Z"),
base, null, null);
//logger.log(Level.INFO, "count=" + handler.count());
//assertTrue(handler.count() > 0);
}
static class Handler extends SimpleMetadataHandler {

View file

@ -0,0 +1,11 @@
handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
.level=ALL
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$-7s [%3$s] %5$s %6$s%n
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level=ALL
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.pattern=build/oai.log
jdk.event.security.level=INFO
jdk.internal.httpclient.hpack.debug.level=INFO
jdk.internal.httpclient.debug.level=INFO