Package org.apache.helix.api.id

Examples of org.apache.helix.api.id.ClusterId


   * cluster.
   */
  @Test
  public void testRecreateCluster() {
    final String MODIFIER = "modifier";
    final ClusterId clusterId = ClusterId.from("TestAccessorRecreate!testCluster");

    // connect
    boolean connected = _gZkClient.waitUntilConnected(30000, TimeUnit.MILLISECONDS);
    if (!connected) {
      LOG.warn("Connection not established");
      return;
    }
    BaseDataAccessor<ZNRecord> baseAccessor = new ZkBaseDataAccessor<ZNRecord>(_gZkClient);
    HelixDataAccessor helixAccessor = new ZKHelixDataAccessor(clusterId.stringify(), baseAccessor);
    ClusterAccessor accessor = new ClusterAccessor(clusterId, helixAccessor);

    // create a cluster
    boolean created = createCluster(clusterId, accessor, MODIFIER, 1);
    Assert.assertTrue(created);
View Full Code Here


   * participant.
   */
  @Test
  public void testRecreateParticipant() {
    final String MODIFIER = "modifier";
    final ClusterId clusterId = ClusterId.from("testCluster");
    final ParticipantId participantId = ParticipantId.from("testParticipant");

    // connect
    boolean connected = _gZkClient.waitUntilConnected(30000, TimeUnit.MILLISECONDS);
    if (!connected) {
      LOG.warn("Connection not established");
      return;
    }
    BaseDataAccessor<ZNRecord> baseAccessor = new ZkBaseDataAccessor<ZNRecord>(_gZkClient);
    HelixDataAccessor helixAccessor = new ZKHelixDataAccessor(clusterId.stringify(), baseAccessor);
    ClusterAccessor accessor = new ClusterAccessor(clusterId, helixAccessor);

    // create the cluster
    boolean clusterCreated = createCluster(clusterId, accessor, MODIFIER, 0);
    Assert.assertTrue(clusterCreated);
View Full Code Here

  private static final long TIMEOUT = 30000L;
  private static final long EXTRA_WAIT = 10000L;

  @Test
  public void testClusterUpdates() {
    final ClusterId clusterId = ClusterId.from("TestAtomicAccessors!testCluster");
    final BaseDataAccessor<ZNRecord> baseAccessor = new ZkBaseDataAccessor<ZNRecord>(_gZkClient);
    final HelixDataAccessor helixAccessor =
        new ZKHelixDataAccessor(clusterId.stringify(), baseAccessor);
    final LockProvider lockProvider = new LockProvider();
    final StateModelDefId stateModelDefId = StateModelDefId.from("FakeModel");
    final State state = State.from("fake");
    final int constraint1 = 10;
    final int constraint2 = 11;
View Full Code Here

    System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis()));

    ClusterAccessor clusterAccessor = new ClusterAccessor(_clusterId, _dataAccessor);
    Cluster cluster = clusterAccessor.readCluster();

    ClusterId id = cluster.getId();
    Assert.assertEquals(id, _clusterId);
    Map<ParticipantId, Participant> liveParticipantMap = cluster.getLiveParticipantMap();
    Assert.assertEquals(liveParticipantMap.size(), n);

    for (ParticipantId participantId : liveParticipantMap.keySet()) {
View Full Code Here

    Assert.assertEquals(updated.getUserConfig().getSimpleField("key2"), "value2");
  }

  @Test
  public void testClusterConfigUpdate() {
    final ClusterId clusterId = ClusterId.from("cluster");
    final StateModelDefId masterSlave = StateModelDefId.from("MasterSlave");
    final State master = State.from("MASTER");
    final State slave = State.from("SLAVE");
    final State offline = State.from("OFFLINE");
View Full Code Here

    String clusterName = className + "_" + methodName;

    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));

    String zkAddr = ZK_ADDR;
    ClusterId clusterId = ClusterId.from(clusterName);
    ControllerId controllerId = ControllerId.from("controller");
    final ParticipantId participantId = ParticipantId.from("participant1");

    ResourceId resourceId = ResourceId.from("testDB");
    State master = State.from("MASTER");
View Full Code Here

    // create connection
    HelixConnection connection = new ZkHelixConnection(ZK_ADDR);
    connection.connect();

    // start auto-controller
    ClusterId clusterId = ClusterId.from(clusterName);
    final HelixAutoController[] controllers = new HelixAutoController[n];
    for (int i = 0; i < n; i++) {
      int port = 12918 + i;
      ControllerId controllerId = ControllerId.from("localhost_" + port);
      controllers[i] = connection.createAutoController(clusterId, controllerId);
View Full Code Here

    // create connection
    HelixConnection connection = new ZkHelixConnection(ZK_ADDR);
    connection.connect();

    // start participant
    ClusterId clusterId = ClusterId.from(clusterName);
    HelixParticipant[] participants = new HelixParticipant[n];
    for (int i = 0; i < n; i++) {
      int port = 12918 + i;
      ParticipantId participantId = ParticipantId.from("localhost_" + port);
View Full Code Here

    // create connection
    HelixConnection connection = new ZkHelixConnection(ZK_ADDR);
    connection.connect();

    // start controller
    ClusterId clusterId = ClusterId.from(clusterName);
    ControllerId controllerId = ControllerId.from("controller");
    HelixController controller = connection.createController(clusterId, controllerId);
    controller.startAsync();

    // check leader znode exists
View Full Code Here

    // create connection
    HelixConnection connection = new ZkHelixConnection(ZK_ADDR);
    connection.connect();

    // start controller
    ClusterId clusterId = ClusterId.from(clusterName);
    final ControllerId controllerId = ControllerId.from("controller");

    // start controller
    HelixController controller = connection.createController(clusterId, controllerId);
    controller.startAsync();
View Full Code Here

TOP

Related Classes of org.apache.helix.api.id.ClusterId

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.