diff --git a/pom.xml b/pom.xml index b3efa7e..b43eb30 100644 --- a/pom.xml +++ b/pom.xml @@ -64,6 +64,12 @@ 1.1.2 provided + + com.github.kstyrc + embedded-redis + 0.6 + test + diff --git a/src/test/java/com/cwbase/logback/RedisAppenderTest.java b/src/test/java/com/cwbase/logback/RedisAppenderTest.java index decaa50..8a04f00 100644 --- a/src/test/java/com/cwbase/logback/RedisAppenderTest.java +++ b/src/test/java/com/cwbase/logback/RedisAppenderTest.java @@ -21,12 +21,26 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; +import java.io.IOException; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import redis.embedded.RedisServer; public class RedisAppenderTest { + static RedisServer redisServer; String key = "logstash"; Jedis redis; + @BeforeClass + public static void beforeClass() throws IOException { + redisServer = new RedisServer(6379); + redisServer.start(); + } + @AfterClass + public static void afterClass() { + redisServer.stop(); + } @Test public void logTest() throws Exception { // refer to logback.xml in test folder