use of org.geotoolkit.version.VersionControl in project geotoolkit by Geomatys.
the class PostgresSimpleTypeTest method reload.
private void reload(boolean simpleType) throws DataStoreException, VersioningException {
if (store != null) {
store.close();
}
// open in complex type to delete all types
params.getOrCreate(PostgresProvider.SIMPLETYPE).setValue(false);
store = (PostgresStore) DataStores.open(params);
while (!store.getNames().isEmpty()) {
// we get the list each type because relations may delete multiple types each time
final GenericName n = store.getNames().iterator().next();
final VersionControl vc = store.getVersioning(n.toString());
vc.dropVersioning();
store.deleteFeatureType(n.toString());
}
assertTrue(store.getNames().isEmpty());
store.close();
// reopen the way it was asked
params.getOrCreate(PostgresProvider.SIMPLETYPE).setValue(simpleType);
store = (PostgresStore) DataStores.open(params);
assertTrue(store.getNames().isEmpty());
}
use of org.geotoolkit.version.VersionControl in project geotoolkit by Geomatys.
the class PostgresVersioningTest method testTrimVersioning.
@Test
public void testTrimVersioning() throws DataStoreException, VersioningException {
reload(true);
List<Version> versions;
Feature feature;
ResourceId fid;
Version v0;
Version v1;
Version v2;
FeatureIterator ite;
Query qb = new Query();
// create table
final FeatureType refType = FTYPE_SIMPLE;
store.createFeatureType(refType);
assertEquals(1, store.getNames().size());
// get version control
final VersionControl vc = store.getVersioning(refType.getName().toString());
assertNotNull(vc);
assertTrue(vc.isEditable());
assertFalse(vc.isVersioned());
// start versioning /////////////////////////////////////////////////////
vc.startVersioning();
assertTrue(vc.isVersioned());
versions = vc.list();
assertTrue(versions.isEmpty());
// make an insert ///////////////////////////////////////////////////////
final Point firstPoint = GF.createPoint(new Coordinate(56, 45));
feature = refType.newInstance();
feature.setPropertyValue("id", "0");
feature.setPropertyValue("boolean", Boolean.TRUE);
feature.setPropertyValue("integer", 14);
feature.setPropertyValue("point", firstPoint);
feature.setPropertyValue("string", "someteststring");
store.addFeatures(refType.getName().toString(), Collections.singleton(feature));
// we should have one version
versions = vc.list();
assertEquals(1, versions.size());
// get identifier
// ensure normal reading is correct without version----------------------
qb = new Query();
qb.setTypeName(refType.getName());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feature = ite.next();
fid = FeatureExt.getId(feature);
} finally {
ite.close();
}
try {
// wait a bit just to have some space between version dates
Thread.sleep(1000);
} catch (InterruptedException ex) {
fail(ex.getMessage());
}
// make an update ///////////////////////////////////////////////////////
final Point secondPoint = GF.createPoint(new Coordinate(-12, 21));
final Map<String, Object> updates = new HashMap<>();
updates.put("boolean", Boolean.FALSE);
updates.put("integer", -3);
updates.put("point", secondPoint);
updates.put("string", "anothertextupdated");
store.updateFeatures(refType.getName().toString(), fid, updates);
try {
// wait a bit just to have some space between version dates
Thread.sleep(1000);
} catch (InterruptedException ex) {
fail(ex.getMessage());
}
// make a 2nd update ///////////////////////////////////////////////////////
final Point thirdPoint = GF.createPoint(new Coordinate(145, -221));
final Map<String, Object> updates2 = new HashMap<>();
updates2.put("boolean", Boolean.FALSE);
updates2.put("integer", 150);
updates2.put("point", thirdPoint);
updates2.put("string", "secondtextupdated");
store.updateFeatures(refType.getName().toString(), fid, updates2);
// get all versions organized in increase dates order.
versions = vc.list();
assertEquals(3, versions.size());
v0 = versions.get(0);
v1 = versions.get(1);
v2 = versions.get(2);
/* first trim between v1 date and v2 date (named middle date) to verify
* deletion of first version and update v1 date at trim date.*/
final Date middle = new Date((v1.getDate().getTime() + v2.getDate().getTime()) >> 1);
vc.trim(middle);
versions = vc.list();
assertEquals(2, versions.size());
// ensure version 0 does not exist
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(v0.getLabel());
try {
store.createSession(true).getFeatureCollection(qb).isEmpty();
fail("should not find version");
} catch (FeatureStoreRuntimeException ex) {
// ok
}
// ensure version v1 begin at middle date.
assertEquals(vc.list().get(0).getDate().getTime(), middle.getTime());
/* second trim at exactely the begining of the third version to verify,
* deletion of second version and third version existence.*/
vc.trim(v2);
versions = vc.list();
assertEquals(1, versions.size());
// ensure version 1 does not exist
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(v1.getLabel());
try {
store.createSession(true).getFeatureCollection(qb).isEmpty();
fail("should not find version");
} catch (FeatureStoreRuntimeException ex) {
// ok
}
// ensure version v2 begin time doesn't change.
assertEquals(vc.list().get(0).getDate().getTime(), v2.getDate().getTime());
/* third trim just after v3 version date, to verify that v3
* version date become trim date */
final long lastDate = v2.getDate().getTime() + 400;
vc.trim(new Date(lastDate));
versions = vc.list();
assertEquals(1, versions.size());
// ensure version v2 begin time become lastDate.
assertEquals(vc.list().get(0).getDate().getTime(), lastDate);
}
use of org.geotoolkit.version.VersionControl in project geotoolkit by Geomatys.
the class PostgresVersioningTest method testRevertVersioning.
@Test
public void testRevertVersioning() throws DataStoreException, VersioningException {
reload(true);
List<Version> versions;
Feature feature;
ResourceId fid;
Version v0;
Version v1;
Version v2;
FeatureIterator ite;
Query qb = new Query();
// create table
final FeatureType refType = FTYPE_SIMPLE;
store.createFeatureType(refType);
assertEquals(1, store.getNames().size());
// get version control
final VersionControl vc = store.getVersioning(refType.getName().toString());
assertNotNull(vc);
assertTrue(vc.isEditable());
assertFalse(vc.isVersioned());
// start versioning /////////////////////////////////////////////////////
vc.startVersioning();
assertTrue(vc.isVersioned());
versions = vc.list();
assertTrue(versions.isEmpty());
// make an insert ///////////////////////////////////////////////////////
final Point firstPoint = GF.createPoint(new Coordinate(56, 45));
feature = refType.newInstance();
feature.setPropertyValue("id", "0");
feature.setPropertyValue("boolean", Boolean.TRUE);
feature.setPropertyValue("integer", 14);
feature.setPropertyValue("point", firstPoint);
feature.setPropertyValue("string", "someteststring");
store.addFeatures(refType.getName().toString(), Collections.singleton(feature));
// we should have one version
versions = vc.list();
assertEquals(1, versions.size());
// get identifier
// ensure normal reading is correct without version----------------------
qb = new Query();
qb.setTypeName(refType.getName());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feature = ite.next();
fid = FeatureExt.getId(feature);
} finally {
ite.close();
}
try {
// wait a bit just to have some space between version dates
Thread.sleep(1000);
} catch (InterruptedException ex) {
fail(ex.getMessage());
}
// make an update ///////////////////////////////////////////////////////
final Point secondPoint = GF.createPoint(new Coordinate(-12, 21));
final Map<String, Object> updates = new HashMap<>();
updates.put("boolean", Boolean.FALSE);
updates.put("integer", -3);
updates.put("point", secondPoint);
updates.put("string", "anothertextupdated");
store.updateFeatures(refType.getName().toString(), fid, updates);
try {
// wait a bit just to have some space between version dates
Thread.sleep(1000);
} catch (InterruptedException ex) {
fail(ex.getMessage());
}
// make a remove ///////////////////////////////////////////////////////
store.removeFeatures(refType.getName().toString(), fid);
// ensure test table is empty
qb = new Query();
qb.setTypeName(refType.getName());
assertTrue(store.createSession(true).getFeatureCollection(qb).isEmpty());
// get all versions organized in increase dates order.
versions = vc.list();
assertEquals(3, versions.size());
v0 = versions.get(0);
v1 = versions.get(1);
v2 = versions.get(2);
/* first revert between v1 date and v2 date (named middle date) to verify
* re - insertion of feature in the original base and update v2 ending date become null.*/
// =/2
final Date middle = new Date((v1.getDate().getTime() + v2.getDate().getTime()) >> 1);
vc.revert(middle);
versions = vc.list();
assertEquals(2, versions.size());
// ensure version v2 does not exist
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(v2.getLabel());
try {
store.createSession(true).getFeatureCollection(qb).isEmpty();
fail("should not find version");
} catch (FeatureStoreRuntimeException ex) {
// ok
}
// ensure test table contain feature from version 1
qb = new Query();
qb.setTypeName(refType.getName());
assertFalse(store.createSession(true).getFeatureCollection(qb).isEmpty());
Feature featV1;
Feature feat;
// feature from test base result.
qb = new Query();
qb.setTypeName(refType.getName());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feat = ite.next();
fid = FeatureExt.getId(feature);
} finally {
ite.close();
}
// feature from version v1.
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(v1.getLabel());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
featV1 = ite.next();
fid = FeatureExt.getId(feature);
} finally {
ite.close();
}
assertTrue(feat.getProperty("boolean").equals(featV1.getProperty("boolean")));
assertTrue(feat.getProperty("integer").equals(featV1.getProperty("integer")));
assertTrue(feat.getProperty("point").equals(featV1.getProperty("point")));
assertTrue(feat.getProperty("string").equals(featV1.getProperty("string")));
/* second revert at v0 begin date to verify update roll back, and verify
* feature update from history table into original base.*/
vc.revert(v0.getDate());
versions = vc.list();
assertEquals(1, versions.size());
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(v1.getLabel());
try {
store.createSession(true).getFeatureCollection(qb).isEmpty();
fail("should not find version");
} catch (FeatureStoreRuntimeException ex) {
// ok
}
// ensure test table contain feature from version 1
qb = new Query();
qb.setTypeName(refType.getName());
assertFalse(store.createSession(true).getFeatureCollection(qb).isEmpty());
// feature from test base result.
qb = new Query();
qb.setTypeName(refType.getName());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feat = ite.next();
fid = FeatureExt.getId(feature);
} finally {
ite.close();
}
// feature from version v1.
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(v0.getLabel());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
featV1 = ite.next();
fid = FeatureExt.getId(feature);
} finally {
ite.close();
}
assertTrue(feat.getProperty("boolean").equals(featV1.getProperty("boolean")));
assertTrue(feat.getProperty("integer").equals(featV1.getProperty("integer")));
assertTrue(feat.getProperty("point").equals(featV1.getProperty("point")));
assertTrue(feat.getProperty("string").equals(featV1.getProperty("string")));
}
use of org.geotoolkit.version.VersionControl in project geotoolkit by Geomatys.
the class PostgresVersioningTest method testSimpleTypeVersioning.
@Test
public void testSimpleTypeVersioning() throws DataStoreException, VersioningException {
reload(true);
List<Version> versions;
Version version;
Feature feature;
ResourceId fid;
Version v1;
Version v2;
Version v3;
FeatureIterator ite;
Query qb = new Query();
// create table
final FeatureType refType = FTYPE_SIMPLE;
store.createFeatureType(refType);
assertEquals(1, store.getNames().size());
assertNotNull(store.getQueryCapabilities());
assertTrue(store.getQueryCapabilities().handleVersioning());
// get version control
final VersionControl vc = store.getVersioning(refType.getName().toString());
assertNotNull(vc);
assertTrue(vc.isEditable());
assertFalse(vc.isVersioned());
// //////////////////////////////////////////////////////////////////////
// start versioning /////////////////////////////////////////////////////
vc.startVersioning();
assertTrue(vc.isVersioned());
versions = vc.list();
assertTrue(versions.isEmpty());
// check the version table is not visible in the feature types
store.refreshMetaModel();
final Set<GenericName> names = store.getNames();
assertEquals(1, names.size());
// //////////////////////////////////////////////////////////////////////
// make an insert ///////////////////////////////////////////////////////
final Point firstPoint = GF.createPoint(new Coordinate(56, 45));
feature = refType.newInstance();
feature.setPropertyValue("id", "0");
feature.setPropertyValue("boolean", Boolean.TRUE);
feature.setPropertyValue("integer", 14);
feature.setPropertyValue("point", firstPoint);
feature.setPropertyValue("string", "someteststring");
store.addFeatures(refType.getName().toString(), Collections.singleton(feature));
// we should have one version
versions = vc.list();
assertEquals(1, versions.size());
version = versions.get(0);
Date date = version.getDate();
// ensure normal reading is correct without version----------------------
qb = new Query();
qb.setTypeName(refType.getName());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feature = ite.next();
assertEquals(Boolean.TRUE, feature.getPropertyValue("boolean"));
assertEquals(14, feature.getPropertyValue("integer"));
assertEquals(firstPoint, feature.getPropertyValue("point"));
assertEquals("someteststring", feature.getPropertyValue("string"));
fid = FeatureExt.getId(feature);
} finally {
ite.close();
}
// ensure normal reading is correct with version-------------------------
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(version.getLabel());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feature = ite.next();
assertEquals(Boolean.TRUE, feature.getPropertyValue("boolean"));
assertEquals(14, feature.getPropertyValue("integer"));
assertEquals(firstPoint, feature.getPropertyValue("point"));
assertEquals("someteststring", feature.getPropertyValue("string"));
} finally {
ite.close();
}
try {
// wait a bit just to have some space between version dates
Thread.sleep(1000);
} catch (InterruptedException ex) {
fail(ex.getMessage());
}
// //////////////////////////////////////////////////////////////////////
// make an update ///////////////////////////////////////////////////////
final Point secondPoint = GF.createPoint(new Coordinate(-12, 21));
final Map<String, Object> updates = new HashMap<>();
updates.put("boolean", Boolean.FALSE);
updates.put("integer", -3);
updates.put("point", secondPoint);
updates.put("string", "anothertextupdated");
store.updateFeatures(refType.getName().toString(), fid, updates);
// we should have two versions
versions = vc.list();
assertEquals(2, versions.size());
v1 = versions.get(0);
v2 = versions.get(1);
// should be ordered starting from the oldest
assertTrue(v1.getDate().compareTo(v2.getDate()) < 0);
// ensure normal reading is correct without version----------------------
qb = new Query();
qb.setTypeName(refType.getName());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feature = ite.next();
assertEquals(Boolean.FALSE, feature.getPropertyValue("boolean"));
assertEquals(-3, feature.getPropertyValue("integer"));
assertEquals(secondPoint, feature.getPropertyValue("point"));
assertEquals("anothertextupdated", feature.getPropertyValue("string"));
} finally {
ite.close();
}
// ensure normal reading is correct with version-------------------------
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(v2.getLabel());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feature = ite.next();
assertEquals(Boolean.FALSE, feature.getPropertyValue("boolean"));
assertEquals(-3, feature.getPropertyValue("integer"));
assertEquals(secondPoint, feature.getPropertyValue("point"));
assertEquals("anothertextupdated", feature.getPropertyValue("string"));
} finally {
ite.close();
}
// ensure reading a previous version works ------------------------------
qb = new Query();
;
qb.setTypeName(refType.getName());
qb.setVersionLabel(v1.getLabel());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feature = ite.next();
assertEquals(Boolean.TRUE, feature.getPropertyValue("boolean"));
assertEquals(14, feature.getPropertyValue("integer"));
assertEquals(firstPoint, feature.getPropertyValue("point"));
assertEquals("someteststring", feature.getPropertyValue("string"));
} finally {
ite.close();
}
// ensure reading a previous version using not exact date----------------
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionDate(new Date(v1.getDate().getTime() + 400));
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feature = ite.next();
assertEquals(Boolean.TRUE, feature.getPropertyValue("boolean"));
assertEquals(14, feature.getPropertyValue("integer"));
assertEquals(firstPoint, feature.getPropertyValue("point"));
assertEquals("someteststring", feature.getPropertyValue("string"));
} finally {
ite.close();
}
// //////////////////////////////////////////////////////////////////////
// delete record ////////////////////////////////////////////////////////
store.removeFeatures(refType.getName().toString(), fid);
qb = new Query();
qb.setTypeName(refType.getName());
assertEquals(0, store.getCount(qb));
// we should have three versions
versions = vc.list();
assertEquals(3, versions.size());
v1 = versions.get(0);
v2 = versions.get(1);
v3 = versions.get(2);
// should be ordered starting from the oldest
assertTrue(v2.getDate().compareTo(v1.getDate()) > 0);
assertTrue(v3.getDate().compareTo(v2.getDate()) > 0);
// ensure we have nothing if no version set -----------------------------
qb = new Query();
qb.setTypeName(refType.getName());
assertTrue(store.createSession(true).getFeatureCollection(qb).isEmpty());
// ensure we have nothing if latest version set -------------------------
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(v3.getLabel());
assertTrue(store.createSession(true).getFeatureCollection(qb).isEmpty());
// ensure we have nothing with date after deletion ----------------------
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionDate(new Date(v3.getDate().getTime() + 400));
assertTrue(store.createSession(true).getFeatureCollection(qb).isEmpty());
// ensure reading version 1 works ---------------------------------------
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(v1.getLabel());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feature = ite.next();
assertEquals(Boolean.TRUE, feature.getProperty("boolean").getValue());
assertEquals(14, feature.getProperty("integer").getValue());
assertEquals(firstPoint, feature.getProperty("point").getValue());
assertEquals("someteststring", feature.getProperty("string").getValue());
} finally {
ite.close();
}
// ensure reading version 2 works ---------------------------------------
qb = new Query();
qb.setTypeName(refType.getName());
qb.setVersionLabel(v2.getLabel());
ite = store.createSession(true).getFeatureCollection(qb).iterator();
try {
feature = ite.next();
assertEquals(Boolean.FALSE, feature.getProperty("boolean").getValue());
assertEquals(-3, feature.getProperty("integer").getValue());
assertEquals(secondPoint, feature.getProperty("point").getValue());
assertEquals("anothertextupdated", feature.getProperty("string").getValue());
} finally {
ite.close();
}
// //////////////////////////////////////////////////////////////////////
// drop versioning //////////////////////////////////////////////////////
vc.dropVersioning();
assertTrue(vc.isEditable());
assertFalse(vc.isVersioned());
versions = vc.list();
assertTrue(versions.isEmpty());
// ensure we have no record----------------------------------------------
qb = new Query();
qb.setTypeName(refType.getName());
assertTrue(store.createSession(true).getFeatureCollection(qb).isEmpty());
}
use of org.geotoolkit.version.VersionControl in project geotoolkit by Geomatys.
the class PGCVersioningTest method testVersioning.
@Test
public void testVersioning() throws DataStoreException, VersioningException {
reload();
final GeneralDirectPosition upperLeft = new GeneralDirectPosition(CommonCRS.WGS84.geographic());
final Dimension dimension = new Dimension(20, 20);
final Calendar calendar = Calendar.getInstance(GMT0);
upperLeft.setOrdinate(0, -90);
upperLeft.setOrdinate(1, +180);
List<Version> versions;
Version version;
PyramidalCoverageResource cref;
Pyramid pyramid;
Mosaic mosaic;
GridCoverage coverage;
final GenericName name = NamesExt.create(null, "versLayer");
store.add(new DefiningCoverageResource(name));
final VersionControl vc = store.getVersioning(name);
versions = vc.list();
assertTrue(versions.isEmpty());
// create version 1 -----------------------------------------------------
calendar.setTimeInMillis(0);
final Date date1 = calendar.getTime();
version = vc.createVersion(date1);
cref = (PyramidalCoverageResource) store.findResource(name, version);
assertNotNull(cref);
// we need to create a pyramid otherwise the version not really be created
pyramid = (Pyramid) cref.createModel(new DefiningPyramid(CommonCRS.WGS84.geographic()));
mosaic = pyramid.createMosaic(new DefiningMosaic(null, upperLeft, 1, dimension, new Dimension(1, 1)));
mosaic.writeTiles(Stream.of(new DefaultImageTile(createImage(dimension, Color.RED), new Point(0, 0))), null);
versions = vc.list();
assertEquals(1, versions.size());
assertEquals(versions.get(0).getDate().getTime(), 0);
assertEquals(date1.getTime(), versions.get(0).getDate().getTime());
coverage = cref.read(null);
assertImageColor(coverage.render(null), Color.RED);
// create version 2 -----------------------------------------------------
calendar.setTimeInMillis(50000);
final Date date2 = calendar.getTime();
version = vc.createVersion(date2);
cref = (PyramidalCoverageResource) store.findResource(name, version);
assertNotNull(cref);
// we need to create a pyramid otherwise the version not really be created
pyramid = (Pyramid) cref.createModel(new DefiningPyramid(CommonCRS.WGS84.geographic()));
mosaic = pyramid.createMosaic(new DefiningMosaic(null, upperLeft, 1, dimension, new Dimension(1, 1)));
mosaic.writeTiles(Stream.of(new DefaultImageTile(createImage(dimension, Color.BLUE), new Point(0, 0))), null);
coverage = cref.read(null);
assertImageColor(coverage.render(null), Color.BLUE);
versions = vc.list();
assertEquals(2, versions.size());
assertEquals(versions.get(0).getDate().getTime(), 0);
assertEquals(versions.get(1).getDate().getTime(), 50000);
// create version 3 -----------------------------------------------------
calendar.setTimeInMillis(20000);
final Date date3 = calendar.getTime();
version = vc.createVersion(date3);
cref = (PyramidalCoverageResource) store.findResource(name, version);
assertNotNull(cref);
// we need to create a pyramid otherwise the version not really be created
pyramid = (Pyramid) cref.createModel(new DefiningPyramid(CommonCRS.WGS84.geographic()));
mosaic = pyramid.createMosaic(new DefiningMosaic(null, upperLeft, 1, dimension, new Dimension(1, 1)));
mosaic.writeTiles(Stream.of(new DefaultImageTile(createImage(dimension, Color.BLUE), new Point(0, 0))), null);
coverage = cref.read(null);
assertImageColor(coverage.render(null), Color.GREEN);
versions = vc.list();
assertEquals(3, versions.size());
assertEquals(versions.get(0).getDate().getTime(), 0);
assertEquals(versions.get(1).getDate().getTime(), 20000);
assertEquals(versions.get(2).getDate().getTime(), 50000);
// try accesing different version ---------------------------------------
cref = (PyramidalCoverageResource) store.findResource(name.toString());
// we should have the blue image
coverage = cref.read(null);
assertImageColor(coverage.render(null), Color.BLUE);
// grab by version
cref = (PyramidalCoverageResource) store.findResource(name, versions.get(0));
coverage = cref.read(null);
assertImageColor(coverage.render(null), Color.RED);
cref = (PyramidalCoverageResource) store.findResource(name, versions.get(1));
coverage = cref.read(null);
assertImageColor(coverage.render(null), Color.GREEN);
cref = (PyramidalCoverageResource) store.findResource(name, versions.get(2));
coverage = cref.read(null);
assertImageColor(coverage.render(null), Color.BLUE);
// drop some versions ---------------------------------------------------
vc.dropVersion(versions.get(1));
versions = vc.list();
assertEquals(2, versions.size());
assertEquals(versions.get(0).getDate().getTime(), 0);
assertEquals(versions.get(1).getDate().getTime(), 50000);
cref = (PyramidalCoverageResource) store.findResource(name, versions.get(0));
coverage = cref.read(null);
assertImageColor(coverage.render(null), Color.RED);
cref = (PyramidalCoverageResource) store.findResource(name, versions.get(1));
coverage = cref.read(null);
assertImageColor(coverage.render(null), Color.BLUE);
}
Aggregations