DefaultJobStatusStore implements JobStatusStore, Initializable { @Override public JobStatus getJobStatus(List<String> id) { String idString = toUniqueString(id); JobStatus status = this.cache.get(idString); if (status == null) { status = maybeLoadStatus(id, idString); } return status == NOSTATUS ? null : status; }  @Override void initialize(); @Override JobStatus getJobStatus(List<String> id); @Override void store(JobStatus status); @Override void storeAsync(JobStatus status); @Override void remove(List<String> id); @Override LoggerTail createLoggerTail(List<String> jobId, boolean readonly); void flushCache();  }
@Test void getJobStatusWithNullId() { JobStatus jobStatus = this.store.getJobStatus(null); assertNotNull(jobStatus); assertNull(jobStatus.getRequest().getId()); assertEquals(JobStatus.State.FINISHED, jobStatus.getState()); assertSame(jobStatus, this.store.getJobStatus(null)); }
@Test void getJobStatusWithMultipleId() { JobStatus jobStatus = this.store.getJobStatus(Arrays.asList("id1", "id2")); assertNotNull(jobStatus); assertEquals(Arrays.asList("id1", "id2"), jobStatus.getRequest().getId()); assertEquals(JobStatus.State.FINISHED, jobStatus.getState()); assertSame(jobStatus, this.store.getJobStatus(Arrays.asList("id1", "id2"))); }
@Test void getJobStatusInOldPlace() { JobStatus jobStatus = this.store.getJobStatus(Arrays.asList("id1", "id2", "id3")); assertNotNull(jobStatus); assertEquals(Arrays.asList("id1", "id2", "id3"), jobStatus.getRequest().getId()); assertEquals(JobStatus.State.FINISHED, jobStatus.getState()); }
@Test void getJobStatusInWrongPlaceAndWithInvalidLogArgument() { JobStatus jobStatus = this.store.getJobStatus(Arrays.asList("invalidlogargument")); assertNotNull(jobStatus); assertEquals(3, jobStatus.getLog().size()); }
@Test void getJobStatusThatDoesNotExist() { JobStatus jobStatus = this.store.getJobStatus(Arrays.asList("nostatus")); assertNull(jobStatus); JobStatusSerializer mockSerializer = mock(JobStatusSerializer.class); ReflectionUtils.setFieldValue(this.store, "serializer", mockSerializer); jobStatus = this.store.getJobStatus(Arrays.asList("nostatus")); assertNull(jobStatus); verifyNoMoreInteractions(mockSerializer); }