Search in sources :

Example 11 with GetRecordsRequest

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

the class CswQueryFactoryTest method ogcSpatialRelativeQuery.

/**
     * Runs a binary Spatial OGC Query, verifying that the right filter class is generated based on OGC Filter
     *
     * @param constraint The OGC Filter Constraint as an XML string
     * @throws UnsupportedQueryException
     * @throws SourceUnavailableException
     * @throws FederationException
     * @throws CswException
     */
private <N extends DistanceBufferOperator> void ogcSpatialRelativeQuery(Class<N> clz, String constraint) throws UnsupportedQueryException, SourceUnavailableException, FederationException, CswException {
    GetRecordsRequest grr = createDefaultGetRecordsRequest();
    grr.setConstraintLanguage("FILTER");
    grr.setConstraint(constraint);
    QueryImpl frameworkQuery = (QueryImpl) queryFactory.getQuery(grr.get202RecordsType()).getQuery();
    assertThat(frameworkQuery.getFilter(), instanceOf(clz));
    @SuppressWarnings("unchecked") N spatial = (N) frameworkQuery.getFilter();
    assertThat(((LiteralExpressionImpl) spatial.getExpression2()).getValue(), is(polygon));
    assertThat(((AttributeExpressionImpl) spatial.getExpression1()).getPropertyName(), is(SPATIAL_TEST_ATTRIBUTE));
}
Also used : QueryImpl(ddf.catalog.operation.impl.QueryImpl) GetRecordsRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordsRequest)

Example 12 with GetRecordsRequest

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

the class CswSubscriptionEndpointTest method testCreateRecordsSubscriptionPOST.

@Test
public void testCreateRecordsSubscriptionPOST() throws Exception {
    CSW_LOGGER.setLevel(Level.DEBUG);
    GetRecordsRequest getRecordsRequest = createDefaultGetRecordsRequest();
    getRecordsRequest.setResponseHandler(RESPONSE_HANDLER_URL);
    Response response = cswSubscriptionEndpoint.createRecordsSubscription(getRecordsRequest.get202RecordsType());
    AcknowledgementType createAck = (AcknowledgementType) response.getEntity();
    assertThat(createAck, notNullValue());
    assertThat(createAck.getRequestId(), notNullValue());
    CSW_LOGGER.setLevel(Level.INFO);
    verify(mockContext).registerService(eq(Subscription.class.getName()), any(Subscription.class), any(Dictionary.class));
}
Also used : Response(javax.ws.rs.core.Response) Dictionary(java.util.Dictionary) Subscription(ddf.catalog.event.Subscription) CswSubscription(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.event.CswSubscription) AcknowledgementType(net.opengis.cat.csw.v_2_0_2.AcknowledgementType) GetRecordsRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordsRequest) Test(org.junit.Test)

Example 13 with GetRecordsRequest

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

the class CswSubscriptionEndpointTest method testCreateRecordsSubscriptionGET.

@Test
public void testCreateRecordsSubscriptionGET() throws Exception {
    GetRecordsRequest getRecordsRequest = createDefaultGetRecordsRequest();
    getRecordsRequest.setResponseHandler(RESPONSE_HANDLER_URL);
    getRecordsRequest.setVersion("");
    Response response = cswSubscriptionEndpoint.createRecordsSubscription(getRecordsRequest);
    AcknowledgementType createAck = (AcknowledgementType) response.getEntity();
    assertThat(createAck, notNullValue());
    verify(mockContext).registerService(eq(Subscription.class.getName()), any(Subscription.class), any(Dictionary.class));
}
Also used : Response(javax.ws.rs.core.Response) Dictionary(java.util.Dictionary) Subscription(ddf.catalog.event.Subscription) CswSubscription(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.event.CswSubscription) AcknowledgementType(net.opengis.cat.csw.v_2_0_2.AcknowledgementType) GetRecordsRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordsRequest) Test(org.junit.Test)

Aggregations

GetRecordsRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordsRequest)13 Test (org.junit.Test)9 Subscription (ddf.catalog.event.Subscription)3 Dictionary (java.util.Dictionary)3 Response (javax.ws.rs.core.Response)3 AcknowledgementType (net.opengis.cat.csw.v_2_0_2.AcknowledgementType)3 CswSubscription (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.event.CswSubscription)3 QueryImpl (ddf.catalog.operation.impl.QueryImpl)1 JAXBElement (javax.xml.bind.JAXBElement)1