HHH-6513 Fixes SQL Server 2008 integration tests.
This commit is contained in:
parent
28cf93f6eb
commit
a4e8d02ead
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program 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 distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
jdbcDependency "com.microsoft:sqljdbc:2.0"
|
|
@ -0,0 +1,40 @@
|
|||
#
|
||||
# Hibernate, Relational Persistence for Idiomatic Java
|
||||
#
|
||||
# Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
# indicated by the @author tags or express copyright attribution
|
||||
# statements applied by the authors. All third-party contributions are
|
||||
# distributed under license by Red Hat Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing to use, modify,
|
||||
# copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
# Lesser General Public License, as published by the Free Software Foundation.
|
||||
#
|
||||
# This program 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 distribution; if not, write to:
|
||||
# Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect
|
||||
hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
hibernate.connection.url jdbc:sqlserver://192.168.0.100:1433;databaseName=HBS
|
||||
hibernate.connection.username hbs
|
||||
hibernate.connection.password hbs
|
||||
|
||||
|
||||
hibernate.connection.pool_size 5
|
||||
|
||||
hibernate.show_sql true
|
||||
hibernate.format_sql true
|
||||
|
||||
hibernate.max_fetch_depth 5
|
||||
|
||||
hibernate.cache.region_prefix hibernate.test
|
||||
hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
|
|
@ -18,8 +18,8 @@ dependencies {
|
|||
testCompile( libraries.junit )
|
||||
testCompile( project(':hibernate-testing') )
|
||||
testCompile( [group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4'])
|
||||
testCompile([group: 'com.oracle.jdbc', name:'ojdbc6', version:'11.1.0.7.0'])
|
||||
testCompile([group: 'com.microsoft', name: 'sqljdbc', version: '2.0'])
|
||||
// testCompile([group: 'com.oracle.jdbc', name:'ojdbc6', version:'11.1.0.7.0'])
|
||||
// testCompile([group: 'com.microsoft', name: 'sqljdbc', version: '2.0'])
|
||||
|
||||
matrixRuntime( 'jaxen:jaxen:1.1' )
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#! /bin/sh
|
||||
# gradle -Dhibernate-matrix-databases=/home/maesenka/workspaces/github/hibernate-core/hibernate-spatial/databases
|
||||
gradle -Dhibernate-matrix-databases="/home/maesenka/workspaces/github/hibernate-core/hibernate-spatial/databases" -Dhibernate-matrix-ignore='mysql50,mysql51,postgresql82,postgresql83,postgresql84' $@
|
||||
#! /bin/bash
|
||||
|
||||
TASK=matrix
|
||||
if [[ -n $@ ]]; then
|
||||
TASK="$@"
|
||||
fi
|
||||
echo "TASK : $TASK"
|
||||
gradle -Dhibernate-matrix-databases="/home/maesenka/workspaces/github/hibernate-core/hibernate-spatial/databases" -Dhibernate-matrix-ignore='mysql50,mysql51,postgresql82,postgresql83,postgresql84' $TASK
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
package org.hibernate.spatial.dialect.sqlserver;
|
||||
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.dialect.SQLServer2008Dialect;
|
||||
import org.hibernate.dialect.function.SQLFunctionTemplate;
|
||||
import org.hibernate.spatial.GeometryType;
|
||||
|
@ -103,6 +104,13 @@ public class SqlServer2008SpatialDialect extends SQLServer2008Dialect implements
|
|||
registerFunction( "pointonsurface", new SQLFunctionTemplate( GeometryType.INSTANCE, "?1.STPointOnSurface()" ) );
|
||||
}
|
||||
|
||||
//Temporary Fix for HHH-6074
|
||||
@Override
|
||||
public String getTypeName(int code, long length, int precision, int scale) throws HibernateException {
|
||||
if (code == 3000) return "GEOMETRY";
|
||||
return super.getTypeName(code, length, precision, scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||
if ( sqlTypeDescriptor instanceof GeometrySqlTypeDescriptor) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*
|
||||
* For more information, visit: http://www.hibernatespatial.org/
|
||||
*/
|
||||
package org.hibernate.spatial.testing.dialects.sqlserver.convertors;
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
/**
|
||||
* @author Karel Maesen, Geovise BVBA.
|
||||
|
@ -32,9 +32,6 @@ package org.hibernate.spatial.testing.dialects.sqlserver.convertors;
|
|||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.hibernate.spatial.Log;
|
||||
import org.hibernate.spatial.LogFactory;
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.Decoders;
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.Encoders;
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.OpenGisType;
|
||||
import org.hibernate.spatial.testing.DataSourceUtils;
|
||||
import org.hibernate.spatial.testing.SpatialFunctionalTestCase;
|
||||
import org.hibernate.spatial.testing.TestData;
|
||||
|
@ -67,7 +64,6 @@ public abstract class AbstractConvertorTest extends SpatialFunctionalTestCase {
|
|||
Map<Integer, byte[]> encodedGeoms;
|
||||
Map<Integer, Geometry> expectedGeoms;
|
||||
|
||||
|
||||
public void beforeClass() {
|
||||
dataSourceUtils = new DataSourceUtils(
|
||||
"sqlserver/hibernate-spatial-sqlserver-test.properties",
|
||||
|
@ -84,17 +80,17 @@ public abstract class AbstractConvertorTest extends SpatialFunctionalTestCase {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void afterClass() {
|
||||
try {
|
||||
String sql = dataSourceUtils.parseSqlIn("sqlserver/drop-sqlserver-test-schema.sql");
|
||||
dataSourceUtils.executeStatement(sql);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
//
|
||||
// public void afterClass() {
|
||||
// try {
|
||||
// String sql = dataSourceUtils.parseSqlIn("sqlserver/drop-sqlserver-test-schema.sql");
|
||||
// dataSourceUtils.executeStatement(sql);
|
||||
// } catch (SQLException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
|
||||
public void doDecoding(OpenGisType type) {
|
||||
rawResults = dataSourceUtils.rawDbObjects(type.toString());
|
|
@ -23,11 +23,9 @@
|
|||
* For more information, visit: http://www.hibernatespatial.org/
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.sqlserver.convertors;
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.OpenGisType;
|
||||
import org.hibernate.testing.AfterClassOnce;
|
||||
import org.hibernate.testing.BeforeClassOnce;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.junit.Test;
|
||||
|
@ -43,7 +41,7 @@ import org.junit.Test;
|
|||
public class GeometryCollectionConvertorTest extends AbstractConvertorTest {
|
||||
|
||||
@BeforeClassOnce
|
||||
public void setUp() {
|
||||
public void beforeClass() {
|
||||
super.beforeClass();
|
||||
doDecoding(OpenGisType.GEOMETRYCOLLECTION);
|
||||
doEncoding();
|
||||
|
@ -59,9 +57,4 @@ public class GeometryCollectionConvertorTest extends AbstractConvertorTest {
|
|||
super.test_decoding();
|
||||
}
|
||||
|
||||
@AfterClassOnce
|
||||
public void afterClass(){
|
||||
super.afterClass();
|
||||
}
|
||||
|
||||
}
|
|
@ -23,12 +23,11 @@
|
|||
* For more information, visit: http://www.hibernatespatial.org/
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.sqlserver.convertors;
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.OpenGisType;
|
||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
||||
import org.hibernate.testing.BeforeClassOnce;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
|
@ -42,7 +41,8 @@ import static org.junit.Assert.assertTrue;
|
|||
public class LineStringConvertorTest extends AbstractConvertorTest {
|
||||
|
||||
@BeforeClassOnce
|
||||
public void setUp() {
|
||||
public void beforeClass() {
|
||||
super.beforeClass();
|
||||
doDecoding(OpenGisType.LINESTRING);
|
||||
doEncoding();
|
||||
}
|
|
@ -23,10 +23,9 @@
|
|||
* For more information, visit: http://www.hibernatespatial.org/
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.sqlserver.convertors;
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.OpenGisType;
|
||||
import org.hibernate.testing.BeforeClassOnce;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.junit.Test;
|
||||
|
@ -35,7 +34,8 @@ import org.junit.Test;
|
|||
public class MultiLineStringConvertorTest extends AbstractConvertorTest {
|
||||
|
||||
@BeforeClassOnce
|
||||
public void setUp() {
|
||||
public void beforeClass() {
|
||||
super.beforeClass();
|
||||
doDecoding( OpenGisType.MULTILINESTRING );
|
||||
doEncoding();
|
||||
}
|
|
@ -23,10 +23,9 @@
|
|||
* For more information, visit: http://www.hibernatespatial.org/
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.sqlserver.convertors;
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.OpenGisType;
|
||||
import org.hibernate.testing.BeforeClassOnce;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.junit.Test;
|
||||
|
@ -35,7 +34,8 @@ import org.junit.Test;
|
|||
public class MultiPointConvertorTest extends AbstractConvertorTest {
|
||||
|
||||
@BeforeClassOnce
|
||||
public void setUp() {
|
||||
public void beforeClass() {
|
||||
super.beforeClass();
|
||||
doDecoding( OpenGisType.MULTIPOINT );
|
||||
doEncoding();
|
||||
}
|
|
@ -23,10 +23,9 @@
|
|||
* For more information, visit: http://www.hibernatespatial.org/
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.sqlserver.convertors;
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.OpenGisType;
|
||||
import org.hibernate.testing.BeforeClassOnce;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.junit.Test;
|
||||
|
@ -35,7 +34,8 @@ import org.junit.Test;
|
|||
public class MultiPolygonConvertorTest extends AbstractConvertorTest {
|
||||
|
||||
@BeforeClassOnce
|
||||
public void setUp() {
|
||||
public void beforeClass() {
|
||||
super.beforeClass();
|
||||
doDecoding( OpenGisType.MULTIPOLYGON );
|
||||
doEncoding();
|
||||
}
|
|
@ -23,12 +23,11 @@
|
|||
* For more information, visit: http://www.hibernatespatial.org/
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.sqlserver.convertors;
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.OpenGisType;
|
||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
||||
import org.hibernate.testing.BeforeClassOnce;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
|
@ -44,7 +43,8 @@ import static junit.framework.Assert.assertEquals;
|
|||
public class PointConvertorTest extends AbstractConvertorTest {
|
||||
|
||||
@BeforeClassOnce
|
||||
public void setup() {
|
||||
public void beforeClass() {
|
||||
super.beforeClass();
|
||||
doDecoding( OpenGisType.POINT );
|
||||
doEncoding();
|
||||
}
|
|
@ -23,10 +23,9 @@
|
|||
* For more information, visit: http://www.hibernatespatial.org/
|
||||
*/
|
||||
|
||||
package org.hibernate.spatial.testing.dialects.sqlserver.convertors;
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.OpenGisType;
|
||||
import org.hibernate.testing.BeforeClassOnce;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.junit.Test;
|
||||
|
@ -36,7 +35,8 @@ public class PolygonConvertorTest extends AbstractConvertorTest {
|
|||
|
||||
|
||||
@BeforeClassOnce
|
||||
public void setUp() {
|
||||
public void beforeClass() {
|
||||
super.beforeClass();
|
||||
doDecoding( OpenGisType.POLYGON );
|
||||
doEncoding();
|
||||
}
|
|
@ -58,7 +58,7 @@ hibernate.jdbc.batch_versioned_data true
|
|||
|
||||
#hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect
|
||||
#hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
#hibernate.connection.url jdbc:sqlserver://192.168.122.67:1433;databaseName=HBS
|
||||
#hibernate.connection.url jdbc:sqlserver://192.168.0.100:1433;databaseName=HBS
|
||||
#hibernate.connection.username hbs
|
||||
#hibernate.connection.password hbs
|
||||
#
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
# $Id: hibernate-spatial-sqlserver-test.properties 182 2010-03-20 17:30:12Z maesenka $
|
||||
#
|
||||
|
||||
#jdbcUrl = jdbc:sqlserver://192.168.0.100:1433;databaseName=HBS
|
||||
#jdbcDriver = com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
#jdbcUser = hbs
|
||||
#jdbcPass = hbs
|
||||
#dataset = test-data-set.xml
|
||||
jdbcUrl = jdbc:sqlserver://192.168.0.100:1433;databaseName=HBS
|
||||
jdbcDriver = com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
jdbcUser = hbs
|
||||
jdbcPass = hbs
|
||||
dataset = test-data-set.xml
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue