WorkflowRuntimeParameters { public static String getParamValue(String paramName, Configuration configuration) { String paramValue = configuration.get(paramName); if (StringUtils.isNotBlank(paramValue) && !UNDEFINED_NONEMPTY_VALUE.equals(paramValue)) { return paramValue; } else { return null; } } private  WorkflowRuntimeParameters(); static String getParamValue(String paramName, Configuration configuration); static Integer getIntegerParamValue(String paramName, Configuration configuration); static String getParamValue(String paramName, String fallbackParamName, Configuration configuration); static String getParamValue(String paramName, String defaultValue, Map<String, String> parameters); static String getParamValueWithUndefinedCheck(String paramName, String defaultValue, Map<String, String> parameters); static final String OOZIE_ACTION_OUTPUT_FILENAME; static final char DEFAULT_CSV_DELIMITER; static final String UNDEFINED_NONEMPTY_VALUE; static final String DNET_SERVICE_READ_TIMEOUT_DEFAULT_VALUE; static final String DNET_SERVICE_CONNECTION_TIMEOUT_DEFAULT_VALUE; static final String DNET_SERVICE_CLIENT_READ_TIMEOUT; static final String DNET_SERVICE_CLIENT_CONNECTION_TIMEOUT; }
@Test public void testGetParamValue() throws Exception { String paramName = "paramName1"; String paramValue = "paramValue1"; configuration.set(paramName, paramValue); String result = WorkflowRuntimeParameters.getParamValue(paramName, configuration); assertEquals(paramValue, result); }
@Test public void testGetParamValueMissing() throws Exception { String paramName = "paramName1"; String result = WorkflowRuntimeParameters.getParamValue(paramName, configuration); assertNull(result); }
@Test public void testGetParamValueBlank() throws Exception { String paramName = "paramName1"; String paramValue = ""; configuration.set(paramName, paramValue); String result = WorkflowRuntimeParameters.getParamValue(paramName, configuration); assertNull(result); }
@Test public void testGetParamValueWithFallback() throws Exception { String paramName = "paramName1"; String paramValue = "paramValue1"; String paramNameMissing = "paramNameMissing"; configuration.set(paramName, paramValue); String result = WorkflowRuntimeParameters.getParamValue( paramNameMissing, paramName, configuration); assertEquals(paramValue, result); }
@Test public void testGetParamValueWithDefault() throws Exception { String paramName = "paramName1"; String paramValue = "paramValue1"; String paramNameMissing = "paramNameMissing"; String paramDefaultValue = "defaultValue"; Map<String, String> parameters = new HashMap<>(); parameters.put(paramName, paramValue); assertEquals(paramValue, WorkflowRuntimeParameters.getParamValue(paramName, paramDefaultValue, parameters)); assertEquals(paramDefaultValue, WorkflowRuntimeParameters.getParamValue(paramNameMissing, paramDefaultValue, parameters)); }