kstyrc / embedded-redis

Redis embedded server for Java integration testing
854 stars 371 forks source link

Os detection fix + ability to override redis exec per os/arch #29

Closed kstyrc closed 9 years ago

kstyrc commented 9 years ago

Hi,

finally fixed broken os detection as stated here: https://github.com/kstyrc/embedded-redis/issues/20 https://blogs.oracle.com/DieterDeramoudt/entry/beware_when_detecting_32_and

I've implemented some improved OSDetector based on a couple of posts on StackOverflow. It would be great if you could test it on MacOS / Windows 32/64.

Also, I've added possibility to override redis executable os-independently as follows:

RedisExecProvider customProvider = RedisExecProvider.defaultProvider()
  .override(OS.UNIX, "/path/to/unix/redis")
  .override(OS.WINDOWS, Architecture.x86, "/path/to/windows/redis")
  .override(OS.Windows, Architecture.x86_64, "/path/to/windows/redis")
  .override(OS.MAC_OS_X, Architecture.x86, "/path/to/macosx/redis")
  .override(OS.MAC_OS_X, Architecture.x86_64, "/path/to/macosx/redis");

RedisServer redisServer = new RedisServer(customProvider, 6379);
RedisServer redisServer = new RedisServerBuilder()
  .redisExecProvider(customProvider)
  .build();

@turu @domdorn @ghillert @anthonyu What do you guys think about this PR?