Search in sources :

Example 1 with XWikiBridge

use of org.xwiki.security.internal.XWikiBridge in project xwiki-platform by xwiki.

the class DefaultAuthorizationManagerIntegrationTest method initializeMocks.

@BeforeComponent
public void initializeMocks() throws Exception {
    cache = new TestCache<Object>();
    final CacheManager cacheManager = componentManager.registerMockComponent(CacheManager.class);
    when(cacheManager.createNewCache(any(CacheConfiguration.class))).thenReturn(cache);
    xWikiBridge = componentManager.registerMockComponent(XWikiBridge.class);
    userBridge = componentManager.registerMockComponent(UserBridge.class);
    securityEntryReader = componentManager.registerMockComponent(SecurityEntryReader.class);
    securityCacheRulesInvalidator = componentManager.registerMockComponent(SecurityCacheRulesInvalidator.class);
}
Also used : UserBridge(org.xwiki.security.internal.UserBridge) CacheManager(org.xwiki.cache.CacheManager) XWikiBridge(org.xwiki.security.internal.XWikiBridge) CacheConfiguration(org.xwiki.cache.config.CacheConfiguration) SecurityCacheRulesInvalidator(org.xwiki.security.authorization.cache.SecurityCacheRulesInvalidator) BeforeComponent(org.xwiki.test.annotation.BeforeComponent)

Example 2 with XWikiBridge

use of org.xwiki.security.internal.XWikiBridge in project xwiki-platform by xwiki.

the class DefaultSecurityCacheLoaderTest method setUp.

@Before
public void setUp() throws Exception {
    XWikiBridge bridge = mocker.registerMockComponent(XWikiBridge.class);
    when(bridge.getMainWikiReference()).thenReturn(new WikiReference("wiki"));
    securityReferenceFactory = mocker.getInstance(SecurityReferenceFactory.class);
    mocker.registerMockComponent(SecurityCache.class);
    mocker.registerMockComponent(SecurityCacheRulesInvalidator.class);
    mocker.registerMockComponent(SecurityEntryReader.class);
    mocker.registerMockComponent(UserBridge.class);
    mocker.registerMockComponent(AuthorizationSettler.class);
    securityCacheLoader = mocker.getInstance(SecurityCacheLoader.class);
}
Also used : DefaultSecurityReferenceFactory(org.xwiki.security.DefaultSecurityReferenceFactory) SecurityReferenceFactory(org.xwiki.security.SecurityReferenceFactory) XWikiBridge(org.xwiki.security.internal.XWikiBridge) WikiReference(org.xwiki.model.reference.WikiReference) SecurityCacheLoader(org.xwiki.security.authorization.cache.SecurityCacheLoader) Before(org.junit.Before)

Example 3 with XWikiBridge

use of org.xwiki.security.internal.XWikiBridge in project xwiki-platform by xwiki.

the class DefaultSecurityCacheTest method configure.

@Before
public void configure() throws Exception {
    if (cache == null) {
        cache = new TestCache<Object>();
        final CacheManager cacheManager = securityCacheMocker.getInstance(CacheManager.class);
        when(cacheManager.createNewCache(any(CacheConfiguration.class))).thenReturn(cache);
    }
    XWikiBridge xwikiBridge = securityReferenceFactoryMocker.getInstance(XWikiBridge.class);
    when(xwikiBridge.getMainWikiReference()).thenReturn(new WikiReference("xwiki"));
    this.factory = securityReferenceFactoryMocker.getComponentUnderTest();
    this.securityCache = securityCacheMocker.getComponentUnderTest();
    aMissingParentRef = factory.newEntityReference(new SpaceReference("space", new WikiReference("missing")));
    aMissingEntityRef = factory.newEntityReference(new DocumentReference("missingPage", xspaceRef.getOriginalSpaceReference()));
    aMissingUserRef = factory.newUserReference(new DocumentReference("missingUser", xXWikiSpace.getOriginalSpaceReference()));
    aMissingGroupRef = factory.newGroupReference(new DocumentReference("missingGroup", xXWikiSpace.getOriginalSpaceReference()));
    aMissingWikiRef = factory.newEntityReference(new WikiReference("missingWiki"));
}
Also used : SpaceReference(org.xwiki.model.reference.SpaceReference) CacheManager(org.xwiki.cache.CacheManager) XWikiBridge(org.xwiki.security.internal.XWikiBridge) WikiReference(org.xwiki.model.reference.WikiReference) CacheConfiguration(org.xwiki.cache.config.CacheConfiguration) DocumentReference(org.xwiki.model.reference.DocumentReference) Before(org.junit.Before)

Example 4 with XWikiBridge

use of org.xwiki.security.internal.XWikiBridge in project xwiki-platform by xwiki.

the class SecurityReferenceTest method configure.

@Before
public void configure() throws Exception {
    XWikiBridge xwikiBridge = securityReferenceFactoryMocker.getInstance(XWikiBridge.class);
    when(xwikiBridge.getMainWikiReference()).thenReturn(new WikiReference("xwiki"));
    factory = securityReferenceFactoryMocker.getComponentUnderTest();
}
Also used : XWikiBridge(org.xwiki.security.internal.XWikiBridge) WikiReference(org.xwiki.model.reference.WikiReference) Before(org.junit.Before)

Aggregations

XWikiBridge (org.xwiki.security.internal.XWikiBridge)4 Before (org.junit.Before)3 WikiReference (org.xwiki.model.reference.WikiReference)3 CacheManager (org.xwiki.cache.CacheManager)2 CacheConfiguration (org.xwiki.cache.config.CacheConfiguration)2 DocumentReference (org.xwiki.model.reference.DocumentReference)1 SpaceReference (org.xwiki.model.reference.SpaceReference)1 DefaultSecurityReferenceFactory (org.xwiki.security.DefaultSecurityReferenceFactory)1 SecurityReferenceFactory (org.xwiki.security.SecurityReferenceFactory)1 SecurityCacheLoader (org.xwiki.security.authorization.cache.SecurityCacheLoader)1 SecurityCacheRulesInvalidator (org.xwiki.security.authorization.cache.SecurityCacheRulesInvalidator)1 UserBridge (org.xwiki.security.internal.UserBridge)1 BeforeComponent (org.xwiki.test.annotation.BeforeComponent)1