Package org.springframework.boot.context.event

Examples of org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent


  @Test
  public void orderedInitialize() throws Exception {
    EnvironmentTestUtils.addEnvironment(this.context, "context.listener.classes:"
        + MockInitB.class.getName() + "," + MockInitA.class.getName());
    this.listener.onApplicationEvent(new ApplicationEnvironmentPreparedEvent(
        new SpringApplication(), new String[0], this.context.getEnvironment()));
    this.context.getBeanFactory().registerSingleton("testListener", this.listener);
    this.context.refresh();
    assertThat(this.context.getBeanFactory().getSingleton("a"), equalTo((Object) "a"));
    assertThat(this.context.getBeanFactory().getSingleton("b"), equalTo((Object) "b"));
View Full Code Here


    assertThat(this.context.getBeanFactory().getSingleton("b"), equalTo((Object) "b"));
  }

  @Test
  public void noInitializers() throws Exception {
    this.listener.onApplicationEvent(new ApplicationEnvironmentPreparedEvent(
        new SpringApplication(), new String[0], this.context.getEnvironment()));
  }
View Full Code Here

  }

  @Test
  public void emptyInitializers() throws Exception {
    EnvironmentTestUtils.addEnvironment(this.context, "context.listener.classes:");
    this.listener.onApplicationEvent(new ApplicationEnvironmentPreparedEvent(
        new SpringApplication(), new String[0], this.context.getEnvironment()));
  }
View Full Code Here

    File file = this.temporaryFolder.newFile();
    ConfigurableEnvironment environment = new StandardEnvironment();
    MockPropertySource propertySource = new MockPropertySource();
    propertySource.setProperty("spring.pidfile", file.getAbsolutePath());
    environment.getPropertySources().addLast(propertySource);
    ApplicationEnvironmentPreparedEvent event = new ApplicationEnvironmentPreparedEvent(
        new SpringApplication(), new String[] {}, environment);
    ApplicationPidFileWriter listener = new ApplicationPidFileWriter();
    listener.onApplicationEvent(event);
    assertThat(FileCopyUtils.copyToString(new FileReader(file)), isEmptyString());
    listener.setTriggerEventType(ApplicationEnvironmentPreparedEvent.class);
View Full Code Here

TOP

Related Classes of org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent

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.