Test case for setting overrides
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 14 Oct 2009 14:32:24 +0000 (16:32 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 14 Oct 2009 14:32:24 +0000 (16:32 +0200)
test/Makefile.am
test/set2/1.xml [new file with mode: 0644]
test/set2/2.xml [new file with mode: 0644]
test/set2/3.xml [new file with mode: 0644]
test/test_settings.cfg [new file with mode: 0644]
test/test_settings.sh [new file with mode: 0755]
test/test_settings_1.res [new file with mode: 0644]
test/test_settings_2.res [new file with mode: 0644]
test/test_settings_3.res [new file with mode: 0644]
test/test_settings_urls [new file with mode: 0644]

index 94bf11c..d026ca3 100644 (file)
@@ -1,10 +1,13 @@
 # This file is part of Pazpar2.
-check_SCRIPTS = test_http.sh test_icu.sh test_post.sh
+check_SCRIPTS = test_http.sh test_icu.sh test_post.sh test_settings.sh
 
 EXTRA_DIST = run_pazpar2.sh marc21.xsl z3950_indexdata_com_marc.xml \
        gils_service.xml marc_service.xml marc21.mmap \
-       test_http.cfg test_http_urls test_icu.cfg test_icu_urls \
-       test_post.cfg test_post_urls $(check_SCRIPTS)
+       test_http.cfg test_http_urls \
+       test_icu.cfg test_icu_urls \
+       test_post.cfg test_post_urls \
+       test_settings.cfg test_settings_urls \
+       $(check_SCRIPTS)
 
 TESTS = $(check_SCRIPTS)
 
@@ -16,4 +19,6 @@ dist-hook:
        cp ${srcdir}/test_http_*.res $(distdir)
        cp ${srcdir}/test_icu_*.res $(distdir)
        cp ${srcdir}/test_post_*.res $(distdir)
-
+       cp ${srcdir}/test_settings_*.res $(distdir)
+       mkdir $(distdir)/set2
+       cp ${srcdir}/set2/*.xml $(distdir)/set2
diff --git a/test/set2/1.xml b/test/set2/1.xml
new file mode 100644 (file)
index 0000000..fed01f4
--- /dev/null
@@ -0,0 +1,6 @@
+<settings target="*">
+  <set name="pz:elements" value="F"/> 
+  <set precedence="10" name="pz:cclmap:term" value="u=host_wildcard"/>
+  <set name="pz:requestsyntax" value="sutrs"/>
+</settings>
diff --git a/test/set2/2.xml b/test/set2/2.xml
new file mode 100644 (file)
index 0000000..c2ea92f
--- /dev/null
@@ -0,0 +1,7 @@
+<settings target="z3950.indexdata.com/*">
+  <set name="pz:elements" value="F"/> 
+  <set name="pz:cclmap:term" value="u=db_wildcard"/>
+  <set name="pz:requestsyntax" value="marc21"/>
+
+</settings>
diff --git a/test/set2/3.xml b/test/set2/3.xml
new file mode 100644 (file)
index 0000000..ad047e6
--- /dev/null
@@ -0,0 +1,5 @@
+<settings target="z3950.indexdata.com/marc">
+  <set name="pz:name" value="Target name"/>
+  <set name="pz:elements" value="F"/> 
+  <set name="pz:cclmap:term" value="u=1016"/>
+</settings>
diff --git a/test/test_settings.cfg b/test/test_settings.cfg
new file mode 100644 (file)
index 0000000..cacd2c1
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pazpar2 xmlns="http://www.indexdata.com/pazpar2/1.0">
+  
+  <server>
+    <listen port="9763"/>
+    <settings src="set2"/>
+
+    <service>
+      <!-- we try to keep same order as in marc21.xsl -->
+      <metadata name="id" brief="yes"/>
+      <metadata name="lccn" merge="unique"/>
+      <metadata name="author" brief="yes" termlist="yes" merge="unique" rank="2"/>
+      <metadata name="title" brief="yes" sortkey="skiparticle"
+               merge="longest" rank="6"/>
+    </service>
+  </server>
+  
+</pazpar2>
+<!-- Keep this comment at the end of the file
+     Local variables:
+     mode: nxml
+     End:
+-->
+
diff --git a/test/test_settings.sh b/test/test_settings.sh
new file mode 100755 (executable)
index 0000000..ce6b03a
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+
+# srcdir might be set by make
+srcdir=${srcdir:-"."}
+
+# Test using test_http.cfg
+exec ${srcdir}/run_pazpar2.sh test_settings
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation: 2
+# sh-basic-offset: 4
+# End:
diff --git a/test/test_settings_1.res b/test/test_settings_1.res
new file mode 100644 (file)
index 0000000..81ff9ff
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<init><status>OK</status><session>1</session><protocol>1</protocol></init>
\ No newline at end of file
diff --git a/test/test_settings_2.res b/test/test_settings_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_settings_3.res b/test/test_settings_3.res
new file mode 100644 (file)
index 0000000..b530805
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bytarget><status>OK</status>
+<target><id>z3950.indexdata.com/marc</id>
+<name>Target name</name>
+<hits>0</hits>
+<diagnostic>0</diagnostic>
+<records>0</records>
+<state>Client_Idle</state>
+<settings>
+<set name="pz:elements" value="F"/>
+<set name="pz:requestsyntax" value="marc21"/>
+<set name="pz:cclmap:term" value="u=host_wildcard"/>
+<set name="pz:id" value="z3950.indexdata.com/marc"/>
+<set name="pz:name" value="Target name"/>
+</settings>
+</target></bytarget>
\ No newline at end of file
diff --git a/test/test_settings_urls b/test/test_settings_urls
new file mode 100644 (file)
index 0000000..cc990c1
--- /dev/null
@@ -0,0 +1,4 @@
+http://localhost:9763/search.pz2?session=1&command=init
+http://localhost:9763/search.pz2?session=1&command=search&query=water
+2
+http://localhost:9763/search.pz2?session=1&command=bytarget&settings=1