@Test public void createJobLogsNothingWhenAtLeastOneCreatorIsAdded() { holder.addJobCreator(mockJobCreator); holder.createJob("DOES_NOT_EXIST"); verifyZeroInteractions(jobLogger); }
/** * Remove the mapping to stop it from creating new jobs. * * @param jobCreator The mapping between a specific job tag and the job class. */ public void removeJobCreator(JobCreator jobCreator) { mJobCreatorHolder.removeJobCreator(jobCreator); }
@Test public void createJobLogsWarningWhenNoCreatorsAreAdded() { holder.createJob("DOES_NOT_EXIST"); verify(jobLogger).log( anyInt(), // priority eq("JobCreatorHolder"), // tag eq("no JobCreator added"), // message ArgumentMatchers.<Throwable>isNull()); }
/** * Registers this instance to create jobs for a specific tag. It's possible to have multiple * {@link JobCreator}s with a first come first serve order. * * @param jobCreator The mapping between a specific job tag and the job class. */ public void addJobCreator(JobCreator jobCreator) { mJobCreatorHolder.addJobCreator(jobCreator); }
private JobManager(final Context context) { mContext = context; mJobCreatorHolder = new JobCreatorHolder(); mJobExecutor = new JobExecutor(); if (!JobConfig.isSkipJobReschedule()) { JobRescheduleService.startService(mContext); } mJobStorageLatch = new CountDownLatch(1); new Thread("AndroidJob-storage-init") { @Override public void run() { mJobStorage = new JobStorage(context); mJobStorageLatch.countDown(); } }.start(); }
if (mJobCreatorHolder.isEmpty()) { CAT.w("you haven't registered a JobCreator with addJobCreator(), it's likely that your job never will be executed");
job = mJobManager.getJobCreatorHolder().createJob(request.getTag());
holder.addJobCreator(new BlockingJobCreator());
@Before public void setup() { JobConfig.addLogger(jobLogger); holder = new JobCreatorHolder(); }
if (mJobCreatorHolder.isEmpty()) { CAT.w("you haven't registered a JobCreator with addJobCreator(), it's likely that your job never will be executed");
job = mJobManager.getJobCreatorHolder().createJob(request.getTag());
/** * Registers this instance to create jobs for a specific tag. It's possible to have multiple * {@link JobCreator}s with a first come first serve order. * * @param jobCreator The mapping between a specific job tag and the job class. */ public void addJobCreator(JobCreator jobCreator) { mJobCreatorHolder.addJobCreator(jobCreator); }
private JobManager(Context context) { mContext = context; mJobCreatorHolder = new JobCreatorHolder(); mJobStorage = new JobStorage(context); mJobExecutor = new JobExecutor(); if (!JobConfig.isSkipJobReschedule()) { JobRescheduleService.startService(mContext); } }
/** * Remove the mapping to stop it from creating new jobs. * * @param jobCreator The mapping between a specific job tag and the job class. */ public void removeJobCreator(JobCreator jobCreator) { mJobCreatorHolder.removeJobCreator(jobCreator); }