assertEquals(msg, OperationStatus.SUCCESS, status);
}
for (int j = 0; j < 2; j += 1) {
boolean withData = (j == 0);
JoinConfig config = (j == 0) ? null : joinConfigNoSort;
JoinCursor jc = priDb.join(cursors, config);
assertSame(priDb, jc.getDatabase());
for (int k = 0; k < priKeys.length; k += 1) {
String msg = prefix + " k=" + k + " pkey=" + priKeys[k];
if (withData) {
status = jc.getNext(key, data, LockMode.DEFAULT);
} else {
status = jc.getNext(key, LockMode.DEFAULT);
}
assertEquals(msg, OperationStatus.SUCCESS, status);
assertEquals(msg, priKeys[k], (int) key.getData()[0]);
if (withData) {
boolean dataFound = false;
for (int m = 0; m < dataSet.length; m += 2) {
int[] vals = dataSet[m];
int priKey = dataSet[m + 1][0];
if (priKey == priKeys[k]) {
for (int n = 0; n < 3; n += 1) {
assertEquals(msg, vals[n],
(int) data.getData()[n]);
dataFound = true;;
}
}
}
assertTrue(msg, dataFound);
}
}
String msg = prefix + " no more expected";
if (withData) {
status = jc.getNext(key, data, LockMode.DEFAULT);
} else {
status = jc.getNext(key, LockMode.DEFAULT);
}
assertEquals(msg, OperationStatus.NOTFOUND, status);
Cursor[] sorted = DbInternal.getSortedCursors(jc);
assertEquals(CURSOR_ORDER.length, sorted.length);
if (config == joinConfigNoSort) {
Database db0 = sorted[0].getDatabase();
Database db1 = sorted[1].getDatabase();
Database db2 = sorted[2].getDatabase();
assertSame(db0, secDb0);
assertSame(db1, secDb1);
assertSame(db2, secDb2);
} else if (setNum == CURSOR_ORDER_SET) {
Database db0 = sorted[CURSOR_ORDER[0]].getDatabase();
Database db1 = sorted[CURSOR_ORDER[1]].getDatabase();
Database db2 = sorted[CURSOR_ORDER[2]].getDatabase();
assertSame(db0, secDb0);
assertSame(db1, secDb1);
assertSame(db2, secDb2);
}
jc.close();
}
}
c0.close();
c1.close();