use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.
the class AuthenticationConfigurationImplTest method testGetLoginCtxProviderWhiteboard.
@Test
public void testGetLoginCtxProviderWhiteboard() throws Exception {
Whiteboard wb = new DefaultWhiteboard();
SecurityProvider sp = mock(SecurityProvider.class, Mockito.withSettings().extraInterfaces(WhiteboardAware.class));
when(((WhiteboardAware) sp).getWhiteboard()).thenReturn(wb);
authConfiguration.setSecurityProvider(sp);
LoginContextProvider lcp = authConfiguration.getLoginContextProvider(repo);
assertTrue(lcp instanceof LoginContextProviderImpl);
Field f = LoginContextProviderImpl.class.getDeclaredField("whiteboard");
f.setAccessible(true);
assertSame(wb, f.get(lcp));
}
use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.
the class InternalSecurityProviderTest method testSetWhiteboard.
@Test
public void testSetWhiteboard() {
Whiteboard wb = new DefaultWhiteboard();
securityProvider.setWhiteboard(wb);
assertSame(wb, securityProvider.getWhiteboard());
}
use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.
the class AbstractUserTest method before.
@Before
public void before() throws Exception {
super.before();
SecurityProvider sp = getSecurityProvider();
Whiteboard wb = null;
if (sp instanceof WhiteboardAware) {
wb = ((WhiteboardAware) sp).getWhiteboard();
}
if (wb == null) {
wb = new DefaultWhiteboard();
}
dynamicMembershipService.start(wb);
}
use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.
the class SlowQueryMetricTest method setUp.
@Before
public void setUp() {
queryEngineSettings.setLimitReads(11);
Whiteboard whiteboard = new DefaultWhiteboard();
whiteboard.register(StatisticsProvider.class, statsProvider, Collections.emptyMap());
oak = new Oak().with(new OpenSecurityProvider()).with(new InitialContent()).with(queryEngineSettings).with(whiteboard);
repository = oak.createContentRepository();
}
use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.
the class L4_CustomAccessControlManagementTest method testImportNodeWithPolicy.
@Test
public void testImportNodeWithPolicy() throws Exception {
Repository jcrRepository = new RepositoryImpl(getContentRepository(), new DefaultWhiteboard(), getSecurityProvider(), Jcr.DEFAULT_OBSERVATION_QUEUE_LENGTH, null, false);
Session adminSession = jcrRepository.login(getAdminCredentials(), null);
try {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<sv:node sv:name=\"another2\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\" xmlns:fn_old=\"http://www.w3.org/2004/10/xpath-functions\" xmlns:fn=\"http://www.w3.org/2005/xpath-functions\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" xmlns:rep=\"internal\" xmlns:jcr=\"http://www.jcp.org/jcr/1.0\">" + "<sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>oak:Unstructured</sv:value></sv:property>" + "<sv:property sv:name=\"jcr:mixinTypes\" sv:type=\"Name\"><sv:value>rep:ThreeRolesMixin</sv:value></sv:property>" + "<sv:node sv:name=\"rep:threeRolesPolicy\" " + "<sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:ThreeRolesPolicy</sv:value></sv:property>" + "<sv:property sv:name=\"rep:readers\" sv:type=\"String\"><sv:value>principalR</sv:value></sv:property>" + "</sv:node>" + "</sv:node>";
adminSession.importXML("/test", new ByteArrayInputStream(xml.getBytes()), ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
Node n = adminSession.getNode("/test/another");
AccessControlPolicy[] policies = adminSession.getAccessControlManager().getPolicies("/test/another");
assertTrue(policies.length > 0);
} finally {
adminSession.refresh(false);
adminSession.logout();
}
}
Aggregations