try
{
if (repositoryName.equals("db3"))
{
DBCleanerTool repositoryDBCleaner =
DBCleanService.getRepositoryDBCleaner(conn, repository.getConfiguration());
// clean and rollback first
repositoryDBCleaner.clean();
conn.rollback();
repositoryDBCleaner.rollback();
conn.commit();
checkConent(repositoryName);
// clean
repositoryDBCleaner.clean();
repositoryDBCleaner.commit();
conn.commit();
}
else
{
try
{
DBCleanerTool repositoryDBCleaner =
DBCleanService.getRepositoryDBCleaner(conn, repository.getConfiguration());
fail("Exception should be thrown");
}
catch (DBCleanException e)
{
}
}
}
finally
{
conn.close();
}
if (repositoryName.equals("db3"))
{
checkEmptyTables(repositoryName);
}
// restore
restore(repositoryName, bch, backupManagerImpl);
checkConent(repositoryName);
// clean every workspace again via DBCleaner
repository = repositoryService.getRepository(repositoryName);
for (WorkspaceEntry wsEntry : repository.getConfiguration().getWorkspaceEntries())
{
ds =
(DataSource)new InitialContext().lookup(wsEntry.getContainer().getParameterValue(
JDBCWorkspaceDataContainer.SOURCE_NAME));
conn = ds.getConnection();
conn.setAutoCommit(false);
DBCleanerTool workspaceDBCleaner = DBCleanService.getWorkspaceDBCleaner(conn, wsEntry);
try
{
// clean and rollback first
workspaceDBCleaner.clean();
conn.rollback();
workspaceDBCleaner.rollback();
conn.commit();
checkConent(repositoryName);
// clean
workspaceDBCleaner.clean();
workspaceDBCleaner.commit();
conn.commit();
}
finally
{