- The test used the default storage-direcory.
- Because the app is sometimes aborted during the shutdown, this sometimes
lead to corrupted data in the default storage-directory.
- The test now uses a predefined set of data underneath the build-directory.
- Also changed the name of the according property to `storage-directory`.
ObjectMapper mapper)
{
return new LocalJsonFilesStorageStrategy(
- Paths.get(properties.getDatadir()),
+ Paths.get(properties.getStorageDirectory()),
clock,
properties.getChatroomBufferSize(),
mapper);
@Setter
public class ChatBackendProperties
{
- private String datadir = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString();
+ private String storageDirectory = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString();
private String allowedOrigins = "http://localhost:4200";
private int chatroomBufferSize = 8;
}
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
-@SpringBootTest
+@SpringBootTest(properties = "chat.backend.storage-directory=target/test-classes/data/")
class ChatBackendApplicationTests
{
@Test
--- /dev/null
+[ {
+ "id" : 1477,
+ "serial" : 0,
+ "time" : "2023-01-08T00:10:08.817267716",
+ "user" : "ute",
+ "text" : "Nachricht Nr. 1477"
+}, {
+ "id" : 1478,
+ "serial" : 1,
+ "time" : "2023-01-08T00:10:10.03333094",
+ "user" : "ute",
+ "text" : "Nachricht Nr. 1478"
+}, {
+ "id" : 1479,
+ "serial" : 2,
+ "time" : "2023-01-08T00:10:11.22582036",
+ "user" : "ute",
+ "text" : "Nachricht Nr. 1479"
+} ]
--- /dev/null
+[ {
+ "id" : "618e89ae-fdc0-4c65-8055-f49908295e8f",
+ "name" : "Peter's Chat-Room"
+} ]
\ No newline at end of file