ExecutorUtils { public static int getMaxConcurrentRunsForFlow(String projectName, String flowName, int defaultMaxConcurrentRuns, Map<Pair<String, String>, Integer> maxConcurrentRunsFlowMap) { return maxConcurrentRunsFlowMap.getOrDefault(new Pair(projectName, flowName), defaultMaxConcurrentRuns); } 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 testGetMaxConcurrentRunsForFlow() { Props props = new Props(); props.put(Constants.ConfigurationKeys.MAX_CONCURRENT_RUNS_ONEFLOW, 10); props.put(ConfigurationKeys.CONCURRENT_RUNS_ONEFLOW_WHITELIST, "project1,flow1,300;project2,flow2,5"); Map<Pair<String, String>, Integer> map = ExecutorUtils.getMaxConcurentRunsPerFlowMap(props); int defaultMaxConcurrent = ExecutorUtils.getMaxConcurrentRunsOneFlow(props); assertThat(ExecutorUtils.getMaxConcurrentRunsForFlow("project1", "flow1", defaultMaxConcurrent, map)).isEqualTo(300); assertThat(ExecutorUtils.getMaxConcurrentRunsForFlow("project2", "flow2", defaultMaxConcurrent, map)).isEqualTo(5); assertThat(ExecutorUtils.getMaxConcurrentRunsForFlow("project3", "flow3", defaultMaxConcurrent, map)).isEqualTo(10); assertThat(ExecutorUtils.getMaxConcurrentRunsForFlow("project1", "flow1", defaultMaxConcurrent, Collections.EMPTY_MAP)).isEqualTo(10); }