static void Main(string[] args) { LogHelper.setLogFile("../logs/Log_OPCSampleGrpConfig.txt"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { OPCSampleGrpConfig.Common.FormCaptionHelper.GetInstance().AddCaptionsToStringHelper(); ConfigureFileHelper.GetInstance().init(); //Connect to central database DBConnectionStrings.GetInstance().AddConnectionString(ConfigureFileHelper.GetInstance().ConnectionStringConfig); //set the language and encoding change LanguageType type = LanguageTypeHelper.GetInstance().GetLanTypeByLanStr(ConfigureFileHelper.GetInstance().LanguageStr); LanguageTypeHelper.GetInstance().SetLanaguageType(type); DAOHelper.SetEncodingChange(ConfigureFileHelper.GetInstance().EncodingChange); ViewManager.GetInstance().RegisterViewFactory(new OPCSampleGrpConfigViewFactory()); IView view = ViewManager.GetInstance().GetView(OPCSampleGrpConfigStart.OPCSAMPLEGRPCONFIGSTARTFRM); Form frm = (Form)view; if (args.Length > 0) { OPCSampleGrpConfigStartController sampleGrpController = (OPCSampleGrpConfigStartController)view.getController(); sampleGrpController.SetSampleGrpConfigLocation(ref frm, args[0]); } Application.Run(frm); } catch (Exception localExecption) { Console.WriteLine(localExecption.ToString()); } DBConnectionStrings.GetInstance().TerminateMonitorThread(); }
public void TestRun02() { DbStatusMonitorThread monitorThreadTemp = new DbStatusMonitorThread(); ThreadStart threadStartFunction = new ThreadStart(monitorThreadTemp.Run); Thread workerThread = new Thread(threadStartFunction); monitorThreadTemp.UpdateStatusHandler += DBConnectionStrings.GetInstance().UpdateDBStatus; monitorThreadTemp.AddItem(TestDBInit.localConnectionString1); // try // { // monitorThreadTemp.Run(); // } // catch (System.Exception ex) // { // // } workerThread.Start(); //stub localList.Remove(localList[i]); throw exception Thread.Sleep(1000); monitorThreadTemp.TerminateThread(); }
public void FixtureSetUp() { OPCSampleGrpConfig.Common.FormCaptionHelper.GetInstance().AddCaptionsToStringHelper(); TrendingHelper.ConfigureFileHelper.GetInstance().init(); LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.English); OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); DBConnectionStrings.GetInstance().AddConnectionString(TrendingHelper.ConfigureFileHelper.GetInstance().ConnectionStringConfig); }
public void FixtureSetUp() { dbConnectionStrings = DBConnectionStrings.GetInstance(); DBConnectionStrings.ReleaseInstance(); // ((IDisposable)dbConnectionStrings).Dispose(); // to call the desctruction dbConnectionStrings = DBConnectionStrings.GetInstance(); TestDBInit.openConn(); }
public void FixtureSetUp() { DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.OPCDataSelector, TestConst.TEST_VIEW_ID); oPCDataSelectorController = (OPCDataSelectorController)(view.getController()); //oPCDataSelectorController.InitDataNodeList(); }
public void FixtureSetUp() { DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.TrendView, TestConst.TEST_VIEW_ID); //viewID is "" trendView = (TrendView)view; ConfigureFileHelper.GetInstance().init(); viewAccessor = ReflectionAccessor.Wrap(trendView); }
public void TestThreadMemberFunction01() { // monitorThread.TerminateThread(); Accessor threadAccessor = ReflectionAccessor.Wrap(monitorThread); threadAccessor.SetField("m_terminate", false); monitorThread.UpdateStatusHandler += DBConnectionStrings.GetInstance().UpdateDBStatus; monitorThread.ThreadMemberFunction(TestDBInit.localConnectionString1); threadAccessor.SetField("m_terminate", true); monitorThread.ThreadMemberFunction(TestDBInit.localConnectionString1); }
public void TestOpenConnection01() { OPCSampleGrpConfigStartModel oPCSampleGrpConfigStartModel = OPCSampleGrpConfigStartModelFactory.CreateOPCSampleGrpConfigStartModel01(); string connectionString = string.Empty; DBConnectionStrings.ReleaseInstance(); DBConnectionStrings.GetInstance().AddConnectionString(connectionString); bool b = false; try { b = oPCSampleGrpConfigStartModel.OpenConnection(); } catch (System.Exception ex) { } #region Record State ValueRecorder recorder = new ValueRecorder(); recorder.Record(b); recorder.FinishRecording(); #endregion // ExpectedException custom attribute was generated instead of // assertions since the test threw System.ArgumentOutOfRangeException #region PostConditionCheck //Assert.IsFalse(b); #endregion //Test invalid connection string connectionString = "DataSource: ; UserName =;Password=;"; DBConnectionStrings.ReleaseInstance(); DBConnectionStrings.GetInstance().AddConnectionString(connectionString); try { b = oPCSampleGrpConfigStartModel.OpenConnection(); } catch (System.Exception ex) { } #region PostConditionCheck Assert.IsFalse(b); #endregion //Test valid connection string DBConnectionStrings.ReleaseInstance(); DBConnectionStrings.GetInstance().AddConnectionString(ConfigureFileHelper.GetInstance().ConnectionStringConfig); b = oPCSampleGrpConfigStartModel.OpenConnection(); #region PostConditionCheck Assert.IsTrue(b); #endregion }
public void FixtureSetUp() { ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.TrendView, TestConst.TEST_VIEW_ID); trendViewController = (TrendViewController)view.getController(); if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1) { DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); } }
public void FixtureSetUp() { ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.ChangeTrendTitle, "Test_ViewID"); changeTrendTitleController = (ChangeTrendTitleController)(view.getController()); string[] titles = new string[3]; titles[0] = ""; titles[1] = ""; titles[2] = ""; changeTrendTitleController.InitData(titles); changeTrendTitleController.AttachCallBack(null, view); DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); }
public void FixtureSetUp() { if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1) { DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); } ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.LoadConfigFormula, TestConst.TEST_VIEW_ID); formulaGroupController = (FormulaGroupController)(view.getController()); formulaGroupController.SetFormType(FormType.Load); formulaGroupController.InitFormulaGrp(); }
public void FixtureSetUp() { ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.LoadConfigHistDataPoint, TestConst.TEST_VIEW_ID); histDataPointGroupController = (HistDataPointGroupController)(view.getController()); histDataPointGroupController.SetFormType(FormType.Load); histDataPointGroupController.InitHistDPGrp(); ((HistDataPointGroup)(view)).SetFormType(FormType.Load); ((HistDataPointGroup)view).FillConfigNameBox(histDataPointGroupController.GetHistDataPointGrpNames()); ((HistDataPointGroup)view).SetCurrentGrpName(TestConst.HIST_GROUP_NAME); DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); }
public void FixtureSetUp() { if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1) { DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); } ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.DataPointList, TestConst.TEST_VIEW_ID); dataPointListController = (DataPointListController)(view.getController()); dataPointListController.InitDataPointTableColumn(); DataPointListModel model = new DataPointListModel(); dataPointListController.FillDataPointTable(model.GetDPListByGrp(TestConst.GROUP_NAME)); //will call setDataPointRowByEty dataPointListController.SetGrpName(TestConst.GROUP_NAME); }
public void FixtureSetUp() { ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.AddHistDataPointData, TestConst.TEST_VIEW_ID); histDataPointDataController = (HistDataPointDataController)(view.getController()); histDataPointDataController.SetFormType(FormType.Add); List <string> dataPointNameList = new List <string>(); dataPointNameList.Add("dpName1"); dataPointNameList.Add("dpName2"); histDataPointDataController.Init(dataPointNameList); if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1) { DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); } }
public void TestRun03() { DbStatusMonitorThread monitorThreadTemp = new DbStatusMonitorThread(); ThreadStart threadStartFunction = new ThreadStart(monitorThreadTemp.Run); Thread workerThread = new Thread(threadStartFunction); monitorThreadTemp.UpdateStatusHandler += DBConnectionStrings.GetInstance().UpdateDBStatus; Accessor threadAccessor = ReflectionAccessor.Wrap(monitorThreadTemp); threadAccessor.SetField("m_terminate", false); workerThread.Start(); monitorThreadTemp.AddItem(TestDBInit.localConnectionString1); Thread.Sleep(300); monitorThreadTemp.TerminateThread(); }
public void FixtureSetUp() { if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1) { DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); } SimpleDatabase.GetInstance().OpenConnection(); ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.MarkerList, TestConst.TEST_VIEW_ID); markerListController = (MarkerListController)(view.getController()); markerListController.initMarkerTable(); MarkerListModel model = new MarkerListModel(); markerListController.SetMarkerTable(model.GetMarkerListByGrp(TestConst.MARK_GROUP_NAME)); markerListController.SetGrpName(TestConst.MARK_GROUP_NAME); }
/// <summary> /// Initialize TimeTableViewer. /// </summary> /// <param name="ctl">.</param> public void InitializeTimeTableViewer() { string FUNCTION_NAME = "InitializeTimeTableViewer"; LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Function Entered."); DateTime Today = System.DateTime.Today.Date; this.datePicker.MaxDate = Today; this.datePicker.Value = Today; //minimum date set to 32 days earlier from current date. this.datePicker.MinDate = System.DateTime.Today.Date.AddDays(-TrainTimeTableConst.NUM_EARLIER_DAYS); this.startTimePicker.MinDate = Today; this.startTimePicker.Value = Today; this.startTimePicker.MaxDate = Today.AddHours(23).AddMinutes(58).AddSeconds(59); this.endTimePicker.Value = Today.AddHours(23).AddMinutes(59).AddSeconds(59); this.endTimePicker.MinDate = System.DateTime.Today.Date.AddMinutes(1); this.endTimePicker.MaxDate = Today.AddHours(23).AddMinutes(59).AddSeconds(59); bool bConnected = false; try { DBConnectionStrings.GetInstance().AddConnectionString(ConfigureFileHelper.GetInstance().DBConnectionString); LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Connection String is: " + ConfigureFileHelper.GetInstance().DBConnectionString); bConnected = SimpleDatabase.GetInstance().OpenConnection(); } catch (Exception localException) { LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, localException.ToString()); } if (!bConnected) { MessageBox.Show("Error", "No connection", MessageBoxButtons.OK, MessageBoxIcon.Error); LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "No Connection to Database."); } LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Exited"); }
public void FixtureSetUp() { if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1) { DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); } ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.HistDataPointList, TestConst.TEST_VIEW_ID); histDataPointListController = (HistDataPointListController)(view.getController()); histDataPointListController.InitHistDataPointTableColumns(); HistDataPointListModel model = new HistDataPointListModel(); List <EtyHistDataPoint> list = model.GetHistDListByGrp(TestConst.HIST_GROUP_NAME); histDataPointListController.FillHistDataPointTable(list); histDataPointListController.SetGrpName(TestConst.HIST_GROUP_NAME); }
public void FixtureSetUp() { if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1) { DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); } ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.AddMarkerData, TestConst.TEST_VIEW_ID); markerDataController = (MarkerDataController)(view.getController()); //((MarkerData)view).SetFormType(FormType.Add); markerDataController.SetFormType(FormType.Add); List <string> markerNameList = new List <string>(); markerNameList.Add("makerName1"); markerNameList.Add("makerName2"); markerDataController.InitMarkerData(markerNameList); }