use of org.redisson.api.RBatchReactive in project redisson by redisson.
the class RedissonReferenceReactiveTest method testBatch.
@Test
public void testBatch() throws InterruptedException {
RBatchReactive batch = redisson.createBatch();
RBucketReactive<Object> b1 = batch.getBucket("b1");
RBucketReactive<Object> b2 = batch.getBucket("b2");
RBucketReactive<Object> b3 = batch.getBucket("b3");
b2.set(b3);
b1.set(b2);
b3.set(b1);
sync(batch.execute());
batch = redisson.createBatch();
batch.getBucket("b1").get();
batch.getBucket("b2").get();
batch.getBucket("b3").get();
List<RBucketReactive> result = (List<RBucketReactive>) sync(batch.execute());
assertEquals("b2", result.get(0).getName());
assertEquals("b3", result.get(1).getName());
assertEquals("b1", result.get(2).getName());
}
use of org.redisson.api.RBatchReactive in project redisson by redisson.
the class RedissonReferenceReactiveTest method testReactiveToNormal.
@Test
public void testReactiveToNormal() throws InterruptedException {
RBatchReactive batch = redisson.createBatch();
RBucketReactive<Object> b1 = batch.getBucket("b1");
RBucketReactive<Object> b2 = batch.getBucket("b2");
RBucketReactive<Object> b3 = batch.getBucket("b3");
b2.set(b3);
b1.set(b2);
b3.set(b1);
sync(batch.execute());
RedissonClient lredisson = Redisson.create(redisson.getConfig());
RBatch b = lredisson.createBatch();
b.getBucket("b1").getAsync();
b.getBucket("b2").getAsync();
b.getBucket("b3").getAsync();
List<RBucket> result = (List<RBucket>) b.execute();
assertEquals("b2", result.get(0).getName());
assertEquals("b3", result.get(1).getName());
assertEquals("b1", result.get(2).getName());
lredisson.shutdown();
}
use of org.redisson.api.RBatchReactive in project redisson by redisson.
the class RedissonReferenceTest method testNormalToReactive.
@Test
public void testNormalToReactive() {
RBatch batch = redisson.createBatch();
RBucketAsync<Object> b1 = batch.getBucket("b1");
RBucketAsync<Object> b2 = batch.getBucket("b2");
RBucketAsync<Object> b3 = batch.getBucket("b3");
b2.setAsync(b3);
b1.setAsync(b2);
b3.setAsync(b1);
batch.execute();
RBatchReactive b = Redisson.createReactive(redisson.getConfig()).createBatch();
b.getBucket("b1").get();
b.getBucket("b2").get();
b.getBucket("b3").get();
List<RBucketReactive> result = (List<RBucketReactive>) BaseReactiveTest.sync(b.execute());
assertEquals("b2", result.get(0).getName());
assertEquals("b3", result.get(1).getName());
assertEquals("b1", result.get(2).getName());
}
Aggregations