use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class FesDecoderV20Test method should_parse_PropertyIsEqualTo_Filter.
/**
* Test PropertyIsEqualTo filter decoding
*
* @throws OwsExceptionReport
*/
@Test
public void should_parse_PropertyIsEqualTo_Filter() throws DecodingException {
PropertyIsEqualToDocument propertyIsEqualToDoc = PropertyIsEqualToDocument.Factory.newInstance();
BinaryComparisonOpType propertyIsEqualToType = propertyIsEqualToDoc.addNewPropertyIsEqualTo();
// valueReference
XmlString valueReference = (XmlString) propertyIsEqualToType.addNewExpression().substitute(FilterConstants.QN_VALUE_REFERENCE, XmlString.type);
valueReference.setStringValue(TEST_VALUE_REFERENCE);
// literal
LiteralType literalType = (LiteralType) propertyIsEqualToType.addNewExpression().substitute(FilterConstants.QN_LITERAL, LiteralType.type);
XmlString newInstance = XmlString.Factory.newInstance();
newInstance.setStringValue(TEST_LITERAL);
literalType.set(newInstance);
// create document
FilterDocument filterDoc = FilterDocument.Factory.newInstance();
FilterType filterType = filterDoc.addNewFilter();
filterType.setComparisonOps(propertyIsEqualToType);
filterType.getComparisonOps().substitute(FilterConstants.QN_PROPERTY_IS_EQUAL_TO, BinaryComparisonOpType.type);
ComparisonFilter comparisonFilter = (ComparisonFilter) decoder.decode(filterDoc);
// test
assertThat(comparisonFilter.getOperator(), is(FilterConstants.ComparisonOperator.PropertyIsEqualTo));
assertThat(comparisonFilter.getValueReference(), is(TEST_VALUE_REFERENCE));
assertThat(comparisonFilter.getValue(), is(TEST_LITERAL));
}
Aggregations