use of org.apache.jena.rdf.model.RDFList.ReduceFn in project jena by apache.
the class SecuredRDFListTest method testReduce.
@Test
public void testReduce() {
final ReduceFn fn = new ReduceFn() {
@Override
public Object reduce(final RDFNode node, final Object accumulator) {
return accumulator;
}
};
try {
getSecuredRDFList().reduce(fn, "Hello");
if (!securityEvaluator.evaluate(Action.Read)) {
Assert.fail("Should have thrown ReadDeniedException Exception");
}
} catch (final ReadDeniedException e) {
if (securityEvaluator.evaluate(Action.Read)) {
Assert.fail(String.format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple()));
}
}
final Set<Action> perms = SecurityEvaluator.Util.asSet(new Action[] { Action.Update, Action.Create });
try {
getSecuredRDFList().reduce(perms, fn, "Hello");
if (!securityEvaluator.evaluate(Action.Read)) {
Assert.fail("Should have thrown ReadDeniedException Exception");
}
} catch (final ReadDeniedException e) {
if (securityEvaluator.evaluate(Action.Read)) {
Assert.fail(String.format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple()));
}
}
}
Aggregations