use of org.redisson.api.RBatchRx in project redisson by redisson.
the class RedissonBatchRxTest method testBatchNPE.
@ParameterizedTest
@MethodSource("data")
public void testBatchNPE(BatchOptions batchOptions) {
RBatchRx batch = redisson.createBatch(batchOptions);
batch.getBucket("A1").set("001");
batch.getBucket("A2").set("001");
batch.getBucket("A3").set("001");
batch.getKeys().delete("A1");
batch.getKeys().delete("A2");
sync(batch.execute());
}
use of org.redisson.api.RBatchRx in project redisson by redisson.
the class RedissonBatchRxTest method testDifferentCodecsAtomic.
@ParameterizedTest
@MethodSource("data")
public void testDifferentCodecsAtomic(BatchOptions batchOptions) {
RBatchRx b = redisson.createBatch(batchOptions.executionMode(ExecutionMode.IN_MEMORY_ATOMIC));
b.getMap("test1").put("1", "2");
b.getMap("test2", StringCodec.INSTANCE).put("21", "3");
Maybe<Object> val1 = b.getMap("test1").get("1");
Maybe<Object> val2 = b.getMap("test2", StringCodec.INSTANCE).get("21");
sync(b.execute());
Assertions.assertEquals("2", sync(val1));
Assertions.assertEquals("3", sync(val2));
}
use of org.redisson.api.RBatchRx in project redisson by redisson.
the class RedissonBatchRxTest method testConnectionLeakAfterError.
@Test
public void testConnectionLeakAfterError() {
Config config = BaseTest.createConfig();
config.useSingleServer().setRetryInterval(100).setTimeout(200).setConnectionMinimumIdleSize(1).setConnectionPoolSize(1);
RedissonRxClient redisson = Redisson.create(config).rxJava();
BatchOptions batchOptions = BatchOptions.defaults().executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
RBatchRx batch = redisson.createBatch(batchOptions);
for (int i = 0; i < 25000; i++) {
batch.getBucket("test").set(123);
}
try {
sync(batch.execute());
Assertions.fail();
} catch (Exception e) {
// skip
}
sync(redisson.getBucket("test3").set(4));
assertThat(sync(redisson.getBucket("test3").get())).isEqualTo(4);
batch = redisson.createBatch(batchOptions);
batch.getBucket("test1").set(1);
batch.getBucket("test2").set(2);
sync(batch.execute());
assertThat(sync(redisson.getBucket("test1").get())).isEqualTo(1);
assertThat(sync(redisson.getBucket("test2").get())).isEqualTo(2);
redisson.shutdown();
}
use of org.redisson.api.RBatchRx in project redisson by redisson.
the class RedissonBatchRxTest method testEmpty.
@ParameterizedTest
@MethodSource("data")
public void testEmpty(BatchOptions batchOptions) {
RBatchRx batch = redisson.createBatch(batchOptions);
sync(batch.execute());
}
use of org.redisson.api.RBatchRx in project redisson by redisson.
the class RedissonBatchRxTest method testExceptionHandling.
@ParameterizedTest
@MethodSource("data")
public void testExceptionHandling(BatchOptions batchOptions) {
Assertions.assertThrows(RedisException.class, () -> {
RBatchRx batch = redisson.createBatch(batchOptions);
batch.getMap("test").put("1", "2");
batch.getScript().eval(Mode.READ_WRITE, "wrong_code", RScript.ReturnType.VALUE);
sync(batch.execute());
});
}
Aggregations