use of com.aerospike.redisson.RedissonClient in project XRTB by benmfaul.
the class TestFreqCapLogc method test1M.
@Test
public void test1M() throws Exception {
AerospikeHandler client = AerospikeHandler.getInstance("localhost", 3000, 300);
RedissonClient redisson = new RedissonClient(client);
Set<String> set = new HashSet();
for (int i = 0; i < 1000; i++) {
String key = "JUNK" + i;
System.out.println(key);
set.add(key);
redisson.set(key, key, 120);
}
System.out.println("Assignment complete");
for (String s : set) {
assertNotNull(redisson.get(s));
}
System.out.println("Test 1 complete");
Thread.sleep(125000);
for (String s : set) {
assertNull(redisson.get(s));
}
}
use of com.aerospike.redisson.RedissonClient in project XRTB by benmfaul.
the class AeroConfiguration method main.
/**
* The application. -set key filename, or -get key
* @param args String[]. The arguments.
* @throws Exception on errors.
*/
public static void main(String[] args) throws Exception {
String name = null;
String cmd = null;
String contents = null;
String spike = "localhost";
int i = 0;
if (args.length > 0) {
while (i < args.length) {
switch(args[i]) {
case "-h":
System.out.println("-aero <host:port> [Sets the host:port string of the cache ]");
System.out.println("-set <name> <filename> [Set <name> to contents of <filename> contents ]");
System.out.println("-get <name> [Print the contents of name ]");
System.exit(0);
case "-aero":
spike = args[i + 1];
i += 2;
break;
case "-set":
cmd = args[i];
name = args[i + 1];
contents = new String(Files.readAllBytes(Paths.get(args[i + 2])), StandardCharsets.UTF_8);
i += 3;
break;
case "-get":
cmd = args[i];
name = args[i + 1];
i += 2;
break;
}
}
}
if (cmd == null) {
System.out.println("Please use either -get or -set");
System.exit(0);
;
}
AerospikeHandler ae = AerospikeHandler.getInstance(spike, 3000, 300);
RedissonClient redisson = new RedissonClient(ae);
if (cmd.equals("-get")) {
contents = redisson.get(name);
System.out.println(contents);
}
if (cmd.equals("-set")) {
redisson.set(name, contents);
}
System.exit(0);
}
use of com.aerospike.redisson.RedissonClient in project XRTB by benmfaul.
the class TestWinProcessing method setup.
@BeforeClass
public static void setup() {
try {
AerospikeHandler spike = AerospikeHandler.getInstance("localhost", 3000, 300);
redisson = new RedissonClient(spike);
Config.setup();
System.out.println("****************** TestWinProcessing");
password = Configuration.getInstance().password;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of com.aerospike.redisson.RedissonClient in project XRTB by benmfaul.
the class TestDeadmanSwitch method testSwitch.
/**
* @throws Exception
*/
@Test
public void testSwitch() throws Exception {
AerospikeHandler spike = AerospikeHandler.getInstance("localhost", 3000, 300);
RedissonClient redisson = new RedissonClient(spike);
DeadmanSwitch.testmode = true;
redisson.del("deadmanswitch");
DeadmanSwitch d = new DeadmanSwitch(redisson, "deadmanswitch");
Thread.sleep(1000);
assertFalse(d.canRun());
redisson.set("deadmanswitch", "ready", 5);
assertTrue(d.canRun());
Thread.sleep(10000);
assertFalse(d.canRun());
}
use of com.aerospike.redisson.RedissonClient in project XRTB by benmfaul.
the class TestDeadmanSwitch method testDelayedExpire.
@Test
public void testDelayedExpire() throws Exception {
AerospikeHandler spike = AerospikeHandler.getInstance("localhost", 3000, 300);
RedissonClient redisson = new RedissonClient(spike);
redisson.del("xxx");
Map m = new HashMap();
m.put("Ben", 1);
m.put("Peter", 2);
redisson.hmset("xxx", m);
m = redisson.hgetAll("xxx");
assertNotNull(m);
Long n = (Long) m.get("Ben");
assertNotNull(n);
redisson.expire("xxx", 2);
m = redisson.hgetAll("xxx");
assertNotNull(m);
n = (Long) m.get("Ben");
assertNotNull(n);
Thread.sleep(5000);
m = redisson.hgetAll("xxx");
assertNull(m);
}
Aggregations