Search in sources :

Example 21 with DescribeRecordResponseType

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

the class TestCswEndpoint method testPostDescribeRecordRequestNoTypesPassed.

@Test
public void testPostDescribeRecordRequestNoTypesPassed() {
    // Should only return the ServiceProvider section
    DescribeRecordType request = createDefaultDescribeRecordType();
    LOGGER.info("Resource directory is {}", this.getClass().getResource(".").getPath());
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(request);
    } catch (CswException e) {
        fail("CswException caught during describeRecord POST request: " + e.getMessage());
    }
    assertThat(drrt, notNullValue());
    assertThat(drrt.getSchemaComponent(), notNullValue());
    // Assert that it returned all record types.
    assertThat(drrt.getSchemaComponent().size(), is(2));
    LOGGER.info("got response \n{}\n", drrt.toString());
}
Also used : DescribeRecordType(net.opengis.cat.csw.v_2_0_2.DescribeRecordType) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 22 with DescribeRecordResponseType

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

the class TestCswEndpoint method testDescribeRecordMultipleTypesMultipleNamespacesMultiplePrefixes.

@Test
public void testDescribeRecordMultipleTypesMultipleNamespacesMultiplePrefixes() {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_PREFIX_LOCAL_TYPE + ",csw2:test4");
    drr.setNamespace("xmlns(" + VALID_PREFIX + "=" + CswConstants.CSW_OUTPUT_SCHEMA + ")" + "," + "xmlns(" + "csw2" + "=" + CswConstants.CSW_OUTPUT_SCHEMA + "2" + ")");
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drr);
    } catch (CswException e) {
        fail("DescribeRecord failed with message '" + e.getMessage() + "'");
    }
    assertThat(drrt, notNullValue());
    assertThat(drrt.getSchemaComponent(), notNullValue());
    List<SchemaComponentType> schemaComponents = drrt.getSchemaComponent();
    assertThat(schemaComponents.size(), is(1));
}
Also used : SchemaComponentType(net.opengis.cat.csw.v_2_0_2.SchemaComponentType) DescribeRecordRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 23 with DescribeRecordResponseType

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

the class TestCswEndpoint method testDescribeRecordRequestInvalidType.

@Test
public void testDescribeRecordRequestInvalidType() throws CswException {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_PREFIX_LOCAL_TYPE + "," + VALID_PREFIX + ":" + BAD_TYPE);
    DescribeRecordResponseType response = csw.describeRecord(drr);
    // spec does not say specifically it should throw an exception,
    // and NSG interoperability tests require to skip the unknown ones, and
    // potentially return an empty list if none are known
    assertThat(response.getSchemaComponent().size(), is(1));
}
Also used : DescribeRecordRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) Test(org.junit.Test)

Example 24 with DescribeRecordResponseType

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

the class TestCswEndpoint method testDescribeRecordSingleTypeSingleNamespaceNoPrefixes.

@Test
public void testDescribeRecordSingleTypeSingleNamespaceNoPrefixes() {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_TYPE);
    drr.setNamespace("xmlns(" + CswConstants.CSW_OUTPUT_SCHEMA + ")");
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drr);
    } catch (CswException e) {
        fail("DescribeRecord failed with message '" + e.getMessage() + "'");
    }
    assertThat(drrt, notNullValue());
    assertThat(drrt.getSchemaComponent(), notNullValue());
    List<SchemaComponentType> schemaComponents = drrt.getSchemaComponent();
    assertThat(schemaComponents.size(), is(1));
}
Also used : SchemaComponentType(net.opengis.cat.csw.v_2_0_2.SchemaComponentType) DescribeRecordRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 25 with DescribeRecordResponseType

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

the class TestCswEndpoint method testDescribeRecordSingleTypeSingleNamespaceNoPrefixesBadType.

@Test
public void testDescribeRecordSingleTypeSingleNamespaceNoPrefixesBadType() throws CswException {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(BAD_TYPE);
    drr.setNamespace("xmlns(" + CswConstants.CSW_OUTPUT_SCHEMA + ")");
    DescribeRecordResponseType response = csw.describeRecord(drr);
    assertThat(response.getSchemaComponent(), is(empty()));
}
Also used : DescribeRecordRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) Test(org.junit.Test)

Aggregations

DescribeRecordResponseType (net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType)36 Test (org.junit.Test)34 CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)26 SchemaComponentType (net.opengis.cat.csw.v_2_0_2.SchemaComponentType)24 DescribeRecordRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest)20 ArrayList (java.util.ArrayList)14 QName (javax.xml.namespace.QName)12 DescribeRecordType (net.opengis.cat.csw.v_2_0_2.DescribeRecordType)12 StringWriter (java.io.StringWriter)2 JAXBContext (javax.xml.bind.JAXBContext)2 JAXBElement (javax.xml.bind.JAXBElement)2 JAXBException (javax.xml.bind.JAXBException)2 Marshaller (javax.xml.bind.Marshaller)2