Search in sources :

Example 31 with TextValue

use of com.scalar.db.io.TextValue in project scalardb by scalar-labs.

the class JdbcServiceTest method whenPutOperationWithPutIfConditionExecuted_shouldReturnTrueAndCallQueryBuilder.

@Test
public void whenPutOperationWithPutIfConditionExecuted_shouldReturnTrueAndCallQueryBuilder() throws Exception {
    // Arrange
    when(queryBuilder.update(any(), any(), any())).thenReturn(updateQueryBuilder);
    when(updateQueryBuilder.set(any())).thenReturn(updateQueryBuilder);
    when(updateQueryBuilder.where(any(), any(), any())).thenReturn(updateQueryBuilder);
    when(updateQueryBuilder.build()).thenReturn(updateQuery);
    when(connection.prepareStatement(any())).thenReturn(preparedStatement);
    when(preparedStatement.executeUpdate()).thenReturn(1);
    // Act
    Put put = new Put(new Key("p1", "val1")).withValue("v1", "val2").withCondition(new PutIf(new ConditionalExpression("v1", new TextValue("val2"), ConditionalExpression.Operator.EQ))).forNamespace(NAMESPACE).forTable(TABLE);
    boolean ret = jdbcService.put(put, connection);
    // Assert
    assertThat(ret).isTrue();
    verify(operationChecker).check(any(Put.class));
    verify(queryBuilder).update(any(), any(), any());
}
Also used : PutIf(com.scalar.db.api.PutIf) TextValue(com.scalar.db.io.TextValue) ConditionalExpression(com.scalar.db.api.ConditionalExpression) Put(com.scalar.db.api.Put) Key(com.scalar.db.io.Key) Test(org.junit.jupiter.api.Test)

Example 32 with TextValue

use of com.scalar.db.io.TextValue in project scalardb by scalar-labs.

the class JdbcServiceTest method whenDeleteOperationWithDeleteIfConditionExecuted_shouldReturnTrueAndCallQueryBuilder.

@Test
public void whenDeleteOperationWithDeleteIfConditionExecuted_shouldReturnTrueAndCallQueryBuilder() throws Exception {
    // Arrange
    when(queryBuilder.deleteFrom(any(), any(), any())).thenReturn(deleteQueryBuilder);
    when(deleteQueryBuilder.where(any(), any(), any())).thenReturn(deleteQueryBuilder);
    when(deleteQueryBuilder.build()).thenReturn(deleteQuery);
    when(connection.prepareStatement(any())).thenReturn(preparedStatement);
    when(preparedStatement.executeUpdate()).thenReturn(1);
    // Act
    Delete delete = new Delete(new Key("p1", "val1")).withCondition(new DeleteIf(new ConditionalExpression("v1", new TextValue("val2"), ConditionalExpression.Operator.EQ))).forNamespace(NAMESPACE).forTable(TABLE);
    boolean ret = jdbcService.delete(delete, connection);
    // Assert
    assertThat(ret).isTrue();
    verify(operationChecker).check(any(Delete.class));
    verify(queryBuilder).deleteFrom(any(), any(), any());
}
Also used : Delete(com.scalar.db.api.Delete) TextValue(com.scalar.db.io.TextValue) ConditionalExpression(com.scalar.db.api.ConditionalExpression) Key(com.scalar.db.io.Key) DeleteIf(com.scalar.db.api.DeleteIf) Test(org.junit.jupiter.api.Test)

Example 33 with TextValue

use of com.scalar.db.io.TextValue in project scalardb by scalar-labs.

the class MergedResultTest method getValues_ResultAndPutGiven_ShouldReturnMergedValues.

@Test
public void getValues_ResultAndPutGiven_ShouldReturnMergedValues() {
    // Arrange
    Put put = new Put(new Key(ANY_NAME_1, ANY_TEXT_1), new Key(ANY_NAME_2, ANY_TEXT_2)).withValue(ANY_NAME_3, ANY_INT_3);
    MergedResult mergedResult = new MergedResult(Optional.of(result), put, TABLE_METADATA);
    // Act
    Map<String, Value<?>> values = mergedResult.getValues();
    // Assert
    assertThat(values.get(ANY_NAME_1)).isEqualTo(new TextValue(ANY_NAME_1, ANY_TEXT_1));
    assertThat(values.get(ANY_NAME_2)).isEqualTo(new TextValue(ANY_NAME_2, ANY_TEXT_2));
    assertThat(values.get(ANY_NAME_3)).isEqualTo(new IntValue(ANY_NAME_3, ANY_INT_3));
    assertThat(values.get(ANY_NAME_4)).isEqualTo(new TextValue(ANY_NAME_4, ANY_TEXT_3));
    assertThat(values.get(Attribute.ID)).isEqualTo(Attribute.toIdValue(ANY_ID_2));
    assertThat(values.get(Attribute.PREPARED_AT)).isEqualTo(Attribute.toPreparedAtValue(ANY_TIME_3));
    assertThat(values.get(Attribute.COMMITTED_AT)).isEqualTo(Attribute.toCommittedAtValue(ANY_TIME_4));
    assertThat(values.get(Attribute.STATE)).isEqualTo(Attribute.toStateValue(TransactionState.COMMITTED));
    assertThat(values.get(Attribute.VERSION)).isEqualTo(Attribute.toVersionValue(ANY_VERSION_2));
    assertThat(values.get(Attribute.BEFORE_PREFIX + ANY_NAME_3)).isEqualTo(new IntValue(Attribute.BEFORE_PREFIX + ANY_NAME_3, ANY_INT_1));
    assertThat(values.get(Attribute.BEFORE_ID)).isEqualTo(Attribute.toBeforeIdValue(ANY_ID_1));
    assertThat(values.get(Attribute.BEFORE_PREPARED_AT)).isEqualTo(Attribute.toBeforePreparedAtValue(ANY_TIME_1));
    assertThat(values.get(Attribute.BEFORE_COMMITTED_AT)).isEqualTo(Attribute.toBeforeCommittedAtValue(ANY_TIME_2));
    assertThat(values.get(Attribute.BEFORE_STATE)).isEqualTo(Attribute.toBeforeStateValue(TransactionState.COMMITTED));
    assertThat(values.get(Attribute.BEFORE_VERSION)).isEqualTo(Attribute.toBeforeVersionValue(ANY_VERSION_1));
}
Also used : TextValue(com.scalar.db.io.TextValue) IntValue(com.scalar.db.io.IntValue) TextValue(com.scalar.db.io.TextValue) Value(com.scalar.db.io.Value) IntValue(com.scalar.db.io.IntValue) Put(com.scalar.db.api.Put) Key(com.scalar.db.io.Key) Test(org.junit.jupiter.api.Test)

Example 34 with TextValue

use of com.scalar.db.io.TextValue in project scalardb by scalar-labs.

the class MergedResultTest method getValue_OnlyPutGiven_ShouldReturnMergedValue.

@Test
public void getValue_OnlyPutGiven_ShouldReturnMergedValue() {
    // Arrange
    Put put = new Put(new Key(ANY_NAME_1, ANY_TEXT_1), new Key(ANY_NAME_2, ANY_TEXT_2)).withValue(ANY_NAME_3, ANY_INT_3);
    MergedResult mergedResult = new MergedResult(Optional.empty(), put, TABLE_METADATA);
    // Act Assert
    assertThat(mergedResult.getValue(ANY_NAME_1)).isEqualTo(Optional.of(new TextValue(ANY_NAME_1, ANY_TEXT_1)));
    assertThat(mergedResult.getValue(ANY_NAME_2)).isEqualTo(Optional.of(new TextValue(ANY_NAME_2, ANY_TEXT_2)));
    assertThat(mergedResult.getValue(ANY_NAME_3)).isEqualTo(Optional.of(new IntValue(ANY_NAME_3, ANY_INT_3)));
    assertThat(mergedResult.getValue(ANY_NAME_4)).isEqualTo(Optional.of(new TextValue(ANY_NAME_4, (String) null)));
    assertThat(mergedResult.getValue(Attribute.ID)).isEqualTo(Optional.of(Attribute.toIdValue(null)));
    assertThat(mergedResult.getValue(Attribute.PREPARED_AT)).isEqualTo(Optional.of(Attribute.toPreparedAtValue(0L)));
    assertThat(mergedResult.getValue(Attribute.COMMITTED_AT)).isEqualTo(Optional.of(Attribute.toCommittedAtValue(0L)));
    assertThat(mergedResult.getValue(Attribute.STATE)).isEqualTo(Optional.of(new IntValue(Attribute.STATE, 0)));
    assertThat(mergedResult.getValue(Attribute.VERSION)).isEqualTo(Optional.of(Attribute.toVersionValue(0)));
    assertThat(mergedResult.getValue(Attribute.BEFORE_PREFIX + ANY_NAME_3)).isEqualTo(Optional.of(new IntValue(Attribute.BEFORE_PREFIX + ANY_NAME_3, 0)));
    assertThat(mergedResult.getValue(Attribute.BEFORE_ID)).isEqualTo(Optional.of(Attribute.toBeforeIdValue(null)));
    assertThat(mergedResult.getValue(Attribute.BEFORE_PREPARED_AT)).isEqualTo(Optional.of(Attribute.toBeforePreparedAtValue(0L)));
    assertThat(mergedResult.getValue(Attribute.BEFORE_COMMITTED_AT)).isEqualTo(Optional.of(Attribute.toBeforeCommittedAtValue(0L)));
    assertThat(mergedResult.getValue(Attribute.BEFORE_STATE)).isEqualTo(Optional.of(new IntValue(Attribute.BEFORE_STATE, 0)));
    assertThat(mergedResult.getValue(Attribute.BEFORE_VERSION)).isEqualTo(Optional.of(Attribute.toBeforeVersionValue(0)));
    assertThat(mergedResult.getContainedColumnNames()).isEqualTo(new HashSet<>(Arrays.asList(ANY_NAME_1, ANY_NAME_2, ANY_NAME_3, ANY_NAME_4, Attribute.ID, Attribute.PREPARED_AT, Attribute.COMMITTED_AT, Attribute.STATE, Attribute.VERSION, Attribute.BEFORE_PREFIX + ANY_NAME_3, Attribute.BEFORE_PREFIX + ANY_NAME_4, Attribute.BEFORE_ID, Attribute.BEFORE_PREPARED_AT, Attribute.BEFORE_COMMITTED_AT, Attribute.BEFORE_STATE, Attribute.BEFORE_VERSION)));
    assertThat(mergedResult.contains(ANY_NAME_1)).isTrue();
    assertThat(mergedResult.isNull(ANY_NAME_1)).isFalse();
    assertThat(mergedResult.getText(ANY_NAME_1)).isEqualTo(ANY_TEXT_1);
    assertThat(mergedResult.getAsObject(ANY_NAME_1)).isEqualTo(ANY_TEXT_1);
    assertThat(mergedResult.contains(ANY_NAME_2)).isTrue();
    assertThat(mergedResult.isNull(ANY_NAME_2)).isFalse();
    assertThat(mergedResult.getText(ANY_NAME_2)).isEqualTo(ANY_TEXT_2);
    assertThat(mergedResult.getAsObject(ANY_NAME_2)).isEqualTo(ANY_TEXT_2);
    assertThat(mergedResult.contains(ANY_NAME_3)).isTrue();
    assertThat(mergedResult.isNull(ANY_NAME_3)).isFalse();
    assertThat(mergedResult.getInt(ANY_NAME_3)).isEqualTo(ANY_INT_3);
    assertThat(mergedResult.getAsObject(ANY_NAME_3)).isEqualTo(ANY_INT_3);
    assertThat(mergedResult.contains(ANY_NAME_4)).isTrue();
    assertThat(mergedResult.isNull(ANY_NAME_4)).isTrue();
    assertThat(mergedResult.getText(ANY_NAME_4)).isNull();
    assertThat(mergedResult.getAsObject(ANY_NAME_4)).isNull();
    assertThat(mergedResult.contains(Attribute.ID)).isTrue();
    assertThat(mergedResult.isNull(Attribute.ID)).isTrue();
    assertThat(mergedResult.getText(Attribute.ID)).isNull();
    assertThat(mergedResult.getAsObject(Attribute.ID)).isNull();
    assertThat(mergedResult.contains(Attribute.PREPARED_AT)).isTrue();
    assertThat(mergedResult.isNull(Attribute.PREPARED_AT)).isTrue();
    assertThat(mergedResult.getBigInt(Attribute.PREPARED_AT)).isEqualTo(0L);
    assertThat(mergedResult.getAsObject(Attribute.PREPARED_AT)).isNull();
    assertThat(mergedResult.contains(Attribute.COMMITTED_AT)).isTrue();
    assertThat(mergedResult.isNull(Attribute.COMMITTED_AT)).isTrue();
    assertThat(mergedResult.getBigInt(Attribute.COMMITTED_AT)).isEqualTo(0L);
    assertThat(mergedResult.getAsObject(Attribute.COMMITTED_AT)).isNull();
    assertThat(mergedResult.contains(Attribute.STATE)).isTrue();
    assertThat(mergedResult.isNull(Attribute.STATE)).isTrue();
    assertThat(mergedResult.getInt(Attribute.STATE)).isEqualTo(0);
    assertThat(mergedResult.getAsObject(Attribute.STATE)).isNull();
    assertThat(mergedResult.contains(Attribute.VERSION)).isTrue();
    assertThat(mergedResult.isNull(Attribute.VERSION)).isTrue();
    assertThat(mergedResult.getInt(Attribute.VERSION)).isEqualTo(0);
    assertThat(mergedResult.getAsObject(Attribute.VERSION)).isNull();
    assertThat(mergedResult.contains(Attribute.BEFORE_PREFIX + ANY_NAME_3)).isTrue();
    assertThat(mergedResult.isNull(Attribute.BEFORE_PREFIX + ANY_NAME_3)).isTrue();
    assertThat(mergedResult.getInt(Attribute.BEFORE_PREFIX + ANY_NAME_3)).isEqualTo(0);
    assertThat(mergedResult.getAsObject(Attribute.BEFORE_PREFIX + ANY_NAME_3)).isNull();
    assertThat(mergedResult.contains(Attribute.BEFORE_PREFIX + ANY_NAME_4)).isTrue();
    assertThat(mergedResult.isNull(Attribute.BEFORE_PREFIX + ANY_NAME_4)).isTrue();
    assertThat(mergedResult.getText(Attribute.BEFORE_PREFIX + ANY_NAME_4)).isNull();
    assertThat(mergedResult.getAsObject(Attribute.BEFORE_PREFIX + ANY_NAME_4)).isNull();
    assertThat(mergedResult.contains(Attribute.BEFORE_ID)).isTrue();
    assertThat(mergedResult.isNull(Attribute.BEFORE_ID)).isTrue();
    assertThat(mergedResult.getText(Attribute.BEFORE_ID)).isNull();
    assertThat(mergedResult.getAsObject(Attribute.BEFORE_ID)).isNull();
    assertThat(mergedResult.contains(Attribute.BEFORE_PREPARED_AT)).isTrue();
    assertThat(mergedResult.isNull(Attribute.BEFORE_PREPARED_AT)).isTrue();
    assertThat(mergedResult.getBigInt(Attribute.BEFORE_PREPARED_AT)).isEqualTo(0L);
    assertThat(mergedResult.getAsObject(Attribute.BEFORE_PREPARED_AT)).isNull();
    assertThat(mergedResult.contains(Attribute.BEFORE_COMMITTED_AT)).isTrue();
    assertThat(mergedResult.isNull(Attribute.BEFORE_COMMITTED_AT)).isTrue();
    assertThat(mergedResult.getBigInt(Attribute.BEFORE_COMMITTED_AT)).isEqualTo(0L);
    assertThat(mergedResult.getAsObject(Attribute.BEFORE_COMMITTED_AT)).isNull();
    assertThat(mergedResult.contains(Attribute.BEFORE_STATE)).isTrue();
    assertThat(mergedResult.isNull(Attribute.BEFORE_STATE)).isTrue();
    assertThat(mergedResult.getInt(Attribute.BEFORE_STATE)).isEqualTo(0);
    assertThat(mergedResult.getAsObject(Attribute.BEFORE_STATE)).isNull();
    assertThat(mergedResult.contains(Attribute.BEFORE_VERSION)).isTrue();
    assertThat(mergedResult.isNull(Attribute.BEFORE_VERSION)).isTrue();
    assertThat(mergedResult.getInt(Attribute.BEFORE_VERSION)).isEqualTo(0);
    assertThat(mergedResult.getAsObject(Attribute.BEFORE_VERSION)).isNull();
}
Also used : TextValue(com.scalar.db.io.TextValue) IntValue(com.scalar.db.io.IntValue) Put(com.scalar.db.api.Put) Key(com.scalar.db.io.Key) Test(org.junit.jupiter.api.Test)

Example 35 with TextValue

use of com.scalar.db.io.TextValue in project scalardb by scalar-labs.

the class PutTest method withXXXValue_ProperValuesGiven_ShouldReturnWhatsSet.

@Test
public void withXXXValue_ProperValuesGiven_ShouldReturnWhatsSet() {
    // Arrange
    Put put = preparePut();
    // Act
    put.withBooleanValue("val1", true).withIntValue("val2", 5678).withBigIntValue("val3", 1234L).withFloatValue("val4", 4.56f).withDoubleValue("val5", 1.23).withTextValue("val6", "string_value").withBlobValue("val7", "blob_value".getBytes(StandardCharsets.UTF_8)).withBlobValue("val8", ByteBuffer.wrap("blob_value2".getBytes(StandardCharsets.UTF_8))).withBooleanValue("val9", null).withIntValue("val10", null).withBigIntValue("val11", null).withFloatValue("val12", null).withDoubleValue("val13", null).withTextValue("val14", null).withBlobValue("val15", (ByteBuffer) null).withBlobValue("val16", (byte[]) null);
    // Assert
    Map<String, Value<?>> values = put.getValues();
    assertThat(values.size()).isEqualTo(16);
    assertThat(values.get("val1")).isEqualTo(new BooleanValue("val1", true));
    assertThat(values.get("val2")).isEqualTo(new IntValue("val2", 5678));
    assertThat(values.get("val3")).isEqualTo(new BigIntValue("val3", 1234L));
    assertThat(values.get("val4")).isEqualTo(new FloatValue("val4", 4.56f));
    assertThat(values.get("val5")).isEqualTo(new DoubleValue("val5", 1.23));
    assertThat(values.get("val6")).isEqualTo(new TextValue("val6", "string_value"));
    assertThat(values.get("val7")).isEqualTo(new BlobValue("val7", "blob_value".getBytes(StandardCharsets.UTF_8)));
    assertThat(values.get("val8")).isEqualTo(new BlobValue("val8", "blob_value2".getBytes(StandardCharsets.UTF_8)));
    assertThat(values).containsKey("val9");
    assertThat(values.get("val9")).isNull();
    assertThat(values).containsKey("val10");
    assertThat(values.get("val10")).isNull();
    assertThat(values).containsKey("val11");
    assertThat(values.get("val11")).isNull();
    assertThat(values).containsKey("val12");
    assertThat(values.get("val12")).isNull();
    assertThat(values).containsKey("val13");
    assertThat(values.get("val13")).isNull();
    assertThat(values).containsKey("val14");
    assertThat(values.get("val14")).isNull();
    assertThat(values).containsKey("val15");
    assertThat(values.get("val15")).isNull();
    assertThat(values).containsKey("val16");
    assertThat(values.get("val16")).isNull();
    Map<String, Column<?>> columns = put.getColumns();
    assertThat(columns.size()).isEqualTo(16);
    assertThat(columns.get("val1")).isEqualTo(BooleanColumn.of("val1", true));
    assertThat(columns.get("val2")).isEqualTo(IntColumn.of("val2", 5678));
    assertThat(columns.get("val3")).isEqualTo(BigIntColumn.of("val3", 1234L));
    assertThat(columns.get("val4")).isEqualTo(FloatColumn.of("val4", 4.56f));
    assertThat(columns.get("val5")).isEqualTo(DoubleColumn.of("val5", 1.23));
    assertThat(columns.get("val6")).isEqualTo(TextColumn.of("val6", "string_value"));
    assertThat(columns.get("val7")).isEqualTo(BlobColumn.of("val7", "blob_value".getBytes(StandardCharsets.UTF_8)));
    assertThat(columns.get("val8")).isEqualTo(BlobColumn.of("val8", "blob_value2".getBytes(StandardCharsets.UTF_8)));
    assertThat(columns.get("val9")).isEqualTo(BooleanColumn.ofNull("val9"));
    assertThat(columns.get("val10")).isEqualTo(IntColumn.ofNull("val10"));
    assertThat(columns.get("val11")).isEqualTo(BigIntColumn.ofNull("val11"));
    assertThat(columns.get("val12")).isEqualTo(FloatColumn.ofNull("val12"));
    assertThat(columns.get("val13")).isEqualTo(DoubleColumn.ofNull("val13"));
    assertThat(columns.get("val14")).isEqualTo(TextColumn.ofNull("val14"));
    assertThat(columns.get("val15")).isEqualTo(BlobColumn.ofNull("val15"));
    assertThat(columns.get("val16")).isEqualTo(BlobColumn.ofNull("val16"));
    assertThat(put.getContainedColumnNames()).isEqualTo(ImmutableSet.of("val1", "val2", "val3", "val4", "val5", "val6", "val7", "val8", "val9", "val10", "val11", "val12", "val13", "val14", "val15", "val16"));
    assertThat(put.containsColumn("val1")).isTrue();
    assertThat(put.isNullValue("val1")).isFalse();
    assertThat(put.getBooleanValue("val1")).isTrue();
    assertThat(put.getValueAsObject("val1")).isEqualTo(true);
    assertThat(put.containsColumn("val2")).isTrue();
    assertThat(put.isNullValue("val2")).isFalse();
    assertThat(put.getIntValue("val2")).isEqualTo(5678);
    assertThat(put.getValueAsObject("val2")).isEqualTo(5678);
    assertThat(put.containsColumn("val3")).isTrue();
    assertThat(put.isNullValue("val3")).isFalse();
    assertThat(put.getBigIntValue("val3")).isEqualTo(1234L);
    assertThat(put.getValueAsObject("val3")).isEqualTo(1234L);
    assertThat(put.containsColumn("val4")).isTrue();
    assertThat(put.isNullValue("val4")).isFalse();
    assertThat(put.getFloatValue("val4")).isEqualTo(4.56f);
    assertThat(put.getValueAsObject("val4")).isEqualTo(4.56f);
    assertThat(put.containsColumn("val5")).isTrue();
    assertThat(put.isNullValue("val5")).isFalse();
    assertThat(put.getDoubleValue("val5")).isEqualTo(1.23);
    assertThat(put.getValueAsObject("val5")).isEqualTo(1.23);
    assertThat(put.containsColumn("val6")).isTrue();
    assertThat(put.isNullValue("val6")).isFalse();
    assertThat(put.getTextValue("val6")).isEqualTo("string_value");
    assertThat(put.getValueAsObject("val6")).isEqualTo("string_value");
    assertThat(put.containsColumn("val7")).isTrue();
    assertThat(put.isNullValue("val7")).isFalse();
    assertThat(put.getBlobValue("val7")).isEqualTo(ByteBuffer.wrap("blob_value".getBytes(StandardCharsets.UTF_8)));
    assertThat(put.getBlobValueAsByteBuffer("val7")).isEqualTo(ByteBuffer.wrap("blob_value".getBytes(StandardCharsets.UTF_8)));
    assertThat(put.getBlobValueAsBytes("val7")).isEqualTo("blob_value".getBytes(StandardCharsets.UTF_8));
    assertThat(put.getValueAsObject("val7")).isEqualTo(ByteBuffer.wrap("blob_value".getBytes(StandardCharsets.UTF_8)));
    assertThat(put.containsColumn("val8")).isTrue();
    assertThat(put.isNullValue("val8")).isFalse();
    assertThat(put.getBlobValue("val8")).isEqualTo(ByteBuffer.wrap("blob_value2".getBytes(StandardCharsets.UTF_8)));
    assertThat(put.getBlobValueAsByteBuffer("val8")).isEqualTo(ByteBuffer.wrap("blob_value2".getBytes(StandardCharsets.UTF_8)));
    assertThat(put.getBlobValueAsBytes("val8")).isEqualTo("blob_value2".getBytes(StandardCharsets.UTF_8));
    assertThat(put.getValueAsObject("val8")).isEqualTo(ByteBuffer.wrap("blob_value2".getBytes(StandardCharsets.UTF_8)));
    assertThat(put.containsColumn("val9")).isTrue();
    assertThat(put.isNullValue("val9")).isTrue();
    assertThat(put.getBooleanValue("val9")).isFalse();
    assertThat(put.getValueAsObject("val9")).isNull();
    assertThat(put.containsColumn("val10")).isTrue();
    assertThat(put.isNullValue("val10")).isTrue();
    assertThat(put.getIntValue("val10")).isEqualTo(0);
    assertThat(put.getValueAsObject("val10")).isNull();
    assertThat(put.containsColumn("val11")).isTrue();
    assertThat(put.isNullValue("val11")).isTrue();
    assertThat(put.getBigIntValue("val11")).isEqualTo(0L);
    assertThat(put.getValueAsObject("val11")).isNull();
    assertThat(put.containsColumn("val12")).isTrue();
    assertThat(put.isNullValue("val12")).isTrue();
    assertThat(put.getFloatValue("val12")).isEqualTo(0.0F);
    assertThat(put.getValueAsObject("val12")).isNull();
    assertThat(put.containsColumn("val13")).isTrue();
    assertThat(put.isNullValue("val13")).isTrue();
    assertThat(put.getDoubleValue("val13")).isEqualTo(0.0);
    assertThat(put.getValueAsObject("val13")).isNull();
    assertThat(put.containsColumn("val14")).isTrue();
    assertThat(put.isNullValue("val14")).isTrue();
    assertThat(put.getTextValue("val14")).isNull();
    assertThat(put.getValueAsObject("val14")).isNull();
    assertThat(put.containsColumn("val15")).isTrue();
    assertThat(put.isNullValue("val15")).isTrue();
    assertThat(put.getBlobValue("val15")).isNull();
    assertThat(put.getValueAsObject("val15")).isNull();
    assertThat(put.containsColumn("val16")).isTrue();
    assertThat(put.isNullValue("val16")).isTrue();
    assertThat(put.getBlobValue("val16")).isNull();
    assertThat(put.getValueAsObject("val16")).isNull();
}
Also used : ByteBuffer(java.nio.ByteBuffer) BlobValue(com.scalar.db.io.BlobValue) DoubleValue(com.scalar.db.io.DoubleValue) IntColumn(com.scalar.db.io.IntColumn) BooleanColumn(com.scalar.db.io.BooleanColumn) TextColumn(com.scalar.db.io.TextColumn) DoubleColumn(com.scalar.db.io.DoubleColumn) BigIntColumn(com.scalar.db.io.BigIntColumn) FloatColumn(com.scalar.db.io.FloatColumn) Column(com.scalar.db.io.Column) BlobColumn(com.scalar.db.io.BlobColumn) TextValue(com.scalar.db.io.TextValue) BooleanValue(com.scalar.db.io.BooleanValue) IntValue(com.scalar.db.io.IntValue) DoubleValue(com.scalar.db.io.DoubleValue) TextValue(com.scalar.db.io.TextValue) Value(com.scalar.db.io.Value) FloatValue(com.scalar.db.io.FloatValue) BigIntValue(com.scalar.db.io.BigIntValue) BlobValue(com.scalar.db.io.BlobValue) BooleanValue(com.scalar.db.io.BooleanValue) FloatValue(com.scalar.db.io.FloatValue) IntValue(com.scalar.db.io.IntValue) BigIntValue(com.scalar.db.io.BigIntValue) BigIntValue(com.scalar.db.io.BigIntValue) Test(org.junit.jupiter.api.Test)

Aggregations

TextValue (com.scalar.db.io.TextValue)89 Key (com.scalar.db.io.Key)60 IntValue (com.scalar.db.io.IntValue)51 Test (org.junit.jupiter.api.Test)47 Test (org.junit.Test)38 BooleanValue (com.scalar.db.io.BooleanValue)36 Put (com.scalar.db.api.Put)27 BigIntValue (com.scalar.db.io.BigIntValue)27 DoubleValue (com.scalar.db.io.DoubleValue)26 BlobValue (com.scalar.db.io.BlobValue)25 FloatValue (com.scalar.db.io.FloatValue)24 Result (com.scalar.db.api.Result)23 ConditionalExpression (com.scalar.db.api.ConditionalExpression)21 Get (com.scalar.db.api.Get)17 Value (com.scalar.db.io.Value)15 DeleteIf (com.scalar.db.api.DeleteIf)11 Delete (com.scalar.db.api.Delete)8 ExpectedResult (com.scalar.db.util.TestUtils.ExpectedResult)8 PutIf (com.scalar.db.api.PutIf)6 PreparedStatement (java.sql.PreparedStatement)6