org.h2.test.db
Class TestSpatial

java.lang.Object
  extended by org.h2.test.TestBase
      extended by org.h2.test.db.TestSpatial

public class TestSpatial
extends TestBase

Spatial datatype and index tests.


Nested Class Summary
static class TestSpatial.TableEnvelope
          An aggregate function that calculates the envelope.
 
Field Summary
 
Fields inherited from class org.h2.test.TestBase
BASE_TEST_DIR, config, start, TEMP_DIR, uniqueId
 
Constructor Summary
TestSpatial()
           
 
Method Summary
static com.vividsolutions.jts.geom.Geometry geomFromText(java.lang.String text, int srid)
          Convert the text to a geometry object.
static java.lang.String getObjectString(java.lang.Object object)
          Get the toString value of the object.
static java.sql.ResultSet getRandomGeometryTable(long seed, long rowCount, double minX, double maxX, double minY, double maxY, double maxLength)
          Generate a result set with random geometry data.
static void main(java.lang.String... a)
          Run just this test.
static java.sql.ResultSet pointTable(double x, double y)
          This method is called via reflection from the database.
 void test()
          This method will be called by the test framework.
 
Methods inherited from class org.h2.test.TestBase
assertContains, assertEqualDatabases, assertEqualReaders, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualStreams, assertFalse, assertFalse, assertKnownException, assertKnownException, assertNull, assertResult, assertResultRowCount, assertResultSetMeta, assertResultSetOrdered, assertSingleValue, assertSmaller, assertStartsWith, assertThrows, assertThrows, assertThrows, assertThrows, assertTrue, assertTrue, crash, createCaller, createClassProxy, createFailingStream, deleteDb, deleteDb, eatMemory, fail, fail, freeMemory, getBaseDir, getClassPath, getConnection, getConnection, getFilePassword, getMemoryUsed, getMemoryUsedBytes, getPassword, getPassword, getSize, getTestDir, getURL, getUser, init, init, logError, println, printTime, printTimeMemory, readString, runTest, startServerIfRequired, testCase, throwException, trace, trace, traceMemory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestSpatial

public TestSpatial()
Method Detail

main

public static void main(java.lang.String... a)
                 throws java.lang.Exception
Run just this test.

Parameters:
a - ignored
Throws:
java.lang.Exception

test

public void test()
          throws java.sql.SQLException
Description copied from class: TestBase
This method will be called by the test framework.

Specified by:
test in class TestBase
Throws:
java.sql.SQLException

getRandomGeometryTable

public static java.sql.ResultSet getRandomGeometryTable(long seed,
                                                        long rowCount,
                                                        double minX,
                                                        double maxX,
                                                        double minY,
                                                        double maxY,
                                                        double maxLength)
Generate a result set with random geometry data. Used as an ALIAS function.

Parameters:
seed - the random seed
rowCount - the number of rows
minX - the smallest x
maxX - the largest x
minY - the smallest y
maxY - the largest y
maxLength - the maximum length
Returns:
a result set

geomFromText

public static com.vividsolutions.jts.geom.Geometry geomFromText(java.lang.String text,
                                                                int srid)
                                                         throws java.sql.SQLException
Convert the text to a geometry object.

Parameters:
text - the geometry as a Well Known Text
srid - the projection id
Returns:
Geometry object
Throws:
java.sql.SQLException

getObjectString

public static java.lang.String getObjectString(java.lang.Object object)
Get the toString value of the object.

Parameters:
object - the object
Returns:
the string representation

pointTable

public static java.sql.ResultSet pointTable(double x,
                                            double y)
This method is called via reflection from the database.

Parameters:
x - the x position of the point
y - the y position of the point
Returns:
a result set with this point