Examples of onLeading()


Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener.onLeading()

    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    schedulerLifecycle.registered(new DriverRegistered());
    handleRegistered.getValue().run();
    triggerFailover.getValue().run();
  }
View Full Code Here

Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener.onLeading()

    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    registrationTimeout.getValue().run();
  }

  @Test
  public void testDefeatedBeforeRegistered() throws Exception {
View Full Code Here

Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener.onLeading()

    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    leaderListener.onDefeated(null);
  }

  @Test
  public void testStorageStartFails() throws Exception {
View Full Code Here

Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener.onLeading()

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();

    try {
      leaderListener.onLeading(leaderControl);
      fail();
    } catch (StorageException e) {
      // Expected.
    }
  }
View Full Code Here

Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener.onLeading()

    expectShutdown();

    Capture<Command> shutdownCommand = replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    schedulerLifecycle.registered(new DriverRegistered());
    handleRegistered.getValue().run();
    shutdownCommand.getValue().execute();
  }
}
View Full Code Here

Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener.onLeading()

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    assertEquals(1, statsProvider.getValue(stateGaugeName(State.STORAGE_PREPARED)));
    leaderListener.onLeading(leaderControl);
    assertEquals(1, statsProvider.getValue(stateGaugeName(State.LEADER_AWAITING_REGISTRATION)));
    assertEquals(0, statsProvider.getValue(SchedulerLifecycle.REGISTERED_GAUGE));
    schedulerLifecycle.registered(new DriverRegistered());
    assertEquals(1, statsProvider.getValue(stateGaugeName(State.ACTIVE)));
    assertEquals(1, statsProvider.getValue(SchedulerLifecycle.REGISTERED_GAUGE));
View Full Code Here

Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener.onLeading()

    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    registrationTimeout.getValue().run();
  }

  @Test
  public void testDefeatedBeforeRegistered() throws Exception {
View Full Code Here

Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener.onLeading()

    expectShutdown();

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    leaderListener.onDefeated(null);
  }

  @Test
  public void testStorageStartFails() throws Exception {
View Full Code Here

Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener.onLeading()

    replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();

    try {
      leaderListener.onLeading(leaderControl);
      fail();
    } catch (StorageException e) {
      // Expected.
    }
  }
View Full Code Here

Examples of com.twitter.common.zookeeper.SingletonService.LeadershipListener.onLeading()

    serviceManager.awaitStopped(5, TimeUnit.SECONDS);

    Capture<ExceptionalCommand<?>> shutdownCommand = replayAndCreateLifecycle();

    LeadershipListener leaderListener = schedulerLifecycle.prepare();
    leaderListener.onLeading(leaderControl);
    schedulerLifecycle.registered(new DriverRegistered());
    shutdownCommand.getValue().execute();
  }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.