Пример #1
0
 private void advanceCursorUpTo(
     DBCursor<UpdateMsg> cursor, CSN[] csns, int startIndex, int endIndex) throws Exception {
   for (int i = startIndex; i <= endIndex; i++) {
     assertThat(cursor.next()).as("next() value when i=" + i).isTrue();
     assertThat(cursor.getRecord().getCSN()).isEqualTo(csns[i]);
   }
 }
Пример #2
0
 private void assertNotFound(
     JEReplicaDB replicaDB, final CSN startCSN, final PositionStrategy positionStrategy)
     throws ChangelogException {
   DBCursor<UpdateMsg> cursor =
       replicaDB.generateCursorFrom(startCSN, GREATER_THAN_OR_EQUAL_TO_KEY, positionStrategy);
   try {
     final SoftAssertions softly = new SoftAssertions();
     softly.assertThat(cursor.next()).isFalse();
     softly.assertThat(cursor.getRecord()).isNull();
     softly.assertAll();
   } finally {
     close(cursor);
   }
 }
Пример #3
0
  private void assertFoundInOrder(
      JEReplicaDB replicaDB, final PositionStrategy positionStrategy, CSN... csns)
      throws ChangelogException {
    DBCursor<UpdateMsg> cursor =
        replicaDB.generateCursorFrom(csns[0], GREATER_THAN_OR_EQUAL_TO_KEY, positionStrategy);
    try {
      assertNull(cursor.getRecord(), "Cursor should point to a null record initially");

      for (int i = positionStrategy == ON_MATCHING_KEY ? 0 : 1; i < csns.length; i++) {
        final String msg = "i=" + i + ", csns[i]=" + csns[i].toStringUI();
        final SoftAssertions softly = new SoftAssertions();
        softly.assertThat(cursor.next()).as(msg).isTrue();
        softly.assertThat(cursor.getRecord().getCSN()).as(msg).isEqualTo(csns[i]);
        softly.assertAll();
      }
      final SoftAssertions softly = new SoftAssertions();
      softly.assertThat(cursor.next()).isFalse();
      softly.assertThat(cursor.getRecord()).isNull();
      softly.assertAll();
    } finally {
      close(cursor);
    }
  }
Пример #4
0
 private void assertThatCursorCanBeFullyReadFromStart(
     DBCursor<UpdateMsg> cursor, CSN[] csns, int startIndex, int endIndex) throws Exception {
   assertThat(cursor.getRecord()).isNull();
   assertThatCursorCanBeFullyRead(cursor, csns, startIndex, endIndex);
 }
Пример #5
0
 private void assertThatCursorIsExhausted(DBCursor<UpdateMsg> cursor) throws Exception {
   final SoftAssertions softly = new SoftAssertions();
   softly.assertThat(cursor.next()).isFalse();
   softly.assertThat(cursor.getRecord()).isNull();
   softly.assertAll();
 }