@Test public void canGetSuccessfulStatus() throws Exception { ProductionRequest mockProductionRequest = getMockProductionRequest(); when(mockProduction.getProductionRequest()).thenReturn(mockProductionRequest); when(mockCalvalusFacade.getProduction(anyString())).thenReturn(mockProduction); List<String> mockResultUrlList = getMockResultUrlList(); when(mockCalvalusFacade.getProductResultUrls("job-01")).thenReturn(mockResultUrlList); CalvalusWpsProcessStatus mockStatus = getDoneAndSuccessfulProcessStatus(mockResultUrlList); PowerMockito.whenNew(CalvalusWpsProcessStatus.class).withArguments(mockProduction, mockResultUrlList).thenReturn(mockStatus); PowerMockito.whenNew(CalvalusFacade.class).withArguments(any(WpsRequestContext.class)).thenReturn(mockCalvalusFacade); getStatusOperation = new CalvalusGetStatusOperation(mockRequestContext); ExecuteResponse getStatusResponse = getStatusOperation.getStatus("job-01"); assertThat(getStatusResponse.getProcess().getIdentifier().getValue(), equalTo("mockBundle~1.0~mockProcessor")); assertThat(getStatusResponse.getProcess().getProcessVersion(), equalTo("1.0")); assertThat(getStatusResponse.getStatus().getCreationTime().toString(), equalTo("2016-01-01T01:00:00.000+01:00")); assertThat(getStatusResponse.getProcessOutputs().getOutput().get(0).getIdentifier().getValue(), equalTo("production_result")); assertThat(getStatusResponse.getProcessOutputs().getOutput().get(0).getReference().getHref(), equalTo("http: assertThat(getStatusResponse.getProcessOutputs().getOutput().get(1).getIdentifier().getValue(), equalTo("production_result")); assertThat(getStatusResponse.getProcessOutputs().getOutput().get(1).getReference().getHref(), equalTo("http: }
public ExecuteResponse getStatus(String jobId) throws JobNotFoundException, InvalidProcessorIdException, SqlStoreException { String localJobIdRegex = ".*-((\\d{4}((0[13578]|1[02])(0[1-9]|[12]\\d|3[01])|(0[13456789]|1[012])(0[1-9]|" + "[12]\\d|30)|02(0[1-9]|1\\d|2[0-8])))|(\\d{2}[02468][048]|\\d{2}[13579][26])0229){0,8}_.*"; if (jobId.matches(localJobIdRegex)) { try { return getLocalProcessExecuteResponse(jobId); } catch (JobNotFoundException _) {} } return getCalvalusExecuteResponse(jobId); }
CalvalusGetStatusOperation extends WpsOperation { public ExecuteResponse getStatus(String jobId) throws JobNotFoundException, InvalidProcessorIdException, SqlStoreException { String localJobIdRegex = ".*-((\\d{4}((0[13578]|1[02])(0[1-9]|[12]\\d|3[01])|(0[13456789]|1[012])(0[1-9]|" + "[12]\\d|30)|02(0[1-9]|1\\d|2[0-8])))|(\\d{2}[02468][048]|\\d{2}[13579][26])0229){0,8}_.*"; if (jobId.matches(localJobIdRegex)) { try { return getLocalProcessExecuteResponse(jobId); } catch (JobNotFoundException _) {} } return getCalvalusExecuteResponse(jobId); } }
CalvalusGetStatusOperation extends WpsOperation { public ExecuteResponse getStatus(String jobId) throws JobNotFoundException, InvalidProcessorIdException, SqlStoreException { String localJobIdRegex = ".*-((\\d{4}((0[13578]|1[02])(0[1-9]|[12]\\d|3[01])|(0[13456789]|1[012])(0[1-9]|" + "[12]\\d|30)|02(0[1-9]|1\\d|2[0-8])))|(\\d{2}[02468][048]|\\d{2}[13579][26])0229){0,8}_.*"; if (jobId.matches(localJobIdRegex)) { try { return getLocalProcessExecuteResponse(jobId); } catch (JobNotFoundException _) {} } return getCalvalusExecuteResponse(jobId); } CalvalusGetStatusOperation(WpsRequestContext context); }
CalvalusGetStatusOperation extends WpsOperation { public ExecuteResponse getStatus(String jobId) throws JobNotFoundException, InvalidProcessorIdException, SqlStoreException { String localJobIdRegex = ".*-((\\d{4}((0[13578]|1[02])(0[1-9]|[12]\\d|3[01])|(0[13456789]|1[012])(0[1-9]|" + "[12]\\d|30)|02(0[1-9]|1\\d|2[0-8])))|(\\d{2}[02468][048]|\\d{2}[13579][26])0229){0,8}_.*"; if (jobId.matches(localJobIdRegex)) { try { return getLocalProcessExecuteResponse(jobId); } catch (JobNotFoundException _) {} } return getCalvalusExecuteResponse(jobId); } CalvalusGetStatusOperation(WpsRequestContext context); ExecuteResponse getStatus(String jobId); }
CalvalusGetStatusOperation extends WpsOperation { public ExecuteResponse getStatus(String jobId) throws JobNotFoundException, InvalidProcessorIdException, SqlStoreException { String localJobIdRegex = ".*-((\\d{4}((0[13578]|1[02])(0[1-9]|[12]\\d|3[01])|(0[13456789]|1[012])(0[1-9]|" + "[12]\\d|30)|02(0[1-9]|1\\d|2[0-8])))|(\\d{2}[02468][048]|\\d{2}[13579][26])0229){0,8}_.*"; if (jobId.matches(localJobIdRegex)) { try { return getLocalProcessExecuteResponse(jobId); } catch (JobNotFoundException _) {} } return getCalvalusExecuteResponse(jobId); } CalvalusGetStatusOperation(WpsRequestContext context); ExecuteResponse getStatus(String jobId);  }