use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class SendGridSender method configure.
@Override
public void configure() throws ConfigurationException {
super.configure();
if (StringUtils.isEmpty(getCredentialFactory().getPassword())) {
throw new ConfigurationException("Please provide an API key");
}
httpSender = new HttpSender();
httpSender.setUrl(url);
httpSender.configure();
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class XsltErrorTestBase method importNotFoundXslt1.
@Test
public void importNotFoundXslt1() throws Exception {
setStyleSheetName("/Xslt/importNotFound/root.no-validate-xsl");
setXslt2(false);
String errorMessage = null;
try {
pipe.configure();
fail("Expected to run into an exception");
} catch (ConfigurationException e) {
errorMessage = e.getMessage();
assertThat(errorMessage, containsString(FILE_NOT_FOUND_EXCEPTION));
}
checkTestAppender(1, FILE_NOT_FOUND_EXCEPTION);
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class XsltErrorTestBase method notifyXalanExtensionsIllegalForSaxon.
@Test
public void notifyXalanExtensionsIllegalForSaxon() throws SenderException, TimeoutException, ConfigurationException, IOException, PipeRunException, PipeStartException {
setStyleSheetName("/Xslt/XalanExtension/XalanExtension.xsl");
setXslt2(true);
String errorMessage = null;
try {
pipe.configure();
fail("expected configuration to fail");
} catch (ConfigurationException e) {
log.warn("final exception: " + e.getMessage());
errorMessage = e.getMessage();
assertThat(errorMessage, containsString("Cannot find a matching 2-argument function named {http://exslt.org/strings}tokenize()"));
}
assertThat("number of alerts in logging " + testAppender.getLogLines(), testAppender.getNumberOfAlerts(), is(2 + EXPECTED_NUMBER_OF_DUPLICATE_LOGGINGS));
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class PipeLine method configure.
public void configure(IPipe pipe) throws ConfigurationException {
try {
if (pipe instanceof IExtendedPipe) {
IExtendedPipe epipe = (IExtendedPipe) pipe;
// Temporary here because of validators and wrappers
epipe.setPipeLine(this);
if (epipe.getDurationThreshold() >= 0) {
epipe.registerEvent(IExtendedPipe.LONG_DURATION_MONITORING_EVENT);
}
epipe.registerEvent(IExtendedPipe.PIPE_EXCEPTION_MONITORING_EVENT);
if (getMessageSizeWarnNum() >= 0) {
epipe.registerEvent(IExtendedPipe.MESSAGE_SIZE_MONITORING_EVENT);
}
if (epipe.hasSizeStatistics()) {
if (pipe instanceof AbstractPipe) {
AbstractPipe aPipe = (AbstractPipe) pipe;
if (aPipe.getInSizeStatDummyObject() != null) {
pipeSizeStats.put(aPipe.getInSizeStatDummyObject().getName(), new SizeStatisticsKeeper(aPipe.getInSizeStatDummyObject().getName()));
}
if (aPipe.getOutSizeStatDummyObject() != null) {
pipeSizeStats.put(aPipe.getOutSizeStatDummyObject().getName(), new SizeStatisticsKeeper(aPipe.getOutSizeStatDummyObject().getName()));
}
} else {
pipeSizeStats.put(pipe.getName(), new SizeStatisticsKeeper(pipe.getName()));
}
}
}
pipe.configure();
for (PipeForward forward : pipe.getForwards().values()) {
String path = forward.getPath();
if (path != null) {
PipeLineExit plExit = getPipeLineExits().get(path);
if (plExit == null && getPipe(path) == null) {
ConfigurationWarnings.add(pipe, log, "has a forward of which the pipe to execute [" + path + "] is not defined");
}
}
}
if (pipe instanceof MessageSendingPipe) {
MessageSendingPipe messageSendingPipe = (MessageSendingPipe) pipe;
if (messageSendingPipe.getMessageLog() != null) {
pipeStatistics.put(messageSendingPipe.getMessageLog().getName(), new StatisticsKeeper(messageSendingPipe.getMessageLog().getName()));
}
}
pipeStatistics.put(pipe.getName(), new StatisticsKeeper(pipe.getName()));
// congestionSensors.addSensor(pipe);
} catch (Throwable t) {
throw new ConfigurationException("Exception configuring " + ClassUtils.nameOf(pipe), t);
}
if (log.isDebugEnabled()) {
log.debug(getLogPrefix() + "pipe [" + pipe.getName() + "] successfully configured: [" + pipe.toString() + "]");
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class PipeLine method addPipe.
/**
* Register an Pipe at this pipeline.
* The name is also put in the globalForwards table (with
* forward-name=pipename and forward-path=pipename, so that
* pipe can look for a specific pipe-name. If already a globalForward
* exists under that name, the pipe is NOT added, allowing globalForwards
* to prevail.
* @see AbstractPipe
* @ff.mandatory
*/
public void addPipe(IPipe pipe) throws ConfigurationException {
if (pipe == null) {
throw new ConfigurationException("pipe to be added is null, pipelineTable size [" + pipesByName.size() + "]");
}
String name = pipe.getName();
if (StringUtils.isEmpty(name)) {
throw new ConfigurationException("pipe [" + ClassUtils.nameOf(pipe) + "] to be added has no name, pipelineTable size [" + pipesByName.size() + "]");
}
IPipe current = getPipe(name);
if (current != null) {
throw new ConfigurationException("pipe [" + name + "] defined more then once");
}
pipesByName.put(name, pipe);
pipes.add(pipe);
if (pipe.getMaxThreads() > 0) {
pipeWaitingStatistics.put(name, new StatisticsKeeper(name));
}
log.debug("added pipe [" + pipe.toString() + "]");
// Add this pipe's name to the pipeline's Global-Forwards list. @See XmlSwitch
if (globalForwards.get(name) == null) {
PipeForward pw = new PipeForward();
pw.setName(name);
pw.setPath(name);
registerForward(pw);
} else {
log.info("already had a pipeForward with name [" + name + "] skipping the implicit one to Pipe [" + pipe.getName() + "]");
}
}
Aggregations