Beispiel #1
0
        public static bool runRichards()
        {
            Scheduler scheduler = new Scheduler();

            scheduler.addIdleTask(ID_IDLE, 0, null, COUNT);
            Packet queue = new Packet(null, ID_WORKER, KIND_WORK);

            queue = new Packet(queue, ID_WORKER, KIND_WORK);
            scheduler.addWorkerTask(ID_WORKER, 1000, queue);

            queue = new Packet(null, ID_DEVICE_A, KIND_DEVICE);
            queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE);
            queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE);
            scheduler.addHandlerTask(ID_HANDLER_A, 2000, queue);

            queue = new Packet(null, ID_DEVICE_B, KIND_DEVICE);
            queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE);
            queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE);
            scheduler.addHandlerTask(ID_HANDLER_B, 3000, queue);

            scheduler.addDeviceTask(ID_DEVICE_A, 4000, null);
            scheduler.addDeviceTask(ID_DEVICE_B, 5000, null);
            scheduler.schedule();

            return((scheduler.queueCount == EXPECTED_QUEUE_COUNT) &&
                   (scheduler.holdCount == EXPECTED_HOLD_COUNT));
        }
Beispiel #2
0
        public static bool runRichards()
        {
            Scheduler scheduler = new Scheduler();
            scheduler.addIdleTask(ID_IDLE, 0, null, COUNT);
            Packet queue = new Packet(null, ID_WORKER, KIND_WORK);
            queue = new Packet(queue, ID_WORKER, KIND_WORK);
            scheduler.addWorkerTask(ID_WORKER, 1000, queue);

            queue = new Packet(null, ID_DEVICE_A, KIND_DEVICE);
            queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE);
            queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE);
            scheduler.addHandlerTask(ID_HANDLER_A, 2000, queue);

            queue = new Packet(null, ID_DEVICE_B, KIND_DEVICE);
            queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE);
            queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE);
            scheduler.addHandlerTask(ID_HANDLER_B, 3000, queue);

            scheduler.addDeviceTask(ID_DEVICE_A, 4000, null);
            scheduler.addDeviceTask(ID_DEVICE_B, 5000, null);
            scheduler.schedule();

            return ((scheduler.queueCount == EXPECTED_QUEUE_COUNT)
                && (scheduler.holdCount == EXPECTED_HOLD_COUNT));
        }
Beispiel #3
0
        public void run()
        {
            Scheduler scheduler = new Scheduler();

            scheduler.addIdleTask(ID_IDLE, 0, null, COUNT);

            Packet queue = new Packet(null, ID_WORKER, Kind.WORK);

            queue = new Packet(queue, ID_WORKER, Kind.WORK);
            scheduler.addWorkerTask(ID_WORKER, 1000, queue);

            queue = new Packet(null, ID_DEVICE_A, Kind.DEVICE);
            queue = new Packet(queue, ID_DEVICE_A, Kind.DEVICE);
            queue = new Packet(queue, ID_DEVICE_A, Kind.DEVICE);
            scheduler.addHandlerTask(ID_HANDLER_A, 2000, queue);

            queue = new Packet(null, ID_DEVICE_B, Kind.DEVICE);
            queue = new Packet(queue, ID_DEVICE_B, Kind.DEVICE);
            queue = new Packet(queue, ID_DEVICE_B, Kind.DEVICE);
            scheduler.addHandlerTask(ID_HANDLER_B, 3000, queue);

            scheduler.addDeviceTask(ID_DEVICE_A, 4000, null);

            scheduler.addDeviceTask(ID_DEVICE_B, 5000, null);

            scheduler.schedule();

            if (scheduler.queueCount != EXPECTED_QUEUE_COUNT ||
                scheduler.holdCount != EXPECTED_HOLD_COUNT)
            {
                Console.Write("Error during execution: queueCount = ");
                Console.Write(scheduler.queueCount);
                Console.Write(", holdCount = ");
                Console.Write(scheduler.holdCount);
                Console.WriteLine(".");
            }
            else
            {
                Console.WriteLine("Finished successfully");
            }
        }