CSWClient extends AbstractOWSClient<CSWCapabilitiesAdapter> { public GetRecordsResponse getIsoRecords( ResultType resultType, ReturnableElement elementSetName, Filter constraint ) throws IOException, XMLProcessingException, OWSExceptionReport, XMLStreamException { GetRecords getRecords = new GetRecords( new Version( 2, 0, 2 ), 10, 15, "application/xml", "http: Collections.singletonList( new QName( CommonNamespaces.ISOAP10GMDNS, "MD_Metadata", CommonNamespaces.ISOAP10GMD_PREFIX ) ), ResultType.results, ReturnableElement.full, null ); return this.getRecords( getRecords ); } CSWClient( URL capaUrl );  CSWClient( URL capaUrl, int connectionTimeout, int readTimeout ); GetRecordsResponse getIsoRecords( ResultType resultType, ReturnableElement elementSetName, Filter constraint ); GetRecordsResponse getIsoRecords( int startPosition, int maxRecords, ResultType resultType,
                                             ReturnableElement elementSetName, Filter constraint ); GetRecordsResponse getIsoRecords( int startPosition, int maxRecords, Filter constraint ); GetRecordsResponse getRecords( int startPosition, int maxRecords, String outputFormat, String outputSchema,
                                          List<QName> typeNames, ResultType resultType,
                                          ReturnableElement elementSetName, Filter constraint ); GetRecordsResponse getRecords( GetRecords getRecords ); List<MetadataRecord> getRecordById( List<String> fileIdentifiers ); MetadataRecord getIsoRecordById( String fileIdentifier ); MetadataRecord getRecordById( String fileIdentifier, String schema ); TransactionResponse insert( OMElement record ); TransactionResponse insert( List<OMElement> records ); boolean update( String fileIdentifier, OMElement record ); boolean delete( String fileIdentifier ); boolean delete( Filter filter ); boolean deleteAll();  }
@Test public void testGetIsoRecords() throws OWSExceptionReport, XMLStreamException, IOException { String demoCSWURL = TestProperties.getProperty( "demo_csw_url" ); Assume.assumeNotNull( demoCSWURL ); URL serviceUrl = new URL( demoCSWURL ); CSWClient client = new CSWClient( serviceUrl ); Assert.assertNotNull( client ); Operator titleFilter1 = createPropertyLikeFilter( APISO_PREFIX, "Title", APISO, "%e%" ); Operator titleFilter2 = createPropertyLikeFilter( APISO_PREFIX, "Title", APISO, "%a%" ); Operator titleFilter = new Or(titleFilter1, titleFilter2); int startPosition = 1; int maxRecords = 20; Filter constraint = new OperatorFilter(titleFilter); GetRecordsResponse recordsResponse = client.getIsoRecords(startPosition, maxRecords, constraint); Assert.assertNotNull( recordsResponse ); Assert.assertTrue( maxRecords >= recordsResponse.getNumberOfRecordsReturned() ); Assert.assertTrue( recordsResponse.getNumberOfRecordsReturned() >= 1 ); Assert.assertTrue( recordsResponse.getNumberOfRecordsMatched() >= 1 ); int recordsCounter = 0; Iterator<MetadataRecord> iter = recordsResponse.getRecords(); while(iter.hasNext()) { MetadataRecord record = iter.next(); Assert.assertNotNull(record); System.out.println(String.format("%s * %s * %s * %s * %s", Arrays.toString(record.getTitle()), record.getIdentifier(), record.getLanguage(), record.getModified(), record.getType())); Assert.assertNotNull(record.getTitle()[0]); Assert.assertNotNull(record.getAbstract()[0]); Assert.assertNotNull(record.getIdentifier()); Assert.assertNotNull(record.getLanguage()); Assert.assertNotNull(record.getModified()); Assert.assertNotNull(record.getType()); recordsCounter++; } Assert.assertTrue(recordsCounter > 0); }