Package org.apache.helix.manager.zk

Examples of org.apache.helix.manager.zk.MockParticipant


    });

    // start dummy participants
    for (int i = 0; i < n; i++) {
      String instanceName = "localhost_" + (START_PORT + i);
      _participants[i] = new MockParticipant(_zkaddr, CLUSTER_NAME, instanceName);

      // Register a Task state model factory.
      StateMachineEngine stateMachine = _participants[i].getStateMachineEngine();
      stateMachine.registerStateModelFactory(StateModelDefId.from("Task"),
          new TaskStateModelFactory(_participants[i], taskFactoryReg));
View Full Code Here


  @Test()
  public void testParticiptantNameCollision() throws Exception {
    logger.info("RUN TestParticipantNameCollision() at " + new Date(System.currentTimeMillis()));

    MockParticipant newParticipant = null;
    for (int i = 0; i < 1; i++) {
      String instanceName = "localhost_" + (START_PORT + i);
      try {
        // the call fails on getClusterManagerForParticipant()
        // no threads start
        newParticipant = new MockParticipant(_zkaddr, CLUSTER_NAME, instanceName);
        newParticipant.syncStart();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
View Full Code Here

    // start participants
    for (int i = 0; i < n; i++) {
      String instanceName = "localhost_" + (12918 + i);

      participants[i] = new MockParticipant(_zkaddr, clusterName, instanceName);
      participants[i].syncStart();
    }

    boolean result =
        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
View Full Code Here

    } catch (Exception e) {
      e.printStackTrace();
      exception = true;
    }
    Assert.assertFalse(exception);
    MockParticipant newParticipant =
        new MockParticipant(_zkaddr, CLUSTER_NAME, instanceName2);
    newParticipant.syncStart();

    result =
        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
            _zkaddr, CLUSTER_NAME));
    Assert.assertTrue(result);
View Full Code Here

        "MasterSlave", 3, true);

    // start dummy participants for the first cluster
    for (int i = 0; i < NODE_NR; i++) {
      String instanceName = "localhost_" + (START_PORT + i);
      _participants[i] = new MockParticipant(_zkaddr, firstCluster, instanceName);
      _participants[i].syncStart();
    }

    // start multi-cluster controllers
    for (int i = 0; i < NODE_NR; i++) {
View Full Code Here

        "MasterSlave", true);

    MockParticipant[] participants = new MockParticipant[5];
    for (int i = 0; i < 5; i++) {
      String instanceName = "localhost_" + (12918 + i);
      participants[i] = new MockParticipant(_zkaddr, clusterName, instanceName);
      participants[i].syncStart();
    }

    MockController controller =
        new MockController(_zkaddr, clusterName, "controller_0");
    controller.syncStart();

    boolean result;
    result =
        ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(
            _zkaddr, clusterName));
    Assert.assertTrue(result);

    // participant session expiry
    MockParticipant participantToExpire = participants[1];

    System.out.println("Expire participant session");
    String oldSessionId = participantToExpire.getSessionId();

    ZkTestHelper.expireSession(participantToExpire.getZkClient());
    String newSessionId = participantToExpire.getSessionId();
    System.out.println("oldSessionId: " + oldSessionId + ", newSessionId: " + newSessionId);
    Assert.assertTrue(newSessionId.compareTo(oldSessionId) > 0,
        "Session id should be increased after expiry");

    _setupTool.addResourceToCluster(clusterName, "TestDB1", 10, "MasterSlave");
View Full Code Here

    // start 1st participant
    MockParticipant[] participants = new MockParticipant[n];
    String instanceName1 = "localhost_12918";

    participants[0] = new MockParticipant(_zkaddr, clusterName, instanceName1);
    participants[0].getStateMachineEngine().registerStateModelFactory(StateModelDefId.from("Bootstrap"),
        new BootstrapStateModelFactory());
    participants[0].syncStart();

    boolean result =
        ClusterStateVerifier
            .verifyByZkCallback(new ClusterStateVerifier.BestPossAndExtViewZkVerifier(_zkaddr,
                clusterName));
    Assert.assertTrue(result);

    // start 2nd participant which will be the master for Test0_0
    String instanceName2 = "localhost_12919";
    participants[1] = new MockParticipant(_zkaddr, clusterName, instanceName2);
    participants[1].getStateMachineEngine().registerStateModelFactory(StateModelDefId.from("Bootstrap"),
        new BootstrapStateModelFactory());
    participants[1].syncStart();

    result =
View Full Code Here

    });

    // start dummy participants
    for (int i = 0; i < n; i++) {
      String instanceName = "localhost_" + (START_PORT + i);
      _participants[i] = new MockParticipant(_zkaddr, CLUSTER_NAME, instanceName);

      // Register a Task state model factory.
      StateMachineEngine stateMachine = _participants[i].getStateMachineEngine();
      stateMachine.registerStateModelFactory(StateModelDefId.from("Task"),
          new TaskStateModelFactory(_participants[i], taskFactoryReg));
View Full Code Here

        public Task createNewTask(TaskCallbackContext context) {
          return new SingleFailTask();
        }
      });

      _participants[i] = new MockParticipant(_zkaddr, CLUSTER_NAME, instanceName);

      // Register a Task state model factory.
      StateMachineEngine stateMachine = _participants[i].getStateMachineEngine();
      stateMachine.registerStateModelFactory(StateModelDefId.from("Task"),
          new TaskStateModelFactory(_participants[i], taskFactoryReg));
View Full Code Here

    MockParticipant[] participants = new MockParticipant[n];
    for (int i = 0; i < n; i++) {
      final String instanceName = "localhost_" + (12918 + i);

      participants[i] = new MockParticipant(_zkaddr, clusterName, instanceName);

      participants[i].syncStart();
    }

    boolean result =
View Full Code Here

TOP

Related Classes of org.apache.helix.manager.zk.MockParticipant

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.