use of net.opengis.wfs.v_2_0_0.GetFeatureType in project ddf by codice.
the class TestWfsSource method testTwoPropertyQuery.
@Test
public void testTwoPropertyQuery() throws UnsupportedQueryException, WfsException, SecurityServiceException {
setUp(TWO_TEXT_PROPERTY_SCHEMA, null, null, ONE_FEATURE, null);
QueryImpl propertyIsLikeQuery = new QueryImpl(builder.attribute(Metacard.ANY_TEXT).is().like().text(LITERAL));
propertyIsLikeQuery.setPageSize(MAX_FEATURES);
ArgumentCaptor<GetFeatureType> captor = ArgumentCaptor.forClass(GetFeatureType.class);
source.query(new QueryRequestImpl(propertyIsLikeQuery));
verify(mockWfs).getFeature(captor.capture());
GetFeatureType getFeatureType = captor.getValue();
assertMaxFeatures(getFeatureType, propertyIsLikeQuery);
assertTrue(getFeatureType.getQuery().size() == ONE_FEATURE);
QueryType query = getFeatureType.getQuery().get(0);
assertTrue(query.getTypeName().equals(sampleFeatures.get(0)));
// The Text Properties should be ORed
assertTrue(query.getFilter().isSetLogicOps());
assertTrue(query.getFilter().getLogicOps().getValue() instanceof BinaryLogicOpType);
}
use of net.opengis.wfs.v_2_0_0.GetFeatureType in project ddf by codice.
the class TestWfsSource method testIntersectQuery.
@Test
public void testIntersectQuery() throws UnsupportedQueryException, WfsException, SecurityServiceException {
setUp(ONE_GML_PROPERTY_SCHEMA, Arrays.asList(new Intersect(), new BBOX()), SRS_NAME, ONE_FEATURE, null);
Filter intersectFilter = builder.attribute(Metacard.ANY_GEO).is().intersecting().wkt(POLYGON_WKT);
QueryImpl intersectQuery = new QueryImpl(intersectFilter);
intersectQuery.setPageSize(MAX_FEATURES);
ArgumentCaptor<GetFeatureType> captor = ArgumentCaptor.forClass(GetFeatureType.class);
source.query(new QueryRequestImpl(intersectQuery));
verify(mockWfs).getFeature(captor.capture());
GetFeatureType getFeatureType = captor.getValue();
assertMaxFeatures(getFeatureType, intersectQuery);
assertTrue(getFeatureType.getQuery().size() == ONE_FEATURE);
QueryType query = getFeatureType.getQuery().get(0);
assertTrue(query.getTypeName().equals(sampleFeatures.get(0)));
assertTrue(query.getFilter().isSetSpatialOps());
assertTrue(query.getFilter().getSpatialOps().getValue() instanceof SpatialOpsType);
}
use of net.opengis.wfs.v_2_0_0.GetFeatureType in project ddf by codice.
the class TestWfsSource method testIDQuery.
@Test
public void testIDQuery() throws UnsupportedQueryException, WfsException, SecurityServiceException {
setUp(NO_PROPERTY_SCHEMA, null, null, TWO_FEATURES, null);
QueryImpl idQuery = new QueryImpl(builder.attribute(Core.ID).is().text(ORDER_PERSON));
ArgumentCaptor<GetFeatureType> captor = ArgumentCaptor.forClass(GetFeatureType.class);
source.query(new QueryRequestImpl(idQuery));
verify(mockWfs).getFeature(captor.capture());
GetFeatureType getFeatureType = captor.getValue();
assertEquals(ONE_FEATURE.intValue(), getFeatureType.getQuery().get(0).getFilter().getFeatureId().size());
assertEquals(ORDER_PERSON, getFeatureType.getQuery().get(0).getFilter().getFeatureId().get(0).getFid());
}
use of net.opengis.wfs.v_2_0_0.GetFeatureType in project ddf by codice.
the class TestWfsSource method testPropertyIsLikeQuery.
@Test
public void testPropertyIsLikeQuery() throws UnsupportedQueryException, WfsException, SecurityServiceException {
setUp(ONE_TEXT_PROPERTY_SCHEMA, null, null, ONE_FEATURE, null);
QueryImpl propertyIsLikeQuery = new QueryImpl(builder.attribute(Metacard.ANY_TEXT).is().like().text("literal"));
propertyIsLikeQuery.setPageSize(MAX_FEATURES);
ArgumentCaptor<GetFeatureType> captor = ArgumentCaptor.forClass(GetFeatureType.class);
source.query(new QueryRequestImpl(propertyIsLikeQuery));
verify(mockWfs).getFeature(captor.capture());
GetFeatureType getFeatureType = captor.getValue();
assertMaxFeatures(getFeatureType, propertyIsLikeQuery);
assertTrue(getFeatureType.getQuery().size() == ONE_FEATURE);
QueryType query = getFeatureType.getQuery().get(0);
assertTrue(query.getTypeName().equals(sampleFeatures.get(0)));
assertTrue(query.getFilter().isSetComparisonOps());
assertTrue(query.getFilter().getComparisonOps().getValue() instanceof PropertyIsLikeType);
}
use of net.opengis.wfs.v_2_0_0.GetFeatureType in project ddf by codice.
the class TestWfsSource method testContentTypeAndNoPropertyQuery.
@Test
public void testContentTypeAndNoPropertyQuery() throws UnsupportedQueryException, WfsException, SecurityServiceException {
setUp(NO_PROPERTY_SCHEMA, null, null, ONE_FEATURE, null);
Filter contentTypeFilter = builder.attribute(Metacard.CONTENT_TYPE).is().like().text(sampleFeatures.get(0).getLocalPart());
QueryImpl propertyIsLikeQuery = new QueryImpl(contentTypeFilter);
propertyIsLikeQuery.setPageSize(MAX_FEATURES);
ArgumentCaptor<GetFeatureType> captor = ArgumentCaptor.forClass(GetFeatureType.class);
source.query(new QueryRequestImpl(propertyIsLikeQuery));
verify(mockWfs).getFeature(captor.capture());
GetFeatureType getFeatureType = captor.getValue();
assertMaxFeatures(getFeatureType, propertyIsLikeQuery);
assertEquals(ONE_FEATURE.intValue(), getFeatureType.getQuery().size());
assertEquals(sampleFeatures.get(0), getFeatureType.getQuery().get(0).getTypeName());
}
Aggregations