Package org.apache.helix.controller

Examples of org.apache.helix.controller.GenericHelixController$ClusterEventProcessor


    TestHelper.setupEmptyCluster(_zkclient, clusterName);

    String controllerName = "controller_0";
    MockController controller = new MockController(_zkaddr, clusterName, controllerName);
    GenericHelixController pipeline = new GenericHelixController();

    ZkHelixLeaderElection leader = new ZkHelixLeaderElection(controller.getController(), pipeline);
    NotificationContext context = new NotificationContext(controller);
    context.setType(NotificationContext.Type.INIT);
    leader.onControllerChange(context);

    LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
    AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());

    // Start another controller, leader should remain unchanged
    String controllerName1 = "controller_1";
    MockController controller1 = new MockController(_zkaddr, clusterName, controllerName1);
    GenericHelixController pipeline1 = new GenericHelixController();
    ZkHelixLeaderElection leader1 = new ZkHelixLeaderElection(controller1.getController(), pipeline1);
    NotificationContext context1 = new NotificationContext(controller1);
    context1.setType(NotificationContext.Type.INIT);
    leader1.onControllerChange(context1);
    liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
View Full Code Here


    TestHelper.setupEmptyCluster(_zkclient, clusterName);

    String controllerName = "controller_0";
    MockMultiClusterController controller = new MockMultiClusterController(_zkaddr, clusterName, controllerName);
    GenericHelixController pipeline = new GenericHelixController();

    ZkHelixLeaderElection leader = new ZkHelixLeaderElection(controller.getController(), pipeline);
    NotificationContext context = new NotificationContext(controller);
    context.setType(NotificationContext.Type.CALLBACK);
    leader.onControllerChange(context);

    LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
    AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());

    // Start another controller, leader should remain unchanged
    MockMultiClusterController controller1 = new MockMultiClusterController(_zkaddr, clusterName, "controller_1");

    GenericHelixController pipeline1 = new GenericHelixController();
    ZkHelixLeaderElection leader1 = new ZkHelixLeaderElection(controller.getController(), pipeline1);
    context = new NotificationContext(controller);
    context.setType(NotificationContext.Type.CALLBACK);
    leader1.onControllerChange(context);
    liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
View Full Code Here

  public ZkHelixController(ZkHelixConnection connection, ClusterId clusterId,
      ControllerId controllerId) {
    _connection = connection;
    _clusterId = clusterId;
    _controllerId = controllerId;
    _pipeline = new GenericHelixController();
    _clusterAccessor = connection.createClusterAccessor(clusterId);
    _accessor = connection.createDataAccessor(clusterId);

    _messagingService = (DefaultMessagingService) connection.createMessagingService(this);
    _timerTasks = new ArrayList<HelixTimerTask>();
View Full Code Here

  public ZkHelixController(ZkHelixConnection connection, ClusterId clusterId, ControllerId controllerId) {
    _connection = connection;
    _clusterId = clusterId;
    _controllerId = controllerId;
    _pipeline = new GenericHelixController();
    _clusterAccessor = connection.createClusterAccessor(clusterId);
    _accessor = connection.createDataAccessor(clusterId);

    _messagingService = (DefaultMessagingService) connection.createMessagingService(this);
    _timerTasks = new ArrayList<HelixTimerTask>();
View Full Code Here

    TestHelper.setupEmptyCluster(_gZkClient, clusterName);

    final String controllerName = "controller_0";
    HelixManager manager =
        new MockZKHelixManager(clusterName, controllerName, InstanceType.CONTROLLER, _gZkClient);
    GenericHelixController controller0 = new GenericHelixController();

    List<HelixTimerTask> timerTasks = Collections.emptyList();
    DistributedLeaderElection election =
        new DistributedLeaderElection(manager, controller0, timerTasks);
    NotificationContext context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.INIT);
    election.onControllerChange(context);

    // path = PropertyPathConfig.getPath(PropertyType.LEADER, clusterName);
    // ZNRecord leaderRecord = _gZkClient.<ZNRecord> readData(path);
    LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
    AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());
    // AssertJUnit.assertNotNull(election.getController());
    // AssertJUnit.assertNull(election.getLeader());

    manager =
        new MockZKHelixManager(clusterName, "controller_1", InstanceType.CONTROLLER, _gZkClient);
    GenericHelixController controller1 = new GenericHelixController();
    election = new DistributedLeaderElection(manager, controller1, timerTasks);
    context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.INIT);
    election.onControllerChange(context);
    // leaderRecord = _gZkClient.<ZNRecord> readData(path);
View Full Code Here

    final String controllerName = "controller_0";
    HelixManager manager =
        new MockZKHelixManager(clusterName, controllerName, InstanceType.CONTROLLER_PARTICIPANT,
            _gZkClient);
    GenericHelixController controller0 = new GenericHelixController();
    List<HelixTimerTask> timerTasks = Collections.emptyList();

    DistributedLeaderElection election =
        new DistributedLeaderElection(manager, controller0, timerTasks);
    NotificationContext context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.CALLBACK);
    election.onControllerChange(context);

    LiveInstance liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
    AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());

    // path = PropertyPathConfig.getPath(PropertyType.LEADER, clusterName);
    // ZNRecord leaderRecord = _gZkClient.<ZNRecord> readData(path);
    // AssertJUnit.assertEquals(controllerName, leaderRecord.getSimpleField("LEADER"));
    // AssertJUnit.assertNotNull(election.getController());
    // AssertJUnit.assertNotNull(election.getLeader());

    manager =
        new MockZKHelixManager(clusterName, "controller_1", InstanceType.CONTROLLER_PARTICIPANT,
            _gZkClient);
    GenericHelixController controller1 = new GenericHelixController();
    election = new DistributedLeaderElection(manager, controller1, timerTasks);
    context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.CALLBACK);
    election.onControllerChange(context);
View Full Code Here

    TestHelper.setupEmptyCluster(_gZkClient, clusterName);

    final String controllerName = "participant_0";
    HelixManager manager =
        new MockZKHelixManager(clusterName, controllerName, InstanceType.PARTICIPANT, _gZkClient);
    GenericHelixController participant0 = new GenericHelixController();
    List<HelixTimerTask> timerTasks = Collections.emptyList();

    DistributedLeaderElection election =
        new DistributedLeaderElection(manager, participant0, timerTasks);
    NotificationContext context = new NotificationContext(manager);
View Full Code Here

TOP

Related Classes of org.apache.helix.controller.GenericHelixController$ClusterEventProcessor

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.