use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.
the class SelectStatementHandlerTest method handle_ScanAllOperationWithClusteringKeyAndColumnProjected_ShouldProjectOnlyGivenColumns.
@Test
public void handle_ScanAllOperationWithClusteringKeyAndColumnProjected_ShouldProjectOnlyGivenColumns() {
// Arrange
when(container.queryItems(anyString(), any(CosmosQueryRequestOptions.class), eq(Record.class))).thenReturn(responseIterable);
Record expected = new Record();
when(responseIterable.iterator()).thenReturn(Collections.singletonList(expected).iterator());
ScanAll scanAll = prepareScanAll().withProjections(Arrays.asList(ANY_NAME_2, ANY_NAME_4));
// Act Assert
assertThatCode(() -> handler.handle(scanAll)).doesNotThrowAnyException();
// Assert
String expectedQuery = "select r.id, " + "r.concatenatedPartitionKey, " + "{\"name2\":r.clusteringKey[\"name2\"]} as clusteringKey, " + "{\"name4\":r.values[\"name4\"]} as values " + "from Record r";
verify(container).queryItems(eq(expectedQuery), any(CosmosQueryRequestOptions.class), eq(Record.class));
}
use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.
the class ConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForDeletedWhenCoordinatorStateNotExistAndExpired_ShouldAbortTransaction.
@Test
public void scanAll_ScanAllGivenForDeletedWhenCoordinatorStateNotExistAndExpired_ShouldAbortTransaction() throws ExecutionException, CoordinatorException, CrudException {
ScanAll scanAll = prepareScanAll(namespace1, TABLE_1);
selection_SelectionGivenForDeletedWhenCoordinatorStateNotExistAndExpired_ShouldAbortTransaction(scanAll);
}
use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.
the class ConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForPreparedWhenCoordinatorStateNotExistAndExpired_ShouldAbortTransaction.
@Test
public void scanAll_ScanAllGivenForPreparedWhenCoordinatorStateNotExistAndExpired_ShouldAbortTransaction() throws ExecutionException, CoordinatorException, CrudException {
ScanAll scanAll = prepareScanAll(namespace1, TABLE_1);
selection_SelectionGivenForPreparedWhenCoordinatorStateNotExistAndExpired_ShouldAbortTransaction(scanAll);
}
use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.
the class ConsensusCommitSpecificIntegrationTestBase method scanAll_OverlappingPutGivenBefore_ShouldThrowIllegalArgumentException.
@Test
public void scanAll_OverlappingPutGivenBefore_ShouldThrowIllegalArgumentException() {
// Arrange
ConsensusCommit transaction = manager.start();
transaction.put(preparePut(0, 0, namespace1, TABLE_1).withIntValue(BALANCE, 1));
// Act
ScanAll scanAll = prepareScanAll(namespace1, TABLE_1);
Throwable thrown = catchThrowable(() -> transaction.scan(scanAll));
transaction.abort();
// Assert
assertThat(thrown).isInstanceOf(IllegalArgumentException.class);
}
use of com.scalar.db.api.ScanAll in project scalardb by scalar-labs.
the class ConsensusCommitSpecificIntegrationTestBase method scanAll_ScanAllGivenForDeletedWhenCoordinatorStateCommitted_ShouldRollforward.
@Test
public void scanAll_ScanAllGivenForDeletedWhenCoordinatorStateCommitted_ShouldRollforward() throws ExecutionException, CoordinatorException, CrudException {
ScanAll scanAll = prepareScanAll(namespace1, TABLE_1);
selection_SelectionGivenForDeletedWhenCoordinatorStateCommitted_ShouldRollforward(scanAll);
}
Aggregations