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));
}
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));
}
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));
}
Aggregations