use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestGeometry method testAsFromEwkb.
@Test
public void testAsFromEwkb() throws Exception {
Expression ex = TestFunctionResolving.getExpression("st_asewkt(st_geomfromewkb(st_asewkb(ST_GeomFromEwkt('SrID=4326;POINT(0 0)'))))");
assertEquals("SRID=4326;POINT (0 0)", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
}
use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestGeometry method testSimplifyPreserveTopology.
@Test
public void testSimplifyPreserveTopology() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_AsText(ST_SimplifyPreserveTopology(ST_GeomFromText('POLYGON((6 3,1 -2,-4 3,1 8,6 3))'),5))");
assertEquals("POLYGON ((6 3, 1 -2, -4 3, 1 8, 6 3))", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
}
use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestGeometry method testGmlParseSrid.
@Test
public void testGmlParseSrid() throws Exception {
String gml = "<gml:Polygon srsName=\"SDO:8307\" xmlns:gml=\"http://www.opengis.net/gml\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates decimal=\".\" cs=\",\" ts=\" \">5,1 8,1 8,6 5,7 5,1 </gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>";
GeometryType gt = GeometryUtils.geometryFromGml(new ClobType(ClobImpl.createClob(gml.toCharArray())), null);
assertEquals(8307, gt.getSrid());
// oracle will leave of the int with unknown
gml = "<gml:Polygon srsName=\"SDO:\" xmlns:gml=\"http://www.opengis.net/gml\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates decimal=\".\" cs=\",\" ts=\" \">5,1 8,1 8,6 5,7 5,1 </gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>";
gt = GeometryUtils.geometryFromGml(new ClobType(ClobImpl.createClob(gml.toCharArray())), null);
assertEquals(GeometryType.UNKNOWN_SRID, gt.getSrid());
}
use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestJDBCSocketTransport method testGeometryStreaming.
@Test
public void testGeometryStreaming() throws Exception {
StringBuilder geomString = new StringBuilder();
for (int i = 0; i < 600; i++) {
geomString.append("100 100,");
}
geomString.append("100 100");
final GeometryType geo = GeometryUtils.geometryFromClob(new ClobType(new ClobImpl("POLYGON ((" + geomString + "))")));
long length = geo.length();
PreparedStatement s = conn.prepareStatement("select st_geomfrombinary(?)");
s.setBlob(1, new BlobImpl(new InputStreamFactory() {
@Override
public InputStream getInputStream() throws IOException {
try {
return geo.getBinaryStream();
} catch (SQLException e) {
throw new IOException(e);
}
}
}));
ResultSet rs = s.executeQuery();
rs.next();
Blob b = rs.getBlob(1);
assertEquals(length, b.length());
b.getBytes(1, (int) b.length());
toggleInline(false);
rs = s.executeQuery();
rs.next();
b = rs.getBlob(1);
assertEquals(length, b.length());
b.getBytes(1, (int) b.length());
}
Aggregations