Ignore:
Timestamp:
10/11/18 12:13:58 (6 years ago)
Author:
Oliver Schonefeld
Message:
  • rewrite to use SRUClient instead of SRUSimpleClient
  • add Tests for Endpoint Description (FCS 1.0 and FCS 2.0)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • FCSEndpointTester/trunk/src/main/java/eu/clarin/fcs/tester/tests/TestScan3.java

    r7116 r7196  
    1717package eu.clarin.fcs.tester.tests;
    1818
    19 import java.util.List;
    20 
    2119import eu.clarin.fcs.tester.FCSTest;
    2220import eu.clarin.fcs.tester.FCSTestCase;
    2321import eu.clarin.fcs.tester.FCSTestContext;
    2422import eu.clarin.fcs.tester.FCSTestProfile;
    25 import eu.clarin.fcs.tester.FCSTestHandler;
    2623import eu.clarin.fcs.tester.FCSTestResult;
     24import eu.clarin.sru.client.SRUClient;
    2725import eu.clarin.sru.client.SRUClientException;
    2826import eu.clarin.sru.client.SRUScanRequest;
    29 import eu.clarin.sru.client.SRUSimpleClient;
     27import eu.clarin.sru.client.SRUScanResponse;
    3028
    3129@FCSTestCase(priority=2030, profiles = {
     
    5351
    5452    @Override
    55     public FCSTestResult perform(FCSTestContext context, SRUSimpleClient client,
    56             FCSTestHandler handler) throws SRUClientException {
     53    public FCSTestResult perform(FCSTestContext context, SRUClient client) throws SRUClientException {
    5754        SRUScanRequest req = context.createScanRequest();
    5855        req.setScanClause("fcs.resource=root");
    5956        req.setMaximumTerms(1);
    60         client.scan(req, handler);
     57        SRUScanResponse res = client.scan(req);
    6158
    62         if (handler.getDiagnosticCount() > 0) {
    63             if (handler.findDiagnostic("info:srw/diagnostic/1/4")) {
     59        if (res.getDiagnosticsCount() > 0) {
     60            if (findDiagnostic(res, "info:srw/diagnostic/1/4")) {
    6461                return makeWarning("Endpoint does not support 'scan' operation");
    6562            } else {
     
    6764            }
    6865        } else {
    69             List<String> terms = handler.getTerms();
    70             if (terms.size() == 1) {
     66            int count = getTermsCount(res);
     67            if (count == 1) {
    7168                return makeSuccess();
    72             } else if (terms.size() > 1) {
     69            } else if (count > 1) {
    7370                return makeWarning("Endpoint did not honor 'maximumTerms' argument");
    7471            }
Note: See TracChangeset for help on using the changeset viewer.