@Test public void testDateTerminated() { QueuedWork work = createWork("network", "snapshot"); assertThat(work._dateTerminated, is(nullValue())); work.setStatus(WorkStatusCode.TRYINGTOASSIGN); assertThat(work._dateTerminated, is(nullValue())); work.setStatus(WorkStatusCode.TERMINATEDNORMALLY); assertThat(work._dateTerminated, not(is(nullValue()))); }
public synchronized void setStatus(WorkStatusCode status) { if (_status.isTerminated() && !status.isTerminated()) { throw new IllegalStateException( "Status of terminated work shouldn't be updated to non-terminated. Current: " + _status + ". Desired = " + status); } if (!_status.isTerminated() && status.isTerminated()) { _dateTerminated = new Date(); } _status = status; }
QueuedWork { public synchronized void setStatus(WorkStatusCode status) { if (_status.isTerminated() && !status.isTerminated()) { throw new IllegalStateException( "Status of terminated work shouldn't be updated to non-terminated. Current: " + _status + ". Desired = " + status); } if (!_status.isTerminated() && status.isTerminated()) { _dateTerminated = new Date(); } _status = status; } }
QueuedWork { public synchronized void setStatus(WorkStatusCode status) { if (_status.isTerminated() && !status.isTerminated()) { throw new IllegalStateException( "Status of terminated work shouldn't be updated to non-terminated. Current: " + _status + ". Desired = " + status); } if (!_status.isTerminated() && status.isTerminated()) { _dateTerminated = new Date(); } _status = status; } QueuedWork(WorkItem workItem, WorkDetails details); }
QueuedWork { public synchronized void setStatus(WorkStatusCode status) { if (_status.isTerminated() && !status.isTerminated()) { throw new IllegalStateException( "Status of terminated work shouldn't be updated to non-terminated. Current: " + _status + ". Desired = " + status); } if (!_status.isTerminated() && status.isTerminated()) { _dateTerminated = new Date(); } _status = status; } QueuedWork(WorkItem workItem, WorkDetails details); synchronized void clearAssignment(); String getAssignedWorker(); Date getDateCreated(); Date getDateTerminated(); WorkDetails getDetails(); UUID getId(); Task getLastTaskCheckResult(); WorkStatusCode getStatus(); WorkItem getWorkItem(); synchronized void recordTaskCheckResult(Task task); synchronized void setAssignment(String assignedWorker); synchronized void setStatus(WorkStatusCode status); @Override String toString(); @Nonnull WorkStatus toWorkStatus(); @Nonnull Map<String, String> resolveRequestParams(); }
QueuedWork { public synchronized void setStatus(WorkStatusCode status) { if (_status.isTerminated() && !status.isTerminated()) { throw new IllegalStateException( "Status of terminated work shouldn't be updated to non-terminated. Current: " + _status + ". Desired = " + status); } if (!_status.isTerminated() && status.isTerminated()) { _dateTerminated = new Date(); } _status = status; } QueuedWork(WorkItem workItem, WorkDetails details); synchronized void clearAssignment(); String getAssignedWorker(); Date getDateCreated(); Date getDateTerminated(); WorkDetails getDetails(); UUID getId(); Task getLastTaskCheckResult(); WorkStatusCode getStatus(); WorkItem getWorkItem(); synchronized void recordTaskCheckResult(Task task); synchronized void setAssignment(String assignedWorker); synchronized void setStatus(WorkStatusCode status); @Override String toString(); @Nonnull WorkStatus toWorkStatus(); @Nonnull Map<String, String> resolveRequestParams();  }