Search in sources :

Example 6 with WrappedSpatial

use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial in project eclipselink by eclipse-ee4j.

the class Query_Basic_Tests method testReadNotNullGeometry.

/**
 * Comparisons to geometry != NULL always fail.
 */
public void testReadNotNullGeometry() throws Exception {
    ReadAllQuery roq = new ReadAllQuery(WrappedSpatial.class);
    ExpressionBuilder eb = roq.getExpressionBuilder();
    Expression selectionCriteria = eb.get("geometry").getField("geom").notNull();
    roq.setSelectionCriteria(selectionCriteria);
    List<WrappedSpatial> results = (List<WrappedSpatial>) session.executeQuery(roq);
    assertNotNull(results);
    int countAll = DeleteTests.countWrappedSpatial(session);
    assertEquals("More then one found", countAll - 1, results.size());
}
Also used : WrappedSpatial(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial) Expression(org.eclipse.persistence.expressions.Expression) ReadAllQuery(org.eclipse.persistence.queries.ReadAllQuery) List(java.util.List) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder)

Example 7 with WrappedSpatial

use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial in project eclipselink by eclipse-ee4j.

the class Query_Basic_Tests method testMyGeometryGeomIsNull.

public void testMyGeometryGeomIsNull() throws Exception {
    ReadAllQuery roq = new ReadAllQuery(WrappedSpatial.class);
    ExpressionBuilder eb = new ExpressionBuilder(WrappedSpatial.class);
    Expression geomExp = eb.get("geometry").getField("geom");
    roq.setSelectionCriteria(geomExp.isNull());
    List<WrappedSpatial> results = (List<WrappedSpatial>) session.executeQuery(roq);
    assertNotNull(results);
    assertEquals(1, results.size());
}
Also used : WrappedSpatial(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial) Expression(org.eclipse.persistence.expressions.Expression) ReadAllQuery(org.eclipse.persistence.queries.ReadAllQuery) List(java.util.List) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder)

Example 8 with WrappedSpatial

use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial in project eclipselink by eclipse-ee4j.

the class CreateTests method testInsertNullWithBinding.

public void testInsertNullWithBinding() throws Exception {
    getSession().getLogin().setShouldBindAllParameters(true);
    UnitOfWork uow = getSession().acquireUnitOfWork();
    WrappedSpatial ss = (WrappedSpatial) uow.newInstance(WrappedSpatial.class);
    ss.setId(123456789);
    uow.writeChanges();
    uow.release();
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) WrappedSpatial(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial)

Example 9 with WrappedSpatial

use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial in project eclipselink by eclipse-ee4j.

the class DeleteTests method testAnySingleDelete.

public void testAnySingleDelete() throws Exception {
    int initialQuantity = countWrappedSpatial(session);
    UnitOfWork uow = session.acquireUnitOfWork();
    WrappedSpatial ss = (WrappedSpatial) uow.readObject(WrappedSpatial.class);
    assertNotNull("No SimpleSpatial found", ss);
    uow.deleteObject(ss);
    uow.writeChanges();
    int afterCount = countWrappedSpatial(uow);
    assertEquals("Number of rows does not match", initialQuantity - 1, afterCount);
    uow.release();
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) WrappedSpatial(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial)

Example 10 with WrappedSpatial

use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial in project eclipselink by eclipse-ee4j.

the class Query_SpatialOp_ExpReport_Tests method populateTestGeometry.

private void populateTestGeometry(JGeometry g) {
    UnitOfWork uow = session.acquireUnitOfWork();
    uow.registerNewObject(new WrappedSpatial(6666, 0, g));
    uow.commit();
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) WrappedSpatial(org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial)

Aggregations

WrappedSpatial (org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.WrappedSpatial)10 UnitOfWork (org.eclipse.persistence.sessions.UnitOfWork)7 ExpressionBuilder (org.eclipse.persistence.expressions.ExpressionBuilder)4 List (java.util.List)2 Expression (org.eclipse.persistence.expressions.Expression)2 ReadAllQuery (org.eclipse.persistence.queries.ReadAllQuery)2 ArrayList (java.util.ArrayList)1 MyGeometry (org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.MyGeometry)1 SampleGeometries (org.eclipse.persistence.testing.tests.spatial.jgeometry.SampleGeometries)1