Search in sources :

Example 1 with RBucketReactive

use of org.redisson.api.RBucketReactive 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());
}
Also used : RBucketReactive(org.redisson.api.RBucketReactive) List(java.util.List) RBatchReactive(org.redisson.api.RBatchReactive) Test(org.junit.Test)

Example 2 with RBucketReactive

use of org.redisson.api.RBucketReactive 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());
}
Also used : RBatch(org.redisson.api.RBatch) RBucketReactive(org.redisson.api.RBucketReactive) RLiveObject(org.redisson.api.RLiveObject) List(java.util.List) RBatchReactive(org.redisson.api.RBatchReactive) Test(org.junit.Test)

Aggregations

List (java.util.List)2 Test (org.junit.Test)2 RBatchReactive (org.redisson.api.RBatchReactive)2 RBucketReactive (org.redisson.api.RBucketReactive)2 RBatch (org.redisson.api.RBatch)1 RLiveObject (org.redisson.api.RLiveObject)1