@Test public void testGetSpecJobWasSubmittedAgainstReturnsOptionalEmptyIfJobDoesntExist() throws IOException { final Path jobsDir = createTmpDir(FilesystemJobsDAOTest.class); final FilesystemJobsDAO dao = createStandardFilesystemDAO(jobsDir); assertThat(dao.getSpecJobWasSubmittedAgainst(generateJobId())).isNotPresent(); }
@Override public Optional<JobSpec> getSpecJobWasSubmittedAgainst(JobId jobId) { return resolveJobDir(jobId).map(Path::toFile).flatMap(this::loadJobSpec); }
FilesystemJobsDAO implements JobDAO { @Override public Optional<JobSpec> getSpecJobWasSubmittedAgainst(JobId jobId) { return resolveJobDir(jobId).map(Path::toFile).flatMap(this::loadJobSpec); } }
FilesystemJobsDAO implements JobDAO { @Override public Optional<JobSpec> getSpecJobWasSubmittedAgainst(JobId jobId) { return resolveJobDir(jobId).map(Path::toFile).flatMap(this::loadJobSpec); } FilesystemJobsDAO(Path jobsDirectory, IdGenerator idGenerator); }
FilesystemJobsDAO implements JobDAO { @Override public Optional<JobSpec> getSpecJobWasSubmittedAgainst(JobId jobId) { return resolveJobDir(jobId).map(Path::toFile).flatMap(this::loadJobSpec); } FilesystemJobsDAO(Path jobsDirectory, IdGenerator idGenerator); @Override boolean jobExists(JobId jobId); @Override List<JobDetails> getJobs(int pageSize, int page); @Override List<JobDetails> getJobs(int pageSize, int pageNumber, String query); @Override Disposable appendStdout(JobId jobId, Observable<byte[]> stdout); @Override Disposable appendStderr(JobId jobId, Observable<byte[]> stderr); @Override PersistedJob persist(ValidJobRequest validJobRequest); @Override void addNewJobStatus(JobId jobId, JobStatus newStatus, String statusMessage); @Override void persistOutput(JobId jobId, JobOutput jobOutput); @Override void remove(JobId jobId); @Override Optional<JobDetails> getJobDetailsById(JobId jobId); @Override Optional<JobSpec> getSpecJobWasSubmittedAgainst(JobId jobId); @Override boolean hasStdout(JobId jobId); @Override Optional<BinaryData> getStdout(JobId jobId); @Override boolean hasStderr(JobId jobId); @Override Optional<BinaryData> getStderr(JobId jobId); @Override Set<JobId> getJobsWithStatus(JobStatus status); @Override boolean hasOutput(JobId jobId, JobOutputId outputId); @Override Optional<BinaryData> getOutput(JobId jobId, JobOutputId outputId); @Override List<JobOutputDetails> getJobOutputs(JobId jobId); @Override boolean hasJobInputs(JobId jobId); @Override Optional<Map<JobExpectedInputId, JsonNode>> getJobInputs(JobId jobId); @Override Map<String, HealthCheck> getHealthChecks(); }
FilesystemJobsDAO implements JobDAO { @Override public Optional<JobSpec> getSpecJobWasSubmittedAgainst(JobId jobId) { return resolveJobDir(jobId).map(Path::toFile).flatMap(this::loadJobSpec); } FilesystemJobsDAO(Path jobsDirectory, IdGenerator idGenerator); @Override boolean jobExists(JobId jobId); @Override List<JobDetails> getJobs(int pageSize, int page); @Override List<JobDetails> getJobs(int pageSize, int pageNumber, String query); @Override Disposable appendStdout(JobId jobId, Observable<byte[]> stdout); @Override Disposable appendStderr(JobId jobId, Observable<byte[]> stderr); @Override PersistedJob persist(ValidJobRequest validJobRequest); @Override void addNewJobStatus(JobId jobId, JobStatus newStatus, String statusMessage); @Override void persistOutput(JobId jobId, JobOutput jobOutput); @Override void remove(JobId jobId); @Override Optional<JobDetails> getJobDetailsById(JobId jobId); @Override Optional<JobSpec> getSpecJobWasSubmittedAgainst(JobId jobId); @Override boolean hasStdout(JobId jobId); @Override Optional<BinaryData> getStdout(JobId jobId); @Override boolean hasStderr(JobId jobId); @Override Optional<BinaryData> getStderr(JobId jobId); @Override Set<JobId> getJobsWithStatus(JobStatus status); @Override boolean hasOutput(JobId jobId, JobOutputId outputId); @Override Optional<BinaryData> getOutput(JobId jobId, JobOutputId outputId); @Override List<JobOutputDetails> getJobOutputs(JobId jobId); @Override boolean hasJobInputs(JobId jobId); @Override Optional<Map<JobExpectedInputId, JsonNode>> getJobInputs(JobId jobId); @Override Map<String, HealthCheck> getHealthChecks();  }