HHH-10211 - Checkstyle fixes

This commit is contained in:
Karel Maesen 2016-11-01 16:58:25 +01:00
parent 70d55987f8
commit 55ed5faa3b
18 changed files with 103 additions and 74 deletions

View File

@ -16,6 +16,7 @@ import org.hibernate.spatial.SpatialDialect;
import org.hibernate.spatial.SpatialFunction; import org.hibernate.spatial.SpatialFunction;
/** /**
*
* Created by Karel Maesen, Geovise BVBA on 01/11/16. * Created by Karel Maesen, Geovise BVBA on 01/11/16.
*/ */
public class PostgisPG9Dialect extends PostgreSQL9Dialect implements SpatialDialect { public class PostgisPG9Dialect extends PostgreSQL9Dialect implements SpatialDialect {

View File

@ -1,3 +1,9 @@
/*
* 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.oracle; package org.hibernate.spatial.dialect.oracle;
import java.sql.Connection; import java.sql.Connection;
@ -12,6 +18,7 @@ public class TestConnectionFinder implements ConnectionFinder {
final private ConnectionFinder internal = new DefaultConnectionFinder(); final private ConnectionFinder internal = new DefaultConnectionFinder();
/** /**
* Find an instance of Connection that can be cast to an {@code OracleConnection} instance. * Find an instance of Connection that can be cast to an {@code OracleConnection} instance.
* *

View File

@ -1,3 +1,9 @@
/*
* 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.postgis; package org.hibernate.spatial.dialect.postgis;
import java.sql.SQLException; import java.sql.SQLException;

View File

@ -13,8 +13,6 @@ import java.util.Map;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.junit.Test;
import org.hibernate.Criteria; import org.hibernate.Criteria;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
@ -25,6 +23,9 @@ import org.hibernate.spatial.criterion.SpatialRestrictions;
import org.hibernate.spatial.integration.jts.GeomEntity; import org.hibernate.spatial.integration.jts.GeomEntity;
import org.hibernate.spatial.testing.SpatialDialectMatcher; import org.hibernate.spatial.testing.SpatialDialectMatcher;
import org.hibernate.spatial.testing.SpatialFunctionalTestCase; import org.hibernate.spatial.testing.SpatialFunctionalTestCase;
import org.junit.Test;
import org.hibernate.testing.Skip; import org.hibernate.testing.Skip;
import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertEquals;

View File

@ -92,5 +92,3 @@ public class GeomEntity {
} }
} }

View File

@ -15,16 +15,16 @@ import java.sql.SQLException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.hibernate.spatial.HSMessageLogger;
import org.jboss.logging.Logger;
import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon; import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.io.ParseException; import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader; import com.vividsolutions.jts.io.WKTReader;
import org.jboss.logging.Logger;
import org.hibernate.spatial.HSMessageLogger;
/** /**
* An <code>AbstractExpectationsFactory</code> provides the expected * An <code>AbstractExpectationsFactory</code> provides the expected
* values to be used in the integration tests of the spatial functions * values to be used in the integration tests of the spatial functions
@ -754,7 +754,7 @@ public abstract class AbstractExpectationsFactory {
polygon.setSRID( getTestSrid() ); polygon.setSRID( getTestSrid() );
return polygon; return polygon;
} }
catch ( ParseException e ) { catch (ParseException e) {
throw new RuntimeException( e ); throw new RuntimeException( e );
} }
} }
@ -771,7 +771,7 @@ public abstract class AbstractExpectationsFactory {
point.setSRID( getTestSrid() ); point.setSRID( getTestSrid() );
return point; return point;
} }
catch ( ParseException e ) { catch (ParseException e) {
throw new RuntimeException( e ); throw new RuntimeException( e );
} }
} }
@ -814,7 +814,7 @@ public abstract class AbstractExpectationsFactory {
//this code is a hack to deal with Oracle Spatial that returns Blob's for asWKB() function //this code is a hack to deal with Oracle Spatial that returns Blob's for asWKB() function
//TODO -- clean up //TODO -- clean up
if ( val instanceof Blob ) { if ( val instanceof Blob ) {
val = (T) ( (Blob) val ).getBytes( 1, MAX_BYTE_LEN ); val = (T) ((Blob) val).getBytes( 1, MAX_BYTE_LEN );
} }
expected.put( id, val ); expected.put( id, val );
} }
@ -822,20 +822,26 @@ public abstract class AbstractExpectationsFactory {
return expected; return expected;
} }
finally { finally {
if (results != null) { if ( results != null ) {
try { try {
results.close(); results.close();
}catch(SQLException e) {} }
catch (SQLException e) {
}
} }
if ( preparedStatement != null ) { if ( preparedStatement != null ) {
try { try {
preparedStatement.close(); preparedStatement.close();
}catch(SQLException e) {} }
catch (SQLException e) {
}
} }
if ( cn != null ) { if ( cn != null ) {
try { try {
cn.close(); cn.close();
}catch(SQLException e){} }
catch (SQLException e) {
}
} }
} }
} }

View File

@ -16,8 +16,9 @@ import com.vividsolutions.jts.geom.GeometryCollection;
* <p/> * <p/>
* The notion of geometric equality can differ slightly between * The notion of geometric equality can differ slightly between
* spatial databases. * spatial databases.
*
* @deprecated Should be replaced by Geolatte-geom GeometryEquality
*/ */
//TODO -- replace by Geolatte-geom
@Deprecated @Deprecated
public class GeometryEquality { public class GeometryEquality {
@ -32,10 +33,12 @@ public class GeometryEquality {
if ( geom1.isEmpty() ) { if ( geom1.isEmpty() ) {
return geom2.isEmpty(); return geom2.isEmpty();
} }
if (!ignoreSRID && !equalSRID(geom1, geom2)) return false; if ( !ignoreSRID && !equalSRID( geom1, geom2 ) ) {
return false;
}
if ( geom1 instanceof GeometryCollection ) { if ( geom1 instanceof GeometryCollection ) {
if ( !( geom2 instanceof GeometryCollection ) ) { if ( !(geom2 instanceof GeometryCollection) ) {
return false; return false;
} }
GeometryCollection expectedCollection = (GeometryCollection) geom1; GeometryCollection expectedCollection = (GeometryCollection) geom1;
@ -59,11 +62,12 @@ public class GeometryEquality {
* *
* @param geom1 * @param geom1
* @param geom2 * @param geom2
*
* @return * @return
*/ */
private boolean equalSRID(Geometry geom1, Geometry geom2) { private boolean equalSRID(Geometry geom1, Geometry geom2) {
return geom1.getSRID() == geom2.getSRID() || return geom1.getSRID() == geom2.getSRID() ||
( geom1.getSRID() < 1 && geom2.getSRID() < 1); (geom1.getSRID() < 1 && geom2.getSRID() < 1);
} }
/** /**
@ -76,7 +80,7 @@ public class GeometryEquality {
*/ */
protected boolean testSimpleGeometryEquality(Geometry geom1, Geometry geom2) { protected boolean testSimpleGeometryEquality(Geometry geom1, Geometry geom2) {
//return geom1.equals(geom2); //return geom1.equals(geom2);
return testTypeAndVertexEquality( geom1, geom2); return testTypeAndVertexEquality( geom1, geom2 );
} }
protected boolean testTypeAndVertexEquality(Geometry geom1, Geometry geom2) { protected boolean testTypeAndVertexEquality(Geometry geom1, Geometry geom2) {
@ -118,4 +122,3 @@ public class GeometryEquality {
return c1.x == c2.x && c1.y == c2.y; return c1.x == c2.x && c1.y == c2.y;
} }
} }

View File

@ -52,10 +52,10 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
try { try {
dataSourceUtils.insertTestData( testData ); dataSourceUtils.insertTestData( testData );
} }
catch ( BatchUpdateException e ) { catch (BatchUpdateException e) {
throw new RuntimeException( e.getNextException() ); throw new RuntimeException( e.getNextException() );
} }
catch ( SQLException e ) { catch (SQLException e) {
throw new RuntimeException( e ); throw new RuntimeException( e );
} }
} }
@ -74,12 +74,12 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
try { try {
session = openSession(); session = openSession();
tx = session.beginTransaction(); tx = session.beginTransaction();
String hql = String.format("delete from org.hibernate.spatial.integration.%s.GeomEntity", pckg); String hql = String.format( "delete from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
Query q = session.createQuery( hql ); Query q = session.createQuery( hql );
q.executeUpdate(); q.executeUpdate();
tx.commit(); tx.commit();
} }
catch ( Exception e ) { catch (Exception e) {
if ( tx != null ) { if ( tx != null ) {
tx.rollback(); tx.rollback();
} }
@ -98,7 +98,7 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
* @return * @return
*/ */
protected void afterConfigurationBuilt(Configuration cfg) { protected void afterConfigurationBuilt(Configuration cfg) {
super.afterConfigurationBuilt(cfg); super.afterConfigurationBuilt( cfg );
initializeSpatialTestSupport( serviceRegistry() ); initializeSpatialTestSupport( serviceRegistry() );
} }
@ -110,7 +110,7 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
testData = support.createTestData( this ); testData = support.createTestData( this );
geometryEquality = support.createGeometryEquality(); geometryEquality = support.createGeometryEquality();
} }
catch ( Exception e ) { catch (Exception e) {
throw new RuntimeException( e ); throw new RuntimeException( e );
} }
} }
@ -139,7 +139,7 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
} }
public String[] getMappings() { public String[] getMappings() {
return new String[] { }; return new String[] {};
} }
@Override @Override
@ -198,7 +198,7 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
} }
protected <T> void compare(Map<Integer, T> expected, Map<Integer, T> received, String geometryType) { protected <T> void compare(Map<Integer, T> expected, Map<Integer, T> received, String geometryType) {
for ( Map.Entry<Integer, T> entry: expected.entrySet()) { for ( Map.Entry<Integer, T> entry : expected.entrySet() ) {
Integer id = entry.getKey(); Integer id = entry.getKey();
getLogger().debug( "Case :" + id ); getLogger().debug( "Case :" + id );
getLogger().debug( "expected: " + expected.get( id ) ); getLogger().debug( "expected: " + expected.get( id ) );
@ -212,9 +212,10 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
if ( expected instanceof byte[] ) { if ( expected instanceof byte[] ) {
assertArrayEquals( "Failure on testsuite-suite for case " + id, (byte[]) expected, (byte[]) received ); assertArrayEquals( "Failure on testsuite-suite for case " + id, (byte[]) expected, (byte[]) received );
} else if ( expected instanceof Geometry ) { }
if ( JTS.equals(geometryType) ) { else if ( expected instanceof Geometry ) {
if ( !( received instanceof Geometry ) ) { if ( JTS.equals( geometryType ) ) {
if ( !(received instanceof Geometry) ) {
fail( fail(
"Expected a JTS Geometry, but received an object of type " + received.getClass() "Expected a JTS Geometry, but received an object of type " + received.getClass()
.getCanonicalName() .getCanonicalName()
@ -224,8 +225,9 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
"Failure on testsuite-suite for case " + id, "Failure on testsuite-suite for case " + id,
geometryEquality.test( (Geometry) expected, (Geometry) received ) geometryEquality.test( (Geometry) expected, (Geometry) received )
); );
} else { }
if ( !( received instanceof org.geolatte.geom.Geometry ) ) { else {
if ( !(received instanceof org.geolatte.geom.Geometry) ) {
fail( fail(
"Expected a Geolatte Geometry, but received an object of type " + received.getClass() "Expected a Geolatte Geometry, but received an object of type " + received.getClass()
.getCanonicalName() .getCanonicalName()
@ -233,14 +235,17 @@ public abstract class SpatialFunctionalTestCase extends BaseCoreFunctionalTestCa
} }
assertTrue( assertTrue(
"Failure on testsuite-suite for case " + id, "Failure on testsuite-suite for case " + id,
geometryEquality.test( (Geometry) expected, (Geometry) org.geolatte.geom.jts.JTS.to((org.geolatte.geom.Geometry)received) ) geometryEquality.test(
(Geometry) expected,
(Geometry) org.geolatte.geom.jts.JTS.to( (org.geolatte.geom.Geometry) received )
)
); );
} }
} }
else { else {
if ( expected instanceof Long ) { if ( expected instanceof Long ) {
assertEquals( "Failure on testsuite-suite for case " + id, ( (Long) expected ).intValue(), received ); assertEquals( "Failure on testsuite-suite for case " + id, ((Long) expected).intValue(), received );
} }
else { else {
assertEquals( "Failure on testsuite-suite for case " + id, expected, received ); assertEquals( "Failure on testsuite-suite for case " + id, expected, received );

View File

@ -26,4 +26,3 @@ public class TestDataElement {
} }
} }

View File

@ -29,7 +29,7 @@ public class TestDataReader {
Document document = reader.read( getInputStream( fileName ) ); Document document = reader.read( getInputStream( fileName ) );
addDataElements( document, testDataElements ); addDataElements( document, testDataElements );
} }
catch ( DocumentException e ) { catch (DocumentException e) {
throw new RuntimeException( e ); throw new RuntimeException( e );
} }
return testDataElements; return testDataElements;
@ -47,7 +47,7 @@ public class TestDataReader {
int id = Integer.parseInt( element.selectSingleNode( "id" ).getText() ); int id = Integer.parseInt( element.selectSingleNode( "id" ).getText() );
String type = element.selectSingleNode( "type" ).getText(); String type = element.selectSingleNode( "type" ).getText();
String wkt = element.selectSingleNode( "wkt" ).getText(); String wkt = element.selectSingleNode( "wkt" ).getText();
TestDataElement testDataElement = new TestDataElement( id, type, wkt); TestDataElement testDataElement = new TestDataElement( id, type, wkt );
testDataElements.add( testDataElement ); testDataElements.add( testDataElement );
} }

View File

@ -9,8 +9,8 @@ package org.hibernate.spatial.testing;
import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.AvailableSettings;
import org.hibernate.engine.config.spi.ConfigurationService; import org.hibernate.engine.config.spi.ConfigurationService;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;

View File

@ -79,4 +79,3 @@ public class TestSupportFactories {
} }
} }

View File

@ -14,10 +14,10 @@ public class WktUtility {
static public int getSRID(String wkt) { static public int getSRID(String wkt) {
String[] tokens = wkt.split( ";" ); String[] tokens = wkt.split( ";" );
if (tokens.length == 1){ if ( tokens.length == 1 ) {
return 0; return 0;
} }
String[] sridTokens = tokens[0].split("="); String[] sridTokens = tokens[0].split( "=" );
if ( sridTokens.length < 2 ) { if ( sridTokens.length < 2 ) {
throw new IllegalArgumentException( "Can't parse " + wkt ); throw new IllegalArgumentException( "Can't parse " + wkt );
} }
@ -25,10 +25,11 @@ public class WktUtility {
} }
static public String getWkt(String wkt) { static public String getWkt(String wkt) {
String[] tokens = wkt.split(";"); String[] tokens = wkt.split( ";" );
if ( tokens.length > 1 ) { if ( tokens.length > 1 ) {
return tokens[1]; return tokens[1];
} else { }
else {
return wkt; return wkt;
} }

View File

@ -43,14 +43,14 @@ public class GeoDBExpectationsFactory extends AbstractExpectationsFactory {
@Override @Override
protected NativeSQLStatement createNativeBoundaryStatement() { protected NativeSQLStatement createNativeBoundaryStatement() {
return createNativeSQLStatement("select id, ST_Boundary(geom) from GEOMTEST"); return createNativeSQLStatement( "select id, ST_Boundary(geom) from GEOMTEST" );
} }
@Override @Override
protected NativeSQLStatement createNativeBufferStatement(Double distance) { protected NativeSQLStatement createNativeBufferStatement(Double distance) {
return createNativeSQLStatement( return createNativeSQLStatement(
"select t.id, ST_Buffer(t.geom,?) from GEOMTEST t where ST_SRID(t.geom) = 4326", "select t.id, ST_Buffer(t.geom,?) from GEOMTEST t where ST_SRID(t.geom) = 4326",
new Object[] { distance } new Object[] {distance}
); );
} }
@ -87,7 +87,7 @@ public class GeoDBExpectationsFactory extends AbstractExpectationsFactory {
@Override @Override
protected NativeSQLStatement createNativeDimensionSQL() { protected NativeSQLStatement createNativeDimensionSQL() {
return createNativeSQLStatement("select id, ST_Dimension(geom) from GEOMTEST"); return createNativeSQLStatement( "select id, ST_Dimension(geom) from GEOMTEST" );
} }
@Override @Override
@ -277,14 +277,16 @@ public class GeoDBExpectationsFactory extends AbstractExpectationsFactory {
*/ */
@Override @Override
protected NativeSQLStatement createNativeRelateStatement(Geometry geom, protected NativeSQLStatement createNativeRelateStatement(
Geometry geom,
String matrix) { String matrix) {
String sql = "select t.id, ST_Relate(t.geom, ST_GeomFromText(?, 4326), '" + matrix + "' ) from GEOMTEST t where ST_Relate(t.geom, ST_GeomFromText(?, 4326), '" + matrix + "') = 'true' and ST_SRID(t.geom) = 4326"; String sql = "select t.id, ST_Relate(t.geom, ST_GeomFromText(?, 4326), '" + matrix + "' ) from GEOMTEST t where ST_Relate(t.geom, ST_GeomFromText(?, 4326), '" + matrix + "') = 'true' and ST_SRID(t.geom) = 4326";
return createNativeSQLStatementAllWKTParams(sql, geom.toText()); return createNativeSQLStatementAllWKTParams( sql, geom.toText() );
} }
@Override @Override
protected NativeSQLStatement createNativeDwithinStatement(Point geom, protected NativeSQLStatement createNativeDwithinStatement(
Point geom,
double distance) { double distance) {
String sql = "select t.id, ST_DWithin(t.geom, ST_GeomFromText(?, 4326), " String sql = "select t.id, ST_DWithin(t.geom, ST_GeomFromText(?, 4326), "
+ distance + distance

View File

@ -20,8 +20,9 @@ import org.hibernate.spatial.testing.GeometryEquality;
* Geometry objects, which cannot be cast to {@link org.hibernate.spatial.jts.mgeom.MGeometry} objects. * Geometry objects, which cannot be cast to {@link org.hibernate.spatial.jts.mgeom.MGeometry} objects.
* *
* @author Jan Boonen, Geodan IT b.v. * @author Jan Boonen, Geodan IT b.v.
* @deprecated This should no longer be necesseary
*/ */
@Deprecated //NO LONGER REQUIRED @Deprecated
public class GeoDBGeometryEquality extends GeometryEquality { public class GeoDBGeometryEquality extends GeometryEquality {
@Override @Override

View File

@ -10,23 +10,24 @@
*/ */
package org.hibernate.spatial.testing.dialects.h2geodb; package org.hibernate.spatial.testing.dialects.h2geodb;
import org.hibernate.spatial.testing.AbstractExpectationsFactory;
import org.hibernate.spatial.testing.NativeSQLStatement;
import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Point;
import org.geolatte.geom.ByteBuffer; import org.geolatte.geom.ByteBuffer;
import org.geolatte.geom.codec.Wkb; import org.geolatte.geom.codec.Wkb;
import org.geolatte.geom.jts.JTS; import org.geolatte.geom.jts.JTS;
import org.hibernate.spatial.testing.AbstractExpectationsFactory;
import org.hibernate.spatial.testing.NativeSQLStatement;
/** /**
* A Factory class that generates expected {@link org.hibernate.spatial.testing.NativeSQLStatement}s for GeoDB * A Factory class that generates expected {@link org.hibernate.spatial.testing.NativeSQLStatement}s for GeoDB
* version < 0.4. These versions don't support storage of the SRID value with * version < 0.4. These versions don't support storage of the SRID value with
* the geometry. * the geometry.
* *
* @author Jan Boonen, Geodan IT b.v. * @author Jan Boonen, Geodan IT b.v.
* @deprecated No longer used
*/ */
@Deprecated //Class no longer used. Remove. @Deprecated
public class GeoDBNoSRIDExpectationsFactory extends AbstractExpectationsFactory { public class GeoDBNoSRIDExpectationsFactory extends AbstractExpectationsFactory {
public GeoDBNoSRIDExpectationsFactory(GeoDBDataSourceUtils dataSourceUtils) { public GeoDBNoSRIDExpectationsFactory(GeoDBDataSourceUtils dataSourceUtils) {
@ -54,7 +55,7 @@ public class GeoDBNoSRIDExpectationsFactory extends AbstractExpectationsFactory
protected NativeSQLStatement createNativeBufferStatement(Double distance) { protected NativeSQLStatement createNativeBufferStatement(Double distance) {
return createNativeSQLStatement( return createNativeSQLStatement(
"select t.id, ST_Buffer(t.geom,?) from GEOMTEST t where ST_SRID(t.geom) = 4326", "select t.id, ST_Buffer(t.geom,?) from GEOMTEST t where ST_SRID(t.geom) = 4326",
new Object[] { distance } new Object[] {distance}
); );
} }
@ -192,7 +193,8 @@ public class GeoDBNoSRIDExpectationsFactory extends AbstractExpectationsFactory
} }
@Override @Override
protected NativeSQLStatement createNativeRelateStatement(Geometry geom, protected NativeSQLStatement createNativeRelateStatement(
Geometry geom,
String matrix) { String matrix) {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"Method ST_Relate() is not implemented in the current version of GeoDB." "Method ST_Relate() is not implemented in the current version of GeoDB."

View File

@ -10,8 +10,6 @@ package org.hibernate.spatial.testing.dialects.h2geodb;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.spatial.testing.AbstractExpectationsFactory; import org.hibernate.spatial.testing.AbstractExpectationsFactory;
import org.hibernate.spatial.testing.DataSourceUtils; import org.hibernate.spatial.testing.DataSourceUtils;
@ -19,6 +17,7 @@ import org.hibernate.spatial.testing.GeometryEquality;
import org.hibernate.spatial.testing.SQLExpressionTemplate; import org.hibernate.spatial.testing.SQLExpressionTemplate;
import org.hibernate.spatial.testing.TestData; import org.hibernate.spatial.testing.TestData;
import org.hibernate.spatial.testing.TestSupport; import org.hibernate.spatial.testing.TestSupport;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
/** /**
@ -32,10 +31,10 @@ public class GeoDBTestSupport extends TestSupport {
try { try {
return new GeoDBDataSourceUtils( driver(), url(), user(), passwd(), getSQLExpressionTemplate() ); return new GeoDBDataSourceUtils( driver(), url(), user(), passwd(), getSQLExpressionTemplate() );
} }
catch ( SQLException e ) { catch (SQLException e) {
throw new RuntimeException( e ); throw new RuntimeException( e );
} }
catch ( IOException e ) { catch (IOException e) {
throw new RuntimeException( e ); throw new RuntimeException( e );
} }
} }
@ -49,10 +48,11 @@ public class GeoDBTestSupport extends TestSupport {
} }
public AbstractExpectationsFactory createExpectationsFactory(DataSourceUtils dataSourceUtils) { public AbstractExpectationsFactory createExpectationsFactory(DataSourceUtils dataSourceUtils) {
if ( dataSourceUtils instanceof GeoDBDataSourceUtils) { if ( dataSourceUtils instanceof GeoDBDataSourceUtils ) {
return new GeoDBExpectationsFactory( (GeoDBDataSourceUtils) dataSourceUtils ); return new GeoDBExpectationsFactory( (GeoDBDataSourceUtils) dataSourceUtils );
} else { }
throw new IllegalArgumentException("Requires a GeoDBDataSourceUtils instance"); else {
throw new IllegalArgumentException( "Requires a GeoDBDataSourceUtils instance" );
} }
} }
@ -60,6 +60,4 @@ public class GeoDBTestSupport extends TestSupport {
return new GeoDBExpressionTemplate(); return new GeoDBExpressionTemplate();
} }
} }