@Test public void testGetJobSpecSummariesWithoutQueryReturnsOnlyTheNumberOfEntriesSpecifiedByPageSize() throws IOException { final Path jobSpecsDir = Files.createTempDirectory(FilesystemJobSpecDAOTest.class.getSimpleName()); final int pageSize = 10; final int numberOfSpecs = pageSize * 3; final String jobSpecConfigurationText = fixture("fixtures/dao/specs/FilesystemBasedJobSpecDAO/valid-job-spec-configuration.yml"); for (int i = 0; i < numberOfSpecs; i++) { final JobSpecId jobSpecId = new JobSpecId(generateRandomBase36String(5)); final Path jobSpecPath = jobSpecsDir.resolve(jobSpecId.toString()); createDirectory(jobSpecPath); final Path jobSpecConfigurationPath = jobSpecPath.resolve(SPEC_DIR_SPEC_FILENAME); Files.write(jobSpecConfigurationPath, jobSpecConfigurationText.getBytes()); } final FilesystemJobSpecDAO filesystemJobSpecDAO = new FilesystemJobSpecDAO(jobSpecsDir); final List<JobSpecSummary> jobSpecSummaries = filesystemJobSpecDAO.getJobSpecSummaries(pageSize, 0); assertThat(jobSpecSummaries.size()).isEqualTo(pageSize); }
@Override public List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page) { return getJobSpecSummaries(pageSize, page, ""); }
FilesystemJobSpecDAO implements JobSpecDAO { @Override public List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page) { return getJobSpecSummaries(pageSize, page, ""); } }
FilesystemJobSpecDAO implements JobSpecDAO { @Override public List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page) { return getJobSpecSummaries(pageSize, page, ""); } FilesystemJobSpecDAO(Path jobSpecsDir); }
FilesystemJobSpecDAO implements JobSpecDAO { @Override public List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page) { return getJobSpecSummaries(pageSize, page, ""); } FilesystemJobSpecDAO(Path jobSpecsDir); @Override Optional<JobSpec> getJobSpecById(JobSpecId jobSpecId); @Override Map<String, HealthCheck> getHealthChecks(); @Override Optional<JobSpecSummary> getJobSpecSummaryById(JobSpecId jobSpecId); @Override List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page); @Override List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page, String query); }
FilesystemJobSpecDAO implements JobSpecDAO { @Override public List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page) { return getJobSpecSummaries(pageSize, page, ""); } FilesystemJobSpecDAO(Path jobSpecsDir); @Override Optional<JobSpec> getJobSpecById(JobSpecId jobSpecId); @Override Map<String, HealthCheck> getHealthChecks(); @Override Optional<JobSpecSummary> getJobSpecSummaryById(JobSpecId jobSpecId); @Override List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page); @Override List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page, String query);  }