SecurityRegistry extends Registry<String, SecurityContext> implements AuthorizationService { @Override public SecurityContext get(String actor) { if ( actor == null ) return SecurityContext.NONE; SecurityContext sCxt = super.get(actor); if ( sCxt == null ) sCxt = SecurityContext.NONE; return sCxt; } SecurityRegistry(); @Override SecurityContext get(String actor); @Override String toString(); String toLongString();  }
@Test public void assemblerFile_1() { AuthorizationService authService = (AuthorizationService)AssemblerUtils.build(DIR+"assem-security-registry-1.ttl", VocabSecurity.tSecurityRegistry); assertNotNull(authService); SecurityRegistry sReg = (SecurityRegistry)authService; assertEquals(4, sReg.keys().size()); assertEquals(3, sReg.get("user1").visibleGraphs().size()); }
@Test public void assemblerFile_2() { AuthorizationService authService = (AuthorizationService)AssemblerUtils.build(DIR+"assem-security-registry-2.ttl", VocabSecurity.tSecurityRegistry); assertNotNull(authService); { SecurityContext sCxt = authService.get("user1"); assertEquals(1, sCxt.visibleGraphs().size()); Node x = sCxt.visibleGraphs().stream().findFirst().get(); assertEquals(SecurityContext.allNamedGraphs, x); } { SecurityContext sCxt = authService.get("user2"); assertEquals(1, sCxt.visibleGraphs().size()); Node x = sCxt.visibleGraphs().stream().findFirst().get(); assertEquals(SecurityContext.allGraphs, x); } { SecurityContext sCxt = authService.get("user3"); assertEquals(1, sCxt.visibleGraphs().size()); Node x = sCxt.visibleGraphs().stream().findFirst().get(); assertEquals(SecurityContext.allGraphs, x); } { SecurityContext sCxt = authService.get("*"); assertEquals(1, sCxt.visibleGraphs().size()); String x = sCxt.visibleGraphNames().stream().findFirst().get(); assertEquals("http: } }