use of org.apache.jena.rdf.model.RDFList.ApplyFn in project jena by apache.
the class SecuredRDFListTest method testApply.
@Test
public void testApply() {
final ApplyFn fn = new ApplyFn() {
@Override
public void apply(final RDFNode node) {
// do nothing
}
};
try {
getSecuredRDFList().apply(fn);
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.Read });
try {
getSecuredRDFList().apply(perms, fn);
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