From 9d2bf8b467c86c158bc86e5db55a56b596b325b0 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Thu, 16 Apr 2015 21:47:00 +0200 Subject: [PATCH] HHH-6509 - Fixes Oracle11g integration tests --- .../resources/hibernate.properties | 6 +++--- hibernate-spatial/hibernate-spatial.gradle | 2 +- .../org/hibernate/spatial/HSMessageLogger.java | 13 +------------ .../spatial/integration/TestSpatialFunctions.java | 6 ++++++ .../spatial/integration/geolatte/GeomEntity.java | 14 ++++++++------ .../oracle/SDOGeometryExpectationsFactory.java | 2 +- .../src/test/resources/hibernate.properties | 12 ++---------- 7 files changed, 22 insertions(+), 33 deletions(-) diff --git a/hibernate-spatial/databases/oracle11g_spatial/resources/hibernate.properties b/hibernate-spatial/databases/oracle11g_spatial/resources/hibernate.properties index a62a6f0376..83fd492a6e 100644 --- a/hibernate-spatial/databases/oracle11g_spatial/resources/hibernate.properties +++ b/hibernate-spatial/databases/oracle11g_spatial/resources/hibernate.properties @@ -24,9 +24,9 @@ hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver -hibernate.connection.url jdbc:oracle:thin:@oracle11g.geovise.com:1521/orcl11g.geovise.com -hibernate.connection.username HBS -hibernate.connection.password HBS +hibernate.connection.url jdbc:oracle:thin:@hibernatespatial-oracle.cctaez8ywvn2.eu-west-1.rds.amazonaws.com:1521/ORCL +hibernate.connection.username hibspa +hibernate.connection.password L9un5Bh6 ## uncommenting this will fail a unit test!! #hibernate.spatial.ogc_strict false diff --git a/hibernate-spatial/hibernate-spatial.gradle b/hibernate-spatial/hibernate-spatial.gradle index 26a9782000..c5c934e3d5 100644 --- a/hibernate-spatial/hibernate-spatial.gradle +++ b/hibernate-spatial/hibernate-spatial.gradle @@ -36,7 +36,7 @@ dependencies { testCompile(libraries.junit) testCompile(project(':hibernate-testing')) testCompile([group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4']) -// testRuntime([group: 'com.oracle.jdbc', name: 'ojdbc6', version: '11.2.0.3']) +// testCompile([group: 'com.oracle.jdbc', name: 'ojdbc6', version: '11.1.0.7.0']) // testRuntime([group: 'com.microsoft', name: 'sqljdbc', version: '2.0']) // testRuntime("org.opengeo:geodb:0.7") // testRuntime("mysql:mysql-connector-java:5.1.15") diff --git a/hibernate-spatial/src/main/java/org/hibernate/spatial/HSMessageLogger.java b/hibernate-spatial/src/main/java/org/hibernate/spatial/HSMessageLogger.java index 76625b87a4..ea29c40e25 100644 --- a/hibernate-spatial/src/main/java/org/hibernate/spatial/HSMessageLogger.java +++ b/hibernate-spatial/src/main/java/org/hibernate/spatial/HSMessageLogger.java @@ -22,12 +22,7 @@ package org.hibernate.spatial; import org.jboss.logging.BasicLogger; -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; import org.jboss.logging.annotations.MessageLogger; -import org.hibernate.internal.CoreMessageLogger; - -import static org.jboss.logging.Logger.Level.WARN; /** * The logger interface for the Hibernate Spatial module. @@ -36,11 +31,5 @@ import static org.jboss.logging.Logger.Level.WARN; */ @MessageLogger(projectCode = "HHH") public interface HSMessageLogger extends BasicLogger { - /** - * Message indicating that user attempted to use the deprecated ValidTimeAuditStrategy - */ -// @LogMessage(level = WARN) -// @Message(value = "ValidTimeAuditStrategy is deprecated, please use ValidityAuditStrategy instead", id = 25001) -// void voidvalidTimeAuditStrategyDeprecated(); -} \ No newline at end of file +} diff --git a/hibernate-spatial/src/test/java/org/hibernate/spatial/integration/TestSpatialFunctions.java b/hibernate-spatial/src/test/java/org/hibernate/spatial/integration/TestSpatialFunctions.java index d2fd757f61..be7ae9fa38 100644 --- a/hibernate-spatial/src/test/java/org/hibernate/spatial/integration/TestSpatialFunctions.java +++ b/hibernate-spatial/src/test/java/org/hibernate/spatial/integration/TestSpatialFunctions.java @@ -502,12 +502,18 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase { } + // The convexhull tests are skipped for Oracle because of error: + // ORA-13276: internal error [Geodetic Geometry too big for Local Transform] in coordinate transformation + @Test + @SkipForDialect(value = OracleSpatial10gDialect.class) public void test_convexhull_on_jts() throws SQLException { convexhull( JTS ); } + @Test + @SkipForDialect(value = OracleSpatial10gDialect.class) public void test_convexhull_on_geolatte() throws SQLException { convexhull( GEOLATTE ); } diff --git a/hibernate-spatial/src/test/java/org/hibernate/spatial/integration/geolatte/GeomEntity.java b/hibernate-spatial/src/test/java/org/hibernate/spatial/integration/geolatte/GeomEntity.java index f0ea28a686..a912405ef3 100644 --- a/hibernate-spatial/src/test/java/org/hibernate/spatial/integration/geolatte/GeomEntity.java +++ b/hibernate-spatial/src/test/java/org/hibernate/spatial/integration/geolatte/GeomEntity.java @@ -37,19 +37,21 @@ import org.hibernate.spatial.testing.TestDataElement; /** * Test class used in unit testing. + * + * Not that this is Entity class uses raw Geometries, because in test classes a wide variety of SRIDs and + * coordinate spaces are mixed. (This creates notable problems for Oracle, which is very, very strict in what it accepts) + * */ @Entity @Table(name = "geomtest") public class GeomEntity { - private final static CoordinateReferenceSystem CRS = CoordinateReferenceSystems.PROJECTED_3DM_METER; - @Id private Integer id; private String type; - private Geometry geom; + private Geometry geom; public Integer getId() { return id; @@ -67,17 +69,17 @@ public class GeomEntity { this.type = type; } - public Geometry getGeom() { + public Geometry getGeom() { return geom; } - public void setGeom(Geometry geom) { + public void setGeom(Geometry geom) { this.geom = geom; } public static GeomEntity createFrom(TestDataElement element) throws WktDecodeException { WktDecoder decoder = Wkt.newDecoder( Wkt.Dialect.POSTGIS_EWKT_1 ); - Geometry geom = decoder.decode( element.wkt, CRS ); + Geometry geom = decoder.decode( element.wkt ); GeomEntity result = new GeomEntity(); result.setId( element.id ); result.setGeom( geom ); diff --git a/hibernate-spatial/src/test/java/org/hibernate/spatial/testing/dialects/oracle/SDOGeometryExpectationsFactory.java b/hibernate-spatial/src/test/java/org/hibernate/spatial/testing/dialects/oracle/SDOGeometryExpectationsFactory.java index cba48979a5..587ec3ad59 100644 --- a/hibernate-spatial/src/test/java/org/hibernate/spatial/testing/dialects/oracle/SDOGeometryExpectationsFactory.java +++ b/hibernate-spatial/src/test/java/org/hibernate/spatial/testing/dialects/oracle/SDOGeometryExpectationsFactory.java @@ -267,6 +267,6 @@ public class SDOGeometryExpectationsFactory extends AbstractExpectationsFactory @Override protected Geometry decode(Object o) { - return JTS.to(decoder.convert(o)); + return ( o != null) ? JTS.to(decoder.convert(o)) : null; } } diff --git a/hibernate-spatial/src/test/resources/hibernate.properties b/hibernate-spatial/src/test/resources/hibernate.properties index e0992e3da9..839c513895 100644 --- a/hibernate-spatial/src/test/resources/hibernate.properties +++ b/hibernate-spatial/src/test/resources/hibernate.properties @@ -65,24 +65,16 @@ hibernate.connection.username sa ## #hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect #hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver -#hibernate.connection.url jdbc:oracle:thin:@oracle11g.geovise.com:1521/orcl11g.geovise.com +#hibernate.connection.url jdbc:oracle:thin:@ec2-54-170-61-24.eu-west-1.compute.amazonaws.com:1521/ORCL #hibernate.connection.username HBS #hibernate.connection.password HBS + ## ## Test Oracle ogc_strict property setting ## #hibernate.spatial.ogc_strict false -## -## Oracle 10g -## -#hibernate.dialect org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect -#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver -#hibernate.connection.url jdbc:oracle:thin:@oracle.geovise.com/ORCL -#hibernate.connection.username hbs -#hibernate.connection.password hbs - ## ## MS SQL Server dialect