Map<String, Map<String, String>> errStates = new HashMap<String, Map<String, String>>();
errStates.put("TestDB0", new HashMap<String, String>());
errStates.get("TestDB0").put("TestDB0_0", "localhost_12918");
boolean result =
ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
clusterName, errStates));
Assert.assertTrue(result);
// check state-models in state-machine
HelixStateMachineEngine stateMachine =
(HelixStateMachineEngine) participants[0].getStateMachineEngine();
StateTransitionHandlerFactory<? extends TransitionHandler> fty =
stateMachine.getStateModelFactory(StateModelDefId.from("MasterSlave"));
Map<PartitionId, String> expectStateModelMap = new TreeMap<PartitionId, String>();
expectStateModelMap.put(PartitionId.from("TestDB0_0"), "ERROR");
expectStateModelMap.put(PartitionId.from("TestDB0_1"), "MASTER");
expectStateModelMap.put(PartitionId.from("TestDB0_2"), "SLAVE");
expectStateModelMap.put(PartitionId.from("TestDB0_3"), "MASTER");
checkStateModelMap(fty, expectStateModelMap);
// drop resource
HelixAdmin admin = new ZKHelixAdmin(_zkclient);
admin.dropResource(clusterName, "TestDB0");
result =
ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(_zkaddr,
clusterName));
Assert.assertTrue(result);
// check state models have been dropped also
Assert.assertTrue(fty.getPartitionSet().isEmpty(),