1250 /* numLinesPerFile */, 1 /* numLinesPerNewline */, "\n", 0,
-1 /* no corruption */, "", false, "");
TrailFilePositionSetter posSetter = new TrailFilePositionSetter(dir.getAbsolutePath(), TRAIL_FILENAME_PREFIX);
GGXMLTrailTransactionFinder finder = new GGXMLTrailTransactionFinder();
FilePositionResult res;
// SCN 99 is before the earliest SCN present in the trail files (100), so expect ERROR:
res = posSetter.locateFilePosition(99, finder);
Assert.assertEquals(res.getStatus(), FilePositionResult.Status.ERROR,
"expected error for exact-match SCN that's too old.");
// "Transaction-SCN" semantics: max SCN is 121 in this transaction and 119 in the
// previous one, so those are the values used for most of the "is it found?" logic.
// Since 120 falls between the two but doesn't equal either one, it's not considered
// to be found exactly (even though it's actually present), but the state is still
// valid, so processing can continue (i.e., it doesn't matter).
finder.reset();
res = posSetter.locateFilePosition(120, finder);
assertFilePositionResult(res, dir, 120, FilePositionResult.Status.EXACT_SCN_NOT_FOUND);
// For SCN <= the earliest transactions maxSCN, we throw error
finder.reset();
res = posSetter.locateFilePosition(100, finder);
Assert.assertEquals(res.getStatus(), FilePositionResult.Status.ERROR,
"expected error for exact-match SCN that's too old.");
// Related, weird corner case: USE_EARLIEST_SCN uses the min SCN in the oldest transaction,
// so even though an exact match for 100 doesn't return FOUND, this does:
finder.reset();
res = posSetter.locateFilePosition(TrailFilePositionSetter.USE_EARLIEST_SCN, finder);
assertFilePositionResult(res, dir, 100, FilePositionResult.Status.FOUND);
// For SCN <= the earliest transactions maxSCN, we throw error
finder.reset();
res = posSetter.locateFilePosition(101, finder);
Assert.assertEquals(res.getStatus(), FilePositionResult.Status.ERROR,
"expected error for exact-match SCN that's too old.");
log.info(DONE_STRING);
}