ExecutorUtils { public static Map<Pair<String, String>, Integer> getMaxConcurentRunsPerFlowMap( final Props azkProps) { Map<Pair<String, String>, Integer> map = new HashMap<>(); String perFlowSettings = azkProps.get(ConfigurationKeys.CONCURRENT_RUNS_ONEFLOW_WHITELIST); if (perFlowSettings != null) { String[] flowSettings = perFlowSettings.split(";"); for (String flowSetting: flowSettings) { String[] setting = flowSetting.split(","); Preconditions.checkState(setting.length == 3, "setting value must be specified as <project name>,<flow name>,<max concurrent runs>"); Pair<String, String> key = new Pair(setting[0], setting[1]); Integer maxRuns = Integer.parseInt(setting[2]); map.put(key, maxRuns); } } return map; } private  ExecutorUtils(); static int getMaxConcurrentRunsOneFlow(final Props azkProps); static Map<Pair<String, String>, Integer> getMaxConcurentRunsPerFlowMap(
      final Props azkProps); static int getMaxConcurrentRunsForFlow(String projectName, String flowName,
      int defaultMaxConcurrentRuns, Map<Pair<String, String>, Integer> maxConcurrentRunsFlowMap);  }
@Test public void testGetMaxConcurentRunsPerFlowMap() { Props props = new Props(); assertThat(ExecutorUtils.getMaxConcurentRunsPerFlowMap(props).size()).isEqualTo(0); props.put(ConfigurationKeys.CONCURRENT_RUNS_ONEFLOW_WHITELIST, "project1,flow1,300;project2,flow2,5"); Map<Pair<String, String>, Integer> map = ExecutorUtils.getMaxConcurentRunsPerFlowMap(props); assertThat(map.size()).isEqualTo(2); assertThat(map.get(new Pair("project1", "flow1"))).isEqualTo(300); assertThat(map.get(new Pair("project2", "flow2"))).isEqualTo(5); props.put(ConfigurationKeys.CONCURRENT_RUNS_ONEFLOW_WHITELIST, "project1,flow1,300;project2,5"); assertThatThrownBy(() -> ExecutorUtils.getMaxConcurentRunsPerFlowMap(props)).isInstanceOf (IllegalStateException.class); }