Skip to content

Commit

Permalink
PR Review Suggestions and Fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdulRehman Faraj committed Mar 14, 2024
1 parent d646395 commit c262958
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ public static FieldWriterFactory makeFactory(Field field, DDBRecordMetadata reco
}
}

// Partially Adapted From aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/ItemUtils.java
public static <T> T toSimpleValue(AttributeValue value)
{
if (value == null) {
Expand Down Expand Up @@ -581,6 +582,7 @@ private static <T> T handleListAttribute(EnhancedAttributeValue enhancedAttribut
return (T) result;
}

// Partially Adapted From aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/ItemUtils.java
public static AttributeValue toAttributeValue(Object value)
{
if (value == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public void doGetTable()

assertThat(res.getTableName().getSchemaName(), equalTo(DEFAULT_SCHEMA));
assertThat(res.getTableName().getTableName(), equalTo(TEST_TABLE));
assertThat(res.getSchema().getFields().size(), equalTo(11));
assertThat(res.getSchema().getFields().size(), equalTo(12));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.core.waiters.WaiterResponse;
import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
import software.amazon.awssdk.regions.Region;
Expand Down Expand Up @@ -68,6 +69,7 @@
import software.amazon.awssdk.services.dynamodb.waiters.DynamoDbWaiter;

import java.net.URI;
import java.nio.ByteBuffer;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
Expand Down Expand Up @@ -278,6 +280,11 @@ private static void setUpTable1And2(
item.put("col_10", DDBTypeUtils.toAttributeValue(ImmutableList.of(ImmutableList.of(1 * i, 2 * i, 3 * i),
ImmutableList.of(4 * i, 5 * i), ImmutableList.of(6 * i, 7 * i, 8 * i))));

byte[] sampleBytes = new byte[2];
sampleBytes[0] = (byte) (i * len);
sampleBytes[1] = (byte) (len - i);
item.put("col_11", AttributeValue.builder().bs(SdkBytes.fromByteBuffer(ByteBuffer.wrap(sampleBytes))).build());

writeRequests.add(WriteRequest.builder()
.putRequest(PutRequest.builder().item(item).build())
.build());
Expand Down

0 comments on commit c262958

Please sign in to comment.