CalvalusExecuteResponseConverter { public ExecuteResponse getAcceptedWithLineageResponse(String jobId, DataInputsType dataInputs, List<DocumentOutputDefinitionType> rawDataOutput, WpsServerContext context) { StatusType statusType = new StatusType(); GregorianCalendar gregorianCalendar = new GregorianCalendar(); XMLGregorianCalendar currentTime = getXmlGregorianCalendar(gregorianCalendar); statusType.setCreationTime(currentTime); statusType.setProcessAccepted("The request has been accepted. The status of the process can be found in the URL."); executeResponse.setStatus(statusType); String getStatusUrl = getStatusUrl(jobId, context); executeResponse.setStatusLocation(getStatusUrl); executeResponse.setDataInputs(dataInputs); OutputDefinitionsType outputDefinitionsType = new OutputDefinitionsType(); outputDefinitionsType.getOutput().addAll(rawDataOutput); executeResponse.setOutputDefinitions(outputDefinitionsType); 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 canGetAcceptedResponseWithLineage() throws Exception { DataInputsType dataInputs = new DataInputsType(); InputType input1 = getInputType("inputDataSetName", "MERIS FSG v2013 L1b 2002-2012"); dataInputs.getInput().add(input1); InputType input2 = getInputType("maxDate", "2009-06-03"); dataInputs.getInput().add(input2); OutputDefinitionsType output = new OutputDefinitionsType(); DocumentOutputDefinitionType outputType = getOutputType(); output.getOutput().add(outputType); String jobId = "job-01"; Calendar calendar = Calendar.getInstance(); ExecuteResponse executeResponse = calvalusExecuteResponse.getAcceptedWithLineageResponse(jobId, dataInputs, output.getOutput(), mockServerContext); 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().getProcessAccepted(), equalTo("The request has been accepted. The status of the process can be found in the URL.")); assertThat(executeResponse.getStatusLocation(), equalTo("http: assertThat(executeResponse.getDataInputs().getInput().get(0).getIdentifier().getValue(), equalTo("inputDataSetName")); assertThat(executeResponse.getDataInputs().getInput().get(0).getData().getLiteralData().getValue(), equalTo("MERIS FSG v2013 L1b 2002-2012")); assertThat(executeResponse.getDataInputs().getInput().get(1).getIdentifier().getValue(), equalTo("maxDate")); assertThat(executeResponse.getDataInputs().getInput().get(1).getData().getLiteralData().getValue(), equalTo("2009-06-03")); assertThat(executeResponse.getOutputDefinitions().getOutput().get(0).getIdentifier().getValue(), equalTo("productionResults")); }