Package org.springframework.context.support

Examples of org.springframework.context.support.AbstractRefreshableApplicationContext


public class BusApplicationListenerTest extends Assert {
   
    @Test
    public void testParentApplicationEvent() {
        AbstractRefreshableApplicationContext parent = new ClassPathXmlApplicationContext();
        parent.refresh();
        SpringBusFactory factory = new SpringBusFactory(parent);
        Bus bus = factory.createBus();
        CXFBusLifeCycleManager manager = bus.getExtension(CXFBusLifeCycleManager.class);
        BusLifeCycleListener listener = EasyMock.createMock(BusLifeCycleListener.class);
        manager.registerLifeCycleListener(listener);
        EasyMock.reset(listener);
        listener.preShutdown();
        EasyMock.expectLastCall().times(1);
        listener.postShutdown();
        EasyMock.expectLastCall().times(1);
        EasyMock.replay(listener);
        AbstractRefreshableApplicationContext context =
            (AbstractRefreshableApplicationContext)factory.getApplicationContext();
        context.close();
        parent.close();
        EasyMock.verify(listener);
    }
View Full Code Here


public class BusApplicationListenerTest extends Assert {
   
    @Test
    public void testParentApplicationEvent() {
        AbstractRefreshableApplicationContext parent = new ClassPathXmlApplicationContext();
        parent.refresh();
        SpringBusFactory factory = new SpringBusFactory(parent);
        Bus bus = factory.createBus();
        CXFBusLifeCycleManager manager = bus.getExtension(CXFBusLifeCycleManager.class);
        BusLifeCycleListener listener = EasyMock.createMock(BusLifeCycleListener.class);
        manager.registerLifeCycleListener(listener);
        EasyMock.reset(listener);
        listener.preShutdown();
        EasyMock.expectLastCall().times(1);
        listener.postShutdown();
        EasyMock.expectLastCall().times(1);
        EasyMock.replay(listener);
        parent.close();
        EasyMock.verify(listener);
    }
View Full Code Here

public class BusApplicationListenerTest extends Assert {
   
    @Test
    public void testParentApplicationEvent() {
        AbstractRefreshableApplicationContext parent = new ClassPathXmlApplicationContext();
        parent.refresh();
        SpringBusFactory factory = new SpringBusFactory(parent);
        Bus bus = factory.createBus();
        CXFBusLifeCycleManager manager = bus.getExtension(CXFBusLifeCycleManager.class);
        BusLifeCycleListener listener = EasyMock.createMock(BusLifeCycleListener.class);
        manager.registerLifeCycleListener(listener);
        EasyMock.reset(listener);
        listener.preShutdown();
        EasyMock.expectLastCall().times(1);
        listener.postShutdown();
        EasyMock.expectLastCall().times(1);
        EasyMock.replay(listener);
        parent.close();
        EasyMock.verify(listener);
    }
View Full Code Here

            return;
        }
        Resource resource = implementation.getApplicationResource();
        SpringComponentType componentType = new SpringComponentType();
        // REVIEW andyp -- pass in deploymentContext.getClassLoader()?
        AbstractRefreshableApplicationContext ctx;
        if (runtimeInfo instanceof SpringRuntimeInfo) {
            ctx = ((SpringRuntimeInfo) runtimeInfo).getApplicationContext();
        } else {
            ctx = new ScaApplicationContext(resource, componentType);
        }
        componentType.setApplicationContext(ctx); // FIXME andyp@bea.com -- don't do this!

        // If there are <sca:service> elements, they define (and limit) the services exposed
        // in the componentType.
        String [] serviceBeanNames = ctx.getBeanNamesForType(ScaServiceExporter.class);
        for (String serviceBeanName : serviceBeanNames) {
            int nSuffix = serviceBeanName.indexOf(SERVICE_BEAN_SUFFIX);
            if (nSuffix == -1) {
                continue;
            }

            String serviceName = serviceBeanName.substring(0, nSuffix);
            ScaServiceExporter serviceBean = (ScaServiceExporter) ctx.getBean(serviceName);
            // REVIEW andyp -- use the class directly?
            String serviceTypeName = serviceBean.getServiceType().getName();
            try {
                Class serviceInterface = Class.forName(serviceTypeName, true, deploymentContext.getClassLoader());
                componentType.addServiceType(serviceName, serviceInterface);
View Full Code Here

    ServiceTracker tracker = new ServiceTracker(bundleContext, bundleContext.createFilter(filter.toString()), null);
    try {

      tracker.open();

      AbstractRefreshableApplicationContext appContext = (AbstractRefreshableApplicationContext) tracker.waitForService(30000);
      assertNotNull("test application context", appContext);
      assertTrue("application context is active", appContext.isActive());

      testBundle.stop();
      while (testBundle.getState() == Bundle.STOPPING) {
        Thread.sleep(10);
      }
      assertEquals("Guinea pig didn't shutdown", "true",
        System.getProperty("org.springframework.osgi.iandt.lifecycle.GuineaPig.close"));

      assertFalse("application context is inactive", appContext.isActive());
    }
    finally {
      tracker.close();
    }
  }
View Full Code Here

    ServiceTracker tracker = new ServiceTracker(bundleContext, bundleContext.createFilter(filter.toString()), null);

    try {
      tracker.open();

      AbstractRefreshableApplicationContext appContext = (AbstractRefreshableApplicationContext) tracker.waitForService(3000);
      assertNull("Deadlock context should not be published", appContext);
    }
    finally {
      tracker.close();
    }
View Full Code Here

public class BusApplicationListenerTest extends Assert {
   
    @Test
    public void testParentApplicationEvent() {
        AbstractRefreshableApplicationContext parent = new ClassPathXmlApplicationContext();
        parent.refresh();
        SpringBusFactory factory = new SpringBusFactory(parent);
        Bus bus = factory.createBus();
        CXFBusLifeCycleManager manager = bus.getExtension(CXFBusLifeCycleManager.class);
        BusLifeCycleListener listener = EasyMock.createMock(BusLifeCycleListener.class);
        manager.registerLifeCycleListener(listener);
        EasyMock.reset(listener);
        listener.preShutdown();
        EasyMock.expectLastCall().times(1);
        listener.postShutdown();
        EasyMock.expectLastCall().times(1);
        EasyMock.replay(listener);
        parent.close();
        EasyMock.verify(listener);
    }
View Full Code Here

TOP

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

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.