- Timestamp:
- 11/12/14 00:07:48 (10 years ago)
- Location:
- SRUClient/trunk/src/test/java/eu/clarin/sru/client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUClient/trunk/src/test/java/eu/clarin/sru/client/TestClient.java
r5750 r5799 21 21 22 22 import eu.clarin.sru.client.fcs.ClarinFCSClientBuilder; 23 import eu.clarin.sru.client.fcs.ClarinFCSEndpointDescriptionParser; 23 24 24 25 … … 36 37 .unknownDataViewAsString() 37 38 .enableLegacySupport() 39 .registerExtraResponseDatar( 40 new ClarinFCSEndpointDescriptionParser()) 38 41 .buildClient(); 39 42 -
SRUClient/trunk/src/test/java/eu/clarin/sru/client/TestUtils.java
r5750 r5799 17 17 package eu.clarin.sru.client; 18 18 19 import java.net.URI; 19 20 import java.util.List; 20 21 … … 25 26 import eu.clarin.sru.client.SRUExplainRecordData.ConfigInfo; 26 27 import eu.clarin.sru.client.SRUExplainRecordData.Schema; 28 import eu.clarin.sru.client.fcs.ClarinFCSEndpointDescription; 29 import eu.clarin.sru.client.fcs.ClarinFCSEndpointDescription.ResourceInfo; 27 30 import eu.clarin.sru.client.fcs.ClarinFCSRecordData; 28 31 import eu.clarin.sru.client.fcs.DataView; … … 39 42 SRUExplainRequest request = new SRUExplainRequest(baseURI); 40 43 request.setExtraRequestData("x-indent-response", "4"); 44 request.setExtraRequestData("x-fcs-endpoint-description", "true"); 41 45 request.setParseRecordDataEnabled(true); 42 46 return request; … … 82 86 if (record.isRecordSchema(SRUExplainRecordData.RECORD_SCHEMA)) { 83 87 dumpExplainRecordData(record.getRecordData()); 88 } 89 if (record.hasExtraRecordData()) { 90 logger.info("extraRecordInfo = {}", 91 record.getExtraRecordData()); 92 } 93 } 94 if (response.hasExtraResponseData()) { 95 for (SRUExtraResponseData data : response.getExtraResponseData()) { 96 if (data instanceof ClarinFCSEndpointDescription) { 97 dumpEndpointDescription( 98 (ClarinFCSEndpointDescription) data); 99 } else { 100 logger.info("extraResponseData = {} (class={})", 101 data.getRootElement(), data.getClass().getName()); 102 } 103 84 104 } 85 105 } … … 200 220 dumpDataView("CLARIN-FCS: ResourceFragment/", fragment.getDataViews()); 201 221 } 222 } 223 } 224 } 225 226 227 private static void dumpEndpointDescription(ClarinFCSEndpointDescription ed) { 228 logger.info("dumping <EndpointDescription> (version={})", 229 ed.getVersion()); 230 for (URI capability : ed.getCapabilities()) { 231 logger.info(" capability: {}", capability); 232 } // for 233 for (ClarinFCSEndpointDescription.DataView dataView : 234 ed.getSupportedDataViews()) { 235 logger.info(" supportedDataView: id={}, type={}, policy={}", 236 dataView.getIdentifier(), 237 dataView.getMimeType(), 238 dataView.getDeliveryPolicy()); 239 } // for 240 dumpResourceInfo(ed.getResources(), 1, " "); 241 } 242 243 244 private static void dumpResourceInfo(List<ResourceInfo> ris, int depth, 245 String indent) { 246 for (ResourceInfo ri : ris) { 247 logger.info("{}[depth={}] <ResourceInfo>", indent, depth); 248 logger.info("{} pid={}", indent, ri.getPid()); 249 logger.info("{} title: {}", indent, ri.getTitle()); 250 if (ri.getDescription() != null) { 251 logger.info("{} description: {}", 252 indent, ri.getDescription()); 253 } 254 if (ri.getLandingPageURI() != null) { 255 logger.info("{} landingPageURI: {}", 256 indent, ri.getLandingPageURI()); 257 } 258 for (ClarinFCSEndpointDescription.DataView dv : 259 ri.getAvailableDataViews()) { 260 logger.info("{} available dataviews: type={}, policy={}", 261 indent, dv.getMimeType(), dv.getDeliveryPolicy()); 262 } 263 if (ri.hasSubResources()) { 264 dumpResourceInfo(ri.getSubResources(), 265 depth + 1, indent + " "); 202 266 } 203 267 }
Note: See TracChangeset
for help on using the changeset viewer.