Search in sources :

Example 1 with VelocityMacro

use of org.xwiki.rendering.internal.macro.velocity.VelocityMacro in project xwiki-platform by xwiki.

the class VelocityMacroSecurityTest method setUp.

@Before
public void setUp() throws Exception {
    authorizationManager = mocker.registerMockComponent(ContextualAuthorizationManager.class);
    BeanDescriptor mockBeanDescriptor = mock(BeanDescriptor.class);
    when(mockBeanDescriptor.getProperties()).thenReturn(Collections.EMPTY_LIST);
    BeanManager beanManager = mocker.getInstance(BeanManager.class);
    when(beanManager.getBeanDescriptor(any(Class.class))).thenReturn(mockBeanDescriptor);
    Macro velocityMacro = mocker.getComponentUnderTest();
    MacroManager mockMacroManager = mocker.registerMockComponent(MacroManager.class);
    when(mockMacroManager.getMacro(any(MacroId.class))).thenReturn(velocityMacro);
}
Also used : ContextualAuthorizationManager(org.xwiki.security.authorization.ContextualAuthorizationManager) BeanDescriptor(org.xwiki.properties.BeanDescriptor) VelocityMacro(org.xwiki.rendering.internal.macro.velocity.VelocityMacro) Macro(org.xwiki.rendering.macro.Macro) MacroId(org.xwiki.rendering.macro.MacroId) MacroManager(org.xwiki.rendering.macro.MacroManager) BeanManager(org.xwiki.properties.BeanManager) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 BeanDescriptor (org.xwiki.properties.BeanDescriptor)1 BeanManager (org.xwiki.properties.BeanManager)1 VelocityMacro (org.xwiki.rendering.internal.macro.velocity.VelocityMacro)1 Macro (org.xwiki.rendering.macro.Macro)1 MacroId (org.xwiki.rendering.macro.MacroId)1 MacroManager (org.xwiki.rendering.macro.MacroManager)1 ContextualAuthorizationManager (org.xwiki.security.authorization.ContextualAuthorizationManager)1