use of com.scalar.db.api.TwoPhaseCommitTransaction in project scalardb by scalar-labs.
the class TwoPhaseConsensusCommitSpecificIntegrationTestBase method scanAll_DeleteCalledBefore_ShouldReturnEmpty.
@Test
public void scanAll_DeleteCalledBefore_ShouldReturnEmpty() throws TransactionException {
// Arrange
TwoPhaseCommitTransaction transaction = manager.start();
transaction.put(preparePut(0, 0, TABLE_1).withIntValue(BALANCE, 1));
transaction.prepare();
transaction.commit();
// Act
TwoPhaseCommitTransaction transaction1 = manager.start();
ScanAll scanAll = prepareScanAll(TABLE_1);
List<Result> resultBefore = transaction1.scan(scanAll);
transaction1.delete(prepareDelete(0, 0, TABLE_1));
List<Result> resultAfter = transaction1.scan(scanAll);
assertThatCode(() -> {
transaction1.prepare();
transaction1.commit();
}).doesNotThrowAnyException();
// Assert
assertThat(resultBefore.size()).isEqualTo(1);
assertThat(resultAfter.size()).isEqualTo(0);
}
Aggregations