mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 07:23:08 +00:00
Merge pull request #1758 from Georgetown-University-Libraries/ds3594m
[DS-3594] Unit Test Clean Up for PostGres
This commit is contained in:
@@ -97,7 +97,7 @@ public class ChecksumHistoryDAOImplTest
|
|||||||
qry.setInteger("id", checkId);
|
qry.setInteger("id", checkId);
|
||||||
qry.setDate("date", matchDate);
|
qry.setDate("date", matchDate);
|
||||||
qry.setString("result", ChecksumResultCode.CHECKSUM_MATCH.name());
|
qry.setString("result", ChecksumResultCode.CHECKSUM_MATCH.name());
|
||||||
qry.setString("bitstream", bs.getID().toString()); // FIXME identifier not being set???
|
qry.setParameter("bitstream", bs.getID()); // FIXME identifier not being set???
|
||||||
qry.executeUpdate();
|
qry.executeUpdate();
|
||||||
|
|
||||||
// Row with nonmatching result code
|
// Row with nonmatching result code
|
||||||
@@ -107,7 +107,7 @@ public class ChecksumHistoryDAOImplTest
|
|||||||
qry.setInteger("id", checkId);
|
qry.setInteger("id", checkId);
|
||||||
qry.setDate("date", noMatchDate);
|
qry.setDate("date", noMatchDate);
|
||||||
qry.setString("result", ChecksumResultCode.CHECKSUM_NO_MATCH.name());
|
qry.setString("result", ChecksumResultCode.CHECKSUM_NO_MATCH.name());
|
||||||
qry.setString("bitstream", bs.getID().toString());
|
qry.setParameter("bitstream", bs.getID()); // FIXME identifier not being set???
|
||||||
qry.executeUpdate();
|
qry.executeUpdate();
|
||||||
|
|
||||||
// Create one newer row
|
// Create one newer row
|
||||||
@@ -117,7 +117,7 @@ public class ChecksumHistoryDAOImplTest
|
|||||||
qry.setInteger("id", checkId);
|
qry.setInteger("id", checkId);
|
||||||
qry.setDate("date", new java.sql.Date(futureDate.getTime()));
|
qry.setDate("date", new java.sql.Date(futureDate.getTime()));
|
||||||
qry.setString("result", ChecksumResultCode.CHECKSUM_MATCH.name());
|
qry.setString("result", ChecksumResultCode.CHECKSUM_MATCH.name());
|
||||||
qry.setString("bitstream", bs.getID().toString());
|
qry.setParameter("bitstream", bs.getID()); // FIXME identifier not being set???
|
||||||
qry.executeUpdate();
|
qry.executeUpdate();
|
||||||
|
|
||||||
// Test!
|
// Test!
|
||||||
|
@@ -122,7 +122,7 @@ public class InstallItemTest extends AbstractUnitTest
|
|||||||
public void testInstallItem_validHandle() throws Exception
|
public void testInstallItem_validHandle() throws Exception
|
||||||
{
|
{
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
String handle = "123456789/567";
|
String handle = "123456789/56789";
|
||||||
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
||||||
|
|
||||||
//Test assigning a specified handle to an item
|
//Test assigning a specified handle to an item
|
||||||
@@ -149,7 +149,7 @@ public class InstallItemTest extends AbstractUnitTest
|
|||||||
authorizeService.isAdmin((Context) any); result = true;
|
authorizeService.isAdmin((Context) any); result = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
String handle = "123456789/567";
|
String handle = "123456789/56789";
|
||||||
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
||||||
WorkspaceItem is2 = workspaceItemService.create(context, collection, false);
|
WorkspaceItem is2 = workspaceItemService.create(context, collection, false);
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ public class InstallItemTest extends AbstractUnitTest
|
|||||||
public void testRestoreItem() throws Exception
|
public void testRestoreItem() throws Exception
|
||||||
{
|
{
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
String handle = "123456789/567";
|
String handle = "123456789/56789";
|
||||||
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
||||||
|
|
||||||
//get current date
|
//get current date
|
||||||
@@ -240,7 +240,7 @@ public class InstallItemTest extends AbstractUnitTest
|
|||||||
{
|
{
|
||||||
//create a dummy WorkspaceItem
|
//create a dummy WorkspaceItem
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
String handle = "123456789/567";
|
String handle = "123456789/56789";
|
||||||
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
||||||
|
|
||||||
// Set "today" as "dc.date.issued"
|
// Set "today" as "dc.date.issued"
|
||||||
@@ -274,7 +274,7 @@ public class InstallItemTest extends AbstractUnitTest
|
|||||||
{
|
{
|
||||||
//create a dummy WorkspaceItem with no dc.date.issued
|
//create a dummy WorkspaceItem with no dc.date.issued
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
String handle = "123456789/567";
|
String handle = "123456789/56789";
|
||||||
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
||||||
|
|
||||||
Item result = installItemService.installItem(context, is, handle);
|
Item result = installItemService.installItem(context, is, handle);
|
||||||
@@ -293,7 +293,7 @@ public class InstallItemTest extends AbstractUnitTest
|
|||||||
{
|
{
|
||||||
//create a dummy WorkspaceItem
|
//create a dummy WorkspaceItem
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
String handle = "123456789/567";
|
String handle = "123456789/56789";
|
||||||
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
WorkspaceItem is = workspaceItemService.create(context, collection, false);
|
||||||
|
|
||||||
// Set "today" as "dc.date.issued"
|
// Set "today" as "dc.date.issued"
|
||||||
|
@@ -107,28 +107,30 @@ public class ItemTest extends AbstractDSpaceObjectTest
|
|||||||
@Override
|
@Override
|
||||||
public void destroy()
|
public void destroy()
|
||||||
{
|
{
|
||||||
// try {
|
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
//Get new instances, god knows what happended before
|
try {
|
||||||
// it = itemService.find(context, it.getID());
|
itemService.delete(context, it);
|
||||||
// collection = collectionService.find(context, collection.getID());
|
} catch(Exception e){
|
||||||
// owningCommunity = communityService.find(context, owningCommunity.getID());
|
}
|
||||||
//
|
|
||||||
// communityService.delete(context, owningCommunity);
|
try {
|
||||||
// context.commit();
|
collectionService.delete(context, collection);
|
||||||
// context.restoreAuthSystemState();
|
} catch(Exception e){
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
communityService.delete(context, owningCommunity);
|
||||||
|
} catch(Exception e){
|
||||||
|
}
|
||||||
|
|
||||||
|
context.restoreAuthSystemState();
|
||||||
it = null;
|
it = null;
|
||||||
collection = null;
|
collection = null;
|
||||||
owningCommunity = null;
|
owningCommunity = null;
|
||||||
|
try {
|
||||||
super.destroy();
|
super.destroy();
|
||||||
// } catch (SQLException | AuthorizeException | IOException ex) {
|
} catch(Exception e){
|
||||||
// if(context.isValid())
|
}
|
||||||
// {
|
|
||||||
// context.abort();
|
|
||||||
// }
|
|
||||||
// log.error("Error in destroy", ex);
|
|
||||||
// fail("Error in destroy: " + ex.getMessage());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -206,6 +206,10 @@ public class GroupTest extends AbstractUnitTest {
|
|||||||
List<String> names = new ArrayList<>();
|
List<String> names = new ArrayList<>();
|
||||||
List<String> sortedNames = new ArrayList<>();
|
List<String> sortedNames = new ArrayList<>();
|
||||||
for (Group group : groups) {
|
for (Group group : groups) {
|
||||||
|
// Ignore any unnamed groups. This is only necessary when running unit tests via a persistent database (e.g. Postgres) as unnamed groups may be created by other tests.
|
||||||
|
if (group.getName() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
names.add(group.getName());
|
names.add(group.getName());
|
||||||
sortedNames.add(group.getName());
|
sortedNames.add(group.getName());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user