topic pattern test fixed

pull/243/head
Nikita 10 years ago
parent c8af58cbbf
commit a60b47c721

@ -52,7 +52,7 @@ public class RedissonTopicPatternTest {
public void testUnsubscribe() throws InterruptedException { public void testUnsubscribe() throws InterruptedException {
final CountDownLatch messageRecieved = new CountDownLatch(1); final CountDownLatch messageRecieved = new CountDownLatch(1);
Redisson redisson = Redisson.create(); Redisson redisson = BaseTest.createInstance();
RTopic<Message> topic1 = redisson.getTopicPattern("topic1.*"); RTopic<Message> topic1 = redisson.getTopicPattern("topic1.*");
int listenerId = topic1.addListener(new MessageListener<Message>() { int listenerId = topic1.addListener(new MessageListener<Message>() {
@Override @Override
@ -81,7 +81,7 @@ public class RedissonTopicPatternTest {
public void testLazyUnsubscribe() throws InterruptedException { public void testLazyUnsubscribe() throws InterruptedException {
final CountDownLatch messageRecieved = new CountDownLatch(1); final CountDownLatch messageRecieved = new CountDownLatch(1);
Redisson redisson1 = Redisson.create(); Redisson redisson1 = BaseTest.createInstance();
RTopic<Message> topic1 = redisson1.getTopicPattern("topic.*"); RTopic<Message> topic1 = redisson1.getTopicPattern("topic.*");
int listenerId = topic1.addListener(new MessageListener<Message>() { int listenerId = topic1.addListener(new MessageListener<Message>() {
@Override @Override
@ -94,7 +94,7 @@ public class RedissonTopicPatternTest {
topic1.removeListener(listenerId); topic1.removeListener(listenerId);
Thread.sleep(1000); Thread.sleep(1000);
Redisson redisson2 = Redisson.create(); Redisson redisson2 = BaseTest.createInstance();
RTopic<Message> topic2 = redisson2.getTopicPattern("topic.*"); RTopic<Message> topic2 = redisson2.getTopicPattern("topic.*");
topic2.addListener(new MessageListener<Message>() { topic2.addListener(new MessageListener<Message>() {
@Override @Override
@ -118,7 +118,7 @@ public class RedissonTopicPatternTest {
public void test() throws InterruptedException { public void test() throws InterruptedException {
final CountDownLatch messageRecieved = new CountDownLatch(5); final CountDownLatch messageRecieved = new CountDownLatch(5);
Redisson redisson1 = Redisson.create(); Redisson redisson1 = BaseTest.createInstance();
RTopic<Message> topic1 = redisson1.getTopicPattern("topic.*"); RTopic<Message> topic1 = redisson1.getTopicPattern("topic.*");
topic1.addListener(new MessageListener<Message>() { topic1.addListener(new MessageListener<Message>() {
@Override @Override
@ -128,7 +128,7 @@ public class RedissonTopicPatternTest {
} }
}); });
Redisson redisson2 = Redisson.create(); Redisson redisson2 = BaseTest.createInstance();
RTopic<Message> topic2 = redisson2.getTopic("topic.t1"); RTopic<Message> topic2 = redisson2.getTopic("topic.t1");
topic2.addListener(new MessageListener<Message>() { topic2.addListener(new MessageListener<Message>() {
@Override @Override
@ -156,7 +156,7 @@ public class RedissonTopicPatternTest {
@Test @Test
public void testListenerRemove() throws InterruptedException { public void testListenerRemove() throws InterruptedException {
Redisson redisson1 = Redisson.create(); Redisson redisson1 = BaseTest.createInstance();
RTopic<Message> topic1 = redisson1.getTopicPattern("topic.*"); RTopic<Message> topic1 = redisson1.getTopicPattern("topic.*");
int id = topic1.addListener(new MessageListener<Message>() { int id = topic1.addListener(new MessageListener<Message>() {
@Override @Override
@ -165,7 +165,7 @@ public class RedissonTopicPatternTest {
} }
}); });
Redisson redisson2 = Redisson.create(); Redisson redisson2 = BaseTest.createInstance();
RTopic<Message> topic2 = redisson2.getTopic("topic.t1"); RTopic<Message> topic2 = redisson2.getTopic("topic.t1");
topic1.removeListener(id); topic1.removeListener(id);
topic2.publish(new Message("123")); topic2.publish(new Message("123"));

Loading…
Cancel
Save