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.FCSTestHandler; |
---|
24 | import eu.clarin.fcs.tester.FCSTestResult; |
---|
25 | import eu.clarin.sru.client.SRUClientException; |
---|
26 | import eu.clarin.sru.client.SRUSearchRetrieveRequest; |
---|
27 | import eu.clarin.sru.client.SRUSimpleClient; |
---|
28 | |
---|
29 | |
---|
30 | @FCSTestCase(priority = 3030, profiles = { |
---|
31 | FCSTestProfile.CLARIN_FCS_LEGACY |
---|
32 | }) |
---|
33 | public class TestSearch3 extends FCSTest { |
---|
34 | |
---|
35 | @Override |
---|
36 | public String getName() { |
---|
37 | return "SearchRetrieve"; |
---|
38 | } |
---|
39 | |
---|
40 | |
---|
41 | @Override |
---|
42 | public String getDescription() { |
---|
43 | return "Search with missing 'query' argument"; |
---|
44 | } |
---|
45 | |
---|
46 | |
---|
47 | @Override |
---|
48 | public String getExpected() { |
---|
49 | return "Expecting diagnostic \"info:srw/diagnostic/1/7\""; |
---|
50 | } |
---|
51 | |
---|
52 | |
---|
53 | @Override |
---|
54 | public FCSTestResult perform(FCSTestContext context, SRUSimpleClient client, |
---|
55 | FCSTestHandler handler) throws SRUClientException { |
---|
56 | SRUSearchRetrieveRequest req = context.createSearchRetrieveRequest(); |
---|
57 | req.setExtraRequestData(SRUSearchRetrieveRequest.X_MALFORMED_QUERY, |
---|
58 | SRUSearchRetrieveRequest.MALFORMED_OMIT); |
---|
59 | client.searchRetrieve(req, handler); |
---|
60 | return handler.findDiagnostic("info:srw/diagnostic/1/7") |
---|
61 | ? makeSuccess() |
---|
62 | : makeErrorNoDiagnostic("info:srw/diagnostic/1/7"); |
---|
63 | } |
---|
64 | } |
---|