类org.springframework.context.support.AbstractRefreshableApplicationContext源码实例Demo

下面列出了怎么用org.springframework.context.support.AbstractRefreshableApplicationContext的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: cxf   文件: BusApplicationListenerTest.java
@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);
}
 
源代码2 项目: alfresco-remote-api   文件: NodeWebScripTest.java
@Override
protected void setUp() throws Exception
{
    super.setUp();
    
    AbstractRefreshableApplicationContext ctx = (AbstractRefreshableApplicationContext)getServer().getApplicationContext();
    this.retryingTransactionHelper = (RetryingTransactionHelper)ctx.getBean("retryingTransactionHelper");
    this.authenticationService = (MutableAuthenticationService)ctx.getBean("AuthenticationService");
    this.personService = (PersonService)ctx.getBean("PersonService");
    this.siteService = (SiteService)ctx.getBean("SiteService");
    this.nodeService = (NodeService)ctx.getBean("NodeService");
    this.nodeArchiveService = (NodeArchiveService)ctx.getBean("nodeArchiveService");
    this.checkOutCheckInService = (CheckOutCheckInService)ctx.getBean("checkOutCheckInService");
    this.permissionService = (PermissionService)ctx.getBean("permissionService");
    
    // Do the setup as admin
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();

    // Create a site
    TEST_SITE = createSite(TEST_SITE_NAME);
    
    // Create two users, one who's a site member
    createUser(USER_ONE, true);
    createUser(USER_TWO, false);
    
    // Do our tests by default as the first user who is a contributor
    AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE);
}
 
@Before
public void setup() {

	//System.err.printf("ApplicationContext Type [%s]%n", ObjectUtils.nullSafeClassName(this.applicationContext));

	assertThat(this.applicationContext).isInstanceOf(AbstractRefreshableApplicationContext.class);
}
 
 同包方法