Program: 62148
Project: 62148
Buggy source:
private void fillDTOWithNodesSubstitutionConfiguration(FlowExecutionContext executionContext,DeploymentTopology deploymentTopology,DeploymentTopologyDTO deploymentTopologyDTO,DeploymentMatchingConfiguration matchingConfiguration,DeploymentSubstitutionConfiguration substitutionConfiguration){
  deploymentTopology.setOriginalNodes((Map<String,NodeTemplate>)executionContext.getExecutionCache().get(FlowExecutionContext.MATCHING_ORIGINAL_NODES));
  deploymentTopology.setSubstitutedNodes(matchingConfiguration.getMatchedLocationResources());
  Map<String,LocationResourceTemplate> allLocationResourcesTemplates=(Map<String,LocationResourceTemplate>)executionContext.getExecutionCache().get(FlowExecutionContext.MATCHED_NODE_LOCATION_TEMPLATES_BY_ID_MAP);
  Map<String,LocationResourceTemplate> substitutedLocationResourceTemplate=Maps.newHashMap();
  matchingConfiguration.getMatchedLocationResources().values().forEach((locationResourceId) -> substitutedLocationResourceTemplate.put(locationResourceId,safe(allLocationResourcesTemplates).get(locationResourceId)));
  deploymentTopologyDTO.setLocationResourceTemplates(substitutedLocationResourceTemplate);
  substitutionConfiguration.setAvailableSubstitutions((Map<String,Set<String>>)executionContext.getExecutionCache().get(FlowExecutionContext.SELECTED_MATCH_NODE_LOCATION_TEMPLATE_BY_NODE_ID_MAP));
  substitutionConfiguration.setSubstitutionsTemplates(allLocationResourcesTemplates);
  substitutionConfiguration.getSubstitutionTypes().addFrom(locationResourceService.getLocationResourceTypes(safe(substitutionConfiguration.getSubstitutionsTemplates()).values()));
  enrichSubstitutionTypesWithServicesDependencies(safe(substitutionConfiguration.getSubstitutionsTemplates()).values(),substitutionConfiguration.getSubstitutionTypes());
}

Fixed version (ground truth):
private void fillDTOWithNodesSubstitutionConfiguration(FlowExecutionContext executionContext,DeploymentTopology deploymentTopology,DeploymentTopologyDTO deploymentTopologyDTO,DeploymentMatchingConfiguration matchingConfiguration,DeploymentSubstitutionConfiguration substitutionConfiguration){
  deploymentTopology.setOriginalNodes((Map<String,NodeTemplate>)executionContext.getExecutionCache().get(FlowExecutionContext.MATCHING_ORIGINAL_NODES));
  deploymentTopology.setSubstitutedNodes(matchingConfiguration.getMatchedLocationResources());
  deploymentTopology.setMatchReplacedNodes((Map<String,NodeTemplate>)executionContext.getExecutionCache().get(FlowExecutionContext.MATCHING_REPLACED_NODES));
  Map<String,LocationResourceTemplate> allLocationResourcesTemplates=(Map<String,LocationResourceTemplate>)executionContext.getExecutionCache().get(FlowExecutionContext.MATCHED_NODE_LOCATION_TEMPLATES_BY_ID_MAP);
  Map<String,LocationResourceTemplate> substitutedLocationResourceTemplate=Maps.newHashMap();
  matchingConfiguration.getMatchedLocationResources().values().forEach((locationResourceId) -> substitutedLocationResourceTemplate.put(locationResourceId,safe(allLocationResourcesTemplates).get(locationResourceId)));
  deploymentTopologyDTO.setLocationResourceTemplates(substitutedLocationResourceTemplate);
  substitutionConfiguration.setAvailableSubstitutions((Map<String,Set<String>>)executionContext.getExecutionCache().get(FlowExecutionContext.SELECTED_MATCH_NODE_LOCATION_TEMPLATE_BY_NODE_ID_MAP));
  substitutionConfiguration.setSubstitutionsTemplates(allLocationResourcesTemplates);
  substitutionConfiguration.getSubstitutionTypes().addFrom(locationResourceService.getLocationResourceTypes(safe(substitutionConfiguration.getSubstitutionsTemplates()).values()));
  enrichSubstitutionTypesWithServicesDependencies(safe(substitutionConfiguration.getSubstitutionsTemplates()).values(),substitutionConfiguration.getSubstitutionTypes());
}