use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class Query_SpatialOp_ExpReport_Tests method testSDOWithinDistanceNullParamsNotMatching.
/**
* SDO_WITHIN_DISTANCE with NULL params not matching existing
*/
public void testSDOWithinDistanceNullParamsNotMatching() throws Exception {
String sql = "select GID, GEOMETRY from SIMPLE_SPATIAL where " + "mdsys.sdo_within_distance(geometry, 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 GID";
SQLReader reader = new SQLReader(session, sql);
populateTestGeometry(JGeometry.createCircle(10, 0, 0, 10, 0, -10, 0));
ReadAllQuery raq = new ReadAllQuery(SimpleSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
Expression geom1 = eb.get("geometry");
ExpressionBuilder eb2 = new ExpressionBuilder();
ReportQuery rq = new ReportQuery(SimpleSpatial.class, eb2);
rq.addAttribute("geometry");
rq.setSelectionCriteria(eb2.get("id").equal(6666));
Expression selectionCriteria = SpatialExpressionFactory.withinDistance(geom1, rq, new SpatialParameters(""));
selectionCriteria = selectionCriteria.and(eb.get("id").notEqual(6666));
raq.setSelectionCriteria(selectionCriteria);
raq.addAscendingOrdering("id");
List<Spatial> results = (List) session.executeQuery(raq);
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 NamedQueryTests method executeNamedSessionQuery.
public void executeNamedSessionQuery() throws Exception {
String sql = "select GID, GEOMETRY from SIMPLE_SPATIAL where mdsys.sdo_relate(geometry, " + "mdsys.sdo_geometry(3,null,null, mdsys.sdo_elem_info_array(1,3,3), " + "mdsys.sdo_ordinate_array(1,1, 20, 20)), " + "'MASK=ANYINTERACT QUERYTYPE=WINDOW') = 'TRUE' ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
double[] points = new double[] { 1, 1, 1, 20, 10, 20, 20, 1, 1, 1 };
JGeometry rectangle = JGeometry.createLinearPolygon(points, 2, 0);
List<Spatial> results = (List<Spatial>) session.executeQuery(SESSION_QUERY_NAME, rectangle);
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 Query_Basic_Tests method testReadAll.
public void testReadAll() throws Exception {
String sql = "select GID, GEOMETRY from WRAPPED_SPATIAL ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
ReadAllQuery raq = new ReadAllQuery(WrappedSpatial.class);
raq.addAscendingOrdering("id");
List<Spatial> results = (List<Spatial>) session.executeQuery(raq);
assertNotNull(results);
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 Query_OrderedHint method testReadAll.
public void testReadAll() throws Exception {
String sql = "SELECT /*+ ORDERED */ GID, GEOMETRY FROM WRAPPED_SPATIAL WS ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
ReadAllQuery raq = new ReadAllQuery(WrappedSpatial.class);
raq.addAscendingOrdering("id");
raq.setHintString("/*+ ORDERED */ ");
List<Spatial> results = (List<Spatial>) session.executeQuery(raq);
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 Query_SpatialExpOp_ExpGeom_Tests 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 GID, GEOMETRY from WRAPPED_SPATIAL WS where mdsys.sdo_within_distance(" + "WS.geometry.geom, 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 GID";
SQLReader reader = new SQLReader(session, sql);
JGeometry rectangle = JGeometry.createLinearPolygon(new double[] { 1, 1, 1, 20, 10, 20, 20, 1, 1, 1 }, 2, 0);
ReadAllQuery raq = new ReadAllQuery(WrappedSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
String params = "DISTANCE=10";
Expression selectionCriteria = SpatialExpressionFactory.withinDistance(eb.get("geometry").getField("geom"), rectangle, new SpatialParameters(params));
raq.setSelectionCriteria(selectionCriteria);
raq.addAscendingOrdering("id");
List<Spatial> results = (List<Spatial>) session.executeQuery(raq);
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
Aggregations