use of org.datanucleus.samples.jgeometry.SampleGeometry3D in project tests by datanucleus.
the class JGeometry3dMMappingTest method testPointMMapping.
public void testPointMMapping() throws SQLException {
if (!runTestsForDatastore()) {
return;
}
// point with measure in third dimension
int gtype = 3301;
int srid = 4326;
int[] elemInfo = { 1, 1, 1 };
double[] ordinates = { 10.0, 10.0, 100.0 };
JGeometry point = new JGeometry(gtype, srid, elemInfo, ordinates);
SampleGeometry3D samplePoint;
SampleGeometry3D samplePoint_read;
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
Object id = null;
try {
tx.begin();
samplePoint = new SampleGeometry3D(1101, "Point with measure", point);
pm.makePersistent(samplePoint);
id = JDOHelper.getObjectId(samplePoint);
samplePoint = (SampleGeometry3D) pm.detachCopy(samplePoint);
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
pm.close();
}
pm = pmf.getPersistenceManager();
tx = pm.currentTransaction();
try {
tx.begin();
samplePoint_read = (SampleGeometry3D) pm.getObjectById(id, true);
assertEquals(samplePoint, samplePoint_read);
tx.commit();
} finally {
if (tx.isActive()) {
tx.rollback();
}
pm.close();
}
}
Aggregations