use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdType in project ddf by codice.
the class TestCswEndpoint method testPostRetrieveProductGetRecordByIdWithMultiIds.
@Test(expected = CswException.class)
public void testPostRetrieveProductGetRecordByIdWithMultiIds() throws CswException, FederationException, SourceUnavailableException, UnsupportedQueryException, ResourceNotFoundException, IOException, ResourceNotSupportedException {
final GetRecordByIdType getRecordByIdType = new GetRecordByIdType();
getRecordByIdType.setOutputFormat(MediaType.APPLICATION_OCTET_STREAM);
getRecordByIdType.setOutputSchema(OCTET_STREAM_OUTPUT_SCHEMA);
getRecordByIdType.setId(Arrays.asList("123", "124"));
csw.getRecordById(getRecordByIdType, null);
}
use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdType in project ddf by codice.
the class CswEndpointTest method testPostRetrieveProductGetRecordById.
@Test
public void testPostRetrieveProductGetRecordById() throws IOException, ResourceNotFoundException, ResourceNotSupportedException, CswException {
final GetRecordByIdType getRecordByIdType = new GetRecordByIdType();
getRecordByIdType.setOutputFormat(MediaType.APPLICATION_OCTET_STREAM);
getRecordByIdType.setOutputSchema(OCTET_STREAM_OUTPUT_SCHEMA);
getRecordByIdType.setId(Collections.singletonList("123"));
setUpMocksForProductRetrieval(true);
CswRecordCollection cswRecordCollection = csw.getRecordById(getRecordByIdType, null);
assertThat(cswRecordCollection.getResource(), is(notNullValue()));
}
use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdType in project ddf by codice.
the class CswEndpointTest method testPostRetrieveProductGetRecordByIdIncorrectOutputFormat.
@Test(expected = CswException.class)
public void testPostRetrieveProductGetRecordByIdIncorrectOutputFormat() throws CswException, FederationException, SourceUnavailableException, UnsupportedQueryException, ResourceNotFoundException, IOException, ResourceNotSupportedException {
final GetRecordByIdType getRecordByIdType = new GetRecordByIdType();
getRecordByIdType.setOutputFormat(MediaType.APPLICATION_XML);
getRecordByIdType.setOutputSchema(OCTET_STREAM_OUTPUT_SCHEMA);
getRecordByIdType.setId(Collections.singletonList("123"));
csw.getRecordById(getRecordByIdType, null);
}
use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdType in project ddf by codice.
the class CswEndpointTest method testPostGetRecordByWithIdNoId.
@Test(expected = CswException.class)
public void testPostGetRecordByWithIdNoId() throws CswException {
final GetRecordByIdType getRecordByIdType = new GetRecordByIdType();
getRecordByIdType.setOutputFormat(MediaType.APPLICATION_XML);
getRecordByIdType.setOutputSchema(CswConstants.CSW_OUTPUT_SCHEMA);
csw.getRecordById(getRecordByIdType, null);
}
use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdType in project ddf by codice.
the class CswEndpointTest method testPostGetRecordById.
@Test
public void testPostGetRecordById() throws CswException, FederationException, SourceUnavailableException, UnsupportedQueryException {
final GetRecordByIdType getRecordByIdType = new GetRecordByIdType();
getRecordByIdType.setId(Collections.singletonList("123,456"));
getRecordByIdType.setOutputFormat(MediaType.APPLICATION_XML);
getRecordByIdType.setOutputSchema(CswConstants.CSW_OUTPUT_SCHEMA);
final Metacard metacard1 = new MetacardImpl();
final Metacard metacard2 = new MetacardImpl();
final List<Result> mockResults = Arrays.asList(new ResultImpl(metacard1), new ResultImpl(metacard2));
final QueryResponse queryResponse = new QueryResponseImpl(null, mockResults, mockResults.size());
doReturn(queryResponse).when(catalogFramework).query(any(QueryRequest.class));
final CswRecordCollection cswRecordCollection = csw.getRecordById(getRecordByIdType, null);
verifyCswRecordCollection(cswRecordCollection, metacard1, metacard2);
// "summary" is the default if none is specified in the request.
assertThat(cswRecordCollection.getElementSetType(), is(ElementSetType.SUMMARY));
}
Aggregations