private void injectEmail(String filePath) throws Exception {
    MessageActionPipe pipe = mailService.getPipe("casemanagementMailBox");
    assertNotNull(pipe);
    Visitor visitor = new Visitor(pipe);
    ExecutionContext initialExecutionContext = new ExecutionContext();
    initialExecutionContext.put(
        MailActionPipeConstants.CORE_SESSION_ID_KEY, session.getSessionId());
    initialExecutionContext.put(
        MailActionPipeConstants.MIMETYPE_SERVICE_KEY, Framework.getService(MimetypeRegistry.class));
    initialExecutionContext.put(
        MailActionPipeConstants.CASEMANAGEMENT_SERVICE_KEY, distributionService);

    Message[] messages = new Message[] {getSampleMessage(filePath)};

    visitor.visit(messages, initialExecutionContext);

    DocumentModel mailFolderRef =
        session.getDocument(new PathRef(CaseConstants.CASE_ROOT_DOCUMENT_PATH));
    assertNotNull(mailFolderRef);
    assertTrue(session.hasChildren(mailFolderRef.getRef()));
  }
Exemplo n.º 2
0
 protected CoreSession getCoreSession(ExecutionContext context) {
   ExecutionContext initialContext = context.getInitialContext();
   return (CoreSession) initialContext.get(CORE_SESSION_KEY);
 }