Java 类org.apache.camel.component.properties.PropertiesComponent 实例源码

项目:camel-isds    文件:ISDSTestBase.java   
@Before
public void initProperties() throws Exception {
    log.info("Setting up test properties from {}", getPathToConfigProperties());
    PropertiesComponent testProperties = context.getComponent("properties", PropertiesComponent.class);
    testProperties.setLocation(getPathToConfigProperties());

    log.info("init databox ids and manager");
    ovmId = context.resolvePropertyPlaceholders("{{isds.ovm.id}}");
    foId = context.resolvePropertyPlaceholders("{{isds.fo.id}}");
    fo2Id = context.resolvePropertyPlaceholders("{{isds.fo2.id}}");

    String username = context.resolvePropertyPlaceholders("{{isds.fo.login}}");
    String password = context.resolvePropertyPlaceholders("{{isds.fo.password}}");
    authFo = new BasicAuthentication(TEST_CONFIG, username, password);
    manager = new DataBoxManager(TEST_CONFIG, authFo);

    // mark all messages as read to have clean state every time
    // unfortunately isds doesn't allow deleting
    markMessagesRead(context.resolvePropertyPlaceholders("{{isds.ovm.login}}"), context.resolvePropertyPlaceholders("{{isds.ovm.password"));
    markMessagesRead(context.resolvePropertyPlaceholders("{{isds.fo.login}}"), context.resolvePropertyPlaceholders("{{isds.fo.password"));
    markMessagesRead(context.resolvePropertyPlaceholders("{{isds.fo2.login}}"), context.resolvePropertyPlaceholders("{{isds.fo2.password"));
}
项目:Camel    文件:MyFtpClientRouteBuilder.java   
@Override
public void configure() throws Exception {
    // configure properties component
    PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
    pc.setLocation("classpath:ftp.properties");

    // lets shutdown faster in case of in-flight messages stack up
    getContext().getShutdownStrategy().setTimeout(10);

    from("file:target/upload?moveFailed=../error")
        .log("Uploading file ${file:name}")
        .to("{{ftp.client}}")
        .log("Uploaded file ${file:name} complete.");

    // use system out so it stand out
    System.out.println("*********************************************************************************");
    System.out.println("Camel will route files from target/upload directory to the FTP server: "
            + getContext().resolvePropertyPlaceholders("{{ftp.server}}"));
    System.out.println("You can configure the location of the ftp server in the src/main/resources/ftp.properties file.");
    System.out.println("If the file upload fails, then the file is moved to the target/error directory.");
    System.out.println("Use ctrl + c to stop this application.");
    System.out.println("*********************************************************************************");
}
项目:Camel    文件:MyFtpServerRouteBuilder.java   
@Override
public void configure() throws Exception {
    // configure properties component
    PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
    pc.setLocation("classpath:ftp.properties");

    // lets shutdown faster in case of in-flight messages stack up
    getContext().getShutdownStrategy().setTimeout(10);

    from("{{ftp.server}}")
        .to("file:target/download")
        .log("Downloaded file ${file:name} complete.");

    // use system out so it stand out
    System.out.println("*********************************************************************************");
    System.out.println("Camel will route files from the FTP server: "
            + getContext().resolvePropertyPlaceholders("{{ftp.server}}") + " to the target/download directory.");
    System.out.println("You can configure the location of the ftp server in the src/main/resources/ftp.properties file.");
    System.out.println("Use ctrl + c to stop this application.");
    System.out.println("*********************************************************************************");
}
项目:Camel    文件:IntrospectionSupport.java   
private static boolean isPropertyPlaceholder(CamelContext context, Object value) {
    if (context != null) {
        Component component = context.hasComponent("properties");
        if (component != null) {
            PropertiesComponent pc;
            try {
                pc = context.getTypeConverter().mandatoryConvertTo(PropertiesComponent.class, component);
            } catch (Exception e) {
                return false;
            }
            if (value.toString().contains(pc.getPrefixToken()) && value.toString().contains(pc.getSuffixToken())) {
                return true;
            }
        }
    }
    return false;
}
项目:Camel    文件:DefaultCamelContext.java   
public void addComponent(String componentName, final Component component) {
    ObjectHelper.notNull(component, "component");
    synchronized (components) {
        if (components.containsKey(componentName)) {
            throw new IllegalArgumentException("Cannot add component as its already previously added: " + componentName);
        }
        component.setCamelContext(this);
        components.put(componentName, component);
        for (LifecycleStrategy strategy : lifecycleStrategies) {
            strategy.onComponentAdd(componentName, component);
        }

        // keep reference to properties component up to date
        if (component instanceof PropertiesComponent && "properties".equals(componentName)) {
            propertiesComponent = (PropertiesComponent) component;
        }
    }
}
项目:Camel    文件:PropertiesAvailableEverywhereTest.java   
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();

    final Properties properties = new Properties();
    properties.put("foo", "bar");
    PropertiesComponent pc = camelContext.getComponent("properties", PropertiesComponent.class);
    pc.setLocations(new String[0]);
    pc.setPropertiesResolver(new PropertiesResolver() {
        @Override
        public Properties resolveProperties(CamelContext context, boolean ignoreMissingLocation, String... uri) {
            return properties;
        }
    });

    return camelContext;
}
项目:Camel    文件:RouteAutoStartupTest.java   
public void testRouteAutoStartedUsingProperties() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {

            PropertiesComponent properties = new PropertiesComponent();
            properties.setLocation("classpath:org/apache/camel/processor/routeAutoStartupTest.properties");
            context.addComponent("properties", properties);

            from("direct:start").autoStartup("{{autoStartupProp}}").to("mock:result");
        }
    });
    context.start();

    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(1);
    template.sendBody("direct:start", "Hello World");
    assertMockEndpointsSatisfied();
}
项目:Camel    文件:FilerProducerDoneFileNameRouteTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            myProp.put("myDir", "target/done");

            PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
            pc.setLocation("ref:myProp");

            from("direct:start")
                .to("file:{{myDir}}?doneFileName=done-${file:name}")
                .to("mock:result");
        }
    };
}
项目:Camel    文件:GroovySetHeaderPropertyComponentTest.java   
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        public void configure() throws Exception {
            PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
            pc.setLocation("org/apache/camel/builder/script/myproperties.properties");

            from("direct:start")
                .setHeader("myHeader").groovy("context.resolvePropertyPlaceholders('{{' + request.headers.get('foo') + '}}')")
                .to("mock:result");

            from("direct:number")
                .transform().groovy("{{myscript}}")
                .to("mock:result");
        }
    };
}
项目:Camel    文件:JasyptPropertiesTest.java   
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();

    // START SNIPPET: e1
    // create the jasypt properties parser
    JasyptPropertiesParser jasypt = new JasyptPropertiesParser();
    // and set the master password
    jasypt.setPassword("secret");

    // create the properties component
    PropertiesComponent pc = new PropertiesComponent();
    pc.setLocation("classpath:org/apache/camel/component/jasypt/myproperties.properties");
    // and use the jasypt properties parser so we can decrypt values
    pc.setPropertiesParser(jasypt);

    // add properties component to camel context
    context.addComponent("properties", pc);
    // END SNIPPET: e1

    return context;
}
项目:Camel    文件:CamelServletContextListener.java   
/**
 * Initializes the property placeholders by registering the {@link PropertiesComponent} with
 * the configuration from the given init parameters.
 */
private void initPropertyPlaceholder(ServletCamelContext camelContext, Map<String, Object> parameters) throws Exception {
    // setup property placeholder first
    Map<String, Object> properties = IntrospectionSupport.extractProperties(parameters, "propertyPlaceholder.");
    if (properties != null && !properties.isEmpty()) {
        PropertiesComponent pc = new PropertiesComponent();
        IntrospectionSupport.setProperties(pc, properties);
        // validate we could set all parameters
        if (!properties.isEmpty()) {
            throw new IllegalArgumentException("Error setting propertyPlaceholder parameters on CamelContext."
                    + " There are " + properties.size() + " unknown parameters. [" + properties + "]");
        }
        // register the properties component
        camelContext.addComponent("properties", pc);
    }
}
项目:camelinaction2    文件:SecuringConfigTest.java   
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();

 // create the jasypt properties parser
    JasyptPropertiesParser jasypt = new JasyptPropertiesParser();
    // and set the master password
    jasypt.setPassword("supersecret");   

    // we can avoid keeping the master password in plaintext in the application
    // by referencing a environment variable
    // export CAMEL_ENCRYPTION_PASSWORD=supersecret
    // jasypt.setPassword("sysenv:CAMEL_ENCRYPTION_PASSWORD");

    // setup the properties component to use the production file
    PropertiesComponent prop = context.getComponent("properties", PropertiesComponent.class);
    prop.setLocation("classpath:rider-test.properties");

    // and use the jasypt properties parser so we can decrypt values
    prop.setPropertiesParser(jasypt);

    return context;
}
项目:camelinaction2    文件:XARollbackAfterDbTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
            pc.setLocation("camelinaction/sql.properties");

            from("activemq:queue:partners")
                    .transacted()
                    .log("*** transacted ***")
                    .bean(PartnerServiceBean.class, "toMap")
                    .log("*** before SQL ***")
                    .to("sql:{{sql-insert}}?dataSource=#myDataSource")
                    .log("*** after SQL ***")
                    .throwException(new IllegalArgumentException("Forced failure after DB"));
        }
    };
}
项目:camelinaction2    文件:XACommitTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
            pc.setLocation("camelinaction/sql.properties");

            from("activemq:queue:partners")
                .transacted()
                .log("*** transacted ***")
                .bean(PartnerServiceBean.class, "toMap")
                .log("*** before SQL ***")
                .to("sql:{{sql-insert}}?dataSource=#myDataSource")
                .log("*** after SQL ***")
                .to("mock:result");
        }
    };
}
项目:camelinaction2    文件:XARollbackBeforeDbTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
            pc.setLocation("camelinaction/sql.properties");

            from("activemq:queue:partners")
                .transacted()
                .log("*** transacted ***")
                .bean(PartnerServiceBean.class, "toMap")
                .log("*** before SQL ***")
                .throwException(new IllegalArgumentException("Forced failure before DB"))
                .to("sql:{{sql-insert}}?dataSource=#myDataSource")
                .log("*** after SQL ***");
        }
    };
}
项目:camelinaction2    文件:FtpToJMSWithPropertyPlaceholderTest.java   
@Override
protected CamelContext createCamelContext() throws Exception {
    // create CamelContext
    CamelContext camelContext = super.createCamelContext();

    // connect to embedded ActiveMQ JMS broker
    ConnectionFactory connectionFactory = 
        new ActiveMQConnectionFactory("vm://localhost");
    camelContext.addComponent("jms",
        JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));

    // setup the properties component to use the test file
    PropertiesComponent prop = camelContext.getComponent("properties", PropertiesComponent.class);
    prop.setLocation("classpath:rider-test.properties");        

    return camelContext;
}
项目:metasfresh    文件:Util.java   
public static void readProperties(
        final CamelContext context,
        final String... propertiesLocations)
{
    if (context.hasComponent("properties") == null)
    {
        final StringBuilder msg = new StringBuilder("Going to add a PropertiesComponent with propertiesLocation(s)=");
        for (final String loc : propertiesLocations)
        {
            msg.append(loc + " ");
        }
        LOGGER.info(msg.toString());

        final PropertiesComponent pc = new PropertiesComponent();
        pc.setLocations(propertiesLocations);
        context.addComponent("properties", pc);
    }
}
项目:metasfresh    文件:Util.java   
public static void readProperties(
        final CamelContext context,
        final String... propertiesLocations)
{
    if (context.hasComponent("properties") == null)
    {
        final StringBuilder msg = new StringBuilder("Going to add a PropertiesComponent with propertiesLocation(s)=");
        for (final String loc : propertiesLocations)
        {
            msg.append(loc + " ");
        }
        Util.LOGGER.info(msg.toString());

        final PropertiesComponent pc = new PropertiesComponent();
        pc.setLocations(propertiesLocations);
        context.addComponent("properties", pc);
    }
}
项目:switchyard    文件:CamelActivator.java   
@Override
public ServiceHandler activateService(QName serviceName, ComponentModel config) {
    ServiceHandler handler = null;

    // add switchyard property parser to camel PropertiesComponent
    PropertiesComponent propertiesComponent = getCamelContext().getComponent("properties", PropertiesComponent.class);
    PropertyResolver pr = config.getModelConfiguration().getPropertyResolver();
    propertiesComponent.setPropertiesParser(new SwitchYardPropertiesParser(pr));

    // process service
    for (ComponentServiceModel service : config.getServices()) {
        if (service.getQName().equals(serviceName)) {
            handler = handleImplementation(service, serviceName);
            break;
        }
    }

    return handler;
}
项目:IDEAConfigSync    文件:MoreRouterBuilders.java   
/**
 * <b>Called on initialization to build the routes using the fluent builder syntax.</b>
 * <p/>
 * This is a central method for RouteBuilder implementations to implement
 * the routes using the Java fluent builder syntax.
 *
 * @throws Exception can be thrown during configuration
 */
@Override
public void configure() throws Exception {
    // configure properties component
    PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
    pc.setLocation("classpath:ftp.properties");
    // lets shutdown faster in case of in-flight messages stack up
    getContext().getShutdownStrategy().setTimeout(10);

    from("file:target/upload?moveFailed=../error")
            .log("Uploading file ${file:name}")
            .to("{{ftp.client}}")
            .log("Uploaded file ${file:name} complete.");

    // use system out so it stand out
    System.out.println("*********************************************************************************");
    System.out.println("Camel will route files from target/upload directory to the FTP server: "
            + getContext().resolvePropertyPlaceholders("{{ftp.server}}"));
    System.out.println("You can configure the location of the ftp server in the src/main/resources/ftp.properties file.");
    System.out.println("If the file upload fails, then the file is moved to the target/error directory.");
    System.out.println("Use ctrl + c to stop this application.");
    System.out.println("*********************************************************************************");

}
项目:camel-cookbook-examples    文件:EncryptedPropertiesPasswordInSystemPropertyTest.java   
@Override
public CamelContext createCamelContext() {
    // normally this would be set along the lines of -DjasyptMasterPassword=encryptionPassword
    // in a place appropriate to the runtime
    System.setProperty("jasyptMasterPassword", "encryptionPassword");

    JasyptPropertiesParser propParser = new JasyptPropertiesParser();
    propParser.setPassword("sys:jasyptMasterPassword");

    PropertiesComponent propComponent = new PropertiesComponent();
    propComponent.setLocation("classpath:placeholder.properties");
    propComponent.setPropertiesParser(propParser);

    CamelContext camelContext = new DefaultCamelContext();
    camelContext.addComponent("properties", propComponent);
    return camelContext;
}
项目:drinkwater-java    文件:Service.java   
public PropertiesComponent getPropertiesComponent() {
    if (propertiesComponent == null) {
        propertiesComponent = camelContext.getComponent(
                "properties", PropertiesComponent.class);
    }
    return propertiesComponent;
}
项目:drinkwater-java    文件:DrinkWaterApplication.java   
public PropertiesComponent getPropertiesComponent() {
    if (propertiesComponent == null) {
        propertiesComponent = applicationLevelContext.getComponent(
                "properties", PropertiesComponent.class);
    }
    return propertiesComponent;
}
项目:openex-worker    文件:EmailDownloader.java   
@SuppressWarnings({"unused", "unchecked"})
public void process(Exchange exchange) {
    Message in = exchange.getIn();
    List attachments = in.getHeader(ATTACHMENTS, List.class);
    if (attachments != null) {
        String user = exchange.getIn().getHeader("To", String.class);
        List<EmailAttachment> filesContent = (List) exchange.getProperty(ATTACHMENTS_CONTENT, new ArrayList<>());
        for (Object attachment : attachments) {
            try {
                Map attachmentMap = (Map) attachment;
                String file_id = attachmentMap.get(FILE_ID).toString();
                String file_name = attachmentMap.get(FILE_NAME).toString();
                PropertiesComponent p = exchange.getContext().getComponent("properties", PropertiesComponent.class);
                String attachmentUri = p.parseUri("{{openex.api}}") + p.parseUri("{{openex_email.attachment_uri}}");
                URL attachmentURL = new URL(attachmentUri + "/" + file_id);
                HttpURLConnection urlConnection = (HttpURLConnection) attachmentURL.openConnection();
                urlConnection.setRequestProperty(AUTHORIZATION, p.parseUri("{{openex.token}}"));
                byte[] content = IOUtils.toByteArray(urlConnection.getInputStream());
                filesContent.add(new EmailAttachment(file_name, content, urlConnection.getContentType()));
            } catch (FileNotFoundException fileNotFound) {
                //Don't care because file was removed after his inject configuration.
            } catch (Exception e) {
                throw new RuntimeException(user + " error: Failed to download files");
            }
        }
        exchange.setProperty(ATTACHMENTS_CONTENT, filesContent);
    }
}
项目:openex-worker    文件:OpenexContext.java   
private PropertiesComponent buildPropertiesComponent() {
    File[] propertiesFiles = new File(System.getProperty("karaf.home") + "/openex/").listFiles();
    assert propertiesFiles != null;
    List<String> paths = Arrays.stream(propertiesFiles)
            .filter(file -> file.getName().endsWith(".properties"))
            .map(file -> "file:" + file.getAbsolutePath()).collect(Collectors.toList());
    String[] locations = paths.toArray(new String[paths.size()]);
    return new PropertiesComponent(locations);
}
项目:drinkwater-java    文件:Service.java   
public PropertiesComponent getPropertiesComponent() {
    if (propertiesComponent == null) {
        propertiesComponent = camelContext.getComponent(
                "properties", PropertiesComponent.class);
    }
    return propertiesComponent;
}
项目:drinkwater-java    文件:DrinkWaterApplication.java   
public PropertiesComponent getPropertiesComponent() {
    if (propertiesComponent == null) {
        propertiesComponent = applicationLevelContext.getComponent(
                "properties", PropertiesComponent.class);
    }
    return propertiesComponent;
}
项目:Camel    文件:Application.java   
@Produces
@ApplicationScoped
@Named("properties")
// "properties" component bean that Camel uses to lookup properties
PropertiesComponent properties(PropertiesParser parser) {
    PropertiesComponent component = new PropertiesComponent();
    // Use DeltaSpike as configuration source for Camel CDI
    component.setPropertiesParser(parser);
    return component;
}
项目:Camel    文件:Config.java   
@Produces
@ApplicationScoped
@Named("properties")
PropertiesComponent properties() {
    PropertiesComponent component = new PropertiesComponent();
    component.setLocation("classpath:jms.properties");
    return component;
}
项目:Camel    文件:SplunkSavedSearchRouteBuilder.java   
@Override
public void configure() throws Exception {
    log.info("About to setup Splunk 'saved-search' route:Splunk Server --> log{results}");

    // configure properties component
    PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
    pc.setLocation("classpath:application.properties");

    from("splunk://savedsearch?host={{splunk.host}}&port={{splunk.port}}&delay=10s"
            + "&username={{splunk.username}}&password={{splunk.password}}&initEarliestTime=08/17/13 08:35:46:456"
            + "&savedSearch=failed_password")
            .log("${body}");
}
项目:Camel    文件:SplunkPublishEventRouteBuilder.java   
@Override
public void configure() throws Exception {
    log.info("About to start route: direct --> Splunk Server");

    // configure properties component
    PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
    pc.setLocation("classpath:application.properties");

    from("direct:start")
            .convertBodyTo(SplunkEvent.class)
            .to("splunk://submit?host={{splunk.host}}&port={{splunk.port}}"
                + "&username={{splunk.username}}&password={{splunk.password}}&sourceType=secure&source=myAppName");
}
项目:Camel    文件:SplunkSearchRouteBuilder.java   
@Override
public void configure() throws Exception {

    log.info("About to setup Splunk search route: Splunk Server --> log{results}");

    // configure properties component
    PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
    pc.setLocation("classpath:application.properties");

    from("splunk://normal?host={{splunk.host}}&port={{splunk.port}}&delay=10s"
            + "&username={{splunk.username}}&password={{splunk.password}}&initEarliestTime=08/17/13 08:35:46:456"
            + "&sourceType=access_combined_wcookie&search=search Code=D | head 5")
            .log("${body}");
}
项目:Camel    文件:DefaultCamelContext.java   
public String getPropertyPrefixToken() {
    PropertiesComponent pc = getPropertiesComponent();

    if (pc != null) {
        return pc.getPrefixToken();
    } else {
        return null;
    }
}
项目:Camel    文件:DefaultCamelContext.java   
public String getPropertySuffixToken() {
    PropertiesComponent pc = getPropertiesComponent();

    if (pc != null) {
        return pc.getSuffixToken();
    } else {
        return null;
    }
}
项目:Camel    文件:PropertiesComponentAutoConfiguration.java   
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(PropertiesComponent.class)
public PropertiesComponent configurePropertiesComponent(
        CamelContext camelContext,
        PropertiesComponentConfiguration configuration) throws Exception {
    PropertiesComponent component = new PropertiesComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), component, parameters);
    return component;
}
项目:Camel    文件:TransactedPropertyPlaceholderIssueTest.java   
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();

    PropertiesComponent pc = new PropertiesComponent();
    pc.setLocation("classpath:org/apache/camel/component/properties/myproperties.properties");
    context.addComponent("properties", pc);

    return context;
}
项目:Camel    文件:InterceptFromPropertyPlaceholderTest.java   
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();

    PropertiesComponent pc = new PropertiesComponent();
    pc.setLocation("classpath:org/apache/camel/processor/intercept/myproperties.properties");
    context.addComponent("properties", pc);

    return context;
}
项目:Camel    文件:RouteAutoStartupTest.java   
public void testRouteNotAutoStartedUsingProperties() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {

            PropertiesComponent properties = new PropertiesComponent();
            properties.setLocation("classpath:org/apache/camel/processor/routeAutoStartupTest.properties");
            context.addComponent("properties", properties);

            from("direct:start").id("route1").autoStartup("{{noAutoStartupProp}}").to("mock:result");
        }
    });
    context.start();

    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(0);

    try {
        template.sendBody("direct:start", "Hello World");
        fail("route shouldn't be started yet");
    } catch (Exception e) {
        // expected
    }

    assertMockEndpointsSatisfied();

    // reset mock, start route and resend message
    mock.reset();
    mock.expectedMessageCount(1);
    context.startRoute("route1");
    template.sendBody("direct:start", "Hello World");
    assertMockEndpointsSatisfied();
}