@Test public void canCatchProductionExceptionWhenGetInProgressStatus() throws Exception { when(mockProductionService.getProduction(anyString())).thenReturn(mockProduction); when(mockCalvalusFacade.getProduction(anyString())).thenThrow(new IOException("Production error")); PowerMockito.whenNew(CalvalusFacade.class).withArguments(any(WpsRequestContext.class)).thenReturn(mockCalvalusFacade); thrownException.expect(JobNotFoundException.class); thrownException.expectMessage("Parameter 'JobId job-01' has an invalid value."); getStatusOperation = new CalvalusGetStatusOperation(mockRequestContext); getStatusOperation.getStatus("job-01"); }
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);  }