Example usage for org.springframework.context.event ContextStartedEvent ContextStartedEvent

List of usage examples for org.springframework.context.event ContextStartedEvent ContextStartedEvent

Introduction

In this page you can find the example usage for org.springframework.context.event ContextStartedEvent ContextStartedEvent.

Prototype

public ContextStartedEvent(ApplicationContext source) 

Source Link

Document

Create a new ContextStartedEvent.

Usage

From source file:natalia.dymnikova.cluster.AutostartActorsBeanPostProcessorTest.java

@Test
public void shouldStartActors() throws Exception {
    doReturn(new String[] { "actor1", "actor2", "actor3" }).when(applicationContext)
            .getBeanNamesForAnnotation(AutostartActor.class);

    doReturn(Actor1.class).when(applicationContext).getType("actor1");
    doReturn(Actor2.class).when(applicationContext).getType("actor2");
    doReturn(Actor3.class).when(applicationContext).getType("actor3");

    doAnswer(invocation -> mock(ActorRef.class)).when(actorSystem).actorOf(isA(Props.class), anyString());

    processor.onStart(new ContextStartedEvent(applicationContext));

    verify(actorSystem).actorOf(isA(Props.class), eq("path1"));
    verify(actorSystem).actorOf(isA(Props.class), eq("path2"));
    verify(actorSystem).actorOf(isA(Props.class), eq("path3"));
}

From source file:net.zcarioca.zcommons.config.spring.ConfigurationInjectionPostProcessorTest.java

/**
 * Test method for/* ww w  . j  a  v a2s  . co m*/
 * {@link net.zcarioca.zcommons.config.spring.ConfigurationInjectionPostProcessor#onApplicationEvent(org.springframework.context.ApplicationEvent)}
 * .
 */
@Test
public void testOnApplicationEvent() {
    this.ctx.publishEvent(new ContextStartedEvent(this.ctx));
    this.ctx.publishEvent(new ContextRefreshedEvent(this.ctx));
}

From source file:org.springframework.context.support.AbstractApplicationContext.java

@Override
public void start() {
    getLifecycleProcessor().start();
    publishEvent(new ContextStartedEvent(this));
}