Skip to content

Commit

Permalink
Merge branch 'release/0.19.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ljupcovangelski committed Apr 27, 2021
2 parents abce5e0 + 0d07cf2 commit 67900ea
Show file tree
Hide file tree
Showing 232 changed files with 2,967 additions and 5,350 deletions.
10 changes: 0 additions & 10 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@ java_library(
],
)

java_library(
name = "jdbi",
exports = [
"@maven//:org_jdbi_jdbi3_core",
"@maven//:org_jdbi_jdbi3_postgres",
"@maven//:org_jdbi_jdbi3_spring4",
"@maven//:org_jdbi_jdbi3_sqlobject",
],
)

java_library(
name = "lombok",
exported_plugins = [
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.18.0
0.19.0
36 changes: 12 additions & 24 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ maven_install(
"io.jsonwebtoken:jjwt-jackson:0.10.5",
"io.lettuce:lettuce-core:5.3.3.RELEASE",
"io.micrometer:micrometer-registry-prometheus:1.6.5",
"io.zonky.test:embedded-database-spring-test:1.5.1",
"javax.activation:javax.activation-api:1.2.0",
"javax.validation:validation-api:2.0.1.Final",
"javax.xml.bind:jaxb-api:2.3.1",
Expand All @@ -63,40 +62,29 @@ maven_install(
"org.apache.lucene:lucene-analyzers-common:8.7.0",
"org.apache.lucene:lucene-core:8.7.0",
"org.aspectj:aspectjweaver:1.8.10",
"org.bouncycastle:bcpkix-jdk15on:1.63",
"org.flywaydb:flyway-core:5.2.4",
"org.hamcrest:hamcrest-library:2.1",
"org.hamcrest:hamcrest:2.1",
"org.junit.jupiter:junit-jupiter-engine:5.7.0",
"org.junit.jupiter:junit-jupiter:5.7.0",
"org.junit.platform:junit-platform-console:1.7.0",
"org.junit.platform:junit-platform-engine:1.7.0",
"org.jdbi:jdbi3-core:3.14.4",
"org.jdbi:jdbi3-postgres:3.14.4",
"org.jdbi:jdbi3-sqlobject:3.14.4",
"org.jdbi:jdbi3-spring4:3.14.4",
"org.mockito:mockito-core:2.28.2",
"org.postgresql:postgresql:42.2.5",
"org.projectlombok:lombok:1.18.10",
"org.springframework.boot:spring-boot-loader:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-starter-actuator:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-starter-data-jdbc:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-starter-jetty:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-starter-test:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-starter-mail:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-starter-web:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-starter-websocket:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-starter-security:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-loader:2.4.5",
"org.springframework.boot:spring-boot-starter-actuator:2.4.5",
"org.springframework.boot:spring-boot-starter-jetty:2.4.5",
"org.springframework.boot:spring-boot-starter-test:2.4.5",
"org.springframework.boot:spring-boot-starter-web:2.4.5",
"org.springframework.boot:spring-boot-starter-websocket:2.4.5",
"org.springframework.boot:spring-boot-starter-security:2.4.5",
"org.springframework.retry:spring-retry:1.2.5.RELEASE",
"org.springframework:spring-aop:4.1.4.RELEASE",
"org.springframework:spring-jdbc:4.1.4.RELEASE",
"org.springframework:spring-context-support:5.2.0.RELEASE",
"org.springframework:spring-context:5.2.0.RELEASE",
"org.springframework:spring-messaging:5.1.2.RELEASE",
"org.springframework:spring-websocket:5.1.2.RELEASE",
"org.springframework:spring-context-support:5.3.6",
"org.springframework:spring-context:5.3.6",
"org.springframework:spring-messaging:5.3.6",
"org.springframework:spring-websocket:5.3.6",
"org.springframework.data:spring-data-redis:2.3.3.RELEASE",
"org.springframework.security:spring-security-core:5.1.2.RELEASE",
"org.springframework.security:spring-security-crypto:5.3.0.RELEASE",
"org.springframework.security:spring-security-core:5.4.6",
"org.rocksdb:rocksdbjni:5.18.3",
],
excluded_artifacts = [
Expand Down
6 changes: 3 additions & 3 deletions backend/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ java_library(
java_library(
name = "read-receipt",
exports = [
"//backend/avro/communication:read-receipt",
"//backend/avro:read-receipt",
"//lib/java/kafka/schema:application-communication-read-receipts",
],
)

java_library(
name = "tag",
exports = [
"//backend/avro/communication:tag",
"//backend/avro:tag",
"//lib/java/kafka/schema:application-communication-tags",
],
)

java_library(
name = "webhook",
exports = [
"//backend/avro/communication:webhook",
"//backend/avro:webhook",
"//lib/java/kafka/schema:application-communication-webhooks",
],
)
Expand Down
3 changes: 1 addition & 2 deletions backend/api/admin/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ kafka.brokers=${KAFKA_BROKERS}
kafka.schema-registry-url=${KAFKA_SCHEMA_REGISTRY_URL}
kafka.cleanup=${KAFKA_CLEANUP:false}
kafka.commit-interval-ms=${KAFKA_COMMIT_INTERVAL_MS}
auth.jwt-secret=${jwtSecret}
kubernetes.namespace=${KUBERNETES_NAMESPACE}
kubernetes.namespace=${KUBERNETES_NAMESPACE}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void canListChannels() throws Exception {
.build())
));

retryOnException(() -> webTestHelper.post("/channels.list", "{}", "user-id")
retryOnException(() -> webTestHelper.post("/channels.list", "{}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", greaterThanOrEqualTo(1)))
.andExpect(jsonPath("$.data[*].id").value(not(contains(disconnectedChannel)))),
Expand All @@ -118,20 +118,20 @@ void canListChannels() throws Exception {
void canUpdateChannel() throws Exception {
final String expectedChannelName = "channel name";

retryOnException(() -> webTestHelper.post("/channels.info", String.format("{\"channel_id\":\"%s\"}", connectedChannel.getId()), "user-id")
retryOnException(() -> webTestHelper.post("/channels.info", String.format("{\"channel_id\":\"%s\"}", connectedChannel.getId()))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id", equalTo(connectedChannel.getId())))
.andExpect(jsonPath("$.metadata.name", not(equalTo(expectedChannelName)))),
"/channels.info did not return the right channel");

webTestHelper.post("/channels.update", String.format("{\"channel_id\":\"%s\",\"name\":\"%s\"}",
connectedChannel.getId(), expectedChannelName), "user-id")
connectedChannel.getId(), expectedChannelName))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id", equalTo(connectedChannel.getId())))
.andExpect(jsonPath("$.metadata.name", not(equalTo(connectedChannel.getId()))))
.andExpect(jsonPath("$.source", equalTo(connectedChannel.getSource())));

retryOnException(() -> webTestHelper.post("/channels.info", String.format("{\"channel_id\":\"%s\"}", connectedChannel.getId()), "user-id")
retryOnException(() -> webTestHelper.post("/channels.info", String.format("{\"channel_id\":\"%s\"}", connectedChannel.getId()))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id", equalTo(connectedChannel.getId())))
.andExpect(jsonPath("$.metadata.name", equalTo(expectedChannelName))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void canManageTags() throws Exception {
final String color = "tag-red";
final String payload = "{\"name\":\"" + name + "\",\"color\": \"" + color + "\"}";

final String createTagResponse = webTestHelper.post("/tags.create", payload, "user-id")
final String createTagResponse = webTestHelper.post("/tags.create", payload)
.andExpect(status().isCreated())
.andReturn()
.getResponse()
Expand All @@ -90,30 +90,30 @@ void canManageTags() throws Exception {
//TODO wait for tag to be there
TimeUnit.SECONDS.sleep(5);

webTestHelper.post("/tags.list", "{}", "user-id")
webTestHelper.post("/tags.list", "{}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", is(1)))
.andExpect(jsonPath("$.data[0].id").value(is(tagId)))
.andExpect(jsonPath("$.data[0].name").value(is(name)))
.andExpect(jsonPath("$.data[0].color").value(is("RED")));

webTestHelper.post("/tags.update",
"{\"id\": \"" + tagId + "\", \"name\": \"new-name\", \"color\": \"" + color + "\"}", "user-id")
"{\"id\": \"" + tagId + "\", \"name\": \"new-name\", \"color\": \"" + color + "\"}")
.andExpect(status().isNoContent());

webTestHelper.post("/tags.list", "{}", "user-id")
webTestHelper.post("/tags.list", "{}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", is(1)))
.andExpect(jsonPath("$.data[0].id").value(is(tagId)))
.andExpect(jsonPath("$.data[0].name").value(is("new-name")))
.andExpect(jsonPath("$.data[0].color").value(is("RED")));

webTestHelper.post("/tags.delete", "{\"id\": \"" + tagId + "\"}", "user-id").andExpect(status().isNoContent());
webTestHelper.post("/tags.delete", "{\"id\": \"" + tagId + "\"}").andExpect(status().isNoContent());

//TODO wait for tag deletion
TimeUnit.SECONDS.sleep(5);

webTestHelper.post("/tags.list", "{}", "user-id")
webTestHelper.post("/tags.list", "{}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", is(0)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void canManageTemplates() throws Exception {
final String content = "{\"blueprint\":\"text\",\"payload\":\"[[salutation]]!\"}";
final String payload = "{\"name\":\"" + name + "\",\"source\": \"" + source + "\",\"content\":" + content + "}";

final String createTemplateResponse = webTestHelper.post("/templates.create", payload, "user-id")
final String createTemplateResponse = webTestHelper.post("/templates.create", payload)
.andExpect(status().isCreated())
.andReturn()
.getResponse()
Expand All @@ -92,25 +92,25 @@ void canManageTemplates() throws Exception {

assertThat(templateId, is(not(nullValue())));

retryOnException(() -> webTestHelper.post("/templates.info", "{\"id\":\"" + templateId + "\"}", "user-id")
retryOnException(() -> webTestHelper.post("/templates.info", "{\"id\":\"" + templateId + "\"}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(is(templateId)))
.andExpect(jsonPath("$.content.blueprint").value(is("text")))
.andExpect(jsonPath("$.source").value(is(source)))
.andExpect(jsonPath("$.name").value(is(name))), "could not find template");

webTestHelper.post("/templates.update", "{\"id\":\"" + templateId + "\", \"name\": \"new-template-name\", \"source\": \"google\", \"content\": " + content + "}", "user-id")
webTestHelper.post("/templates.update", "{\"id\":\"" + templateId + "\", \"name\": \"new-template-name\", \"source\": \"google\", \"content\": " + content + "}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(is(templateId)))
.andExpect(jsonPath("$.content.blueprint").value(is("text")))
.andExpect(jsonPath("$.source").value(is("google")))
.andExpect(jsonPath("$.name").value(is("new-template-name")));

retryOnException(() -> webTestHelper.post("/templates.info", "{\"id\":\"" + templateId + "\"}", "user-id")
retryOnException(() -> webTestHelper.post("/templates.info", "{\"id\":\"" + templateId + "\"}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.name").value(is("new-template-name"))), "could not update template");

webTestHelper.post("/templates.delete", "{\"id\": \"" + templateId + "\"}", "user-id").andExpect(status().isNoContent());
webTestHelper.post("/templates.delete", "{\"id\": \"" + templateId + "\"}").andExpect(status().isNoContent());
}

@Test
Expand All @@ -122,7 +122,7 @@ void canListTemplates() throws Exception {
final String name = "awesome-template-" + i;
final String payload = "{\"name\":\"" + name + "\",\"source\": \"" + googleSource + "\",\"content\":" + googleContent + "}";

webTestHelper.post("/templates.create", payload, "user-id").andExpect(status().isCreated());
webTestHelper.post("/templates.create", payload).andExpect(status().isCreated());
}

final String twilioSource = "twilio.sms";
Expand All @@ -131,36 +131,36 @@ void canListTemplates() throws Exception {
final String name = "awesome-template-" + i;
final String payload = "{\"name\":\"" + name + "\",\"source\": \"" + twilioSource + "\",\"content\":" + twilioContent + "}";

webTestHelper.post("/templates.create", payload, "user-id").andExpect(status().isCreated());
webTestHelper.post("/templates.create", payload).andExpect(status().isCreated());
}

retryOnException(() -> webTestHelper.post("/templates.list",
"{\"source\": \"google\"}", "user-id")
"{\"source\": \"google\"}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", is(10))), "could not list google templates");

retryOnException(() -> webTestHelper.post("/templates.list",
"{\"source\": \"google\", \"name\": \"awesome-template-\"}", "user-id")
"{\"source\": \"google\", \"name\": \"awesome-template-\"}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", is(10))), "could not list google templates by name");

retryOnException(() -> webTestHelper.post("/templates.list",
"{\"source\": \"google\", \"name\": \"awesome-template-1\"}", "user-id")
"{\"source\": \"google\", \"name\": \"awesome-template-1\"}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", is(1))), "could not list google templates by name");

retryOnException(() -> webTestHelper.post("/templates.list",
"{\"source\": \"twilio.sms\"}", "user-id")
"{\"source\": \"twilio.sms\"}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", is(5))), "could not list twilio templates");

retryOnException(() -> webTestHelper.post("/templates.list",
"{\"source\": \"twilio.sms\", \"name\": \"awesome-template-\"}", "user-id")
"{\"source\": \"twilio.sms\", \"name\": \"awesome-template-\"}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", is(5))), "could not list twilio templates by name");

retryOnException(() -> webTestHelper.post("/templates.list",
"{\"source\": \"twilio.sms\", \"name\": \"awesome-template-1\"}", "user-id")
"{\"source\": \"twilio.sms\", \"name\": \"awesome-template-1\"}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", is(1))), "could not list twilio templates by name");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,26 @@ void beforeEach() throws Exception {

@Test
public void canManageWebhook() throws Exception {
webTestHelper.post("/webhooks.info", "{}", "user-id").andExpect(status().isNotFound());
webTestHelper.post("/webhooks.info", "{}").andExpect(status().isNotFound());

final String url = "http://example.org/webhook";
final String xAuthHeader = "auth token";

final String payload = "{\"url\":\"" + url + "\",\"headers\":{\"X-Auth\":\"" + xAuthHeader + "\"}}";

webTestHelper.post("/webhooks.subscribe", payload, "user-id")
webTestHelper.post("/webhooks.subscribe", payload)
.andExpect(status().isOk())
.andExpect(jsonPath("$.url", equalTo(url)))
.andExpect(jsonPath("$.headers['X-Auth']", equalTo(xAuthHeader)));

retryOnException(() -> webTestHelper.post("/webhooks.info", "{}", "user-id")
retryOnException(() -> webTestHelper.post("/webhooks.info", "{}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.url", equalTo(url)))
.andExpect(jsonPath("$.headers['X-Auth']", equalTo(xAuthHeader))),
"Webhook was not stored"
);

webTestHelper.post("/webhooks.unsubscribe", payload, "user-id")
webTestHelper.post("/webhooks.unsubscribe", payload)
.andExpect(status().isOk())
.andExpect(jsonPath("$.url", equalTo(url)))
.andExpect(jsonPath("$.headers['X-Auth']", equalTo(xAuthHeader)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void canReturnConfig() throws Exception {
withSuccess("{\"components\": [\"api-communication\"]}", MediaType.APPLICATION_JSON)
);

retryOnException(() -> webTestHelper.post("/client.config", "{}", "user-id")
retryOnException(() -> webTestHelper.post("/client.config", "{}")
.andExpect(status().isOk())
.andExpect(jsonPath("$.components.*", hasSize(1)))
.andExpect(jsonPath("$.components", hasKey("api-communication")))
Expand Down
1 change: 0 additions & 1 deletion backend/api/admin/src/test/resources/test.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
kafka.cleanup=true
kafka.commit-interval-ms=100
auth.jwt-secret=42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242
kubernetes.namespace=default
51 changes: 0 additions & 51 deletions backend/api/auth/BUILD

This file was deleted.

Loading

0 comments on commit 67900ea

Please sign in to comment.