Search in sources :

Example 6 with DescribeRecordRequest

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

the class TestCswEndpoint method testDescribeRecordMultipleTypesMultipleNamespacesNominal.

@Test
public void testDescribeRecordMultipleTypesMultipleNamespacesNominal() {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_PREFIX_LOCAL_TYPE + ",csw:test");
    drr.setNamespace("xmlns(" + VALID_PREFIX + "=" + 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 7 with DescribeRecordRequest

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

the class TestCswEndpoint method testDescribeRecordValidSchemaLanguage.

@Test
public void testDescribeRecordValidSchemaLanguage() {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_PREFIX_LOCAL_TYPE);
    drr.setSchemaLanguage(CswConstants.SCHEMA_LANGUAGE_X_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 8 with DescribeRecordRequest

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

the class TestCswEndpoint method testDescribeRecordMultipleTypesMultipleNamespacesMultiplePrefixesMismatchedPrefix.

@Test
public void testDescribeRecordMultipleTypesMultipleNamespacesMultiplePrefixesMismatchedPrefix() {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_PREFIX_LOCAL_TYPE + ",csw3:test4");
    drr.setNamespace("xmlns(" + VALID_PREFIX + "=" + CswConstants.CSW_OUTPUT_SCHEMA + ")" + "," + "xmlns(" + "csw2" + "=" + CswConstants.CSW_OUTPUT_SCHEMA + "2" + ")");
    try {
        csw.describeRecord(drr);
        fail("Should have thrown an exception indicating an invalid type.");
    } catch (CswException e) {
        LOGGER.info("Correctly got exception " + e.getMessage());
        return;
    }
    fail("Should have gotten exception.");
}
Also used : DescribeRecordRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 9 with DescribeRecordRequest

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

the class TestCswEndpoint method testDescribeRecordOnlyLocalPartMultipleTypes.

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

Example 10 with DescribeRecordRequest

use of org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest 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)

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