public void testStoreAndRetrieveJobs() { RAMJobStore store = new RAMJobStore(); // Store jobs. for (int i = 0; i < 10; i++) { IJobDetail job = JobBuilder.Create<NoOpJob>().WithIdentity("job" + i).Build(); store.StoreJob(job, false); } // Retrieve jobs. for (int i = 0; i < 10; i++) { JobKey jobKey = JobKey.Create("job" + i); IJobDetail storedJob = store.RetrieveJob(jobKey); Assert.AreEqual(jobKey, storedJob.Key); } }
public void TestStoreAndRetriveTriggers() { RAMJobStore store = new RAMJobStore(); // Store jobs and triggers. for (int i = 0; i < 10; i++) { IJobDetail job = JobBuilder.Create<NoOpJob>().WithIdentity("job" + i).Build(); store.StoreJob(job, true); SimpleScheduleBuilder schedule = SimpleScheduleBuilder.Create(); ITrigger trigger = TriggerBuilder.Create().WithIdentity("job" + i).WithSchedule(schedule).ForJob(job).Build(); store.StoreTrigger((IOperableTrigger) trigger, true); } // Retrieve job and trigger. for (int i = 0; i < 10; i++) { JobKey jobKey = JobKey.Create("job" + i); IJobDetail storedJob = store.RetrieveJob(jobKey); Assert.AreEqual(jobKey, storedJob.Key); TriggerKey triggerKey = new TriggerKey("job" + i); ITrigger storedTrigger = store.RetrieveTrigger(triggerKey); Assert.AreEqual(triggerKey, storedTrigger.Key); } }
public void TestRetrieveJob_NoJobFound() { RAMJobStore store = new RAMJobStore(); IJobDetail job = store.RetrieveJob(new JobKey("not", "existing")); Assert.IsNull(job); }