Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
- Make pubsub test more stable (PUBLISH happened before the client was reconnected)
- Decrease logging
  • Loading branch information
mp911de committed Jul 1, 2015
1 parent 51c2e39 commit 6c29bb7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/test/java/com/lambdaworks/redis/PubSubCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

package com.lambdaworks.redis;

import static com.google.code.tempusfugit.temporal.Duration.*;
import static com.google.code.tempusfugit.temporal.Timeout.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.junit.Assert.assertThat;
Expand All @@ -13,6 +15,10 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

import com.google.code.tempusfugit.temporal.Condition;
import com.google.code.tempusfugit.temporal.Duration;
import com.google.code.tempusfugit.temporal.Timeout;
import com.google.code.tempusfugit.temporal.WaitFor;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.MoreExecutors;
import org.junit.After;
Expand Down Expand Up @@ -256,6 +262,13 @@ public void resubscribeChannelsOnReconnect() throws Exception {
assertThat(channels.take()).isEqualTo(channel);
assertThat((long) counts.take()).isEqualTo(1);

WaitFor.waitOrTimeout(new Condition() {
@Override
public boolean isSatisfied() {
return pubsub.isOpen();
}
}, timeout(seconds(5)));

redis.publish(channel, message);
assertThat(channels.take()).isEqualTo(channel);
assertThat(messages.take()).isEqualTo(message);
Expand All @@ -272,6 +285,13 @@ public void resubscribePatternsOnReconnect() throws Exception {
assertThat(patterns.take()).isEqualTo(pattern);
assertThat((long) counts.take()).isEqualTo(1);

WaitFor.waitOrTimeout(new Condition() {
@Override
public boolean isSatisfied() {
return pubsub.isOpen();
}
}, timeout(seconds(5)));

redis.publish(channel, message);
assertThat(channels.take()).isEqualTo(channel);
assertThat(messages.take()).isEqualTo(message);
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ log4j.rootLogger=INFO, stdout, file
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.threshold=DEBUG
log4j.appender.stdout.threshold=INFO
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%-5p] [%t] (%c{1}:%L) %m%n

Expand All @@ -16,6 +16,7 @@ log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%-5p] [%t]

log4j.logger.com.lambdaworks=INFO
log4j.logger.io.netty=INFO
log4j.logger.com.lambdaworks.redis.protocol=DEBUG
log4j.logger.com.lambdaworks.redis.cluster=INFO
log4j.logger.com.lambdaworks.redis.protocol.ConnectionWatchdog=INFO

Expand Down

0 comments on commit 6c29bb7

Please sign in to comment.