/// <exception cref="System.Exception"/> public virtual void TestReconnectedNode() { CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration(); conf.SetQueues("default", new string[] { "default" }); conf.SetCapacity("default", 100); FifoScheduler fs = new FifoScheduler(); fs.Init(conf); fs.Start(); // mock rmContext to avoid NPE. RMContext context = Org.Mockito.Mockito.Mock <RMContext>(); fs.Reinitialize(conf, null); fs.SetRMContext(context); RMNode n1 = MockNodes.NewNodeInfo(0, MockNodes.NewResource(4 * Gb), 1, "127.0.0.2" ); RMNode n2 = MockNodes.NewNodeInfo(0, MockNodes.NewResource(2 * Gb), 2, "127.0.0.3" ); fs.Handle(new NodeAddedSchedulerEvent(n1)); fs.Handle(new NodeAddedSchedulerEvent(n2)); fs.Handle(new NodeUpdateSchedulerEvent(n1)); NUnit.Framework.Assert.AreEqual(6 * Gb, fs.GetRootQueueMetrics().GetAvailableMB() ); // reconnect n1 with downgraded memory n1 = MockNodes.NewNodeInfo(0, MockNodes.NewResource(2 * Gb), 1, "127.0.0.2"); fs.Handle(new NodeRemovedSchedulerEvent(n1)); fs.Handle(new NodeAddedSchedulerEvent(n1)); fs.Handle(new NodeUpdateSchedulerEvent(n1)); NUnit.Framework.Assert.AreEqual(4 * Gb, fs.GetRootQueueMetrics().GetAvailableMB() ); fs.Stop(); }