projects
/
demos
/
kafka
/
chat
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test: HandoverIT-POC - setup without static containers
[demos/kafka/chat]
/
src
/
test
/
java
/
de
/
juplo
/
kafka
/
chat
/
backend
/
AbstractStorageStrategyIT.java
diff --git
a/src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java
b/src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java
index
9568545
..
74c7c6f
100644
(file)
--- a/
src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java
+++ b/
src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java
@@
-28,29
+28,25
@@
import static pl.rzrz.assertj.reactor.Assertions.*;
@Slf4j
public abstract class AbstractStorageStrategyIT
{
@Slf4j
public abstract class AbstractStorageStrategyIT
{
+ @Autowired
ChatHomeService chathome;
ChatHomeService chathome;
-
@Autowired
StorageStrategy storageStrategy;
@Autowired
StorageStrategy storageStrategy;
- abstract ChatHomeService getChatHome();
- protected void start()
- {
- chathome = getChatHome();
- }
+ abstract void restore();
-
protected void stop
()
+
void store
()
{
storageStrategy
.write(chathome)
{
storageStrategy
.write(chathome)
- .
subscribe
();
+ .
block
();
}
@Test
}
@Test
-
protected
void testStoreAndRecreate()
+ void testStoreAndRecreate()
{
{
-
start
();
+
restore
();
assertThat(chathome.getChatRoomInfo().toStream()).hasSize(0);
assertThat(chathome.getChatRoomInfo().toStream()).hasSize(0);
@@
-69,8
+65,8
@@
public abstract class AbstractStorageStrategyIT
.getChatRoomData(chatRoomId)
.flatMapMany(cr -> cr.getMessages())).emitsExactly(m1, m2, m3, m4);
.getChatRoomData(chatRoomId)
.flatMapMany(cr -> cr.getMessages())).emitsExactly(m1, m2, m3, m4);
- sto
p
();
-
start
();
+ sto
re
();
+
restore
();
assertThat(chathome.getChatRoomInfo().toStream()).containsExactlyElementsOf(List.of(info));
assertThat(chathome.getChatRoomInfo(chatRoomId)).emitsExactly(info);
assertThat(chathome.getChatRoomInfo().toStream()).containsExactlyElementsOf(List.of(info));
assertThat(chathome.getChatRoomInfo(chatRoomId)).emitsExactly(info);
@@
-80,9
+76,9
@@
public abstract class AbstractStorageStrategyIT
}
@Test
}
@Test
-
protected
void testStoreAndRecreateParallelChatRooms()
+ void testStoreAndRecreateParallelChatRooms()
{
{
-
start
();
+
restore
();
assertThat(chathome.getChatRoomInfo().toStream()).hasSize(0);
assertThat(chathome.getChatRoomInfo().toStream()).hasSize(0);
@@
-114,8
+110,8
@@
public abstract class AbstractStorageStrategyIT
.getChatRoomData(chatRoomBId)
.flatMapMany(cr -> cr.getMessages())).emitsExactly(mb1, mb2, mb3, mb4);
.getChatRoomData(chatRoomBId)
.flatMapMany(cr -> cr.getMessages())).emitsExactly(mb1, mb2, mb3, mb4);
- sto
p
();
-
start
();
+ sto
re
();
+
restore
();
assertThat(chathome.getChatRoomInfo().toStream()).containsExactlyInAnyOrderElementsOf(List.of(infoA, infoB));
assertThat(chathome.getChatRoomInfo(chatRoomAId)).emitsExactly(infoA);
assertThat(chathome.getChatRoomInfo().toStream()).containsExactlyInAnyOrderElementsOf(List.of(infoA, infoB));
assertThat(chathome.getChatRoomInfo(chatRoomAId)).emitsExactly(infoA);