use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordByIdRequest in project ddf by codice.
the class TestCswEndpoint method testRetrieveProductGetRecordByIdWithInvalidRangeHeader.
@Test(expected = CswException.class)
public void testRetrieveProductGetRecordByIdWithInvalidRangeHeader() throws IOException, ResourceNotFoundException, ResourceNotSupportedException, CswException {
final GetRecordByIdRequest getRecordByIdRequest = new GetRecordByIdRequest();
getRecordByIdRequest.setId("123");
getRecordByIdRequest.setOutputFormat(MediaType.APPLICATION_OCTET_STREAM);
getRecordByIdRequest.setOutputSchema(OCTET_STREAM_OUTPUT_SCHEMA);
setUpMocksForProductRetrieval(true);
csw.getRecordById(getRecordByIdRequest, "100");
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordByIdRequest in project ddf by codice.
the class TestCswEndpoint method testGetRecordById.
@Test
public void testGetRecordById() throws CswException, FederationException, SourceUnavailableException, UnsupportedQueryException {
final GetRecordByIdRequest getRecordByIdRequest = new GetRecordByIdRequest();
getRecordByIdRequest.setId("123");
getRecordByIdRequest.setOutputFormat(MediaType.APPLICATION_XML);
getRecordByIdRequest.setOutputSchema(CswConstants.CSW_OUTPUT_SCHEMA);
getRecordByIdRequest.setElementSetName("full");
final Metacard metacard = new MetacardImpl();
final List<Result> mockResults = Collections.singletonList(new ResultImpl(metacard));
final QueryResponseImpl queryResponse = new QueryResponseImpl(null, mockResults, mockResults.size());
doReturn(queryResponse).when(catalogFramework).query(any(QueryRequest.class));
final CswRecordCollection cswRecordCollection = csw.getRecordById(getRecordByIdRequest, null);
verifyCswRecordCollection(cswRecordCollection, metacard);
assertThat(cswRecordCollection.getElementSetType(), is(ElementSetType.FULL));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordByIdRequest in project ddf by codice.
the class TestCswEndpoint method testGetRecordByIdWithNoId.
@Test(expected = CswException.class)
public void testGetRecordByIdWithNoId() throws CswException {
final GetRecordByIdRequest getRecordByIdRequest = new GetRecordByIdRequest();
getRecordByIdRequest.setOutputFormat(MediaType.APPLICATION_XML);
getRecordByIdRequest.setOutputSchema(CswConstants.CSW_OUTPUT_SCHEMA);
csw.getRecordById(getRecordByIdRequest, null);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordByIdRequest in project ddf by codice.
the class TestCswEndpoint method testRetrieveProductGetRecordByIdWithRange.
@Test
public void testRetrieveProductGetRecordByIdWithRange() throws IOException, ResourceNotFoundException, ResourceNotSupportedException, CswException {
final GetRecordByIdRequest getRecordByIdRequest = new GetRecordByIdRequest();
getRecordByIdRequest.setId("123");
getRecordByIdRequest.setOutputFormat(MediaType.APPLICATION_OCTET_STREAM);
getRecordByIdRequest.setOutputSchema(OCTET_STREAM_OUTPUT_SCHEMA);
setUpMocksForProductRetrieval(true);
CswRecordCollection cswRecordCollection = csw.getRecordById(getRecordByIdRequest, RANGE_VALUE);
assertThat(cswRecordCollection.getResource(), is(notNullValue()));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordByIdRequest in project ddf by codice.
the class TestCswEndpoint method testRetrieveProductGetRecordById.
@Test
public void testRetrieveProductGetRecordById() throws IOException, ResourceNotFoundException, ResourceNotSupportedException, CswException {
final GetRecordByIdRequest getRecordByIdRequest = new GetRecordByIdRequest();
getRecordByIdRequest.setId("123");
getRecordByIdRequest.setOutputFormat(MediaType.APPLICATION_OCTET_STREAM);
getRecordByIdRequest.setOutputSchema(OCTET_STREAM_OUTPUT_SCHEMA);
setUpMocksForProductRetrieval(true);
CswRecordCollection cswRecordCollection = csw.getRecordById(getRecordByIdRequest, null);
assertThat(cswRecordCollection.getResource(), is(notNullValue()));
}
Aggregations