use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.
the class TestGeometry method testIntersection.
@Test
public void testIntersection() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_AsText(st_intersection(ST_GeomFromText('POLYGON ((0 50, 50 50, 40 0, 0 0, 0 50))'), ST_GeomFromText('POLYGON ((0 50, 40 50, 40 0, 0 0, 0 50))')))");
ClobType intersection = (ClobType) Evaluator.evaluate(ex);
assertEquals("POLYGON ((0 50, 40 50, 40 0, 0 0, 0 50))", ClobType.getString(intersection));
ex = TestFunctionResolving.getExpression("ST_AsText(st_intersection(ST_GeomFromText('POLYGON ((0 50, 50 50, 40 0, 0 0, 0 50))'), ST_GeomFromText('POLYGON ((150 50, 200 50, 190 0, 150 0, 150 50))')))");
intersection = (ClobType) Evaluator.evaluate(ex);
assertEquals("POLYGON EMPTY", ClobType.getString(intersection));
}
use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.
the class TestGeometry method testOrderingEquals.
@Test
public void testOrderingEquals() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_OrderingEquals(ST_GeomFromText('LINESTRING(0 0, 10 10)'),ST_GeomFromText('LINESTRING(0 0, 0 0, 10 10)'))");
assertFalse((Boolean) Evaluator.evaluate(ex));
}
use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.
the class TestGeometry method testEndPoint.
@Test
public void testEndPoint() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_AsText(st_endpoint(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 3)'))))");
assertEquals("POINT (1 3)", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
}
use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.
the class TestGeometry method testForce2d.
@Test
public void testForce2d() throws Exception {
Expression ex = TestFunctionResolving.getExpression("st_astext(st_force_2d(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 3)')))");
assertEquals("LINESTRING (0 0, 1 3)", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
}
use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.
the class TestGeometry method testTextError.
@Test
public void testTextError() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_GeomFromText('''hello''')");
try {
Evaluator.evaluate(ex);
fail();
} catch (ExpressionEvaluationException e) {
assertNull(ExceptionUtil.getExceptionOfType(e, NullPointerException.class));
}
}
Aggregations