Package org.springframework.context.event

Examples of org.springframework.context.event.ContextRefreshedEvent


  @Test
  public void shouldUpdateLastRefreshDateOnReload() throws Exception {
    createSpringFacesIntegration();
    Date initialDate = SpringFacesIntegration.getLastRefreshedDate(this.servletContext);
    Thread.sleep(100);
    ContextRefreshedEvent event = mock(ContextRefreshedEvent.class);
    this.springFacesIntegration.onApplicationEvent(event);
    assertThat(SpringFacesIntegration.getLastRefreshedDate(this.servletContext), is(greaterThan(initialDate)));
    assertThat(SpringFacesIntegration.getLastRefreshedDate(this.externalContext), is(greaterThan(initialDate)));
  }
View Full Code Here


  @Test
  public void shouldPublishPostConstructApplicationEventWhenJsfFirst() throws Exception {
    Application application = mock(Application.class);
    SpringFacesIntegration.postConstructApplicationEvent(this.externalContext, application);
    createSpringFacesIntegration();
    this.springFacesIntegration.onApplicationEvent(new ContextRefreshedEvent(this.applicationContext));
    verify(this.applicationContext).publishEvent(this.applicationEventCaptor.capture());
    assertThat(this.applicationEventCaptor.getValue().getSource(), is(sameInstance((Object) application)));
  }
View Full Code Here

    FacesContextSetter.setCurrentInstance(null);
  }

  private Application createWrappedApplication() {
    this.converterSupport.setApplicationContext(this.applicationContext);
    this.converterSupport.onApplicationEvent(new ContextRefreshedEvent(this.applicationContext));
    return this.converterSupport.newWrapper(Application.class, this.delegateApplication);
  }
View Full Code Here

        "/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml"));
    GenericApplicationContext applicationContext = new GenericApplicationContext();
    applicationContext.refresh();
    setUpApplicationContextFactories(jobPaths, applicationContext);
    registrar.setApplicationContext(applicationContext);
    registrar.onApplicationEvent(new ContextRefreshedEvent(applicationContext));
    assertEquals(2, registry.getJobNames().size());
  }
View Full Code Here

  @Before
  public void setupApiController() throws Exception {
    methodInfoCache.clear();
    apiCache.clear();
    wac.publishEvent(new ContextRefreshedEvent(wac));

    Configuration config = new Configuration();
    ReflectionTestUtils.setField(configurationService, "configuration", config);
    configurationService.afterPropertiesSet();
View Full Code Here

  @Before
  public void setupApiController() throws Exception {
    methodInfoCache.clear();
    apiCache.clear();
    wac.publishEvent(new ContextRefreshedEvent(wac));

    Configuration config = new Configuration();
    ReflectionTestUtils.setField(configurationService, "configuration", config);
    configurationService.afterPropertiesSet();
View Full Code Here

    this.stereotypeHandlers = stereotypeHandlers;
    }

  public void onApplicationEvent(ApplicationEvent event) {
    if (event instanceof ContextRefreshedEvent) {
      ContextRefreshedEvent contextRefreshedEvent = (ContextRefreshedEvent) event;
      handleRefresh(contextRefreshedEvent.getApplicationContext());
    }
  }
View Full Code Here

  public void logsDebugOnContextRefresh() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    this.initializer.initialize(context);
    context.register(Config.class);
    context.refresh();
    this.initializer.onApplicationEvent(new ContextRefreshedEvent(context));
    assertThat(this.debugLog.size(), not(equalTo(0)));
  }
View Full Code Here

  public void logsOutput() throws Exception {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    this.initializer.initialize(context);
    context.register(Config.class);
    context.refresh();
    this.initializer.onApplicationEvent(new ContextRefreshedEvent(context));
    for (String message : this.debugLog) {
      System.out.println(message);
    }
    // Just basic sanity check, test is for visual inspection
    String l = this.debugLog.get(0);
View Full Code Here

  @Test
  public void testWiring() {
    TestDeclarable declarable = new TestDeclarable();

    declarable.init(createParameters("testParam", "testValue"));
    declarable.onApplicationEvent(new ContextRefreshedEvent(applicationContext));
    declarable.assertInitialized();

    assertNull(declarable.getDataSource());
    assertNotNull(declarable.getUser());
    assertEquals("supertool", declarable.getUser().getUsername());
View Full Code Here

TOP

Related Classes of org.springframework.context.event.ContextRefreshedEvent

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.