Table table = model.getTable(idx);
Column[] pkCols = table.getPrimaryKeyColumns();
for (Iterator it = origDbPlatform.query(model, buildQueryString(origDbPlatform, table, null, null), new Table[] { table }); it.hasNext();)
{
DynaBean obj = (DynaBean)it.next();
Collection result = testedDbPlatform.fetch(model, buildQueryString(origDbPlatform, table, pkCols, obj), new Table[] { table });
if (result.isEmpty())
{
if (_log.isDebugEnabled())
{
hasError = true;
_log.debug("Row "+obj.toString()+" is not present in second database");
}
else
{
throw new AssertionFailedError(failureMsg);
}
}
else if (result.size() > 1)
{
if (_log.isDebugEnabled())
{
hasError = true;
StringBuffer debugMsg = new StringBuffer();
debugMsg.append("Row ");
debugMsg.append(obj.toString());
debugMsg.append(" is present more than once in the second database:\n");
for (Iterator resultIt = result.iterator(); resultIt.hasNext();)
{
debugMsg.append(" ");
debugMsg.append(resultIt.next().toString());
}
_log.debug(debugMsg.toString());
}
else
{
throw new AssertionFailedError(failureMsg);
}
}
else
{
DynaBean otherObj = (DynaBean)result.iterator().next();
if (!obj.equals(otherObj))
{
if (_log.isDebugEnabled())
{
hasError = true;
_log.debug("Row "+obj.toString()+" is different in the second database: "+otherObj.toString());
}
else
{
throw new AssertionFailedError(failureMsg);
}