Package org.apache.helix.participant

Examples of org.apache.helix.participant.DistClusterControllerElection


        final String path =
            PropertyPathConfig.getPath(PropertyType.CONTROLLER, _clusterName);

        _leaderElectionHandler =
            createCallBackHandler(path,
                                  new DistClusterControllerElection(_zkConnectString),
                                  new EventType[] { EventType.NodeChildrenChanged,
                                      EventType.NodeDeleted, EventType.NodeCreated },
                                  ChangeType.CONTROLLER);
      }
      else
View Full Code Here


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

    DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
    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);
    election = new DistClusterControllerElection(ZK_ADDR);
    context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.INIT);
    election.onControllerChange(context);
//    leaderRecord = _gZkClient.<ZNRecord> readData(path);
    liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
    AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());
    // AssertJUnit.assertNull(election.getController());
    // AssertJUnit.assertNull(election.getLeader());
View Full Code Here

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

    DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
    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);
    election = new DistClusterControllerElection(ZK_ADDR);
    context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.CALLBACK);
    election.onControllerChange(context);

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

//    leaderRecord = _gZkClient.<ZNRecord> readData(path);
View Full Code Here

    final String controllerName = "participant_0";
    HelixManager manager = new MockZKHelixManager(clusterName, controllerName,
                               InstanceType.PARTICIPANT,
                               _gZkClient);

    DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
    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, true);
    AssertJUnit.assertNull(leaderRecord);
    // AssertJUnit.assertNull(election.getController());
View Full Code Here

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

    DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
    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);
    election = new DistClusterControllerElection(ZK_ADDR);
    context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.INIT);
    election.onControllerChange(context);
    // leaderRecord = _gZkClient.<ZNRecord> readData(path);
    liveInstance = accessor.getProperty(keyBuilder.controllerLeader());
    AssertJUnit.assertEquals(controllerName, liveInstance.getInstanceName());
    // AssertJUnit.assertNull(election.getController());
    // AssertJUnit.assertNull(election.getLeader());
View Full Code Here

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

    DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
    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);
    election = new DistClusterControllerElection(ZK_ADDR);
    context = new NotificationContext(manager);
    context.setType(NotificationContext.Type.CALLBACK);
    election.onControllerChange(context);

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

    // leaderRecord = _gZkClient.<ZNRecord> readData(path);
View Full Code Here

    final String controllerName = "participant_0";
    HelixManager manager =
        new MockZKHelixManager(clusterName, controllerName, InstanceType.PARTICIPANT, _gZkClient);

    DistClusterControllerElection election = new DistClusterControllerElection(ZK_ADDR);
    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, true);
    AssertJUnit.assertNull(leaderRecord);
    // AssertJUnit.assertNull(election.getController());
View Full Code Here

        _leaderElectionHandler.reset();
        _leaderElectionHandler.init();
      } else {
        _leaderElectionHandler =
              createCallBackHandler(new Builder(_clusterName).controller(),
                                    new DistClusterControllerElection(_zkConnectString),
                                    new EventType[] { EventType.NodeChildrenChanged,
                                        EventType.NodeDeleted, EventType.NodeCreated },
                                    ChangeType.CONTROLLER);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.helix.participant.DistClusterControllerElection

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.