Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JobRepository#getJobNames() always returns empty list #4229

Closed
kzander91 opened this issue Nov 11, 2022 · 2 comments
Closed

JobRepository#getJobNames() always returns empty list #4229

kzander91 opened this issue Nov 11, 2022 · 2 comments

Comments

@kzander91
Copy link

Bug description
JobRepository#getJobNames() is not implemented by the only implementation of the interface, SimpleJobRepository. The default method simply returns an empty list.
As of Spring Batch 5, this method is used by JobRepositoryTestUtils.removeJobExecutions(), which became a no-op method, never removing any executions due to getJobNames() never returning any job names.

Environment
Spring Batch 5.0.0-RC2

Steps to reproduce

  1. Run Job.
  2. Call JobRepository.getJobNames().

Expected behavior
Names of jobs are returned.

Minimal Complete Reproducible example
demo1.zip

  1. Unzip
  2. Run mvnw spring-boot:run
  3. The app runs a job named job and then queries both the batch_job_instance table and the JobRepository for all job names. The query returns job as expected, the JobRepository returns nothing.
@kzander91 kzander91 added status: waiting-for-triage Issues that we did not analyse yet type: bug labels Nov 11, 2022
@kzander91
Copy link
Author

In fact, two other methods return empty lists as well due to not being implemented in SimpleJobRepository:

default List<JobInstance> findJobInstancesByName(String jobName, int start, int count) {
return Collections.emptyList();
}

default List<JobExecution> findJobExecutions(JobInstance jobInstance) {
return Collections.emptyList();
}

@fmbenhassine
Copy link
Contributor

Good catch! I will plan the fix for 5.0 GA. Thank you for raising this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants