use of org.xwiki.mail.script.ScriptServicePermissionChecker in project xwiki-platform by xwiki.
the class ScriptingIntegrationTest method registerConfiguration.
@BeforeComponent
public void registerConfiguration() throws Exception {
MailSenderConfiguration configuration = new TestMailSenderConfiguration(this.mail.getSmtp().getPort(), null, null, new Properties());
this.componentManager.registerComponent(MailSenderConfiguration.class, configuration);
// Register a test Permission Checker that allows sending mails
ScriptServicePermissionChecker checker = mock(ScriptServicePermissionChecker.class);
this.componentManager.registerComponent(ScriptServicePermissionChecker.class, "test", checker);
// Set the current wiki in the Context
ModelContext modelContext = this.componentManager.registerMockComponent(ModelContext.class);
Mockito.when(modelContext.getCurrentEntityReference()).thenReturn(new WikiReference("wiki"));
Provider<XWikiContext> xwikiContextProvider = this.componentManager.registerMockComponent(XWikiContext.TYPE_PROVIDER);
when(xwikiContextProvider.get()).thenReturn(Mockito.mock(XWikiContext.class));
this.componentManager.registerMockComponent(ExecutionContextManager.class);
this.componentManager.registerMockComponent(new DefaultParameterizedType(null, Copier.class, ExecutionContext.class));
EnvironmentConfiguration environmentConfiguration = this.componentManager.registerMockComponent(EnvironmentConfiguration.class);
when(environmentConfiguration.getPermanentDirectoryPath()).thenReturn(System.getProperty("java.io.tmpdir"));
this.componentManager.registerMockComponent(ConverterManager.class);
}
Aggregations