use of com.scalar.db.io.DataType in project scalardb by scalar-labs.
the class DistributedStorageSingleClusteringKeyScanIntegrationTestBase method scan_WithoutClusteringKeyRange_ShouldReturnProperResult.
@Test
public void scan_WithoutClusteringKeyRange_ShouldReturnProperResult() throws ExecutionException, IOException {
for (DataType clusteringKeyType : clusteringKeyTypes) {
for (Order clusteringOrder : Order.values()) {
truncateTable(clusteringKeyType, clusteringOrder);
List<Value<?>> clusteringKeyValues = prepareRecords(clusteringKeyType, clusteringOrder);
for (OrderingType orderingType : OrderingType.values()) {
for (boolean withLimit : Arrays.asList(false, true)) {
scan_WithoutClusteringKeyRange_ShouldReturnProperResult(clusteringKeyValues, clusteringKeyType, clusteringOrder, orderingType, withLimit);
}
}
}
}
}
use of com.scalar.db.io.DataType in project scalardb by scalar-labs.
the class DistributedStorageSingleClusteringKeyScanIntegrationTestBase method scan_WithClusteringKeyRangeWithSameValues_ShouldReturnProperResult.
@Test
public void scan_WithClusteringKeyRangeWithSameValues_ShouldReturnProperResult() throws ExecutionException, IOException {
for (DataType clusteringKeyType : clusteringKeyTypes) {
for (Order clusteringOrder : Order.values()) {
truncateTable(clusteringKeyType, clusteringOrder);
List<Value<?>> clusteringKeyValues = prepareRecords(clusteringKeyType, clusteringOrder);
for (boolean startInclusive : Arrays.asList(true, false)) {
for (boolean endInclusive : Arrays.asList(true, false)) {
for (OrderingType orderingType : OrderingType.values()) {
for (boolean withLimit : Arrays.asList(false, true)) {
scan_WithClusteringKeyRangeWithSameValues_ShouldReturnProperResult(clusteringKeyValues, clusteringKeyType, clusteringOrder, startInclusive, endInclusive, orderingType, withLimit);
}
}
}
}
}
}
}
use of com.scalar.db.io.DataType in project scalardb by scalar-labs.
the class DistributedStorageSingleClusteringKeyScanIntegrationTestBase method scan_WithClusteringKeyRangeWithMinAndMaxValue_ShouldReturnProperResult.
@Test
public void scan_WithClusteringKeyRangeWithMinAndMaxValue_ShouldReturnProperResult() throws ExecutionException, IOException {
for (DataType clusteringKeyType : clusteringKeyTypes) {
for (Order clusteringOrder : Order.values()) {
truncateTable(clusteringKeyType, clusteringOrder);
List<Value<?>> clusteringKeyValues = prepareRecords(clusteringKeyType, clusteringOrder);
for (boolean startInclusive : Arrays.asList(true, false)) {
for (boolean endInclusive : Arrays.asList(true, false)) {
for (OrderingType orderingType : OrderingType.values()) {
for (boolean withLimit : Arrays.asList(false, true)) {
scan_WithClusteringKeyRangeWithMinAndMaxValue_ShouldReturnProperResult(clusteringKeyValues, clusteringKeyType, clusteringOrder, startInclusive, endInclusive, orderingType, withLimit);
}
}
}
}
}
}
}
use of com.scalar.db.io.DataType in project scalardb by scalar-labs.
the class DistributedStorageSinglePartitionKeyIntegrationTestBase method createTables.
private void createTables() throws ExecutionException {
Map<String, String> options = getCreateOptions();
admin.createNamespace(namespace, true, options);
for (DataType partitionKeyType : partitionKeyTypes) {
createTable(partitionKeyType, options);
}
}
use of com.scalar.db.io.DataType in project scalardb by scalar-labs.
the class DistributedStorageSinglePartitionKeyIntegrationTestBase method getAndScanAndDelete_ShouldBehaveCorrectly.
@Test
public void getAndScanAndDelete_ShouldBehaveCorrectly() throws ExecutionException, IOException {
for (DataType partitionKeyType : partitionKeyTypes) {
truncateTable(partitionKeyType);
List<Value<?>> partitionKeyValues = prepareRecords(partitionKeyType);
String description = description(partitionKeyType);
// for get
for (Value<?> partitionKeyValue : partitionKeyValues) {
// Arrange
Get get = prepareGet(partitionKeyType, partitionKeyValue);
// Act
Optional<Result> result = storage.get(get);
// Assert
assertThat(result).describedAs(description).isPresent();
assertThat(result.get().getValue(PARTITION_KEY).isPresent()).describedAs(description).isTrue();
assertThat(result.get().getValue(PARTITION_KEY).get()).describedAs(description).isEqualTo(partitionKeyValue);
assertThat(result.get().getValue(COL_NAME).isPresent()).describedAs(description).isTrue();
assertThat(result.get().getValue(COL_NAME).get().getAsInt()).describedAs(description).isEqualTo(1);
}
// for scan
for (Value<?> partitionKeyValue : partitionKeyValues) {
// Arrange
Scan scan = prepareScan(partitionKeyType, partitionKeyValue);
// Act Assert
try (Scanner scanner = storage.scan(scan)) {
Optional<Result> result = scanner.one();
assertThat(result).describedAs(description).isPresent();
assertThat(result.get().getValue(PARTITION_KEY).isPresent()).describedAs(description).isTrue();
assertThat(result.get().getValue(PARTITION_KEY).get()).describedAs(description).isEqualTo(partitionKeyValue);
assertThat(result.get().getValue(COL_NAME).isPresent()).describedAs(description).isTrue();
assertThat(result.get().getValue(COL_NAME).get().getAsInt()).describedAs(description).isEqualTo(1);
assertThat(scanner.one()).isNotPresent();
}
}
// for delete
for (Value<?> partitionKeyValue : partitionKeyValues) {
// Arrange
Delete delete = prepareDelete(partitionKeyType, partitionKeyValue);
// Act
storage.delete(delete);
// Assert
Optional<Result> result = storage.get(prepareGet(partitionKeyType, partitionKeyValue));
assertThat(result).describedAs(description).isNotPresent();
}
}
}
Aggregations