Search in sources :

Example 1 with DescribeRecordRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest in project ddf by codice.

the class TestCswEndpoint method testDescribeRecordRequestMultipleTypes.

@Test
public void testDescribeRecordRequestMultipleTypes() {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_PREFIX_LOCAL_TYPE + ",csw:test");
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drr);
    } catch (CswException e) {
        fail("CswException caught during describeRecord GET request: " + e.getMessage());
    }
    // 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(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 2 with DescribeRecordRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest in project ddf by codice.

the class TestCswEndpoint method testDescribeRecordRequestNoTypesPassed.

@Test
public void testDescribeRecordRequestNoTypesPassed() {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    LOGGER.info("Resource directory is {}", this.getClass().getResource(".").getPath());
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drr);
    } catch (CswException e) {
        fail("CswException caught during describeRecord GET 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 : 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 3 with DescribeRecordRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest in project ddf by codice.

the class TestCswEndpoint method testDescribeRecordOnlyLocalPart.

@Test(expected = CswException.class)
public void testDescribeRecordOnlyLocalPart() throws CswException {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_TYPE);
    drr.setNamespace(null);
    csw.describeRecord(drr);
}
Also used : DescribeRecordRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest) Test(org.junit.Test)

Example 4 with DescribeRecordRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest in project ddf by codice.

the class TestCswEndpoint method testDescribeRecordValidOutputFormat.

@Test
public void testDescribeRecordValidOutputFormat() {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_PREFIX_LOCAL_TYPE);
    drr.setOutputFormat(CswConstants.OUTPUT_FORMAT_XML);
    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 5 with DescribeRecordRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest in project ddf by codice.

the class ValidatorTest method testValidateTypeNameToNamespaceMappings.

@Test
public void testValidateTypeNameToNamespaceMappings() throws Exception {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest(VALID_PREFIX);
    drr.setTypeName(VALID_PREFIX_LOCAL_TYPE);
    drr.setOutputFormat(CswConstants.OUTPUT_FORMAT_XML);
    Map<String, String> namespacePrefixToUriMappings = drr.parseNamespaces(drr.getNamespace());
    validator.validateTypeNameToNamespaceMappings(drr.getTypeName(), drr.getNamespace(), namespacePrefixToUriMappings);
}
Also used : DescribeRecordRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest) Test(org.junit.Test)

Aggregations

DescribeRecordRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest)17 Test (org.junit.Test)15 DescribeRecordResponseType (net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType)10 CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)9 SchemaComponentType (net.opengis.cat.csw.v_2_0_2.SchemaComponentType)6