kaisun2000 commented on issue #1418:
URL: https://github.com/apache/helix/issues/1418#issuecomment-699551282


   code
   ```
      // start controller
       String controllerName = CONTROLLER_PREFIX + "_0";
       _controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, 
controllerName);
       _controller.syncStart();
   
       Thread.sleep(1000);
   
       // verify ideal state and external view
       IdealState idealState = 
_accessor.getProperty(_keyBuilder.idealStates(DB_NAME));
       Assert.assertNotNull(idealState);
       Assert.assertEquals(idealState.getNumPartitions(), PARTITION_NUMBER);
       for (String partition : idealState.getPartitionSet()) {
         List<String> preferenceList = idealState.getPreferenceList(partition);
         Assert.assertNotNull(preferenceList);
         Assert.assertEquals(preferenceList.size(), REPLICA_NUMBER);
       }
   
       ExternalView externalView = 
_accessor.getProperty(_keyBuilder.externalView(DB_NAME));
       Assert.assertNotNull(externalView);
       Assert.assertEquals(externalView.getPartitionSet().size(), 
PARTITION_NUMBER);
       for (String partition : externalView.getPartitionSet()) {
         Map<String, String> stateMap = externalView.getStateMap(partition);
         Assert.assertEquals(stateMap.size(), REPLICA_NUMBER);
   
         int masters = 0;
         for (String state : stateMap.values()) {
           if (state.equals(MasterSlaveSMD.States.MASTER.name())) {
             ++masters;
           }
         }
         Assert.assertEquals(masters, 1);
       }
   
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to