Search in sources :

Example 21 with ScanAll

use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.

the class ConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForPreparedWhenCoordinatorStateAbortedAndRolledBackByAnother_ShouldRollbackProperly.

@Test
public void scanAll_ScanAllGivenForPreparedWhenCoordinatorStateAbortedAndRolledBackByAnother_ShouldRollbackProperly() throws ExecutionException, CoordinatorException, CrudException {
    ScanAll scanAll = prepareScanAll(namespace1, TABLE_1);
    selection_SelectionGivenForPreparedWhenCoordinatorStateAbortedAndRolledBackByAnother_ShouldRollbackProperly(scanAll);
}
Also used : ScanAll(com.scalar.db.api.ScanAll) Test(org.junit.jupiter.api.Test)

Example 22 with ScanAll

use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.

the class ConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForPreparedWhenCoordinatorStateCommittedAndRolledForwardByAnother_ShouldRollforwardProperly.

@Test
public void scanAll_ScanAllGivenForPreparedWhenCoordinatorStateCommittedAndRolledForwardByAnother_ShouldRollforwardProperly() throws ExecutionException, CoordinatorException, CrudException {
    ScanAll scanAll = prepareScanAll(namespace1, TABLE_1);
    selection_SelectionGivenForPreparedWhenCoordinatorStateCommittedAndRolledForwardByAnother_ShouldRollforwardProperly(scanAll);
}
Also used : ScanAll(com.scalar.db.api.ScanAll) Test(org.junit.jupiter.api.Test)

Example 23 with ScanAll

use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.

the class ConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForDeletedWhenCoordinatorStateNotExistAndNotExpired_ShouldNotAbortTransaction.

@Test
public void scanAll_ScanAllGivenForDeletedWhenCoordinatorStateNotExistAndNotExpired_ShouldNotAbortTransaction() throws ExecutionException, CoordinatorException {
    ScanAll scanAll = prepareScanAll(namespace1, TABLE_1);
    selection_SelectionGivenForDeletedWhenCoordinatorStateNotExistAndNotExpired_ShouldNotAbortTransaction(scanAll);
}
Also used : ScanAll(com.scalar.db.api.ScanAll) Test(org.junit.jupiter.api.Test)

Example 24 with ScanAll

use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.

the class TwoPhaseConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForNonExisting_ShouldReturnEmpty.

@Test
public void scanAll_ScanAllGivenForNonExisting_ShouldReturnEmpty() throws CrudException, CommitException, UnknownTransactionStatusException, PreparationException {
    // Arrange
    TwoPhaseConsensusCommit putTransaction = manager.start();
    putTransaction.put(preparePut(0, 0, TABLE_1));
    putTransaction.prepare();
    putTransaction.commit();
    TwoPhaseConsensusCommit transaction = manager.start();
    ScanAll scanAll = new ScanAll().forNamespace(namespace).forTable(TABLE_2).withConsistency(Consistency.LINEARIZABLE);
    // Act
    List<Result> results = transaction.scan(scanAll);
    // Assert
    assertThat(results.size()).isEqualTo(0);
}
Also used : ScanAll(com.scalar.db.api.ScanAll) Result(com.scalar.db.api.Result) Test(org.junit.jupiter.api.Test)

Example 25 with ScanAll

use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.

the class TwoPhaseConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForCommittedRecord_ShouldReturnRecord.

@Test
public void scanAll_ScanAllGivenForCommittedRecord_ShouldReturnRecord() throws TransactionException {
    // Arrange
    populate(TABLE_1);
    TwoPhaseConsensusCommit transaction = manager.start();
    ScanAll scanAll = prepareScanAll(TABLE_1).withLimit(1);
    // Act
    List<Result> results = transaction.scan(scanAll);
    // Assert
    assertThat(results.size()).isEqualTo(1);
    Assertions.assertThat(((TransactionResult) ((FilteredResult) results.get(0)).getOriginalResult()).getState()).isEqualTo(TransactionState.COMMITTED);
}
Also used : ScanAll(com.scalar.db.api.ScanAll) Result(com.scalar.db.api.Result) Test(org.junit.jupiter.api.Test)

Aggregations

ScanAll (com.scalar.db.api.ScanAll)52 Test (org.junit.jupiter.api.Test)43 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)10 Result (com.scalar.db.api.Result)9 CosmosQueryRequestOptions (com.azure.cosmos.models.CosmosQueryRequestOptions)8 Put (com.scalar.db.api.Put)4 HashMap (java.util.HashMap)4 Scan (com.scalar.db.api.Scan)3 TableMetadata (com.scalar.db.api.TableMetadata)3 Key (com.scalar.db.io.Key)3 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)3 Assertions.catchThrowable (org.assertj.core.api.Assertions.catchThrowable)3 ScanRequest (software.amazon.awssdk.services.dynamodb.model.ScanRequest)3 SelectQuery (com.scalar.db.storage.jdbc.query.SelectQuery)2 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 List (java.util.List)2 Nonnull (javax.annotation.Nonnull)2 ResultSet (com.datastax.driver.core.ResultSet)1 Select (com.datastax.driver.core.querybuilder.Select)1