Search in sources :

Example 36 with CswException

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

the class TestCswEndpoint method testGetCapabilitiesTypeBadSection.

@Test
public void testGetCapabilitiesTypeBadSection() {
    // Shouldn't return any sections
    GetCapabilitiesType gct = createDefaultGetCapabilitiesType();
    SectionsType stv = new SectionsType();
    stv.setSection(Arrays.asList("bad"));
    gct.setSections(stv);
    CapabilitiesType ct = null;
    try {
        ct = csw.getCapabilities(gct);
    } catch (CswException e) {
        fail("CswException caught during getCapabilities GET request: " + e.getMessage());
    }
    assertThat(ct, notNullValue());
    verifyFilterCapabilities(ct);
    assertThat(ct.getServiceIdentification(), nullValue());
    assertThat(ct.getServiceProvider(), nullValue());
    assertThat(ct.getOperationsMetadata(), nullValue());
}
Also used : SectionsType(net.opengis.ows.v_1_0_0.SectionsType) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 37 with CswException

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

the class TestCswEndpoint method testCapabilitiesRequestBadSection.

@Test
public void testCapabilitiesRequestBadSection() {
    // Shouldn't return any sections
    GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
    gcr.setSections("bad");
    CapabilitiesType ct = null;
    try {
        ct = csw.getCapabilities(gcr);
    } catch (CswException e) {
        fail("CswException caught during getCapabilities GET request: " + e.getMessage());
    }
    assertThat(ct, notNullValue());
    assertThat(ct.getOperationsMetadata(), nullValue());
    assertThat(ct.getServiceIdentification(), nullValue());
    assertThat(ct.getServiceProvider(), nullValue());
    verifyFilterCapabilities(ct);
}
Also used : GetCapabilitiesRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 38 with CswException

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

the class TestCswEndpoint method testPostDescribeRecordRequestGMDTypePassed.

@Test
public void testPostDescribeRecordRequestGMDTypePassed() {
    DescribeRecordType drt = createDefaultDescribeRecordType();
    List<QName> typeNames = new ArrayList<>();
    typeNames.add(new QName(GmdConstants.GMD_NAMESPACE, GmdConstants.GMD_LOCAL_NAME, GmdConstants.GMD_PREFIX));
    drt.setTypeName(typeNames);
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drt);
    } catch (CswException e) {
        fail("CswException caught during describeRecord POST request: " + e.getMessage());
    }
    assertThat(drrt, notNullValue());
    assertThat(drrt.getSchemaComponent(), notNullValue());
    List<SchemaComponentType> schemaComponents = drrt.getSchemaComponent();
    assertThat(schemaComponents.size(), is(1));
}
Also used : DescribeRecordType(net.opengis.cat.csw.v_2_0_2.DescribeRecordType) SchemaComponentType(net.opengis.cat.csw.v_2_0_2.SchemaComponentType) QName(javax.xml.namespace.QName) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) ArrayList(java.util.ArrayList) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 39 with CswException

use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswException 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 40 with CswException

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

the class TestCswEndpoint method testGetCapabilitiesTypeServiceIdentification.

@Test
public void testGetCapabilitiesTypeServiceIdentification() {
    // Should only return the ServiceIdentification section
    GetCapabilitiesType gct = createDefaultGetCapabilitiesType();
    SectionsType stv = new SectionsType();
    stv.setSection(Arrays.asList(CswEndpoint.SERVICE_IDENTIFICATION));
    gct.setSections(stv);
    CapabilitiesType ct = null;
    try {
        ct = csw.getCapabilities(gct);
    } catch (CswException e) {
        fail("CswException caught during getCapabilities GET request: " + e.getMessage());
    }
    assertThat(ct, notNullValue());
    verifyServiceIdentification(ct);
    verifyFilterCapabilities(ct);
    assertThat(ct.getServiceProvider(), nullValue());
    assertThat(ct.getOperationsMetadata(), nullValue());
}
Also used : SectionsType(net.opengis.ows.v_1_0_0.SectionsType) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Aggregations

CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)84 Test (org.junit.Test)55 CapabilitiesType (net.opengis.cat.csw.v_2_0_2.CapabilitiesType)19 GetCapabilitiesType (net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType)19 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)17 QueryImpl (ddf.catalog.operation.impl.QueryImpl)13 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)13 DescribeRecordResponseType (net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType)13 Matchers.anyString (org.mockito.Matchers.anyString)13 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)11 UnsupportedQueryException (ddf.catalog.source.UnsupportedQueryException)10 ArrayList (java.util.ArrayList)10 SchemaComponentType (net.opengis.cat.csw.v_2_0_2.SchemaComponentType)10 GetCapabilitiesRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest)10 SourceResponse (ddf.catalog.operation.SourceResponse)9 IOException (java.io.IOException)9 DescribeRecordRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest)9 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)7 Filter (org.opengis.filter.Filter)7 JAXBException (javax.xml.bind.JAXBException)6