Source:
private Map<String, Map<String, String>> createPartitionConfig(List<String> taskStates, List<String> expectedTaskEndingStates) throws Exception { Map<String, Map<String, String>> targetPartitionConfigs = new HashMap<>(); boolean isExternalViewCreated = TestHelper.verify(() -> { ExternalView externalView = _manager.getClusterManagmentTool().getResourceExternalView(CLUSTER_NAME, DB_NAME); return (externalView != null); }, TestHelper.WAIT_DURATION); Assert.assertTrue(isExternalViewCreated); ExternalView externalView = _manager.getClusterManagmentTool().getResourceExternalView(CLUSTER_NAME, DB_NAME); Set<String> partitionSet = externalView.getPartitionSet(); if (taskStates.size() != partitionSet.size()) { throw new IllegalArgumentException( "Input size does not match number of partitions for target resource: " + DB_NAME); } int i = 0; for (String partition : partitionSet) { Map<String, String> config = new HashMap<>(); if (taskStates.get(i).equals(TaskPartitionState.COMPLETED.name())) { config.put(MockTask.TASK_RESULT_STATUS, TaskResult.Status.COMPLETED.name()); } else if (taskStates.get(i).equals(TaskPartitionState.TASK_ERROR.name())) { config.put(MockTask.TASK_RESULT_STATUS, TaskResult.Status.FAILED.name()); } else if (taskStates.get(i).equals(TaskPartitionState.TASK_ABORTED.name())) { config.put(MockTask.TASK_RESULT_STATUS, TaskResult.Status.FATAL_FAILED.name()); } else if (taskStates.get(i).equals(TaskPartitionState.RUNNING.name())) { config.put(MockTask.JOB_DELAY, "99999999"); } else { throw new IllegalArgumentException("Invalid taskStates input: " + taskStates.get(i)); } config.put(EXPECTED_ENDING_STATE, expectedTaskEndingStates.get(i)); targetPartitionConfigs.put(partition, config); i++; } return targetPartitionConfigs; }

Target:
private Map<String, Map<String, String>> createPartitionConfig(List<String> taskStates, List<String> expectedTaskEndingStates) throws Exception { Map<String, Map<String, String>> targetPartitionConfigs = new HashMap<>(); Assert.assertTrue(TestHelper.verify(() -> { ExternalView externalView = _manager.getClusterManagmentTool().getResourceExternalView(CLUSTER_NAME, DB_NAME); return externalView != null; }, TestHelper.WAIT_DURATION)); ExternalView externalView = _manager.getClusterManagmentTool().getResourceExternalView(CLUSTER_NAME, DB_NAME); Set<String> partitionSet = externalView.getPartitionSet(); if (taskStates.size() != partitionSet.size()) { throw new IllegalArgumentException( "Input size does not match number of partitions for target resource: " + DB_NAME); } int i = 0; for (String partition : partitionSet) { Map<String, String> config = new HashMap<>(); if (taskStates.get(i).equals(TaskPartitionState.COMPLETED.name())) { config.put(MockTask.TASK_RESULT_STATUS, TaskResult.Status.COMPLETED.name()); } else if (taskStates.get(i).equals(TaskPartitionState.TASK_ERROR.name())) { config.put(MockTask.TASK_RESULT_STATUS, TaskResult.Status.FAILED.name()); } else if (taskStates.get(i).equals(TaskPartitionState.TASK_ABORTED.name())) { config.put(MockTask.TASK_RESULT_STATUS, TaskResult.Status.FATAL_FAILED.name()); } else if (taskStates.get(i).equals(TaskPartitionState.RUNNING.name())) { config.put(MockTask.JOB_DELAY, "99999999"); } else { throw new IllegalArgumentException("Invalid taskStates input: " + taskStates.get(i)); } config.put(EXPECTED_ENDING_STATE, expectedTaskEndingStates.get(i)); targetPartitionConfigs.put(partition, config); i++; } return targetPartitionConfigs; }