Search in sources :

Example 1 with OnGrantedEvent

use of org.springframework.integration.leader.event.OnGrantedEvent in project spring-integration by spring-projects.

the class EndpointRoleParserTests method test.

@Test
public void test() {
    assertFalse(this.in.isRunning());
    assertFalse(this.out1.isRunning());
    assertFalse(this.out2.isRunning());
    assertFalse(this.out3.isRunning());
    assertFalse(this.out4.isRunning());
    assertFalse(this.bridge.isRunning());
    this.controller.startLifecyclesInRole("cluster");
    assertTrue(this.in.isRunning());
    assertTrue(this.out1.isRunning());
    assertTrue(this.out2.isRunning());
    assertTrue(this.out3.isRunning());
    assertFalse(this.out4.isRunning());
    assertTrue(this.bridge.isRunning());
    this.controller.stopLifecyclesInRole("cluster");
    assertFalse(this.in.isRunning());
    assertFalse(this.out1.isRunning());
    assertFalse(this.out2.isRunning());
    assertFalse(this.out3.isRunning());
    assertFalse(this.out4.isRunning());
    assertFalse(this.bridge.isRunning());
    this.controller.onApplicationEvent(new OnGrantedEvent("foo", null, "cluster"));
    assertTrue(this.in.isRunning());
    assertTrue(this.out1.isRunning());
    assertTrue(this.out2.isRunning());
    assertTrue(this.out3.isRunning());
    assertFalse(this.out4.isRunning());
    assertTrue(this.bridge.isRunning());
    this.controller.onApplicationEvent(new OnRevokedEvent("foo", null, "cluster"));
    assertFalse(this.in.isRunning());
    assertFalse(this.out1.isRunning());
    assertFalse(this.out2.isRunning());
    assertFalse(this.out3.isRunning());
    assertFalse(this.out4.isRunning());
    assertFalse(this.bridge.isRunning());
    assertFalse(this.controller.allEndpointsRunning("cluster"));
}
Also used : OnGrantedEvent(org.springframework.integration.leader.event.OnGrantedEvent) OnRevokedEvent(org.springframework.integration.leader.event.OnRevokedEvent) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 OnGrantedEvent (org.springframework.integration.leader.event.OnGrantedEvent)1 OnRevokedEvent (org.springframework.integration.leader.event.OnRevokedEvent)1