Merge remote-tracking branch 'upstream/main' into #2956

This commit is contained in:
Mark H. Wood
2020-11-24 11:56:18 -05:00
67 changed files with 2107 additions and 11368 deletions

View File

@@ -40,6 +40,8 @@ import org.dspace.core.factory.CoreServiceFactory;
import org.dspace.core.service.LicenseService;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
import org.dspace.services.ConfigurationService;
import org.dspace.utils.DSpace;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -161,6 +163,7 @@ public class CollectionTest extends AbstractDSpaceObjectTest {
public void testCreate() throws Exception {
// Allow Community ADD perms
doNothing().when(authorizeServiceSpy).authorizeAction(context, owningCommunity, Constants.ADD);
doNothing().when(authorizeServiceSpy).authorizeAction(context, owningCommunity, Constants.ADD, true);
Collection created = collectionService.create(context, owningCommunity);
assertThat("testCreate 0", created, notNullValue());
@@ -174,6 +177,14 @@ public class CollectionTest extends AbstractDSpaceObjectTest {
public void testCreateWithValidHandle() throws Exception {
// Allow Community ADD perms
doNothing().when(authorizeServiceSpy).authorizeAction(context, owningCommunity, Constants.ADD);
doNothing().when(authorizeServiceSpy).authorizeAction(context, owningCommunity, Constants.ADD, true);
// provide additional prefixes to the configuration in order to support them
final ConfigurationService configurationService = new DSpace().getConfigurationService();
String handleAdditionalPrefixes = configurationService.getProperty("handle.additional.prefixes");
try {
configurationService.setProperty("handle.additional.prefixes", "987654321");
// test creating collection with a specified handle which is NOT already in use
// (this handle should not already be used by system, as it doesn't start with "1234567689" prefix)
@@ -182,6 +193,10 @@ public class CollectionTest extends AbstractDSpaceObjectTest {
// check that collection was created, and that its handle was set to proper value
assertThat("testCreateWithValidHandle 0", created, notNullValue());
assertThat("testCreateWithValidHandle 1", created.getHandle(), equalTo("987654321/100"));
} finally {
configurationService.setProperty("handle.additional.prefixes", handleAdditionalPrefixes);
}
}