use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method durableDeleteExcept.
@Test
public void durableDeleteExcept() {
if (!args.enterprise) {
return;
}
WritePolicy policy = new WritePolicy();
policy.filterExp = Exp.build(Exp.eq(Exp.intBin(binA), Exp.val(1)));
policy.failOnFilteredOut = true;
policy.durableDelete = true;
client.delete(policy, keyA);
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.delete(policy, keyB);
}
});
assertEquals(ResultCode.FILTERED_OUT, ae.getResultCode());
}
use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterLog.
@Test
public void filterLog() {
String name = "x";
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.let(Exp.def(name, Exp.log(Exp.floatBin(binB), Exp.val(2.0))), Exp.and(Exp.ge(Exp.var(name), Exp.val(1.1374)), Exp.le(Exp.var(name), Exp.val(1.1376)))));
policy.failOnFilteredOut = true;
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.get(policy, keyA);
}
});
assertEquals(ResultCode.FILTERED_OUT, ae.getResultCode());
Record r = client.get(policy, keyB);
assertBinEqual(keyA, r, binA, 2);
}
use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterLscan.
@Test
public void filterLscan() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.not(Exp.eq(Exp.lscan(Exp.intBin(binA), Exp.val(true)), Exp.val(63))));
policy.failOnFilteredOut = true;
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.get(policy, keyA);
}
});
assertEquals(ResultCode.FILTERED_OUT, ae.getResultCode());
policy.filterExp = Exp.build(Exp.eq(Exp.lscan(Exp.intBin(binA), Exp.val(true)), Exp.val(63)));
Record r = client.get(policy, keyA);
assertBinEqual(keyA, r, binA, 1);
}
use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterExclusive.
@Test
public void filterExclusive() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.exclusive(Exp.eq(Exp.intBin(binA), Exp.val(1)), Exp.eq(Exp.intBin(binD), Exp.val(1))));
policy.failOnFilteredOut = true;
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.get(policy, keyA);
}
});
assertEquals(ResultCode.FILTERED_OUT, ae.getResultCode());
Record r = client.get(policy, keyB);
assertBinEqual(keyA, r, binA, 2);
}
use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterAddInt.
@Test
public void filterAddInt() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.eq(Exp.add(Exp.intBin(binA), Exp.intBin(binD), Exp.val(1)), Exp.val(4)));
policy.failOnFilteredOut = true;
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.get(policy, keyA);
}
});
assertEquals(ResultCode.FILTERED_OUT, ae.getResultCode());
Record r = client.get(policy, keyB);
assertBinEqual(keyA, r, binA, 2);
}
Aggregations