/// <exception cref="Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Reservation.Exceptions.PlanningException
        ///     "/>
        /// <exception cref="System.IO.IOException"/>
        public virtual void TestStress(int numJobs)
        {
            long timeWindow = 1000000L;

            Org.Apache.Hadoop.Yarn.Api.Records.Resource clusterCapacity = Org.Apache.Hadoop.Yarn.Api.Records.Resource
                                                                          .NewInstance(500 * 100 * 1024, 500 * 32);
            step = 1000L;
            ReservationSystemTestUtil testUtil  = new ReservationSystemTestUtil();
            CapacityScheduler         scheduler = testUtil.MockCapacityScheduler(500 * 100);
            string reservationQ   = testUtil.GetFullReservationQueueName();
            float  instConstraint = 100;
            float  avgConstraint  = 100;
            ReservationSchedulerConfiguration conf = ReservationSystemTestUtil.CreateConf(reservationQ
                                                                                          , timeWindow, instConstraint, avgConstraint);
            CapacityOverTimePolicy policy = new CapacityOverTimePolicy();

            policy.Init(reservationQ, conf);
            plan = new InMemoryPlan(scheduler.GetRootQueueMetrics(), policy, agent, clusterCapacity
                                    , step, res, minAlloc, maxAlloc, "dedicated", null, true);
            int acc = 0;
            IList <ReservationDefinition> list = new AList <ReservationDefinition>();

            for (long i = 0; i < numJobs; i++)
            {
                list.AddItem(ReservationSystemTestUtil.GenerateRandomRR(rand, i));
            }
            long start = Runtime.CurrentTimeMillis();

            for (int i_1 = 0; i_1 < numJobs; i_1++)
            {
                try
                {
                    if (agent.CreateReservation(ReservationSystemTestUtil.GetNewReservationId(), "u"
                                                + i_1 % 100, plan, list[i_1]))
                    {
                        acc++;
                    }
                }
                catch (PlanningException)
                {
                }
            }
            // ignore exceptions
            long end = Runtime.CurrentTimeMillis();

            System.Console.Out.WriteLine("Submitted " + numJobs + " jobs " + " accepted " + acc
                                         + " in " + (end - start) + "ms");
        }