Skip to content

Commit a7e6e93

Browse files
authored
Create Redis_KeyLongMap_test.java
1 parent b16dc02 commit a7e6e93

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package picoded.dstack.redis;
2+
3+
import picoded.core.struct.*;
4+
import picoded.dstack.*;
5+
import picoded.dstack.struct.simple.*;
6+
7+
import java.util.concurrent.ThreadLocalRandom;
8+
9+
public class RedisKeyLongMap_test extends StructSimple_KeyLongMap_test {
10+
// Redis stack instance
11+
protected static volatile RedisStack instance = null;
12+
13+
/// Implementation constructor
14+
public KeyLongMap implementationConstructor() {
15+
16+
// Initialize server
17+
synchronized (RedisKeyLongMap_test.class) {
18+
if (instance == null) {
19+
// The default config uses "172.17.0.1" (default docker bridge address)
20+
// and port 6379 (default redis port)
21+
GenericConvertMap<String, Object> redisConfig = new GenericConvertHashMap<>();
22+
redisConfig.put("host", DStackTestConfig.REDIS_HOST());
23+
redisConfig.put("port", DStackTestConfig.REDIS_PORT());
24+
25+
// Use a random DB number between 0 and 15.
26+
// int randomNum = ThreadLocalRandom.current().nextInt(0, 15 + 1);
27+
redisConfig.put("name", DStackTestConfig.randomTablePrefix());
28+
29+
GenericConvertMap<String, Object> stackConfig = new GenericConvertHashMap<>();
30+
stackConfig.put("name", "RedisKeyLongMap_test");
31+
stackConfig.put("redis", redisConfig);
32+
33+
instance = new RedisStack(stackConfig);
34+
}
35+
}
36+
// Load the KeyLongMap
37+
return instance.KeyLongMap(DStackTestConfig.randomTablePrefix());
38+
}
39+
}

0 commit comments

Comments
 (0)