@Test public void testFlowConfigurationMapInitIfAlreadyExists() { List<FlowConfiguration<?>> flowConfigs = new ArrayList<>(); HelloWorldFlowConfig helloWorldFlowConfig = new HelloWorldFlowConfig(); flowConfigs.add(helloWorldFlowConfig); flowConfigs.add(helloWorldFlowConfig); thrown.expect(UnsupportedOperationException.class); thrown.expectMessage("Event already registered: " + HelloWorldEvent.HELLOWORLD_TRIGGER_EVENT.event()); underTest.flowConfigurationMap(flowConfigs); }
@Bean public Map<String, FlowConfiguration<?>> flowConfigurationMap(List<FlowConfiguration<?>> flowConfigs) { Map<String, FlowConfiguration<?>> flowConfigMap = new HashMap<>(); for (FlowConfiguration<?> flowConfig : flowConfigs) { for (FlowEvent event : flowConfig.getInitEvents()) { String key = event.event(); if (flowConfigMap.get(key) != null) { throw new UnsupportedOperationException("Event already registered: " + key); } flowConfigMap.put(key, flowConfig); } } return ImmutableMap.copyOf(flowConfigMap); }
Flow2Config { @Bean public Map<String, FlowConfiguration<?>> flowConfigurationMap(List<FlowConfiguration<?>> flowConfigs) { Map<String, FlowConfiguration<?>> flowConfigMap = new HashMap<>(); for (FlowConfiguration<?> flowConfig : flowConfigs) { for (FlowEvent event : flowConfig.getInitEvents()) { String key = event.event(); if (flowConfigMap.get(key) != null) { throw new UnsupportedOperationException("Event already registered: " + key); } flowConfigMap.put(key, flowConfig); } } return ImmutableMap.copyOf(flowConfigMap); } }
Flow2Config { @Bean public Map<String, FlowConfiguration<?>> flowConfigurationMap(List<FlowConfiguration<?>> flowConfigs) { Map<String, FlowConfiguration<?>> flowConfigMap = new HashMap<>(); for (FlowConfiguration<?> flowConfig : flowConfigs) { for (FlowEvent event : flowConfig.getInitEvents()) { String key = event.event(); if (flowConfigMap.get(key) != null) { throw new UnsupportedOperationException("Event already registered: " + key); } flowConfigMap.put(key, flowConfig); } } return ImmutableMap.copyOf(flowConfigMap); }  }
Flow2Config { @Bean public Map<String, FlowConfiguration<?>> flowConfigurationMap(List<FlowConfiguration<?>> flowConfigs) { Map<String, FlowConfiguration<?>> flowConfigMap = new HashMap<>(); for (FlowConfiguration<?> flowConfig : flowConfigs) { for (FlowEvent event : flowConfig.getInitEvents()) { String key = event.event(); if (flowConfigMap.get(key) != null) { throw new UnsupportedOperationException("Event already registered: " + key); } flowConfigMap.put(key, flowConfig); } } return ImmutableMap.copyOf(flowConfigMap); }  @Bean Map<String, FlowConfiguration<?>> flowConfigurationMap(List<FlowConfiguration<?>> flowConfigs); @Bean Set<String> retryableEvents(List<RetryableFlowConfiguration<?>> retryableFlowConfigurations); @Bean Set<String> failHandledEvents(List<AbstractFlowConfiguration<?, ?>> flowConfigurations); }
Flow2Config { @Bean public Map<String, FlowConfiguration<?>> flowConfigurationMap(List<FlowConfiguration<?>> flowConfigs) { Map<String, FlowConfiguration<?>> flowConfigMap = new HashMap<>(); for (FlowConfiguration<?> flowConfig : flowConfigs) { for (FlowEvent event : flowConfig.getInitEvents()) { String key = event.event(); if (flowConfigMap.get(key) != null) { throw new UnsupportedOperationException("Event already registered: " + key); } flowConfigMap.put(key, flowConfig); } } return ImmutableMap.copyOf(flowConfigMap); }  @Bean Map<String, FlowConfiguration<?>> flowConfigurationMap(List<FlowConfiguration<?>> flowConfigs); @Bean Set<String> retryableEvents(List<RetryableFlowConfiguration<?>> retryableFlowConfigurations); @Bean Set<String> failHandledEvents(List<AbstractFlowConfiguration<?, ?>> flowConfigurations);  }