// restart
startRunStop(new RepositoryOperation() {
@Override
public Void call() throws Exception {
changeLastUpgradeId(repository, Upgrades.ModeShape_4_0_0_Beta3.INSTANCE.getId() - 1);
FileSystemBinaryStore binaryStore = (FileSystemBinaryStore)repository.runningState().binaryStore();
assertFalse("No used binaries expected", binaryStore.getAllBinaryKeys().iterator().hasNext());
assertFalse("The binary should not be found", binaryStore.hasBinary(binaryKey));
File mainStorageDirectory = binaryStore.getDirectory();
File[] files = mainStorageDirectory.listFiles();
assertEquals("Just the trash directory was expected", 1, files.length);
File trash = files[0];
assertTrue(trash.isDirectory());
return null;
}
}, config);
// run the repo a second time, which should run the upgrade
startRunStop(new RepositoryOperation() {
@Override
public Void call() throws Exception {
FileSystemBinaryStore binaryStore = (FileSystemBinaryStore)repository.runningState().binaryStore();
assertFalse("No used binaries expected", binaryStore.getAllBinaryKeys().iterator().hasNext());
assertTrue("The binary should be found", binaryStore.hasBinary(binaryKey));
return null;
}
}, config);
}