use of org.redisson.api.RBatchRx in project redisson by redisson.
the class RedissonBatchRxTest method testBatchBigRequest.
@ParameterizedTest
@MethodSource("data")
public void testBatchBigRequest(BatchOptions batchOptions) {
Config config = BaseTest.createConfig();
config.useSingleServer().setTimeout(15000);
RedissonRxClient redisson = Redisson.create(config).rxJava();
RBatchRx batch = redisson.createBatch(batchOptions);
for (int i = 0; i < 210; i++) {
batch.getMap("test").fastPut("1", "2");
batch.getMap("test").fastPut("2", "3");
batch.getMap("test").put("2", "5");
batch.getAtomicLong("counter").incrementAndGet();
batch.getAtomicLong("counter").incrementAndGet();
}
BatchResult<?> res = sync(batch.execute());
Assertions.assertEquals(210 * 5, res.getResponses().size());
redisson.shutdown();
}
use of org.redisson.api.RBatchRx in project redisson by redisson.
the class RedissonBatchRxTest method testTwice.
@ParameterizedTest
@MethodSource("data")
public void testTwice(BatchOptions batchOptions) {
Assertions.assertThrows(IllegalStateException.class, () -> {
RBatchRx batch = redisson.createBatch(batchOptions);
batch.getMap("test").put("1", "2");
sync(batch.execute());
sync(batch.execute());
});
}
use of org.redisson.api.RBatchRx in project redisson by redisson.
the class RedissonBatchRxTest method testSkipResult.
@ParameterizedTest
@MethodSource("data")
public void testSkipResult(BatchOptions batchOptions) {
Assumptions.assumeTrue(RedisRunner.getDefaultRedisServerInstance().getRedisVersion().compareTo("3.2.0") > 0);
batchOptions.skipResult();
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());
assertThat(sync(redisson.getBucket("A1").isExists())).isFalse();
assertThat(sync(redisson.getBucket("A3").isExists())).isTrue();
}
use of org.redisson.api.RBatchRx in project redisson by redisson.
the class RedissonBatchRxTest method testBatchRedirect.
// @Test
public void testBatchRedirect(BatchOptions batchOptions) {
RBatchRx batch = redisson.createBatch(batchOptions);
for (int i = 0; i < 5; i++) {
batch.getMap("" + i).fastPut("" + i, i);
}
sync(batch.execute());
batch = redisson.createBatch(batchOptions);
for (int i = 0; i < 1; i++) {
batch.getMap("" + i).size();
batch.getMap("" + i).containsValue("" + i);
batch.getMap("" + i).containsValue(i);
}
BatchResult<?> t = sync(batch.execute());
System.out.println(t);
}
use of org.redisson.api.RBatchRx in project redisson by redisson.
the class RedissonBatchRxTest method testPerformance.
@ParameterizedTest
@MethodSource("data")
public void testPerformance(BatchOptions batchOptions) {
Assertions.assertTimeout(Duration.ofSeconds(20), () -> {
RMapRx<String, String> map = redisson.getMap("map");
Map<String, String> m = new HashMap<String, String>();
for (int j = 0; j < 1000; j++) {
m.put("" + j, "" + j);
}
sync(map.putAll(m));
for (int i = 0; i < 10000; i++) {
RBatchRx batch = redisson.createBatch(batchOptions);
RMapRx<String, String> m1 = batch.getMap("map");
Single<Map<String, String>> f = m1.getAll(m.keySet());
sync(batch.execute());
assertThat(sync(f)).hasSize(1000);
}
});
}
Aggregations