use of software.amazon.awssdk.services.dynamodb.model.AttributeValue in project beam by apache.
the class AttributeValueCoderTest method shouldPassForBooleanType.
@Test
public void shouldPassForBooleanType() throws IOException {
AttributeValue expected = AttributeValue.builder().bool(false).build();
AttributeValueCoder coder = AttributeValueCoder.of();
ByteArrayOutputStream output = new ByteArrayOutputStream();
coder.encode(expected, output);
ByteArrayInputStream in = new ByteArrayInputStream(output.toByteArray());
AttributeValue actual = coder.decode(in);
Assert.assertEquals(expected, actual);
}
use of software.amazon.awssdk.services.dynamodb.model.AttributeValue in project beam by apache.
the class AttributeValueCoderTest method shouldPassForByteArray.
@Test
public void shouldPassForByteArray() throws IOException {
AttributeValue expected = AttributeValue.builder().b(SdkBytes.fromByteArray("hello".getBytes(StandardCharsets.UTF_8))).build();
AttributeValueCoder coder = AttributeValueCoder.of();
ByteArrayOutputStream output = new ByteArrayOutputStream();
coder.encode(expected, output);
ByteArrayInputStream in = new ByteArrayInputStream(output.toByteArray());
AttributeValue actual = coder.decode(in);
Assert.assertEquals(expected, actual);
}
use of software.amazon.awssdk.services.dynamodb.model.AttributeValue in project beam by apache.
the class AttributeValueCoderTest method shouldPassForListType.
@Test
public void shouldPassForListType() throws IOException {
List<AttributeValue> listAttr = new ArrayList<>();
listAttr.add(AttributeValue.builder().s("innerMapValue1").build());
listAttr.add(AttributeValue.builder().n("8976234").build());
AttributeValue expected = AttributeValue.builder().l(listAttr).build();
AttributeValueCoder coder = AttributeValueCoder.of();
ByteArrayOutputStream output = new ByteArrayOutputStream();
coder.encode(expected, output);
ByteArrayInputStream in = new ByteArrayInputStream(output.toByteArray());
AttributeValue actual = coder.decode(in);
Assert.assertEquals(expected, actual);
}
use of software.amazon.awssdk.services.dynamodb.model.AttributeValue in project beam by apache.
the class AttributeValueCoderTest method shouldPassForListOfString.
@Test
public void shouldPassForListOfString() throws IOException {
AttributeValue expected = AttributeValue.builder().ss(ImmutableList.of("foo", "bar")).build();
AttributeValueCoder coder = AttributeValueCoder.of();
ByteArrayOutputStream output = new ByteArrayOutputStream();
coder.encode(expected, output);
ByteArrayInputStream in = new ByteArrayInputStream(output.toByteArray());
AttributeValue actual = coder.decode(in);
Assert.assertEquals(expected, actual);
}
use of software.amazon.awssdk.services.dynamodb.model.AttributeValue in project beam by apache.
the class AttributeValueCoderTest method shouldPassForNullType.
@Test
public void shouldPassForNullType() throws IOException {
AttributeValue expected = AttributeValue.builder().nul(true).build();
AttributeValueCoder coder = AttributeValueCoder.of();
ByteArrayOutputStream output = new ByteArrayOutputStream();
coder.encode(expected, output);
ByteArrayInputStream in = new ByteArrayInputStream(output.toByteArray());
AttributeValue actual = coder.decode(in);
Assert.assertEquals(expected, actual);
}
Aggregations