Search in sources :

Example 16 with CswException

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

the class AbstractCswSource method removeEventServiceSubscription.

private void removeEventServiceSubscription() {
    if (filterlessSubscriptionId != null && subscribeClientFactory != null) {
        CswSubscribe cswSubscribe = subscribeClientFactory.getClientForSubject(getSystemSubject());
        try {
            cswSubscribe.deleteRecordsSubscription(filterlessSubscriptionId);
        } catch (CswException e) {
            LOGGER.info("Failed to remove filterless subscription registered for id {} for csw source with id of {}", filterlessSubscriptionId, this.getId());
        }
        filterlessSubscriptionId = null;
    }
}
Also used : CswSubscribe(org.codice.ddf.spatial.ogc.csw.catalog.common.CswSubscribe) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)

Example 17 with CswException

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

the class TestCswEndpoint method testPostDescribeRecordRequestMultipleTypes.

@Test
public void testPostDescribeRecordRequestMultipleTypes() {
    DescribeRecordType drt = createDefaultDescribeRecordType();
    List<QName> typeNames = new ArrayList<>();
    typeNames.add(new QName(CswConstants.CSW_OUTPUT_SCHEMA, VALID_TYPE, VALID_PREFIX));
    typeNames.add(new QName(CswConstants.CSW_OUTPUT_SCHEMA, "test", VALID_PREFIX));
    drt.setTypeName(typeNames);
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drt);
    } catch (CswException e) {
        fail("CswException caught during describeRecord GET 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 18 with CswException

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

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

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

the class TestCswEndpoint method testPostDescribeRecordRequestSingleTypePassed.

@Test
public void testPostDescribeRecordRequestSingleTypePassed() {
    DescribeRecordType drt = createDefaultDescribeRecordType();
    List<QName> typeNames = new ArrayList<>();
    typeNames.add(new QName(CswConstants.CSW_OUTPUT_SCHEMA, VALID_TYPE, VALID_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)

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