Search in sources :

Example 71 with ConfigurationException

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();
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) HttpSender(nl.nn.adapterframework.http.HttpSender)

Example 72 with ConfigurationException

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);
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 73 with ConfigurationException

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));
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 74 with ConfigurationException

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() + "]");
    }
}
Also used : AbstractPipe(nl.nn.adapterframework.pipes.AbstractPipe) MessageSendingPipe(nl.nn.adapterframework.pipes.MessageSendingPipe) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) SizeStatisticsKeeper(nl.nn.adapterframework.statistics.SizeStatisticsKeeper) SizeStatisticsKeeper(nl.nn.adapterframework.statistics.SizeStatisticsKeeper) StatisticsKeeper(nl.nn.adapterframework.statistics.StatisticsKeeper)

Example 75 with ConfigurationException

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() + "]");
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) SizeStatisticsKeeper(nl.nn.adapterframework.statistics.SizeStatisticsKeeper) StatisticsKeeper(nl.nn.adapterframework.statistics.StatisticsKeeper)

Aggregations

ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)187 IOException (java.io.IOException)52 PipeRunException (nl.nn.adapterframework.core.PipeRunException)25 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)24 Parameter (nl.nn.adapterframework.parameters.Parameter)20 ArrayList (java.util.ArrayList)19 URL (java.net.URL)17 ParameterList (nl.nn.adapterframework.parameters.ParameterList)16 SAXException (org.xml.sax.SAXException)14 TransformerException (javax.xml.transform.TransformerException)12 Test (org.junit.Test)12 CredentialFactory (nl.nn.adapterframework.util.CredentialFactory)11 HashMap (java.util.HashMap)10 File (java.io.File)9 StringTokenizer (java.util.StringTokenizer)8 Connection (java.sql.Connection)7 Map (java.util.Map)7 ListenerException (nl.nn.adapterframework.core.ListenerException)7 ParameterException (nl.nn.adapterframework.core.ParameterException)7 JdbcException (nl.nn.adapterframework.jdbc.JdbcException)7