use of org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType in project geotoolkit by Geomatys.
the class OGC110Test method testFilterComparisonPropertyIsEqualTo.
@Test
public void testFilterComparisonPropertyIsEqualTo() throws JAXBException, NoSuchAuthorityCodeException, FactoryException {
final Unmarshaller UNMARSHALLER = POOL.acquireUnmarshaller();
final Marshaller MARSHALLER = POOL.acquireMarshaller();
// Read test
Object obj = UNMARSHALLER.unmarshal(FILE_FIL_COMP_ISEQUAL);
assertNotNull(obj);
JAXBElement<? extends FilterType> jaxfilter = (JAXBElement<? extends FilterType>) obj;
assertNotNull(jaxfilter);
Filter filter = TRANSFORMER_GT.visitFilter(jaxfilter.getValue());
assertNotNull(filter);
BinaryComparisonOperator prop = (BinaryComparisonOperator) filter;
ValueReference left = (ValueReference) prop.getOperand1();
Literal right = (Literal) prop.getOperand2();
assertEquals(left.getXPath(), valueStr);
assertEquals(((Number) right.apply(null)).floatValue(), valueF, DELTA);
// write test
FilterType ft = TRANSFORMER_OGC.apply(filter);
assertNotNull(ft.getComparisonOps());
ComparisonOpsType cot = ft.getComparisonOps().getValue();
BinaryComparisonOpType pibt = (BinaryComparisonOpType) cot;
PropertyNameType lf = (PropertyNameType) pibt.getExpression().get(0).getValue();
LiteralType rg = (LiteralType) pibt.getExpression().get(1).getValue();
assertEquals(valueStr, lf.getContent());
numberEquals(valueF, rg.getContent().get(0));
MARSHALLER.marshal(ft.getComparisonOps(), TEST_FILE_FIL_COMP_ISEQUAL);
POOL.recycle(MARSHALLER);
POOL.recycle(UNMARSHALLER);
}
use of org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType in project geotoolkit by Geomatys.
the class OGC110Test method testFilterComparisonPropertyIsNotEqualTo.
@Test
public void testFilterComparisonPropertyIsNotEqualTo() throws JAXBException, NoSuchAuthorityCodeException, FactoryException {
final Unmarshaller UNMARSHALLER = POOL.acquireUnmarshaller();
final Marshaller MARSHALLER = POOL.acquireMarshaller();
// Read test
Object obj = UNMARSHALLER.unmarshal(FILE_FIL_COMP_ISNOTEQUAL);
assertNotNull(obj);
JAXBElement<? extends FilterType> jaxfilter = (JAXBElement<? extends FilterType>) obj;
assertNotNull(jaxfilter);
Filter filter = TRANSFORMER_GT.visitFilter(jaxfilter.getValue());
assertNotNull(filter);
BinaryComparisonOperator prop = (BinaryComparisonOperator) filter;
ValueReference left = (ValueReference) prop.getOperand1();
Literal right = (Literal) prop.getOperand2();
assertEquals(left.getXPath(), valueStr);
assertEquals(((Number) right.apply(null)).floatValue(), valueF, DELTA);
// write test
FilterType ft = TRANSFORMER_OGC.apply(filter);
assertNotNull(ft.getComparisonOps());
ComparisonOpsType cot = ft.getComparisonOps().getValue();
BinaryComparisonOpType pibt = (BinaryComparisonOpType) cot;
PropertyNameType lf = (PropertyNameType) pibt.getExpression().get(0).getValue();
LiteralType rg = (LiteralType) pibt.getExpression().get(1).getValue();
assertEquals(valueStr, lf.getContent());
numberEquals(valueF, rg.getContent().get(0));
MARSHALLER.marshal(ft.getComparisonOps(), TEST_FILE_FIL_COMP_ISNOTEQUAL);
POOL.recycle(MARSHALLER);
POOL.recycle(UNMARSHALLER);
}
Aggregations