AbstractJobProducer implements JobProducer { @Override public long countJobs(Status status) throws ServiceRegistryException { if (status == null) throw new IllegalArgumentException("Status must not be null"); return getServiceRegistry().count(getJobType(), status); } 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 testCountJobs() throws Exception { replayAll(); assertEquals(2, jobProducer.countJobs(Status.DISPATCHING)); assertEquals(3, jobProducer.countJobs(Status.RUNNING)); }