CalvalusExecuteResponseConverter { public ExecuteResponse getStartedResponse(String state, float progress) { StatusType statusType = new StatusType(); GregorianCalendar gregorianCalendar = new GregorianCalendar(); XMLGregorianCalendar currentTime = getXmlGregorianCalendar(gregorianCalendar); statusType.setCreationTime(currentTime); ProcessStartedType processStartedType = new ProcessStartedType(); processStartedType.setValue(state); processStartedType.setPercentCompleted(Math.round(progress)); statusType.setProcessStarted(processStartedType); executeResponse.setStatus(statusType); return executeResponse; } CalvalusExecuteResponseConverter(); ExecuteResponse getAcceptedResponse(String jobId, WpsServerContext context); ExecuteResponse getAcceptedWithLineageResponse(String jobId,
                                                          DataInputsType dataInputs,
                                                          List<DocumentOutputDefinitionType> rawDataOutput,
                                                          WpsServerContext context); ExecuteResponse getSuccessfulResponse(List<String> resultUrls, Date stopTime); ExecuteResponse getSuccessfulWithLineageResponse(List<String> resultUrls,
                                                            DataInputsType dataInputs,
                                                            List<DocumentOutputDefinitionType> outputType); ExecuteResponse getFailedResponse(String exceptionMessage); ExecuteResponse getStartedResponse(String state, float progress); ExecuteResponse getQuotationResponse(String username, String remoteRef, DataInputsType dataInputs);  }
@Test public void canGetStartedResponse() throws Exception { Calendar calendar = Calendar.getInstance(); ExecuteResponse executeResponse = calvalusExecuteResponse.getStartedResponse("RUNNING", 50); assertThat(executeResponse.getStatus().getCreationTime().getDay(), equalTo(calendar.get(Calendar.DAY_OF_MONTH))); assertThat(executeResponse.getStatus().getCreationTime().getMonth(), equalTo(calendar.get(Calendar.MONTH) + 1)); assertThat(executeResponse.getStatus().getCreationTime().getYear(), equalTo(calendar.get(Calendar.YEAR))); assertThat(executeResponse.getStatus().getProcessStarted().getValue(), equalTo("RUNNING")); assertThat(executeResponse.getStatus().getProcessStarted().getPercentCompleted(), equalTo(50)); }