mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-10 19:43:10 +00:00
Fixes to various errorprone warnings in tests
This commit is contained in:
@@ -14,7 +14,9 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dspace.AbstractUnitTest;
|
import org.dspace.AbstractUnitTest;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
@@ -85,7 +87,8 @@ public class GoogleMetadataTest extends AbstractUnitTest {
|
|||||||
log.error("SQL Error in init", ex);
|
log.error("SQL Error in init", ex);
|
||||||
fail("SQL Error in init: " + ex.getMessage());
|
fail("SQL Error in init: " + ex.getMessage());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error("IO Error in init", e);
|
||||||
|
fail("IO Error in init: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,8 +122,8 @@ public class GoogleMetadataTest extends AbstractUnitTest {
|
|||||||
context.restoreAuthSystemState();
|
context.restoreAuthSystemState();
|
||||||
context.commit();
|
context.commit();
|
||||||
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
||||||
String[] urlSplitted = gm.getPDFURL().get(0).split("/");
|
List<String> urlSplitted = Splitter.on("/").splitToList(gm.getPDFURL().get(0));
|
||||||
assertEquals("Pdf", urlSplitted[urlSplitted.length - 1]);
|
assertEquals("Pdf", urlSplitted.get(urlSplitted.size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,8 +157,8 @@ public class GoogleMetadataTest extends AbstractUnitTest {
|
|||||||
context.restoreAuthSystemState();
|
context.restoreAuthSystemState();
|
||||||
context.commit();
|
context.commit();
|
||||||
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
||||||
String[] urlSplitted = gm.getPDFURL().get(0).split("/");
|
List<String> urlSplitted = Splitter.on("/").splitToList(gm.getPDFURL().get(0));
|
||||||
assertEquals("size9", urlSplitted[urlSplitted.length - 1]);
|
assertEquals("size9", urlSplitted.get(urlSplitted.size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -189,8 +192,8 @@ public class GoogleMetadataTest extends AbstractUnitTest {
|
|||||||
context.restoreAuthSystemState();
|
context.restoreAuthSystemState();
|
||||||
context.commit();
|
context.commit();
|
||||||
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
||||||
String[] urlSplitted = gm.getPDFURL().get(0).split("/");
|
List<String> urlSplitted = Splitter.on("/").splitToList(gm.getPDFURL().get(0));
|
||||||
assertEquals("first", urlSplitted[urlSplitted.length - 1]);
|
assertEquals("first", urlSplitted.get(urlSplitted.size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -225,8 +228,8 @@ public class GoogleMetadataTest extends AbstractUnitTest {
|
|||||||
context.restoreAuthSystemState();
|
context.restoreAuthSystemState();
|
||||||
context.commit();
|
context.commit();
|
||||||
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
||||||
String[] urlSplitted = gm.getPDFURL().get(0).split("/");
|
List<String> urlSplitted = Splitter.on("/").splitToList(gm.getPDFURL().get(0));
|
||||||
assertEquals("primary", urlSplitted[urlSplitted.length - 1]);
|
assertEquals("primary", urlSplitted.get(urlSplitted.size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -261,8 +264,8 @@ public class GoogleMetadataTest extends AbstractUnitTest {
|
|||||||
context.restoreAuthSystemState();
|
context.restoreAuthSystemState();
|
||||||
context.commit();
|
context.commit();
|
||||||
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
||||||
String[] urlSplitted = gm.getPDFURL().get(0).split("/");
|
List<String> urlSplitted = Splitter.on("/").splitToList(gm.getPDFURL().get(0));
|
||||||
assertEquals("large", urlSplitted[urlSplitted.length - 1]);
|
assertEquals("large", urlSplitted.get(urlSplitted.size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -285,7 +288,7 @@ public class GoogleMetadataTest extends AbstractUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testGetPDFURLWithNoBitstreams() throws Exception {
|
public void testGetPDFURLWithNoBitstreams() throws Exception {
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
Bundle bundle = ContentServiceFactory.getInstance().getBundleService().create(context, it, "ORIGINAL");
|
ContentServiceFactory.getInstance().getBundleService().create(context, it, "ORIGINAL");
|
||||||
|
|
||||||
context.restoreAuthSystemState();
|
context.restoreAuthSystemState();
|
||||||
context.commit();
|
context.commit();
|
||||||
@@ -319,8 +322,8 @@ public class GoogleMetadataTest extends AbstractUnitTest {
|
|||||||
context.restoreAuthSystemState();
|
context.restoreAuthSystemState();
|
||||||
context.commit();
|
context.commit();
|
||||||
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
GoogleMetadata gm = new GoogleMetadata(this.context, it);
|
||||||
String[] urlSplitted = gm.getPDFURL().get(0).split("/");
|
List<String> urlSplitted = Splitter.on("/").splitToList(gm.getPDFURL().get(0));
|
||||||
assertEquals("small", urlSplitted[urlSplitted.length - 1]);
|
assertEquals("small", urlSplitted.get(urlSplitted.size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@@ -334,12 +337,8 @@ public class GoogleMetadataTest extends AbstractUnitTest {
|
|||||||
community = context.reloadEntity(community);
|
community = context.reloadEntity(community);
|
||||||
ContentServiceFactory.getInstance().getCommunityService().delete(context, community);
|
ContentServiceFactory.getInstance().getCommunityService().delete(context, community);
|
||||||
community = null;
|
community = null;
|
||||||
} catch (SQLException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
throw new AssertionError("Error occurred in destroy()", e);
|
||||||
} catch (AuthorizeException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
it = null;
|
it = null;
|
||||||
super.destroy();
|
super.destroy();
|
||||||
|
@@ -363,7 +363,7 @@ public class BundleTest extends AbstractDSpaceObjectTest {
|
|||||||
doThrow(new AuthorizeException()).when(authorizeServiceSpy).authorizeAction(context, b, Constants.ADD);
|
doThrow(new AuthorizeException()).when(authorizeServiceSpy).authorizeAction(context, b, Constants.ADD);
|
||||||
|
|
||||||
File f = new File(testProps.get("test.bitstream").toString());
|
File f = new File(testProps.get("test.bitstream").toString());
|
||||||
Bitstream bs = bitstreamService.create(context, b, new FileInputStream(f));
|
bitstreamService.create(context, b, new FileInputStream(f));
|
||||||
fail("Exception should be thrown");
|
fail("Exception should be thrown");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ public class BundleTest extends AbstractDSpaceObjectTest {
|
|||||||
|
|
||||||
int assetstore = 0; //default assetstore
|
int assetstore = 0; //default assetstore
|
||||||
File f = new File(testProps.get("test.bitstream").toString());
|
File f = new File(testProps.get("test.bitstream").toString());
|
||||||
Bitstream bs = bitstreamService.register(context, b, assetstore, f.getAbsolutePath());
|
bitstreamService.register(context, b, assetstore, f.getAbsolutePath());
|
||||||
fail("Exception should be thrown");
|
fail("Exception should be thrown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -196,7 +196,7 @@ public class CollectionTest extends AbstractDSpaceObjectTest {
|
|||||||
|
|
||||||
// test creating collection with a specified handle which IS already in use
|
// test creating collection with a specified handle which IS already in use
|
||||||
// This should throw an exception
|
// This should throw an exception
|
||||||
Collection created = collectionService.create(context, owningCommunity, inUseHandle);
|
collectionService.create(context, owningCommunity, inUseHandle);
|
||||||
fail("Exception expected");
|
fail("Exception expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,7 +291,6 @@ public class CollectionTest extends AbstractDSpaceObjectTest {
|
|||||||
String itext = "introductory text";
|
String itext = "introductory text";
|
||||||
String copy = "copyright declaration";
|
String copy = "copyright declaration";
|
||||||
String sidebar = "side bar text";
|
String sidebar = "side bar text";
|
||||||
String tempItem = "3";
|
|
||||||
String provDesc = "provenance description";
|
String provDesc = "provenance description";
|
||||||
String license = "license text";
|
String license = "license text";
|
||||||
|
|
||||||
@@ -370,7 +369,7 @@ public class CollectionTest extends AbstractDSpaceObjectTest {
|
|||||||
@Test(expected = AuthorizeException.class)
|
@Test(expected = AuthorizeException.class)
|
||||||
public void testSetLogoNoAuth() throws Exception {
|
public void testSetLogoNoAuth() throws Exception {
|
||||||
File f = new File(testProps.get("test.bitstream").toString());
|
File f = new File(testProps.get("test.bitstream").toString());
|
||||||
Bitstream logo = collectionService.setLogo(context, collection, new FileInputStream(f));
|
collectionService.setLogo(context, collection, new FileInputStream(f));
|
||||||
fail("Exception expected");
|
fail("Exception expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +392,7 @@ public class CollectionTest extends AbstractDSpaceObjectTest {
|
|||||||
@Test(expected = AuthorizeException.class)
|
@Test(expected = AuthorizeException.class)
|
||||||
public void testCreateWorkflowGroupNoAuth() throws Exception {
|
public void testCreateWorkflowGroupNoAuth() throws Exception {
|
||||||
int step = 1;
|
int step = 1;
|
||||||
Group result = collectionService.createWorkflowGroup(context, collection, step);
|
collectionService.createWorkflowGroup(context, collection, step);
|
||||||
fail("Exception expected");
|
fail("Exception expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,7 +460,7 @@ public class CollectionTest extends AbstractDSpaceObjectTest {
|
|||||||
*/
|
*/
|
||||||
@Test(expected = AuthorizeException.class)
|
@Test(expected = AuthorizeException.class)
|
||||||
public void testCreateSubmittersNoAuth() throws Exception {
|
public void testCreateSubmittersNoAuth() throws Exception {
|
||||||
Group result = collectionService.createSubmitters(context, collection);
|
collectionService.createSubmitters(context, collection);
|
||||||
fail("Exception expected");
|
fail("Exception expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +510,7 @@ public class CollectionTest extends AbstractDSpaceObjectTest {
|
|||||||
*/
|
*/
|
||||||
@Test(expected = AuthorizeException.class)
|
@Test(expected = AuthorizeException.class)
|
||||||
public void testCreateAdministratorsNoAuth() throws Exception {
|
public void testCreateAdministratorsNoAuth() throws Exception {
|
||||||
Group result = collectionService.createAdministrators(context, collection);
|
collectionService.createAdministrators(context, collection);
|
||||||
fail("Exception expected");
|
fail("Exception expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,11 +28,6 @@ import org.junit.Test;
|
|||||||
* @author pvillega
|
* @author pvillega
|
||||||
*/
|
*/
|
||||||
public class DCDateTest {
|
public class DCDateTest {
|
||||||
/**
|
|
||||||
* log4j category
|
|
||||||
*/
|
|
||||||
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(DCDateTest.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object to use in the tests
|
* Object to use in the tests
|
||||||
*/
|
*/
|
||||||
|
@@ -13,11 +13,9 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.dspace.content.dao.RelationshipTypeDAO;
|
|
||||||
import org.dspace.content.service.EntityTypeService;
|
import org.dspace.content.service.EntityTypeService;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
import org.dspace.content.service.RelationshipService;
|
import org.dspace.content.service.RelationshipService;
|
||||||
@@ -60,10 +58,8 @@ public class EntityServiceImplTest {
|
|||||||
public void testfindByItemId() throws Exception {
|
public void testfindByItemId() throws Exception {
|
||||||
// Declare objects utilized in unit test
|
// Declare objects utilized in unit test
|
||||||
Item item = mock(Item.class);
|
Item item = mock(Item.class);
|
||||||
List<Relationship> relationshipList = new ArrayList<>();
|
|
||||||
Relationship relationship = mock(Relationship.class);
|
Relationship relationship = mock(Relationship.class);
|
||||||
relationship.setId(9);
|
relationship.setId(9);
|
||||||
relationshipList.add(relationship);
|
|
||||||
|
|
||||||
// Mock the state of objects utilized in findByItemId() to meet the success criteria of an invocation
|
// Mock the state of objects utilized in findByItemId() to meet the success criteria of an invocation
|
||||||
when(itemService.find(any(), any())).thenReturn(item);
|
when(itemService.find(any(), any())).thenReturn(item);
|
||||||
@@ -79,10 +75,6 @@ public class EntityServiceImplTest {
|
|||||||
// Declare objects utilized in unit test
|
// Declare objects utilized in unit test
|
||||||
Entity entity = mock(Entity.class);
|
Entity entity = mock(Entity.class);
|
||||||
EntityTypeService entityTypeService = mock(EntityTypeService.class);
|
EntityTypeService entityTypeService = mock(EntityTypeService.class);
|
||||||
Item item = mock(Item.class);
|
|
||||||
List<MetadataValue> list = new ArrayList<>();
|
|
||||||
MetadataValue metadataValue = mock(MetadataValue.class);
|
|
||||||
list.add(metadataValue);
|
|
||||||
EntityType entityType = entityTypeService.findByEntityType(context, "testType");
|
EntityType entityType = entityTypeService.findByEntityType(context, "testType");
|
||||||
|
|
||||||
// The returned EntityType should equal our defined entityType case
|
// The returned EntityType should equal our defined entityType case
|
||||||
@@ -151,11 +143,7 @@ public class EntityServiceImplTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testGetAllRelationshipTypes() throws Exception {
|
public void testGetAllRelationshipTypes() throws Exception {
|
||||||
// Declare objects utilized for this test
|
// Declare objects utilized for this test
|
||||||
List<MetadataValue> list = new ArrayList<>();
|
|
||||||
MetadataValue metadataValue = mock(MetadataValue.class);
|
|
||||||
list.add(metadataValue);
|
|
||||||
Item item = mock(Item.class);
|
Item item = mock(Item.class);
|
||||||
RelationshipTypeDAO relationshipTypeDAO = mock(RelationshipTypeDAO.class);
|
|
||||||
Entity entity = mock(Entity.class);
|
Entity entity = mock(Entity.class);
|
||||||
RelationshipType relationshipType = mock(RelationshipType.class);
|
RelationshipType relationshipType = mock(RelationshipType.class);
|
||||||
relationshipType.setLeftType(leftType);
|
relationshipType.setLeftType(leftType);
|
||||||
@@ -185,7 +173,7 @@ public class EntityServiceImplTest {
|
|||||||
RelationshipType relationshipType = mock(RelationshipType.class);
|
RelationshipType relationshipType = mock(RelationshipType.class);
|
||||||
|
|
||||||
// Currently this unit test will only test one case with one relationshipType
|
// Currently this unit test will only test one case with one relationshipType
|
||||||
List<RelationshipType> relationshipTypeList = new LinkedList<>();
|
List<RelationshipType> relationshipTypeList = new ArrayList<>();
|
||||||
relationshipTypeList.add(relationshipType);
|
relationshipTypeList.add(relationshipType);
|
||||||
List<MetadataValue> metsList = new ArrayList<>();
|
List<MetadataValue> metsList = new ArrayList<>();
|
||||||
MetadataValue metadataValue = mock(MetadataValue.class);
|
MetadataValue metadataValue = mock(MetadataValue.class);
|
||||||
@@ -213,7 +201,7 @@ public class EntityServiceImplTest {
|
|||||||
RelationshipType relationshipType = mock(RelationshipType.class);
|
RelationshipType relationshipType = mock(RelationshipType.class);
|
||||||
|
|
||||||
// Currently this unit test will only test one case with one relationshipType
|
// Currently this unit test will only test one case with one relationshipType
|
||||||
List<RelationshipType> relationshipTypeList = new LinkedList<>();
|
List<RelationshipType> relationshipTypeList = new ArrayList<>();
|
||||||
relationshipTypeList.add(relationshipType);
|
relationshipTypeList.add(relationshipType);
|
||||||
List<MetadataValue> metsList = new ArrayList<>();
|
List<MetadataValue> metsList = new ArrayList<>();
|
||||||
MetadataValue metadataValue = mock(MetadataValue.class);
|
MetadataValue metadataValue = mock(MetadataValue.class);
|
||||||
@@ -236,7 +224,7 @@ public class EntityServiceImplTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testGetRelationshipTypesByTypeName() throws Exception {
|
public void testGetRelationshipTypesByTypeName() throws Exception {
|
||||||
// Declare objects utilized in unit test
|
// Declare objects utilized in unit test
|
||||||
List<RelationshipType> list = new LinkedList<>();
|
List<RelationshipType> list = new ArrayList<>();
|
||||||
RelationshipType relationshipType = mock(RelationshipType.class);
|
RelationshipType relationshipType = mock(RelationshipType.class);
|
||||||
list.add(relationshipType);
|
list.add(relationshipType);
|
||||||
|
|
||||||
|
@@ -16,7 +16,6 @@ import java.io.IOException;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.dspace.AbstractIntegrationTest;
|
import org.dspace.AbstractIntegrationTest;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
@@ -37,11 +36,6 @@ import org.junit.Test;
|
|||||||
* @author pvillega
|
* @author pvillega
|
||||||
*/
|
*/
|
||||||
public class ITMetadata extends AbstractIntegrationTest {
|
public class ITMetadata extends AbstractIntegrationTest {
|
||||||
/**
|
|
||||||
* log4j category
|
|
||||||
*/
|
|
||||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(ITMetadata.class);
|
|
||||||
|
|
||||||
|
|
||||||
protected CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
|
protected CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
|
||||||
protected CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
protected CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
||||||
|
@@ -132,8 +132,8 @@ public class ItemComparatorTest extends AbstractUnitTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCompare() throws SQLException {
|
public void testCompare() throws SQLException {
|
||||||
int result = 0;
|
int result;
|
||||||
ItemComparator ic = null;
|
ItemComparator ic;
|
||||||
|
|
||||||
//one of the tiems has no value
|
//one of the tiems has no value
|
||||||
ic = new ItemComparator("test", "one", Item.ANY, true);
|
ic = new ItemComparator("test", "one", Item.ANY, true);
|
||||||
@@ -246,7 +246,7 @@ public class ItemComparatorTest extends AbstractUnitTest {
|
|||||||
@SuppressWarnings( {"ObjectEqualsNull", "IncompatibleEquals"})
|
@SuppressWarnings( {"ObjectEqualsNull", "IncompatibleEquals"})
|
||||||
public void testEquals() {
|
public void testEquals() {
|
||||||
ItemComparator ic = new ItemComparator("test", "one", Item.ANY, true);
|
ItemComparator ic = new ItemComparator("test", "one", Item.ANY, true);
|
||||||
ItemComparator target = null;
|
ItemComparator target;
|
||||||
|
|
||||||
assertFalse("testEquals 0", ic.equals(null));
|
assertFalse("testEquals 0", ic.equals(null));
|
||||||
assertFalse("testEquals 1", ic.equals("test one"));
|
assertFalse("testEquals 1", ic.equals("test one"));
|
||||||
|
@@ -41,7 +41,6 @@ import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
|||||||
import org.dspace.authorize.service.AuthorizeService;
|
import org.dspace.authorize.service.AuthorizeService;
|
||||||
import org.dspace.content.factory.ContentServiceFactory;
|
import org.dspace.content.factory.ContentServiceFactory;
|
||||||
import org.dspace.content.service.BitstreamFormatService;
|
import org.dspace.content.service.BitstreamFormatService;
|
||||||
import org.dspace.content.service.CollectionService;
|
|
||||||
import org.dspace.content.service.MetadataFieldService;
|
import org.dspace.content.service.MetadataFieldService;
|
||||||
import org.dspace.content.service.MetadataSchemaService;
|
import org.dspace.content.service.MetadataSchemaService;
|
||||||
import org.dspace.core.Constants;
|
import org.dspace.core.Constants;
|
||||||
@@ -76,8 +75,6 @@ public class ItemTest extends AbstractDSpaceObjectTest {
|
|||||||
.getBitstreamFormatService();
|
.getBitstreamFormatService();
|
||||||
private MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
|
private MetadataFieldService metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
|
||||||
|
|
||||||
private CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
|
||||||
|
|
||||||
private Collection collection;
|
private Collection collection;
|
||||||
private Community owningCommunity;
|
private Community owningCommunity;
|
||||||
|
|
||||||
@@ -839,7 +836,7 @@ public class ItemTest extends AbstractDSpaceObjectTest {
|
|||||||
@Test(expected = AuthorizeException.class)
|
@Test(expected = AuthorizeException.class)
|
||||||
public void testCreateBundleNoAuth() throws Exception {
|
public void testCreateBundleNoAuth() throws Exception {
|
||||||
String name = "bundle";
|
String name = "bundle";
|
||||||
Bundle created = bundleService.create(context, it, name);
|
bundleService.create(context, it, name);
|
||||||
fail("Exception expected");
|
fail("Exception expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -941,7 +938,7 @@ public class ItemTest extends AbstractDSpaceObjectTest {
|
|||||||
public void testCreateSingleBitstream_InputStream_StringNoAuth() throws Exception {
|
public void testCreateSingleBitstream_InputStream_StringNoAuth() throws Exception {
|
||||||
String name = "new bundle";
|
String name = "new bundle";
|
||||||
File f = new File(testProps.get("test.bitstream").toString());
|
File f = new File(testProps.get("test.bitstream").toString());
|
||||||
Bitstream result = itemService.createSingleBitstream(context, new FileInputStream(f), it, name);
|
itemService.createSingleBitstream(context, new FileInputStream(f), it, name);
|
||||||
fail("Exception expected");
|
fail("Exception expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,7 +969,7 @@ public class ItemTest extends AbstractDSpaceObjectTest {
|
|||||||
@Test(expected = AuthorizeException.class)
|
@Test(expected = AuthorizeException.class)
|
||||||
public void testCreateSingleBitstream_InputStreamNoAuth() throws Exception {
|
public void testCreateSingleBitstream_InputStreamNoAuth() throws Exception {
|
||||||
File f = new File(testProps.get("test.bitstream").toString());
|
File f = new File(testProps.get("test.bitstream").toString());
|
||||||
Bitstream result = itemService.createSingleBitstream(context, new FileInputStream(f), it);
|
itemService.createSingleBitstream(context, new FileInputStream(f), it);
|
||||||
fail("Expected exception");
|
fail("Expected exception");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1624,7 +1621,7 @@ public class ItemTest extends AbstractDSpaceObjectTest {
|
|||||||
assertThat("testGetParentObject 1", itemService.getParentObject(context, it), notNullValue());
|
assertThat("testGetParentObject 1", itemService.getParentObject(context, it), notNullValue());
|
||||||
assertThat("testGetParentObject 2", (Collection) itemService.getParentObject(context, it), equalTo(parent));
|
assertThat("testGetParentObject 2", (Collection) itemService.getParentObject(context, it), equalTo(parent));
|
||||||
} catch (AuthorizeException ex) {
|
} catch (AuthorizeException ex) {
|
||||||
fail("Authorize exception catched");
|
throw new AssertionError("Authorize Exception occurred", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,8 +9,6 @@ package org.dspace.content;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,12 +19,6 @@ import org.junit.Test;
|
|||||||
*/
|
*/
|
||||||
public class NonUniqueMetadataExceptionTest {
|
public class NonUniqueMetadataExceptionTest {
|
||||||
|
|
||||||
/**
|
|
||||||
* log4j category
|
|
||||||
*/
|
|
||||||
private static final Logger log = LogManager
|
|
||||||
.getLogger(NonUniqueMetadataExceptionTest.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy test to avoid initialization errors
|
* Dummy test to avoid initialization errors
|
||||||
*/
|
*/
|
||||||
|
@@ -13,7 +13,6 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.dspace.authorize.service.AuthorizeService;
|
import org.dspace.authorize.service.AuthorizeService;
|
||||||
@@ -137,7 +136,7 @@ public class RelationshipServiceImplTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testFindByItemAndRelationshipType() throws Exception {
|
public void testFindByItemAndRelationshipType() throws Exception {
|
||||||
// Declare objects utilized in unit test
|
// Declare objects utilized in unit test
|
||||||
List<Relationship> relList = new LinkedList<>();
|
List<Relationship> relList = new ArrayList<>();
|
||||||
Item item = mock(Item.class);
|
Item item = mock(Item.class);
|
||||||
RelationshipType testRel = new RelationshipType();
|
RelationshipType testRel = new RelationshipType();
|
||||||
|
|
||||||
@@ -152,7 +151,7 @@ public class RelationshipServiceImplTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testFindByRelationshipType() throws Exception {
|
public void testFindByRelationshipType() throws Exception {
|
||||||
// Declare objects utilized in unit test
|
// Declare objects utilized in unit test
|
||||||
List<Relationship> relList = new LinkedList<>();
|
List<Relationship> relList = new ArrayList<>();
|
||||||
RelationshipType testRel = new RelationshipType();
|
RelationshipType testRel = new RelationshipType();
|
||||||
|
|
||||||
// The Relationship(s) reported should match our our relList
|
// The Relationship(s) reported should match our our relList
|
||||||
@@ -232,7 +231,6 @@ public class RelationshipServiceImplTest {
|
|||||||
|
|
||||||
// Declare objects utilized in unit test
|
// Declare objects utilized in unit test
|
||||||
MetadataValue metVal = mock(MetadataValue.class);
|
MetadataValue metVal = mock(MetadataValue.class);
|
||||||
List<MetadataValue> metsList = new ArrayList<>();
|
|
||||||
List<Relationship> leftTypelist = new ArrayList<>();
|
List<Relationship> leftTypelist = new ArrayList<>();
|
||||||
List<Relationship> rightTypelist = new ArrayList<>();
|
List<Relationship> rightTypelist = new ArrayList<>();
|
||||||
Item leftItem = mock(Item.class);
|
Item leftItem = mock(Item.class);
|
||||||
@@ -246,7 +244,6 @@ public class RelationshipServiceImplTest {
|
|||||||
testRel.setRightwardType("Entitylabel");
|
testRel.setRightwardType("Entitylabel");
|
||||||
testRel.setLeftMinCardinality(0);
|
testRel.setLeftMinCardinality(0);
|
||||||
testRel.setRightMinCardinality(0);
|
testRel.setRightMinCardinality(0);
|
||||||
metsList.add(metVal);
|
|
||||||
relationship = getRelationship(leftItem, rightItem, testRel, 0,0);
|
relationship = getRelationship(leftItem, rightItem, testRel, 0,0);
|
||||||
leftTypelist.add(relationship);
|
leftTypelist.add(relationship);
|
||||||
rightTypelist.add(relationship);
|
rightTypelist.add(relationship);
|
||||||
|
@@ -48,11 +48,6 @@ public class ThumbnailTest extends AbstractUnitTest {
|
|||||||
*/
|
*/
|
||||||
private Bitstream orig;
|
private Bitstream orig;
|
||||||
|
|
||||||
/**
|
|
||||||
* Thumbnail instance for the tests, original copy
|
|
||||||
*/
|
|
||||||
private Thumbnail t;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be run before every test as per @Before. It will
|
* This method will be run before every test as per @Before. It will
|
||||||
* initialize resources required for the tests.
|
* initialize resources required for the tests.
|
||||||
@@ -69,7 +64,7 @@ public class ThumbnailTest extends AbstractUnitTest {
|
|||||||
File f = new File(testProps.get("test.bitstream").toString());
|
File f = new File(testProps.get("test.bitstream").toString());
|
||||||
thumb = bitstreamService.create(context, new FileInputStream(f));
|
thumb = bitstreamService.create(context, new FileInputStream(f));
|
||||||
orig = bitstreamService.create(context, new FileInputStream(f));
|
orig = bitstreamService.create(context, new FileInputStream(f));
|
||||||
t = new Thumbnail(thumb, orig);
|
Thumbnail t = new Thumbnail(thumb, orig);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
log.error("IO Error in init", ex);
|
log.error("IO Error in init", ex);
|
||||||
fail("SQL Error in init: " + ex.getMessage());
|
fail("SQL Error in init: " + ex.getMessage());
|
||||||
@@ -91,7 +86,6 @@ public class ThumbnailTest extends AbstractUnitTest {
|
|||||||
public void destroy() {
|
public void destroy() {
|
||||||
thumb = null;
|
thumb = null;
|
||||||
orig = null;
|
orig = null;
|
||||||
t = null;
|
|
||||||
super.destroy();
|
super.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,6 +22,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dspace.AbstractIntegrationTest;
|
import org.dspace.AbstractIntegrationTest;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
@@ -1194,9 +1195,9 @@ public class ITDSpaceAIP extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
// Get the typeText & name of this object from the values
|
// Get the typeText & name of this object from the values
|
||||||
String info = infoMap.get(key);
|
String info = infoMap.get(key);
|
||||||
String[] values = info.split(valueseparator);
|
List<String> values = Splitter.on(valueseparator).splitToList(info);
|
||||||
String typeText = values[0];
|
String typeText = values.get(0);
|
||||||
String name = values[1];
|
String name = values.get(1);
|
||||||
|
|
||||||
// Also assert type and name are correct
|
// Also assert type and name are correct
|
||||||
assertEquals("assertObjectsExist object " + key + " type",
|
assertEquals("assertObjectsExist object " + key + " type",
|
||||||
|
@@ -14,6 +14,7 @@ import static org.mockito.Mockito.when;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.content.MetadataValue;
|
import org.dspace.content.MetadataValue;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
@@ -107,18 +108,15 @@ public class ConcatenateTest {
|
|||||||
metadataValueList.add(metadataValue);
|
metadataValueList.add(metadataValue);
|
||||||
String s = "dc.title";
|
String s = "dc.title";
|
||||||
list.add(s);
|
list.add(s);
|
||||||
String[] splittedString = s.split("\\.");
|
List<String> splittedString = Splitter.on(".").splitToList(s);
|
||||||
concatenate.setFields(list);
|
concatenate.setFields(list);
|
||||||
valueList.add("TestValue");
|
valueList.add("TestValue");
|
||||||
|
|
||||||
// Mock the state of objects utilized in getValues() to meet the success criteria of an invocation
|
// Mock the state of objects utilized in getValues() to meet the success criteria of an invocation
|
||||||
when(itemService.getMetadata(item, splittedString.length > 0 ? splittedString[0] :
|
when(itemService.getMetadata(item, splittedString.size() > 0 ? splittedString.get(0) : null,
|
||||||
null,
|
splittedString.size() > 1 ? splittedString.get(1) : null,
|
||||||
splittedString.length > 1 ? splittedString[1] :
|
splittedString.size() > 2 ? splittedString.get(2) : null,
|
||||||
null,
|
Item.ANY, false)).thenReturn(metadataValueList);
|
||||||
splittedString.length > 2 ? splittedString[2] :
|
|
||||||
null,
|
|
||||||
Item.ANY, false)).thenReturn(metadataValueList);
|
|
||||||
when(metadataValue.getValue()).thenReturn("TestValue");
|
when(metadataValue.getValue()).thenReturn("TestValue");
|
||||||
|
|
||||||
|
|
||||||
|
@@ -13,7 +13,6 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -150,8 +149,8 @@ public class RelatedTest {
|
|||||||
assertEquals("TestGetValues 1", virtualMetadataConfiguration.getValues(context, item),
|
assertEquals("TestGetValues 1", virtualMetadataConfiguration.getValues(context, item),
|
||||||
related.getValues(context, item));
|
related.getValues(context, item));
|
||||||
related.setPlace(2);
|
related.setPlace(2);
|
||||||
// No match should return empty LinkedList
|
// No match should return empty List
|
||||||
assertEquals("TestGetValues 2", new LinkedList<>(), related.getValues(context, item));
|
assertEquals("TestGetValues 2", new ArrayList<>(), related.getValues(context, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ import org.mockito.junit.MockitoJUnitRunner;
|
|||||||
public class UUIDValueTest {
|
public class UUIDValueTest {
|
||||||
|
|
||||||
@InjectMocks
|
@InjectMocks
|
||||||
private UUIDValue UUIDValue;
|
private UUIDValue uuidValue;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private Context context;
|
private Context context;
|
||||||
@@ -36,32 +36,32 @@ public class UUIDValueTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testGetValues() throws Exception {
|
public void testGetValues() throws Exception {
|
||||||
// Setup objects utilized in unit test
|
// Setup objects utilized in unit test
|
||||||
List<String> list = new LinkedList<>();
|
List<String> list = new ArrayList<>();
|
||||||
Item item = mock(Item.class);
|
Item item = mock(Item.class);
|
||||||
UUID uuid = UUID.randomUUID();
|
UUID uuid = UUID.randomUUID();
|
||||||
when(item.getID()).thenReturn(uuid);
|
when(item.getID()).thenReturn(uuid);
|
||||||
list.add(String.valueOf(uuid));
|
list.add(String.valueOf(uuid));
|
||||||
|
|
||||||
// The reported value(s) should match our defined list
|
// The reported value(s) should match our defined list
|
||||||
assertEquals("TestGetValues 0", list, UUIDValue.getValues(context, item));
|
assertEquals("TestGetValues 0", list, uuidValue.getValues(context, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetUseForPlace() {
|
public void testSetUseForPlace() {
|
||||||
// Setup objects utilized in unit test
|
// Setup objects utilized in unit test
|
||||||
UUIDValue.setUseForPlace(true);
|
uuidValue.setUseForPlace(true);
|
||||||
|
|
||||||
// The reported boolean should return true
|
// The reported boolean should return true
|
||||||
assertEquals("TestSetUseForPlace 0", true, UUIDValue.getUseForPlace());
|
assertEquals("TestSetUseForPlace 0", true, uuidValue.getUseForPlace());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetUseForPlace() {
|
public void testGetUseForPlace() {
|
||||||
// Setup objects utilized in unit test
|
// Setup objects utilized in unit test
|
||||||
UUIDValue.setUseForPlace(true);
|
uuidValue.setUseForPlace(true);
|
||||||
|
|
||||||
// The reported boolean should return true
|
// The reported boolean should return true
|
||||||
assertEquals("TestGetUseForPlace 0", true, UUIDValue.getUseForPlace());
|
assertEquals("TestGetUseForPlace 0", true, uuidValue.getUseForPlace());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
package org.dspace.external.provider.impl;
|
package org.dspace.external.provider.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -28,10 +28,12 @@ public class MockDataProvider implements ExternalDataProvider {
|
|||||||
* Generic getter for the sourceIdentifier
|
* Generic getter for the sourceIdentifier
|
||||||
* @return the sourceIdentifier value of this MockDataProvider
|
* @return the sourceIdentifier value of this MockDataProvider
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getSourceIdentifier() {
|
public String getSourceIdentifier() {
|
||||||
return sourceIdentifier;
|
return sourceIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Optional<ExternalDataObject> getExternalDataObject(String id) {
|
public Optional<ExternalDataObject> getExternalDataObject(String id) {
|
||||||
ExternalDataObject externalDataObject = mockLookupMap.get(id);
|
ExternalDataObject externalDataObject = mockLookupMap.get(id);
|
||||||
if (externalDataObject == null) {
|
if (externalDataObject == null) {
|
||||||
@@ -41,8 +43,9 @@ public class MockDataProvider implements ExternalDataProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<ExternalDataObject> searchExternalDataObjects(String query, int start, int limit) {
|
public List<ExternalDataObject> searchExternalDataObjects(String query, int start, int limit) {
|
||||||
List<ExternalDataObject> listToReturn = new LinkedList<>();
|
List<ExternalDataObject> listToReturn = new ArrayList<>();
|
||||||
for (Map.Entry<String, ExternalDataObject> entry : mockLookupMap.entrySet()) {
|
for (Map.Entry<String, ExternalDataObject> entry : mockLookupMap.entrySet()) {
|
||||||
if (StringUtils.containsIgnoreCase(entry.getKey(), query)) {
|
if (StringUtils.containsIgnoreCase(entry.getKey(), query)) {
|
||||||
listToReturn.add(entry.getValue());
|
listToReturn.add(entry.getValue());
|
||||||
@@ -72,7 +75,7 @@ public class MockDataProvider implements ExternalDataProvider {
|
|||||||
|
|
||||||
public void init() throws IOException {
|
public void init() throws IOException {
|
||||||
mockLookupMap = new HashMap<>();
|
mockLookupMap = new HashMap<>();
|
||||||
List<String> externalDataObjectsToMake = new LinkedList<>();
|
List<String> externalDataObjectsToMake = new ArrayList<>();
|
||||||
externalDataObjectsToMake.add("one");
|
externalDataObjectsToMake.add("one");
|
||||||
externalDataObjectsToMake.add("two");
|
externalDataObjectsToMake.add("two");
|
||||||
externalDataObjectsToMake.add("three");
|
externalDataObjectsToMake.add("three");
|
||||||
@@ -83,7 +86,7 @@ public class MockDataProvider implements ExternalDataProvider {
|
|||||||
externalDataObject.setId(id);
|
externalDataObject.setId(id);
|
||||||
externalDataObject.setValue(id);
|
externalDataObject.setValue(id);
|
||||||
externalDataObject.setDisplayValue(id);
|
externalDataObject.setDisplayValue(id);
|
||||||
List<MetadataValueDTO> list = new LinkedList<>();
|
List<MetadataValueDTO> list = new ArrayList<>();
|
||||||
list.add(new MetadataValueDTO("dc", "contributor", "author", null, "Donald, Smith"));
|
list.add(new MetadataValueDTO("dc", "contributor", "author", null, "Donald, Smith"));
|
||||||
externalDataObject.setMetadata(list);
|
externalDataObject.setMetadata(list);
|
||||||
|
|
||||||
|
@@ -128,12 +128,8 @@ public class HandleDAOImplTest extends AbstractUnitTest {
|
|||||||
owningCommunity = context.reloadEntity(owningCommunity);
|
owningCommunity = context.reloadEntity(owningCommunity);
|
||||||
ContentServiceFactory.getInstance().getCommunityService().delete(context, owningCommunity);
|
ContentServiceFactory.getInstance().getCommunityService().delete(context, owningCommunity);
|
||||||
owningCommunity = null;
|
owningCommunity = null;
|
||||||
} catch (SQLException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
throw new AssertionError("Error occurred in destroy()", e);
|
||||||
} catch (AuthorizeException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
item1 = null;
|
item1 = null;
|
||||||
item2 = null;
|
item2 = null;
|
||||||
|
@@ -11,11 +11,11 @@ package org.dspace.statistics.util;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -114,7 +114,7 @@ public class DummyHttpServletRequest implements HttpServletRequest {
|
|||||||
* @param headerValue The value of the header
|
* @param headerValue The value of the header
|
||||||
*/
|
*/
|
||||||
public void addHeader(String headerName, String headerValue) {
|
public void addHeader(String headerName, String headerValue) {
|
||||||
List<String> values = headers.computeIfAbsent(headerName, k -> new LinkedList<>());
|
List<String> values = headers.computeIfAbsent(headerName, k -> new ArrayList<>());
|
||||||
values.add(headerValue);
|
values.add(headerValue);
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@@ -271,7 +271,7 @@ public class BasicWorkflowAuthorizationIT
|
|||||||
Item item = wsi.getItem();
|
Item item = wsi.getItem();
|
||||||
Bundle bundle = bundleService.create(context, item, "ORIGINAL");
|
Bundle bundle = bundleService.create(context, item, "ORIGINAL");
|
||||||
File f = new File(AbstractDSpaceTest.testProps.get("test.bitstream").toString());
|
File f = new File(AbstractDSpaceTest.testProps.get("test.bitstream").toString());
|
||||||
Bitstream bs = bitstreamService.create(context, bundle, new FileInputStream(f));
|
bitstreamService.create(context, bundle, new FileInputStream(f));
|
||||||
bundleService.update(context, bundle);
|
bundleService.update(context, bundle);
|
||||||
itemService.update(context, item);
|
itemService.update(context, item);
|
||||||
workspaceItemService.update(context, wsi);
|
workspaceItemService.update(context, wsi);
|
||||||
@@ -323,7 +323,7 @@ public class BasicWorkflowAuthorizationIT
|
|||||||
Item item = wsi.getItem();
|
Item item = wsi.getItem();
|
||||||
Bundle bundle = bundleService.create(context, item, "ORIGINAL");
|
Bundle bundle = bundleService.create(context, item, "ORIGINAL");
|
||||||
File f = new File(AbstractDSpaceTest.testProps.get("test.bitstream").toString());
|
File f = new File(AbstractDSpaceTest.testProps.get("test.bitstream").toString());
|
||||||
Bitstream bs = bitstreamService.create(context, bundle, new FileInputStream(f));
|
bitstreamService.create(context, bundle, new FileInputStream(f));
|
||||||
bundleService.update(context, bundle);
|
bundleService.update(context, bundle);
|
||||||
itemService.update(context, item);
|
itemService.update(context, item);
|
||||||
workspaceItemService.update(context, wsi);
|
workspaceItemService.update(context, wsi);
|
||||||
@@ -365,7 +365,7 @@ public class BasicWorkflowAuthorizationIT
|
|||||||
item.setSubmitter(submitter);
|
item.setSubmitter(submitter);
|
||||||
Bundle bundle = bundleService.create(context, item, "ORIGINAL");
|
Bundle bundle = bundleService.create(context, item, "ORIGINAL");
|
||||||
File f = new File(AbstractDSpaceTest.testProps.get("test.bitstream").toString());
|
File f = new File(AbstractDSpaceTest.testProps.get("test.bitstream").toString());
|
||||||
Bitstream bs = bitstreamService.create(context, bundle, new FileInputStream(f));
|
bitstreamService.create(context, bundle, new FileInputStream(f));
|
||||||
bundleService.update(context, bundle);
|
bundleService.update(context, bundle);
|
||||||
itemService.update(context, item);
|
itemService.update(context, item);
|
||||||
workspaceItemService.update(context, wsi);
|
workspaceItemService.update(context, wsi);
|
||||||
|
Reference in New Issue
Block a user