use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class WfsFilterDelegateTest method testLogicalNotOfLogicals.
@Test
public void testLogicalNotOfLogicals() {
String mockProperty = "myPropertyName";
String mockType = "myType";
WfsFilterDelegate delegate = mockFeatureMetacardCreateDelegate(mockProperty, mockType);
FilterType compFilter1 = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
FilterType compFilter2 = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
List<FilterType> subFiltersToBeOred = new ArrayList<>();
subFiltersToBeOred.add(compFilter1);
subFiltersToBeOred.add(compFilter2);
// Perform Test
FilterType filter = delegate.not(delegate.or(subFiltersToBeOred));
// Verify
assertThat(filter.getLogicOps().getName().toString(), is(LOGICAL_NOT_NAME));
UnaryLogicOpType logicOpType = (UnaryLogicOpType) filter.getLogicOps().getValue();
BinaryLogicOpType logicOrType = (BinaryLogicOpType) logicOpType.getLogicOps().getValue();
assertThat(logicOpType.getLogicOps().getName().toString(), is(LOGICAL_OR_NAME));
PropertyIsLikeType compOpsType1 = (PropertyIsLikeType) logicOrType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(0).getValue();
String valRef1 = fetchPropertyIsLikeExpression(compOpsType1, VALUE_REFERENCE);
assertThat(valRef1, is(mockProperty));
String literal1 = fetchPropertyIsLikeExpression(compOpsType1, LITERAL);
assertThat(literal1, is(LITERAL));
PropertyIsLikeType compOpsType2 = (PropertyIsLikeType) logicOrType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(1).getValue();
String valRef2 = fetchPropertyIsLikeExpression(compOpsType2, VALUE_REFERENCE);
assertThat(valRef2, is(mockProperty));
String literal2 = fetchPropertyIsLikeExpression(compOpsType2, LITERAL);
assertThat(literal2, is(LITERAL));
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class WfsFilterDelegateTest method testIntersectsAsNotDisjoint.
@Test
public void testIntersectsAsNotDisjoint() {
WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.DISJOINT.toString());
FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
assertTrue(filter.isSetLogicOps());
assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
assertTrue(type.isSetSpatialOps());
assertTrue(type.getSpatialOps().getValue() instanceof BinarySpatialOpType);
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class WfsFilterDelegateTest method testDisjointAsNotBBox.
@Test
public void testDisjointAsNotBBox() throws SAXException, IOException, JAXBException {
WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.toString());
FilterType filter = delegate.disjoint(Metacard.ANY_GEO, POLYGON);
assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
assertTrue(type.getSpatialOps().getValue() instanceof BBOXType);
assertXMLEqual(MockWfsServer.getNotBboxXmlFilter(), getXmlFromMarshaller(filter));
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class WfsFilterDelegateTest method testBeyondAsNotDwithin.
@Test
public void testBeyondAsNotDwithin() {
WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.D_WITHIN.toString());
FilterType filter = delegate.beyond(Metacard.ANY_GEO, POLYGON, DISTANCE);
assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
assertTrue(type.getSpatialOps().getValue() instanceof DistanceBufferType);
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class WfsFilterDelegateTest method testLogicalNotOfComparison.
@Test
public void testLogicalNotOfComparison() {
String mockProperty = "myPropertyName";
String mockType = "myType";
WfsFilterDelegate delegate = mockFeatureMetacardCreateDelegate(mockProperty, mockType);
FilterType filterToBeNoted = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
// Perform Test
FilterType filter = delegate.not(filterToBeNoted);
// Verify
assertThat(filter.getLogicOps().getName().toString(), is(LOGICAL_NOT_NAME));
UnaryLogicOpType logicOpType = (UnaryLogicOpType) filter.getLogicOps().getValue();
PropertyIsLikeType compOpsType1 = (PropertyIsLikeType) logicOpType.getComparisonOps().getValue();
String valRef1 = fetchPropertyIsLikeExpression(compOpsType1, VALUE_REFERENCE);
assertThat(valRef1, is(mockProperty));
String literal1 = fetchPropertyIsLikeExpression(compOpsType1, LITERAL);
assertThat(literal1, is(LITERAL));
}
Aggregations