Skip to content

Commit

Permalink
DURACOM-211 s3bitstoreService IT class fix
Browse files Browse the repository at this point in the history
  • Loading branch information
frabacche committed Jan 19, 2024
1 parent 584d178 commit 2beb604
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import io.findify.s3mock.S3Mock;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.BooleanUtils;
import org.dspace.AbstractIntegrationTestWithDatabase;
import org.dspace.app.matcher.LambdaMatcher;
import org.dspace.authorize.AuthorizeException;
Expand All @@ -63,6 +64,7 @@
import org.junit.Test;



/**
* @author Luca Giamminonni (luca.giamminonni at 4science.com)
*/
Expand All @@ -86,6 +88,7 @@ public class S3BitStoreServiceIT extends AbstractIntegrationTestWithDatabase {
@Before
public void setup() throws Exception {

configurationService.setProperty("assetstore.s3.enabled", "true");
s3Directory = new File(System.getProperty("java.io.tmpdir"), "s3");

s3Mock = S3Mock.create(8001, s3Directory.getAbsolutePath());
Expand All @@ -94,7 +97,8 @@ public void setup() throws Exception {
amazonS3Client = createAmazonS3Client();

s3BitStoreService = new S3BitStoreService(amazonS3Client);

s3BitStoreService.setEnabled(BooleanUtils.toBoolean(
configurationService.getProperty("assetstore.s3.enabled")));
context.turnOffAuthorisationSystem();

parentCommunity = CommunityBuilder.createCommunity(context)
Expand Down Expand Up @@ -391,7 +395,7 @@ public void givenBitStreamIdentifierWithSlashesWhenSanitizedThenSlashesMustBeRem
@Test
public void testDoNotInitializeConfigured() throws Exception {
String assetstores3enabledOldValue = configurationService.getProperty("assetstore.s3.enabled");
configurationService.setProperty("assetstore.s3.enabled", false);
configurationService.setProperty("assetstore.s3.enabled", "false");
s3BitStoreService = new S3BitStoreService(amazonS3Client);
s3BitStoreService.init();
assertFalse(s3BitStoreService.isInitialized());
Expand Down

0 comments on commit 2beb604

Please sign in to comment.