Search in sources :

Example 1 with RebalanceConfig

use of org.apache.helix.api.config.RebalanceConfig in project helix by apache.

the class TestStateTransitionTimeoutWithResource method testStateTransitionTimeOut.

@Test
public void testStateTransitionTimeOut() throws Exception {
    _setupTool.addResourceToCluster(CLUSTER_NAME, TEST_DB, _PARTITIONS, STATE_MODEL);
    _setupTool.getClusterManagementTool().enableResource(CLUSTER_NAME, TEST_DB, false);
    _setupTool.rebalanceStorageCluster(CLUSTER_NAME, TEST_DB, 3);
    // Set the timeout values
    StateTransitionTimeoutConfig stateTransitionTimeoutConfig = new StateTransitionTimeoutConfig(new ZNRecord(TEST_DB));
    stateTransitionTimeoutConfig.setStateTransitionTimeout("SLAVE", "MASTER", 300);
    ResourceConfig resourceConfig = new ResourceConfig.Builder(TEST_DB).setStateTransitionTimeoutConfig(stateTransitionTimeoutConfig).setRebalanceConfig(new RebalanceConfig(new ZNRecord(TEST_DB))).setNumPartitions(_PARTITIONS).setHelixEnabled(false).build();
    _configAccessor.setResourceConfig(CLUSTER_NAME, TEST_DB, resourceConfig);
    setParticipants(TEST_DB);
    _setupTool.getClusterManagementTool().enableResource(CLUSTER_NAME, TEST_DB, true);
    boolean result = ClusterStateVerifier.verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR, CLUSTER_NAME));
    Assert.assertTrue(result);
    verify(TEST_DB);
}
Also used : MasterNbInExtViewVerifier(org.apache.helix.tools.ClusterStateVerifier.MasterNbInExtViewVerifier) StateTransitionTimeoutConfig(org.apache.helix.api.config.StateTransitionTimeoutConfig) ResourceConfig(org.apache.helix.model.ResourceConfig) ZNRecord(org.apache.helix.ZNRecord) RebalanceConfig(org.apache.helix.api.config.RebalanceConfig) Test(org.testng.annotations.Test)

Aggregations

ZNRecord (org.apache.helix.ZNRecord)1 RebalanceConfig (org.apache.helix.api.config.RebalanceConfig)1 StateTransitionTimeoutConfig (org.apache.helix.api.config.StateTransitionTimeoutConfig)1 ResourceConfig (org.apache.helix.model.ResourceConfig)1 MasterNbInExtViewVerifier (org.apache.helix.tools.ClusterStateVerifier.MasterNbInExtViewVerifier)1 Test (org.testng.annotations.Test)1