Ejemplo n.º 1
0
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            const int _waitTime = 30000;

            Trace.TraceInformation("IngestWebJob entry point called.");
            while (true)
            {
                try
                {
                    Trace.TraceInformation("Monitoring instance started");
                    var _monitor = new MonitoringController();
                    var start    = DateTime.Now;
                    _monitor.Start();
                    Trace.TraceInformation("Total time for processing: {0}", DateTime.Now.Subtract(start));
                }
                catch (AggregateException ae)
                {
                    ae = ae.Flatten();
                    Trace.TraceError("Aggregate exception: {0}", ae);
                    Trace.TraceError("source: {0} exception: {1} stacktrace: {2}", ae.Source, ae.Message, ae.StackTrace);
                }
                catch (Exception ex)
                {
                    Trace.TraceError("System Exception: {0}", ex);
                    Trace.TraceError("source: {0} exception: {1} stacktrace: {2}", ex.Source, ex.Message, ex.StackTrace);
                }
                finally
                {
                    Thread.Sleep(_waitTime);
                }
            }
        }
Ejemplo n.º 2
0
        public override void Run()
        {
            // This is a sample worker implementation. Replace with your logic.
            Trace.TraceInformation("MediaDashboard.IngestWorker entry point called\r\n");
            MonitoringController _monitor = null;

            while (true)
            {
                try
                {
                    _monitor = new MonitoringController();
                    _monitor.Start();

                    Debug.Write("Monitoring instance started", "information");
                }
                catch (Exception _ex)
                {
                    Debug.Write(string.Format("source: {0} exception: {1} stacktrace: {2}", _ex.Source, _ex.Message, _ex.StackTrace), "warning");
                }
                finally
                {
                    Thread.Sleep(_waitTime);
                }
            }
        }
Ejemplo n.º 3
0
        public FormMonitorManage()
        {
            InitializeComponent();

            this.m_MonitoringController              = new MonitoringController();
            this.m_MonitoringController.QueryEvent  += m_MonitoringController_QueryEvent;
            this.m_MonitoringController.DeleteEvent += m_MonitoringController_DeleteEvent;
        }
Ejemplo n.º 4
0
        public void SetUp()
        {
            //Create mock services
            _monitoringService      = new Mock <IMonitoringService>();
            _nbrSurveillanceService = new Mock <INbrSurveillanceService>();
            _patientService         = new Mock <IPatientService>();

            //Create controller
            _controller = new MonitoringController(_monitoringService.Object, _nbrSurveillanceService.Object, _patientService.Object);
        }
Ejemplo n.º 5
0
        public void DeleteTest1()
        {
            MonitoringController monitoringController;

            monitoringController = new MonitoringController();
            monitoringController.Delete((string)null);
            Assert.IsNotNull((object)monitoringController);
            Assert.AreEqual <string>("127.0.0.1", ((BaseService)monitoringController).Server);
            Assert.AreEqual <int>(8080, ((BaseService)monitoringController).Port);
        }
Ejemplo n.º 6
0
        public FormMonitor(OperationType type, Fire_ForestRemoteMonitoring monitor = null)
        {
            InitializeComponent();

            this.m_OperationType        = type;
            this.m_Monitor              = monitor;
            this.m_MonitoringController = new MonitoringController();

            this.m_MonitoringController.AddEvent  += m_MonitoringController_AddEvent;
            this.m_MonitoringController.EditEvent += m_MonitoringController_EditEvent;
        }
Ejemplo n.º 7
0
        public void EditTest()
        {
            MonitoringController monitoringController;

            // 测试用例1
            monitoringController = new MonitoringController();
            monitoringController.Edit((Fire_ForestRemoteMonitoring)null);
            Assert.IsNotNull((object)monitoringController);
            Assert.AreEqual <string>("127.0.0.1", ((BaseService)monitoringController).Server);
            Assert.AreEqual <int>(8080, ((BaseService)monitoringController).Port);

            // 测试用例2
            monitoringController = new MonitoringController();
            Fire_ForestRemoteMonitoring s0 = new Fire_ForestRemoteMonitoring();

            s0.objectid      = 0;
            s0.name          = (string)null;
            s0.address       = (string)null;
            s0.manager       = (string)null;
            s0.phone         = (string)null;
            s0.longitude     = 0;
            s0.latitude      = 0;
            s0.county        = (string)null;
            s0.deviceid      = (string)null;
            s0.ip            = (string)null;
            s0.image         = (byte[])null;
            s0.height        = 0;
            s0.elevation     = 0;
            s0.h_offset      = 0;
            s0.v_offset      = 0;
            s0.cre_time      = (string)null;
            s0.cre_pers      = (string)null;
            s0.mod_time      = (string)null;
            s0.mod_pers      = (string)null;
            s0.shape         = (string)null;
            s0.user_         = (string)null;
            s0.password      = (string)null;
            s0.city          = (string)null;
            s0.channel       = 0;
            s0.Port          = 0;
            s0.picture1      = (string)null;
            s0.picture2      = (string)null;
            s0.video         = (string)null;
            s0.note          = (string)null;
            s0.username      = (string)null;
            s0.id            = (string)null;
            s0.pac           = (string)null;
            s0.mediaByteDict = (Dictionary <string, object>)null;
            s0.mediaFiles    = (List <MediaFile>)null;
            monitoringController.Edit(s0);
            Assert.IsNotNull((object)monitoringController);
            Assert.AreEqual <string>("127.0.0.1", ((BaseService)monitoringController).Server);
            Assert.AreEqual <int>(8080, ((BaseService)monitoringController).Port);
        }
 public void MonitoringControllerTest2()
 {
     ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;
     WebRequest.DefaultWebProxy = new WebProxy("http://localhost:8888/", false);
     try
     {
         // MonitoringWorker mw = new MonitoringWorker(svc);
         MonitoringController mw = new MonitoringController();
         mw.Start();
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message, ex);
     }
 }
Ejemplo n.º 9
0
        public void DeleteTest()
        {
            MonitoringController monitoringController;

            //测试用例1
            monitoringController = new MonitoringController();
            monitoringController.Delete((Dictionary <string, object>)null);
            Assert.IsNotNull((object)monitoringController);
            Assert.AreEqual <string>("127.0.0.1", ((BaseService)monitoringController).Server);
            Assert.AreEqual <int>(8080, ((BaseService)monitoringController).Port);

            // 测试用例2
            Dictionary <string, object> dictionary;

            monitoringController = new MonitoringController();
            dictionary           = new Dictionary <string, object>(0);
            dictionary[""]       = (object)null;
            monitoringController.Delete(dictionary);
            Assert.IsNotNull((object)monitoringController);
            Assert.AreEqual <string>("127.0.0.1", ((BaseService)monitoringController).Server);
            Assert.AreEqual <int>(8080, ((BaseService)monitoringController).Port);
        }
 public MonitoringControllerTests()
 {
     _monitoringController = new MonitoringController();
     _accestoken           = Guid.NewGuid().ToString();
     VersionMonitor.SetAccessToken(_accestoken);
 }
Ejemplo n.º 11
0
 public void SetUp()
 {
     _monitor = new Mock <IMonitor>();
     _sut     = new MonitoringController(_monitor.Object);
 }
Ejemplo n.º 12
0
 public void Initialize()
 {
     _actionSource = new ActionSource();
     _controller   = new MonitoringController(_actionSource);
 }