DefaultStorageFileItem item = new DefaultStorageFileItem(
repository,
new ResourceStoreRequest(SPOOF_RELEASE),
true,
true,
new StringContentLocator(SPOOF_RELEASE));
repository.storeItem(false, item);
try {
item = new DefaultStorageFileItem(
repository, new ResourceStoreRequest(SPOOF_SNAPSHOT), true, true, new StringContentLocator(SPOOF_SNAPSHOT)
);
repository.storeItem(false, item);
fail("Should not be able to store snapshot to release repo");
}
catch (UnsupportedStorageOperationException e) {
// good
}
// reset NFC
repository.expireCaches(new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT, true));
// a "snapshot"
repository.setRepositoryPolicy(RepositoryPolicy.SNAPSHOT);
repository.getCurrentCoreConfiguration().commitChanges();
item = new DefaultStorageFileItem(
repository, new ResourceStoreRequest(SPOOF_SNAPSHOT), true, true, new StringContentLocator(SPOOF_SNAPSHOT)
);
repository.storeItem(false, item);
try {
item = new DefaultStorageFileItem(
repository, new ResourceStoreRequest(SPOOF_RELEASE), true, true, new StringContentLocator(SPOOF_RELEASE)
);
repository.storeItem(false, item);
fail("Should not be able to store release to snapshot repo");