/// <summary> /// Create the job instance, populating it with property values taken /// from the scheduler context, job data map and trigger data map. /// </summary> protected override object CreateJobInstance(TriggerFiredBundle bundle) { ObjectWrapper ow = new ObjectWrapper(bundle.JobDetail.JobType); if (IsEligibleForPropertyPopulation(ow.WrappedInstance)) { MutablePropertyValues pvs = new MutablePropertyValues(); if (schedulerContext != null) { pvs.AddAll(schedulerContext); } pvs.AddAll(bundle.JobDetail.JobDataMap); pvs.AddAll(bundle.Trigger.JobDataMap); if (ignoredUnknownProperties != null) { for (int i = 0; i < ignoredUnknownProperties.Length; i++) { string propName = ignoredUnknownProperties[i]; if (pvs.Contains(propName)) { pvs.Remove(propName); } } ow.SetPropertyValues(pvs); } else { ow.SetPropertyValues(pvs, true); } } return ow.WrappedInstance; }
/// <summary> /// This implementation applies the passed-in job data map as object property /// values, and delegates to <code>ExecuteInternal</code> afterwards. /// </summary> /// <seealso cref="ExecuteInternal" /> public void Execute(IJobExecutionContext context) { try { ObjectWrapper bw = new ObjectWrapper(this); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.AddAll(context.Scheduler.Context); pvs.AddAll(context.MergedJobDataMap); bw.SetPropertyValues(pvs, true); } catch (SchedulerException ex) { throw new JobExecutionException(ex); } ExecuteInternal(context); }
public void AddAllInNullMap() { MutablePropertyValues props = new MutablePropertyValues (); props.Add (new PropertyValue ("Name", "Fiona Apple")); props.AddAll ((IDictionary) null); Assert.AreEqual (1, props.PropertyValues.Length); }
public void AddAllInNullMap() { MutablePropertyValues props = new MutablePropertyValues(); props.Add(new PropertyValue("Name", "Fiona Apple")); props.AddAll((IDictionary <string, object>)null); Assert.AreEqual(1, props.PropertyValues.Count); }
public void AddAllInNullMap() { MutablePropertyValues props = new MutablePropertyValues(); props.Add(new PropertyValue("Name", "Fiona Apple")); props.AddAll((IDictionary)null); Assert.AreEqual(1, props.PropertyValues.Length); }
public void AddAllInNullList() { MutablePropertyValues props = new MutablePropertyValues (); props.Add (new PropertyValue ("Name", "Fiona Apple")); props.Add (new PropertyValue ("Age", 24)); props.AddAll ((IList) null); Assert.AreEqual (2, props.PropertyValues.Length); }
public void AddAllInList() { MutablePropertyValues props = new MutablePropertyValues (); props.AddAll (new PropertyValue [] { new PropertyValue ("Name", "Fiona Apple"), new PropertyValue ("Age", 24)}); Assert.AreEqual (2, props.PropertyValues.Length); }
public void AddAllInNullList() { MutablePropertyValues props = new MutablePropertyValues(); props.Add(new PropertyValue("Name", "Fiona Apple")); props.Add(new PropertyValue("Age", 24)); props.AddAll((IList <PropertyValue>)null); Assert.AreEqual(2, props.PropertyValues.Count); }
public void AddAllInMap() { MutablePropertyValues props = new MutablePropertyValues (); IDictionary map = new Hashtable (); map.Add ("Name", "Fiona Apple"); map.Add ("Age", 24); props.AddAll (map); Assert.AreEqual (2, props.PropertyValues.Length); }
public void AddAllInList() { MutablePropertyValues props = new MutablePropertyValues(); props.AddAll(new PropertyValue [] { new PropertyValue("Name", "Fiona Apple"), new PropertyValue("Age", 24) }); Assert.AreEqual(2, props.PropertyValues.Count); }
public void AddAllInMap() { MutablePropertyValues props = new MutablePropertyValues(); IDictionary <string, object> map = new Dictionary <string, object>(); map.Add("Name", "Fiona Apple"); map.Add("Age", 24); props.AddAll(map); Assert.AreEqual(2, props.PropertyValues.Count); }
public void AddAllInMap() { MutablePropertyValues props = new MutablePropertyValues(); IDictionary map = new Hashtable(); map.Add("Name", "Fiona Apple"); map.Add("Age", 24); props.AddAll(map); Assert.AreEqual(2, props.PropertyValues.Length); }
public void AddAllInNullMap () { MutablePropertyValues props = new MutablePropertyValues (); props.Add (new PropertyValue ("Name", "Fiona Apple")); props.AddAll ((IDictionary<string, object>) null); Assert.AreEqual (1, props.PropertyValues.Count); }
public void AddAllInMap () { MutablePropertyValues props = new MutablePropertyValues (); IDictionary<string, object> map = new Dictionary<string, object>(); map.Add("Name", "Fiona Apple"); map.Add ("Age", 24); props.AddAll (map); Assert.AreEqual (2, props.PropertyValues.Count); }