Java 类org.springframework.context.support.AbstractXmlApplicationContext 实例源码

项目:Camel    文件:SpringRemotingTwoCamelContextTest.java   
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);
}
项目:Camel    文件:SpringXStreamConfigurationTest.java   
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);
}
项目:Camel    文件:SpringMarshalListTest.java   
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);        
}
项目:Camel    文件:SpringQuartzPersistentStoreRestartAppChangeOptionsTest.java   
@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);
}
项目:Camel    文件:SpringQuartzPersistentStoreRestartAppChangeOptionsTest.java   
@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);
}
项目:Camel    文件:SpringQuartzPersistentStoreRestartAppChangeOptionsTest.java   
@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);
}
项目:Camel    文件:SpringRouteNoFromTest.java   
@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;
}
项目:Camel    文件:SpringRemotingBeanConverterTest.java   
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);
}
项目:Camel    文件:SpringFromRestDuplicateTest.java   
@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;
}
项目:Camel    文件:ConsumerWSANewChannelParamsToTests.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext(new String[] {"org/apache/camel/component/spring/ws/addresing/ConsumerWSAParamsTOTests-context.xml"});
}
项目:Camel    文件:SpringDataFormatWithNonChildElementTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/dataformat/dataFormatWithNonChildElementTest.xml");
}
项目:Camel    文件:SpringRouteContextProduceBeanTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/SpringRouteContextProduceBeanTest.xml");
}
项目:Camel    文件:TransactionalClientDataSourceMinimalConfigurationTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext(
        "/org/apache/camel/spring/interceptor/springTransactionalClientDataSourceMinimalConfiguration.xml");
}
项目:Camel    文件:SpringMDCWithBreadcrumbTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/SpringMDCWithBreadcrumbTest.xml");
}
项目:Camel    文件:ConsumerEndpointMappingByBeanNameRouteTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/component/spring/ws/ConsumerEndpointMappingByBeanNameRouteTest-context.xml");
}
项目:Camel    文件:BeanRouteTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/component/bean/camelContext.xml");
}
项目:Camel    文件:ReportIncidentRoutesTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("/META-INF/spring/camel-context.xml");
}
项目:Camel    文件:BeanCallDerivedClassTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/itest/issues/BeanCallDerivedClassTest-context.xml");
}
项目:Camel    文件:TwoRouteRefOnExceptionTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/config/TwoRouteRefOnException.xml");
}
项目:Camel    文件:SpringJmsValidatorTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/itest/jms/SpringJmsValidatorTest.xml");
}
项目:Camel    文件:MistypedPackageTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/component/event/mistypedPackage.xml");
}
项目:Camel    文件:SpringSimpleMultiLineExpressionTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/language/SpringSimpleMultiLineExpressionTest.xml");
}
项目:Camel    文件:RemoveHeadersExcludeTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/processor/camel-context.xml");
}
项目:Camel    文件:SpringDeadLetterChannelInvalidOptionDeadLetterUriTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/SpringDeadLetterChannelInvalidOptionDeadLetterUriTest.xml");
}
项目:Camel    文件:CamelSpringPropertyPlaceholderConfigurer3Test.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.xml");
}
项目:Camel    文件:JMXAgentTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/jmxConfig.xml");
}
项目:Camel    文件:TransactionalClientWithAnnotatedBeanTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext(
            "/org/apache/camel/spring/interceptor/transactionalClientWithAnnotatedBeanTest.xml");
}
项目:Camel    文件:BridgePropertyPlaceholderConfigurerUtilIssueTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/spi/bridgePropertyPlaceholderConfigurerUtilIssue.xml");
}
项目:Camel    文件:SkipNonPublicRouteBuilderTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/issues/packagescan/camelContext.xml");
}
项目:Camel    文件:SpringQuartzConsumerTwoAppsClusteredRecoveryTest.java   
@Override
public void process(Exchange exchange) throws Exception {
    // shutdown the application context;
    ((AbstractXmlApplicationContext)applicationContext).close();
}
项目:Camel    文件:SpringCustomPredicateTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/SpringCustomPredicateTest.xml");
}
项目:Camel    文件:CamelCustomPostProcessorOnRouteBuilderTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/postprocessor/camelCustomPostProcessorOnRouteBuilderTest.xml");
}
项目:Camel    文件:ConsumerEndpointMappingRouteTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext(
            new String[]{"org/apache/camel/component/spring/ws/ConsumerEndpointMappingRouteTest-context.xml"});
}
项目:Camel    文件:SpringDeadLetterChannelInvalidDeadLetterUriTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/SpringDeadLetterChannelInvalidDeadLetterUriTest.xml");
}
项目:Camel    文件:SslTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    // we can put the http conduit configuration here
    return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/CxfSslContext.xml");
}
项目:Camel    文件:TransactionalClientWithRollbackTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("/org/apache/camel/spring/interceptor/transactionalClientDataSource.xml");
}
项目:Camel    文件:CustomExchangeFormatterTest.java   
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/component/log/custom-exchange-formatter-context.xml");
}
项目:Camel    文件:CamelRouteRefInjectionIssueTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml");
}
项目:Camel    文件:CamelSpringPropertyPlaceholderConfigurerTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurerTest.xml");
}
项目:Camel    文件:SpringPropertiesAfterTransactedDSLTest.java   
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
    return new ClassPathXmlApplicationContext("org/apache/camel/component/properties/SpringPropertiesAfterTransactedDSLTest.xml");
}