优化
This commit is contained in:
+12
@@ -3,8 +3,10 @@ package com.baiyue.eventbridge.service;
|
||||
import com.baiyue.eventbridge.mapper.BridgeInboxMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class EventReplayServiceTest {
|
||||
@@ -28,6 +30,16 @@ class EventReplayServiceTest {
|
||||
.isInstanceOf(IllegalStateException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void replayOnlyRequeuesDeadStateAndDoesNotRewriteFrozenEvent() throws Exception {
|
||||
String sql = String.join(" ", BridgeInboxMapper.class
|
||||
.getMethod("replayDead", String.class, String.class)
|
||||
.getAnnotation(Update.class).value()).replaceAll("\\s+", " ");
|
||||
|
||||
assertThat(sql).contains("status='RETRY'", "retry_count=0", "status='DEAD'")
|
||||
.doesNotContain("payload_json=", "payload_hash=");
|
||||
}
|
||||
|
||||
private EventReplayService service() {
|
||||
EventReplayService service = new EventReplayService();
|
||||
ReflectionTestUtils.setField(service, "inboxMapper", mapper);
|
||||
|
||||
Reference in New Issue
Block a user