View | Details | Raw Unified | Return to bug 13937
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Z3950Responder/GenericSession.t (-5 / +7 lines)
Lines 7-12 use Test::WWW::Mechanize; Link Here
7
use t::lib::Mocks qw(mock_preference);
7
use t::lib::Mocks qw(mock_preference);
8
8
9
use File::Basename;
9
use File::Basename;
10
use File::Copy;
11
use FindBin qw($Bin);
10
use XML::LibXML;
12
use XML::LibXML;
11
use YAML;
13
use YAML;
12
use ZOOM;
14
use ZOOM;
Lines 80-86 subtest 'test_search' => sub { Link Here
80
82
81
    $child = fork();
83
    $child = fork();
82
    if ($child == 0) {
84
    if ($child == 0) {
83
        my $config_dir = dirname(__FILE__) . '/';
85
        my $config_dir = $Bin . '/';
84
        my $z = Koha::Z3950Responder->new( {
86
        my $z = Koha::Z3950Responder->new( {
85
            config_dir => $config_dir
87
            config_dir => $config_dir
86
        });
88
        });
Lines 116-136 subtest 'test_search' => sub { Link Here
116
118
117
    # SRU protocol tests
119
    # SRU protocol tests
118
    my $base = 'http://localhost:42111';
120
    my $base = 'http://localhost:42111';
119
    my $ns = 'http://docs.oasis-open.org/ns/search-ws/sruResponse';
121
    my $ns = 'http://www.loc.gov/zing/srw/';
120
    my $marc_ns = 'http://www.loc.gov/MARC21/slim';
122
    my $marc_ns = 'http://www.loc.gov/MARC21/slim';
121
    my $agent = Test::WWW::Mechanize->new( autocheck => 1 );
123
    my $agent = Test::WWW::Mechanize->new( autocheck => 1 );
122
124
123
    $agent->get_ok("$base", 'Retrieve explain response');
125
    $agent->get_ok("$base?version=1.1", 'Retrieve explain response');
124
    my $dom = XML::LibXML->load_xml(string => $agent->content());
126
    my $dom = XML::LibXML->load_xml(string => $agent->content());
125
    my @nodes = $dom->getElementsByTagNameNS($ns, 'explainResponse');
127
    my @nodes = $dom->getElementsByTagNameNS($ns, 'explainResponse');
126
    is(scalar(@nodes), 1, 'explainResponse returned');
128
    is(scalar(@nodes), 1, 'explainResponse returned');
127
129
128
    $agent->get_ok("$base/biblios?operation=searchRetrieve&recordSchema=marcxml&maximumRecords=10&query=", 'Try bad search query');
130
    $agent->get_ok("$base/biblios?operation=searchRetrieve&recordSchema=marcxml&version=1.1&maximumRecords=10&query=", 'Try bad search query');
129
    $dom = XML::LibXML->load_xml(string => $agent->content());
131
    $dom = XML::LibXML->load_xml(string => $agent->content());
130
    @nodes = $dom->getElementsByTagNameNS($ns, 'diagnostics');
132
    @nodes = $dom->getElementsByTagNameNS($ns, 'diagnostics');
131
    is(scalar(@nodes), 1, 'diagnostics returned for bad query');
133
    is(scalar(@nodes), 1, 'diagnostics returned for bad query');
132
134
133
    $agent->get_ok("$base/biblios?operation=searchRetrieve&recordSchema=marcxml&maximumRecords=10&query=(dc.author%3dauthor AND (dc.title%3d\"title(s)\" OR dc.title%3danother))", 'Retrieve search results');
135
    $agent->get_ok("$base/biblios?operation=searchRetrieve&recordSchema=marcxml&version=1.1&maximumRecords=10&query=(dc.author%3dauthor AND (dc.title%3d\"title(s)\" OR dc.title%3danother))", 'Retrieve search results');
134
    $dom = XML::LibXML->load_xml(string => $agent->content());
136
    $dom = XML::LibXML->load_xml(string => $agent->content());
135
    @nodes = $dom->getElementsByTagNameNS($ns, 'searchRetrieveResponse');
137
    @nodes = $dom->getElementsByTagNameNS($ns, 'searchRetrieveResponse');
136
    is(scalar(@nodes), 1, 'searchRetrieveResponse returned');
138
    is(scalar(@nodes), 1, 'searchRetrieveResponse returned');
(-)a/t/db_dependent/Koha/Z3950Responder/Session2.t (-1 / +7 lines)
Lines 5-10 use Test::More tests => 3; Link Here
5
use t::lib::TestBuilder;
5
use t::lib::TestBuilder;
6
use C4::Items;
6
use C4::Items;
7
7
8
use Koha::Caches;
9
8
BEGIN {
10
BEGIN {
9
    use_ok('Koha::Z3950Responder');
11
    use_ok('Koha::Z3950Responder');
10
    use_ok('Koha::Z3950Responder::Session');
12
    use_ok('Koha::Z3950Responder::Session');
Lines 20-26 subtest 'add_item_status' => sub { Link Here
20
    plan tests => 2;
22
    plan tests => 2;
21
23
22
    # This time we are sustituting some values
24
    # This time we are sustituting some values
23
    $builder->schema->resultset( 'AuthorisedValue' )->delete_all;
25
    $builder->schema->resultset( 'AuthorisedValue' )->delete_all();
24
    $builder->build({
26
    $builder->build({
25
        source => 'AuthorisedValue',
27
        source => 'AuthorisedValue',
26
        value => {
28
        value => {
Lines 37-42 subtest 'add_item_status' => sub { Link Here
37
            lib => "Borked completely"
39
            lib => "Borked completely"
38
        }
40
        }
39
    });
41
    });
42
    
43
    # Clear the cache to make sure the above values take effect
44
    my $cache = Koha::Caches->get_instance();
45
    $cache->flush_all();
40
46
41
    ## FIRST ITEM HAS ALL THE STATUSES ##
47
    ## FIRST ITEM HAS ALL THE STATUSES ##
42
    my $item_1 = $builder->build({
48
    my $item_1 = $builder->build({
(-)a/t/db_dependent/Koha/Z3950Responder/config.xml (-1 / +1 lines)
Lines 1-7 Link Here
1
<yazgfs>
1
<yazgfs>
2
  <listen id="public">tcp:localhost:42111</listen>
2
  <listen id="public">tcp:localhost:42111</listen>
3
  <server>
3
  <server>
4
    <cql2rpn>../../../../etc/z3950/pqf.properties</cql2rpn>
4
    <cql2rpn>pqf.properties</cql2rpn>
5
    <explain xmlns="http://explain.z3950.org/dtd/2.0/">
5
    <explain xmlns="http://explain.z3950.org/dtd/2.0/">
6
      <retrievalinfo>
6
      <retrievalinfo>
7
        <retrieval syntax="usmarc" name="marc21"/>
7
        <retrieval syntax="usmarc" name="marc21"/>
(-)a/t/db_dependent/Koha/Z3950Responder/pqf.properties (-1 / +162 lines)
Line 0 Link Here
0
- 
1
#
2
# Propeties file to drive org.z3950.zing.cql.CQLNode's toPQF()
3
# back-end and the YAZ CQL-to-PQF converter.  This specifies the
4
# interpretation of various CQL indexes, relations, etc. in terms
5
# of Type-1 query attributes.
6
#
7
# This configuration file generates queries using BIB-1 attributes.
8
# See http://www.loc.gov/z3950/agency/zing/cql/dc-indexes.html
9
# for the Maintenance Agency's work-in-progress mapping of Dublin Core
10
# indexes to Attribute Architecture (util, XD and BIB-2)
11
# attributes.
12
13
# Identifiers for prefixes used in this file. (index.*)
14
set.cql     = info:srw/cql-context-set/1/cql-v1.1
15
set.rec     = info:srw/cql-context-set/2/rec-1.0
16
set.dc      = info:srw/cql-context-set/1/dc-v1.1
17
set.bath    = http://zing.z3950.org/cql/bath/2.0/
18
19
# default set (in query)
20
set     = info:srw/cql-context-set/1/dc-v1.1
21
22
# The default access point and result-set references
23
index.cql.serverChoice = 1=1016
24
    # srw.serverChoice is deprecated in favour of cql.serverChoice
25
    # BIB-1 "any"
26
27
index.rec.id                = 1=12
28
index.dc.identifier         = 1=1007
29
index.dc.title              = 1=4
30
index.dc.subject            = 1=21
31
index.dc.creator            = 1=1003
32
index.dc.author             = 1=1003
33
index.dc.itemtype           = 1=1031
34
index.dc.barcode            = 1=1028
35
index.dc.branch             = 1=1033
36
index.dc.isbn               = 1=7
37
index.dc.issn               = 1=8
38
index.dc.any                = 1=1016
39
index.dc.note               = 1=63
40
41
# personal name experimental
42
index.dc.pname  = 1=1
43
    ### Unofficial synonym for "creator"
44
index.dc.editor             = 1=1020
45
index.dc.publisher          = 1=1018
46
index.dc.description        = 1=62
47
    # "abstract"
48
index.dc.date               = 1=30
49
index.dc.resourceType       = 1=1031
50
    # guesswork: "Material-type"
51
index.dc.format             = 1=1034
52
    # guesswork: "Content-type"
53
index.dc.resourceIdentifier = 1=12
54
    # "Local number"
55
#index.dc.source                = 1=1019
56
    # "Record-source"
57
index.dc.language           = 1=54
58
    # "Code--language"
59
60
index.dc.Place-publication  = 1=59
61
    # "Place-publication"
62
63
#index.dc.relation           = 1=?
64
    ### No idea how to represent this
65
#index.dc.coverage           = 1=?
66
    ### No idea how to represent this
67
#index.dc.rights             = 1=?
68
    ### No idea how to represent this
69
70
# Relation attributes are selected according to the CQL relation by
71
# looking up the "relation.<relation>" property:
72
#
73
relation.<                  = 2=1
74
relation.le                 = 2=2
75
relation.eq                 = 2=3
76
relation.exact              = 2=3
77
relation.ge                 = 2=4
78
relation.>                  = 2=5
79
relation.<>                 = 2=6
80
81
### These two are not really right:
82
relation.all                = 2=3
83
relation.any                = 2=3
84
85
# BIB-1 doesn't have a server choice relation, so we just make the
86
# choice here, and use equality (which is clearly correct).
87
relation.scr                = 2=3
88
89
# Relation modifiers.
90
#
91
relationModifier.relevant   = 2=102
92
relationModifier.fuzzy      = 5=103
93
    ### 100 is "phonetic", which is not quite the same thing
94
relationModifier.stem       = 2=101
95
relationModifier.phonetic   = 2=100
96
97
# Position attributes may be specified for anchored terms (those
98
# beginning with "^", which is stripped) and unanchored (those not
99
# beginning with "^").  This may change when we get a BIB-1 truncation
100
# attribute that says "do what CQL does".
101
#
102
position.first              = 3=1 6=1
103
    # "first in field"
104
position.any                = 3=3 6=1
105
    # "any position in field"
106
position.last               = 3=4 6=1
107
    # not a standard BIB-1 attribute
108
position.firstAndLast       = 3=3 6=3
109
    # search term is anchored to be complete field
110
111
# Structure attributes may be specified for individual relations; a
112
# default structure attribute my be specified by the pseudo-relation
113
# "*", to be used whenever a relation not listed here occurs.
114
#
115
structure.exact             = 4=108
116
    # string
117
structure.all               = 4=2
118
structure.any               = 4=2
119
structure.*                 = 4=1
120
    # phrase
121
122
# Truncation attributes used to implement CQL wildcard patterns.  The
123
# simpler forms, left, right- and both-truncation will be used for the
124
# simplest patterns, so that we produce PQF queries that conform more
125
# closely to the Bath Profile.  However, when a more complex pattern
126
# such as "foo*bar" is used, we fall back on Z39.58-style masking.
127
#
128
truncation.right            = 5=1
129
truncation.left             = 5=2
130
truncation.both             = 5=3
131
truncation.none             = 5=100
132
truncation.z3958            = 5=104
133
134
# Finally, any additional attributes that should always be included
135
# with each term can be specified in the "always" property.
136
#
137
always                      = 6=1
138
# 6=1: completeness = incomplete subfield
139
140
141
# Bath Profile support, added Thu Dec 18 13:06:20 GMT 2003
142
# See the Bath Profile for SRW at
143
#   http://zing.z3950.org/cql/bath.html
144
# including the Bath Context Set defined within that document.
145
#
146
# In this file, we only map index-names to BIB-1 use attributes, doing
147
# so in accordance with the specifications of the Z39.50 Bath Profile,
148
# and leaving the relations, wildcards, etc. to fend for themselves.
149
150
index.bath.keyTitle         = 1=33
151
index.bath.possessingInstitution    = 1=1044
152
index.bath.name             = 1=1002
153
index.bath.personalName     = 1=1
154
index.bath.corporateName    = 1=2
155
index.bath.conferenceName   = 1=3
156
index.bath.uniformTitle     = 1=6
157
index.bath.isbn             = 1=7
158
index.bath.issn             = 1=8
159
index.bath.geographicName   = 1=58
160
index.bath.notes            = 1=63
161
index.bath.topicalSubject   = 1=1079
162
index.bath.genreForm        = 1=1075

Return to bug 13937