use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class PdfPipeTest method multiThreadedMailWithWordAttachment.
@Test
public void multiThreadedMailWithWordAttachment() throws Exception {
pipe.setName("multiThreadedmailWithWordAttachment");
pipe.setAction(DocumentAction.CONVERT);
pipe.registerForward(new PipeForward("success", "dummy"));
pipe.configure();
pipe.start();
PipeLineSession session = new PipeLineSession();
List<URL> inputs = new ArrayList<URL>();
for (int i = 0; i < 5; i++) {
inputs.add(TestFileUtils.getTestFileURL("/PdfPipe/MailWithAttachments/mailWithWordAttachment.msg"));
}
String expected = TestFileUtils.getTestFileMessage("/PdfPipe/xml-results/mailWithWordAttachment.xml").asString();
inputs.parallelStream().forEach(item -> {
try {
PipeRunResult prr = pipe.doPipe(Message.asMessage(new File(item.toURI())), session);
Message result = prr.getResult();
MatchUtils.assertXmlEquals("Conversion XML does not match", applyIgnores(result.asString()), applyIgnores(expected), true);
} catch (Exception e) {
fail("Failed to execute test " + e.getMessage());
}
});
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class PdfPipeTest method executeConversion.
public String executeConversion(String pipeName, String fileToConvert) throws Exception {
pipe.setName(pipeName);
pipe.setAction(DocumentAction.CONVERT);
pipe.configure();
pipe.start();
PipeLineSession session = new PipeLineSession();
URL input = TestFileUtils.getTestFileURL(fileToConvert);
pipe.doPipe(Message.asMessage(new File(input.toURI())), session);
// returns <main conversionOption="0" mediaType="xxx/xxx" documentName="filename" numberOfPages="1" convertedDocument="xxx.pdf" />
return session.getMessage("documents").asString();
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class CmisSender method sendMessage.
@Override
public Message sendMessage(Message message, PipeLineSession session) throws SenderException, TimeoutException {
Session cmisSession = null;
try {
ParameterValueList pvl = null;
if (getParameterList() != null) {
try {
pvl = getParameterList().getValues(message, session);
} catch (ParameterException e) {
throw new SenderException(getLogPrefix() + "Sender [" + getName() + "] caught exception evaluating parameters", e);
}
}
if (runtimeSession) {
cmisSession = createCmisSession(pvl);
} else {
cmisSession = globalSession;
}
switch(getActionEnum()) {
case GET:
return sendMessageForActionGet(cmisSession, message, session, pvl);
case CREATE:
return sendMessageForActionCreate(cmisSession, message, session, pvl);
case DELETE:
return sendMessageForActionDelete(cmisSession, message, session);
case FIND:
return sendMessageForActionFind(cmisSession, message);
case UPDATE:
return sendMessageForActionUpdate(cmisSession, message);
case FETCH:
return sendMessageForDynamicActions(cmisSession, message, session);
case DYNAMIC:
return sendMessageForDynamicActions(cmisSession, message, session);
default:
throw new SenderException(getLogPrefix() + "unknown action [" + getAction() + "]");
}
} finally {
if (cmisSession != null && runtimeSession) {
cmisSession.clear();
cmisSession = null;
}
}
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class IbisDiscoveryService method query.
@Override
public ObjectList query(String repositoryId, String statement, Boolean searchAllVersions, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
if (!eventDispatcher.contains(CmisEvent.QUERY)) {
return discoveryService.query(repositoryId, statement, searchAllVersions, includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension);
} else {
XmlBuilder cmisXml = new XmlBuilder("cmis");
cmisXml.addSubElement(buildXml("repositoryId", repositoryId));
cmisXml.addSubElement(buildXml("statement", statement));
cmisXml.addSubElement(buildXml("searchAllVersions", searchAllVersions));
cmisXml.addSubElement(buildXml("includeAllowableActions", includeAllowableActions));
cmisXml.addSubElement(buildXml("includeRelationships", includeRelationships.name()));
cmisXml.addSubElement(buildXml("renditionFilter", renditionFilter));
cmisXml.addSubElement(buildXml("maxItems", maxItems));
cmisXml.addSubElement(buildXml("skipCount", skipCount));
PipeLineSession context = new PipeLineSession();
context.put(CmisUtils.CMIS_CALLCONTEXT_KEY, callContext);
Element cmisResult = eventDispatcher.trigger(CmisEvent.QUERY, cmisXml.toXML(), context);
Element typesXml = XmlUtils.getFirstChildTag(cmisResult, "objectList");
return CmisUtils.xml2ObjectList(typesXml, context);
}
}
use of nl.nn.adapterframework.core.PipeLineSession in project iaf by ibissource.
the class IbisObjectService method getObject.
@Override
public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extensions) {
if (!eventDispatcher.contains(CmisEvent.GET_OBJECT)) {
return objectService.getObject(repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extensions);
} else {
XmlBuilder cmisXml = new XmlBuilder("cmis");
cmisXml.addSubElement(buildXml("repositoryId", repositoryId));
cmisXml.addSubElement(buildXml("objectId", objectId));
cmisXml.addSubElement(buildXml("filter", filter));
cmisXml.addSubElement(buildXml("includeAllowableActions", includeAllowableActions));
cmisXml.addSubElement(buildXml("includePolicies", includePolicyIds));
cmisXml.addSubElement(buildXml("includeAcl", includeAcl));
PipeLineSession context = new PipeLineSession();
context.put(CmisUtils.CMIS_CALLCONTEXT_KEY, callContext);
Element cmisElement = eventDispatcher.trigger(CmisEvent.GET_OBJECT, cmisXml.toXML(), context);
return CmisUtils.xml2ObjectData(cmisElement, context);
}
}
Aggregations