AdminHelper { public JSONObject getControllerAutobalancingStatus() { return getControllerAutobalancingStatus("", ""); } AdminHelper(ControllerHelixManager helixManager); Map<String, Boolean> setControllerAutobalancing(boolean enable); JSONObject getControllerAutobalancingStatus(); JSONObject getControllerAutobalancingStatus(String srcCluster, String dstCluster); Map<String, Boolean> setControllerAutobalancing(String srcCluster, String dstCluster, boolean enable);  }
@Test public void testGetControllerAutobalancing() throws Exception { ControllerHelixManager mockHelixManager = EasyMock.createMock(ControllerHelixManager.class); AdminHelper helper = new AdminHelper(mockHelixManager); Map<String, PriorityQueue<InstanceTopicPartitionHolder>> instanceMap = new HashMap<>(); PriorityQueue<InstanceTopicPartitionHolder> sjc1aTosjc1Agg1 = new PriorityQueue<>(); String pipeline = ControllerUtils.getPipelineName("sjc1a", "sjc1-agg1"); InstanceTopicPartitionHolder ith = new InstanceTopicPartitionHolder("compute9527-sjc1", new TopicPartition(pipeline, 0)); sjc1aTosjc1Agg1.add(ith); instanceMap.put(pipeline, sjc1aTosjc1Agg1); EasyMock.expect(mockHelixManager.getPipelineToInstanceMap()).andReturn(instanceMap).atLeastOnce(); EasyMock.expect(mockHelixManager.getControllerAutobalancingStatus("compute9527-sjc1")) .andReturn(false); EasyMock.replay(mockHelixManager); JSONObject status = helper.getControllerAutobalancingStatus(); Assert.assertEquals(status.size(), 1); JSONObject detail = (JSONObject) status.get("compute9527-sjc1"); Assert.assertEquals(detail.get("autoBalance"), false); EasyMock.verify(mockHelixManager); }