JAVA-20164 Upgrade java hibernate specific modules to JDK 11 (#13900)
* JAVA-20164 Upgrade java hibernate specific modules to JDK 11 * JAVA-20164 Migrating java-jpa-2 * JAVA-20164 Migrating jnosql-artemis * JAVA-20164 Migrating querydsl * JAVA-20164 Migrating r2dbc * JAVA-20164 Migrating redis * JAVA-20164 Fixing test JPATextUnitTest#givenExam_whenSaveExam_thenReturnExpectedExam * JAVA-20164 Fixing givenIdentityStrategy_whenCommitTransction_thenReturnPrimaryKey * JAVA-20164 Changes after review * JAVA-20164 Migrating java-cassandra to jdk8 * JAVA-20164 Fix legacy mode error * Update pom.xml --------- Co-authored-by: timis1 <noreplay@yahoo.com> Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>
This commit is contained in:
+3
-3
@@ -102,18 +102,18 @@ public class RedisClient {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
public Set<String> zrange(final String key, final long start, final long stop) {
|
||||
public List<String> zrange(final String key, final long start, final long stop) {
|
||||
try (Jedis jedis = jedisPool.getResource()) {
|
||||
return jedis.zrange(key, start, stop);
|
||||
} catch (Exception ex) {
|
||||
log.error("Exception caught in zrange", ex);
|
||||
}
|
||||
return new HashSet<String>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public String mset(final HashMap<String, String> keysValues) {
|
||||
try (Jedis jedis = jedisPool.getResource()) {
|
||||
ArrayList<String> keysValuesArrayList = new ArrayList<String>();
|
||||
ArrayList<String> keysValuesArrayList = new ArrayList<>();
|
||||
keysValues.forEach((key, value) -> {
|
||||
keysValuesArrayList.add(key);
|
||||
keysValuesArrayList.add(value);
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
import redis.clients.jedis.params.ScanParams;
|
||||
import redis.clients.jedis.resps.ScanResult;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.baeldung.redis_scan.strategy;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
import redis.clients.jedis.params.ScanParams;
|
||||
import redis.clients.jedis.resps.ScanResult;
|
||||
|
||||
public interface ScanStrategy<T> {
|
||||
ScanResult<T> scan(Jedis jedis, String cursor, ScanParams scanParams);
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package com.baeldung.redis_scan.strategy.impl;
|
||||
|
||||
import com.baeldung.redis_scan.strategy.ScanStrategy;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
import redis.clients.jedis.params.ScanParams;
|
||||
import redis.clients.jedis.resps.ScanResult;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package com.baeldung.redis_scan.strategy.impl;
|
||||
|
||||
import com.baeldung.redis_scan.strategy.ScanStrategy;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
import redis.clients.jedis.params.ScanParams;
|
||||
import redis.clients.jedis.resps.ScanResult;
|
||||
|
||||
public class Scan implements ScanStrategy<String> {
|
||||
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package com.baeldung.redis_scan.strategy.impl;
|
||||
|
||||
import com.baeldung.redis_scan.strategy.ScanStrategy;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
import redis.clients.jedis.params.ScanParams;
|
||||
import redis.clients.jedis.resps.ScanResult;
|
||||
|
||||
public class Sscan implements ScanStrategy<String> {
|
||||
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@ package com.baeldung.redis_scan.strategy.impl;
|
||||
|
||||
import com.baeldung.redis_scan.strategy.ScanStrategy;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
import redis.clients.jedis.Tuple;
|
||||
import redis.clients.jedis.params.ScanParams;
|
||||
import redis.clients.jedis.resps.ScanResult;
|
||||
import redis.clients.jedis.resps.Tuple;
|
||||
|
||||
public class Zscan implements ScanStrategy<Tuple> {
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -35,7 +36,10 @@ public class JedisIntegrationTest {
|
||||
port = s.getLocalPort();
|
||||
s.close();
|
||||
|
||||
redisServer = new RedisServer(port);
|
||||
redisServer = RedisServer.builder()
|
||||
.port(port)
|
||||
.setting("maxheap 128M")
|
||||
.build();
|
||||
redisServer.start();
|
||||
|
||||
// Configure JEDIS
|
||||
@@ -148,7 +152,7 @@ public class JedisIntegrationTest {
|
||||
jedis.zadd(key, playerScore.getValue(), playerScore.getKey());
|
||||
});
|
||||
|
||||
Set<String> players = jedis.zrevrange(key, 0, 1);
|
||||
List<String> players = jedis.zrevrange(key, 0, 1);
|
||||
Assert.assertEquals("PlayerThree", players.iterator().next());
|
||||
|
||||
long rank = jedis.zrevrank(key, "PlayerOne");
|
||||
@@ -184,7 +188,7 @@ public class JedisIntegrationTest {
|
||||
p.zadd("ranking", 126, userOneId);
|
||||
p.zadd("ranking", 325, userTwoId);
|
||||
Response<Boolean> pipeExists = p.sismember("searched#" + userOneId, "paris");
|
||||
Response<Set<String>> pipeRanking = p.zrange("ranking", 0, -1);
|
||||
Response<List<String>> pipeRanking = p.zrange("ranking", 0, -1);
|
||||
p.sync();
|
||||
|
||||
Assert.assertTrue(pipeExists.get());
|
||||
|
||||
+4
-1
@@ -32,7 +32,10 @@ public class RedissonConfigurationIntegrationTest {
|
||||
port = s.getLocalPort();
|
||||
s.close();
|
||||
|
||||
redisServer = new RedisServer(port);
|
||||
redisServer = RedisServer.builder()
|
||||
.port(port)
|
||||
.setting("maxheap 128M")
|
||||
.build();
|
||||
redisServer.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,11 @@ public class RedissonIntegrationTest {
|
||||
private static RedissonClient client;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp() throws IOException {
|
||||
redisServer = new RedisServer(6379);
|
||||
public static void setUp() {
|
||||
redisServer = RedisServer.builder()
|
||||
.port(6379)
|
||||
.setting("maxheap 128M")
|
||||
.build();
|
||||
redisServer.start();
|
||||
client = Redisson.create();
|
||||
}
|
||||
|
||||
+4
-1
@@ -23,7 +23,10 @@ public class DeleteEverythingInRedisIntegrationTest {
|
||||
port = s.getLocalPort();
|
||||
s.close();
|
||||
|
||||
redisServer = new RedisServer(port);
|
||||
redisServer = RedisServer.builder()
|
||||
.port(port)
|
||||
.setting("maxheap 128M")
|
||||
.build();
|
||||
redisServer.start();
|
||||
|
||||
// Configure JEDIS
|
||||
|
||||
+10
-6
@@ -8,6 +8,7 @@ import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -24,7 +25,10 @@ public class NaiveApproachIntegrationTest {
|
||||
port = s.getLocalPort();
|
||||
s.close();
|
||||
|
||||
redisServer = new RedisServer(port);
|
||||
redisServer = RedisServer.builder()
|
||||
.port(port)
|
||||
.setting("maxheap 128M")
|
||||
.build();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -50,7 +54,7 @@ public class NaiveApproachIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testKeys() {
|
||||
HashMap<String, String> keyValues = new HashMap<String, String>();
|
||||
HashMap<String, String> keyValues = new HashMap<>();
|
||||
keyValues.put("balls:cricket", "160");
|
||||
keyValues.put("balls:football", "450");
|
||||
keyValues.put("balls:volleyball", "270");
|
||||
@@ -62,7 +66,7 @@ public class NaiveApproachIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testSmembers() {
|
||||
HashSet<String> setMembers = new HashSet<String>();
|
||||
HashSet<String> setMembers = new HashSet<>();
|
||||
setMembers.add("cricket_160");
|
||||
setMembers.add("football_450");
|
||||
setMembers.add("volleyball_270");
|
||||
@@ -73,7 +77,7 @@ public class NaiveApproachIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testHgetAll() {
|
||||
HashMap<String, String> keyValues = new HashMap<String, String>();
|
||||
HashMap<String, String> keyValues = new HashMap<>();
|
||||
keyValues.put("balls:cricket", "160");
|
||||
keyValues.put("balls:football", "450");
|
||||
keyValues.put("balls:volleyball", "270");
|
||||
@@ -84,12 +88,12 @@ public class NaiveApproachIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testZRange() {
|
||||
HashMap<String, Double> scoreMembers = new HashMap<String, Double>();
|
||||
HashMap<String, Double> scoreMembers = new HashMap<>();
|
||||
scoreMembers.put("cricket", (double) 160);
|
||||
scoreMembers.put("football", (double) 450);
|
||||
scoreMembers.put("volleyball", (double) 270);
|
||||
redisClient.zadd("balls", scoreMembers);
|
||||
Set<String> readSetMembers = redisClient.zrange("balls", 0, -1);
|
||||
List<String> readSetMembers = redisClient.zrange("balls", 0, -1);
|
||||
|
||||
Assert.assertEquals(readSetMembers.size(), scoreMembers.size());
|
||||
}
|
||||
|
||||
+12
-9
@@ -8,7 +8,7 @@ import com.baeldung.redis_scan.strategy.impl.Scan;
|
||||
import com.baeldung.redis_scan.strategy.impl.Sscan;
|
||||
import com.baeldung.redis_scan.strategy.impl.Zscan;
|
||||
import org.junit.*;
|
||||
import redis.clients.jedis.Tuple;
|
||||
import redis.clients.jedis.resps.Tuple;
|
||||
import redis.embedded.RedisServer;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -31,7 +31,10 @@ public class ScanStrategyIntegrationTest {
|
||||
port = s.getLocalPort();
|
||||
s.close();
|
||||
|
||||
redisServer = new RedisServer(port);
|
||||
redisServer = RedisServer.builder()
|
||||
.port(port)
|
||||
.setting("maxheap 128M")
|
||||
.build();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -57,7 +60,7 @@ public class ScanStrategyIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testScanStrategy() {
|
||||
HashMap<String, String> keyValues = new HashMap<String, String>();
|
||||
HashMap<String, String> keyValues = new HashMap<>();
|
||||
keyValues.put("balls:cricket", "160");
|
||||
keyValues.put("balls:football", "450");
|
||||
keyValues.put("balls:volleyball", "270");
|
||||
@@ -66,7 +69,7 @@ public class ScanStrategyIntegrationTest {
|
||||
ScanStrategy<String> scanStrategy = new Scan();
|
||||
int iterationCount = 2;
|
||||
RedisIterator iterator = redisClient.iterator(iterationCount, "ball*", scanStrategy);
|
||||
List<String> results = new LinkedList<String>();
|
||||
List<String> results = new LinkedList<>();
|
||||
while (iterator.hasNext()) {
|
||||
results.addAll(iterator.next());
|
||||
}
|
||||
@@ -84,7 +87,7 @@ public class ScanStrategyIntegrationTest {
|
||||
Sscan scanStrategy = new Sscan("balls");
|
||||
int iterationCount = 2;
|
||||
RedisIterator iterator = redisClient.iterator(iterationCount, "*", scanStrategy);
|
||||
List<String> results = new LinkedList<String>();
|
||||
List<String> results = new LinkedList<>();
|
||||
while (iterator.hasNext()) {
|
||||
results.addAll(iterator.next());
|
||||
}
|
||||
@@ -93,7 +96,7 @@ public class ScanStrategyIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testHscanStrategy() {
|
||||
HashMap<String, String> hash = new HashMap<String, String>();
|
||||
HashMap<String, String> hash = new HashMap<>();
|
||||
hash.put("cricket", "160");
|
||||
hash.put("football", "450");
|
||||
hash.put("volleyball", "270");
|
||||
@@ -102,7 +105,7 @@ public class ScanStrategyIntegrationTest {
|
||||
Hscan scanStrategy = new Hscan("balls");
|
||||
int iterationCount = 2;
|
||||
RedisIterator iterator = redisClient.iterator(iterationCount, "*", scanStrategy);
|
||||
List<Map.Entry<String, String>> results = new LinkedList<Map.Entry<String, String>>();
|
||||
List<Map.Entry<String, String>> results = new LinkedList<>();
|
||||
while (iterator.hasNext()) {
|
||||
results.addAll(iterator.next());
|
||||
}
|
||||
@@ -111,7 +114,7 @@ public class ScanStrategyIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testZscanStrategy() {
|
||||
HashMap<String, Double> memberScores = new HashMap<String, Double>();
|
||||
HashMap<String, Double> memberScores = new HashMap<>();
|
||||
memberScores.put("cricket", (double) 160);
|
||||
memberScores.put("football", (double) 450);
|
||||
memberScores.put("volleyball", (double) 270);
|
||||
@@ -120,7 +123,7 @@ public class ScanStrategyIntegrationTest {
|
||||
Zscan scanStrategy = new Zscan("balls");
|
||||
int iterationCount = 2;
|
||||
RedisIterator iterator = redisClient.iterator(iterationCount, "*", scanStrategy);
|
||||
List<Tuple> results = new LinkedList<Tuple>();
|
||||
List<Tuple> results = new LinkedList<>();
|
||||
while (iterator.hasNext()) {
|
||||
results.addAll(iterator.next());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user