[DS-643] New testing framework (GSoC 2010)

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5252 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Pere Villega
2010-08-10 09:10:00 +00:00
parent b779342fdd
commit 5b83e188c0
127 changed files with 36011 additions and 86 deletions

View File

@@ -584,6 +584,33 @@ public class Bitstream extends DSpaceObject
.getIntColumn("bitstream_id"));
}
/**
* Bitstreams are only logically deleted (via a flag in the database).
* This method allows us to verify is the bitstream is still valid
*
* @return true if the bitstream has been deleted
*/
boolean isDeleted() throws SQLException
{
String query = "select count(*) as mycount from Bitstream where deleted = '1' and bitstream_id = ? ";
TableRowIterator tri = DatabaseManager.query(bContext, query, bRow.getIntColumn("bitstream_id"));
long count = 0;
try
{
TableRow r = tri.next();
count = r.getLongColumn("mycount");
}
finally
{
// close the TableRowIterator to free up resources
if (tri != null)
tri.close();
}
return count == 1;
}
/**
* Retrieve the contents of the bitstream
*