AbstractJobProducer implements JobProducer { @Override public void acceptJob(final Job job) throws ServiceRegistryException { final Job runningJob; try { job.setStatus(Job.Status.RUNNING); runningJob = getServiceRegistry().updateJob(job); } catch (NotFoundException e) { throw new IllegalStateException(e); } executor.submit(new JobRunner(runningJob, getServiceRegistry().getCurrentJob())); } AbstractJobProducer(String jobType); void activate(ComponentContext cc); @Override String getJobType(); @Override long countJobs(Status status); @Override void acceptJob(final Job job); @Override boolean isReadyToAcceptJobs(String operation); @Override boolean isReadyToAccept(Job job); Incidents incident(); static final boolean DEFAULT_ACCEPT_JOB_LOADS_EXCEEDING; static final String ACCEPT_JOB_LOADS_EXCEEDING_PROPERTY; }
@Test public void testAcceptJob() throws Exception { replayAll(); Job job = new JobImpl(); job.setStatus(Status.DISPATCHING); assertEquals(Status.DISPATCHING, job.getStatus()); jobProducer.acceptJob(job); assertEquals(Status.RUNNING, job.getStatus()); }