use of com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.nonterminal.geometric.WithinNode in project hale by halestudio.
the class TestCqlToMappingConditionTranslator method testTranslateGeometricWithin.
/**
* Tests translating a CQL expression which includes a geometric 'within'
* predicate.
*
* @throws CQLException
* if any errors occurred parsing the CQL string
* @throws TranslationException
* if any errors occurred during the translation
*/
// @Test
public void testTranslateGeometricWithin() throws CQLException, TranslationException {
// $NON-NLS-1$
String cqlPredicate = "DWITHIN(ATTR1, POINT(1 2), 10, kilometers)";
ModelMappingCondition result = digester.translate(CQL.toFilter(cqlPredicate));
assertNotNull(result);
assertNotNull(result.getRoot());
assertThat(result.getRoot(), is(instanceOf(WithinNode.class)));
WithinNode withinNode = (WithinNode) result.getRoot();
assertThat(withinNode.getLeaves().size(), is(equalTo(2)));
assertNotNull(withinNode.getLeft());
// $NON-NLS-1$
assertThat(withinNode.getLeft().getPropertyName(), is(equalTo("ATTR1")));
assertNotNull(withinNode.getRight());
// CHECKSTYLE:OFF
assertThat(withinNode.getDistance(), is(equalTo(10.0)));
// CHECKSTYLE:ON
assertThat(withinNode.getDistanceUnits(), is(equalTo(UnitOfMeasureType.kilometers)));
}
Aggregations