use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method udfExcept.
@Test
public void udfExcept() {
WritePolicy policy = new WritePolicy();
policy.filterExp = Exp.build(Exp.eq(Exp.intBin(binA), Exp.val(1)));
policy.failOnFilteredOut = true;
client.execute(policy, keyA, "record_example", "writeBin", Value.get(binA), Value.get(3));
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.execute(policy, keyB, "record_example", "writeBin", Value.get(binA), Value.get(3));
}
});
assertEquals(ResultCode.FILTERED_OUT, ae.getResultCode());
}
use of org.junit.function.ThrowingRunnable in project aerospike-client-java by aerospike.
the class TestFilterExp method filterFloor.
@Test
public void filterFloor() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.eq(Exp.floor(Exp.floatBin(binB)), Exp.val(2.0)));
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 getExcept.
@Test
public void getExcept() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.eq(Exp.intBin(binA), Exp.val(1)));
policy.failOnFilteredOut = true;
client.get(policy, keyA);
AerospikeException ae = assertThrows(AerospikeException.class, new ThrowingRunnable() {
public void run() {
client.get(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 filterMin.
@Test
public void filterMin() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.not(Exp.eq(Exp.min(Exp.intBin(binA), Exp.intBin(binD), Exp.intBin(binE)), 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.min(Exp.intBin(binA), Exp.intBin(binD), Exp.intBin(binE)), 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 filterLshift.
@Test
public void filterLshift() {
Policy policy = new Policy();
policy.filterExp = Exp.build(Exp.not(Exp.eq(Exp.lshift(Exp.intBin(binA), Exp.val(2)), 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());
policy.filterExp = Exp.build(Exp.eq(Exp.lshift(Exp.intBin(binA), Exp.val(2)), Exp.val(4)));
Record r = client.get(policy, keyA);
assertBinEqual(keyA, r, binA, 1);
}
Aggregations