Search in sources :

Example 16 with GetRecordByIdType

use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdType in project ddf by codice.

the class CswEndpointTest 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);
}
Also used : GetRecordByIdType(net.opengis.cat.csw.v_2_0_2.GetRecordByIdType) Test(org.junit.Test)

Example 17 with GetRecordByIdType

use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdType in project ddf by codice.

the class CswEndpointTest method testPostRetrieveProductGetRecordByIdIncorrectSchema.

@Test(expected = CswException.class)
public void testPostRetrieveProductGetRecordByIdIncorrectSchema() throws CswException, FederationException, SourceUnavailableException, UnsupportedQueryException, ResourceNotFoundException, IOException, ResourceNotSupportedException {
    final GetRecordByIdType getRecordByIdType = new GetRecordByIdType();
    getRecordByIdType.setOutputFormat(MediaType.APPLICATION_OCTET_STREAM);
    getRecordByIdType.setOutputSchema(CswConstants.CSW_OUTPUT_SCHEMA);
    getRecordByIdType.setId(Collections.singletonList("123"));
    csw.getRecordById(getRecordByIdType, null);
}
Also used : GetRecordByIdType(net.opengis.cat.csw.v_2_0_2.GetRecordByIdType) Test(org.junit.Test)

Example 18 with GetRecordByIdType

use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdType in project ddf by codice.

the class CswEndpointTest method testPostRetrieveProductGetRecordByIdWithNoResource.

@Test(expected = CswException.class)
public void testPostRetrieveProductGetRecordByIdWithNoResource() 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(Collections.singletonList("123"));
    when(catalogFramework.getLocalResource(any(ResourceRequest.class))).thenThrow(ResourceNotFoundException.class);
    csw.getRecordById(getRecordByIdType, null);
}
Also used : GetRecordByIdType(net.opengis.cat.csw.v_2_0_2.GetRecordByIdType) ResourceRequest(ddf.catalog.operation.ResourceRequest) Test(org.junit.Test)

Example 19 with GetRecordByIdType

use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdType in project ddf by codice.

the class CswEndpointTest method testPostRetrieveProductGetRecordByIdWithNoMimeType.

@Test
public void testPostRetrieveProductGetRecordByIdWithNoMimeType() 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(false);
    CswRecordCollection cswRecordCollection = csw.getRecordById(getRecordByIdType, null);
    assertThat(cswRecordCollection.getResource(), is(notNullValue()));
    assertThat(cswRecordCollection.getResource().getMimeType().toString(), is(MediaType.APPLICATION_OCTET_STREAM));
}
Also used : CswRecordCollection(org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection) GetRecordByIdType(net.opengis.cat.csw.v_2_0_2.GetRecordByIdType) Test(org.junit.Test)

Example 20 with GetRecordByIdType

use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdType in project ddf by codice.

the class CswEndpointTest method testPostRetrieveProductGetRecordByIdWithRange.

@Test
public void testPostRetrieveProductGetRecordByIdWithRange() 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, RANGE_VALUE);
    assertThat(cswRecordCollection.getResource(), is(notNullValue()));
}
Also used : CswRecordCollection(org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection) GetRecordByIdType(net.opengis.cat.csw.v_2_0_2.GetRecordByIdType) Test(org.junit.Test)

Aggregations

GetRecordByIdType (net.opengis.cat.csw.v_2_0_2.GetRecordByIdType)20 Test (org.junit.Test)20 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)8 Metacard (ddf.catalog.data.Metacard)2 Result (ddf.catalog.data.Result)2 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)2 ResultImpl (ddf.catalog.data.impl.ResultImpl)2 QueryRequest (ddf.catalog.operation.QueryRequest)2 QueryResponse (ddf.catalog.operation.QueryResponse)2 ResourceRequest (ddf.catalog.operation.ResourceRequest)2 QueryResponseImpl (ddf.catalog.operation.impl.QueryResponseImpl)2