Revision 28678 branches/v2_0_0_prep/libraries/libFMap_daldb/src-test/org/gvsig/fmap/dal/store/postgresql/TestReadAndWriteGeom.java
TestReadAndWriteGeom.java | ||
---|---|---|
49 | 49 |
import org.gvsig.fmap.geom.operation.towkt.ToWKT; |
50 | 50 |
import org.gvsig.fmap.geom.primitive.impl.Point2D; |
51 | 51 |
import org.gvsig.tools.ToolsLibrary; |
52 |
import org.postgis.PGgeometry; |
|
53 | 52 |
|
54 | 53 |
public class TestReadAndWriteGeom extends TestCase { |
55 | 54 |
private static final int FEATURES_TO_INSERT = 12000; |
... | ... | |
272 | 271 |
} |
273 | 272 |
} |
274 | 273 |
|
275 |
public void testReadPostgis() throws Exception { |
|
276 |
Statement st = null; |
|
277 |
ResultSet rs = null; |
|
278 |
long count = 0; |
|
279 |
Geometry geom; |
|
280 |
PGgeometry pgGeom; |
|
281 |
PostGIS2Geometry converter = new PostGIS2Geometry(); |
|
282 |
try { |
|
283 |
st = conn.createStatement(); |
|
284 |
rs = st.executeQuery(getSQLForRead("the_geom")); |
|
285 |
while (rs.next()) { |
|
286 |
count++; |
|
287 |
pgGeom = (PGgeometry) rs.getObject(1); |
|
288 |
if (pgGeom != null) { |
|
289 |
geom = converter.getGeometry(pgGeom); |
|
290 |
assertNotNull(geom); |
|
291 |
} |
|
292 |
} |
|
274 |
// public void testReadPostgis() throws Exception { |
|
275 |
// Statement st = null; |
|
276 |
// ResultSet rs = null; |
|
277 |
// long count = 0; |
|
278 |
// Geometry geom; |
|
279 |
// PGgeometry pgGeom; |
|
280 |
// PostGIS2Geometry converter = new PostGIS2Geometry(); |
|
281 |
// try { |
|
282 |
// st = conn.createStatement(); |
|
283 |
// rs = st.executeQuery(getSQLForRead("the_geom")); |
|
284 |
// while (rs.next()) { |
|
285 |
// count++; |
|
286 |
// pgGeom = (PGgeometry) rs.getObject(1); |
|
287 |
// if (pgGeom != null) { |
|
288 |
// geom = converter.getGeometry(pgGeom); |
|
289 |
// assertNotNull(geom); |
|
290 |
// } |
|
291 |
// } |
|
292 |
// |
|
293 |
// |
|
294 |
// System.out |
|
295 |
// .println("TestReadAndWriteGeom.testReadPostgis() Count = " |
|
296 |
// + count); |
|
297 |
// |
|
298 |
// |
|
299 |
// } finally { |
|
300 |
// if (st != null) { |
|
301 |
// try { |
|
302 |
// st.close(); |
|
303 |
// } catch (SQLException e) { |
|
304 |
// e.printStackTrace(); |
|
305 |
// } |
|
306 |
// } |
|
307 |
// if (rs != null) { |
|
308 |
// try { |
|
309 |
// rs.close(); |
|
310 |
// } catch (SQLException e) { |
|
311 |
// e.printStackTrace(); |
|
312 |
// } |
|
313 |
// } |
|
314 |
// } |
|
315 |
// } |
|
293 | 316 |
|
294 | 317 |
|
295 |
System.out |
|
296 |
.println("TestReadAndWriteGeom.testReadPostgis() Count = " |
|
297 |
+ count); |
|
298 |
|
|
299 |
|
|
300 |
} finally { |
|
301 |
if (st != null) { |
|
302 |
try { |
|
303 |
st.close(); |
|
304 |
} catch (SQLException e) { |
|
305 |
e.printStackTrace(); |
|
306 |
} |
|
307 |
} |
|
308 |
if (rs != null) { |
|
309 |
try { |
|
310 |
rs.close(); |
|
311 |
} catch (SQLException e) { |
|
312 |
e.printStackTrace(); |
|
313 |
} |
|
314 |
} |
|
315 |
} |
|
316 |
} |
|
317 |
|
|
318 |
|
|
319 | 318 |
protected void tearDown() throws Exception { |
320 | 319 |
super.tearDown(); |
321 | 320 |
conn.close(); |
Also available in: Unified diff