use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.
the class ConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForPreparedWhenCoordinatorStateNotExistAndNotExpired_ShouldNotAbortTransaction.
@Test
public void scanAll_ScanAllGivenForPreparedWhenCoordinatorStateNotExistAndNotExpired_ShouldNotAbortTransaction() throws ExecutionException, CoordinatorException {
ScanAll scanAll = prepareScanAll(namespace1, TABLE_1);
selection_SelectionGivenForPreparedWhenCoordinatorStateNotExistAndNotExpired_ShouldNotAbortTransaction(scanAll);
}
use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.
the class ConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForPreparedWhenCoordinatorStateCommitted_ShouldRollforward.
@Test
public void scanAll_ScanAllGivenForPreparedWhenCoordinatorStateCommitted_ShouldRollforward() throws ExecutionException, CoordinatorException, CrudException {
ScanAll scanAll = prepareScanAll(namespace1, TABLE_1);
selection_SelectionGivenForPreparedWhenCoordinatorStateCommitted_ShouldRollforward(scanAll);
}
use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.
the class ConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForNonExisting_ShouldReturnEmpty.
@Test
public void scanAll_ScanAllGivenForNonExisting_ShouldReturnEmpty() throws CrudException, CommitException, UnknownTransactionStatusException {
// Arrange
ConsensusCommit putTransaction = manager.start();
putTransaction.put(preparePut(0, 0, namespace1, TABLE_1));
putTransaction.commit();
ConsensusCommit transaction = manager.start();
ScanAll scanAll = prepareScanAll(namespace2, TABLE_2);
// Act
List<Result> results = transaction.scan(scanAll);
// Assert
assertThat(results.size()).isEqualTo(0);
}
use of com.scalar.db.api.ScanAll 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);
}
use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.
the class TwoPhaseConsensusCommitSpecificIntegrationTestBase method scanAll_DeleteGivenBefore_ShouldScanAll.
@Test
public void scanAll_DeleteGivenBefore_ShouldScanAll() throws TransactionException {
// Arrange
TwoPhaseConsensusCommit transaction = manager.start();
transaction.put(preparePut(0, 0, TABLE_1).withIntValue(BALANCE, 1));
transaction.put(preparePut(0, 1, TABLE_1).withIntValue(BALANCE, 1));
transaction.prepare();
transaction.commit();
// Act
TwoPhaseConsensusCommit transaction1 = manager.start();
transaction1.delete(prepareDelete(0, 0, TABLE_1));
ScanAll scanAll = prepareScanAll(TABLE_1);
List<Result> results = transaction1.scan(scanAll);
assertThatCode(() -> {
transaction1.prepare();
transaction1.commit();
}).doesNotThrowAnyException();
// Assert
assertThat(results.size()).isEqualTo(1);
}
Aggregations