use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class SpatialJPQLTestSuite method testSDOWithinDistanceRectangleUsingMaxResolution.
public void testSDOWithinDistanceRectangleUsingMaxResolution() throws Exception {
String sql = "select ID, JGEOMETRY from JPA_JGEOMETRY where mdsys.sdo_within_distance(" + "jgeometry, mdsys.sdo_geometry(3,null,null, mdsys.sdo_elem_info_array(1,3,3), " + "mdsys.sdo_ordinate_array(1,1, 20, 20)), " + "'DISTANCE=10 MAX_RESOLUTION=5') = 'TRUE' ORDER BY ID";
SQLReader reader = new SQLReader(getServerSession(STRUCT_CONVERTER_PU), sql);
JGeometry rectangle = JGeometry.createLinearPolygon(new double[] { 1, 1, 1, 20, 10, 20, 20, 1, 1, 1 }, 2, 0);
EntityManager em = createEntityManager(STRUCT_CONVERTER_PU);
Query query = em.createQuery("SELECT ss FROM SimpleSpatial ss WHERE FUNC('mdsys.sdo_WITHIN_DISTANCE', ss.JGeometry, :otherGeometry, :params) = 'TRUE' ORDER BY ss.id ASC");
query.setParameter("otherGeometry", rectangle);
query.setParameter("params", "DISTANCE=10 MAX_RESOLUTION=5");
List<Spatial> results = query.getResultList();
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class SpatialJPQLTestSuite method testSDOFilterRectangle.
/**
* SDO_Filter using a dynamic rectangular window with lower left
* and upper right coordinates of {(1,1), (20,20)}
*/
public void testSDOFilterRectangle() throws Exception {
String sql = "select ID, JGEOMETRY from JPA_JGEOMETRY where mdsys.sdo_filter(" + "jgeometry, mdsys.sdo_geometry(3,null,null, " + "mdsys.sdo_elem_info_array(1,3,3), " + "mdsys.sdo_ordinate_array(1,1, 20, 20)), " + "'QUERYTYPE=WINDOW') = 'TRUE' ORDER BY ID";
SQLReader reader = new SQLReader(getServerSession(STRUCT_CONVERTER_PU), sql);
JGeometry rectangle = JGeometry.createLinearPolygon(new double[] { 1, 1, 1, 20, 10, 20, 20, 1, 1, 1 }, 2, 0);
EntityManager em = createEntityManager(STRUCT_CONVERTER_PU);
Query query = em.createQuery("SELECT ss FROM SimpleSpatial ss WHERE FUNC('mdsys.sdo_FILTER', ss.JGeometry, :otherGeometry, :params) = 'TRUE' ORDER BY ss.id ASC");
query.setParameter("otherGeometry", rectangle);
query.setParameter("params", "QUERYTYPE=WINDOW");
List<Spatial> results = query.getResultList();
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class SpatialJPQLTestSuite method testSDOWithinDistanceNullParamsNotMatching.
/**
* SDO_WITHIN_DISTANCE with NULL params not matching existing
*/
public void testSDOWithinDistanceNullParamsNotMatching() throws Exception {
String sql = "select ID, JGEOMETRY from JPA_JGEOMETRY where " + "mdsys.sdo_within_distance(jgeometry, mdsys.sdo_geometry(3, " + "NULL, null, mdsys.sdo_elem_info_array(1,3,4), " + "mdsys.sdo_ordinate_array(10, 0, 0, 10, 0, -10)), " + "NULL) = 'TRUE' ORDER BY ID";
SQLReader reader = new SQLReader(getServerSession(STRUCT_CONVERTER_PU), sql);
JGeometry circle = JGeometry.createCircle(10, 0, 0, 10, 0, -10, 0);
EntityManager em = createEntityManager(STRUCT_CONVERTER_PU);
Query query = em.createQuery("SELECT ss FROM SimpleSpatial ss WHERE FUNC('mdsys.sdo_WITHIN_DISTANCE', ss.JGeometry, :otherGeometry, :params) = 'TRUE' ORDER BY ss.id ASC");
query.setParameter("otherGeometry", circle);
query.setParameter("params", null);
List<Spatial> results = query.getResultList();
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class SpatialJPQLTestSuite method testSDOWithinDistanceRectangle.
/**
* SDO_WITHIN_DISTANCE using a dynamic rectangular window with lower left
* and upper right coordinates of {(1,1), (20,20)}
*/
public void testSDOWithinDistanceRectangle() throws Exception {
String sql = "select ID, JGEOMETRY from JPA_JGEOMETRY where mdsys.sdo_within_distance(" + "jgeometry, mdsys.sdo_geometry(3,null,null, mdsys.sdo_elem_info_array(1,3,3), " + "mdsys.sdo_ordinate_array(1,1, 20, 20)), " + "'DISTANCE=10') = 'TRUE' ORDER BY ID";
SQLReader reader = new SQLReader(getServerSession(STRUCT_CONVERTER_PU), sql);
JGeometry rectangle = JGeometry.createLinearPolygon(new double[] { 1, 1, 1, 20, 10, 20, 20, 1, 1, 1 }, 2, 0);
EntityManager em = createEntityManager(STRUCT_CONVERTER_PU);
Query query = em.createQuery("SELECT ss FROM SimpleSpatial ss WHERE FUNC('mdsys.sdo_WITHIN_DISTANCE', ss.JGeometry, :otherGeometry, :params) = 'TRUE' ORDER BY ss.id ASC");
query.setParameter("otherGeometry", rectangle);
query.setParameter("params", "DISTANCE=10");
List<Spatial> results = query.getResultList();
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class SpatialJPQLTestSuite method testSDOFilterCircle.
/**
* SDO_FILTER using a with a circle of radius 10 around (0,0)
*/
public void testSDOFilterCircle() throws Exception {
String sql = "select ID, JGEOMETRY from JPA_JGEOMETRY where mdsys.sdo_filter(" + "jgeometry, mdsys.sdo_geometry(3,null,null, " + "mdsys.sdo_elem_info_array(1,3,4), " + "mdsys.sdo_ordinate_array(-10,0, 0, 10, 10, 0)), " + "'QUERYTYPE=WINDOW') = 'TRUE' ORDER BY ID";
SQLReader reader = new SQLReader(getServerSession(STRUCT_CONVERTER_PU), sql);
JGeometry circle = JGeometry.createCircle(-10, 0, 0, 10, 10, 0, 0);
EntityManager em = createEntityManager(STRUCT_CONVERTER_PU);
Query query = em.createQuery("SELECT ss FROM SimpleSpatial ss WHERE FUNC('mdsys.sdo_FILTER', ss.JGeometry, :otherGeometry, :params) = 'TRUE' ORDER BY ss.id ASC");
query.setParameter("otherGeometry", circle);
query.setParameter("params", "QUERYTYPE=WINDOW");
List<Spatial> results = query.getResultList();
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
Aggregations