use of nl.nn.adapterframework.core.PipeLine in project iaf by ibissource.
the class AbstractPipe method getForwards.
@Override
public Map<String, PipeForward> getForwards() {
Map<String, PipeForward> forwards = new Hashtable<String, PipeForward>(pipeForwards);
PipeLine pipeline = getPipeLine();
if (pipeline == null) {
return null;
}
// Omit global pipeline-forwards and only return local pipe-forwards
List<IPipe> pipes = pipeline.getPipes();
for (int i = 0; i < pipes.size(); i++) {
String pipeName = pipes.get(i).getName();
if (forwards.containsKey(pipeName))
forwards.remove(pipeName);
}
return forwards;
}
use of nl.nn.adapterframework.core.PipeLine in project iaf by ibissource.
the class WsdlGeneratorPipe method createPipeLineFromXsdFile.
private PipeLine createPipeLineFromXsdFile(File xsdFile) throws ConfigurationException {
PipeLine pipeLine = new PipeLine();
EsbSoapValidator inputValidator;
inputValidator = createValidator(xsdFile, null, null, 1, 1, pipeLine);
pipeLine.setInputValidator(inputValidator);
String countRoot = null;
try {
String countRootXPath = "count(*/*[local-name()='element'])";
TransformerPool tp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(countRootXPath, OutputType.TEXT));
Resource xsdResource = Resource.getResource(xsdFile.getPath());
countRoot = tp.transform(xsdResource.asSource());
if (StringUtils.isNotEmpty(countRoot)) {
log.debug("counted [" + countRoot + "] root elements in xsd file [" + xsdFile.getName() + "]");
int cr = Integer.parseInt(countRoot);
if (cr > 1) {
EsbSoapValidator outputValidator;
outputValidator = createValidator(xsdFile, null, null, 2, 1, pipeLine);
pipeLine.setOutputValidator(outputValidator);
}
}
} catch (Exception e) {
throw new ConfigurationException(e);
}
return pipeLine;
}
use of nl.nn.adapterframework.core.PipeLine in project iaf by ibissource.
the class ApiTestBase method registerAdapter.
protected void registerAdapter(TestConfiguration configuration) throws Exception {
Adapter adapter = configuration.createBean(Adapter.class);
adapter.setName("dummyAdapter");
try {
PipeLine pipeline = new PipeLine();
PipeLineExit exit = new PipeLineExit();
exit.setPath("EXIT");
exit.setState(ExitState.SUCCESS);
pipeline.registerPipeLineExit(exit);
EchoPipe pipe = new EchoPipe();
pipe.setName("myPipe");
pipeline.addPipe(pipe);
adapter.setPipeLine(pipeline);
configuration.registerAdapter(adapter);
} catch (ConfigurationException e) {
e.printStackTrace();
fail("error registering adapter [" + adapter + "] " + e.getMessage());
}
configuration.getConfigurationWarnings().add((Object) null, log, "hello I am a configuration warning!");
}
use of nl.nn.adapterframework.core.PipeLine in project iaf by ibissource.
the class InputOutputPipeProcessorTest method setUp.
@Before
public void setUp() {
processor = new InputOutputPipeProcessor();
PipeProcessor chain = new PipeProcessor() {
@Override
public PipeRunResult processPipe(PipeLine pipeLine, IPipe pipe, Message message, PipeLineSession pipeLineSession) throws PipeRunException {
return pipe.doPipe(message, pipeLineSession);
}
@Override
public PipeRunResult validate(PipeLine pipeLine, IValidator validator, Message message, PipeLineSession pipeLineSession, String messageRoot) throws PipeRunException {
return validator.validate(message, pipeLineSession, messageRoot);
}
};
processor.setPipeProcessor(chain);
pipeLine = new PipeLine();
Adapter owner = new Adapter();
owner.setName("PipeLine owner");
pipeLine.setOwner(owner);
session = new PipeLineSession();
}
use of nl.nn.adapterframework.core.PipeLine in project iaf by ibissource.
the class ClassLoaderManagerTest method createAdapter4ServiceClassLoader.
private static void createAdapter4ServiceClassLoader(String config4Adaptername) throws ConfigurationException {
// Mock a configuration with an adapter in it
IbisManager ibisManager = spy(new DefaultIbisManager());
ibisManager.setIbisContext(ibisContext);
Configuration configuration = new TestConfiguration();
configuration.setName("dummyConfiguration");
configuration.setVersion("1");
configuration.setIbisManager(ibisManager);
Adapter adapter = spy(new Adapter());
adapter.setName(config4Adaptername);
PipeLine pl = new PipeLine();
pl.setFirstPipe("dummy");
EchoPipe pipe = new EchoPipe();
pipe.setName("dummy");
pl.addPipe(pipe);
PipeLineExit ple = new PipeLineExit();
ple.setPath("success");
ple.setState(ExitState.SUCCESS);
pl.registerPipeLineExit(ple);
adapter.setPipeLine(pl);
doAnswer(new Answer<PipeLineResult>() {
@Override
public PipeLineResult answer(InvocationOnMock invocation) throws Throwable {
PipeLineSession session = (PipeLineSession) invocation.getArguments()[2];
URL file = this.getClass().getResource(JAR_FILE);
session.put("configurationJar", Misc.streamToBytes(file.openStream()));
return new PipeLineResult();
}
}).when(adapter).processMessage(anyString(), any(Message.class), any(PipeLineSession.class));
adapter.setConfiguration(configuration);
configuration.registerAdapter(adapter);
ibisManager.addConfiguration(configuration);
when(ibisContext.getIbisManager()).thenReturn(ibisManager);
}
Aggregations