@Test public void testGetLastOperationProgressParam() { doReturn(OPERATION_PROGRESS_JSON).when(mockEnvironmentFieldRetriever).getField(HandlerField.LAST_PROGRESS.name()); launchDataWrapper.setJsonHelper(jsonHelper); LastProgressObject lastProgressObject = launchDataWrapper.getLastOperationProgressParam(JOB_PARAM_NAME, LastProgressObject.class); Assert.assertNotNull(lastProgressObject); Assert.assertEquals(lastProgressObject.getJobId(), JOB_ID); }
@Override public <T> T getLastOperationProgressParam(String paramName, Class<T> objectClass) { String operationProgressJson = getStringFromFields(HandlerArgument.LAST_PROGRESS_FILE, HandlerField.LAST_PROGRESS); if(operationProgressJson == null) return null; try { OperationProgress operationProgress = jsonHelper.getObjectFromString(operationProgressJson, OperationProgress.class); if(operationProgress == null || operationProgress.getParams() == null || !operationProgress.getParams().containsKey(paramName)) return null; return jsonHelper.getObjectMapper().convertValue(operationProgress.getParams().get(paramName), objectClass); } catch(JsonHelperException e) { logger.warn("Unable to read the last progress object. Defaulting to null.", e); } return null; }
DefaultLaunchDataWrapper extends LaunchDataWrapper { @Override public <T> T getLastOperationProgressParam(String paramName, Class<T> objectClass) { String operationProgressJson = getStringFromFields(HandlerArgument.LAST_PROGRESS_FILE, HandlerField.LAST_PROGRESS); if(operationProgressJson == null) return null; try { OperationProgress operationProgress = jsonHelper.getObjectFromString(operationProgressJson, OperationProgress.class); if(operationProgress == null || operationProgress.getParams() == null || !operationProgress.getParams().containsKey(paramName)) return null; return jsonHelper.getObjectMapper().convertValue(operationProgress.getParams().get(paramName), objectClass); } catch(JsonHelperException e) { logger.warn("Unable to read the last progress object. Defaulting to null.", e); } return null; } }
DefaultLaunchDataWrapper extends LaunchDataWrapper { @Override public <T> T getLastOperationProgressParam(String paramName, Class<T> objectClass) { String operationProgressJson = getStringFromFields(HandlerArgument.LAST_PROGRESS_FILE, HandlerField.LAST_PROGRESS); if(operationProgressJson == null) return null; try { OperationProgress operationProgress = jsonHelper.getObjectFromString(operationProgressJson, OperationProgress.class); if(operationProgress == null || operationProgress.getParams() == null || !operationProgress.getParams().containsKey(paramName)) return null; return jsonHelper.getObjectMapper().convertValue(operationProgress.getParams().get(paramName), objectClass); } catch(JsonHelperException e) { logger.warn("Unable to read the last progress object. Defaulting to null.", e); } return null; } DefaultLaunchDataWrapper(String[] args);  DefaultLaunchDataWrapper(ArgumentRetriever argumentRetriever, EnvironmentFieldRetriever environmentRetriever, PropertyRetriever propertyRetriever);  DefaultLaunchDataWrapper(ArgumentRetriever argumentRetriever); }
DefaultLaunchDataWrapper extends LaunchDataWrapper { @Override public <T> T getLastOperationProgressParam(String paramName, Class<T> objectClass) { String operationProgressJson = getStringFromFields(HandlerArgument.LAST_PROGRESS_FILE, HandlerField.LAST_PROGRESS); if(operationProgressJson == null) return null; try { OperationProgress operationProgress = jsonHelper.getObjectFromString(operationProgressJson, OperationProgress.class); if(operationProgress == null || operationProgress.getParams() == null || !operationProgress.getParams().containsKey(paramName)) return null; return jsonHelper.getObjectMapper().convertValue(operationProgress.getParams().get(paramName), objectClass); } catch(JsonHelperException e) { logger.warn("Unable to read the last progress object. Defaulting to null.", e); } return null; } DefaultLaunchDataWrapper(String[] args);  DefaultLaunchDataWrapper(ArgumentRetriever argumentRetriever, EnvironmentFieldRetriever environmentRetriever, PropertyRetriever propertyRetriever);  DefaultLaunchDataWrapper(ArgumentRetriever argumentRetriever); @Override String getPayload(); @Override OperationProgress getLastOperationProgress(); @Override T getLastProgressObject(Class<T> objectClass); @Override T getLastOperationProgressParam(String paramName, Class<T> objectClass); void setJsonHelper(JsonHelper jsonHelper); }
DefaultLaunchDataWrapper extends LaunchDataWrapper { @Override public <T> T getLastOperationProgressParam(String paramName, Class<T> objectClass) { String operationProgressJson = getStringFromFields(HandlerArgument.LAST_PROGRESS_FILE, HandlerField.LAST_PROGRESS); if(operationProgressJson == null) return null; try { OperationProgress operationProgress = jsonHelper.getObjectFromString(operationProgressJson, OperationProgress.class); if(operationProgress == null || operationProgress.getParams() == null || !operationProgress.getParams().containsKey(paramName)) return null; return jsonHelper.getObjectMapper().convertValue(operationProgress.getParams().get(paramName), objectClass); } catch(JsonHelperException e) { logger.warn("Unable to read the last progress object. Defaulting to null.", e); } return null; } DefaultLaunchDataWrapper(String[] args);  DefaultLaunchDataWrapper(ArgumentRetriever argumentRetriever, EnvironmentFieldRetriever environmentRetriever, PropertyRetriever propertyRetriever);  DefaultLaunchDataWrapper(ArgumentRetriever argumentRetriever); @Override String getPayload(); @Override OperationProgress getLastOperationProgress(); @Override T getLastProgressObject(Class<T> objectClass); @Override T getLastOperationProgressParam(String paramName, Class<T> objectClass); void setJsonHelper(JsonHelper jsonHelper);  }