package jnpf.audit.sdk;
|
|
/** Source-scope acceptance matrix; runnable without a test framework. */
|
public final class AuditRequestScopeFilterChecks {
|
|
private AuditRequestScopeFilterChecks() {
|
}
|
|
public static void main(String[] args) {
|
AuditRequestScopeFilter limsFrontend = new AuditRequestScopeFilter(true, "LIMS");
|
check("FRONTEND + LIMS", limsFrontend.accepts("FRONTEND", "LIMS"));
|
check("case-insensitive app code", limsFrontend.accepts("frontend", "lims"));
|
check("BACKEND rejected", !limsFrontend.accepts("BACKEND", "LIMS"));
|
check("CONSOLE rejected", !limsFrontend.accepts("CONSOLE", "LIMS"));
|
check("missing scope rejected", !limsFrontend.accepts(null, "LIMS"));
|
check("other app rejected", !limsFrontend.accepts("FRONTEND", "ELN"));
|
|
AuditRequestScopeFilter unrestricted = new AuditRequestScopeFilter(false, "");
|
check("disabled filter remains backward compatible", unrestricted.accepts(null, null));
|
System.out.println("AuditRequestScopeFilterChecks: all checks passed");
|
}
|
|
private static void check(String name, boolean condition) {
|
if (!condition) {
|
throw new AssertionError(name);
|
}
|
}
|
}
|