group persistence modules (#2890)
* move security content from spring-security-rest-full * swagger update * move query language to new module * rename spring-security-rest-full to spring-rest-full * group persistence modules
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
dbeb5f8ba4
commit
26c50909be
@@ -0,0 +1,65 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.redisson.Redisson;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.redisson.config.Config;
|
||||
import redis.embedded.RedisServer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by johnson on 3/9/17.
|
||||
*/
|
||||
public class RedissonConfigurationIntegrationTest {
|
||||
private static RedisServer redisServer;
|
||||
private static RedissonClient client;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp() throws IOException {
|
||||
redisServer = new RedisServer(6379);
|
||||
redisServer.start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void destroy() {
|
||||
redisServer.stop();
|
||||
client.shutdown();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenJavaConfig_thenRedissonConnectToRedis() {
|
||||
Config config = new Config();
|
||||
config.useSingleServer()
|
||||
.setAddress("127.0.0.1:6379");
|
||||
|
||||
client = Redisson.create(config);
|
||||
|
||||
assert(client != null && client.getKeys().count() >= 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenJSONFileConfig_thenRedissonConnectToRedis() throws IOException {
|
||||
Config config = Config.fromJSON(
|
||||
new File(getClass().getClassLoader().getResource(
|
||||
"singleNodeConfig.json").getFile()));
|
||||
|
||||
client = Redisson.create(config);
|
||||
|
||||
assert(client != null && client.getKeys().count() >= 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenYAMLFileConfig_thenRedissonConnectToRedis() throws IOException {
|
||||
Config config = Config.fromYAML(
|
||||
new File(getClass().getClassLoader().getResource(
|
||||
"singleNodeConfig.yaml").getFile()));
|
||||
|
||||
client = Redisson.create(config);
|
||||
|
||||
assert(client != null && client.getKeys().count() >= 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user