Package org.springframework.context.support

Examples of org.springframework.context.support.AbstractApplicationContext


        component.start();
        verify(appContext);
    }

    public void testChildStart() {
        AbstractApplicationContext appContext = EasyMock.createNiceMock(AbstractApplicationContext.class);
        replay(appContext);
        Service service = EasyMock.createMock(Service.class);
        EasyMock.expect(service.getName()).andReturn("foo").anyTimes();
        service.start();
        service.getInterface();
View Full Code Here


* @version $$Rev: 451895 $$ $$Date: 2006-10-01 23:58:18 -0700 (Sun, 01 Oct 2006) $$
*/
public class ReferenceInvocationTestCase extends TestCase {

    public void testInvocation() throws Exception {
        AbstractApplicationContext ctx = createSpringContext();
        SpringCompositeComponent parent = new SpringCompositeComponent("spring", ctx, null, null, null);
        parent.start();
        TestBean referenceTarget = new TestBeanImpl();
        Reference reference = createMock(Reference.class);
        expect(reference.getName()).andReturn("bar").anyTimes();
        expect(reference.isSystem()).andReturn(false).atLeastOnce();
        expect(reference.getInterface()).andStubReturn(TestBean.class);
        expect(reference.getServiceInstance()).andStubReturn(referenceTarget);
        replay(reference);
        parent.register(reference);
        ctx.getBean("foo");
    }
View Full Code Here

* @version $$Rev: 449095 $$ $$Date: 2006-09-22 14:22:11 -0700 (Fri, 22 Sep 2006) $$
*/
public class ServiceInvocationTestCase extends TestCase {

    public void testInvocation() throws InvalidServiceContractException {
        AbstractApplicationContext springContext = createSpringContext();
        SpringCompositeComponent composite = new SpringCompositeComponent("parent", springContext, null, null, null);
        InboundWire inboundWire = ArtifactFactory.createInboundWire("fooService", TestBean.class);
        OutboundWire outboundWire = ArtifactFactory.createOutboundWire("fooService", TestBean.class);
        outboundWire.setTargetName(new QualifiedName("foo"));
        ArtifactFactory.terminateWire(outboundWire);
View Full Code Here

            log.info("Skipping starting CamelContext as system property skipStartingCamelContext is set to be true.");
        }
    }

    private AbstractApplicationContext doCreateApplicationContext() {
        AbstractApplicationContext context = createApplicationContext();
        assertNotNull("Should have created a valid Spring application context", context);

        String[] profiles = activeProfiles();
        if (profiles != null && profiles.length > 0) {
            // the context must not be active
            if (context.isActive()) {
                throw new IllegalStateException("Cannot active profiles: " + Arrays.asList(profiles) + " on active Spring application context: " + context
                    + ". The code in your createApplicationContext() method should be adjusted to create the application context with refresh = false as parameter");
            }
            log.info("Spring activating profiles: {}", Arrays.asList(profiles));
            context.getEnvironment().setActiveProfiles(profiles);
        }

        // ensure the context has been refreshed at least once
        if (!context.isActive()) {
            context.refresh();
        }

        return context;
    }
View Full Code Here

public class ProducerBeanInjectTest extends Assert {

    @Test
    public void checkProducerBeanInjection() {
        AbstractApplicationContext applicationContext = createApplicationContext();
        MyProduceBean bean = applicationContext.getBean("myProduceBean", MyProduceBean.class);
        assertNotNull("The producerTemplate should not be null.", bean.getProducerTemplate());
        assertEquals("Get a wrong response", "Camel rocks!", bean.getProducerTemplate().requestBody("Camel"));
    }
View Full Code Here

    private ProducerTemplate template1;
    private ProducerTemplate template2;

    @Before
    public void setUp() throws Exception {
        AbstractApplicationContext ac = new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsProducerClientFactoryCacheTest1.xml");
        context1 = SpringCamelContext.springCamelContext(ac, false);
        context1.start();
        template1 = context1.createProducerTemplate();
        template1.start();
View Full Code Here

public class HiveApp {

  private static final Log log = LogFactory.getLog(HiveApp.class);

  public static void main(String[] args) throws Exception {
    AbstractApplicationContext context = new ClassPathXmlApplicationContext(
        "/META-INF/spring/hive-context.xml", HiveApp.class);
    log.info("Hive Application Running");
    context.registerShutdownHook();

    HiveTemplate template = context.getBean(HiveTemplate.class);
    template.query("show tables;");

    PasswordRepository repository = context.getBean(HiveTemplatePasswordRepository.class);
    repository.processPasswordFile("/etc/passwd");
    log.info("Count of password entries = " + repository.count());
        context.close();
    log.info("Hive Application Completed");
  }
View Full Code Here

public class HiveJdbcApp {

  private static final Log log = LogFactory.getLog(HiveJdbcApp.class);

  public static void main(String[] args) throws Exception {
    AbstractApplicationContext context = new ClassPathXmlApplicationContext(
        "/META-INF/spring/hive-context.xml", HiveJdbcApp.class);
    log.info("Hive Application Running");
    context.registerShutdownHook()
   
    HiveTemplate template = context.getBean(HiveTemplate.class);
    template.query("show tables;");


    JdbcPasswordRepository repo = context.getBean(JdbcPasswordRepository.class);   
    repo.processPasswordFile("password-analysis.hql")
    log.info("Count of password entrires = " + repo.count());
        context.close();
        log.info("Hive Application Completed");
  }
View Full Code Here

public class HiveAppWithApacheLogs {

  private static final Log log = LogFactory.getLog(HiveAppWithApacheLogs.class);

  public static void main(String[] args) throws Exception {
    AbstractApplicationContext context = new ClassPathXmlApplicationContext(
        "/META-INF/spring/hive-apache-log-context.xml", HiveAppWithApacheLogs.class);
    log.info("Hive Application Running");
    context.registerShutdownHook()
   
    HiveRunner runner = context.getBean(HiveRunner.class);   
    runner.call();

        context.close();
        log.info("Hive Application Completed");
  }
View Full Code Here

public class PigAppWithApacheLogs {

  private static final Log log = LogFactory.getLog(PigAppWithApacheLogs.class);

  public static void main(String[] args) throws Exception {
    AbstractApplicationContext context = new ClassPathXmlApplicationContext(
        "/META-INF/spring/pig-context-apache-logs.xml", PigAppWithApacheLogs.class);
    log.info("Pig Application Running");
    context.registerShutdownHook()


     
  }
View Full Code Here

TOP

Related Classes of org.springframework.context.support.AbstractApplicationContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.