public void TestSynchroFinishPersistence() { TestGraph1 tg1 = new TestGraph1(); TestGraph1 tg2 = new TestGraph1(); // Synchronize ta and tc VertexSynchronizer vs1 = new VertexSynchronizer(tg1.model.Executive, new Vertex[] { tg1.ta.PostVertex, tg1.tc.PostVertex }, ExecEventType.Detachable); // Synchronize tc and ta VertexSynchronizer vs2 = new VertexSynchronizer(tg2.model.Executive, new Vertex[] { tg2.tc.PostVertex, tg2.ta.PostVertex }, ExecEventType.Detachable); storeXML(tg1); tg1 = null; loadXML(ref tg1); storeXML(tg2); tg2 = null; loadXML(ref tg2); // Test graph 1 Assert.AreEqual(tg1.ta.GetFinishTime(tg1.GraphContext), new DateTime(1, 1, 1, 4, 0, 0), "Task A did not finish at 4AM 1/1/1"); Assert.AreEqual(tg1.tc.GetFinishTime(tg1.GraphContext), new DateTime(1, 1, 1, 4, 0, 0), "Task C did not finish at 4AM 1/1/1"); Assert.AreEqual(tg1.td.GetStartTime(tg1.GraphContext), new DateTime(1, 1, 1, 4, 0, 0), "Task D did not start at 4AM 1/1/1"); tg1.model.Start(); _Debug.WriteLine("Test 2"); tg2.model.Start(); // Test graph 2 Assert.AreEqual(tg2.ta.GetFinishTime(tg2.GraphContext), new DateTime(1, 1, 1, 4, 0, 0), "Task A did not finish at 4AM 1/1/1"); Assert.AreEqual(tg2.tc.GetFinishTime(tg2.GraphContext), new DateTime(1, 1, 1, 1, 0, 0), "Task C did not finish at 1AM 1/1/1"); Assert.AreEqual(tg2.td.GetStartTime(tg2.GraphContext), new DateTime(1, 1, 1, 1, 0, 0), "Task D did not start at 1AM 1/1/1"); }
public void TestSynchroStart() { TestGraph1 tg1 = new TestGraph1(); TestGraph1 tg2 = new TestGraph1(); // Synchronize tb and td VertexSynchronizer vs1 = new VertexSynchronizer(tg1.model.Executive, new Vertex[] { tg1.tb.PreVertex, tg1.td.PreVertex }, ExecEventType.Detachable); // Synchronize tb and tc VertexSynchronizer vs2 = new VertexSynchronizer(tg2.model.Executive, new Vertex[] { tg2.tb.PreVertex, tg2.tc.PreVertex }, ExecEventType.Detachable); tg1.model.Start(); Debug.WriteLine("Test 2"); tg2.model.Start(); // Test graph 1 Assert.IsTrue(tg1.tb.GetStartTime(tg1.GraphContext).Equals(new DateTime(1, 1, 1, 4, 0, 0)), "Task B did not start at 4AM 1/1/1"); Assert.IsTrue(tg1.td.GetStartTime(tg1.GraphContext).Equals(new DateTime(1, 1, 1, 4, 0, 0)), "Task D did not start at 4AM 1/1/1"); Assert.IsTrue(tg1.parent.GetFinishTime(tg1.GraphContext).Equals(new DateTime(1, 1, 1, 5, 0, 0)), "Task parent did not finish at 5AM 1/1/1"); // Test graph 2 Assert.IsTrue(tg2.tb.GetStartTime(tg2.GraphContext).Equals(new DateTime(1, 1, 1, 4, 0, 0)), "Task B did not start at 4AM 1/1/1"); Assert.IsTrue(tg2.tc.GetStartTime(tg2.GraphContext).Equals(new DateTime(1, 1, 1, 4, 0, 0)), "Task C did not start at 4AM 1/1/1"); Assert.IsTrue(tg2.parent.GetFinishTime(tg2.GraphContext).Equals(new DateTime(1, 1, 1, 6, 0, 0)), "Task parent did not finish at 6AM 1/1/1"); }
public SynchronizerData(VertexSynchronizer vs) { m_vs = vs; m_fwdVisits = new ArrayList(); m_revVisits = new ArrayList(); m_members = new ArrayList(); m_earliest = long.MinValue; m_latest = long.MaxValue; foreach (Vertex vertex in m_vs.Members) { m_members.Add(vertex); } }
public void TestSynchroStartPersistence() { TestGraph1 tg1 = new TestGraph1(); TestGraph1 tg2 = new TestGraph1(); // Synchronize tb and td VertexSynchronizer vs1 = new VertexSynchronizer(tg1.model.Executive, new Vertex[] { tg1.tb.PreVertex, tg1.td.PreVertex }, ExecEventType.Detachable); // Synchronize tb and tc VertexSynchronizer vs2 = new VertexSynchronizer(tg2.model.Executive, new Vertex[] { tg2.tb.PreVertex, tg2.tc.PreVertex }, ExecEventType.Detachable); storeXML(tg1); tg1 = null; loadXML(ref tg1); storeXML(tg2); tg2 = null; loadXML(ref tg2); tg1.model.Start(); _Debug.WriteLine("Test 2"); tg2.model.Start(); // Test graph 1 Assert.AreEqual(tg1.tb.GetStartTime(tg1.GraphContext), new DateTime(1, 1, 1, 4, 0, 0), "Task B did not start at 4AM 1/1/1"); Assert.AreEqual(tg1.td.GetStartTime(tg1.GraphContext), new DateTime(1, 1, 1, 4, 0, 0), "Task D did not start at 4AM 1/1/1"); // AEL, bug \"Set finish time on a task\" submitted //Assert.AreEqual(tg1.parent.GetFinishTime(tg1.GraphContext), new DateTime(1,1,1,5,0,0), "Task parent did not finish at 5AM 1/1/1"); // Test graph 2 Assert.AreEqual(tg2.tb.GetStartTime(tg2.GraphContext), new DateTime(1, 1, 1, 4, 0, 0), "Task B did not start at 4AM 1/1/1"); Assert.AreEqual(tg2.tc.GetStartTime(tg2.GraphContext), new DateTime(1, 1, 1, 4, 0, 0), "Task C did not start at 4AM 1/1/1"); // AEL, bug \"Set finish time on a task\" submitted //Assert.AreEqual(tg2.parent.GetFinishTime(tg2.GraphContext), new DateTime(1,1,1,6,0,0), "Task parent did not finish at 6AM 1/1/1"); }