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
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,19 @@ jobs:
FLAMINGOCK_JRELEASER_GPG_SECRET_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_SECRET_KEY }}
FLAMINGOCK_JRELEASER_GPG_PASSPHRASE: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PASSPHRASE }}

mongodb-test-kit:
needs: [ build ]
uses: ./.github/workflows/module-release-graalvm.yml
with:
module: mongodb-test-kit
secrets:
FLAMINGOCK_JRELEASER_GITHUB_TOKEN: ${{ secrets.FLAMINGOCK_JRELEASER_GITHUB_TOKEN }}
FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }}
FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD }}
FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY }}
FLAMINGOCK_JRELEASER_GPG_SECRET_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_SECRET_KEY }}
FLAMINGOCK_JRELEASER_GPG_PASSPHRASE: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PASSPHRASE }}

dynamodb-util:
needs: [ build ]
uses: ./.github/workflows/module-release-graalvm.yml
Expand All @@ -448,6 +461,19 @@ jobs:
FLAMINGOCK_JRELEASER_GPG_SECRET_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_SECRET_KEY }}
FLAMINGOCK_JRELEASER_GPG_PASSPHRASE: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PASSPHRASE }}

dynamodb-test-kit:
needs: [ build ]
uses: ./.github/workflows/module-release-graalvm.yml
with:
module: dynamodb-test-kit
secrets:
FLAMINGOCK_JRELEASER_GITHUB_TOKEN: ${{ secrets.FLAMINGOCK_JRELEASER_GITHUB_TOKEN }}
FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }}
FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD }}
FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY }}
FLAMINGOCK_JRELEASER_GPG_SECRET_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_SECRET_KEY }}
FLAMINGOCK_JRELEASER_GPG_PASSPHRASE: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PASSPHRASE }}

couchbase-util:
needs: [ build ]
uses: ./.github/workflows/module-release-graalvm.yml
Expand Down Expand Up @@ -556,7 +582,9 @@ jobs:
general-util,
test-util,
mongodb-util,
mongodb-test-kit,
dynamodb-util,
dynamodb-test-kit,
couchbase-util,
sql-util,
mongock-support,
Expand Down
1 change: 1 addition & 0 deletions community/flamingock-auditstore-dynamodb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies {


testImplementation(project(":utils:test-util"))
testImplementation(project(":utils:dynamodb-test-kit"))
testImplementation(project(":core:target-systems:dynamodb-target-system"))
testImplementation(project(":core:target-systems:nontransactional-target-system"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.testcontainers.utility.DockerImageName;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;

Expand Down Expand Up @@ -59,6 +60,7 @@ public static DynamoDbClient createClient(GenericContainer<?> container) {
return DynamoDbClient.builder()
.region(Region.US_EAST_1)
.endpointOverride(URI.create(endpoint))
.httpClient(UrlConnectionHttpClient.builder().build())
.credentialsProvider(
StaticCredentialsProvider.create(
AwsBasicCredentials.create(DUMMY_ACCESS_KEY, DUMMY_SECRET_KEY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies {


testImplementation(project(":utils:test-util"))
testImplementation(project(":utils:mongodb-test-kit"))
testImplementation(project(":core:target-systems:nontransactional-target-system"))
testImplementation(project(":core:target-systems:mongodb-sync-target-system"))

Expand Down
8 changes: 6 additions & 2 deletions core/target-systems/dynamodb-target-system/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ dependencies {

compileOnly("software.amazon.awssdk:dynamodb-enhanced:2.25.29")

testImplementation("software.amazon.awssdk:url-connection-client:2.24.11")
testImplementation("com.amazonaws:DynamoDBLocal:1.25.0")
testImplementation("software.amazon.awssdk:dynamodb:2.25.29")
testImplementation("software.amazon.awssdk:dynamodb-enhanced:2.25.29")
testImplementation("software.amazon.awssdk:url-connection-client:2.25.29")

testImplementation(project(":cloud:flamingock-cloud"))
testImplementation(project(":utils:test-util"))
testImplementation(project(":utils:dynamodb-test-kit"))
testImplementation("org.testcontainers:testcontainers:2.0.2")
testImplementation("org.testcontainers:testcontainers-junit-jupiter:2.0.2")
}

description = "Amazon DynamoDB target system for NoSQL change operations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
*/
package io.flamingock.targetsystem.dynamodb;

import com.amazonaws.services.dynamodbv2.local.main.ServerRunner;
import com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer;
import io.flamingock.dynamodb.kit.DynamoDBTestContainer;
import io.flamingock.targetsystem.dynamodb.changes.common.UserEntity;
import io.flamingock.targetsystem.dynamodb.changes.happypath._001__HappyCreateTableClientsChange;
import io.flamingock.targetsystem.dynamodb.changes.happypath._002__HappyInsertClientsChange;
Expand All @@ -41,27 +40,28 @@
import org.mockito.Mockito;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient;
import software.amazon.awssdk.enhanced.dynamodb.TableSchema;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.UUID;

import static io.flamingock.internal.common.cloud.audit.AuditEntryRequest.Status.APPLIED;
import static io.flamingock.internal.common.cloud.audit.AuditEntryRequest.Status.FAILED;
import static io.flamingock.internal.common.cloud.audit.AuditEntryRequest.Status.ROLLED_BACK;

@Testcontainers
public class DynamoDBCloudTargetSystemTest {

private static final Logger logger = LoggerFactory.getLogger(DynamoDBCloudTargetSystemTest.class);

private static DynamoDBProxyServer dynamoDBLocal;
@Container
static GenericContainer<?> dynamoContainer = DynamoDBTestContainer.createContainer();

private static DynamoDbClient client;
private static DynamoDBTestHelper dynamoDBTestHelper;

Expand All @@ -83,20 +83,11 @@ public class DynamoDBCloudTargetSystemTest {

@BeforeEach
void beforeEach() throws Exception {
logger.info("Starting DynamoDB Local...");
dynamoDBLocal = ServerRunner.createServerFromCommandLineArgs(
new String[]{
"-inMemory",
"-port",
"8000"
}
);
dynamoDBLocal.start();

client = getDynamoDBClient();
logger.info("Creating DynamoDB client from TestContainer...");
client = DynamoDBTestContainer.createClient(dynamoContainer);

//We use different client, as the transactioner will close it
dynamoDBTestHelper = new DynamoDBTestHelper(getDynamoDBClient());
dynamoDBTestHelper = new DynamoDBTestHelper(DynamoDBTestContainer.createClient(dynamoContainer));

logger.info("Starting Mock Server...");
mockRunnerServer = new MockRunnerServer()
Expand Down Expand Up @@ -125,11 +116,6 @@ void afterEach() throws Exception {
//tear down
logger.info("Stopping Mock Server...");
mockRunnerServer.stop();

logger.info("Stopping DynamoDB Local...");
if(dynamoDBLocal != null) {
dynamoDBLocal.stop();
}
}

@Test
Expand Down Expand Up @@ -307,19 +293,4 @@ void shouldSendOngoingTaskInExecutionPlan() {
}
}

private static DynamoDbClient getDynamoDBClient() {
try {
return DynamoDbClient.builder()
.region(Region.EU_WEST_1)
.endpointOverride(new URI("http://localhost:8000"))
.credentialsProvider(
StaticCredentialsProvider.create(
AwsBasicCredentials.create("dummye", "dummye")
)
)
.build();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
}
2 changes: 2 additions & 0 deletions legacy/mongock-importer-dynamodb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ dependencies {


testImplementation(project(":utils:test-util"))
testImplementation(project(":utils:dynamodb-test-kit"))

testImplementation("org.testcontainers:testcontainers-junit-jupiter:2.0.2")
testImplementation("org.mockito:mockito-inline:4.11.0")
testImplementation("org.testcontainers:testcontainers-localstack:2.0.2")
testImplementation("software.amazon.awssdk:dynamodb:2.25.61")
testImplementation("software.amazon.awssdk:url-connection-client:2.24.11")

testImplementation("org.mockito:mockito-inline:4.11.0")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.testcontainers.junit.jupiter.Testcontainers;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.DescribeTableRequest;
Expand Down Expand Up @@ -72,6 +73,7 @@ void setUp() {
client = DynamoDbClient.builder()
.endpointOverride(URI.create(endpoint))
.region(Region.US_EAST_1)
.httpClient(UrlConnectionHttpClient.builder().build())
.credentialsProvider(
StaticCredentialsProvider.create(
AwsBasicCredentials.create("dummy", "dummy")
Expand Down
2 changes: 1 addition & 1 deletion legacy/mongock-importer-mongodb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
testImplementation(project(":community:flamingock-auditstore-mongodb-sync"))
testImplementation(project(":templates:flamingock-mongodb-sync-template"))
testImplementation(project(":utils:test-util"))
testImplementation(project(":utils:mongodb-util"))
testImplementation(project(":utils:mongodb-test-kit"))

testImplementation("org.testcontainers:testcontainers-mongodb:2.0.2")

Expand Down
7 changes: 7 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,18 @@ include("utils:mongodb-util")
project(":utils:mongodb-util").name = "mongodb-util"
project(":utils:mongodb-util").projectDir = file("utils/mongodb-util")

include("utils:mongodb-test-kit")
project(":utils:mongodb-test-kit").name = "mongodb-test-kit"
project(":utils:mongodb-test-kit").projectDir = file("utils/mongodb-test-kit")

include("utils:dynamodb-util")
project(":utils:dynamodb-util").name = "dynamodb-util"
project(":utils:dynamodb-util").projectDir = file("utils/dynamodb-util")

include("utils:dynamodb-test-kit")
project(":utils:dynamodb-test-kit").name = "dynamodb-test-kit"
project(":utils:dynamodb-test-kit").projectDir = file("utils/dynamodb-test-kit")

include("utils:couchbase-util")
project(":utils:couchbase-util").name = "couchbase-util"
project(":utils:couchbase-util").projectDir = file("utils/couchbase-util")
Expand Down
21 changes: 21 additions & 0 deletions utils/dynamodb-test-kit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dependencies {
implementation(project(":core:flamingock-core"))
implementation(project(":utils:dynamodb-util"))
implementation(project(":utils:general-util"))
implementation(project(":utils:test-util"))

compileOnly("software.amazon.awssdk:dynamodb-enhanced:2.25.29")

compileOnly("software.amazon.awssdk:url-connection-client:2.24.11")

compileOnly("org.testcontainers:testcontainers:2.0.2")
compileOnly("org.testcontainers:testcontainers-junit-jupiter:2.0.2")
}

description = "DynamoDB TestKit for Flamingock testing"

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.testcontainers.utility.DockerImageName;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;

Expand Down Expand Up @@ -88,6 +89,7 @@ public static DynamoDbClient createClient(GenericContainer<?> container) {
return DynamoDbClient.builder()
.region(Region.US_EAST_1)
.endpointOverride(URI.create(endpoint))
.httpClient(UrlConnectionHttpClient.builder().build())
.credentialsProvider(
StaticCredentialsProvider.create(
AwsBasicCredentials.create(DUMMY_ACCESS_KEY, DUMMY_SECRET_KEY)
Expand Down
21 changes: 4 additions & 17 deletions utils/dynamodb-util/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
plugins {
id("java")
}


val jacksonVersion = "2.16.0"
dependencies {
implementation(project(":core:flamingock-core"))
implementation(project(":utils:general-util"))

api("software.amazon.awssdk:dynamodb-enhanced:2.25.29")

// TestKit dependencies
api(project(":utils:test-util"))
api(project(":utils:general-util"))

// TestContainers for DynamoDB testing
api("org.testcontainers:testcontainers:2.0.2")
api("org.testcontainers:testcontainers-junit-jupiter:2.0.2")

compileOnly("software.amazon.awssdk:dynamodb-enhanced:2.25.29")
}

description = "Amazon DynamoDB utilities and TestContainers support for NoSQL testing and development"
description = "Amazon DynamoDB utilities and helpers for database operations"

java {
toolchain {
Expand Down
15 changes: 15 additions & 0 deletions utils/mongodb-test-kit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dependencies {
implementation(project(":core:flamingock-core"))
implementation(project(":utils:mongodb-util"))
implementation(project(":utils:test-util"))

compileOnly("org.mongodb:mongodb-driver-sync:4.0.0")
}

description = "MongoDB TestKit for Flamingock testing"

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
10 changes: 7 additions & 3 deletions utils/mongodb-util/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
dependencies {
implementation(project(":core:flamingock-core"))
implementation(project(":utils:test-util"))

// MongoDB driver for storage implementations

compileOnly("org.mongodb:mongodb-driver-sync:4.0.0")

testImplementation(project(":utils:test-util"))
}

configurations.testImplementation {
extendsFrom(configurations.compileOnly.get())
}

description = "MongoDB-specific utilities and helpers for connection management and document operations"
Expand Down
Loading