@@ -0,0 +1,2707 @@
+package org.realityforge.jeo.geolatte.jpa.eclipselink;%0A%0Aimport javax.persistence.EntityManager;%0Aimport org.geolatte.geom.Geometry;%0Aimport org.geolatte.geom.GeometryCollection;%0Aimport org.geolatte.geom.LineString;%0Aimport org.geolatte.geom.MultiLineString;%0Aimport org.geolatte.geom.MultiPoint;%0Aimport org.geolatte.geom.MultiPolygon;%0Aimport org.geolatte.geom.Point;%0Aimport org.geolatte.geom.Polygon;%0Aimport org.testng.annotations.Test;%0Aimport static org.testng.Assert.*;%0A%0Apublic final class GeolatteExtensionTest%0A%7B%0A  @Test%0A  public void basic()%0A    throws Exception%0A  %7B%0A    testType( TestGeometryEntity.class, Geometry.class, %22POINT ( 1 1 )%22 );%0A    testType( TestGeometryCollectionEntity.class, GeometryCollection.class, %22GEOMETRYCOLLECTION ( POINT ( 1 1 ) , POINT ( 1 1 ))%22 );%0A    testType( TestPointEntity.class, Point.class, %22POINT ( 1 1 )%22 );%0A    testType( TestMultiPointEntity.class, MultiPoint.class, %22MULTIPOINT ( (100.0 0.0) , (101.0 1.0) )%22 );%0A    testType( TestLineStringEntity.class, LineString.class, %22LINESTRING ( 1 1, 2 1 )%22 );%0A    testType( TestMultiLineStringEntity.class, MultiLineString.class, %22MULTILINESTRING ( ( 100.0 0.0, 101.0 1.0 ), ( 102.0 2.0, 103.0 3.0 ) )%22 );%0A    testType( TestPolygonEntity.class, Polygon.class, %22POLYGON((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 0.0))%22 );%0A    testType( TestMultiPolygonEntity.class, MultiPolygon.class, %22MULTIPOLYGON(((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 0.0)))%22 );%0A  %7D%0A%0A  public void testType( final Class%3C?%3E entityType, final Class%3C?%3E geomType, final String value )%0A    throws Exception%0A  %7B%0A    final EntityManager em = DatabaseTestUtil.createEntityManager( %22GeolatteEclipselinkTest%22 );%0A%0A    assertEntityClassPresent( em, entityType );%0A%0A    assertNull( em.find( entityType, 22 ) );%0A%0A    em.getTransaction().begin();%0A    final String insertSQL =%0A      %22INSERT INTO %22 + entityType.getSimpleName() + %22(id,geom) VALUES (22,ST_GeometryFromText(?))%22;%0A    em.createNativeQuery( insertSQL ).setParameter( 1, value ).executeUpdate();%0A    em.getTransaction().commit();%0A%0A    final Object entity = em.find( entityType, 22 );%0A    final Object geom = entityType.getMethod( %22getGeom%22 ).invoke( entity );%0A%0A    assertNotNull( entity );%0A    em.remove( entity );%0A    assertNull( em.find( entityType, 22 ) );%0A%0A    final Object e2 = entityType.newInstance();%0A    entityType.getMethod( %22setId%22, Integer.class ).invoke( e2, 23 );%0A    entityType.getMethod( %22setGeom%22, geomType ).invoke( e2, geom );%0A%0A    em.persist( e2 );%0A    assertNotNull( em.find( entityType, 23 ) );%0A    em.remove( e2 );%0A  %7D%0A%0A  private void assertEntityClassPresent( final EntityManager em, final Class%3C?%3E entityClass )%0A  %7B%0A    assertNotNull( em.getMetamodel().managedType( entityClass ) );%0A  %7D%0A%7D%0A

Add basic test for serialize and deserialize