Example usage for org.springframework.integration.leader Context Context

List of usage examples for org.springframework.integration.leader Context Context

Introduction

In this page you can find the example usage for org.springframework.integration.leader Context Context.

Prototype

Context

Source Link

Usage

From source file:com.netflix.genie.web.tasks.leader.LeadershipTasksCoordinatorUnitTests.java

/**
 * Make sure unhandled commands are ignored.
 *//*from ww w  .  j  av  a2  s  . c  o  m*/
@Test
public void doesIgnoreUnknownEvent() {
    final AbstractLeaderEvent leaderEvent = new AbstractLeaderEvent(this) {
        /**
         * Gets the {@link Context} associated with this event.
         *
         * @return the context
         */
        @Override
        public Context getContext() {
            return new Context() {
                @Override
                public boolean isLeader() {
                    return false;
                }

                @Override
                public void yield() {
                }
            };
        }
    };

    this.coordinator.onLeaderEvent(leaderEvent);
    Mockito.verify(this.scheduler, Mockito.never()).scheduleAtFixedRate(Mockito.any(Runnable.class),
            Mockito.anyLong());
}