Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/kstyrc/embedded-redis
Browse files Browse the repository at this point in the history
  • Loading branch information
kstyrc committed Oct 24, 2013
2 parents b8df088 + 7967e58 commit be44c7e
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,72 @@ embedded-redis
==============

Redis embedded server for Java integration testing


Maven dependency
==============

Currently embedded-redis is available in clojars repository:
```
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
```

Dependency configuration:
```
<dependency>
<groupId>redis.embedded</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.1</version>
</dependency>
```
More at https://clojars.org/redis.embedded/embedded-redis

Usage example
==============

Running RedisServer is as simple as:
```
RedisServer redisServer = new RedisServer(6379);
redisServer.start();
// do some work
redisServer.stop();
```
You can also provide RedisServer with your own redis executable to run:
```
RedisServer redisServer = new RedisServer("/path/to/your/redis", 6379);
```
A simple redis integration test would look like this:
```
public class SomeIntegrationTestThatRequiresRedis {
private RedisServer redisServer;
@Before
public void setup() throws Exception {
redisServer = new RedisServer(6379); // or new RedisServer("/path/to/your/redis", 6379);
redisServer.start();
}
@Test
public void test() throws Exception {
// testing code that requires redis running
}
@After
public void tearDown() throws Exception {
redisServer.stop();
}
}
```


Redis version
==============

When not provided with the desired redis executable, RedisServer runs os-dependent executable enclosed in jar. Currently is uses:
- Redis 2.6.14 in case of Linux/Unix
- unofficial Win32/64 port from https://github.com/MSOpenTech/redis (branch 2.6) in case of Windows

However, you should provide RedisServer with redis executable if you need specific version.

0 comments on commit be44c7e

Please sign in to comment.