Package org.apache.helix.manager.zk

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


    // start first cluster
    _participants = new MockParticipant[n];
    _firstClusterName = _clusterNamePrefix + "0_0";
    for (int i = 0; i < n; i++) {
      String instanceName = "localhost0_" + (12918 + i);
      _participants[i] = new MockParticipant(_zkaddr, _firstClusterName, instanceName);
      _participants[i].syncStart();
    }

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


    // Register 4 per-instance resource mbean
    Assert.assertEquals(nMbeansUnregistered, listener._nMbeansUnregistered - 16);
    Assert.assertEquals(nMbeansRegistered, listener._nMbeansRegistered - 12);

    String instanceName = "localhost0_" + (12918 + 0);
    _participants[0] = new MockParticipant(_zkaddr, _firstClusterName, instanceName);
    _participants[0].syncStart();

    // 1 participant comes back
    // No change in instance/resource mbean
    // Register 1 per-instance resource mbean
View Full Code Here

    // start n-1 participants
    for (int i = 1; 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,
            clusterName));
    Assert.assertTrue(result);

    // start the remaining 1 participant
    participants[0] = new MockParticipant(_zkaddr, clusterName, "localhost_12918");
    participants[0].syncStart();

    // make sure we have all participants in MASTER state
    result =
        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
View Full Code Here

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

      participants[i] = new MockParticipant(_zkaddr, clusterName, instanceName);
      participants[i].getMessagingService().registerMessageHandlerFactory(DUMMY_MSG_TYPE,
          new DummyMessageHandlerFactory(handledMsgSet));
      participants[i].syncStart();
    }
View Full Code Here

      config.setHostName(host);
      config.setPort(Integer.toString(port));
      config.getRecord().setSimpleField("IPC_PORT", Integer.toString(ipcPort));
      admin.addInstance(CLUSTER_NAME, config);
      _socketMap.put(instanceName, new InetSocketAddress(host, ipcPort));
      _participants[i] = new MockParticipant(_zkaddr, CLUSTER_NAME, instanceName);
      _participants[i].syncStart();
    }

    // Start controller
    _controller = new MockController(_zkaddr, CLUSTER_NAME, "controller_0");
View Full Code Here

    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, TEST_DB, _replica);

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

    // start controller
    String controllerName = "controller_0";
View Full Code Here

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

      if (i == 0) {
        participants[i] =
            new MockParticipant(_zkaddr, clusterName, instanceName);
        participants[i].setTransition(new ErrTransition(errPartitions));
      } else {
        participants[i] = new MockParticipant(_zkaddr, clusterName, instanceName);
      }
      participants[i].syncStart();
    }

    // verify cluster
View Full Code Here

    // start participants
    MockParticipant[] participants = new MockParticipant[n];
    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
View Full Code Here

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

      if (i == 4) {
        participants[i] = new MockParticipant(_zkaddr, clusterName, instanceName);
        participants[i].setTransition(new KillOtherTransition(participants[0]));
      } else {
        participants[i] = new MockParticipant(_zkaddr, clusterName, instanceName);
      }

      participants[i].syncStart();
    }

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

    // restart
    Thread.sleep(500);
    MockParticipant participant =
        new MockParticipant(_zkaddr, participants[0].getClusterName(),
            participants[0].getInstanceName());
    System.err.println("Restart " + participant.getInstanceName());
    participant.syncStart();
    result =
        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
            clusterName));
    Assert.assertTrue(result);

    // clean up
    controller.syncStop();
    for (int i = 0; i < 5; i++) {
      participants[i].syncStop();
    }
    participant.syncStop();

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

  }
View Full Code Here

      _other = new AtomicReference<MockParticipant>(other);
    }

    @Override
    public void doTransition(Message message, NotificationContext context) {
      MockParticipant other = _other.getAndSet(null);
      if (other != null) {
        System.err.println("Kill " + other.getInstanceName()
            + ". Interrupted exceptions are IGNORABLE");
        other.syncStop();
      }
    }
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.