add tests

This commit is contained in:
Jörg Prante 2023-01-15 23:20:15 +01:00
parent f2a57d9ce3
commit 96ba70d4dc
4 changed files with 91 additions and 5 deletions

View file

@ -25,6 +25,7 @@ dependencyResolutionManagement {
library('groovy-macro', 'org.apache.groovy', 'groovy-macro').versionRef('groovy')
library('groovy-templates', 'org.apache.groovy', 'groovy-templates').versionRef('groovy')
library('groovy-test', 'org.apache.groovy', 'groovy-test').versionRef('groovy')
library('marc', 'org.xbib', 'marc').version('2.9.14')
}
}
}

View file

@ -112,3 +112,67 @@
245=Type-1 query: restriction ('resultAttr') operand not supported
246=Type-1 query: 'complex' attributeValue not supported
247=Type-1 query: 'attributeSet' as part of AttributeElement not supported
1001=Malformed APDU
1002=ES: EXTERNAL form of Item Order request not supported
1003=ES: Result set item form of Item Order request not supported
1004=ES: Extended services not supported unless access control is in effect
1005=Response records in Search response not supported
1006=Response records in Search response not possible for specified database (or database combination)
1007=No Explain server. Addinfo: pointers to servers that have a surrogate Explain database for this server
1008=ES: missing mandatory parameter for specified function. Addinfo: parameter
1009=ES: Item Order, unsupported OID in itemRequest. Addinfo: OID
1010=Init/AC: Bad Userid
1011=Init/AC: Bad Userid and/or Password
1012=Init/AC: No searches remaining (pre-purchased searches exhausted)
1013=Init/AC: Incorrect interface type (specified id valid only when used with a particular access method or client)
1014=Init/AC: Authentication System error
1015=Init/AC: Maximum number of simultaneous sessions for Userid
1016=Init/AC: Blocked network address
1017=Init/AC: No databases available for specified userId
1018=Init/AC: System temporarily out of resources
1019=Init/AC: System not available due to maintenance
1020=Init/AC: System temporarily unavailable (Addinfo: when it's expected back up)
1021=Init/AC: Account has expired
1022=Init/AC: Password has expired so a new one must be supplied
1023=Init/AC: Password has been changed by an administrator so a new one must be supplied
1024=Unsupported Attribute
1025=Service not supported for this database
1026=Record cannot be opened because it is locked
1027=SQL error
1028=Record deleted
1029=Scan: too many terms requested. Addinfo: max terms supported
1040=ES: Invalid function
1041=ES: Error in retention time
1042=ES: Permissions data not understood
1043=ES: Invalid OID for task specific parameters
1044=ES: Invalid action
1045=ES: Unknown schema
1046=ES: Too many records in package
1047=ES: Invalid wait action
1048=ES: Cannot create task package -- exceeds maximum permissible size
1049=ES: Cannot return task package -- exceeds maximum permissible size
1050=ES: Extended services request too large
1051=Scan: Attribute set id required -- not supplied
1052=ES: Cannot process task package record -- exceeds maximum permissible record size for ES
1053=ES: Cannot return task package record -- exceeds maximum permissible record size for ES response
1054=Init: Required negotiation record not included
1055=Init: negotiation option required
1056=Attribute not supported for database
1057=ES: Unsupported value of task package parameter
1058=Duplicate Detection: Cannot dedup on requested record portion
1059=Duplicate Detection: Requested detection criterion not supported
1060=Duplicate Detection: Requested level of match not supported
1061=Duplicate Detection: Requested regular expression not supported
1062=Duplicate Detection: Cannot do clustering
1063=Duplicate Detection: Retention criterion not supported
1064=Duplicate Detection: Requested number (or percentage) of entries
1065=Duplicate Detection: Requested sort criterion not supported
1066=CompSpec: Unknown schema, or schema not supported.
1067=Encapsulation: Encapsulated sequence of PDUs not supported
1068=Encapsulation: Base operation (and encapsulated PDUs) not executed based on pre-screening analysis
1069=No syntaxes available for this request
1070=user not authorized to receive record(s) in requested syntax
1071=preferredRecordSyntax not supplied
1072=Query term includes characters that do not translate into the target character set
1073=Database records do not contain data associated with access point
1074=Proxy failure

View file

@ -11,4 +11,5 @@ dependencies {
testImplementation libs.groovy.macro
testImplementation libs.groovy.templates
testImplementation libs.groovy.test
testImplementation libs.marc
}

View file

@ -3,12 +3,14 @@ package org.xbib.z3950.groovy
import groovy.util.logging.Log
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.xbib.marc.MarcRecord
import org.xbib.z3950.client.jdk.JDKZClient
import java.nio.charset.StandardCharsets
import java.util.logging.Level
@Log
@Disabled("internal test")
//@Disabled("internal test")
class LVITest {
@Test
@ -16,8 +18,21 @@ class LVITest {
String host = "localhost"
int port = 2100
String database = "lvi"
String query = "@attr 1=4 linux"
String preferredRecordSyntax = "xml"
//String query = "@attr 1=1 Schmidt" // OK!
//String query = "@attr 1=1 \"Schmidt, Heiner\"" // OK!
//String query = "@attr 1=2 test" // unsupported?
//String query = "@attr 1=3 test" // unsupported?
//String query = "@attr 1=4 linux"
//String query = "@attr 1=4 @attr 2=3 @attr 3=3 @attr 4=1 @attr 5=100 @attr 6=1 \"linux journal\"" // OK!
//String query = "@attr 1=7 \"0136142230\"" // ISBN OK!
//String query = "@attr 1=8 \"2251-6204\"" // ISSN OK!
//String query = "@attr 1=8 \"22516204\"" // ISSN OK!
//String query = "@attr 1=12 \"1016677359\"" // record ID OK!
//String query = "@attr 1=12 \"(DE-101)1016677359\"" // record ID plus prefix OK!
//String query = "@attr 1=12 \"(DE-600)2635378-7\"" // ZDB ID plus prefix NOT OK!
//String query = "@attr 1=1016 \"2020\"" // any OK!
//String query = "@attr 1=1052 12-7" // ZDB-ID OK!
String preferredRecordSyntax = "marc21"
int from = 1
int size = 1
JDKZClient client = JDKZClient.builder()
@ -25,12 +40,17 @@ class LVITest {
.setPort(port)
.setDatabases(Collections.singletonList(database))
.setPreferredRecordSyntax(preferredRecordSyntax)
.setElementSetName("F")
.build()
client.withCloseable {cl ->
cl.searchPQF(query, from, size,
(status, total, returned, elapsedMillis) -> log.log(Level.INFO, "total records = " + total),
record -> log.log(Level.INFO, "found record " + record),
record -> dump(MarcRecord.from(record.asStream(), StandardCharsets.UTF_8)),
() -> log.log(Level.WARNING, "timeout"))
}
}
static void dump(Iterable<MarcRecord> iterable) {
iterable.forEach {log.log(Level.INFO, it.toString()) }
}
}