HHH-14442 Fix checkstyle errors
This commit is contained in:
parent
f0a81898dc
commit
650a703e1c
|
@ -7,10 +7,11 @@
|
|||
|
||||
package org.hibernate.spatial;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.type.descriptor.WrapperOptions;
|
||||
import org.hibernate.type.descriptor.java.AbstractTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry;
|
||||
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.io.ParseException;
|
||||
|
@ -49,7 +50,7 @@ public class JTSGeometryJavaTypeDescriptor extends AbstractTypeDescriptor<Geomet
|
|||
return reader.read( string );
|
||||
}
|
||||
catch (ParseException e) {
|
||||
throw new RuntimeException( String.format( "Can't parse string %s as WKT", string ) );
|
||||
throw new RuntimeException( String.format( Locale.ENGLISH, "Can't parse string %s as WKT", string ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@ import org.hibernate.spatial.SpatialRelation;
|
|||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
/**
|
||||
* @author David Adler, Adtech Geospatial
|
||||
* creation-date: 5/22/2014
|
||||
|
@ -230,22 +228,9 @@ public class DB2SpatialDialect extends DB2Dialect implements SpatialDialect {
|
|||
// Register non-SFS functions listed in Hibernate Spatial
|
||||
registerFunction( "dwithin", new DWithinFunction() );
|
||||
|
||||
// // The srid parameter needs to be explicitly cast to INTEGER to avoid a -245 SQLCODE,
|
||||
// // ambiguous parameter.
|
||||
// registerFunction( "transform", new SQLFunctionTemplate(
|
||||
// geolatteGemetryType,
|
||||
// "DB2GSE.ST_Transform(?1, CAST (?2 AS INTEGER))"
|
||||
// ) );
|
||||
|
||||
registerFunction( "geomFromText", new StandardSQLFunction(
|
||||
"DB2GSE.ST_GeomFromText"
|
||||
) );
|
||||
|
||||
// // Register spatial aggregate function
|
||||
// registerFunction( "extent", new SQLFunctionTemplate(
|
||||
// geolatteGemetryType,
|
||||
// "db2gse.ST_GetAggrResult(MAX(db2gse.st_BuildMBRAggr(?1)))"
|
||||
// ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -271,7 +256,7 @@ public class DB2SpatialDialect extends DB2Dialect implements SpatialDialect {
|
|||
@Override
|
||||
public String getSpatialAggregateSQL(String columnName, int type) {
|
||||
switch ( type ) {
|
||||
case SpatialAggregate.EXTENT: // same as extent function above???
|
||||
case SpatialAggregate.EXTENT:
|
||||
return "db2gse.ST_GetAggrResult(MAX(db2gse.st_BuildMBRAggr(" + columnName + ")))";
|
||||
case SpatialAggregate.UNION:
|
||||
return "db2gse.ST_GetAggrResult(MAX(db2gse.st_BuildUnionAggr(" + columnName + ")))";
|
||||
|
@ -304,7 +289,8 @@ public class DB2SpatialDialect extends DB2Dialect implements SpatialDialect {
|
|||
if ( spatialRelation != SpatialRelation.DISJOINT ) {
|
||||
return " db2gse." + relationName + "(" + columnName + ", ?) = 1 SELECTIVITY .0001";
|
||||
}
|
||||
else { // SELECTIVITY not supported for ST_Disjoint UDF
|
||||
else {
|
||||
// SELECTIVITY not supported for ST_Disjoint UDF
|
||||
return " db2gse." + relationName + "(" + columnName + ", ?) = 1";
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +319,7 @@ public class DB2SpatialDialect extends DB2Dialect implements SpatialDialect {
|
|||
|
||||
public String render(Type firstArgumentType, final List args, final SessionFactoryImplementor factory) {
|
||||
StringBuilder sb = new StringBuilder( "db2gse.ST_Intersects( " );
|
||||
sb.append( (String)args.get(0) ) //
|
||||
sb.append( (String) args.get( 0 ) )
|
||||
.append( ", db2gse.ST_Buffer(" )
|
||||
.append( (String) args.get( 1 ) )
|
||||
.append( ", " )
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
package org.hibernate.spatial.dialect.h2geodb;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -177,7 +178,7 @@ public class GeoDBDialect extends H2Dialect implements SpatialDialect {
|
|||
Type firstArgumentType, List arguments, SessionFactoryImplementor sessionFactory) {
|
||||
int argumentCount = arguments.size();
|
||||
if ( argumentCount != 2 ) {
|
||||
throw new QueryException( String.format( "2 arguments expected, received %d", argumentCount ) );
|
||||
throw new QueryException( String.format( Locale.ENGLISH,"2 arguments expected, received %d", argumentCount ) );
|
||||
}
|
||||
|
||||
return Stream.of(
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.sql.Connection;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.geolatte.geom.ByteBuffer;
|
||||
import org.geolatte.geom.ByteOrder;
|
||||
|
@ -23,6 +24,10 @@ public class HANASpatialUtils {
|
|||
|
||||
private static final int POSTGIS_SRID_FLAG = 0x20000000;
|
||||
|
||||
private HANASpatialUtils(){
|
||||
//prevent instantiation of Utility class
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public static Geometry<?> toGeometry(ResultSet rs, String name) throws SQLException {
|
||||
ByteBuffer buffer = toByteBuffer( rs.getObject( name ) );
|
||||
|
@ -36,7 +41,7 @@ public class HANASpatialUtils {
|
|||
String columnName = null;
|
||||
for ( int i = 1; i <= rs.getMetaData().getColumnCount(); i++ ) {
|
||||
if ( name.equals( rs.getMetaData().getColumnLabel( i ) ) ||
|
||||
name.toUpperCase().equals( rs.getMetaData().getColumnLabel( i ) ) ) {
|
||||
name.toUpperCase( Locale.ENGLISH ).equals( rs.getMetaData().getColumnLabel( i ) ) ) {
|
||||
tableName = rs.getMetaData().getTableName( i );
|
||||
columnName = rs.getMetaData().getColumnName( i );
|
||||
}
|
||||
|
@ -80,17 +85,20 @@ public class HANASpatialUtils {
|
|||
}
|
||||
|
||||
private static ByteBuffer addCrsId(byte[] wkb, byte orderByte, int typeCode, int crsId) {
|
||||
ByteBuffer buffer = ByteBuffer.allocate( wkb.length + 4 ); // original capacity + 4 bytes for the CRS ID
|
||||
// original capacity + 4 bytes for the CRS ID
|
||||
ByteBuffer buffer = ByteBuffer.allocate( wkb.length + 4 );
|
||||
buffer.setByteOrder( ByteOrder.valueOf( orderByte ) );
|
||||
|
||||
buffer.put( orderByte ); // write byte order
|
||||
// write byte order
|
||||
buffer.put( orderByte );
|
||||
|
||||
buffer.putUInt( typeCode | POSTGIS_SRID_FLAG ); // set SRID flag
|
||||
// set SRID flag
|
||||
buffer.putUInt( typeCode | POSTGIS_SRID_FLAG );
|
||||
|
||||
buffer.putInt( crsId ); // write CRS ID
|
||||
// write CRS ID
|
||||
buffer.putInt( crsId );
|
||||
|
||||
// write remaining data
|
||||
|
||||
for ( int i = 5; i < wkb.length; i++ ) {
|
||||
buffer.put( wkb[i] );
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.spatial.dialect.mysql;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
|
@ -93,7 +94,10 @@ public class MySQLSpatialDialect extends MySQLDialect implements SpatialDialect
|
|||
|
||||
@Override
|
||||
public String getDWithinSQL(String columnName) {
|
||||
throw new UnsupportedOperationException( String.format( "Mysql doesn't support the Dwithin function" ) );
|
||||
throw new UnsupportedOperationException( String.format(
|
||||
Locale.ENGLISH,
|
||||
"Mysql doesn't support the Dwithin function"
|
||||
) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,11 +42,10 @@ class OracleSDOSupport implements SpatialDialect, Serializable, WithCustomJPAFil
|
|||
OracleSpatial10gDialect.class.getName()
|
||||
);
|
||||
|
||||
private final boolean isOgcStrict;
|
||||
|
||||
private final SpatialFunctionsRegistry sdoFunctions;
|
||||
|
||||
OracleSDOSupport(boolean isOgcStrict) {
|
||||
this.isOgcStrict = isOgcStrict;
|
||||
this.sdoFunctions = new OracleSpatialFunctions( isOgcStrict, this );
|
||||
}
|
||||
|
||||
|
@ -262,7 +261,7 @@ class OracleSDOSupport implements SpatialDialect, Serializable, WithCustomJPAFil
|
|||
aggregateFunction.append( "SDOAGGRTYPE(" );
|
||||
}
|
||||
aggregateFunction.append( columnName );
|
||||
// TODO tolerance must by configurable
|
||||
// Can we make tolerance configurable
|
||||
if ( sa.isAggregateType() ) {
|
||||
aggregateFunction.append( ", " ).append( .001 ).append( ")" );
|
||||
}
|
||||
|
@ -292,7 +291,7 @@ class OracleSDOSupport implements SpatialDialect, Serializable, WithCustomJPAFil
|
|||
*/
|
||||
@Override
|
||||
public String getHavingSridSQL(String columnName) {
|
||||
return String.format( " (MDSYS.ST_GEOMETRY(%s).ST_SRID() = ?)", columnName , Locale.US);
|
||||
return String.format( Locale.ENGLISH, " (MDSYS.ST_GEOMETRY(%s).ST_SRID() = ?)", columnName );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -306,7 +305,12 @@ class OracleSDOSupport implements SpatialDialect, Serializable, WithCustomJPAFil
|
|||
*/
|
||||
@Override
|
||||
public String getIsEmptySQL(String columnName, boolean isEmpty) {
|
||||
return String.format( "( MDSYS.ST_GEOMETRY(%s).ST_ISEMPTY() = %d )", columnName, isEmpty ? 1 : 0 , Locale.US);
|
||||
return String.format(
|
||||
Locale.ENGLISH,
|
||||
"( MDSYS.ST_GEOMETRY(%s).ST_ISEMPTY() = %d )",
|
||||
columnName,
|
||||
isEmpty ? 1 : 0
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.spatial.dialect.postgis;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -226,7 +227,11 @@ class PostgisFunctions extends SpatialFunctionsRegistry {
|
|||
Type firstArgumentType, List arguments, SessionFactoryImplementor sessionFactory) {
|
||||
int argumentCount = arguments.size();
|
||||
if ( argumentCount != 2 ) {
|
||||
throw new QueryException( String.format( "2 arguments expected, received %d", argumentCount ) );
|
||||
throw new QueryException( String.format(
|
||||
Locale.ENGLISH,
|
||||
"2 arguments expected, received %d",
|
||||
argumentCount
|
||||
) );
|
||||
}
|
||||
|
||||
return Stream.of(
|
||||
|
|
|
@ -1,17 +1,28 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.dialect.hana;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.spatial.HSMessageLogger;
|
||||
import org.hibernate.spatial.integration.TestSpatialFunctions;
|
||||
import org.hibernate.spatial.testing.dialects.hana.HANAExpectationsFactory;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
@ -24,7 +35,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
|
||||
private static final HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
HSMessageLogger.class,
|
||||
TestHANASpatialFunctions.class.getName() );
|
||||
TestHANASpatialFunctions.class.getName()
|
||||
);
|
||||
|
||||
protected HANAExpectationsFactory hanaExpectationsFactory;
|
||||
|
||||
|
@ -52,8 +64,10 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
public void alphashape(String pckg) throws SQLException {
|
||||
Map<Integer, Geometry> 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 );
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -71,7 +85,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> 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 );
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -151,7 +166,10 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
|
||||
public void assvgaggr(String pckg) throws SQLException {
|
||||
Map<Integer, String> dbexpected = hanaExpectationsFactory.getAsSVGAggr();
|
||||
String hql = format( "SELECT cast(count(g) as int), assvgaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g", pckg );
|
||||
String hql = format(
|
||||
"SELECT cast(count(g) as int), assvgaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -199,7 +217,10 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
|
||||
public void convexhullaggr(String pckg) throws SQLException {
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getConvexHullAggr();
|
||||
String hql = format( "SELECT cast(count(g) as int), convexhullaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g", pckg );
|
||||
String hql = format(
|
||||
"SELECT cast(count(g) as int), convexhullaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -215,7 +236,10 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
|
||||
public void centroid(String pckg) throws SQLException {
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getCentroid();
|
||||
String hql = format( "SELECT id, centroid(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_Polygon'", pckg );
|
||||
String hql = format(
|
||||
"SELECT id, centroid(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_Polygon'",
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -249,7 +273,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Boolean> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
@ -268,7 +294,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Boolean> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
@ -285,8 +313,10 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
|
||||
public void endpoint(String pckg) throws SQLException {
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getEndPoint();
|
||||
String hql = format( "SELECT id, endpoint(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_LineString'",
|
||||
pckg );
|
||||
String hql = format(
|
||||
"SELECT id, endpoint(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_LineString'",
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -302,7 +332,10 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
|
||||
public void envelopeaggr(String pckg) throws SQLException {
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getEnvelopeAggr();
|
||||
String hql = format( "SELECT cast(count(g) as int), envelopeaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g", pckg );
|
||||
String hql = format(
|
||||
"SELECT cast(count(g) as int), envelopeaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -318,8 +351,10 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
|
||||
public void exteriorring(String pckg) throws SQLException {
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getExteriorRing();
|
||||
String hql = format( "SELECT id, exteriorring(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_Polygon'",
|
||||
pckg );
|
||||
String hql = format(
|
||||
"SELECT id, exteriorring(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_Polygon'",
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -337,8 +372,11 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
WKBWriter writer = new WKBWriter( 2, true );
|
||||
byte[] ewkb = writer.write( expectationsFactory.getTestPolygon() );
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getGeomFromEWKB( ewkb );
|
||||
String hql = format( "SELECT 1, cast(geomfromewkb(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
getGeometryTypeFromPackage( pckg ), pckg );
|
||||
String hql = format(
|
||||
"SELECT 1, cast(geomfromewkb(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
getGeometryTypeFromPackage( pckg ),
|
||||
pckg
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "param", ewkb );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
@ -357,8 +395,11 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
WKTWriter writer = new WKTWriter();
|
||||
String ewkt = "SRID=" + expectationsFactory.getTestSrid() + ";" + writer.write( expectationsFactory.getTestPolygon() );
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getGeomFromEWKT( ewkt );
|
||||
String hql = format( "SELECT 1, cast(geomfromewkt(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
getGeometryTypeFromPackage( pckg ), pckg );
|
||||
String hql = format(
|
||||
"SELECT 1, cast(geomfromewkt(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
getGeometryTypeFromPackage( pckg ),
|
||||
pckg
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "param", ewkt );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
@ -376,8 +417,11 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
public void geomfromtext(String pckg) throws SQLException {
|
||||
String text = expectationsFactory.getTestPolygon().toText();
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getGeomFromText( text );
|
||||
String hql = format( "SELECT 1, cast(geomfromtext(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
getGeometryTypeFromPackage( pckg ), pckg );
|
||||
String hql = format(
|
||||
"SELECT 1, cast(geomfromtext(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
getGeometryTypeFromPackage( pckg ),
|
||||
pckg
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "param", text );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
@ -396,8 +440,11 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
WKBWriter writer = new WKBWriter( 2, false );
|
||||
byte[] wkb = writer.write( expectationsFactory.getTestPolygon() );
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getGeomFromWKB( wkb );
|
||||
String hql = format( "SELECT 1, cast(geomfromwkb(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
getGeometryTypeFromPackage( pckg ), pckg );
|
||||
String hql = format(
|
||||
"SELECT 1, cast(geomfromwkb(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
getGeometryTypeFromPackage( pckg ),
|
||||
pckg
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "param", wkb );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
@ -416,8 +463,11 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
WKTWriter writer = new WKTWriter();
|
||||
String wkt = writer.write( expectationsFactory.getTestPolygon() );
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getGeomFromWKT( wkt );
|
||||
String hql = format( "SELECT 1, cast(geomfromwkt(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
getGeometryTypeFromPackage( pckg ), pckg );
|
||||
String hql = format(
|
||||
"SELECT 1, cast(geomfromwkt(:param) as %s) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
getGeometryTypeFromPackage( pckg ),
|
||||
pckg
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "param", wkt );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
@ -436,7 +486,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Geometry> 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'",
|
||||
getGeometryTypeFromPackage( pckg ), pckg );
|
||||
getGeometryTypeFromPackage( pckg ),
|
||||
pckg
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "n", 1 );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
@ -455,7 +507,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Geometry> 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'",
|
||||
getGeometryTypeFromPackage( pckg ), pckg );
|
||||
getGeometryTypeFromPackage( pckg ),
|
||||
pckg
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "n", 1 );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
@ -472,7 +526,10 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
|
||||
public void intersectionaggr(String pckg) throws SQLException {
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getIntersectionAggr();
|
||||
String hql = format( "SELECT cast(count(g) as int), intersectionaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g", pckg );
|
||||
String hql = format(
|
||||
"SELECT cast(count(g) as int), intersectionaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -487,11 +544,15 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
}
|
||||
|
||||
public void intersectsrect(String pckg) throws SQLException {
|
||||
Map<Integer, Boolean> dbexpected = hanaExpectationsFactory.getIntersectsRect( (Point) expectationsFactory.getTestPoint().reverse(),
|
||||
expectationsFactory.getTestPoint() );
|
||||
Map<Integer, Boolean> dbexpected = hanaExpectationsFactory.getIntersectsRect(
|
||||
(Point) expectationsFactory.getTestPoint().reverse(),
|
||||
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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "pmin", expectationsFactory.getTestPoint().reverse() );
|
||||
params.put( "pmax", expectationsFactory.getTestPoint() );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
|
@ -511,7 +572,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Boolean> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -529,7 +592,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Boolean> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -547,7 +612,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Boolean> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -565,7 +632,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Boolean> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -583,7 +652,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Boolean> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -601,7 +672,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -619,7 +692,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -637,7 +712,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> dbexpected = hanaExpectationsFactory.getMMax();
|
||||
String hql = format(
|
||||
"SELECT id, mmax(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
||||
pckg, expectationsFactory.getTestSrid() );
|
||||
pckg, expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -655,7 +731,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> dbexpected = hanaExpectationsFactory.getMMin();
|
||||
String hql = format(
|
||||
"SELECT id, mmin(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
||||
pckg, expectationsFactory.getTestSrid() );
|
||||
pckg, expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -673,7 +750,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Integer> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -691,7 +770,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Integer> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -709,7 +790,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Integer> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -727,7 +810,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Integer> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -745,7 +830,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Boolean> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
@ -764,7 +851,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -782,7 +871,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Geometry> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -800,17 +891,21 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Geometry> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
Map<String, Object> params = createQueryParams( "n", 1 );
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
||||
@Test(expected = SQLException.class) // ST_GEOMETRY columns are not supported
|
||||
// ST_GEOMETRY columns are not supported
|
||||
@Test(expected = SQLException.class)
|
||||
public void test_snaptogrid_on_jts() throws SQLException {
|
||||
snaptogrid( JTS );
|
||||
}
|
||||
|
||||
@Test(expected = SQLException.class) // ST_GEOMETRY columns are not supported
|
||||
// ST_GEOMETRY columns are not supported
|
||||
@Test(expected = SQLException.class)
|
||||
public void test_snaptogrid_on_geolatte() throws SQLException {
|
||||
snaptogrid( GEOLATTE );
|
||||
}
|
||||
|
@ -819,7 +914,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getSnapToGrid();
|
||||
String hql = format(
|
||||
"SELECT id, snaptogrid(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
||||
pckg, expectationsFactory.getTestSrid() );
|
||||
pckg, expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -835,8 +931,10 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
|
||||
public void startpoint(String pckg) throws SQLException {
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getStartPoint();
|
||||
String hql = format( "SELECT id, startpoint(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_LineString'",
|
||||
pckg );
|
||||
String hql = format(
|
||||
"SELECT id, startpoint(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g where geometrytype(geom) = 'ST_LineString'",
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -852,7 +950,10 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
|
||||
public void unionaggr(String pckg) throws SQLException {
|
||||
Map<Integer, Geometry> dbexpected = hanaExpectationsFactory.getUnionAggr();
|
||||
String hql = format( "SELECT cast(count(g) as int), unionaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g", pckg );
|
||||
String hql = format(
|
||||
"SELECT cast(count(g) as int), unionaggr(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity g",
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -870,7 +971,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -888,7 +991,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> dbexpected = hanaExpectationsFactory.getXMax();
|
||||
String hql = format(
|
||||
"SELECT id, xmax(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
||||
pckg, expectationsFactory.getTestSrid() );
|
||||
pckg, expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -906,7 +1010,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> dbexpected = hanaExpectationsFactory.getXMin();
|
||||
String hql = format(
|
||||
"SELECT id, xmin(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
||||
pckg, expectationsFactory.getTestSrid() );
|
||||
pckg, expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -924,7 +1029,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -942,7 +1049,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> dbexpected = hanaExpectationsFactory.getYMax();
|
||||
String hql = format(
|
||||
"SELECT id, ymax(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
||||
pckg, expectationsFactory.getTestSrid() );
|
||||
pckg, expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -960,7 +1068,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> dbexpected = hanaExpectationsFactory.getYMin();
|
||||
String hql = format(
|
||||
"SELECT id, ymin(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
||||
pckg, expectationsFactory.getTestSrid() );
|
||||
pckg, expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -978,7 +1087,9 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> 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, expectationsFactory.getTestSrid() );
|
||||
pckg,
|
||||
expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -996,7 +1107,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> dbexpected = hanaExpectationsFactory.getZMax();
|
||||
String hql = format(
|
||||
"SELECT id, zmax(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
||||
pckg, expectationsFactory.getTestSrid() );
|
||||
pckg, expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -1014,7 +1126,8 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Double> dbexpected = hanaExpectationsFactory.getZMin();
|
||||
String hql = format(
|
||||
"SELECT id, zmin(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
||||
pckg, expectationsFactory.getTestSrid() );
|
||||
pckg, expectationsFactory.getTestSrid()
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
||||
}
|
||||
|
||||
|
@ -1032,14 +1145,16 @@ public class TestHANASpatialFunctions extends TestSpatialFunctions {
|
|||
Map<Integer, Geometry> 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 );
|
||||
pckg
|
||||
);
|
||||
Map<String, Object> 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 );
|
||||
pckg
|
||||
);
|
||||
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ import static org.junit.Assert.assertEquals;
|
|||
*/
|
||||
public class PostgisUnmarshalTest {
|
||||
|
||||
private CoordinateReferenceSystem<G2D> crs = CoordinateReferenceSystems.WGS84;
|
||||
private Geometry<G2D> geom = linestring( crs, g( 6.123, 53.234 ), g( 6.133, 53.244 ) );
|
||||
private Geometry<C2D> geomNoSrid = linestring(
|
||||
private final CoordinateReferenceSystem<G2D> crs = CoordinateReferenceSystems.WGS84;
|
||||
private final Geometry<G2D> geom = linestring( crs, g( 6.123, 53.234 ), g( 6.133, 53.244 ) );
|
||||
private final Geometry<C2D> geomNoSrid = linestring(
|
||||
CoordinateReferenceSystems.PROJECTED_2D_METER,
|
||||
c( 6.123, 53.234 ),
|
||||
c( 6.133, 53.244 )
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.integration;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -66,7 +73,7 @@ public abstract class AbstractTestStoreRetrieve<G, E extends GeomEntityLike<G>>
|
|||
tx = session.beginTransaction();
|
||||
for ( E storedEntity : stored.values() ) {
|
||||
id = storedEntity.getId();
|
||||
E retrievedEntity = (E) session.get( getGeomEntityClass(), id );
|
||||
E retrievedEntity = session.get( getGeomEntityClass(), id );
|
||||
G retrievedGeometry = retrievedEntity.getGeom();
|
||||
G storedGeometry = storedEntity.getGeom();
|
||||
String msg = createFailureMessage( storedEntity.getId(), storedGeometry, retrievedGeometry );
|
||||
|
@ -110,7 +117,6 @@ public abstract class AbstractTestStoreRetrieve<G, E extends GeomEntityLike<G>>
|
|||
for ( TestDataElement element : testData ) {
|
||||
id = element.id;
|
||||
tx = session.beginTransaction();
|
||||
;
|
||||
E entity = createFrom( element, dialect );
|
||||
stored.put( entity.getId(), entity );
|
||||
session.save( entity );
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.integration;
|
||||
|
||||
import org.hibernate.dialect.AbstractHANADialect;
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.integration;
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,7 @@ import static org.junit.Assert.fail;
|
|||
@SkipForDialect(value = HANASpatialDialect.class, comment = "The HANA dialect is tested via org.hibernate.spatial.dialect.hana.TestHANASpatialFunctions", jiraKey = "HHH-12426")
|
||||
public class TestGeolatteSpatialPredicates extends SpatialFunctionalTestCase {
|
||||
|
||||
private static HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
private static final HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
HSMessageLogger.class,
|
||||
TestGeolatteSpatialPredicates.class.getName()
|
||||
);
|
||||
|
|
|
@ -41,7 +41,7 @@ import static org.junit.Assert.fail;
|
|||
@SkipForDialect(value = HANASpatialDialect.class, comment = "The HANA dialect is tested via org.hibernate.spatial.dialect.hana.TestHANASpatialFunctions", jiraKey = "HHH-12426")
|
||||
public class TestJTSSpatialPredicates extends SpatialFunctionalTestCase {
|
||||
|
||||
private static HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
private static final HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
HSMessageLogger.class,
|
||||
TestJTSSpatialPredicates.class.getName()
|
||||
);
|
||||
|
|
|
@ -473,7 +473,9 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|||
}
|
||||
Map<Integer, Double> dbexpected = expectationsFactory.getDistance( expectationsFactory.getTestPolygon() );
|
||||
String hql = format(
|
||||
"SELECT id, distance(geom, :filter) from %s where srid(geom) = %d", entityName( 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 );
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.hibernate.spatial.integration;
|
|||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
|
@ -36,7 +37,7 @@ import static org.junit.Assert.fail;
|
|||
@SkipForDialect(value = HANASpatialDialect.class, comment = "The HANA dialect is tested via org.hibernate.spatial.dialect.hana.TestHANASpatialFunctions", jiraKey = "HHH-12426")
|
||||
public class TestSpatialRestrictions extends SpatialFunctionalTestCase {
|
||||
|
||||
private static HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
private static final HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
HSMessageLogger.class,
|
||||
TestSpatialRestrictions.class.getName()
|
||||
);
|
||||
|
@ -208,7 +209,11 @@ public class TestSpatialRestrictions extends SpatialFunctionalTestCase {
|
|||
if ( entry.getValue() ) {
|
||||
cnt++;
|
||||
if ( !findInList( entry.getKey(), (List<JtsGeomEntity>) list ) ) {
|
||||
fail( String.format( "Expected object with id= %d, but not found in result", entry.getKey() ) );
|
||||
fail( String.format(
|
||||
Locale.ENGLISH,
|
||||
"Expected object with id= %d, but not found in result",
|
||||
entry.getKey()
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,11 +88,7 @@ public class GeomEntity implements GeomEntityLike<Geometry> {
|
|||
|
||||
GeomEntity geomEntity = (GeomEntity) o;
|
||||
|
||||
if ( !id.equals( geomEntity.id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return id.equals( geomEntity.id );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.geolatte.geom.codec.WktDecodeException;
|
|||
@Skip(condition = SpatialDialectMatcher.class, message = "No Spatial Dialect")
|
||||
public class TestStoreRetrieveUsingGeolatte extends AbstractTestStoreRetrieve<Geometry, GeomEntity> {
|
||||
|
||||
private static HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
private static final HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
HSMessageLogger.class,
|
||||
TestStoreRetrieveUsingGeolatte.class.getName()
|
||||
);
|
||||
|
|
|
@ -82,11 +82,7 @@ public class JtsGeomEntity implements GeomEntityLike<Geometry> {
|
|||
|
||||
JtsGeomEntity geomEntity = (JtsGeomEntity) o;
|
||||
|
||||
if ( !id.equals( geomEntity.id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return id.equals( geomEntity.id );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -793,8 +793,7 @@ public abstract class AbstractExpectationsFactory {
|
|||
case STRING:
|
||||
expected.put( id, (T) results.getString( 2 ) );
|
||||
break;
|
||||
case INTEGER:
|
||||
{
|
||||
case INTEGER: {
|
||||
Long value = Long.valueOf( results.getLong( 2 ) );
|
||||
if ( results.wasNull() ) {
|
||||
value = null; // This is required because the Hibernate BasicExtractor also checks ResultSet#wasNull which can lead to a mismatch between the expected and the actual results
|
||||
|
@ -802,8 +801,7 @@ public abstract class AbstractExpectationsFactory {
|
|||
expected.put( id, (T) value );
|
||||
}
|
||||
break;
|
||||
case DOUBLE:
|
||||
{
|
||||
case DOUBLE: {
|
||||
Double value = Double.valueOf( results.getDouble( 2 ) );
|
||||
if ( results.wasNull() ) {
|
||||
value = null; //this is required because SQL Server converts automatically null to 0.0
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.io.InputStream;
|
|||
import java.io.InputStreamReader;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -42,7 +43,7 @@ import org.geolatte.geom.codec.WktDecoder;
|
|||
public class DataSourceUtils {
|
||||
|
||||
|
||||
private static HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
private static final HSMessageLogger LOG = Logger.getMessageLogger(
|
||||
HSMessageLogger.class,
|
||||
DataSourceUtils.class.getName()
|
||||
);
|
||||
|
@ -257,7 +258,7 @@ public class DataSourceUtils {
|
|||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(
|
||||
new InputStreamReader( is, Charset.forName( "UTF-8" ) )
|
||||
new InputStreamReader( is, StandardCharsets.UTF_8 )
|
||||
);
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing;
|
||||
|
||||
import org.geolatte.geom.Geometry;
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing;
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,7 +29,7 @@ public interface NativeSQLStatement {
|
|||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public PreparedStatement prepare(Connection connection) throws SQLException;
|
||||
PreparedStatement prepare(Connection connection) throws SQLException;
|
||||
|
||||
public String toString();
|
||||
String toString();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ public interface SQLExpressionTemplate {
|
|||
*
|
||||
* @return an insert SQL for testDataElement
|
||||
*/
|
||||
public String toInsertSql(TestDataElement testDataElement);
|
||||
String toInsertSql(TestDataElement testDataElement);
|
||||
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
|
|||
"Failure on testsuite-suite for case " + id,
|
||||
geometryEquality.test(
|
||||
(Geometry) expected,
|
||||
(Geometry) org.geolatte.geom.jts.JTS.to( (org.geolatte.geom.Geometry) received )
|
||||
org.geolatte.geom.jts.JTS.to( (org.geolatte.geom.Geometry) received )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -257,7 +257,8 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
|
|||
protected String entityName(String pckg) {
|
||||
if ( JTS.equalsIgnoreCase( pckg ) ) {
|
||||
return "org.hibernate.spatial.integration.jts.JtsGeomEntity";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return "org.hibernate.spatial.integration.geolatte.GeomEntity";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ public class TestData implements List<TestDataElement> {
|
|||
protected TestData() {
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public static TestData fromFile(String fileName) {
|
||||
TestDataReader reader = new TestDataReader();
|
||||
return fromFile( fileName, reader );
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.hibernate.spatial.testing.dialects.sqlserver.SQLServerTestSupport;
|
|||
*/
|
||||
public class TestSupportFactories {
|
||||
|
||||
private static TestSupportFactories instance = new TestSupportFactories();
|
||||
private static final TestSupportFactories instance = new TestSupportFactories();
|
||||
|
||||
private TestSupportFactories() {
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@ public class GeometryConverterTest extends BaseUnitTestCase {
|
|||
.addAnnotatedClass( MyEntity.class );
|
||||
final MetadataBuilderImplementor metadataBuilder = (MetadataBuilderImplementor) metadataSources.getMetadataBuilder();
|
||||
|
||||
try ( final SessionFactoryImplementor sessionFactory =
|
||||
(SessionFactoryImplementor) metadataBuilder.build().buildSessionFactory() ) {
|
||||
try (final SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) metadataBuilder.build()
|
||||
.buildSessionFactory()) {
|
||||
|
||||
final TypeConfiguration typeConfiguration = sessionFactory.getMetamodel().getTypeConfiguration();
|
||||
|
||||
|
|
|
@ -1,24 +1,9 @@
|
|||
/*
|
||||
* This file is part of Hibernate Spatial, an extension to the
|
||||
* hibernate ORM solution for spatial (geographic) data.
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright © 2014 Adtech Geospatial
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.db2;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
|
|
@ -1,24 +1,9 @@
|
|||
/*
|
||||
* This file is part of Hibernate Spatial, an extension to the
|
||||
* hibernate ORM solution for spatial (geographic) data.
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright © 2014 Adtech Geospatial
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.db2;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
|
|
@ -1,24 +1,9 @@
|
|||
/*
|
||||
* This file is part of Hibernate Spatial, an extension to the
|
||||
* hibernate ORM solution for spatial (geographic) data.
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright © 2014 Adtech Geospatial
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.db2;
|
||||
|
||||
import org.hibernate.spatial.testing.SQLExpressionTemplate;
|
||||
|
|
|
@ -1,22 +1,8 @@
|
|||
/*
|
||||
* This file is part of Hibernate Spatial, an extension to the
|
||||
* hibernate ORM solution for spatial (geographic) data.
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright © 2014 Adtech Geospatial
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.db2;
|
||||
|
@ -35,8 +21,8 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
|||
public class DB2TestSupport extends TestSupport {
|
||||
|
||||
public TestData createTestData(BaseCoreFunctionalTestCase testcase) {
|
||||
if ( "org.hibernate.spatial.integration.TestSpatialFunctions".equals( testcase.getClass()
|
||||
.getCanonicalName() ) ) {
|
||||
if ( "org.hibernate.spatial.integration.TestSpatialFunctions".equals(
|
||||
testcase.getClass().getCanonicalName() ) ) {
|
||||
return TestData.fromFile( "db2/test-db2nozm-only-polygon.xml" );
|
||||
}
|
||||
return TestData.fromFile( "db2/test-db2nozm-data-set.xml" );
|
||||
|
|
|
@ -44,7 +44,7 @@ public class GeoDBDataSourceUtils extends DataSourceUtils {
|
|||
String errorMsg = "Problem initializing GeoDB.";
|
||||
try {
|
||||
Class<?> geoDB = Thread.currentThread().getContextClassLoader().loadClass( "geodb.GeoDB" );
|
||||
Method m = geoDB.getDeclaredMethod( "InitGeoDB", new Class[] { Connection.class } );
|
||||
Method m = geoDB.getDeclaredMethod( "InitGeoDB", Connection.class );
|
||||
m.invoke( null, conn );
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
|
|
|
@ -38,7 +38,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
protected NativeSQLStatement createNativeBufferStatement(Double distance) {
|
||||
return createNativeSQLStatement(
|
||||
"select t.id, t.geom.ST_Buffer(?) from GeomTest t where t.geom.ST_SRID() = " + getTestSrid(),
|
||||
new Object[]{ distance } );
|
||||
new Object[] { distance }
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +47,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Union(ST_GeomFromText(?, " + getTestSrid() + ")).ST_ConvexHull().ST_AsEWKB() from GeomTest t where t.geom.ST_SRID() = "
|
||||
+ getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,7 +56,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Intersection(ST_GeomFromText(?, " + getTestSrid() + ")).ST_AsEWKB() from GeomTest t where t.geom.ST_SRID() = "
|
||||
+ getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,7 +65,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Difference(ST_GeomFromText(?, " + getTestSrid() + ")).ST_AsEWKB() from GeomTest t where t.geom.ST_SRID() = "
|
||||
+ getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,14 +74,16 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_SymDifference(ST_GeomFromText(?, " + getTestSrid() + ")).ST_AsEWKB() from GeomTest t where t.geom.ST_SRID() = "
|
||||
+ getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NativeSQLStatement createNativeGeomUnionStatement(Geometry geom) {
|
||||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Union(ST_GeomFromText(?, " + getTestSrid() + ")).ST_AsEWKB() from GeomTest t where t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -138,7 +144,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Within(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_Within(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -146,7 +153,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Equals(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_Equals(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,7 +162,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Crosses(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_Crosses(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,7 +171,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Contains(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_Contains(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -170,7 +180,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Disjoint(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_Disjoint(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -189,7 +200,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Intersects(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_Intersects(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -198,7 +210,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
"select t.id, t.geom.ST_IntersectsFilter(ST_GeomFromText(?, " + getTestSrid()
|
||||
+ ")) from GeomTest t where t.geom.ST_IntersectsFilter(ST_GeomFromText(?, " + getTestSrid() + ")) = 1 and t.geom.ST_SRID() = "
|
||||
+ getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -206,7 +219,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Touches(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_Touches(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -214,7 +228,8 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Overlaps(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_Overlaps(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -231,14 +246,16 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
"select t.id, t.geom.ST_WithinDistance(ST_GeomFromText(?, " + getTestSrid() + "), "
|
||||
+ distance + ") from GeomTest t where t.geom.ST_WithinDistance(ST_GeomFromText(?, " + getTestSrid() + "), " + distance
|
||||
+ ") = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NativeSQLStatement createNativeDistanceStatement(Geometry geom) {
|
||||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Distance(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -263,6 +280,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected alpha shapes of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, alpha shape
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getAlphaShape(double radius) throws SQLException {
|
||||
|
@ -272,13 +290,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
private NativeSQLStatement createNativeAlphaShapeStatement(double radius) {
|
||||
return createNativeSQLStatement(
|
||||
"select t.id, t.geom.ST_AlphaShape(?).ST_AsEWKB() from GeomTest t where t.geom.ST_GeometryType() in ('ST_Point', 'ST_MultiPoint')",
|
||||
new Object[]{ radius } );
|
||||
new Object[] { radius }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected area of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, area
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getArea() throws SQLException {
|
||||
|
@ -286,13 +306,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
}
|
||||
|
||||
private NativeSQLStatement createNativeAreaStatement() {
|
||||
return createNativeSQLStatement( "select t.id, t.geom.ST_Area() from GeomTest t where t.geom.ST_GeometryType() in ('ST_Polygon', 'ST_MultiPolygon')" );
|
||||
return createNativeSQLStatement(
|
||||
"select t.id, t.geom.ST_Area() from GeomTest t where t.geom.ST_GeometryType() in ('ST_Polygon', 'ST_MultiPolygon')" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected EWKB representation of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, EWKB
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, byte[]> getAsEWKB() throws SQLException {
|
||||
|
@ -307,6 +329,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected EWKT representation of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, EWKT
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, String> getAsEWKT() throws SQLException {
|
||||
|
@ -321,6 +344,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected GeoJSON representation of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, GeoJSON
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, String> getAsGeoJSON() throws SQLException {
|
||||
|
@ -335,6 +359,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected SVG representation of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, SVG
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, String> getAsSVG() throws SQLException {
|
||||
|
@ -349,6 +374,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected aggregated SVG representation of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of count, SVG
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, String> getAsSVGAggr() throws SQLException {
|
||||
|
@ -363,6 +389,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected WKB representation of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, WKB
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, byte[]> getAsWKB() throws SQLException {
|
||||
|
@ -377,6 +404,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected WKT representation of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, WKT
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, String> getAsWKT() throws SQLException {
|
||||
|
@ -391,6 +419,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected centroid of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of id, centroid
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getCentroid() throws SQLException {
|
||||
|
@ -398,13 +427,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
}
|
||||
|
||||
private NativeSQLStatement createNativeCentroidStatement() {
|
||||
return createNativeSQLStatement( "select id, t.geom.ST_Centroid() from GeomTest t where t.geom.ST_GeometryType() = 'ST_Polygon'" );
|
||||
return createNativeSQLStatement(
|
||||
"select id, t.geom.ST_Centroid() from GeomTest t where t.geom.ST_GeometryType() = 'ST_Polygon'" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected aggregated convex hull representation of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of count, convex hull
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getConvexHullAggr() throws SQLException {
|
||||
|
@ -419,6 +450,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected number of coordinate dimensions of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, coordinate dimension
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Integer> getCoordDim() throws SQLException {
|
||||
|
@ -433,6 +465,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the testsuite-suite geometries that are covered by the given geometry.
|
||||
*
|
||||
* @return map of identifier, whether the geometry is covered
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Boolean> getCoveredBy(Geometry geom) throws SQLException {
|
||||
|
@ -443,13 +476,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_CoveredBy(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_CoveredBy(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the testsuite-suite geometries that are cover the given geometry.
|
||||
*
|
||||
* @return map of identifier, whether the geometry covers the given geometry
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Boolean> getCovers(Geometry geom) throws SQLException {
|
||||
|
@ -460,13 +495,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_Covers(ST_GeomFromText(?, " + getTestSrid() + ")) from GeomTest t where t.geom.ST_Covers(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected endpoint of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of id, endpoint
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getEndPoint() throws SQLException {
|
||||
|
@ -474,13 +511,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
}
|
||||
|
||||
private NativeSQLStatement createNativeEndPointStatement() {
|
||||
return createNativeSQLStatement( "select id, t.geom.ST_EndPoint() from GeomTest t where t.geom.ST_GeometryType() = 'ST_LineString'" );
|
||||
return createNativeSQLStatement(
|
||||
"select id, t.geom.ST_EndPoint() from GeomTest t where t.geom.ST_GeometryType() = 'ST_LineString'" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected aggregated bounding rectangle of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of count, bounding rectangle
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getEnvelopeAggr() throws SQLException {
|
||||
|
@ -495,6 +534,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected exterior ring of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of id, exterior ring
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getExteriorRing() throws SQLException {
|
||||
|
@ -502,13 +542,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
}
|
||||
|
||||
private NativeSQLStatement createNativeExteriorRingStatement() {
|
||||
return createNativeSQLStatement( "select id, t.geom.ST_ExteriorRing() from GeomTest t where t.geom.ST_GeometryType() = 'ST_Polygon'" );
|
||||
return createNativeSQLStatement(
|
||||
"select id, t.geom.ST_ExteriorRing() from GeomTest t where t.geom.ST_GeometryType() = 'ST_Polygon'" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the geometry from an EWKB representation.
|
||||
*
|
||||
* @return map of id, geometry
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getGeomFromEWKB(byte[] ewkb) throws SQLException {
|
||||
|
@ -523,6 +565,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the geometry from an EWKT representation.
|
||||
*
|
||||
* @return map of id, geometry
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getGeomFromEWKT(String ewkt) throws SQLException {
|
||||
|
@ -537,6 +580,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the geometry from a text representation.
|
||||
*
|
||||
* @return map of id, geometry
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getGeomFromText(String text) throws SQLException {
|
||||
|
@ -551,6 +595,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the geometry from a WKB representation.
|
||||
*
|
||||
* @return map of id, geometry
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getGeomFromWKB(byte[] wkb) throws SQLException {
|
||||
|
@ -565,6 +610,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the geometry from a WKT representation.
|
||||
*
|
||||
* @return map of id, geometry
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getGeomFromWKT(String wkt) throws SQLException {
|
||||
|
@ -579,6 +625,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected nth geometry of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of id, geometry
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getGeometryN(int n) throws SQLException {
|
||||
|
@ -586,14 +633,17 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
}
|
||||
|
||||
private NativeSQLStatement createNativeGeometryNStatement(int n) {
|
||||
return createNativeSQLStatement( "select id, t.geom.ST_GeometryN(?) from GeomTest t where t.geom.ST_GeometryType() = 'ST_GeometryCollection'",
|
||||
new Object[]{ n } );
|
||||
return createNativeSQLStatement(
|
||||
"select id, t.geom.ST_GeometryN(?) from GeomTest t where t.geom.ST_GeometryType() = 'ST_GeometryCollection'",
|
||||
new Object[] { n }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected nth interior ring of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of id, interior ring
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getInteriorRingN(int n) throws SQLException {
|
||||
|
@ -601,14 +651,17 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
}
|
||||
|
||||
private NativeSQLStatement createNativeInteriorRingNStatement(int n) {
|
||||
return createNativeSQLStatement( "select id, t.geom.ST_InteriorRingN(?) from GeomTest t where t.geom.ST_GeometryType() = 'ST_Polygon'",
|
||||
new Object[]{ n } );
|
||||
return createNativeSQLStatement(
|
||||
"select id, t.geom.ST_InteriorRingN(?) from GeomTest t where t.geom.ST_GeometryType() = 'ST_Polygon'",
|
||||
new Object[] { n }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected aggregated intersection of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of count, intersection
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getIntersectionAggr() throws SQLException {
|
||||
|
@ -623,6 +676,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the testsuite-suite geometries that intersect the given rectangle.
|
||||
*
|
||||
* @return map of identifier, whether the geometry intersects the given rectangle
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Boolean> getIntersectsRect(Point pmin, Point pmax) throws SQLException {
|
||||
|
@ -634,13 +688,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
"select t.id, t.geom.ST_IntersectsRect(ST_GeomFromText(?, " + getTestSrid() + "), ST_GeomFromText(?, " + getTestSrid()
|
||||
+ ")) from GeomTest t where t.geom.ST_IntersectsRect(ST_GeomFromText(?, "
|
||||
+ getTestSrid() + "), ST_GeomFromText(?, " + getTestSrid() + ")) = 1 and t.geom.ST_SRID() = " + getTestSrid(),
|
||||
new Object[]{ pmin.toText(), pmax.toText(), pmin.toText(), pmax.toText() } );
|
||||
new Object[] { pmin.toText(), pmax.toText(), pmin.toText(), pmax.toText() }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the testsuite-suite geometries that are 3D geometries.
|
||||
*
|
||||
* @return map of identifier, whether the geometry is 3D
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Boolean> getIs3D() throws SQLException {
|
||||
|
@ -656,6 +712,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the testsuite-suite geometries that are closed.
|
||||
*
|
||||
* @return map of identifier, whether the geometry is closed
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Boolean> getIsClosed() throws SQLException {
|
||||
|
@ -672,6 +729,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the testsuite-suite geometries that are measured.
|
||||
*
|
||||
* @return map of identifier, whether the geometry is measured
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Boolean> getIsMeasured() throws SQLException {
|
||||
|
@ -688,6 +746,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the testsuite-suite geometries that are rings.
|
||||
*
|
||||
* @return map of identifier, whether the geometry is a ring
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Boolean> getIsRing() throws SQLException {
|
||||
|
@ -704,6 +763,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the testsuite-suite geometries that are valid.
|
||||
*
|
||||
* @return map of identifier, whether the geometry is valid
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Boolean> getIsValid() throws SQLException {
|
||||
|
@ -720,6 +780,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the length of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, length
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getLength() throws SQLException {
|
||||
|
@ -736,6 +797,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the measure value of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, measure value
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getM() throws SQLException {
|
||||
|
@ -752,6 +814,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the maximum measure value of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, maximum measure value
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getMMax() throws SQLException {
|
||||
|
@ -768,6 +831,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the minimum measure value of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, minimum measure value
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getMMin() throws SQLException {
|
||||
|
@ -784,6 +848,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the number of geometries of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, number of geometries
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Integer> getNumGeometries() throws SQLException {
|
||||
|
@ -800,6 +865,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the number of interior rings of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, number of interior rings
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Integer> getNumInteriorRing() throws SQLException {
|
||||
|
@ -816,6 +882,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the number of interior rings of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, number of interior rings
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Integer> getNumInteriorRings() throws SQLException {
|
||||
|
@ -832,6 +899,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the number of points of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, number of points
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Integer> getNumPoints() throws SQLException {
|
||||
|
@ -848,6 +916,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the testsuite-suite geometries that are equal.
|
||||
*
|
||||
* @return map of identifier, whether the geometry is equal
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Boolean> getOrderingEquals(Geometry geom) throws SQLException {
|
||||
|
@ -858,13 +927,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom.ST_OrderingEquals(ST_GeomFromText(?)) from GeomTest t where t.geom.ST_OrderingEquals(ST_GeomFromText(?)) = 1 and t.geom.ST_SRID() = "
|
||||
+ getTestSrid(),
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the perimeter of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, perimeter
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getPerimeter() throws SQLException {
|
||||
|
@ -881,6 +952,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns a point on the surface of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, point on surface
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getPointOnSurface() throws SQLException {
|
||||
|
@ -897,6 +969,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the nth point of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, point
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getPointN(int n) throws SQLException {
|
||||
|
@ -907,13 +980,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatement(
|
||||
"select t.id, t.geom.ST_PointN(?) from GeomTest t where t.geom.ST_GeometryType() in ('ST_LineString') and t.geom.ST_SRID() = "
|
||||
+ getTestSrid(),
|
||||
new Object[]{ n } );
|
||||
new Object[] { n }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of all testsuite-suite geometries with all points snapped to the grid.
|
||||
*
|
||||
* @return map of identifier, geometry
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getSnapToGrid() throws SQLException {
|
||||
|
@ -930,6 +1005,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the expected startpoint of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of id, startpoint
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getStartPoint() throws SQLException {
|
||||
|
@ -937,13 +1013,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
}
|
||||
|
||||
private NativeSQLStatement createNativeStartPointStatement() {
|
||||
return createNativeSQLStatement( "select id, t.geom.ST_StartPoint() from GeomTest t where t.geom.ST_GeometryType() = 'ST_LineString'" );
|
||||
return createNativeSQLStatement(
|
||||
"select id, t.geom.ST_StartPoint() from GeomTest t where t.geom.ST_GeometryType() = 'ST_LineString'" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected aggregated union of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of count, union
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getUnionAggr() throws SQLException {
|
||||
|
@ -958,6 +1036,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the x coordinate of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, x coordinate
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getX() throws SQLException {
|
||||
|
@ -974,6 +1053,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the maximum x coordinate of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, maximum x coordinate
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getXMax() throws SQLException {
|
||||
|
@ -990,6 +1070,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the minimum x coordinate of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, minumum x coordinate
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getXMin() throws SQLException {
|
||||
|
@ -1006,6 +1087,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the y coordinate of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, y coordinate
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getY() throws SQLException {
|
||||
|
@ -1022,6 +1104,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the maximum y coordinate of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, maximum y coordinate
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getYMax() throws SQLException {
|
||||
|
@ -1038,6 +1121,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the minimum y coordinate of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, minumum y coordinate
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getYMin() throws SQLException {
|
||||
|
@ -1054,6 +1138,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the z coordinate of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, z coordinate
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getZ() throws SQLException {
|
||||
|
@ -1070,6 +1155,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the maximum z coordinate of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, maximum z coordinate
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getZMax() throws SQLException {
|
||||
|
@ -1086,6 +1172,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the minimum z coordinate of all testsuite-suite geometries.
|
||||
*
|
||||
* @return map of identifier, minumum z coordinate
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Double> getZMin() throws SQLException {
|
||||
|
@ -1102,6 +1189,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
* Returns the result of a nested function call with a parameter inside the inner function
|
||||
*
|
||||
* @return map of identifier, geometry
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getNestedFunctionInner(Geometry geom) throws SQLException {
|
||||
|
@ -1112,13 +1200,15 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom from GeomTest t where t.geom.ST_WithinDistance(ST_GeomFromText(?, " + getTestSrid()
|
||||
+ ").ST_SRID(0), 1) = 1",
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of a nested function call with a parameter inside the outer function
|
||||
*
|
||||
* @return map of identifier, geometry
|
||||
*
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, Geometry> getNestedFunctionOuter(Geometry geom) throws SQLException {
|
||||
|
@ -1128,6 +1218,7 @@ public class HANAExpectationsFactory extends AbstractExpectationsFactory {
|
|||
private NativeSQLStatement createNativeNestedFunctionOuterStatement(Geometry geom) {
|
||||
return createNativeSQLStatementAllWKTParams(
|
||||
"select t.id, t.geom from GeomTest t where ST_GeomFromText(?, " + getTestSrid() + ").ST_WithinDistance(geom.ST_SRID(0), 1) = 1",
|
||||
geom.toText() );
|
||||
geom.toText()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,6 @@ public class MySQL8ExpectationsFactory extends AbstractExpectationsFactory {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected NativeSQLStatement createNativeRelateStatement(Geometry geom, String matrix) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
<Element>
|
||||
<id>12</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40 14.0))
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40
|
||||
14.0))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
||||
|
@ -63,7 +64,8 @@
|
|||
<Element>
|
||||
<id>22</id>
|
||||
<type>MULTIPOLYGON</type>
|
||||
<wkt>SRID=4326;MULTIPOLYGON(((0 0, 50 0, 50 50, 0 50, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10)), ((105 100, 130 134, 120 140, 105 100)))
|
||||
<wkt>SRID=4326;MULTIPOLYGON(((0 0, 50 0, 50 50, 0 50, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10)), ((105 100, 130
|
||||
134, 120 140, 105 100)))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
<Element>
|
||||
<id>22</id>
|
||||
<type>MULTIPOLYGON</type>
|
||||
<wkt>SRID=4326;MULTIPOLYGON(((0 0, 50 0, 50 50, 0 50, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10)), ((105 100, 130 134, 120 140, 105 100)))
|
||||
<wkt>SRID=4326;MULTIPOLYGON(((0 0, 50 0, 50 50, 0 50, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10)), ((105 100, 130
|
||||
134, 120 140, 105 100)))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
||||
|
|
|
@ -86,7 +86,8 @@
|
|||
<Element>
|
||||
<id>13</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>MULTILINESTRING M((10.0 5.0 1.0, 20.0 15.0 2.0, 30.25 22.375 1.0, 10 30.0 1.0),(40.0 20.0 0.0, 42.0 18.0 1.0,
|
||||
<wkt>MULTILINESTRING M((10.0 5.0 1.0, 20.0 15.0 2.0, 30.25 22.375 1.0, 10 30.0 1.0),(40.0 20.0 0.0, 42.0 18.0
|
||||
1.0,
|
||||
43.0 16.0 2.0, 40 14.0 3.0))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
@ -94,7 +95,8 @@
|
|||
<Element>
|
||||
<id>14</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>MULTILINESTRING ZM((10.0 5.0 1.0 0.0, 20.0 15.0 2.0 0.0, 30.25 22.375 1.0 1.0, 10 30.0 1.0 2.0),(40.0 20.0 0.0
|
||||
<wkt>MULTILINESTRING ZM((10.0 5.0 1.0 0.0, 20.0 15.0 2.0 0.0, 30.25 22.375 1.0 1.0, 10 30.0 1.0 2.0),(40.0 20.0
|
||||
0.0
|
||||
3.0, 42.0 18.0 1.0 4.0, 43.0 16.0 2.0 5.0, 40 14.0 3.0 6.0))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
|
|
@ -4,26 +4,19 @@
|
|||
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
#
|
||||
|
||||
# Default unit/integration test config.
|
||||
|
||||
hibernate.show_sql true
|
||||
|
||||
hibernate.max_fetch_depth 5
|
||||
|
||||
hibernate.dialect @db.dialect@
|
||||
hibernate.connection.driver_class @jdbc.driver@
|
||||
hibernate.connection.url @jdbc.url@
|
||||
hibernate.connection.username @jdbc.user@
|
||||
hibernate.connection.password @jdbc.pass@
|
||||
|
||||
hibernate.show_sql=true
|
||||
hibernate.max_fetch_depth=5
|
||||
hibernate.dialect=@db.dialect@
|
||||
hibernate.connection.driver_class=@jdbc.driver@
|
||||
hibernate.connection.url=@jdbc.url@
|
||||
hibernate.connection.username=@jdbc.user@
|
||||
hibernate.connection.password=@jdbc.pass@
|
||||
#hibernate.cache.region_prefix hibernate.test
|
||||
#hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
|
||||
#
|
||||
## NOTE: hibernate.jdbc.batch_versioned_data should be set to false when testing with Oracle
|
||||
#hibernate.jdbc.batch_versioned_data true
|
||||
|
||||
|
||||
## Configs for spatial databases (used during testing on local dev environment).
|
||||
#
|
||||
#hibernate.dialect org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect
|
||||
|
@ -31,7 +24,6 @@ hibernate.connection.password @jdbc.pass@
|
|||
#hibernate.connection.url jdbc:postgresql://localhost:9432/
|
||||
#hibernate.connection.username hibern8
|
||||
#hibernate.connection.password hibern8
|
||||
|
||||
##
|
||||
## GeoDb (H2 spatial extension)
|
||||
##
|
||||
|
@ -40,8 +32,6 @@ hibernate.connection.password @jdbc.pass@
|
|||
#hibernate.connection.url jdbc:h2:mem:testhbs;DB_CLOSE_DELAY=-1;MVCC=true
|
||||
#hibernate.connection.username sa
|
||||
#hibernate.connection.password sa
|
||||
|
||||
|
||||
##
|
||||
## Oracle 11g
|
||||
##
|
||||
|
@ -51,15 +41,12 @@ hibernate.connection.password @jdbc.pass@
|
|||
#hibernate.connection.url jdbc:oracle:thin:@localhost:1521/orcl12c
|
||||
#hibernate.connection.username C##hibernate
|
||||
#hibernate.connection.password hibernate
|
||||
|
||||
#hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatialSDO10gDialect
|
||||
#hibernate.connection.driver_class oracle.jdbc.OracleDriver
|
||||
#hibernate.connection.url jdbc:oracle:thin:@localhost:1521/orcl12c
|
||||
#hibernate.connection.username C##hibernate
|
||||
#hibernate.connection.password hibernate
|
||||
#
|
||||
|
||||
|
||||
##
|
||||
## MS SQL Server dialect
|
||||
##
|
||||
|
@ -68,9 +55,6 @@ hibernate.connection.password @jdbc.pass@
|
|||
#hibernate.connection.url jdbc:sqlserver://localhost:1433;databaseName=TestDb
|
||||
#hibernate.connection.username hibern8
|
||||
#hibernate.connection.password hibern8Pass
|
||||
|
||||
|
||||
|
||||
##
|
||||
## MySQL 5 dialects
|
||||
##
|
||||
|
@ -79,7 +63,6 @@ hibernate.connection.password @jdbc.pass@
|
|||
#hibernate.connection.url jdbc:mysql://hibernate-spatial-integration.cctaez8ywvn2.eu-west-1.rds.amazonaws.com/test
|
||||
#hibernate.connection.username hbs
|
||||
#hibernate.connection.password
|
||||
|
||||
##
|
||||
## MySQL 5 InnoDDB dialect
|
||||
##
|
||||
|
@ -88,7 +71,6 @@ hibernate.connection.password @jdbc.pass@
|
|||
#hibernate.connection.url jdbc:mysql://localhost/testhbs
|
||||
#hibernate.connection.username hibernate
|
||||
#hibernate.connection.password hibernate
|
||||
|
||||
##
|
||||
## MySQL 5.6.1 dialect
|
||||
##
|
||||
|
@ -97,7 +79,6 @@ hibernate.connection.password @jdbc.pass@
|
|||
#hibernate.connection.url jdbc:mysql://hibernate-spatial-integration.cctaez8ywvn2.eu-west-1.rds.amazonaws.com:3306/test
|
||||
#hibernate.connection.username hbs
|
||||
#hibernate.connection.password
|
||||
|
||||
##
|
||||
## HANA dialect
|
||||
##
|
||||
|
@ -106,7 +87,6 @@ hibernate.connection.password @jdbc.pass@
|
|||
#hibernate.connection.url jdbc:sap://localhost:30015
|
||||
#hibernate.connection.username HIBERNATE_TEST
|
||||
#hibernate.connection.password H1bernate_test
|
||||
|
||||
##
|
||||
## DB2 dialect
|
||||
##
|
||||
|
|
|
@ -8,9 +8,6 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
|||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
|
||||
|
||||
|
||||
log4j.rootLogger=info, stdout
|
||||
log4j.logger.org.hibernate.SQL=DEBUG
|
||||
|
||||
log4j.logger.org.hibernate.spatial=debug
|
||||
|
|
|
@ -57,7 +57,8 @@ In MySQL these are stored as null objects.
|
|||
<Element>
|
||||
<id>12</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40 14.0))
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40
|
||||
14.0))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
||||
|
@ -86,7 +87,8 @@ In MySQL these are stored as null objects.
|
|||
<Element>
|
||||
<id>22</id>
|
||||
<type>MULTIPOLYGON</type>
|
||||
<wkt>SRID=4326;MULTIPOLYGON(( (0 0, 0 50, 50 50, 50 0, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10) ),((105 100, 120 140, 130
|
||||
<wkt>SRID=4326;MULTIPOLYGON(( (0 0, 0 50, 50 50, 50 0, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10) ),((105 100,
|
||||
120 140, 130
|
||||
134, 105 100)) )
|
||||
</wkt>
|
||||
</Element>
|
||||
|
@ -116,14 +118,16 @@ In MySQL these are stored as null objects.
|
|||
<Element>
|
||||
<id>32</id>
|
||||
<type>GEOMETRYCOLLECTION</type>
|
||||
<wkt>SRID=4326;GEOMETRYCOLLECTION(POINT(4 0), LINESTRING(4 2, 5 3), POLYGON((0 0, 3 0, 3 3,0 3, 0 0),(1 1, 2 1, 2 2, 1 2,
|
||||
<wkt>SRID=4326;GEOMETRYCOLLECTION(POINT(4 0), LINESTRING(4 2, 5 3), POLYGON((0 0, 3 0, 3 3,0 3, 0 0),(1 1, 2 1,
|
||||
2 2, 1 2,
|
||||
1 1)))
|
||||
</wkt>
|
||||
</Element>
|
||||
<Element>
|
||||
<id>33</id>
|
||||
<type>GEOMETRYCOLLECTION</type>
|
||||
<wkt>SRID=4326;GEOMETRYCOLLECTION( MULTIPOINT(21 2, 25 5, 30 3), MULTIPOLYGON( ((10 20, 30 40, 44 50, 10 20)), ((105 100,
|
||||
<wkt>SRID=4326;GEOMETRYCOLLECTION( MULTIPOINT(21 2, 25 5, 30 3), MULTIPOLYGON( ((10 20, 30 40, 44 50, 10 20)),
|
||||
((105 100,
|
||||
120 140, 130 134, 105 100)) ), MULTILINESTRING((10.0 5.0, 20.0 15.0),( 25.0 30.0, 30.0 20.0)))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
|
|
@ -57,7 +57,8 @@ In MySQL these are stored as null objects.
|
|||
<Element>
|
||||
<id>12</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>SRID=31370;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40 14.0))
|
||||
<wkt>SRID=31370;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40
|
||||
14.0))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
||||
|
@ -86,7 +87,8 @@ In MySQL these are stored as null objects.
|
|||
<Element>
|
||||
<id>22</id>
|
||||
<type>MULTIPOLYGON</type>
|
||||
<wkt>SRID=31370;MULTIPOLYGON(( (0 0, 0 50, 50 50, 50 0, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10) ),((15 10, 12 14, 13
|
||||
<wkt>SRID=31370;MULTIPOLYGON(( (0 0, 0 50, 50 50, 50 0, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10) ),((15 10, 12
|
||||
14, 13
|
||||
14, 15 10)) )
|
||||
</wkt>
|
||||
</Element>
|
||||
|
@ -116,14 +118,16 @@ In MySQL these are stored as null objects.
|
|||
<Element>
|
||||
<id>32</id>
|
||||
<type>GEOMETRYCOLLECTION</type>
|
||||
<wkt>SRID=31370;GEOMETRYCOLLECTION(POINT(4 0), LINESTRING(4 2, 5 3), POLYGON((0 0, 3 0, 3 3,0 3, 0 0),(1 1, 2 1, 2 2, 1 2,
|
||||
<wkt>SRID=31370;GEOMETRYCOLLECTION(POINT(4 0), LINESTRING(4 2, 5 3), POLYGON((0 0, 3 0, 3 3,0 3, 0 0),(1 1, 2 1,
|
||||
2 2, 1 2,
|
||||
1 1)))
|
||||
</wkt>
|
||||
</Element>
|
||||
<Element>
|
||||
<id>33</id>
|
||||
<type>GEOMETRYCOLLECTION</type>
|
||||
<wkt>SRID=31370;GEOMETRYCOLLECTION( MULTIPOINT(21 2, 25 5, 30 3), MULTIPOLYGON( ((10 20, 30 40, 44 50, 10 20)), ((15 10,
|
||||
<wkt>SRID=31370;GEOMETRYCOLLECTION( MULTIPOINT(21 2, 25 5, 30 3), MULTIPOLYGON( ((10 20, 30 40, 44 50, 10 20)),
|
||||
((15 10,
|
||||
12 14, 13 14, 15 10)) ), MULTILINESTRING((10.0 5.0, 20.0 15.0),( 25.0 30.0, 30.0 20.0)))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
#
|
||||
|
||||
OGC_STRICT=true
|
||||
CONNECTION-FINDER=org.hibernate.spatial.dialect.oracle.DefaultConnectionFinder
|
|
@ -57,7 +57,8 @@
|
|||
<Element>
|
||||
<id>12</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40 14.0))
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40
|
||||
14.0))
|
||||
</wkt>
|
||||
<sdo>SDO_GEOMETRY(2006, 4326, NULL, SDO_ELEM_INFO_ARRAY(1,2,1,9,2,1),
|
||||
SDO_ORDINATE_ARRAY(10.0,5.0,20.0,15.0,30.3,22.4,10,30.0,40.0,20.0,42.0,18.0,43.0,16.0,40,14.0))
|
||||
|
|
|
@ -100,7 +100,8 @@
|
|||
<Element>
|
||||
<id>12</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40 14.0))
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40
|
||||
14.0))
|
||||
</wkt>
|
||||
<sdo>SDO_GEOMETRY(2006, 4326, NULL, SDO_ELEM_INFO_ARRAY(1,2,1,9,2,1),
|
||||
SDO_ORDINATE_ARRAY(10.0,5.0,20.0,15.0,30.3,22.4,10,30.0,40.0,20.0,42.0,18.0,43.0,16.0,40,14.0))
|
||||
|
@ -121,7 +122,8 @@
|
|||
<Element>
|
||||
<id>14</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0 1.0 0.0, 20.0 15.0 2.0 0.0, 30.3 22.4 1.0 1.0, 10 30.0 1.0 2.0),(40.0 20.0 0.0
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0 1.0 0.0, 20.0 15.0 2.0 0.0, 30.3 22.4 1.0 1.0, 10 30.0 1.0 2.0),(40.0
|
||||
20.0 0.0
|
||||
3.0, 42.0 18.0 1.0 4.0, 43.0 16.0 2.0 5.0, 40 14.0 3.0 6.0))
|
||||
</wkt>
|
||||
<sdo>SDO_GEOMETRY(4406, 4326, NULL, SDO_ELEM_INFO_ARRAY(1,2,1,17,2,1),
|
||||
|
@ -185,7 +187,8 @@
|
|||
<Element>
|
||||
<id>21</id>
|
||||
<type>MULTIPOLYGON</type>
|
||||
<wkt>SRID=4326;MULTIPOLYGON( ((10 20 1, 30 40 2, 44 50 2, 10 20 1)), ((105 100 0, 120 140 10, 130 134 20, 105 100 0)) )
|
||||
<wkt>SRID=4326;MULTIPOLYGON( ((10 20 1, 30 40 2, 44 50 2, 10 20 1)), ((105 100 0, 120 140 10, 130 134 20, 105
|
||||
100 0)) )
|
||||
</wkt>
|
||||
<sdo>SDO_GEOMETRY(3007, 4326, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1, 13, 1003, 1),
|
||||
SDO_ORDINATE_ARRAY(10,20,1,30,40,2,44,50,2,10,20,1,105,100,0,120,140,10,130,134,20,105,100,0))
|
||||
|
@ -194,7 +197,8 @@
|
|||
<Element>
|
||||
<id>22</id>
|
||||
<type>MULTIPOLYGON</type>
|
||||
<wkt>SRID=4326;MULTIPOLYGON(( (0 0, 0 50, 50 50, 50 0, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10) ),((105 100, 120 140, 130
|
||||
<wkt>SRID=4326;MULTIPOLYGON(( (0 0, 0 50, 50 50, 50 0, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10) ),((105 100,
|
||||
120 140, 130
|
||||
134, 105 100)))
|
||||
</wkt>
|
||||
<sdo>SDO_GEOMETRY(2007, 4326, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1, 11, 2003, 1, 21, 1003, 1),
|
||||
|
|
|
@ -53,7 +53,8 @@
|
|||
<Element>
|
||||
<id>9</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40 14.0))
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40
|
||||
14.0))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
CREATE TABLE "HBS"."dbo"."geomtest"
|
||||
(
|
||||
id int PRIMARY KEY NOT NULL,
|
||||
|
|
|
@ -4,11 +4,9 @@
|
|||
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
#
|
||||
|
||||
#
|
||||
# $Id: hibernate-spatial-sqlserver-test.properties 182 2010-03-20 17:30:12Z maesenka $
|
||||
#
|
||||
|
||||
jdbcUrl=jdbc:sqlserver://sqlserver.geovise.com:1433;databaseName=HBS
|
||||
jdbcDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
jdbcUser=hbs
|
||||
|
|
|
@ -72,14 +72,16 @@
|
|||
<Element>
|
||||
<id>12</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40 14.0))
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0, 20.0 15.0, 30.3 22.4, 10 30.0), (40.0 20.0, 42.0 18.0, 43.0 16.0, 40
|
||||
14.0))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
||||
<Element>
|
||||
<id>13</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0 1.0, 20.0 15.0 2.0, 30.3 22.4 1.0, 10 30.0 1.0),(40.0 20.0 0.0, 42.0 18.0 1.0,
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0 1.0, 20.0 15.0 2.0, 30.3 22.4 1.0, 10 30.0 1.0),(40.0 20.0 0.0, 42.0
|
||||
18.0 1.0,
|
||||
43.0 16.0 2.0, 40 14.0 3.0))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
@ -87,7 +89,8 @@
|
|||
<Element>
|
||||
<id>14</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0 1.0 0.0, 20.0 15.0 2.0 0.0, 30.3 22.4 1.0 1.0, 10 30.0 1.0 2.0),(40.0 20.0 0.0
|
||||
<wkt>SRID=4326;MULTILINESTRING((10.0 5.0 1.0 0.0, 20.0 15.0 2.0 0.0, 30.3 22.4 1.0 1.0, 10 30.0 1.0 2.0),(40.0
|
||||
20.0 0.0
|
||||
3.0, 42.0 18.0 1.0 4.0, 43.0 16.0 2.0 5.0, 40 14.0 3.0 6.0))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
@ -127,13 +130,15 @@
|
|||
<Element>
|
||||
<id>21</id>
|
||||
<type>MULTIPOLYGON</type>
|
||||
<wkt>SRID=4326;MULTIPOLYGON( ((10 20 1, 30 40 2, 44 50 2, 10 20 1)), ((105 100 0, 120 140 10, 130 134 20, 105 100 0)) )
|
||||
<wkt>SRID=4326;MULTIPOLYGON( ((10 20 1, 30 40 2, 44 50 2, 10 20 1)), ((105 100 0, 120 140 10, 130 134 20, 105
|
||||
100 0)) )
|
||||
</wkt>
|
||||
</Element>
|
||||
<Element>
|
||||
<id>22</id>
|
||||
<type>MULTIPOLYGON</type>
|
||||
<wkt>SRID=4326;MULTIPOLYGON(( (0 0, 0 50, 50 50, 50 0, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10) ),((105 100, 120 140, 130
|
||||
<wkt>SRID=4326;MULTIPOLYGON(( (0 0, 0 50, 50 50, 50 0, 0 0), (10 10, 10 20, 20 20, 20 10, 10 10) ),((105 100,
|
||||
120 140, 130
|
||||
134, 105 100)) )
|
||||
</wkt>
|
||||
</Element>
|
||||
|
@ -173,14 +178,16 @@
|
|||
<Element>
|
||||
<id>32</id>
|
||||
<type>GEOMETRYCOLLECTION</type>
|
||||
<wkt>SRID=4326;GEOMETRYCOLLECTION(POINT(4 0), LINESTRING(4 2, 5 3), POLYGON((0 0, 3 0, 3 3,0 3, 0 0),(1 1, 2 1, 2 2, 1 2,
|
||||
<wkt>SRID=4326;GEOMETRYCOLLECTION(POINT(4 0), LINESTRING(4 2, 5 3), POLYGON((0 0, 3 0, 3 3,0 3, 0 0),(1 1, 2 1,
|
||||
2 2, 1 2,
|
||||
1 1)))
|
||||
</wkt>
|
||||
</Element>
|
||||
<Element>
|
||||
<id>33</id>
|
||||
<type>GEOMETRYCOLLECTION</type>
|
||||
<wkt>SRID=4326;GEOMETRYCOLLECTION( MULTIPOINT(21 2, 25 5, 30 3), MULTIPOLYGON( ((10 20, 30 40, 44 50, 10 20)), ((105 100,
|
||||
<wkt>SRID=4326;GEOMETRYCOLLECTION( MULTIPOINT(21 2, 25 5, 30 3), MULTIPOLYGON( ((10 20, 30 40, 44 50, 10 20)),
|
||||
((105 100,
|
||||
120 140, 130 134, 105 100)) ), MULTILINESTRING((10.0 5.0, 20.0 15.0),( 25.0 30.0, 30.0 20.0)))
|
||||
</wkt>
|
||||
</Element>
|
||||
|
|
Loading…
Reference in New Issue