diff --git a/dspace-api/src/main/java/org/dspace/storage/bitstore/BitstreamStorageServiceImpl.java b/dspace-api/src/main/java/org/dspace/storage/bitstore/BitstreamStorageServiceImpl.java index 290e480a93f2..9c4d626a098a 100644 --- a/dspace-api/src/main/java/org/dspace/storage/bitstore/BitstreamStorageServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/storage/bitstore/BitstreamStorageServiceImpl.java @@ -90,6 +90,11 @@ protected BitstreamStorageServiceImpl() { } + @Override + public void setIncomingExternal(int incoming) { + this.incoming = incoming; + } + @Override public void afterPropertiesSet() throws Exception { for (Map.Entry storeEntry : stores.entrySet()) { diff --git a/dspace-api/src/main/java/org/dspace/storage/bitstore/service/BitstreamStorageService.java b/dspace-api/src/main/java/org/dspace/storage/bitstore/service/BitstreamStorageService.java index 8c3a67ee9a08..854d6b61fb9b 100644 --- a/dspace-api/src/main/java/org/dspace/storage/bitstore/service/BitstreamStorageService.java +++ b/dspace-api/src/main/java/org/dspace/storage/bitstore/service/BitstreamStorageService.java @@ -144,7 +144,7 @@ public InputStream retrieve(Context context, Bitstream bitstream) /** * Clone the given bitstream to a new bitstream with a new ID. * Metadata of the given bitstream are also copied to the new bitstream. - * + * * @param context * DSpace context object * @param bitstream @@ -191,4 +191,11 @@ public void migrate(Context context, Integer assetstoreSource, Integer assetstor @Nullable Long getLastModified(Bitstream bitstream) throws IOException; + + /** + * Sets the number for the incoming store + * @param incoming + */ + public void setIncomingExternal(int incoming); + } diff --git a/dspace-api/src/test/java/org/dspace/content/BitstreamJCloudBitstoreTest.java b/dspace-api/src/test/java/org/dspace/content/BitstreamJCloudBitstoreTest.java index ec8688b3bea2..4416ef95cb7d 100644 --- a/dspace-api/src/test/java/org/dspace/content/BitstreamJCloudBitstoreTest.java +++ b/dspace-api/src/test/java/org/dspace/content/BitstreamJCloudBitstoreTest.java @@ -13,6 +13,8 @@ import org.dspace.content.service.BitstreamFormatService; import org.dspace.services.ConfigurationService; import org.dspace.services.factory.DSpaceServicesFactory; +import org.dspace.storage.bitstore.factory.StorageServiceFactory; +import org.dspace.storage.bitstore.service.BitstreamStorageService; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -25,11 +27,14 @@ public class BitstreamJCloudBitstoreTest extends BitstreamTest { protected BitstreamFormatService bitstreamFormatService = ContentServiceFactory.getInstance() - .getBitstreamFormatService(); + .getBitstreamFormatService(); private final ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService(); + protected BitstreamStorageService bitstreamService = StorageServiceFactory.getInstance() + .getBitstreamStorageService(); + /** * This method will be run before every test as per @Before. It will @@ -41,7 +46,7 @@ public class BitstreamJCloudBitstoreTest extends BitstreamTest { @Before @Override public void init() { - configurationService.setProperty("assetstore.index.primary", "2"); + bitstreamService.setIncomingExternal(2); super.init(); } @@ -65,7 +70,7 @@ public void testGetStoreNumber() { @After @Override public void destroy() { - configurationService.setProperty("assetstore.index.primary", "0"); + bitstreamService.setIncomingExternal(0); super.destroy(); }