use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterIntOr.
@Test
public void filterIntOr() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.not(Exp.and(Exp.eq(Exp.intOr(Exp.intBin(binA), Exp.val(0)), Exp.val(1)), Exp.eq(Exp.intOr(Exp.intBin(binA), Exp.val(0xFF)), Exp.val(0xFF)))));
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.and(Exp.eq(Exp.intOr(Exp.intBin(binA), Exp.val(0)), Exp.val(1)), Exp.eq(Exp.intOr(Exp.intBin(binA), Exp.val(0xFF)), Exp.val(0xFF))));
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 filterBitCount.
@Test
public void filterBitCount() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.not(Exp.eq(Exp.count(Exp.intBin(binA)), 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());
policy.filterExp = Exp.build(Exp.eq(Exp.count(Exp.intBin(binA)), Exp.val(1)));
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 filterRshift.
@Test
public void filterRshift() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.not(Exp.eq(Exp.rshift(Exp.intBin(binE), Exp.val(62)), Exp.val(3))));
policy.failOnFilteredOut = true;
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.get(policy, keyB);
}
});
assertEquals(ResultCode.FILTERED_OUT, ae.getResultCode());
policy.filterExp = Exp.build(Exp.eq(Exp.rshift(Exp.intBin(binE), Exp.val(62)), Exp.val(3)));
Record r = client.get(policy, keyB);
assertBinEqual(keyB, r, binE, -2);
}
use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterDiv.
@Test
public void filterDiv() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.eq(Exp.div(Exp.val(8), Exp.intBin(binA), Exp.intBin(binD)), 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);
}
use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterSub.
@Test
public void filterSub() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.eq(Exp.sub(Exp.val(1), Exp.intBin(binA), Exp.intBin(binD)), Exp.val(-2)));
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