Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoloboschi committed Aug 22, 2024
1 parent 23b799b commit 13b5631
Showing 1 changed file with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
import lombok.SneakyThrows;
Expand All @@ -45,6 +46,7 @@ public void testDeployAsset() throws Exception {
data:
password: "bar"
""";
String eventsTopic = "events-topic" + UUID.randomUUID();
Map<String, String> application =
Map.of(
"configuration.yaml",
Expand All @@ -66,7 +68,7 @@ public void testDeployAsset() throws Exception {
- name: "my-table"
creation-mode: create-if-not-exists
asset-type: "mock-database-resource"
events-topic: "events-topic"
events-topic: "%s"
deletion-mode: delete
config:
table: "${globals.table-name}"
Expand All @@ -82,16 +84,17 @@ public void testDeployAsset() throws Exception {
creation-mode: create-if-not-exists
- name: "output-topic"
creation-mode: create-if-not-exists
- name: "events-topic"
- name: "%s"
creation-mode: create-if-not-exists
pipeline:
- name: "identity"
id: "step1"
type: "identity"
input: "input-topic"
output: "output-topic"
""");
try (TopicConsumer consumer = createConsumer("events-topic");
"""
.formatted(eventsTopic, eventsTopic));
try (TopicConsumer consumer = createConsumer(eventsTopic);
ApplicationRuntime applicationRuntime =
deployApplicationWithSecrets(
tenant,
Expand Down Expand Up @@ -124,7 +127,8 @@ public void accept(Object o) {
assertEquals("AssetCreated", read.get("type"));
assertEquals("Asset", read.get("category"));
assertEquals(
"{\"tenant\":\"tenant\",\"applicationId\":\"app\",\"asset\":{\"id\":\"my-table\",\"name\":\"my-table\",\"config\":{\"datasource\":{\"configuration\":{\"service\":\"jdbc\",\"driverClass\":\"org.postgresql.Driver\",\"url\":\"bar\"}},\"table\":\"my-table\"},\"creation-mode\":\"create-if-not-exists\",\"deletion-mode\":\"delete\",\"asset-type\":\"mock-database-resource\",\"events-topic\":\"events-topic\"}}",
"{\"tenant\":\"tenant\",\"applicationId\":\"app\",\"asset\":{\"id\":\"my-table\",\"name\":\"my-table\",\"config\":{\"datasource\":{\"configuration\":{\"service\":\"jdbc\",\"driverClass\":\"org.postgresql.Driver\",\"url\":\"bar\"}},\"table\":\"my-table\"},\"creation-mode\":\"create-if-not-exists\",\"deletion-mode\":\"delete\",\"asset-type\":\"mock-database-resource\",\"events-topic\":\"%s\"}}"
.formatted(eventsTopic),
mapper.writeValueAsString(read.get("source")));
assertNotNull(read.get("timestamp"));
}
Expand All @@ -147,7 +151,8 @@ public void accept(Object o) {
assertEquals("AssetDeleted", read.get("type"));
assertEquals("Asset", read.get("category"));
assertEquals(
"{\"tenant\":\"tenant\",\"applicationId\":\"app\",\"asset\":{\"id\":\"my-table\",\"name\":\"my-table\",\"config\":{\"datasource\":{\"configuration\":{\"service\":\"jdbc\",\"driverClass\":\"org.postgresql.Driver\",\"url\":\"bar\"}},\"table\":\"my-table\"},\"creation-mode\":\"create-if-not-exists\",\"deletion-mode\":\"delete\",\"asset-type\":\"mock-database-resource\",\"events-topic\":\"events-topic\"}}",
"{\"tenant\":\"tenant\",\"applicationId\":\"app\",\"asset\":{\"id\":\"my-table\",\"name\":\"my-table\",\"config\":{\"datasource\":{\"configuration\":{\"service\":\"jdbc\",\"driverClass\":\"org.postgresql.Driver\",\"url\":\"bar\"}},\"table\":\"my-table\"},\"creation-mode\":\"create-if-not-exists\",\"deletion-mode\":\"delete\",\"asset-type\":\"mock-database-resource\",\"events-topic\":\"%s\"}}"
.formatted(eventsTopic),
mapper.writeValueAsString(read.get("source")));
assertNotNull(read.get("timestamp"));
}
Expand All @@ -167,6 +172,7 @@ public void testDeployAssetFailed() throws Exception {
data:
password: "bar"
""";
String eventsTopic = "events-topic" + UUID.randomUUID();
Map<String, String> application =
Map.of(
"configuration.yaml",
Expand All @@ -188,7 +194,7 @@ public void testDeployAssetFailed() throws Exception {
- name: "my-table"
creation-mode: create-if-not-exists
asset-type: "mock-database-resource"
events-topic: "events-topic"
events-topic: "%s"
deletion-mode: delete
config:
fail: true
Expand All @@ -198,16 +204,17 @@ public void testDeployAssetFailed() throws Exception {
creation-mode: create-if-not-exists
- name: "output-topic"
creation-mode: create-if-not-exists
- name: "events-topic"
- name: "%s"
creation-mode: create-if-not-exists
pipeline:
- name: "identity"
id: "step1"
type: "identity"
input: "input-topic"
output: "output-topic"
""");
try (TopicConsumer consumer = createConsumer("events-topic"); ) {
"""
.formatted(eventsTopic, eventsTopic));
try (TopicConsumer consumer = createConsumer(eventsTopic); ) {

try {
deployApplicationWithSecrets(
Expand All @@ -229,7 +236,8 @@ public void accept(Object o) {
assertEquals("AssetCreationFailed", read.get("type"));
assertEquals("Asset", read.get("category"));
assertEquals(
"{\"tenant\":\"tenant\",\"applicationId\":\"app\",\"asset\":{\"id\":\"my-table\",\"name\":\"my-table\",\"config\":{\"fail\":true,\"datasource\":{\"configuration\":{\"service\":\"jdbc\",\"driverClass\":\"org.postgresql.Driver\",\"url\":\"bar\"}}},\"creation-mode\":\"create-if-not-exists\",\"deletion-mode\":\"delete\",\"asset-type\":\"mock-database-resource\",\"events-topic\":\"events-topic\"}}",
"{\"tenant\":\"tenant\",\"applicationId\":\"app\",\"asset\":{\"id\":\"my-table\",\"name\":\"my-table\",\"config\":{\"fail\":true,\"datasource\":{\"configuration\":{\"service\":\"jdbc\",\"driverClass\":\"org.postgresql.Driver\",\"url\":\"bar\"}}},\"creation-mode\":\"create-if-not-exists\",\"deletion-mode\":\"delete\",\"asset-type\":\"mock-database-resource\",\"events-topic\":\"%s\"}}"
.formatted(eventsTopic),
mapper.writeValueAsString(read.get("source")));
assertEquals(
"Mock failure to deploy asset",
Expand Down

0 comments on commit 13b5631

Please sign in to comment.