From 27fbacf7d2849ee0707cc04b3ed7a6327fa046eb Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Thu, 11 Feb 2021 21:33:55 +0100 Subject: [PATCH] HHH-14453 Fix Hana integration test --- .../hana/TestHANASpatialFunctions.java | 214 +++++++++--------- 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/hibernate-spatial/src/test/java/org/hibernate/spatial/dialect/hana/TestHANASpatialFunctions.java b/hibernate-spatial/src/test/java/org/hibernate/spatial/dialect/hana/TestHANASpatialFunctions.java index 068c4033b0..81ca06f9c7 100644 --- a/hibernate-spatial/src/test/java/org/hibernate/spatial/dialect/hana/TestHANASpatialFunctions.java +++ b/hibernate-spatial/src/test/java/org/hibernate/spatial/dialect/hana/TestHANASpatialFunctions.java @@ -65,8 +65,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { Map dbexpected = hanaExpectationsFactory.getAlphaShape( 1 ); String hql = format( Locale.ENGLISH, - "SELECT id, alphashape(geom, 1) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_Point', 'ST_MultiPoint')", - pckg + "SELECT id, alphashape(geom, 1) FROM %s where geometrytype(geom) in ('ST_Point', 'ST_MultiPoint')", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -84,8 +84,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void area(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getArea(); String hql = format( - "SELECT id, area(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_Polygon', 'ST_MultiPolygon')", - pckg + "SELECT id, area(geom) FROM %s where geometrytype(geom) in ('ST_Polygon', 'ST_MultiPolygon')", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -102,7 +102,7 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void asewkb(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getAsEWKB(); - String hql = format( "SELECT id, asewkb(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity", pckg ); + String hql = format( "SELECT id, asewkb(geom) FROM %s", entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -118,7 +118,7 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void asewkt(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getAsEWKT(); - String hql = format( "SELECT id, asewkt(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity", pckg ); + String hql = format( "SELECT id, asewkt(geom) FROM %s", entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -134,7 +134,7 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void asgeojson(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getAsGeoJSON(); - String hql = format( "SELECT id, asgeojson(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity", pckg ); + String hql = format( "SELECT id, asgeojson(geom) FROM %s", entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -150,7 +150,7 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void assvg(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getAsSVG(); - String hql = format( "SELECT id, assvg(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity", pckg ); + String hql = format( "SELECT id, assvg(geom) FROM %s", entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -167,8 +167,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void assvgaggr(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getAsSVGAggr(); String hql = format( - "SELECT cast(count(g) as int), assvgaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g", - pckg + "SELECT cast(count(g) as int), assvgaggr(geom) FROM %s g", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -185,7 +185,7 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void aswkb(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getAsWKB(); - String hql = format( "SELECT id, aswkb(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity", pckg ); + String hql = format( "SELECT id, aswkb(geom) FROM %s", entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -201,7 +201,7 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void aswkt(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getAsWKT(); - String hql = format( "SELECT id, aswkt(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity", pckg ); + String hql = format( "SELECT id, aswkt(geom) FROM %s", entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -218,8 +218,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void convexhullaggr(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getConvexHullAggr(); String hql = format( - "SELECT cast(count(g) as int), convexhullaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g", - pckg + "SELECT cast(count(g) as int), convexhullaggr(geom) FROM %s g", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -237,8 +237,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void centroid(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getCentroid(); String hql = format( - "SELECT id, centroid(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_Polygon'", - pckg + "SELECT id, centroid(geom) FROM %s g where geometrytype(geom) = 'ST_Polygon'", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -255,7 +255,7 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void coorddim(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getCoordDim(); - String hql = format( "SELECT id, coorddim(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity", pckg ); + String hql = format( "SELECT id, coorddim(geom) FROM %s", entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -272,8 +272,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void coveredby(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getCoveredBy( expectationsFactory.getTestPolygon() ); String hql = format( - "SELECT id, coveredby(geom, :filter) FROM org.hibernate.spatial.integration.%s.GeomEntity where coveredby(geom, :filter) = true and srid(geom) = %d", - pckg, + "SELECT id, coveredby(geom, :filter) FROM %s where coveredby(geom, :filter) = true and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); Map params = createQueryParams( "filter", expectationsFactory.getTestPolygon() ); @@ -293,8 +293,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void covers(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getCovers( expectationsFactory.getTestPolygon() ); String hql = format( - "SELECT id, covers(geom, :filter) FROM org.hibernate.spatial.integration.%s.GeomEntity where covers(geom, :filter) = true and srid(geom) = %d", - pckg, + "SELECT id, covers(geom, :filter) FROM %s where covers(geom, :filter) = true and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); Map params = createQueryParams( "filter", expectationsFactory.getTestPolygon() ); @@ -314,8 +314,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void endpoint(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getEndPoint(); String hql = format( - "SELECT id, endpoint(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_LineString'", - pckg + "SELECT id, endpoint(geom) FROM %s g where geometrytype(geom) = 'ST_LineString'", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -333,8 +333,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void envelopeaggr(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getEnvelopeAggr(); String hql = format( - "SELECT cast(count(g) as int), envelopeaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g", - pckg + "SELECT cast(count(g) as int), envelopeaggr(geom) FROM %s g", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -352,8 +352,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void exteriorring(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getExteriorRing(); String hql = format( - "SELECT id, exteriorring(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_Polygon'", - pckg + "SELECT id, exteriorring(geom) FROM %s g where geometrytype(geom) = 'ST_Polygon'", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -373,9 +373,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { byte[] ewkb = writer.write( expectationsFactory.getTestPolygon() ); Map dbexpected = hanaExpectationsFactory.getGeomFromEWKB( ewkb ); String hql = format( - "SELECT 1, cast(geomfromewkb(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g", + "SELECT 1, cast(geomfromewkb(:param) as %s) FROM %s g", getGeometryTypeFromPackage( pckg ), - pckg + entityName( pckg ) ); Map params = createQueryParams( "param", ewkb ); retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg ); @@ -396,9 +396,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { String ewkt = "SRID=" + expectationsFactory.getTestSrid() + ";" + writer.write( expectationsFactory.getTestPolygon() ); Map dbexpected = hanaExpectationsFactory.getGeomFromEWKT( ewkt ); String hql = format( - "SELECT 1, cast(geomfromewkt(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g", + "SELECT 1, cast(geomfromewkt(:param) as %s) FROM %s g", getGeometryTypeFromPackage( pckg ), - pckg + entityName( pckg ) ); Map params = createQueryParams( "param", ewkt ); retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg ); @@ -418,9 +418,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { String text = expectationsFactory.getTestPolygon().toText(); Map dbexpected = hanaExpectationsFactory.getGeomFromText( text ); String hql = format( - "SELECT 1, cast(geomfromtext(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g", + "SELECT 1, cast(geomfromtext(:param) as %s) FROM %s g", getGeometryTypeFromPackage( pckg ), - pckg + entityName( pckg ) ); Map params = createQueryParams( "param", text ); retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg ); @@ -441,9 +441,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { byte[] wkb = writer.write( expectationsFactory.getTestPolygon() ); Map dbexpected = hanaExpectationsFactory.getGeomFromWKB( wkb ); String hql = format( - "SELECT 1, cast(geomfromwkb(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g", + "SELECT 1, cast(geomfromwkb(:param) as %s) FROM %s g", getGeometryTypeFromPackage( pckg ), - pckg + entityName( pckg ) ); Map params = createQueryParams( "param", wkb ); retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg ); @@ -464,9 +464,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { String wkt = writer.write( expectationsFactory.getTestPolygon() ); Map dbexpected = hanaExpectationsFactory.getGeomFromWKT( wkt ); String hql = format( - "SELECT 1, cast(geomfromwkt(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g", + "SELECT 1, cast(geomfromwkt(:param) as %s) FROM %s g", getGeometryTypeFromPackage( pckg ), - pckg + entityName( pckg ) ); Map params = createQueryParams( "param", wkt ); retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg ); @@ -485,9 +485,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void geometryn(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getGeometryN( 1 ); String hql = format( - "SELECT id, cast(geometryn(geom, :n) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_GeometryCollection'", + "SELECT id, cast(geometryn(geom, :n) as %s) FROM %s g where geometrytype(geom) = 'ST_GeometryCollection'", getGeometryTypeFromPackage( pckg ), - pckg + entityName( pckg ) ); Map params = createQueryParams( "n", 1 ); retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg ); @@ -506,9 +506,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void interiorringn(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getInteriorRingN( 1 ); String hql = format( - "SELECT id, cast(interiorringn(geom, :n) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_Polygon'", + "SELECT id, cast(interiorringn(geom, :n) as %s) FROM %s g where geometrytype(geom) = 'ST_Polygon'", getGeometryTypeFromPackage( pckg ), - pckg + entityName( pckg ) ); Map params = createQueryParams( "n", 1 ); retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg ); @@ -527,8 +527,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void intersectionaggr(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getIntersectionAggr(); String hql = format( - "SELECT cast(count(g) as int), intersectionaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g", - pckg + "SELECT cast(count(g) as int), intersectionaggr(geom) FROM %s g", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -549,8 +549,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { expectationsFactory.getTestPoint() ); String hql = format( - "SELECT id, intersectsrect(geom, :pmin, :pmax) FROM org.hibernate.spatial.integration.%s.GeomEntity where intersectsrect(geom, :pmin, :pmax) = true and srid(geom) = %d", - pckg, + "SELECT id, intersectsrect(geom, :pmin, :pmax) FROM %s where intersectsrect(geom, :pmin, :pmax) = true and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); Map params = createQueryParams( "pmin", expectationsFactory.getTestPoint().reverse() ); @@ -571,8 +571,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void is3d(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getIs3D(); String hql = format( - "SELECT id, is3d(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where is3d(geom) = true and srid(geom) = %d", - pckg, + "SELECT id, is3d(geom) FROM %s where is3d(geom) = true and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -591,8 +591,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void isclosed(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getIsClosed(); String hql = format( - "SELECT id, isclosed(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_LineString', 'ST_MultiLineString') and isclosed(geom) = true and srid(geom) = %d", - pckg, + "SELECT id, isclosed(geom) FROM %s where geometrytype(geom) in ('ST_LineString', 'ST_MultiLineString') and isclosed(geom) = true and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -611,8 +611,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void ismeasured(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getIsMeasured(); String hql = format( - "SELECT id, ismeasured(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where ismeasured(geom) = true and srid(geom) = %d", - pckg, + "SELECT id, ismeasured(geom) FROM %s where ismeasured(geom) = true and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -631,8 +631,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void isring(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getIsRing(); String hql = format( - "SELECT id, isring(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_LineString') and srid(geom) = %d", - pckg, + "SELECT id, isring(geom) FROM %s where geometrytype(geom) in ('ST_LineString') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -651,8 +651,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void isvalid(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getIsValid(); String hql = format( - "SELECT id, isvalid(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where isvalid(geom) = true and srid(geom) = %d", - pckg, + "SELECT id, isvalid(geom) FROM %s where isvalid(geom) = true and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -671,8 +671,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void length(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getLength(); String hql = format( - "SELECT id, length(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_LineString', 'ST_MultiLineString') and srid(geom) = %d", - pckg, + "SELECT id, length(geom) FROM %s where geometrytype(geom) in ('ST_LineString', 'ST_MultiLineString') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -691,8 +691,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void m(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getM(); String hql = format( - "SELECT id, m(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_Point') and srid(geom) = %d", - pckg, + "SELECT id, m(geom) FROM %s where geometrytype(geom) in ('ST_Point') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -711,8 +711,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void mmax(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getMMax(); String hql = format( - "SELECT id, mmax(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d", - pckg, expectationsFactory.getTestSrid() + "SELECT id, mmax(geom) FROM %s where srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -730,8 +730,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void mmin(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getMMin(); String hql = format( - "SELECT id, mmin(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d", - pckg, expectationsFactory.getTestSrid() + "SELECT id, mmin(geom) FROM %s where srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -749,8 +749,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void numgeometries(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getNumGeometries(); String hql = format( - "SELECT id, numgeometries(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_GeometryCollection') and srid(geom) = %d", - pckg, + "SELECT id, numgeometries(geom) FROM %s where geometrytype(geom) in ('ST_GeometryCollection') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -769,8 +769,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void numinteriorring(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getNumInteriorRing(); String hql = format( - "SELECT id, numinteriorring(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_Polygon') and srid(geom) = %d", - pckg, + "SELECT id, numinteriorring(geom) FROM %s where geometrytype(geom) in ('ST_Polygon') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -789,8 +789,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void numinteriorrings(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getNumInteriorRings(); String hql = format( - "SELECT id, numinteriorrings(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_Polygon') and srid(geom) = %d", - pckg, + "SELECT id, numinteriorrings(geom) FROM %s where geometrytype(geom) in ('ST_Polygon') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -809,8 +809,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void numpoints(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getNumPoints(); String hql = format( - "SELECT id, numpoints(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_LineString') and srid(geom) = %d", - pckg, + "SELECT id, numpoints(geom) FROM %s where geometrytype(geom) in ('ST_LineString') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -829,8 +829,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void orderingequals(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getOrderingEquals( expectationsFactory.getTestPolygon() ); String hql = format( - "SELECT id, orderingequals(geom, :filter) FROM org.hibernate.spatial.integration.%s.GeomEntity where orderingequals(geom, :filter) = true and srid(geom) = %d", - pckg, + "SELECT id, orderingequals(geom, :filter) FROM %s where orderingequals(geom, :filter) = true and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); Map params = createQueryParams( "filter", expectationsFactory.getTestPolygon() ); @@ -850,8 +850,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void perimeter(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getPerimeter(); String hql = format( - "SELECT id, perimeter(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_Polygon', 'ST_MultiPolygon') and srid(geom) = %d", - pckg, + "SELECT id, perimeter(geom) FROM %s where geometrytype(geom) in ('ST_Polygon', 'ST_MultiPolygon') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -870,8 +870,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void pointonsurface(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getPointOnSurface(); String hql = format( - "SELECT id, pointonsurface(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_Polygon', 'ST_MultiPolygon') and srid(geom) = %d", - pckg, + "SELECT id, pointonsurface(geom) FROM %s where geometrytype(geom) in ('ST_Polygon', 'ST_MultiPolygon') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -890,8 +890,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void pointn(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getPointN( 1 ); String hql = format( - "SELECT id, pointn(geom, :n) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_LineString') and srid(geom) = %d", - pckg, + "SELECT id, pointn(geom, :n) FROM %s where geometrytype(geom) in ('ST_LineString') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); Map params = createQueryParams( "n", 1 ); @@ -913,8 +913,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void snaptogrid(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getSnapToGrid(); String hql = format( - "SELECT id, snaptogrid(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d", - pckg, expectationsFactory.getTestSrid() + "SELECT id, snaptogrid(geom) FROM %s where srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -932,8 +932,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void startpoint(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getStartPoint(); String hql = format( - "SELECT id, startpoint(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_LineString'", - pckg + "SELECT id, startpoint(geom) FROM %s g where geometrytype(geom) = 'ST_LineString'", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -951,8 +951,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void unionaggr(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getUnionAggr(); String hql = format( - "SELECT cast(count(g) as int), unionaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g", - pckg + "SELECT cast(count(g) as int), unionaggr(geom) FROM %s g", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -970,8 +970,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void x(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getX(); String hql = format( - "SELECT id, x(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_Point') and srid(geom) = %d", - pckg, + "SELECT id, x(geom) FROM %s where geometrytype(geom) in ('ST_Point') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -990,8 +990,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void xmax(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getXMax(); String hql = format( - "SELECT id, xmax(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d", - pckg, expectationsFactory.getTestSrid() + "SELECT id, xmax(geom) FROM %s where srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -1009,8 +1009,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void xmin(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getXMin(); String hql = format( - "SELECT id, xmin(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d", - pckg, expectationsFactory.getTestSrid() + "SELECT id, xmin(geom) FROM %s where srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -1028,8 +1028,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void y(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getY(); String hql = format( - "SELECT id, y(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_Point') and srid(geom) = %d", - pckg, + "SELECT id, y(geom) FROM %s where geometrytype(geom) in ('ST_Point') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -1048,8 +1048,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void ymax(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getYMax(); String hql = format( - "SELECT id, ymax(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d", - pckg, expectationsFactory.getTestSrid() + "SELECT id, ymax(geom) FROM %s where srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -1067,8 +1067,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void ymin(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getYMin(); String hql = format( - "SELECT id, ymin(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d", - pckg, expectationsFactory.getTestSrid() + "SELECT id, ymin(geom) FROM %s where srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -1086,8 +1086,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void z(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getZ(); String hql = format( - "SELECT id, z(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where geometrytype(geom) in ('ST_Point') and srid(geom) = %d", - pckg, + "SELECT id, z(geom) FROM %s where geometrytype(geom) in ('ST_Point') and srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); @@ -1106,8 +1106,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void zmax(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getZMax(); String hql = format( - "SELECT id, zmax(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d", - pckg, expectationsFactory.getTestSrid() + "SELECT id, zmax(geom) FROM %s where srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -1125,8 +1125,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void zmin(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getZMin(); String hql = format( - "SELECT id, zmin(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d", - pckg, expectationsFactory.getTestSrid() + "SELECT id, zmin(geom) FROM %s where srid(geom) = %d", + entityName( pckg ), expectationsFactory.getTestSrid() ); retrieveHQLResultsAndCompare( dbexpected, hql, pckg ); } @@ -1144,16 +1144,16 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions { public void nestedfunction(String pckg) throws SQLException { Map dbexpected = hanaExpectationsFactory.getNestedFunctionInner( expectationsFactory.getTestPolygon() ); String hql = format( - "SELECT id, geom FROM org.hibernate.spatial.integration.%s.GeomEntity g where dwithin(geom, srid(:filter, 0), 1) = true", - pckg + "SELECT id, geom FROM %s g where dwithin(geom, srid(:filter, 0), 1) = true", + entityName( pckg ) ); Map params = createQueryParams( "filter", expectationsFactory.getTestPolygon() ); retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg ); dbexpected = hanaExpectationsFactory.getNestedFunctionOuter( expectationsFactory.getTestPolygon() ); hql = format( - "SELECT id, geom FROM org.hibernate.spatial.integration.%s.GeomEntity g where dwithin(:filter, srid(geom, 0), 1) = true", - pckg + "SELECT id, geom FROM %s g where dwithin(:filter, srid(geom, 0), 1) = true", + entityName( pckg ) ); retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg ); }