@Test public void a_job_with_two_configured_keys_is_is_handling_them_but_third_own_is_ignored() { PDSJobConfiguration config = new PDSJobConfiguration(); config.setProductId("productid1"); PDSExecutionParameterEntry entry1 = new PDSExecutionParameterEntry(); entry1.setKey("p1.keya"); entry1.setValue("value1"); PDSExecutionParameterEntry entry2 = new PDSExecutionParameterEntry(); entry2.setKey("p1.keyb"); entry2.setValue("value2"); config.getParameters().add(entry1); config.getParameters().add(entry2); PDSProductSetup setup = new PDSProductSetup(); setup.setId("productid1"); PDSProdutParameterDefinition def1 = new PDSProdutParameterDefinition(); def1.setKey("p1.keya"); PDSProdutParameterDefinition def2 = new PDSProdutParameterDefinition(); def2.setKey("p1.keyb"); setup.getParameters().getMandatory().add(def1); setup.getParameters().getOptional().add(def2); when(serverConfigService.getProductSetupOrNull("productid1")).thenReturn(setup); when(converter.convertKeyToEnv("p1.keya")).thenReturn("KEY_A"); when(converter.convertKeyToEnv("p1.keyb")).thenReturn("KEY_B"); when(converter.convertKeyToEnv("p1.keyc.unknown")).thenReturn("KEY_C"); Map<String, String> result = serviceToTest.buildEnvironmentMap(config); assertEquals("value1",result.get("KEY_A")); assertEquals("value2",result.get("KEY_B")); assertEquals(null,result.get("KEY_C")); }
public Map<String, String> buildEnvironmentMap(PDSJobConfiguration config) { String productId = config.getProductId(); PDSProductSetup productSetup = serverConfigService.getProductSetupOrNull(productId); if (productSetup == null) { LOG.error("No product setup found for product id:{}", productId); return Collections.emptyMap(); } Map<String, String> map = new LinkedHashMap<>(); List<PDSExecutionParameterEntry> jobParams = config.getParameters(); for (PDSExecutionParameterEntry jobParam : jobParams) { addJobParamDataWhenAccepted(productSetup, jobParam, map); } return map; }
PDSExecutionEnvironmentService { public Map<String, String> buildEnvironmentMap(PDSJobConfiguration config) { String productId = config.getProductId(); PDSProductSetup productSetup = serverConfigService.getProductSetupOrNull(productId); if (productSetup == null) { LOG.error("No product setup found for product id:{}", productId); return Collections.emptyMap(); } Map<String, String> map = new LinkedHashMap<>(); List<PDSExecutionParameterEntry> jobParams = config.getParameters(); for (PDSExecutionParameterEntry jobParam : jobParams) { addJobParamDataWhenAccepted(productSetup, jobParam, map); } return map; } }
PDSExecutionEnvironmentService { public Map<String, String> buildEnvironmentMap(PDSJobConfiguration config) { String productId = config.getProductId(); PDSProductSetup productSetup = serverConfigService.getProductSetupOrNull(productId); if (productSetup == null) { LOG.error("No product setup found for product id:{}", productId); return Collections.emptyMap(); } Map<String, String> map = new LinkedHashMap<>(); List<PDSExecutionParameterEntry> jobParams = config.getParameters(); for (PDSExecutionParameterEntry jobParam : jobParams) { addJobParamDataWhenAccepted(productSetup, jobParam, map); } return map; }  }
PDSExecutionEnvironmentService { public Map<String, String> buildEnvironmentMap(PDSJobConfiguration config) { String productId = config.getProductId(); PDSProductSetup productSetup = serverConfigService.getProductSetupOrNull(productId); if (productSetup == null) { LOG.error("No product setup found for product id:{}", productId); return Collections.emptyMap(); } Map<String, String> map = new LinkedHashMap<>(); List<PDSExecutionParameterEntry> jobParams = config.getParameters(); for (PDSExecutionParameterEntry jobParam : jobParams) { addJobParamDataWhenAccepted(productSetup, jobParam, map); } return map; }  Map<String, String> buildEnvironmentMap(PDSJobConfiguration config); }
PDSExecutionEnvironmentService { public Map<String, String> buildEnvironmentMap(PDSJobConfiguration config) { String productId = config.getProductId(); PDSProductSetup productSetup = serverConfigService.getProductSetupOrNull(productId); if (productSetup == null) { LOG.error("No product setup found for product id:{}", productId); return Collections.emptyMap(); } Map<String, String> map = new LinkedHashMap<>(); List<PDSExecutionParameterEntry> jobParams = config.getParameters(); for (PDSExecutionParameterEntry jobParam : jobParams) { addJobParamDataWhenAccepted(productSetup, jobParam, map); } return map; }  Map<String, String> buildEnvironmentMap(PDSJobConfiguration config);  }