public void testProxyWithTwoCamelContext() throws Exception { AbstractXmlApplicationContext applicationContext = createApplicationContext(); CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext); ISay proxy = applicationContext.getBean("sayProxy1", ISay.class); String rc = proxy.say(); assertEquals("context-1", rc); proxy = applicationContext.getBean("sayProxy2", ISay.class); rc = proxy.say(); assertEquals("context-2", rc); camelContext.stop(); IOHelper.close(applicationContext); }
protected CamelContext createCamelContext() throws Exception { setUseRouteBuilder(false); final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext( "org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.xml"); setCamelContextService(new Service() { public void start() throws Exception { applicationContext.start(); } public void stop() throws Exception { applicationContext.stop(); } }); return SpringCamelContext.springCamelContext(applicationContext); }
protected CamelContext createCamelContext() throws Exception { setUseRouteBuilder(false); final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/dataformat/xstream/SpringMarshalListTest.xml"); setCamelContextService(new Service() { public void start() throws Exception { applicationContext.start(); } public void stop() throws Exception { applicationContext.stop(); } }); return SpringCamelContext.springCamelContext(applicationContext); }
@Test public void testRestartAppChangeTriggerOptions() throws Exception { // Test creates application context twice with different simple trigger options in configuration xml. // Both times it retrieves back the option, accessing it via trigger (so, using value stored in DB). // After that it asserts that two options are not equal. // load spring app AbstractXmlApplicationContext app = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest1.xml"); app.start(); CamelContext camel = app.getBean("camelContext", CamelContext.class); assertNotNull(camel); SimpleTrigger trigger = (SimpleTrigger) getTrigger(camel, "quartzRoute"); long repeatInterval = trigger.getRepeatInterval(); app.stop(); log.info("Restarting ..."); log.info("Restarting ..."); log.info("Restarting ..."); // load spring app AbstractXmlApplicationContext app2 = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest2.xml"); app2.start(); CamelContext camel2 = app2.getBean("camelContext", CamelContext.class); assertNotNull(camel2); SimpleTrigger trigger2 = (SimpleTrigger) getTrigger(camel2, "quartzRoute"); long repeatInterval2 = trigger2.getRepeatInterval(); app2.stop(); // we're done so let's properly close the application contexts, but close // the second app before the first one so that the quartz scheduler running // inside it can be properly shutdown IOHelper.close(app2, app); assertNotEquals(repeatInterval, repeatInterval2); }
@Test public void testRestartAppChangeTriggerType() throws Exception { // Test creates application context twice with different simple trigger options in configuration xml. // Both times it retrieves back the option, accessing it via trigger (so, using value stored in DB). // After that it asserts that two options are not equal. // load spring app app = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz2/SpringQuartzPersistentStoreRestartAppChangeCronExpressionTest1.xml"); app.start(); CamelContext camel = app.getBean("camelContext", CamelContext.class); assertNotNull(camel); assertTrue(getTrigger(camel, "quartzRoute") instanceof CronTrigger); app.stop(); log.info("Restarting ..."); log.info("Restarting ..."); log.info("Restarting ..."); // load spring app AbstractXmlApplicationContext app2 = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz2/SpringQuartzPersistentStoreRestartAppChangeOptionsTest2.xml"); app2.start(); CamelContext camel2 = app2.getBean("camelContext", CamelContext.class); assertNotNull(camel2); assertTrue(getTrigger(camel2, "quartzRoute") instanceof SimpleTrigger); app2.stop(); // we're done so let's properly close the application contexts, but close // the second app before the first one so that the quartz scheduler running // inside it can be properly shutdown IOHelper.close(app2, app); }
@Test public void testRestartAppChangeTriggerType() throws Exception { // Test creates application context twice with different simple trigger options in configuration xml. // Both times it retrieves back the option, accessing it via trigger (so, using value stored in DB). // After that it asserts that two options are not equal. // load spring app app = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeCronExpressionTest1.xml"); app.start(); CamelContext camel = app.getBean("camelContext", CamelContext.class); assertNotNull(camel); assertTrue(getTrigger(camel, "quartzRoute") instanceof CronTrigger); app.stop(); log.info("Restarting ..."); log.info("Restarting ..."); log.info("Restarting ..."); // load spring app AbstractXmlApplicationContext app2 = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest2.xml"); app2.start(); CamelContext camel2 = app2.getBean("camelContext", CamelContext.class); assertNotNull(camel2); assertTrue(getTrigger(camel2, "quartzRoute") instanceof SimpleTrigger); app2.stop(); // we're done so let's properly close the application contexts, but close // the second app before the first one so that the quartz scheduler running // inside it can be properly shutdown IOHelper.close(app2, app); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { AbstractXmlApplicationContext answer; try { answer = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/SpringRouteNoFromTest.xml"); fail("Should have thrown exception"); } catch (Exception e) { IllegalArgumentException iae = (IllegalArgumentException) e.getCause(); assertEquals("Route myRoute has no inputs: Route(myRoute)[[] -> [To[mock:result]]]", iae.getMessage()); return null; } return answer; }
public void testBeanRoutes() throws Exception { AbstractXmlApplicationContext applicationContext = createApplicationContext(); CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext); Invoker invoker = applicationContext.getBean("invokerProxy", Invoker.class); String response = invoker.invoke(new Bean.SubClass()); assertEquals("Hello from Sub", response); camelContext.stop(); IOHelper.close(applicationContext); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { try { new ClassPathXmlApplicationContext("org/apache/camel/component/rest/SpringFromRestDuplicateTest.xml"); fail("Should throw exception"); } catch (Exception e) { IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, e.getCause()); assertEquals("Duplicate verb detected in rest-dsl: get:{id}", iae.getMessage()); } return null; }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext(new String[] {"org/apache/camel/component/spring/ws/addresing/ConsumerWSAParamsTOTests-context.xml"}); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/dataformat/dataFormatWithNonChildElementTest.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/SpringRouteContextProduceBeanTest.xml"); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext( "/org/apache/camel/spring/interceptor/springTransactionalClientDataSourceMinimalConfiguration.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/SpringMDCWithBreadcrumbTest.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/component/spring/ws/ConsumerEndpointMappingByBeanNameRouteTest-context.xml"); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/component/bean/camelContext.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("/META-INF/spring/camel-context.xml"); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/itest/issues/BeanCallDerivedClassTest-context.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/config/TwoRouteRefOnException.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/itest/jms/SpringJmsValidatorTest.xml"); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/component/event/mistypedPackage.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/language/SpringSimpleMultiLineExpressionTest.xml"); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/processor/camel-context.xml"); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/SpringDeadLetterChannelInvalidOptionDeadLetterUriTest.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/jmxConfig.xml"); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext( "/org/apache/camel/spring/interceptor/transactionalClientWithAnnotatedBeanTest.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/spi/bridgePropertyPlaceholderConfigurerUtilIssue.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/issues/packagescan/camelContext.xml"); }
@Override public void process(Exchange exchange) throws Exception { // shutdown the application context; ((AbstractXmlApplicationContext)applicationContext).close(); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/SpringCustomPredicateTest.xml"); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/postprocessor/camelCustomPostProcessorOnRouteBuilderTest.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext( new String[]{"org/apache/camel/component/spring/ws/ConsumerEndpointMappingRouteTest-context.xml"}); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/SpringDeadLetterChannelInvalidDeadLetterUriTest.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { // we can put the http conduit configuration here return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/CxfSslContext.xml"); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("/org/apache/camel/spring/interceptor/transactionalClientDataSource.xml"); }
protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/component/log/custom-exchange-formatter-context.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurerTest.xml"); }
@Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSLTest.xml"); }