Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@
<version>${aws.sdkv2.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>dynamodb</artifactId>
<version>${aws.sdkv2.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sns</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/cloud/localstack/awssdkv2/TestUtils.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cloud.localstack.awssdkv2;

import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient;
import software.amazon.awssdk.utils.*;
import software.amazon.awssdk.http.*;
import software.amazon.awssdk.services.cloudwatch.*;
Expand Down Expand Up @@ -29,6 +30,10 @@ public static KinesisAsyncClient getClientKinesisAsyncV2() {
return wrapApiClientV2(KinesisAsyncClient.builder(), Localstack.INSTANCE.getEndpointKinesis()).build();
}

public static DynamoDbAsyncClient getClientDyanamoAsyncV2() {
return wrapApiClientV2(DynamoDbAsyncClient.builder(), Localstack.INSTANCE.getEndpointDynamoDB()).build();
}

public static SqsAsyncClient getClientSQSAsyncV2() {
return wrapApiClientV2(SqsAsyncClient.builder(), Localstack.INSTANCE.getEndpointSQS()).build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
import cloud.localstack.Constants;
import cloud.localstack.LocalstackTestRunner;

import com.amazonaws.services.dynamodbv2.model.ListTablesResult;
import org.assertj.core.api.Assertions;
import software.amazon.awssdk.core.SdkSystemSetting;
import software.amazon.awssdk.services.cloudwatch.*;
import software.amazon.awssdk.services.cloudwatch.model.*;
import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient;
import software.amazon.awssdk.services.dynamodb.model.*;
import software.amazon.awssdk.services.kinesis.*;
import software.amazon.awssdk.services.kinesis.model.*;
import software.amazon.awssdk.services.s3.*;
Expand Down Expand Up @@ -78,6 +82,31 @@ public void testCreateKinesisRecordV2() throws Exception {
Assert.assertNotNull(kinesisClient.putRecord(putRecordRequest.build()));
}

@Test
public void testCreateDynamoDBTable() throws Exception {
DynamoDbAsyncClient dynamoDbAsyncClient = TestUtils.getClientDyanamoAsyncV2();
CreateTableRequest createTableRequest = CreateTableRequest.builder()
.keySchema(
KeySchemaElement.builder()
.keyType(KeyType.HASH)
.attributeName("test")
.build()
)
.attributeDefinitions(AttributeDefinition.builder()
.attributeName("test")
.attributeType(ScalarAttributeType.S)
.build())
.provisionedThroughput(
ProvisionedThroughput.builder()
.readCapacityUnits(5L)
.writeCapacityUnits(5L)
.build())
.tableName("test")
.build();
CreateTableResponse response = dynamoDbAsyncClient.createTable(createTableRequest).get();
Assert.assertNotNull(response);
}

@Test
public void testS3CreateListBuckets() throws Exception {
String bucketName = "test-b-"+UUID.randomUUID().toString();
Expand Down