Author: aaime Date: 2012-05-12 09:50:22 -0700 (Sat, 12 May 2012) New Revision: 38719 Added: branches/2.7.x/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCEmptyGeometryTest.java branches/2.7.x/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCEmptyGeometryTestSetup.java branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/test/java/org/geotools/data/h2/H2EmptyGeometryTest.java branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/test/java/org/geotools/data/h2/H2EmptyGeometryTestSetup.java branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTest.java branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTestSetup.java branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/ps/PostGISEmptyGeometryTest.java Modified: branches/2.7.x/modules/library/jdbc/src/main/java/org/geotools/jdbc/BasicSQLDialect.java branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2Dialect.java branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2DialectBasic.java branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2DialectPrepared.java branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostGISDialect.java branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostGISPSDialect.java branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISTestSetup.java Log: [GEOT-4113] Shp publish into postgis datastore with MULTIPOLYGON EMPTY value violates check constraint. Modified: branches/2.7.x/modules/library/jdbc/src/main/java/org/geotools/jdbc/BasicSQLDialect.java =================================================================== --- branches/2.7.x/modules/library/jdbc/src/main/java/org/geotools/jdbc/BasicSQLDialect.java 2012-05-12 16:37:03 UTC (rev 38718) +++ branches/2.7.x/modules/library/jdbc/src/main/java/org/geotools/jdbc/BasicSQLDialect.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -85,6 +85,10 @@ * The <tt>srid</tt> parameter is the spatial reference system identifier * of the geometry, or 0 if not known. * </p> + * <p> + * Attention should be paid to emtpy geometries (<code>g.isEmtpy() == true</code>) as + * they cannot be encoded in WKB and several databases fail to handle them property. + * Common treatment is to equate them to NULL</p> */ public abstract void encodeGeometryValue(Geometry value, int srid, StringBuffer sql) throws IOException; Added: branches/2.7.x/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCEmptyGeometryTest.java =================================================================== --- branches/2.7.x/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCEmptyGeometryTest.java (rev 0) +++ branches/2.7.x/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCEmptyGeometryTest.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -0,0 +1,97 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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. + */ +package org.geotools.jdbc; + +import org.geotools.data.DefaultTransaction; +import org.geotools.data.FeatureWriter; +import org.geotools.data.Transaction; +import org.geotools.data.simple.SimpleFeatureCollection; +import org.geotools.data.simple.SimpleFeatureIterator; +import org.geotools.geometry.jts.JTSFactoryFinder; +import org.geotools.referencing.CRS; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.referencing.crs.CoordinateReferenceSystem; + +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jts.io.ParseException; +import com.vividsolutions.jts.io.WKTReader; + +/** + * + * + * @source $URL: + * http://svn.osgeo.org/geotools/trunk/modules/library/jdbc/src/test/java/org/geotools/ + * jdbc/JDBCEmptyGeometryTest.java $ + */ +public abstract class JDBCEmptyGeometryTest extends JDBCTestSupport { + + @Override + protected abstract JDBCEmptyGeometryTestSetup createTestSetup(); + + public void testEmptyPoint() throws Exception { + testInsertEmptyGeometry("POINT"); + } + + public void testEmptyLine() throws Exception { + testInsertEmptyGeometry("LINESTRING"); + } + + public void testEmptyPolygon() throws Exception { + testInsertEmptyGeometry("POLYGON"); + } + + public void testEmptyMultiPoint() throws Exception { + testInsertEmptyGeometry("MULTIPOINT"); + } + + public void testEmptyMultiLine() throws Exception { + testInsertEmptyGeometry("MULTILINESTRING"); + } + + public void testEmptyMultiPolygon() throws Exception { + testInsertEmptyGeometry("MULTIPOLYGON"); + } + + private void testInsertEmptyGeometry(String type) throws Exception { + WKTReader reader = new WKTReader(); + Geometry emptyGeometry = reader.read(type.toUpperCase() + " EMPTY"); + + Transaction tx = new DefaultTransaction(); + FeatureWriter<SimpleFeatureType, SimpleFeature> writer = dataStore.getFeatureWriterAppend( + tname("empty"), tx); + SimpleFeature feature = writer.next(); + feature.setAttribute(aname("id"), new Integer(100)); + feature.setAttribute(aname("geom_" + type.toLowerCase()), emptyGeometry); + feature.setAttribute(aname("name"), new String("empty " + type)); + writer.write(); + writer.close(); + tx.commit(); + tx.close(); + + SimpleFeatureCollection fc = dataStore.getFeatureSource(tname("empty")).getFeatures(); + assertEquals(1, fc.size()); + SimpleFeatureIterator fi = fc.features(); + SimpleFeature nf = fi.next(); + fi.close(); + Geometry geometry = (Geometry) nf.getDefaultGeometry(); + // either null or empty, we don't really care + assertTrue(geometry == null || geometry.isEmpty()); + } +} Added: branches/2.7.x/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCEmptyGeometryTestSetup.java =================================================================== --- branches/2.7.x/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCEmptyGeometryTestSetup.java (rev 0) +++ branches/2.7.x/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCEmptyGeometryTestSetup.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -0,0 +1,50 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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. + */ +package org.geotools.jdbc; + +import java.sql.SQLException; + +/** + * + * + * @source $URL: http://svn.osgeo.org/geotools/trunk/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCEmptyGeometryTestSetup.java $ + */ +public abstract class JDBCEmptyGeometryTestSetup extends JDBCDelegatingTestSetup { + + protected JDBCEmptyGeometryTestSetup(JDBCTestSetup delegate) { + super(delegate); + } + + protected final void setUpData() throws Exception { + //kill all the data + try { + dropEmptyGeometryTable(); + } catch (SQLException e) { + } + + //create all the data + createEmptyGeometryTable(); + } + + protected abstract void createEmptyGeometryTable() throws Exception; + + /** + * Drops the "empty" table previously created + */ + protected abstract void dropEmptyGeometryTable() throws Exception; + +} Modified: branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2Dialect.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2Dialect.java 2012-05-12 16:37:03 UTC (rev 38718) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2Dialect.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -340,11 +340,15 @@ public void encodeGeometryValue(Geometry value, int srid, StringBuffer sql) throws IOException { - sql.append("ST_GeomFromText ('"); - sql.append(new WKTWriter().write(value)); - sql.append("',"); - sql.append(srid); - sql.append(")"); + if(value == null || value.isEmpty()) { + sql.append("ST_GeomFromText ('"); + sql.append(new WKTWriter().write(value)); + sql.append("',"); + sql.append(srid); + sql.append(")"); + } else { + sql.append("NULL"); + } } Modified: branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2DialectBasic.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2DialectBasic.java 2012-05-12 16:37:03 UTC (rev 38718) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2DialectBasic.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -189,7 +189,7 @@ @Override public void encodeGeometryValue(Geometry value, int srid, StringBuffer sql) throws IOException { - if (value != null) { + if (value != null && !value.isEmpty()) { sql.append("ST_GeomFromText ('"); sql.append(new WKTWriter().write(value)); sql.append("',"); Modified: branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2DialectPrepared.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2DialectPrepared.java 2012-05-12 16:37:03 UTC (rev 38718) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/main/java/org/geotools/data/h2/H2DialectPrepared.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -174,7 +174,7 @@ public void setGeometryValue(Geometry g, int srid, Class binding, PreparedStatement ps, int column) throws SQLException { - if ( g == null ) { + if ( g == null || g.isEmpty() ) { ps.setNull( column, Types.BLOB ); return; } Added: branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/test/java/org/geotools/data/h2/H2EmptyGeometryTest.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/test/java/org/geotools/data/h2/H2EmptyGeometryTest.java (rev 0) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/test/java/org/geotools/data/h2/H2EmptyGeometryTest.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -0,0 +1,34 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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. + */ +package org.geotools.data.h2; + +import org.geotools.jdbc.JDBCEmptyGeometryTest; +import org.geotools.jdbc.JDBCEmptyGeometryTestSetup; + +/** + * + * + * @source $URL: http://svn.osgeo.org/geotools/trunk/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTest.java $ + */ +public class H2EmptyGeometryTest extends JDBCEmptyGeometryTest { + + @Override + protected JDBCEmptyGeometryTestSetup createTestSetup() { + return new H2EmptyGeometryTestSetup(new H2TestSetup()); + } + +} \ No newline at end of file Added: branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/test/java/org/geotools/data/h2/H2EmptyGeometryTestSetup.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/test/java/org/geotools/data/h2/H2EmptyGeometryTestSetup.java (rev 0) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-h2/src/test/java/org/geotools/data/h2/H2EmptyGeometryTestSetup.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -0,0 +1,63 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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. + */ +package org.geotools.data.h2; + +import org.geotools.jdbc.JDBCEmptyGeometryTestSetup; +import org.geotools.jdbc.JDBCTestSetup; + +/** + * + * + * @source $URL: http://svn.osgeo.org/geotools/trunk/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISBooleanTestSetup.java $ + */ +public class H2EmptyGeometryTestSetup extends JDBCEmptyGeometryTestSetup { + + public H2EmptyGeometryTestSetup(JDBCTestSetup delegate) { + super(delegate); + } + + @Override + protected void createEmptyGeometryTable() throws Exception { + //create table schema + run("CREATE TABLE \"geotools\".\"empty\"(" // + + "\"fid\" serial primary key, " // + + "\"id\" integer, " // + + "\"geom_point\" POINT, " // + + "\"geom_linestring\" LINESTRING, " // + + "\"geom_polygon\" POLYGON, " // + + "\"geom_multipoint\" MULTIPOINT, " // + + "\"geom_multilinestring\" MULTILINESTRING, " // + + "\"geom_multipolygon\" MULTIPOLYGON, " // + + "\"name\" varchar" // + + ")"); + + run("CALL AddGeometryColumn('geotools', 'empty', 'geom_point', 4326, 'POINT', 2)"); + run("CALL AddGeometryColumn('geotools', 'empty', 'geom_linestring', 4326, 'LINESTRING', 2)"); + run("CALL AddGeometryColumn('geotools', 'empty', 'geom_polygon', 4326, 'POLYGON', 2)"); + run("CALL AddGeometryColumn('geotools', 'empty', 'geom_multipoint', 4326, 'MULTIPOINT', 2)"); + run("CALL AddGeometryColumn('geotools', 'empty', 'geom_multilinestring', 4326, 'MULTILINESTRING', 2)"); + run("CALL AddGeometryColumn('geotools', 'empty', 'geom_multipolygon', 4326, 'MULTIPOLYGON', 2)"); + } + + @Override + protected void dropEmptyGeometryTable() throws Exception { + run( "DROP TABLE \"geotools\".\"empty\""); + + } + + +} Modified: branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostGISDialect.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostGISDialect.java 2012-05-12 16:37:03 UTC (rev 38718) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostGISDialect.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -718,7 +718,7 @@ @Override public void encodeGeometryValue(Geometry value, int srid, StringBuffer sql) throws IOException { - if(value == null) { + if (value == null || value.isEmpty()) { sql.append("NULL"); } else { if (value instanceof LinearRing) { Modified: branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostGISPSDialect.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostGISPSDialect.java 2012-05-12 16:37:03 UTC (rev 38718) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostGISPSDialect.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -189,7 +189,7 @@ @Override public void setGeometryValue(Geometry g, int srid, Class binding, PreparedStatement ps, int column) throws SQLException { - if (g != null) { + if (g != null && !g.isEmpty()) { if (g instanceof LinearRing ) { //postgis does not handle linear rings, convert to just a line string g = g.getFactory().createLineString(((LinearRing) g).getCoordinateSequence()); Added: branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTest.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTest.java (rev 0) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTest.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -0,0 +1,34 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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. + */ +package org.geotools.data.postgis; + +import org.geotools.jdbc.JDBCEmptyGeometryTest; +import org.geotools.jdbc.JDBCEmptyGeometryTestSetup; + +/** + * + * + * @source $URL: http://svn.osgeo.org/geotools/trunk/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTest.java $ + */ +public class PostGISEmptyGeometryTest extends JDBCEmptyGeometryTest { + + @Override + protected JDBCEmptyGeometryTestSetup createTestSetup() { + return new PostGISEmptyGeometryTestSetup(new PostGISTestSetup()); + } + +} \ No newline at end of file Added: branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTestSetup.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTestSetup.java (rev 0) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTestSetup.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -0,0 +1,63 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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. + */ +package org.geotools.data.postgis; + +import org.geotools.jdbc.JDBCEmptyGeometryTestSetup; +import org.geotools.jdbc.JDBCTestSetup; + +/** + * + * + * @source $URL: http://svn.osgeo.org/geotools/trunk/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISBooleanTestSetup.java $ + */ +public class PostGISEmptyGeometryTestSetup extends JDBCEmptyGeometryTestSetup { + + public PostGISEmptyGeometryTestSetup(JDBCTestSetup delegate) { + super(delegate); + } + + @Override + protected void createEmptyGeometryTable() throws Exception { + //create table schema + run("CREATE TABLE \"empty\"(" // + + "\"fid\" serial primary key, " // + + "\"id\" integer, " // + + "\"geom_point\" geometry, " // + + "\"geom_linestring\" geometry, " // + + "\"geom_polygon\" geometry, " // + + "\"geom_multipoint\" geometry, " // + + "\"geom_multilinestring\" geometry, " // + + "\"geom_multipolygon\" geometry, " // + + "\"name\" varchar," // + + "CONSTRAINT enforce_geotype_geom_1 CHECK (geometrytype(geom_point) = 'POINT'::text OR geom_point IS NULL)," // + + "CONSTRAINT enforce_geotype_geom_2 CHECK (geometrytype(geom_linestring) = 'LINESTRING'::text OR geom_linestring IS NULL)," // + + "CONSTRAINT enforce_geotype_geom_3 CHECK (geometrytype(geom_polygon) = 'POLYGON'::text OR geom_polygon IS NULL)," // + + "CONSTRAINT enforce_geotype_geom_4 CHECK (geometrytype(geom_multipoint) = 'MULTIPOINT'::text OR geom_multipoint IS NULL)," // + + "CONSTRAINT enforce_geotype_geom_5 CHECK (geometrytype(geom_multilinestring) = 'MULTILINESTRING'::text OR geom_multilinestring IS NULL)," // + + "CONSTRAINT enforce_geotype_geom_6 CHECK (geometrytype(geom_multipolygon) = 'MULTIPOLYGON'::text OR geom_multipolygon IS NULL)" // + + ")"); + + } + + @Override + protected void dropEmptyGeometryTable() throws Exception { + run( "DROP TABLE \"empty\""); + + } + + +} Modified: branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISTestSetup.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISTestSetup.java 2012-05-12 16:37:03 UTC (rev 38718) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISTestSetup.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -69,11 +69,12 @@ run("INSERT INTO \"ft1\" VALUES(0, GeometryFromText('POINT(0 0)', 4326), 0, 0.0, 'zero')"); run("INSERT INTO \"ft1\" VALUES(1, GeometryFromText('POINT(1 1)', 4326), 1, 1.1, 'one')"); run("INSERT INTO \"ft1\" VALUES(2, GeometryFromText('POINT(2 2)', 4326), 2, 2.2, 'two')"); - // advance the sequence to 2 + // advance the sequence to 2 run("SELECT nextval(pg_get_serial_sequence('ft1','id'))"); run("SELECT nextval(pg_get_serial_sequence('ft1','id'))"); // analyze so that the stats will be up to date run("ANALYZE \"ft1\""); + } Added: branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/ps/PostGISEmptyGeometryTest.java =================================================================== --- branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/ps/PostGISEmptyGeometryTest.java (rev 0) +++ branches/2.7.x/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/ps/PostGISEmptyGeometryTest.java 2012-05-12 16:50:22 UTC (rev 38719) @@ -0,0 +1,35 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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. + */ +package org.geotools.data.postgis.ps; + +import org.geotools.data.postgis.PostGISEmptyGeometryTestSetup; +import org.geotools.jdbc.JDBCEmptyGeometryTest; +import org.geotools.jdbc.JDBCEmptyGeometryTestSetup; + +/** + * + * + * @source $URL: http://svn.osgeo.org/geotools/trunk/modules/plugin/jdbc/jdbc-postgis/src/test/java/org/geotools/data/postgis/PostGISEmptyGeometryTest.java $ + */ +public class PostGISEmptyGeometryTest extends JDBCEmptyGeometryTest { + + @Override + protected JDBCEmptyGeometryTestSetup createTestSetup() { + return new PostGISEmptyGeometryTestSetup(new PostGISPSTestSetup()); + } + +} \ No newline at end of file |