@Test public void testScheduleJobFailure_emptyRetriesError() { presenter.createJob(JOB_NAME, new Date(), JOB_TYPE, "", emptyList()); verify(view).show(); verify(view).cleanErrorMessages(); verify(view).showEmptyRetriesErrorMessage(); verifyZeroInteractions(executorServicesMock); verify(view).showBasicPane(); verifyNoMoreInteractions(view); }
public void createJob(String jobName, Date dueDate, String jobType, String numberOfRetries, List<RequestParameterSummary> parameters) { if (validateForm(jobName, jobType, numberOfRetries)) { Map<String, String> jobCtxMap = new HashMap<String, String>(); if (parameters != null) { for (RequestParameterSummary param : parameters) { if (!(constants.ClickToEdit().equals(param.getKey()) || constants.ClickToEdit().equals(param.getValue()))) { jobCtxMap.put(param.getKey(), param.getValue()); } } } jobCtxMap.put(RequestDataSetConstants.COLUMN_RETRIES, numberOfRetries); jobCtxMap.put(RequestDataSetConstants.COLUMN_BUSINESSKEY, jobName); executorServices.call( (Long requestId) -> { displayNotification(constants.RequestScheduled(requestId)); requestCreatedEvent.fire(new RequestChangedEvent(requestId)); view.hide(); }, (Message message, Throwable throwable) -> { view.showBasicPane(); if (isInvalidCommandTypeError(throwable)) { view.showInvalidTypeErrorMessage(); } else { view.showInlineNotification(throwable.getCause().getMessage()); } return false; }).scheduleRequest(serverTemplateId, jobType, dueDate, jobCtxMap); } else { view.showBasicPane(); } }
NewJobPresenter { public void createJob(String jobName, Date dueDate, String jobType, String numberOfRetries, List<RequestParameterSummary> parameters) { if (validateForm(jobName, jobType, numberOfRetries)) { Map<String, String> jobCtxMap = new HashMap<String, String>(); if (parameters != null) { for (RequestParameterSummary param : parameters) { if (!(constants.ClickToEdit().equals(param.getKey()) || constants.ClickToEdit().equals(param.getValue()))) { jobCtxMap.put(param.getKey(), param.getValue()); } } } jobCtxMap.put(RequestDataSetConstants.COLUMN_RETRIES, numberOfRetries); jobCtxMap.put(RequestDataSetConstants.COLUMN_BUSINESSKEY, jobName); executorServices.call( (Long requestId) -> { displayNotification(constants.RequestScheduled(requestId)); requestCreatedEvent.fire(new RequestChangedEvent(requestId)); view.hide(); }, (Message message, Throwable throwable) -> { view.showBasicPane(); if (isInvalidCommandTypeError(throwable)) { view.showInvalidTypeErrorMessage(); } else { view.showInlineNotification(throwable.getCause().getMessage()); } return false; }).scheduleRequest(serverTemplateId, jobType, dueDate, jobCtxMap); } else { view.showBasicPane(); } } }
NewJobPresenter { public void createJob(String jobName, Date dueDate, String jobType, String numberOfRetries, List<RequestParameterSummary> parameters) { if (validateForm(jobName, jobType, numberOfRetries)) { Map<String, String> jobCtxMap = new HashMap<String, String>(); if (parameters != null) { for (RequestParameterSummary param : parameters) { if (!(constants.ClickToEdit().equals(param.getKey()) || constants.ClickToEdit().equals(param.getValue()))) { jobCtxMap.put(param.getKey(), param.getValue()); } } } jobCtxMap.put(RequestDataSetConstants.COLUMN_RETRIES, numberOfRetries); jobCtxMap.put(RequestDataSetConstants.COLUMN_BUSINESSKEY, jobName); executorServices.call( (Long requestId) -> { displayNotification(constants.RequestScheduled(requestId)); requestCreatedEvent.fire(new RequestChangedEvent(requestId)); view.hide(); }, (Message message, Throwable throwable) -> { view.showBasicPane(); if (isInvalidCommandTypeError(throwable)) { view.showInvalidTypeErrorMessage(); } else { view.showInlineNotification(throwable.getCause().getMessage()); } return false; }).scheduleRequest(serverTemplateId, jobType, dueDate, jobCtxMap); } else { view.showBasicPane(); } }  }
NewJobPresenter { public void createJob(String jobName, Date dueDate, String jobType, String numberOfRetries, List<RequestParameterSummary> parameters) { if (validateForm(jobName, jobType, numberOfRetries)) { Map<String, String> jobCtxMap = new HashMap<String, String>(); if (parameters != null) { for (RequestParameterSummary param : parameters) { if (!(constants.ClickToEdit().equals(param.getKey()) || constants.ClickToEdit().equals(param.getValue()))) { jobCtxMap.put(param.getKey(), param.getValue()); } } } jobCtxMap.put(RequestDataSetConstants.COLUMN_RETRIES, numberOfRetries); jobCtxMap.put(RequestDataSetConstants.COLUMN_BUSINESSKEY, jobName); executorServices.call( (Long requestId) -> { displayNotification(constants.RequestScheduled(requestId)); requestCreatedEvent.fire(new RequestChangedEvent(requestId)); view.hide(); }, (Message message, Throwable throwable) -> { view.showBasicPane(); if (isInvalidCommandTypeError(throwable)) { view.showInvalidTypeErrorMessage(); } else { view.showInlineNotification(throwable.getCause().getMessage()); } return false; }).scheduleRequest(serverTemplateId, jobType, dueDate, jobCtxMap); } else { view.showBasicPane(); } }  @PostConstruct void init(); void openNewJobDialog(String serverTemplateId); void createJob(String jobName,
                          Date dueDate,
                          String jobType,
                          String numberOfRetries,
                          List<RequestParameterSummary> parameters); @Inject void setNotification(final Event<NotificationEvent> notification); @Inject void setRequestChangedEvent(final Event<RequestChangedEvent> requestChangedEvent); @Inject void setExecutorService(final Caller<ExecutorService> executorService); }
NewJobPresenter { public void createJob(String jobName, Date dueDate, String jobType, String numberOfRetries, List<RequestParameterSummary> parameters) { if (validateForm(jobName, jobType, numberOfRetries)) { Map<String, String> jobCtxMap = new HashMap<String, String>(); if (parameters != null) { for (RequestParameterSummary param : parameters) { if (!(constants.ClickToEdit().equals(param.getKey()) || constants.ClickToEdit().equals(param.getValue()))) { jobCtxMap.put(param.getKey(), param.getValue()); } } } jobCtxMap.put(RequestDataSetConstants.COLUMN_RETRIES, numberOfRetries); jobCtxMap.put(RequestDataSetConstants.COLUMN_BUSINESSKEY, jobName); executorServices.call( (Long requestId) -> { displayNotification(constants.RequestScheduled(requestId)); requestCreatedEvent.fire(new RequestChangedEvent(requestId)); view.hide(); }, (Message message, Throwable throwable) -> { view.showBasicPane(); if (isInvalidCommandTypeError(throwable)) { view.showInvalidTypeErrorMessage(); } else { view.showInlineNotification(throwable.getCause().getMessage()); } return false; }).scheduleRequest(serverTemplateId, jobType, dueDate, jobCtxMap); } else { view.showBasicPane(); } }  @PostConstruct void init(); void openNewJobDialog(String serverTemplateId); void createJob(String jobName,
                          Date dueDate,
                          String jobType,
                          String numberOfRetries,
                          List<RequestParameterSummary> parameters); @Inject void setNotification(final Event<NotificationEvent> notification); @Inject void setRequestChangedEvent(final Event<RequestChangedEvent> requestChangedEvent); @Inject void setExecutorService(final Caller<ExecutorService> executorService);  }