use of com.lambdaworks.redis.cluster.RedisClusterClient in project jetcache by alibaba.
the class RedisLutteceCacheTest method testCluster.
@Test
public void testCluster() throws Exception {
if (!checkOS()) {
return;
}
RedisURI node1 = RedisURI.create("127.0.0.1", 7000);
RedisURI node2 = RedisURI.create("127.0.0.1", 7001);
RedisURI node3 = RedisURI.create("127.0.0.1", 7002);
RedisClusterClient client = RedisClusterClient.create(Arrays.asList(node1, node2, node3));
test(client);
}
use of com.lambdaworks.redis.cluster.RedisClusterClient in project jetcache by alibaba.
the class RedisLutteceStarterTest method tests.
@Test
public void tests() throws Exception {
if (RedisLutteceCacheTest.checkOS()) {
System.setProperty("spring.profiles.active", "redisluttece-cluster");
} else {
System.setProperty("spring.profiles.active", "redisluttece");
}
context = SpringApplication.run(RedisLutteceStarterTest.class);
doTest();
A bean = context.getBean(A.class);
bean.test();
RedisClient t1 = (RedisClient) context.getBean("defaultClient");
RedisClient t2 = (RedisClient) context.getBean("a1Client");
Assert.assertNotNull(t1);
Assert.assertNotNull(t2);
Assert.assertNotSame(t1, t2);
AutoConfigureBeans acb = context.getBean(AutoConfigureBeans.class);
String key = "remote.A1";
Assert.assertTrue(new LutteceFactory(acb, key, StatefulRedisConnection.class).getObject() instanceof StatefulRedisConnection);
Assert.assertTrue(new LutteceFactory(acb, key, RedisCommands.class).getObject() instanceof RedisCommands);
Assert.assertTrue(new LutteceFactory(acb, key, RedisAsyncCommands.class).getObject() instanceof RedisAsyncCommands);
Assert.assertTrue(new LutteceFactory(acb, key, RedisReactiveCommands.class).getObject() instanceof RedisReactiveCommands);
if (RedisLutteceCacheTest.checkOS()) {
key = "remote.A2";
Assert.assertTrue(new LutteceFactory(acb, key, RedisClusterClient.class).getObject() instanceof RedisClusterClient);
Assert.assertTrue(new LutteceFactory(acb, key, RedisClusterCommands.class).getObject() instanceof RedisClusterCommands);
Assert.assertTrue(new LutteceFactory(acb, key, RedisClusterAsyncCommands.class).getObject() instanceof RedisClusterAsyncCommands);
Assert.assertTrue(new LutteceFactory(acb, key, RedisClusterReactiveCommands.class).getObject() instanceof RedisClusterReactiveCommands);
}
}
use of com.lambdaworks.redis.cluster.RedisClusterClient in project jetcache by alibaba.
the class LutteceConnectionManagerTest method testCluster.
@Test
public void testCluster() {
if (!RedisLutteceCacheTest.checkOS()) {
return;
}
RedisURI node1 = RedisURI.create("127.0.0.1", 7000);
RedisURI node2 = RedisURI.create("127.0.0.1", 7001);
RedisURI node3 = RedisURI.create("127.0.0.1", 7002);
RedisClusterClient client = RedisClusterClient.create(Arrays.asList(node1, node2, node3));
LutteceConnectionManager m = LutteceConnectionManager.defaultManager();
Assert.assertSame(m.commands(client), m.commands(client));
Assert.assertSame(m.asyncCommands(client), m.asyncCommands(client));
Assert.assertSame(m.reactiveCommands(client), m.reactiveCommands(client));
m.removeAndClose(client);
}
Aggregations