Example #1
0
        /** <inheritDoc /> */
        public void OnLifecycleEvent(LifecycleEventType evtType)
        {
            if (LifecycleTest.ThrowErr)
                throw new Exception("Lifecycle exception.");

            Event evt = new Event();

            evt.Grid1 = Grid1;
            evt.Grid2 = Grid2;
            evt.Prop1 = Property1;
            evt.Prop2 = Property2;

            switch (evtType)
            {
                case LifecycleEventType.BeforeNodeStart:
                    LifecycleTest.BeforeStartEvts.Add(evt);

                    break;

                case LifecycleEventType.AfterNodeStart:
                    LifecycleTest.AfterStartEvts.Add(evt);

                    break;

                case LifecycleEventType.BeforeNodeStop:
                    LifecycleTest.BeforeStopEvts.Add(evt);

                    break;

                case LifecycleEventType.AfterNodeStop:
                    LifecycleTest.AfterStopEvts.Add(evt);

                    break;
            }
        }
Example #2
0
        /// <summary>
        /// Check event.
        /// </summary>
        /// <param name="evt">Event.</param>
        /// <param name="expGrid1">Expected grid 1.</param>
        /// <param name="expGrid2">Expected grid 2.</param>
        /// <param name="expProp1">Expected property 1.</param>
        /// <param name="expProp2">Expected property 2.</param>
        private static void CheckEvent(Event evt, IIgnite expGrid1, IIgnite expGrid2, int expProp1, string expProp2)
        {
            if (evt.Grid1 != null && evt.Grid1 is IgniteProxy)
                evt.Grid1 = (evt.Grid1 as IgniteProxy).Target;

            if (evt.Grid2 != null && evt.Grid2 is IgniteProxy)
                evt.Grid2 = (evt.Grid2 as IgniteProxy).Target;

            Assert.AreEqual(expGrid1, evt.Grid1);
            Assert.AreEqual(expGrid2, evt.Grid2);
            Assert.AreEqual(expProp1, evt.Prop1);
            Assert.AreEqual(expProp2, evt.Prop2);
        }