Search in sources :

Example 1 with GetRecordByIdType

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

the class TestCswEndpoint 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 2 with GetRecordByIdType

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

the class TestCswEndpoint 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 3 with GetRecordByIdType

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

the class TestCswEndpoint 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()));
}
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 4 with GetRecordByIdType

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

the class TestCswEndpoint method testPostRetrieveProductGetRecordByIdWithInvalidRange.

@Test(expected = CswException.class)
public void testPostRetrieveProductGetRecordByIdWithInvalidRange() 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);
    csw.getRecordById(getRecordByIdType, "100");
}
Also used : GetRecordByIdType(net.opengis.cat.csw.v_2_0_2.GetRecordByIdType) Test(org.junit.Test)

Example 5 with GetRecordByIdType

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

the class TestCswEndpoint 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);
}
Also used : 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