test added

pull/5038/head
Nikita Koksharov 2 years ago
parent 522326083c
commit 258d94c46c

@ -143,7 +143,7 @@ public class RedissonReliableTopicTest extends BaseTest {
}
@Test
public void testListener() throws InterruptedException {
public void testReattach() throws InterruptedException {
RReliableTopic rt = redisson.getReliableTopic("test2");
AtomicInteger i = new AtomicInteger();
String id = rt.addListener(String.class, (ch, m) -> {
@ -151,11 +151,35 @@ public class RedissonReliableTopicTest extends BaseTest {
});
rt.publish("1");
Thread.sleep(5);
assertThat(i).hasValue(1);
rt.removeListener(id);
assertThat(rt.publish("2")).isEqualTo(0);
String id2 = rt.addListener(String.class, (ch, m) -> {
i.incrementAndGet();
});
assertThat(rt.publish("3")).isEqualTo(1);
Thread.sleep(5);
assertThat(i).hasValue(3);
}
@Test
public void testListener() throws InterruptedException {
RReliableTopic rt = redisson.getReliableTopic("test2");
AtomicInteger i = new AtomicInteger();
String id = rt.addListener(String.class, (ch, m) -> {
i.incrementAndGet();
});
rt.publish("1");
Thread.sleep(5);
assertThat(i).hasValue(1);
rt.removeListener(id);
assertThat(rt.publish("2")).isEqualTo(0);
assertThat(i).hasValue(1);
}

Loading…
Cancel
Save