test_sru tests against local yaz-test
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 8 Nov 2013 18:26:25 +0000 (19:26 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 8 Nov 2013 18:26:25 +0000 (19:26 +0100)
test/Makefile.am
test/sru-gbv.de.xml [deleted file]
test/sru_service.xml [new file with mode: 0644]
test/test_sru.cfg
test/test_sru.sh [changed mode: 0644->0755]
test/test_sru.urls
test/test_sru_1.res [new file with mode: 0644]
test/test_sru_2.res [new file with mode: 0644]
test/test_sru_3.res [new file with mode: 0644]

index 4bf29e0..329e4e3 100644 (file)
@@ -4,7 +4,7 @@
 solr_tests = test_solr.sh test_termlist_block.sh test_limit_limitmap.sh test_sort.sh
 check_SCRIPTS = test_http.sh test_icu.sh test_post.sh \
  test_settings.sh test_turbomarcxml.sh test_facets.sh \
- test_url.sh test_filter.sh test_tmarc.sh 
+ test_url.sh test_filter.sh test_tmarc.sh test_sru.sh
 
 EXTRA_DIST = run_pazpar2.sh marc21_test.xsl tmarc.xsl solr-pz2.xsl \
        z3950_indexdata_com_marc.xml \
@@ -32,6 +32,7 @@ EXTRA_DIST = run_pazpar2.sh marc21_test.xsl tmarc.xsl solr-pz2.xsl \
        test_limit_limitmap_settings_5.xml \
        ztest_localhost_settings.xml test_termlist_block_settings_2.xml \
        test_facets_settings_1.xml test_facets_settings_2.xml \
+       sru_service.xml \
        $(check_SCRIPTS)
 
 TESTS = $(check_SCRIPTS)
diff --git a/test/sru-gbv.de.xml b/test/sru-gbv.de.xml
deleted file mode 100644 (file)
index fa6459c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<settings target="gso.gbv.de/sru/DB=2.1">
-
-  <!-- Simple test against a local SRU server (could be yaz-ztest) -->
-
-  <set name="pz:sru" value="get"/> <!-- must be get, post or soap -->
-  <set name="pz:sru_version" value="1.1"/>
-  <set name="pz:name" value="GBV.DE"/>
-
-
-  <set name="pz:maxrecs" value="50"/>
-
-  <!-- mapping for unqualified search -->
-  <set name="pz:cclmap:term" value="u=cql.serverChoice t=l,r s=al"/>
-
-  <!-- field-specific mappings -->
-  <set name="pz:cclmap:ti" value="u=dc.title t=l,r s=al"/>
-  <set name="pz:cclmap:su" value="u=dc.subject s=al"/>
-  <set name="pz:cclmap:isbn" value="u=bath.isbn"/>
-  <set name="pz:cclmap:issn" value="u=bath.issn"/>
-  <set name="pz:cclmap:date" value="u=dc.date r=r"/>
-
-  <!-- Retrieval settings -->
-
-  <set name="pz:elements" value="dc"/>
-
-  <!-- Result normalization settings -->
-
-  <set name="pz:nativesyntax" value="xml"/>
-  <set name="pz:xslt" value="dc.xsl"/>
-
-</settings>
diff --git a/test/sru_service.xml b/test/sru_service.xml
new file mode 100644 (file)
index 0000000..f09e969
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<service id="sru">
+  <rank debug="no"/>
+  <settings target="localhost:9999/db1">
+    <set name="pz:name"  value="db1" />
+    <set name="pz:sru" value="get"/>
+    <set name="pz:url"   value="localhost:9999/db1" />
+    <set name="pz:nativesyntax" value="xml" />
+    <set name="pz:xslt" value="marc21_test.xsl" />
+    <set name="pz:authentication" value="a/b"/>
+    <set name="pz:authentication_mode" value="url"/>
+  </settings>
+  <metadata name="url" merge="unique"/>
+  <metadata name="title" brief="yes" sortkey="skiparticle" merge="longest" rank="6"/>
+  <metadata name="title-remainder" brief="yes" merge="longest" rank="5"/>
+  <metadata name="isbn"/>
+  <metadata name="date" brief="yes" sortkey="numeric" type="year" merge="range"
+           termlist="yes"/>
+  <metadata name="author" brief="yes" termlist="yes" merge="longest" rank="2"/>
+  <metadata name="subject" merge="unique" termlist="yes" rank="3"/>
+  <metadata name="id"/>
+</service>
index 3b4413e..326ae2a 100644 (file)
@@ -3,33 +3,9 @@
   <!-- Used by test_sru.sh -->
   <server>
     <listen port="9763"/>
-    <proxy host="localhost"/>
-    
-    <service>
-      <include src="gbv-sru-marc.xml"/>
-      <metadata name="url" merge="unique"/>
-      <metadata name="title" brief="yes" sortkey="skiparticle" merge="longest" rank="6" mergekey="required" />
-      <metadata name="title-remainder" brief="yes" merge="longest" rank="5"/>
-      <metadata name="isbn"/>
-      <metadata name="date" brief="yes" sortkey="numeric" type="year" merge="range"
-               termlist="yes"/>
-      <metadata name="author" brief="yes" termlist="yes" merge="longest" rank="2" mergekey="optional" />
-      <metadata name="subject" merge="unique" termlist="yes" rank="3"/>
-      <metadata name="id"/>
-      <metadata name="lccn" merge="unique"/>
-      <metadata name="description" brief="yes" merge="longest" rank="3"/>
-      
-      <metadata name="test-usersetting" brief="yes" setting="postproc"/>
-      <metadata name="test" setting="parameter"/>
-      <metadata name="test-usersetting-2" brief="yes"/>
-    </service>
+  </server>
 
-    <include src="*_service.xml"/> 
-    <include src="no_such_service.xml"/>
 
-  </server>
-  
-  
 </pazpar2>
 <!-- Keep this comment at the end of the file
      Local variables:
old mode 100644 (file)
new mode 100755 (executable)
index 9bc98bf..ff745df
@@ -1,24 +1,50 @@
 #!/bin/sh
+#
 
 # srcdir might be set by make
 srcdir=${srcdir:-"."}
 
-#TODO set up solr target. For now use donut 
-#F=../solr/client.sh 
-#
-#rm -f solr.pid
-#$F -l solr.log -p ztest.pid -D @:9999
-#sleep 1
-#if test ! -f ztest.pid; then
-#    echo "yaz-ztest could not be started"
-#    exit 0
-#fi
-
-${srcdir}/run_pazpar2.sh test_sru
-E=$?
-
-#kill `cat ztest.pid`
-#rm ztest.pid
+TEST=`basename $0 .sh`
+
+# look for yaz-ztest in PATH
+oIFS=$IFS
+IFS=:
+F=''
+for p in $PATH; do
+    if test -x $p/yaz-ztest -a -x $p/yaz-client; then
+       VERSION=`$p/yaz-client -V|awk '{print $3;}'|awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
+        if test $VERSION -ge 4000000; then
+            F=$p/yaz-ztest
+            break
+        fi
+    fi
+done
+IFS=$oIFS
+
+if test -z "$F"; then
+    echo "yaz-ztest not found"
+    exit 0
+fi
+
+rm -f ztest.pid
+rm -f ${TEST}_ztest.log
+$F -l ${TEST}_ztest.log -p ztest.pid -D tcp:localhost:9999
+sleep 1
+if test ! -f ztest.pid; then
+    echo "yaz-ztest could not be started"
+    exit 0
+fi
+
+E=0
+if test -x ../src/pazpar2; then
+    if ../src/pazpar2 -V |grep icu:enabled >/dev/null; then
+       ${srcdir}/run_pazpar2.sh $TEST
+       E=$?
+    fi
+fi
+
+kill `cat ztest.pid`
+rm ztest.pid
 exit $E
 
 # Local Variables:
index d10ee84..295c6ea 100644 (file)
@@ -1,5 +1,3 @@
-http://localhost:9763/search.pz2?command=init&clear=1
-http://localhost:9763/search.pz2?session=1&command=settings&pz:sru%5Bgso.gbv.de%2Fsru%2FDB%5D=get&pz%3Aname%5Bgso.gbv.de%2Fsru%2FDB%5D=SOLR+Test&pz%3Acclmap%3Ati%5Bgso.gbv.de%2Fsru%2FDB%5D=1%3Dtitle&pz%3Acclmap%3Asu%5Bgso.gbv.de%2Fsru%2FDB%5D=1%3Dsubject&pz%3Acclmap%3Aau%5Bgso.gbv.de%2Fsru%2FDB%5D=1%3Dauthor&pz%3Acclmap%3Aisbn%5Bgso.gbv.de%2Fsru%2FDB%5D=1%3Disbn&pz%3Acclmap%3Aterm%5Bgso.gbv.de%2Fsru%2FDB%5D=1%3Dtitle&pz%3Axslt%5Bgso.gbv.de%2Fsru%2FDB%5D=solr-pz2.xsl&pz%3Aqueryencoding%5Bgso.gbv.de%2Fsru%2FDB%5D=UTF-8&pz%3Aapdulog%5Bgso.gbv.de%2Fsru%2FDB%5D=1&pz%3Asru_version%5Bgso.gbv.de%2Fsru%2FDB%5D=1.1
-http://localhost:9763/search.pz2?session=1&command=search&query=cql:man
-4 http://localhost:9763/search.pz2?session=1&command=show&block=1
-
+sru_service.xml http://localhost:9763/search.pz2?command=init&service=sru
+http://localhost:9763/search.pz2?session=1&command=search&query=computer
+http://localhost:9763/search.pz2?session=1&command=show
diff --git a/test/test_sru_1.res b/test/test_sru_1.res
new file mode 100644 (file)
index 0000000..c09ee34
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<init><status>OK</status><session>1</session><protocol>1</protocol><keepAlive>50000</keepAlive>
+</init>
\ No newline at end of file
diff --git a/test/test_sru_2.res b/test/test_sru_2.res
new file mode 100644 (file)
index 0000000..ab63fe6
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<search><status>OK</status></search>
\ No newline at end of file
diff --git a/test/test_sru_3.res b/test/test_sru_3.res
new file mode 100644 (file)
index 0000000..11b875c
--- /dev/null
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<show><status>OK</status>
+<activeclients>0</activeclients>
+<merged>22</merged>
+<total>23</total>
+<start>0</start>
+<num>20</num>
+<hit>
+ <md-title>Internet world</md-title>
+ <md-date>1992</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="2093092631">
+  <md-title>Internet world</md-title>
+  <md-date>1992</md-date>
+ </location>
+ <count>1</count>
+ <relevance>312063</relevance>
+ <recid>content: title internet world author medium book</recid>
+</hit>
+<hit>
+ <md-title>How to program a computer</md-title>
+ <md-author>Jack Collins</md-author>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="4195168235">
+  <md-title>How to program a computer</md-title>
+  <md-author>Jack Collins</md-author>
+ </location>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="75373906">
+  <md-title>How to program a computer</md-title>
+  <md-author>Jack Collins</md-author>
+ </location>
+ <count>2</count>
+ <relevance>187238</relevance>
+ <recid>content: title how to program a computer author jack collins medium book</recid>
+</hit>
+<hit>
+ <md-title>Computer science &amp; technology</md-title>
+ <md-title-remainder>proceedings of a workshop held at the National Bureau of Standards, Gaithersburg, MD, June 3-4, 1976</md-title-remainder>
+ <md-date>1977</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="3319303400">
+  <md-title>Computer science &amp; technology</md-title>
+  <md-title-remainder>proceedings of a workshop held at the National Bureau of Standards, Gaithersburg, MD, June 3-4, 1976</md-title-remainder>
+  <md-date>1977</md-date>
+ </location>
+ <count>1</count>
+ <relevance>156031</relevance>
+ <recid>content: title computer science technology author medium book</recid>
+</hit>
+<hit>
+ <md-title>The Computer Bible</md-title>
+ <md-date>1973-1980</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="3844822301">
+  <md-title>The Computer Bible</md-title>
+  <md-date>1973-1980</md-date>
+ </location>
+ <count>1</count>
+ <relevance>156031</relevance>
+ <recid>content: title the computer bible author medium book</recid>
+</hit>
+<hit>
+ <md-title>Internet</md-title>
+ <md-title-remainder>mailing lists</md-title-remainder>
+ <md-date>1993</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="1567573730">
+  <md-title>Internet</md-title>
+  <md-title-remainder>mailing lists</md-title-remainder>
+  <md-date>1993</md-date>
+ </location>
+ <count>1</count>
+ <relevance>78015</relevance>
+ <recid>content: title internet author medium book</recid>
+</hit>
+<hit>
+ <md-title>A plan for community college computer development</md-title>
+ <md-date>1971</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="2793784499">
+  <md-title>A plan for community college computer development</md-title>
+  <md-date>1971</md-date>
+ </location>
+ <count>1</count>
+ <relevance>66870</relevance>
+ <recid>content: title a plan for community college computer development author medium book</recid>
+</hit>
+<hit>
+ <md-title>Washington metropolitan area rail computer feasibility study;</md-title>
+ <md-title-remainder>final report</md-title-remainder>
+ <md-date>1971</md-date>
+ <md-author>Englund, Carl R</md-author>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="2968957466">
+  <md-title>Washington metropolitan area rail computer feasibility study;</md-title>
+  <md-title-remainder>final report</md-title-remainder>
+  <md-date>1971</md-date>
+  <md-author>Englund, Carl R</md-author>
+ </location>
+ <count>1</count>
+ <relevance>66870</relevance>
+ <recid>content: title washington metropolitan area rail computer feasibility study author englund carl r medium book</recid>
+</hit>
+<hit>
+ <md-title>The Puget Sound Region</md-title>
+ <md-title-remainder>a portfolio of thematic computer maps</md-title-remainder>
+ <md-date>1974</md-date>
+ <md-author>Mairs, John W</md-author>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="3669649334">
+  <md-title>The Puget Sound Region</md-title>
+  <md-title-remainder>a portfolio of thematic computer maps</md-title-remainder>
+  <md-date>1974</md-date>
+  <md-author>Mairs, John W</md-author>
+ </location>
+ <count>1</count>
+ <relevance>65013</relevance>
+ <recid>content: title the puget sound region author mairs john w medium book</recid>
+</hit>
+<hit>
+ <md-title>Computer processing of dynamic images from an Anger scintillation camera</md-title>
+ <md-title-remainder>the proceedings of a workshop</md-title-remainder>
+ <md-date>1974</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="4019995268">
+  <md-title>Computer processing of dynamic images from an Anger scintillation camera</md-title>
+  <md-title-remainder>the proceedings of a workshop</md-title-remainder>
+  <md-date>1974</md-date>
+ </location>
+ <count>1</count>
+ <relevance>46809</relevance>
+ <recid>content: title computer processing of dynamic images from an anger scintillation camera author medium book</recid>
+</hit>
+<hit>
+ <md-title>The use of passwords for controlled access to computer resources</md-title>
+ <md-date>1977</md-date>
+ <md-author>Wood, Helen M</md-author>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="3144130433">
+  <md-title>The use of passwords for controlled access to computer resources</md-title>
+  <md-date>1977</md-date>
+  <md-author>Wood, Helen M</md-author>
+ </location>
+ <count>1</count>
+ <relevance>46809</relevance>
+ <recid>content: title the use of passwords for controlled access to computer resources author wood helen m medium book</recid>
+</hit>
+<hit>
+ <md-title>Check this out</md-title>
+ <md-title-remainder>library program models</md-title-remainder>
+ <md-date>1987</md-date>
+ <md-author>Seager, Andrew J</md-author>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="1217227796">
+  <md-title>Check this out</md-title>
+  <md-title-remainder>library program models</md-title-remainder>
+  <md-date>1987</md-date>
+  <md-author>Seager, Andrew J</md-author>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <recid>content: title check this out author seager andrew j medium book</recid>
+</hit>
+<hit>
+ <md-title>Dealing with dropouts</md-title>
+ <md-title-remainder>the urban superintendents&apos; call to action</md-title-remainder>
+ <md-date>1987</md-date>
+ <md-author>Paulu, Nancy</md-author>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="866881862">
+  <md-title>Dealing with dropouts</md-title>
+  <md-title-remainder>the urban superintendents&apos; call to action</md-title-remainder>
+  <md-date>1987</md-date>
+  <md-author>Paulu, Nancy</md-author>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <recid>content: title dealing with dropouts author paulu nancy medium</recid>
+</hit>
+<hit>
+ <md-title>Deuteronomy</md-title>
+ <md-date>1968</md-date>
+ <md-author>Oberst, Bruce</md-author>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="2618611532">
+  <md-title>Deuteronomy</md-title>
+  <md-date>1968</md-date>
+  <md-author>Oberst, Bruce</md-author>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <recid>content: title deuteronomy author oberst bruce medium book</recid>
+</hit>
+<hit>
+ <md-title>FEDLINK services directory for fiscal year</md-title>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="1042054829">
+  <md-title>FEDLINK services directory for fiscal year</md-title>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <recid>content: title fedlink services directory for fiscal year author medium book</recid>
+</hit>
+<hit>
+ <md-title>Four psalms</md-title>
+ <md-title-remainder>XXIII, XXXVI, LII, CXXI</md-title-remainder>
+ <md-date>1980</md-date>
+ <md-author>Smith, George Adam</md-author>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="2268265598">
+  <md-title>Four psalms</md-title>
+  <md-title-remainder>XXIII, XXXVI, LII, CXXI</md-title-remainder>
+  <md-date>1980</md-date>
+  <md-author>Smith, George Adam</md-author>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <recid>content: title four psalms author smith george adam medium book</recid>
+</hit>
+<hit>
+ <md-title>Info Canada</md-title>
+ <md-date>1991</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="1917919664">
+  <md-title>Info Canada</md-title>
+  <md-date>1991</md-date>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <recid>content: title info canada author medium book</recid>
+</hit>
+<hit>
+ <md-title>National dissemination model for the I&apos;M SPECIAL Program of Physical Education for the Handicapped, 1983-1986</md-title>
+ <md-title-remainder>final report, I&apos;M SPECIAL network</md-title-remainder>
+ <md-date>1986</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="691708895">
+  <md-title>National dissemination model for the I&apos;M SPECIAL Program of Physical Education for the Handicapped, 1983-1986</md-title>
+  <md-title-remainder>final report, I&apos;M SPECIAL network</md-title-remainder>
+  <md-date>1986</md-date>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <recid>content: title national dissemination model for the i m special program of physical education for the handicapped author medium</recid>
+</hit>
+<hit>
+ <md-title>NDN, sharing success to improve schools</md-title>
+ <md-date>1991</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="516535928">
+  <md-title>NDN, sharing success to improve schools</md-title>
+  <md-date>1991</md-date>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <recid>content: title ndn sharing success to improve schools author medium book</recid>
+</hit>
+<hit>
+ <md-title>Reconstruction tomography in diagnostic radiology and nuclear medicine</md-title>
+ <md-title-remainder>proceedings of the workshop</md-title-remainder>
+ <md-date>1977</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="3494476367">
+  <md-title>Reconstruction tomography in diagnostic radiology and nuclear medicine</md-title>
+  <md-title-remainder>proceedings of the workshop</md-title-remainder>
+  <md-date>1977</md-date>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <recid>content: title reconstruction tomography in diagnostic radiology and nuclear medicine author medium book</recid>
+</hit>
+<hit>
+ <md-title>Technology programs that work</md-title>
+ <md-date>1984</md-date>
+ <location id="localhost:9999/db1"
+    name="db1" checksum="1392400763">
+  <md-title>Technology programs that work</md-title>
+  <md-date>1984</md-date>
+ </location>
+ <count>1</count>
+ <relevance>0</relevance>
+ <recid>content: title technology programs that work author medium book</recid>
+</hit>
+</show>
\ No newline at end of file