mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-06 19:36:03 +00:00
HHH-13083 - Fix matrix tests
This commit is contained in:
parent
89e36cf0e7
commit
d9dd1ebf62
@ -8,7 +8,7 @@
|
||||
hibernate.test.new_metadata_mappings = true
|
||||
hibernate.dialect org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect
|
||||
hibernate.connection.driver_class org.postgresql.Driver
|
||||
hibernate.connection.url jdbc:postgresql://hibpg95.cctaez8ywvn2.eu-west-1.rds.amazonaws.com:5432/hibernate
|
||||
hibernate.connection.url jdbc:postgresql://hbpg96.cctaez8ywvn2.eu-west-1.rds.amazonaws.com:5432/hibernate
|
||||
hibernate.connection.username hibbrtru
|
||||
hibernate.connection.password QilTygcxHwk1
|
||||
|
||||
|
@ -62,7 +62,7 @@ public void dimension(String pckg) throws SQLException {
|
||||
return;
|
||||
}
|
||||
Map<Integer, Integer> dbexpected = expectationsFactory.getDimension();
|
||||
String hql = format( "SELECT id, dimension(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
||||
String hql = format( "SELECT id, dimension(geom) FROM %s", entityName( pckg ) );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public void astext(String pckg) throws SQLException {
|
||||
return;
|
||||
}
|
||||
Map<Integer, String> dbexpected = expectationsFactory.getAsText();
|
||||
String hql = format( "SELECT id, astext(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
||||
String hql = format( "SELECT id, astext(geom) from %s", entityName( pckg ) );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ public void asbinary(String pckg) throws SQLException {
|
||||
return;
|
||||
}
|
||||
Map<Integer, byte[]> dbexpected = expectationsFactory.getAsBinary();
|
||||
String hql = format( "SELECT id, asbinary(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
||||
String hql = format( "SELECT id, asbinary(geom) from %s", entityName( pckg ) );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
@ -121,10 +121,10 @@ public void geometrytype(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, String> dbexpected = expectationsFactory.getGeometryType();
|
||||
String hql = format(
|
||||
"SELECT id, geometrytype(geom) from org.hibernate.spatial.integration.%s.GeomEntity",
|
||||
pckg
|
||||
"SELECT id, geometrytype(geom) from %s",
|
||||
entityName( pckg )
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, entityName( pckg ) );
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -142,7 +142,7 @@ public void srid(String pckg) throws SQLException {
|
||||
return;
|
||||
}
|
||||
Map<Integer, Integer> dbexpected = expectationsFactory.getSrid();
|
||||
String hql = format( "SELECT id, srid(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
||||
String hql = format( "SELECT id, srid(geom) from %s", entityName( pckg ) );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ public void issimple(String pckg) throws SQLException {
|
||||
return;
|
||||
}
|
||||
Map<Integer, Boolean> dbexpected = expectationsFactory.getIsSimple();
|
||||
String hql = format( "SELECT id, issimple(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
||||
String hql = format( "SELECT id, issimple(geom) from %s", entityName( pckg ) );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ public void isempty(String pckg) throws SQLException {
|
||||
return;
|
||||
}
|
||||
Map<Integer, Boolean> dbexpected = expectationsFactory.getIsEmpty();
|
||||
String hql = format( "SELECT id, isEmpty(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
||||
String hql = format( "SELECT id, isEmpty(geom) from %s", entityName( pckg ) );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ public void boundary(String pckg) throws SQLException {
|
||||
return;
|
||||
}
|
||||
Map<Integer, Geometry> dbexpected = expectationsFactory.getBoundary();
|
||||
String hql = format( "SELECT id, boundary(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
||||
String hql = format( "SELECT id, boundary(geom) from %s", entityName( pckg ) );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ public void envelope(String pckg) throws SQLException {
|
||||
return;
|
||||
}
|
||||
Map<Integer, Geometry> dbexpected = expectationsFactory.getEnvelope();
|
||||
String hql = format( "SELECT id, envelope(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
||||
String hql = format( "SELECT id, envelope(geom) from %s", entityName( pckg ) );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
@ -238,9 +238,9 @@ public void within(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Boolean> dbexpected = expectationsFactory.getWithin( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, within(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"SELECT id, within(geom, :filter) from %s " +
|
||||
"where within(geom, :filter) = true and srid(geom) = %d",
|
||||
pckg,
|
||||
entityName( pckg ),
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
@ -263,9 +263,9 @@ public void equals(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Boolean> dbexpected = expectationsFactory.getEquals( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, equals(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"SELECT id, equals(geom, :filter) from %s " +
|
||||
"where equals(geom, :filter) = true and srid(geom) = %d",
|
||||
pckg,
|
||||
entityName( pckg ),
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
@ -288,9 +288,9 @@ public void crosses(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Boolean> dbexpected = expectationsFactory.getCrosses( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, crosses(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"SELECT id, crosses(geom, :filter) from %s " +
|
||||
"where crosses(geom, :filter) = true and srid(geom) = %d",
|
||||
pckg,
|
||||
entityName( pckg ),
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
@ -314,9 +314,9 @@ public void contains(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Boolean> dbexpected = expectationsFactory.getContains( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, contains(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"SELECT id, contains(geom, :filter) from %s " +
|
||||
"where contains(geom, :filter) = true and srid(geom) = %d",
|
||||
pckg,
|
||||
entityName( pckg ),
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
@ -339,9 +339,9 @@ public void disjoint(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Boolean> dbexpected = expectationsFactory.getDisjoint( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, disjoint(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"SELECT id, disjoint(geom, :filter) from %s " +
|
||||
"where disjoint(geom, :filter) = true and srid(geom) = %d",
|
||||
pckg,
|
||||
entityName( pckg ),
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
@ -364,9 +364,9 @@ public void intersects(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Boolean> dbexpected = expectationsFactory.getIntersects( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, intersects(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"SELECT id, intersects(geom, :filter) from %s " +
|
||||
"where intersects(geom, :filter) = true and srid(geom) = %d",
|
||||
pckg,
|
||||
entityName( pckg ),
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
@ -389,9 +389,8 @@ public void overlaps(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Boolean> dbexpected = expectationsFactory.getOverlaps( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, overlaps(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"where overlaps(geom, :filter) = true and srid(geom) = %d",
|
||||
pckg,
|
||||
"SELECT id, overlaps(geom, :filter) from %s where overlaps(geom, :filter) = true and srid(geom) = %d",
|
||||
entityName( pckg ),
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
@ -413,9 +412,8 @@ public void touches(String pckg) throws SQLException {
|
||||
return;
|
||||
}
|
||||
String hql = format(
|
||||
"SELECT id, touches(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"where touches(geom, :filter) = true and srid(geom) = %d",
|
||||
pckg,
|
||||
"SELECT id, touches(geom, :filter) from %s where touches(geom, :filter) = true and srid(geom) = %d",
|
||||
entityName( pckg ),
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<Integer, Boolean> dbexpected = expectationsFactory.getTouches( expectationsFactory.getTestPolygon() );
|
||||
@ -443,9 +441,9 @@ public void relate(String pckg) throws SQLException {
|
||||
matrix
|
||||
);
|
||||
String hql = format(
|
||||
"SELECT id, relate(geom, :filter, :matrix) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"SELECT id, relate(geom, :filter, :matrix) from %s " +
|
||||
"where relate(geom, :filter, :matrix) = true and srid(geom) = %d",
|
||||
pckg,
|
||||
entityName( pckg ),
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
@ -475,8 +473,7 @@ public void distance(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Double> dbexpected = expectationsFactory.getDistance( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, distance(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
||||
"SELECT id, distance(geom, :filter) from %s where srid(geom) = %d", entityName( pckg ), expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
@ -498,8 +495,8 @@ public void buffer(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Geometry> dbexpected = expectationsFactory.getBuffer( Double.valueOf( 1.0 ) );
|
||||
String hql = format(
|
||||
"SELECT id, buffer(geom, :distance) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
||||
"SELECT id, buffer(geom, :distance) from %s where srid(geom) = %d",
|
||||
entityName( pckg ), expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "distance", Double.valueOf( 1.0 ) );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
@ -528,8 +525,8 @@ public void convexhull(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Geometry> dbexpected = expectationsFactory.getConvexHull( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, convexhull(geomunion(geom, :polygon)) from org.hibernate.spatial.integration" +
|
||||
".%s.GeomEntity where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
||||
"SELECT id, convexhull(geomunion(geom, :polygon)) from %s where srid(geom) = %d",
|
||||
entityName( pckg ), expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "polygon", expectationsFactory.getTestPolygon() );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
@ -556,8 +553,8 @@ public void intersection(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Geometry> dbexpected = expectationsFactory.getIntersection( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, intersection(geom, :polygon) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
||||
"SELECT id, intersection(geom, :polygon) from %s where srid(geom) = %d",
|
||||
entityName( pckg ), expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "polygon", expectationsFactory.getTestPolygon() );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
@ -579,8 +576,8 @@ public void difference(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Geometry> dbexpected = expectationsFactory.getDifference( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, difference(geom, :polygon) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
||||
"SELECT id, difference(geom, :polygon) from %s where srid(geom) = %d",
|
||||
entityName( pckg ), expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "polygon", expectationsFactory.getTestPolygon() );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
@ -602,9 +599,8 @@ public void symdifference(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Geometry> dbexpected = expectationsFactory.getSymDifference( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, symdifference(geom, :polygon) from " +
|
||||
"org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
||||
pckg,
|
||||
"SELECT id, symdifference(geom, :polygon) from %s where srid(geom) = %d",
|
||||
entityName( pckg ),
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "polygon", expectationsFactory.getTestPolygon() );
|
||||
@ -627,8 +623,8 @@ public void geomunion(String pckg) throws SQLException {
|
||||
}
|
||||
Map<Integer, Geometry> dbexpected = expectationsFactory.getGeomUnion( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, geomunion(geom, :polygon) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
||||
"SELECT id, geomunion(geom, :polygon) from %s " +
|
||||
"where srid(geom) = %d", entityName( pckg ), expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "polygon", expectationsFactory.getTestPolygon() );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
@ -655,8 +651,8 @@ public void dwithin(String pckg) throws SQLException {
|
||||
);
|
||||
String hql = format(
|
||||
"SELECT id, dwithin(geom, :filter, :distance) from " +
|
||||
"org.hibernate.spatial.integration.%s.GeomEntity where dwithin(geom, :filter, :distance) = true " +
|
||||
"and srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
||||
"%s where dwithin(geom, :filter, :distance) = true " +
|
||||
"and srid(geom) = %d", entityName( pckg ), expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPoint() );
|
||||
if ( getDialect() instanceof OracleSpatial10gDialect ) {
|
||||
@ -693,8 +689,8 @@ public void transform(String pckg) throws SQLException {
|
||||
int epsg = 4324;
|
||||
Map<Integer, Geometry> dbexpected = expectationsFactory.getTransform( epsg );
|
||||
String hql = format(
|
||||
"SELECT id, transform(geom, :epsg) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
||||
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
||||
"SELECT id, transform(geom, :epsg) from %s " +
|
||||
"where srid(geom) = %d", entityName( pckg ), expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "epsg", Integer.valueOf( epsg ) );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
@ -717,7 +713,7 @@ public void extent(String pckg) throws SQLException {
|
||||
}
|
||||
// here we just check if we get a result, and can read it
|
||||
String hql = format(
|
||||
"SELECT id, extent(geom) from org.hibernate.spatial.integration.%s.GeomEntity group by id", pckg
|
||||
"SELECT id, extent(geom) from %s group by id", entityName( pckg )
|
||||
);
|
||||
Map<Integer, Object> hsreceived = new HashMap<Integer, Object>();
|
||||
doInSession( hql, hsreceived, new HashMap<String, Object>() );
|
||||
|
@ -19,7 +19,7 @@
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
import org.hibernate.spatial.criterion.SpatialRestrictions;
|
||||
import org.hibernate.spatial.dialect.hana.HANASpatialDialect;
|
||||
import org.hibernate.spatial.integration.jts.GeomEntity;
|
||||
import org.hibernate.spatial.integration.jts.JtsGeomEntity;
|
||||
import org.hibernate.spatial.testing.SpatialDialectMatcher;
|
||||
import org.hibernate.spatial.testing.SpatialFunctionalTestCase;
|
||||
|
||||
@ -188,7 +188,7 @@ private void retrieveAndCompare(Map<Integer, Boolean> dbexpected, Criterion spat
|
||||
try {
|
||||
session = openSession();
|
||||
tx = session.beginTransaction();
|
||||
Criteria criteria = session.createCriteria( GeomEntity.class );
|
||||
Criteria criteria = session.createCriteria( JtsGeomEntity.class );
|
||||
criteria.add( spatialCriterion );
|
||||
compare( dbexpected, criteria.list() );
|
||||
}
|
||||
@ -207,7 +207,7 @@ private void compare(Map<Integer, Boolean> dbexpected, List list) {
|
||||
for ( Map.Entry<Integer, Boolean> entry : dbexpected.entrySet() ) {
|
||||
if ( entry.getValue() ) {
|
||||
cnt++;
|
||||
if ( !findInList( entry.getKey(), (List<GeomEntity>) list ) ) {
|
||||
if ( !findInList( entry.getKey(), (List<JtsGeomEntity>) list ) ) {
|
||||
fail( String.format( "Expected object with id= %d, but not found in result", entry.getKey() ) );
|
||||
}
|
||||
}
|
||||
@ -216,8 +216,8 @@ private void compare(Map<Integer, Boolean> dbexpected, List list) {
|
||||
LOG.info( String.format( "Found %d objects within testsuite-suite polygon.", cnt ) );
|
||||
}
|
||||
|
||||
private boolean findInList(Integer id, List<GeomEntity> list) {
|
||||
for ( GeomEntity entity : list ) {
|
||||
private boolean findInList(Integer id, List<JtsGeomEntity> list) {
|
||||
for ( JtsGeomEntity entity : list ) {
|
||||
if ( entity.getId().equals( id ) ) {
|
||||
return true;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "geomtest")
|
||||
public class GeomEntity implements GeomEntityLike<Geometry> {
|
||||
public class JtsGeomEntity implements GeomEntityLike<Geometry> {
|
||||
|
||||
|
||||
@Id
|
||||
@ -37,10 +37,10 @@ public class GeomEntity implements GeomEntityLike<Geometry> {
|
||||
|
||||
private Geometry geom;
|
||||
|
||||
public static GeomEntity createFrom(TestDataElement element, Dialect dialect) throws ParseException {
|
||||
public static JtsGeomEntity createFrom(TestDataElement element, Dialect dialect) throws ParseException {
|
||||
WktDecoder decoder = getWktDecoder( dialect );
|
||||
Geometry geom = JTS.to( decoder.decode( element.wkt ) );
|
||||
GeomEntity result = new GeomEntity();
|
||||
JtsGeomEntity result = new JtsGeomEntity();
|
||||
result.setId( element.id );
|
||||
result.setGeom( geom );
|
||||
result.setType( element.type );
|
||||
@ -80,7 +80,7 @@ public boolean equals(Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GeomEntity geomEntity = (GeomEntity) o;
|
||||
JtsGeomEntity geomEntity = (JtsGeomEntity) o;
|
||||
|
||||
if ( !id.equals( geomEntity.id ) ) {
|
||||
return false;
|
@ -26,7 +26,7 @@
|
||||
* are equal to the <code>Geometry</code>s stored.
|
||||
*/
|
||||
@Skip(condition = SpatialDialectMatcher.class, message = "No Spatial Dialect")
|
||||
public class TestStoreRetrieveUsingJTS extends AbstractTestStoreRetrieve<Geometry, GeomEntity> {
|
||||
public class TestStoreRetrieveUsingJTS extends AbstractTestStoreRetrieve<Geometry, JtsGeomEntity> {
|
||||
|
||||
private static final HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
HSMessageLogger.class,
|
||||
@ -45,15 +45,15 @@ protected GeometryEquality<Geometry> getGeometryEquality() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<GeomEntity> getGeomEntityClass() {
|
||||
return GeomEntity.class;
|
||||
protected Class<JtsGeomEntity> getGeomEntityClass() {
|
||||
return JtsGeomEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GeomEntity createFrom(
|
||||
protected JtsGeomEntity createFrom(
|
||||
TestDataElement element, Dialect dialect) {
|
||||
try {
|
||||
return GeomEntity.createFrom( element, dialect );
|
||||
return JtsGeomEntity.createFrom( element, dialect );
|
||||
}
|
||||
catch (ParseException e) {
|
||||
throw new RuntimeException( e );
|
||||
|
@ -20,6 +20,7 @@
|
||||
import org.hibernate.spatial.HSMessageLogger;
|
||||
import org.hibernate.spatial.SpatialDialect;
|
||||
import org.hibernate.spatial.SpatialFunction;
|
||||
import org.hibernate.spatial.integration.jts.JtsGeomEntity;
|
||||
|
||||
import org.hibernate.testing.AfterClassOnce;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
@ -74,7 +75,7 @@ private void cleanUpTest(String pckg) {
|
||||
try {
|
||||
session = openSession();
|
||||
tx = session.beginTransaction();
|
||||
String hql = String.format( "delete from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
||||
String hql = String.format( "delete from %s", entityName(pckg) );
|
||||
Query q = session.createQuery( hql );
|
||||
q.executeUpdate();
|
||||
tx.commit();
|
||||
@ -146,7 +147,7 @@ public String[] getMappings() {
|
||||
protected Class<?>[] getAnnotatedClasses() {
|
||||
return new Class<?>[] {
|
||||
org.hibernate.spatial.integration.geolatte.GeomEntity.class,
|
||||
org.hibernate.spatial.integration.jts.GeomEntity.class
|
||||
JtsGeomEntity.class
|
||||
};
|
||||
}
|
||||
|
||||
@ -253,4 +254,12 @@ else if ( expected instanceof Geometry ) {
|
||||
}
|
||||
}
|
||||
|
||||
protected String entityName(String pckg) {
|
||||
if (JTS.equalsIgnoreCase( pckg )) {
|
||||
return "org.hibernate.spatial.integration.jts.JtsGeomEntity";
|
||||
} else {
|
||||
return "org.hibernate.spatial.integration.geolatte.GeomEntity";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user