1 | /** |
---|
2 | * This software is copyright (c) 2013 by |
---|
3 | * - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de) |
---|
4 | * This is free software. You can redistribute it |
---|
5 | * and/or modify it under the terms described in |
---|
6 | * the GNU General Public License v3 of which you |
---|
7 | * should have received a copy. Otherwise you can download |
---|
8 | * it from |
---|
9 | * |
---|
10 | * http://www.gnu.org/licenses/gpl-3.0.txt |
---|
11 | * |
---|
12 | * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de) |
---|
13 | * |
---|
14 | * @license http://www.gnu.org/licenses/gpl-3.0.txt |
---|
15 | * GNU General Public License v3 |
---|
16 | */ |
---|
17 | package eu.clarin.fcs.tester.tests; |
---|
18 | |
---|
19 | import eu.clarin.fcs.tester.FCSTest; |
---|
20 | import eu.clarin.fcs.tester.FCSTestCase; |
---|
21 | import eu.clarin.fcs.tester.FCSTestContext; |
---|
22 | import eu.clarin.fcs.tester.FCSTestProfile; |
---|
23 | import eu.clarin.fcs.tester.FCSTestResult; |
---|
24 | import eu.clarin.sru.client.SRUClient; |
---|
25 | import eu.clarin.sru.client.SRUClientConstants; |
---|
26 | import eu.clarin.sru.client.SRUClientException; |
---|
27 | import eu.clarin.sru.client.SRUSearchRetrieveRequest; |
---|
28 | import eu.clarin.sru.client.SRUSearchRetrieveResponse; |
---|
29 | |
---|
30 | |
---|
31 | @FCSTestCase(priority = 3070, profiles = { |
---|
32 | FCSTestProfile.CLARIN_FCS_1_0, |
---|
33 | FCSTestProfile.CLARIN_FCS_2_0, |
---|
34 | FCSTestProfile.CLARIN_FCS_LEGACY |
---|
35 | }) |
---|
36 | public class TestSearch7 extends FCSTest { |
---|
37 | |
---|
38 | @Override |
---|
39 | public String getName() { |
---|
40 | return "SearchRetrieve"; |
---|
41 | } |
---|
42 | |
---|
43 | |
---|
44 | @Override |
---|
45 | public String getDescription() { |
---|
46 | return "Search with invalid value for 'maximumRecords' argument"; |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | @Override |
---|
51 | public String getExpected() { |
---|
52 | return "Expecting diagnostic \"info:srw/diagnostic/1/6\""; |
---|
53 | } |
---|
54 | |
---|
55 | |
---|
56 | @Override |
---|
57 | public FCSTestResult perform(FCSTestContext context, SRUClient client) |
---|
58 | throws SRUClientException { |
---|
59 | SRUSearchRetrieveRequest req = context.createSearchRetrieveRequest(); |
---|
60 | req.setQuery(SRUClientConstants.QUERY_TYPE_CQL, |
---|
61 | escapeCQL(context.getRandomSearchTerm())); |
---|
62 | req.setExtraRequestData( |
---|
63 | SRUSearchRetrieveRequest.X_MALFORMED_MAXIMUM_RECORDS, "invalid"); |
---|
64 | SRUSearchRetrieveResponse res = client.searchRetrieve(req); |
---|
65 | return findDiagnostic(res, "info:srw/diagnostic/1/6") |
---|
66 | ? makeSuccess() |
---|
67 | : makeErrorNoDiagnostic("info:srw/diagnostic/1/6"); |
---|
68 | } |
---|
69 | |
---|
70 | } |
---|