// a "release"
repository.setRepositoryPolicy(RepositoryPolicy.RELEASE);
repository.getCurrentCoreConfiguration().commitChanges();
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);
assertThat("Should not be able to store snapshot to release repo", false);
}
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);
assertThat("Should not be able to store release to snapshot repo", false);