HHH-14906 Fix naming inconsistencies

Also fixes some minor checkstyle violations and
removes dead code
This commit is contained in:
Karel Maesen 2021-11-04 08:26:49 +01:00
parent 65aa8f7a5b
commit 022d2c0a13
22 changed files with 98 additions and 323 deletions

View File

@ -199,11 +199,11 @@ The dialect `CockroachDB` support the `GEOMETRY` type in CockroachDB v20.2 and l
The `GEOGRAPHY` type is not currently supported.
====
GeoDB (H2)::
The `GeoDBDialect` supports the GeoDB a spatial extension of the H2 in-memory database.
H2GIS::
The `H2DBDialect` supports the H2GIS, a spatial extension of the H2 in-memory database.
[NOTE]
====
The dialect has been tested with GeoDB version 0.7
The dialect has been tested with H2GIS version 1.5
====
DB2::

View File

@ -1,5 +1,3 @@
import org.apache.tools.ant.filters.ReplaceTokens
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
@ -14,36 +12,41 @@ apply plugin: 'org.hibernate.matrix-test'
dependencies {
api project(':hibernate-core')
api libraries.geolatte
api project( ':hibernate-core' )
api libraries.geolatte
compileOnly libraries.postgresql
compileOnly libraries.postgresql
testImplementation project(':hibernate-testing')
testImplementation project(':hibernate-ant')
testImplementation project( path: ':hibernate-core', configuration: 'tests' )
testImplementation libraries.jakarta_validation
testImplementation libraries.jandex
testImplementation libraries.classmate
testImplementation libraries.jakarta_validator
testImplementation libraries.dom4j
testImplementation project( ':hibernate-testing' )
testImplementation project( ':hibernate-ant' )
testImplementation project( path: ':hibernate-core', configuration: 'tests' )
testImplementation libraries.jakarta_validation
testImplementation libraries.jandex
testImplementation libraries.classmate
testImplementation libraries.jakarta_validator
testImplementation libraries.dom4j
testImplementation libraries.postgresql
testImplementation libraries.h2gis
testImplementation libraries.postgresql
testImplementation libraries.h2gis
testRuntimeOnly libraries.jakarta_el
testRuntimeOnly 'jaxen:jaxen:1.1'
testRuntimeOnly libraries.byteBuddy
testRuntimeOnly libraries.jakarta_el
testRuntimeOnly 'jaxen:jaxen:1.1'
testRuntimeOnly libraries.byteBuddy
}
sourceSets.test.resources {
setSrcDirs(['src/test/java', 'src/test/resources'])
setSrcDirs( ['src/test/java', 'src/test/resources'] )
}
tasks.test {
// for now we cannot run with 'h2' project.db due to compatability issues
// H2 requires 4.200 but H2GIS 1.5 needs 4.197
enabled = ['pgsql', 'pgsql_ci', 'cockroachdb', 'mariadb', 'mysql_ci', 'mysql_docker'].contains( project.db )
// for now we cannot run with 'h2' project.db due to compatability issues H2 requires 4.200 but H2GIS 1.5 needs 4.197
enabled = ['pgsql',
// 'h2', -- for now we cannot run with 'h2'due to compatability issues we needs H2 at 4.200 but H2GIS only works with 4.197
// 'pgsql_ci', -- disable running in CI until typing issues are resolved
'cockroachdb',
'mariadb',
// 'mysql_ci',
'mysql_docker'].contains( project.db )
}
tasks.test.include '**/*'

View File

@ -1,20 +0,0 @@
/*
* 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.h2gis;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.spatial.SpatialDialect;
/**
* Extends the H2Dialect by also including information on spatial functions.
*
* @author Jan Boonen, Geodan IT b.v.
*/
public class GeoDBDialect extends H2Dialect implements SpatialDialect {
}

View File

@ -13,7 +13,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import org.hibernate.spatial.GeolatteGeometryJavaTypeDescriptor;
import org.hibernate.spatial.GeometryLiteralFormatter;
import org.hibernate.type.SqlTypes;
import org.hibernate.type.descriptor.ValueBinder;
@ -34,12 +33,12 @@ import org.geolatte.geom.jts.JTS;
*
* @author Karel Maesen, Geovise BVBA
*/
public class GeoDBGeometryType implements JdbcType {
public class H2GISGeometryType implements JdbcType {
/**
* An instance of this Descriptor
*/
public static final GeoDBGeometryType INSTANCE = new GeoDBGeometryType();
public static final H2GISGeometryType INSTANCE = new H2GISGeometryType();
@Override
public int getJdbcTypeCode() {
@ -51,17 +50,11 @@ public class GeoDBGeometryType implements JdbcType {
return SqlTypes.GEOMETRY;
}
//todo -- simplify as with postgis/mariadb
@Override
public <T> JdbcLiteralFormatter<T> getJdbcLiteralFormatter(JavaType<T> javaTypeDescriptor) {
return new GeometryLiteralFormatter<T>( javaTypeDescriptor, Wkt.Dialect.SFA_1_1_0, "ST_GeomFromText" );
}
private <T> Geometry<?> jts2Gl(T value) {
return JTS.from( (org.locationtech.jts.geom.Geometry) value );
}
@Override
public <X> ValueBinder<X> getBinder(final JavaType<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@ -69,14 +62,14 @@ public class GeoDBGeometryType implements JdbcType {
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
throws SQLException {
final Geometry geometry = getJavaTypeDescriptor().unwrap( value, Geometry.class, options );
st.setBytes( index, GeoDbWkb.to( geometry ) );
st.setBytes( index, H2GISWkb.to( geometry ) );
}
@Override
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options)
throws SQLException {
final Geometry geometry = getJavaTypeDescriptor().unwrap( value, Geometry.class, options );
st.setBytes( name, GeoDbWkb.to( geometry ) );
st.setBytes( name, H2GISWkb.to( geometry ) );
}
};
}
@ -87,18 +80,18 @@ public class GeoDBGeometryType implements JdbcType {
@Override
protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException {
return getJavaTypeDescriptor().wrap( GeoDbWkb.from( rs.getObject( paramIndex ) ), options );
return getJavaTypeDescriptor().wrap( H2GISWkb.from( rs.getObject( paramIndex ) ), options );
}
@Override
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
return getJavaTypeDescriptor().wrap( GeoDbWkb.from( statement.getObject( index ) ), options );
return getJavaTypeDescriptor().wrap( H2GISWkb.from( statement.getObject( index ) ), options );
}
@Override
protected X doExtract(CallableStatement statement, String name, WrapperOptions options)
throws SQLException {
return getJavaTypeDescriptor().wrap( GeoDbWkb.from( statement.getObject( name ) ), options );
return getJavaTypeDescriptor().wrap( H2GISWkb.from( statement.getObject( name ) ), options );
}
};
}

View File

@ -33,21 +33,21 @@ import org.geolatte.geom.crs.CoordinateReferenceSystems;
import org.geolatte.geom.jts.JTS;
/**
* A utility class to serialize from/to GeoDB WKB's.
* A utility class to serialize from/to H2GIS WKB's.
* <p/>
* <p>Note: this utility makes it unnecessary to have a dependency on GeoDB. As long as GeoDB is
* not available in common maven repositories, such a dependency is to be avoided.</p>
*
* @author Karel Maesen, Geovise BVBA
*/
public class GeoDbWkb {
public class H2GISWkb {
private static final HSMessageLogger LOGGER = Logger.getMessageLogger(
HSMessageLogger.class,
GeoDbWkb.class.getName()
H2GISWkb.class.getName()
);
private GeoDbWkb() {
private H2GISWkb() {
}
/**
@ -113,6 +113,7 @@ public class GeoDbWkb {
return new Polygon<C2D>( ps, CoordinateReferenceSystems.PROJECTED_2D_METER );
}
//todo This type of function really belongs in a general helper class
private static ByteBuffer toByteBuffer(Blob blob) {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final byte[] buf = new byte[1024];

View File

@ -14,8 +14,8 @@ import org.hibernate.service.ServiceRegistry;
import org.hibernate.spatial.GeolatteGeometryType;
import org.hibernate.spatial.HSMessageLogger;
import org.hibernate.spatial.JTSGeometryType;
import org.hibernate.spatial.KeyedSqmFunctionDescriptors;
import org.hibernate.spatial.contributor.ContributorImplementor;
import org.hibernate.spatial.dialect.postgis.PGGeometryType;
import org.hibernate.spatial.dialect.postgis.PostgisSqmFunctionDescriptors;
public class H2GisDialectContributor implements ContributorImplementor {
@ -28,16 +28,16 @@ public class H2GisDialectContributor implements ContributorImplementor {
public void contributeTypes(TypeContributions typeContributions) {
HSMessageLogger.LOGGER.typeContributions( this.getClass().getCanonicalName() );
typeContributions.contributeType( new GeolatteGeometryType( GeoDBGeometryType.INSTANCE ) );
typeContributions.contributeType( new JTSGeometryType( GeoDBGeometryType.INSTANCE ) );
typeContributions.contributeType( new GeolatteGeometryType( H2GISGeometryType.INSTANCE ) );
typeContributions.contributeType( new JTSGeometryType( H2GISGeometryType.INSTANCE ) );
}
@Override
public void contributeFunctions(FunctionContributions functionContributions) {
HSMessageLogger.LOGGER.functionContributions( this.getClass().getCanonicalName() );
final PostgisSqmFunctionDescriptors postgisFunctions = new PostgisSqmFunctionDescriptors( functionContributions );
final KeyedSqmFunctionDescriptors functions = new H2SqmFunctionDescriptors( functionContributions );
final SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry();
postgisFunctions.asMap().forEach( (key, desc) -> {
functions.asMap().forEach( (key, desc) -> {
functionRegistry.register( key.getName(), desc );
key.getAltName().ifPresent( altName -> functionRegistry.registerAlternateKey( altName, key.getName() ) );
} );

View File

@ -0,0 +1,17 @@
/*
* 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.h2gis;
import org.hibernate.boot.model.FunctionContributions;
import org.hibernate.spatial.BaseSqmFunctionDescriptors;
public class H2SqmFunctionDescriptors extends BaseSqmFunctionDescriptors {
public H2SqmFunctionDescriptors(FunctionContributions contributions) {
super( contributions );
}
}

View File

@ -10,10 +10,10 @@
<head></head>
<body>
<p>
This package contains the H2 Dialect extensions for the GeoDB dialect.
This package contains the H2GIS Dialect extensions for the H2Dialect.
</p>
<p>
For more information on GeoDB, see <a href="https://github.com/jdeolive/geodb">https://github.com/jdeolive/geodb</a>.
For more information on H2GIS, see <a href="http://www.h2gis.org/">the H2GIS website</a>.
</p>
</body>
</html>

View File

@ -22,6 +22,7 @@ import org.hibernate.spatial.SpatialDialect;
* Rectangles (MBR's). This dialect my therefore produce different results than the other MySQL spatial dialects.
*
* @author Karel Maesen
* @deprecated Spatial Dialects are no longer needed
*/
@Deprecated
public class MySQL56SpatialDialect extends MySQL55Dialect implements SpatialDialect {

View File

@ -13,6 +13,7 @@ import org.hibernate.spatial.SpatialDialect;
* A Dialect for MySQL 5 using InnoDB engine, with support for its spatial features
*
* @author Karel Maesen, Geovise BVBA
* @deprecated Spatial Dialects are no longer needed
*/
@Deprecated
public class MySQL5SpatialDialect extends MySQL5Dialect implements SpatialDialect {

View File

@ -13,6 +13,7 @@ import org.hibernate.spatial.SpatialDialect;
* A Dialect for MySQL with support for its spatial features
*
* @author Karel Maesen, Boni Gopalan
* @deprecated SpatialDialects are no longer needed in Hibernate 6
*/
@Deprecated
public class MySQLSpatialDialect extends MySQLDialect implements SpatialDialect {

View File

@ -1,94 +0,0 @@
/*
* 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>.
*/
/*
* 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 java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.spatial.integration.SpatialTestDataProvider;
import org.hibernate.spatial.testing.domain.GeomEntity;
import org.hibernate.spatial.testing.domain.JtsGeomEntity;
import org.hibernate.spatial.testing.domain.SpatialDomainModel;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.hibernate.testing.orm.junit.SessionFactoryScopeAware;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
@SuppressWarnings("ALL")
@DomainModel(modelDescriptorClasses = SpatialDomainModel.class)
@SessionFactory
public abstract class BaseSpatialFunctionTestCase extends SpatialTestDataProvider
implements SessionFactoryScopeAware {
private SessionFactoryScope scope;
List received;
List expected;
@Override
public void injectSessionFactoryScope(SessionFactoryScope scope) {
this.scope = scope;
}
@BeforeEach
public void beforeEach() {
scope.inTransaction( session -> super.entities( JtsGeomEntity.class ).forEach( session::save ) );
scope.inTransaction( session -> super.entities( GeomEntity.class ).forEach( session::save ) );
}
@AfterEach
public void cleanup() {
scope.inTransaction( session -> session.createQuery( "delete from GeomEntity" ).executeUpdate() );
scope.inTransaction( session -> session.createQuery( "delete from JtsGeomEntity" ).executeUpdate() );
}
@ParameterizedTest
@ValueSource(classes = { GeomEntity.class, JtsGeomEntity.class })
public void testFunction(Class entityClass) {
PersistentClass geomEntity = scope.getMetadataImplementor().getEntityBinding( entityClass.getCanonicalName() );
String table = geomEntity.getTable().getName();
scope.inSession( session -> {
expected = (List) session.createNativeQuery(
sqlTemplate().mkNativeSQLString( table ) )
.getResultList()
.stream().map( mapper() )
.collect( Collectors.toList() );
} );
scope.inSession( session -> {
received = (List) session.createQuery( jqlQueryTemplate().mkHQLString( entityClass.getCanonicalName() ) )
.getResultList()
.stream()
.map( mapper() )
.collect( Collectors.toList() );
} );
assertEquals( expected, received );
}
protected abstract HQLTemplate jqlQueryTemplate();
protected abstract NativeSQLTemplate sqlTemplate();
protected abstract Function<Object, Object> mapper();
}

View File

@ -1,35 +0,0 @@
/*
* 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;
import org.geolatte.geom.GeometryPositionEquality;
import org.geolatte.geom.Position;
/**
* Created by Karel Maesen, Geovise BVBA on 15/02/2018.
*/
public class GeolatteGeometryEquality<P extends Position> implements GeometryEquality<Geometry<P>> {
private final org.geolatte.geom.GeometryEquality delegate;
public GeolatteGeometryEquality() {
this( new GeometryPositionEquality() );
}
public GeolatteGeometryEquality(org.geolatte.geom.GeometryEquality delegate) {
this.delegate = delegate;
}
@Override
public boolean test(Geometry<P> geom1, Geometry<P> geom2) {
return delegate.equals( geom1, geom2 );
}
}

View File

@ -48,15 +48,7 @@ abstract public class SpatialTestBase
.getFunctions()
.keySet();
if ( DialectContext.getDialect() instanceof H2Dialect ) {
this.scope.inSession( session -> {
try {
Connection cn = session.getJdbcConnectionAccess().obtainConnection();
H2GISFunctions.load( cn );
}
catch (SQLException e) {
throw new RuntimeException( e );
}
} );
initH2GISExtensionsForInMemDb();
}
}
}
@ -84,4 +76,17 @@ abstract public class SpatialTestBase
return supportedFunctions.contains( function.name() );
}
private void initH2GISExtensionsForInMemDb() {
this.scope.inSession( session -> {
try {
Connection cn = session.getJdbcConnectionAccess().obtainConnection();
H2GISFunctions.load( cn );
}
catch (SQLException e) {
throw new RuntimeException( e );
}
} );
}
}

View File

@ -16,7 +16,7 @@ import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.spatial.testing.datareader.TestSupport;
import org.hibernate.spatial.testing.dialects.cockroachdb.CockroachDBTestSupport;
import org.hibernate.spatial.testing.dialects.db2.DB2TestSupport;
import org.hibernate.spatial.testing.dialects.h2geodb.H2GisTestSupport;
import org.hibernate.spatial.testing.dialects.h2gis.H2GisTestSupport;
import org.hibernate.spatial.testing.dialects.hana.HANATestSupport;
import org.hibernate.spatial.testing.dialects.mariadb.MariaDBTestSupport;
import org.hibernate.spatial.testing.dialects.mysql.MySQL56TestSupport;

View File

@ -1,37 +0,0 @@
/*
* 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;
/**
* @author Karel Maesen, Geovise BVBA
* creation-date: 1/24/13
*/
public class WktUtility {
static public int getSRID(String wkt) {
String[] tokens = wkt.split( ";" );
if ( tokens.length == 1 ) {
return 0;
}
String[] sridTokens = tokens[0].split( "=" );
if ( sridTokens.length < 2 ) {
throw new IllegalArgumentException( "Can't parse " + wkt );
}
return Integer.parseInt( sridTokens[1] );
}
static public String getWkt(String wkt) {
String[] tokens = wkt.split( ";" );
if ( tokens.length > 1 ) {
return tokens[1];
}
else {
return wkt;
}
}
}

View File

@ -9,7 +9,7 @@ package org.hibernate.spatial.testing.converter;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import org.hibernate.spatial.dialect.h2gis.GeoDbWkb;
import org.hibernate.spatial.dialect.h2gis.H2GISWkb;
import org.geolatte.geom.Geometry;
@ -23,7 +23,7 @@ public class GeometryConverter implements AttributeConverter<Geometry, byte[]> {
if ( attribute == null ) {
return null;
}
return GeoDbWkb.to( attribute );
return H2GISWkb.to( attribute );
}
@Override
@ -31,6 +31,6 @@ public class GeometryConverter implements AttributeConverter<Geometry, byte[]> {
if ( dbData == null ) {
return null;
}
return GeoDbWkb.from( dbData );
return H2GISWkb.from( dbData );
}
}

View File

@ -11,17 +11,16 @@ import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.boot.spi.MetadataBuilderImplementor;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.model.convert.spi.JpaAttributeConverter;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.spatial.GeolatteGeometryJavaTypeDescriptor;
import org.hibernate.spatial.dialect.h2gis.GeoDBDialect;
import org.hibernate.tool.schema.Action;
import org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter;
import org.hibernate.type.spi.TypeConfiguration;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.junit.Ignore;
import org.junit.Test;
import org.geolatte.geom.Geometry;
@ -33,13 +32,12 @@ import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping;
/**
* @author Steve Ebersole
*/
@Ignore
public class GeometryConverterTest extends BaseUnitTestCase {
@Test
public void testConverterUsage() {
try (final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder()
.applySetting( AvailableSettings.DIALECT, GeoDBDialect.class )
.applySetting( AvailableSettings.DIALECT, H2Dialect.class )
.applySetting( AvailableSettings.HBM2DDL_AUTO, Action.CREATE_DROP )
.build()) {
final MetadataSources metadataSources = new MetadataSources( ssr )

View File

@ -1,54 +0,0 @@
/*
* 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.dialects.h2geodb;
import org.hibernate.spatial.testing.JTSGeometryEquality;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
/**
* Extends the test for {@link Geometry} equality, because GeoDB uses JTS
* Geometry objects, which cannot be cast to {@link org.hibernate.spatial.jts.mgeom.MGeometry} objects.
*
* @author Jan Boonen, Geodan IT b.v.
* @deprecated This should no longer be necesseary
*/
@Deprecated
public class GeoDBGeometryEquality extends JTSGeometryEquality {
@Override
public boolean test(Geometry geom1, Geometry geom2) {
if ( geom1 != null && geom1.isEmpty() ) {
return geom2 == null || geom2.isEmpty();
}
return super.test( geom1, geom2 );
}
@Override
protected boolean testSimpleGeometryEquality(Geometry geom1, Geometry geom2) {
return testVerticesEquality( geom1, geom2 );
}
private boolean testVerticesEquality(Geometry geom1, Geometry geom2) {
if ( geom1.getNumPoints() != geom2.getNumPoints() ) {
return false;
}
for ( int i = 0; i < geom1.getNumPoints(); i++ ) {
Coordinate cn1 = geom1.getCoordinates()[i];
Coordinate cn2 = geom2.getCoordinates()[i];
if ( !cn1.equals2D( cn2 ) ) {
return false;
}
}
return true;
}
}

View File

@ -8,9 +8,9 @@
/**
*
*/
package org.hibernate.spatial.testing.dialects.h2geodb;
package org.hibernate.spatial.testing.dialects.h2gis;
import org.hibernate.spatial.dialect.h2gis.GeoDbWkb;
import org.hibernate.spatial.dialect.h2gis.H2GISWkb;
import org.hibernate.spatial.testing.AbstractExpectationsFactory;
import org.hibernate.spatial.testing.NativeSQLStatement;
@ -25,9 +25,9 @@ import org.locationtech.jts.geom.Point;
*
* @Author Jan Boonen, Geodan IT b.v.
*/
public class GeoDBExpectationsFactory extends AbstractExpectationsFactory {
public class H2GISExpectationsFactory extends AbstractExpectationsFactory {
public GeoDBExpectationsFactory() {
public H2GISExpectationsFactory() {
super();
}
@ -356,7 +356,7 @@ public class GeoDBExpectationsFactory extends AbstractExpectationsFactory {
@Override
protected Geometry decode(Object o) {
return JTS.to( GeoDbWkb.from( o ) );
return JTS.to( H2GISWkb.from( o ) );
}
}

View File

@ -5,15 +5,14 @@
* 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.h2geodb;
package org.hibernate.spatial.testing.dialects.h2gis;
import java.util.Map;
import org.hibernate.spatial.CommonSpatialFunction;
import org.hibernate.spatial.GeomCodec;
import org.hibernate.spatial.dialect.h2gis.GeoDbWkb;
import org.hibernate.spatial.dialect.h2gis.H2GISWkb;
import org.hibernate.spatial.testing.AbstractExpectationsFactory;
import org.hibernate.spatial.testing.JTSGeometryEquality;
import org.hibernate.spatial.testing.datareader.TestData;
import org.hibernate.spatial.testing.datareader.TestSupport;
import org.hibernate.spatial.testing.dialects.NativeSQLTemplates;
@ -29,15 +28,11 @@ public class H2GisTestSupport extends TestSupport {
@Override
public TestData createTestData(TestDataPurpose purpose) {
return TestData.fromFile( "h2gis/test-geodb-data-set.xml" );
}
public JTSGeometryEquality createGeometryEquality() {
return new GeoDBGeometryEquality();
return TestData.fromFile( "h2gis/test-data-set.xml" );
}
public AbstractExpectationsFactory createExpectationsFactory() {
return new GeoDBExpectationsFactory();
return new H2GISExpectationsFactory();
}
@Override
@ -47,7 +42,7 @@ public class H2GisTestSupport extends TestSupport {
@Override
public PredicateRegexes predicateRegexes() {
return new PredicateRegexes("st_geomfromtext");
return new PredicateRegexes( "st_geomfromtext" );
}
@Override
@ -60,7 +55,7 @@ public class H2GisTestSupport extends TestSupport {
return new GeomCodec() {
@Override
public Geometry<?> toGeometry(Object in) {
return GeoDbWkb.from( in );
return H2GISWkb.from( in );
}
};
}