Example #1
0
        public void MainLoop()
        {
            var hostName = Dns.GetHostName();

            _logManager.WriteMessage($"Grabbing hostname...{hostName}");

            _queueManager.AddToQueue(QUEUE_TYPE.RECORD_HOST_INFORMATION, hostName);

            while (_queueManager.IsRunning())
            {
                _queueManager.AddToQueue(QUEUE_TYPE.LISTEN_FOR_CHANGES);

                _queueManager.ProcessQueue();

                Thread.Sleep(1000);
            }

            _logManager.FlushLog();
        }
Example #2
0
        public void AddToQueueTestNullEntity()
        {
            int                maxQueueLength = 10;
            ProductType        pt             = new ProductType("Test", 0.1, 0.1);
            List <ProductType> productTypes   = new List <ProductType> {
                pt
            };
            bool         singleQueueLength = false;
            QueueManager target            = new QueueManager(maxQueueLength, productTypes, singleQueueLength);
            Call         entity            = null;

            target.AddToQueue(entity);
        }
Example #3
0
        public void AddToQueueTestNoQueueForType()
        {
            int                maxQueueLength = 10;
            ProductType        pt             = new ProductType("Test", 0.1, 0.1);
            List <ProductType> productTypes   = new List <ProductType> {
                pt
            };
            bool         singleQueueLength = false;
            QueueManager target            = new QueueManager(maxQueueLength, productTypes, singleQueueLength);
            Call         entity            = new Call((uint)1);

            entity.ProductType = new ProductType("Cheese", 0.1, 0.1);
            target.AddToQueue(entity);
        }
Example #4
0
        public void AddToQueueTest()
        {
            int                maxQueueLength = 10;
            ProductType        pt             = new ProductType("Test", 0.1, 0.1);
            List <ProductType> productTypes   = new List <ProductType> {
                pt
            };
            bool         singleQueueLength = false;
            QueueManager target            = new QueueManager(maxQueueLength, productTypes, singleQueueLength);
            Call         entity            = new Call((uint)1);

            entity.ProductType = pt;
            target.AddToQueue(entity);

            Assert.AreEqual(1, target.GetQueueLength(pt));
        }
Example #5
0
        public void IsQueueTooLongTestNoQueueFound()
        {
            int                maxQueueLength = 10;
            ProductType        pt             = new ProductType("Test", 0.1, 0.1);
            List <ProductType> productTypes   = new List <ProductType> {
                pt
            };
            bool         singleQueueLength = false;
            QueueManager target            = new QueueManager(maxQueueLength, productTypes, singleQueueLength);
            ProductType  productType       = new ProductType("Dave", 0.1, 0.1);
            Call         newCall           = new Call((uint)1);

            newCall.ProductType = pt;
            target.AddToQueue(newCall);
            bool actual;

            actual = target.IsQueueTooLong(productType);
        }
Example #6
0
        public void GetQueueLengthTestNoQueueFound()
        {
            int                maxQueueLength = 10;
            ProductType        pt             = new ProductType("Test", 0.1, 0.1);
            List <ProductType> productTypes   = new List <ProductType> {
                pt
            };
            bool         singleQueueLength = false;
            QueueManager target            = new QueueManager(maxQueueLength, productTypes, singleQueueLength);
            ProductType  productType       = new ProductType("Dave", 0.1, 0.1);

            target.AddToQueue(new Call((uint)1)
            {
                ProductType = pt
            });
            int actual;

            actual = target.GetQueueLength(productType);
        }
Example #7
0
        public void GetCallForRepTypeTestNullRepType()
        {
            int                maxQueueLength = 10;
            ProductType        pt             = new ProductType("Test", 0.1, 0.1);
            List <ProductType> productTypes   = new List <ProductType> {
                pt
            };
            bool         singleQueueLength = false;
            QueueManager target            = new QueueManager(maxQueueLength, productTypes, singleQueueLength);
            SalesRepType repType           = null;
            Call         newCall           = new Call((uint)1);

            newCall.ProductType = pt;
            target.AddToQueue(newCall);
            Call expected = newCall;
            Call actual;

            actual = target.GetCallForRepType(repType);
        }
Example #8
0
        private void addToQueueButton_Click(object sender, EventArgs e)
        {
            bool result = queueManager.CheckJobs(this);

            if (!result)
            {
                if (!String.IsNullOrEmpty(queueManager.errorList))
                {
                    MessageBox.Show(queueManager.errorList, Properties.Resources.ErrorLabel, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                queueManager.AddToQueue(this);
                if (MainForm.optionsData.showQueueWhenAdding)
                {
                    ShowQueueForm();
                }
            }
        }
Example #9
0
        public void IsQueueTooLongTestTrue()
        {
            int                maxQueueLength = 0;
            ProductType        pt             = new ProductType("Test", 0.1, 0.1);
            List <ProductType> productTypes   = new List <ProductType> {
                pt
            };
            bool         singleQueueLength = false;
            QueueManager target            = new QueueManager(maxQueueLength, productTypes, singleQueueLength);
            ProductType  productType       = pt;
            Call         newCall           = new Call((uint)1);

            newCall.ProductType = pt;
            target.AddToQueue(newCall);
            bool expected = true;
            bool actual;

            actual = target.IsQueueTooLong(productType);
            Assert.AreEqual(expected, actual);
        }
Example #10
0
        public void GetQueueLengthTest()
        {
            int                maxQueueLength = 10;
            ProductType        pt             = new ProductType("Test", 0.1, 0.1);
            List <ProductType> productTypes   = new List <ProductType> {
                pt
            };
            bool         singleQueueLength = false;
            QueueManager target            = new QueueManager(maxQueueLength, productTypes, singleQueueLength);
            ProductType  productType       = pt;

            target.AddToQueue(new Call((uint)1)
            {
                ProductType = pt
            });
            int expected = 1;
            int actual;

            actual = target.GetQueueLength(productType);
            Assert.AreEqual(expected, actual);
        }