mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
Fix mock class for previous change
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5723 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -905,7 +905,7 @@ public class MockDatabaseManager
|
||||
* If a database error occurs
|
||||
*/
|
||||
@Mock
|
||||
protected static List<String> getColumnNames(String table) throws SQLException
|
||||
static List<String> getColumnNames(String table) throws SQLException
|
||||
{
|
||||
List<String> results = new ArrayList<String>();
|
||||
Collection<ColumnInfo> info = getColumnInfo(table);
|
||||
@@ -929,8 +929,7 @@ public class MockDatabaseManager
|
||||
* If a database error occurs
|
||||
*/
|
||||
@Mock
|
||||
protected static List<String> getColumnNames(ResultSetMetaData meta)
|
||||
throws SQLException
|
||||
static List<String> getColumnNames(ResultSetMetaData meta) throws SQLException
|
||||
{
|
||||
List<String> results = new ArrayList<String>();
|
||||
int columns = meta.getColumnCount();
|
||||
@@ -1169,12 +1168,33 @@ public class MockDatabaseManager
|
||||
@Mock
|
||||
static TableRow process(ResultSet results, String table)
|
||||
throws SQLException
|
||||
{
|
||||
return process(results, table, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the current row in a ResultSet into a TableRow object.
|
||||
*
|
||||
* @param results
|
||||
* A ResultSet to process
|
||||
* @param table
|
||||
* The name of the table
|
||||
* @param pColumnNames
|
||||
* The name of the columns in this resultset
|
||||
* @return A TableRow object with the data from the ResultSet
|
||||
* @exception SQLException
|
||||
* If a database error occurs
|
||||
*/
|
||||
@Mock
|
||||
static TableRow process(ResultSet results, String table, List<String> pColumnNames) throws SQLException
|
||||
{
|
||||
String dbName =ConfigurationManager.getProperty("db.name");
|
||||
ResultSetMetaData meta = results.getMetaData();
|
||||
int columns = meta.getColumnCount() + 1;
|
||||
|
||||
List<String> columnNames = (table == null) ? getColumnNames(meta) : getColumnNames(table);
|
||||
// If we haven't been passed the column names try to generate them from the metadata / table
|
||||
List<String> columnNames = pColumnNames != null ? pColumnNames :
|
||||
((table == null) ? getColumnNames(meta) : getColumnNames(table));
|
||||
|
||||
TableRow row = new TableRow(canonicalize(table), columnNames);
|
||||
|
||||
|
Reference in New Issue
Block a user