Skip to content

Commit

Permalink
#166 build against JTS 1.17.1.
Browse files Browse the repository at this point in the history
Bump Hibernate Spatial to 1.1.3.2.
Add specific tests for Postgis
  • Loading branch information
etj committed Feb 8, 2021
1 parent 3cd1942 commit c7d90fa
Show file tree
Hide file tree
Showing 8 changed files with 237 additions and 11 deletions.
159 changes: 159 additions & 0 deletions src/services/core/persistence-pg-test/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/* (c) 2021 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.geoserver.geofence</groupId>
<artifactId>geofence-core</artifactId>
<version>3.4-SNAPSHOT</version>
</parent>

<groupId>org.geoserver.geofence</groupId>
<artifactId>geofence-persistence-pg-test</artifactId>
<packaging>jar</packaging>
<name>GeoFence - Core - Persistence PostGIS test</name>

<dependencies>

<dependency>
<groupId>org.geoserver.geofence</groupId>
<artifactId>geofence-model-internal</artifactId>
</dependency>

<dependency>
<groupId>org.geoserver.geofence</groupId>
<artifactId>geofence-persistence</artifactId>
</dependency>

<dependency>
<!-- we need this dep to have a meaningful stacktrace -->
<groupId>org.geoserver.geofence</groupId>
<artifactId>geofence-persistence</artifactId>
<classifier>test-sources</classifier>
<type>test-jar</type>
<version>${project.version}</version>
</dependency>

<dependency>
<!-- we need this dep to have a meaningful stacktrace -->
<groupId>org.hibernatespatial</groupId>
<artifactId>hibernate-spatial</artifactId>
</dependency>

<dependency>
<groupId>org.hibernatespatial</groupId>
<artifactId>hibernate-spatial-postgis</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.postgis</groupId>
<artifactId>postgis-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>org.postgis</groupId>
<artifactId>postgis-stubs</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<testSourceDirectory>${project.build.directory}/original-test-sources</testSourceDirectory>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.geoserver.geofence</groupId>
<artifactId>geofence-persistence</artifactId>
<classifier>test-sources</classifier>
<type>test-jar</type>
<version>${project.version}</version>

<outputDirectory>${project.build.directory}/original-test-sources</outputDirectory>

<!-- we have our one -->
<excludes>geofence-datasource-ovr.properties</excludes>

</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>


<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>3.0</version>

<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<!--<phase>process-classes</phase>-->
</execution>
</executions>
<configuration>
<hibernatetool destdir="target/classes">

<annotationconfiguration configurationfile="src/test/resources/hibernate.cfg.xml"/>
<!--<jdbcconfiguration packagename="it" />-->
<!--<hbm2hbmxml destdir="target/generated-sources/hibernate" />-->
<!--<hbm2cfgxml />-->
<!--<hbm2dao jdk5="true" ejb3="true" />-->
<!--hbm2ddl-->
<classpath>
<path location="target/classes"/>
</classpath>

</hibernatetool>

</configuration>
</plugin>
</plugins>

</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# /* (c) 2014 Open Source Geospatial Foundation - all rights reserved
# * This code is licensed under the GPL 2.0 license, available at the root
# * application directory.
# */
#

geofenceEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=create-drop
geofenceVendorAdapter.generateDdl=true
geofenceVendorAdapter.showSql=true

geofenceVendorAdapter.databasePlatform=org.hibernatespatial.postgis.PostgisDialect
geofenceDataSource.driverClassName=org.postgresql.Driver
geofenceDataSource.url=jdbc:postgresql://localhost:5432/geofence_test
geofenceDataSource.username=geofence_test
geofenceDataSource.password=geofence_test
#geofenceEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]=geofence_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# /* (c) 2014 Open Source Geospatial Foundation - all rights reserved
# * This code is licensed under the GPL 2.0 license, available at the root
# * application directory.
# */
#
log4j.rootLogger=INFO, consoleAppender

log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.consoleAppender.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS} %c::%M - %m%n

log4j.logger.org.hibernate=INFO
log4j.logger.com.trg=INFO

log4j.logger.org.geoserver.geofence=DEBUG
32 changes: 28 additions & 4 deletions src/services/core/persistence/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@
</dependency>

<!-- CGLIB -->
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
Expand Down Expand Up @@ -241,6 +237,34 @@

</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>test-jar</goal>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>

</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void testLayerDetailsPK() {
}

@Test
public void testPersistLayerDetailsWithSpatailFilterType() throws Exception {
public void testPersistLayerDetailsWithSpatialFilterType() throws Exception {

long rid = createRule().getId();

Expand All @@ -243,8 +243,7 @@ public void testPersistLayerDetailsWithSpatailFilterType() throws Exception {
details.getAttributes().add(new LayerAttribute("a3", AccessType.READWRITE));
details.getAttributes().add(new LayerAttribute("a4", AccessType.READWRITE));

GeometryFactory factory = new GeometryFactory();
details.setArea(factory.createMultiPolygon());
details.setArea(buildMultiPolygon());
details.setSpatialFilterType(SpatialFilterType.INTERSECT);

detailsDAO.persist(details);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@
geofenceEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=create-drop
geofenceVendorAdapter.generateDdl=true
geofenceVendorAdapter.showSql=true

#geofenceVendorAdapter.databasePlatform=org.hibernatespatial.postgis.PostgisDialect
#geofenceDataSource.driverClassName=org.postgresql.Driver
#geofenceDataSource.url=jdbc:postgresql://localhost:5432/geofence_test
#geofenceDataSource.username=geofence_test
#geofenceDataSource.password=geofence_test
10 changes: 9 additions & 1 deletion src/services/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@
<module>services-api</module>
<module>services-impl</module>
<module>webtest</module>

</modules>

<profiles>
<profile>
<id>postgis</id>
<modules>
<module>persistence-pg-test</module>
</modules>
</profile>
</profiles>

</project>
5 changes: 2 additions & 3 deletions src/services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@

<hibernate-version>3.6.9.Final</hibernate-version>
<hibernate-generic-dao-version>1.1.0</hibernate-generic-dao-version>
<hibernate-spatial-version>1.1.3.1</hibernate-spatial-version>
<hibernate-spatial-h2-version>1.1.3.1</hibernate-spatial-h2-version>
<postgresql.jdbc.version>42.1.1</postgresql.jdbc.version>
<hibernate-spatial-version>1.1.3.2</hibernate-spatial-version>
<postgresql.jdbc.version>42.2.18</postgresql.jdbc.version>
<postgis.jdbc.version>1.3.3</postgis.jdbc.version>

<commons-logging-version>1.1.2</commons-logging-version>
Expand Down

0 comments on commit c7d90fa

Please sign in to comment.