Exemple #1
0
        public void TestRun02()
        {
            //Testing ----- invalid datapoint Value from OPCProxy
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene02();
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);

            oPCLoggerQueneAccessor.SetField("m_serviceStarted", true);
            Dictionary <string, OPCDPGrpDetails> opcdic = new Dictionary <string, OPCDPGrpDetails>();
            OPCDPGrpDetails deta1 = new OPCDPGrpDetails();

            opcdic.Add("testingDP1", new OPCDPGrpDetails());
            Accessor oPCMagerAccessor = ReflectionAccessor.Wrap(OPCDataPointManager.GetInstance());

            oPCMagerAccessor.SetField("m_DataPointdic", opcdic);
            System.Threading.ThreadStart func = new System.Threading.ThreadStart(oPCLoggerQuene.Run);
            System.Threading.Thread      t1   = new System.Threading.Thread(func);
            t1.Start();
            //wait till test completes
            m_OPCLoggerQuenesignal.WaitOne();

            //PostCondition Check
            //check no data point in WriteQuene.
            Assert.AreEqual(0, oPCMagerAccessor.GetFieldAccessor("m_writeQuene").GetFieldAccessor("m_writeQuene").GetProperty("Count"));


            //release all instances
            OPCDataPointManager.ReleaseInstance();
            OPCLoggerQueneFactory.ReleaseOPCLoggerQuene02();
        }
Exemple #2
0
        public void TestCheckSampleGroupFlag02()
        {
            // Testing -- SampleGrp config Changed and valid setup for re initializations.
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);

            oPCLoggerQueneAccessor.Call("CheckSampleGroupFlag");
        }
Exemple #3
0
        public void TestCheckSampleGroupFlag01()
        {
            //Testing --- SampleGrp Config Variable changed and throws exception in removeOPCItems and intialization
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);

            //Test Procedure Call
            oPCLoggerQueneAccessor.Call("CheckSampleGroupFlag");
            //Post Condition Check
        }
Exemple #4
0
        public void TestTerminateAndWait02()
        {
            //Testing -- normal flow
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);

            oPCLoggerQueneAccessor.SetField("m_thread", System.Threading.Thread.CurrentThread);
            //Test Procedure Call
            oPCLoggerQuene.TerminateAndWait();
            //Post Condition Call
        }
Exemple #5
0
        public void TestsetServiceRunning01()
        {
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);
            bool           flag = false;

            //Test Procedure Call
            oPCLoggerQuene.setServiceRunning(flag);
            //Post Condition Check
            Assert.AreEqual(flag, oPCLoggerQueneAccessor.GetField("m_serviceStarted"));
        }
Exemple #6
0
        public void TestCheckOPCConnection02()
        {
            // Test ---- OPC Server is Connected
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);
            //Test Procedure Call
            bool b = (bool)oPCLoggerQueneAccessor.Call("CheckOPCConnection");

            //Post Condition Check
            Assert.IsTrue(b);
        }
Exemple #7
0
        public void TestGetOPCValue04()
        {
            //Testing --- DataPoint value returned is other type than boolean and numeric
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            string         dataPointname          = "SampleDP1";
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);
            //Test Procedure Call
            string str = (string)oPCLoggerQueneAccessor.Call("GetOPCValue", dataPointname);

            //Post Condition Check
            Assert.AreEqual("0", str);
        }
Exemple #8
0
        public void TestGetOPCValue01()
        {
            //Testing --- DataPoint not connected to OPC Server Proxy
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            string         dataPointname          = "SampleDP1";
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);
            //Test Procedure Call
            string str = (string)oPCLoggerQueneAccessor.Call("GetOPCValue", dataPointname);

            //Post Condition Check
            Assert.AreEqual("", str);
        }
Exemple #9
0
        public void TestCanLogDataPT01()
        {
            //Testing --- NextSampleTime is null ... first time logging the datapoint
            OPCLoggerQuene  oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            OPCDPGrpDetails opcDPGrp               = OPCDPGrpDetailsFactory.CreateOPCDPGrpDetails01();
            Accessor        oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);
            //Test Procedure Call
            bool b = (bool)oPCLoggerQueneAccessor.Call("CanLogDataPT", opcDPGrp);

            //Post Condition Check
            Assert.IsTrue(b);
        }
Exemple #10
0
        public void TestRun05()
        {
            //Testing ----- Initialization data logger failed
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene02();
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);

            oPCLoggerQueneAccessor.SetField("m_serviceStarted", true);
            oPCLoggerQuene.Run();
            //release all instances
            OPCDataPointManager.ReleaseInstance();
            OPCLoggerQueneFactory.ReleaseOPCLoggerQuene02();
        }
Exemple #11
0
        public void TestTerminateAndWait01()
        {
            //Testing -- thread with not started state --- throws exception
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);

            System.Threading.ThreadStart ss   = new System.Threading.ThreadStart(threadProc);
            System.Threading.Thread      thr1 = new System.Threading.Thread(ss);
            oPCLoggerQueneAccessor.SetField("m_thread", thr1);
            //Test Procedure Call
            oPCLoggerQuene.TerminateAndWait();
            //Post Condition Call
        }
Exemple #12
0
        public void TestCheckOracleConnection02()
        {
            // testing ---- exception is passed
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            string         exceptionString        = "Database Connection Failure testing";
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);

            oPCLoggerQueneAccessor.Call("CheckOracleConnection", exceptionString);

            //test2 --- exception passed but flag already set.
            oPCLoggerQueneAccessor.SetField("m_dbDisconnected", true);
            oPCLoggerQueneAccessor.Call("CheckOracleConnection", exceptionString);
        }
Exemple #13
0
        public void TestCanLogDataPT03()
        {
            //testing -- current time is less than next sample time of datapoint
            OPCLoggerQuene  oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            OPCDPGrpDetails opcDPGrp               = OPCDPGrpDetailsFactory.CreateOPCDPGrpDetails01();
            Accessor        oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);

            opcDPGrp.NextSampleTime = DateTime.Now;
            //Test Procedure Call
            bool b = (bool)oPCLoggerQueneAccessor.Call("CanLogDataPT", opcDPGrp);

            //Post Condition Check
            Assert.IsFalse(b);
        }
Exemple #14
0
        public void TestTestOracleConnection01()
        {
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);
            bool           b = (bool)oPCLoggerQueneAccessor.Call("TestOracleConnection");

            //Test 2 --- databse connection failed again
            oPCLoggerQueneAccessor.SetField("m_dbDisconnected", true);
            b = (bool)oPCLoggerQueneAccessor.Call("TestOracleConnection");

            //Test3 -- Database connection OK
            oPCLoggerQueneAccessor.SetField("m_dbDisconnected", true);
            b = (bool)oPCLoggerQueneAccessor.Call("TestOracleConnection");
        }
Exemple #15
0
        public void TestCheckOracleConnection01()
        {
            //testing ---- exception throw for null exception string
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene01();
            string         exceptionString        = null;
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);

            //Test Procedure Call
            oPCLoggerQueneAccessor.Call("CheckOracleConnection", exceptionString);
            //Post Condition Check
            Assert.IsFalse((bool)oPCLoggerQueneAccessor.GetField("m_dbDisconnected"));


            //testing ---- no exception passed
            exceptionString = "";
            //Test Procedure Call
            oPCLoggerQueneAccessor.Call("CheckOracleConnection", exceptionString);
            //Post Condition Check
            Assert.IsFalse((bool)oPCLoggerQueneAccessor.GetField("m_dbDisconnected"));
        }
Exemple #16
0
        public void TestRun04()
        {
            //Testing ----- Exception cases
            OPCLoggerQuene oPCLoggerQuene         = OPCLoggerQueneFactory.CreateOPCLoggerQuene02();
            Accessor       oPCLoggerQueneAccessor = ReflectionAccessor.Wrap(oPCLoggerQuene);

            oPCLoggerQueneAccessor.SetField("m_serviceStarted", true);
            Dictionary <string, OPCDPGrpDetails> opcdic = new Dictionary <string, OPCDPGrpDetails>();

            opcdic.Add("testingDP1", null);
            Accessor oPCMagerAccessor = ReflectionAccessor.Wrap(OPCDataPointManager.GetInstance());

            oPCMagerAccessor.SetField("m_DataPointdic", opcdic);
            System.Threading.ThreadStart func = new System.Threading.ThreadStart(oPCLoggerQuene.Run);
            System.Threading.Thread      t1   = new System.Threading.Thread(func);
            t1.Start();
            //wait till test completes
            m_OPCLoggerQuenesignal.WaitOne();
            //release all instances
            OPCDataPointManager.ReleaseInstance();
            OPCLoggerQueneFactory.ReleaseOPCLoggerQuene02();
        }