diff --git a/.travis.yml b/.travis.yml index 54dff226..5c63c1d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: java -sudo: false # faster builds +dist: trusty jdk: - oraclejdk8 @@ -10,7 +10,6 @@ install: before_script: - pip install --user codecov - - curl http://www.jpm4j.org/install/script | sh script: - mvn -U -B -V test --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true diff --git a/src/main/java/redis/embedded/AbstractRedisInstance.java b/src/main/java/redis/embedded/AbstractRedisInstance.java index abeae789..7dd75428 100644 --- a/src/main/java/redis/embedded/AbstractRedisInstance.java +++ b/src/main/java/redis/embedded/AbstractRedisInstance.java @@ -1,5 +1,6 @@ package redis.embedded; +import org.apache.commons.io.IOUtils; import redis.embedded.exceptions.EmbeddedRedisException; import java.io.*; @@ -9,8 +10,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import org.apache.commons.io.IOUtils; - abstract class AbstractRedisInstance implements Redis { protected List args = Collections.emptyList(); private volatile boolean active = false; @@ -23,12 +22,10 @@ protected AbstractRedisInstance(int port) { this.port = port; } - @Override public boolean isActive() { return active; } - @Override public synchronized void start() throws EmbeddedRedisException { if (active) { throw new EmbeddedRedisException("This redis server instance is already running..."); @@ -54,12 +51,17 @@ private void logErrors() { private void awaitRedisServerReady() throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(redisProcess.getInputStream())); try { + StringBuffer outputStringBuffer = new StringBuffer(); String outputLine; do { outputLine = reader.readLine(); if (outputLine == null) { //Something goes wrong. Stream is ended before server was activated. - throw new RuntimeException("Can't start redis server. Check logs for details."); + throw new RuntimeException("Can't start redis server. Check logs for details. Redis process log: "+outputStringBuffer.toString()); + } + else{ + outputStringBuffer.append("\n"); + outputStringBuffer.append(outputLine); } } while (!outputLine.matches(redisReadyPattern())); } finally { @@ -76,7 +78,6 @@ private ProcessBuilder createRedisProcessBuilder() { return pb; } - @Override public synchronized void stop() throws EmbeddedRedisException { if (active) { if (executor != null && !executor.isShutdown()) { @@ -96,7 +97,6 @@ private void tryWaitFor() { } } - @Override public List ports() { return Arrays.asList(port); }