1 package de.juplo.kafka.chat.backend;
3 import org.junit.jupiter.api.DisplayName;
4 import org.junit.jupiter.api.Test;
5 import org.springframework.http.MediaType;
6 import org.testcontainers.shaded.org.awaitility.Awaitility;
8 import java.time.Duration;
10 import static org.hamcrest.Matchers.endsWith;
13 public abstract class AbstractConfigurationWithShardingIT extends AbstractConfigurationIT
16 @DisplayName("A PUT-message for a not owned shard yields 404 - NOT FOUND")
17 void testNotFoundForPutMessageToAChatRoomInNotOwnedShard()
19 String otherChatRoomId = "4e7246a6-29ae-43ea-b56f-669c3481ac19";
24 .atMost(Duration.ofSeconds(15))
29 "http://localhost:{port}/{chatRoomId}/otto/66",
32 .contentType(MediaType.TEXT_PLAIN)
33 .accept(MediaType.APPLICATION_JSON)
34 .bodyValue("The devil rules route 66")
36 .expectStatus().isNotFound()
38 .jsonPath("$.type").value(endsWith("/problem/shard-not-owned"))
39 .jsonPath("$.shard").isEqualTo(shard));