}
EvolveConfig config = new EvolveConfig();
config.setEvolveListener(new EvolveListener() {
public boolean evolveProgress(EvolveEvent event) {
EvolveStats stats = event.getStats();
evolveNRead = stats.getNRead();
evolveNConverted = stats.getNConverted();
return true;
}
});
openEnv();
openStoreReadWrite();
/*
* Evolve and expect that the expected number of entities are
* converted.
*/
int nExpected = caseObj.getNRecordsExpected();
evolveNRead = 0;
evolveNConverted = 0;
PersistCatalog.unevolvedFormatsEncountered = false;
EvolveStats stats = store.evolve(config);
if (nExpected > 0) {
assertTrue(PersistCatalog.unevolvedFormatsEncountered);
}
assertTrue(evolveNRead == nExpected);
assertTrue(evolveNConverted == nExpected);
assertTrue(evolveNConverted >= evolveNRead);
assertEquals(evolveNRead, stats.getNRead());
assertEquals(evolveNConverted, stats.getNConverted());
/* Evolve again and expect that no entities are converted. */
evolveNRead = 0;
evolveNConverted = 0;
PersistCatalog.unevolvedFormatsEncountered = false;
stats = store.evolve(config);
assertTrue(!PersistCatalog.unevolvedFormatsEncountered);
assertTrue(evolveNRead == 0);
assertTrue(evolveNConverted == 0);
assertEquals(0, stats.getNRead());
assertEquals(0, stats.getNConverted());
/* Ensure that we can read all entities without evolution. */
PersistCatalog.unevolvedFormatsEncountered = false;
caseObj.readObjects(store, false /*doUpdate*/);
assertTrue(!PersistCatalog.unevolvedFormatsEncountered);