protected void Page_Load(object sender, EventArgs e) { RedirectToLoginIfAnonymous(); if (!IsPostBack) { HideControlsBasedOnAccess(ServiceContext, Contact); } var cases = new CaseAccess().CasesForCurrentUser.Cast <Incident>(); var status = StatusDropDown.Text; var casesByStatus = string.Equals(status, "Active", StringComparison.InvariantCulture) ? cases.Where(c => c.StateCode == (int)Enums.IncidentState.Active) : cases.Where(c => c.StateCode != (int)Enums.IncidentState.Active); var casesByCustomer = string.Equals(CustomerFilter.Text, "My", StringComparison.InvariantCulture) ? casesByStatus.Where(c => c.CustomerId.Id == Contact.ContactId) : string.Equals(CustomerFilter.Text, "My Company's", StringComparison.InvariantCulture) ? casesByStatus.Where(c => c.CustomerId.Id != Contact.ContactId) : casesByStatus; if (casesByCustomer.Count() == 0) { return; } CaseList.DataKeyNames = new[] { "incidentid" }; CaseList.DataSource = casesByCustomer.ToDataTable(XrmContext); CaseList.ColumnsGenerator = new CrmSavedQueryColumnsGenerator("Cases Web View"); CaseList.DataBind(); }
private void reset(int characterId, IList <Sugarism.CmdCase> caseList) { // characterId if (Common.Instance.IsValidCharacter(characterId)) { SelectedItem = CharacterList[characterId]; } else { if (null == CharacterList) { SelectedItem = null; } else if (CharacterList.Length > 0) { SelectedItem = CharacterList[0]; } else { SelectedItem = null; } } // caseList CaseList.Clear(); for (int i = 0; i < caseList.Count; ++i) { EditCase editCase = new EditCase(caseList[i].Key, caseList[i].Description); Insert(CaseList.Count, editCase); } }
public void Insert(int index, EditCase editCase) { if (index < 0) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdUnderMin, index, 0); Log.Error(errMsg); return; } if (index > CaseList.Count) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdOverMax, index, CaseList.Count); Log.Error(errMsg); return; } if (null == editCase) { Log.Error(Properties.Resources.ErrInsertCmdNullCmd); return; } if (CaseList.Count >= Sugarism.CmdSwitch.MAX_COUNT_CASE) { string msg = string.Format(Properties.Resources.ErrInsertCaseOverMax, Sugarism.CmdSwitch.MAX_COUNT_CASE); Log.Error(msg); return; } CaseList.Insert(index, editCase); editCase.Owner = this; }
/// <summary> /// 获取所有已发布的案件 /// </summary> /// <param name="page"></param> /// <param name="state"></param> /// <returns></returns> public List <dynamic> GetPieceByPageAndState(int page, CaseState state) { CaseList dbcase = new CaseList(); var caselist = dbcase.GetPieceByPagesAndState(page, state).OrderByDescending(t => t.basic.numberOfComment.Count()); return(_MainCaseList(caselist)); }
public CaseViewModel(List <Logic.Case> cases) { foreach (var cs in cases) { CaseList.Add(new Models.Case(cs)); } }
/// <summary> /// 케이스 초기화 /// </summary> private async void InitializeCases() { var storageFolder = Windows.ApplicationModel.Package.Current.InstalledLocation; if (await storageFolder.FileExistsAsync("case1.csv") == false) { return; } var fileText = await storageFolder.ReadTextFromFileAsync("case1.csv"); var lines = fileText.Split('\n'); CaseList?.Clear(); for (int i = 0; i < lines.Length; i++) { if (lines[i].Length == 0) { continue; } var columns = lines[i].Replace("\r", "").Split(','); var newCase = new Case { Index = Convert.ToInt16(columns[0]), ShowText = columns[1], SpeakText = columns[2] }; CaseList.Add(newCase); } }
public ACSServer(HostComm hostComm, L3.Cargo.Communications.Common.Logger log, string localCaseListPath, out CaseList caseList) { string uri = (String)ConfigurationManager.AppSettings["ConnectionUri"]; string AllowedIPList = (String)ConfigurationManager.AppSettings["AllowedIPList"]; string path = localCaseListPath; string caseListSource = (path == null ? (String)ConfigurationManager.AppSettings["CaseListSource"] : "File System" ); string Alias = (String)ConfigurationManager.AppSettings["ServerName"]; m_ProfilesFolder = ConfigurationManager.AppSettings["UserProfiles"]; bool isReference; if (ConfigurationManager.AppSettings["ACSMode"].Equals("Archive")) { isReference = false; if (path == null) path = ConfigurationManager.AppSettings["CaseListFileSystemPath"]; } else { isReference = true; if (path == null) path = ConfigurationManager.AppSettings["ReferenceFileSystemPath"]; } if (caseListSource == "File System") caseList = new FSCaseList(log, path, isReference); else caseList = new DBCaseList(log, path, isReference); caseList.configFullSync(); base.Subscribe(caseList); base.caseList = caseList; bool loginRequired = Boolean.Parse(ConfigurationManager.AppSettings["LoginRequired"]); acsCommHost = new NetworkHost(this, new Uri(uri), Alias, AllowedIPList, loginRequired); acsCommHost.SendTimeoutMin = int.Parse(ConfigurationManager.AppSettings["WcfTcpBindingSendTimeoutMin"]); acsCommHost.ReceiveTimeoutMin = int.Parse(ConfigurationManager.AppSettings["WcfTcpBindingReceiveTimeoutMin"]); EnableArchiveDecision = Boolean.Parse(ConfigurationManager.AppSettings["EnableArchiveDecision"]); caseList.List.CaseListTable.CaseListTableRowChanged += new CaseListDataSet.CaseListTableRowChangeEventHandler(CaseListTable_RowChanged); caseList.List.CaseListTable.CaseListTableRowDeleting += new CaseListDataSet.CaseListTableRowChangeEventHandler(CaseListTable_RowChanged); m_HostComm = hostComm; m_HostComm.ConnectedToHostEvent += new HostComm.ConnectedToHostHandler(hostComm_ConnectedToHostEvent); m_WSCallbacks = new Dictionary<String, ICaseRequestManagerCallback>(); m_WSLastPing = new Dictionary<String, DateTime>(); ClientConnThread = new Thread(new ThreadStart(ClientConnState)); }
private void RunAssertionOp(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every (every b=" + EVENT_B_CLASS + "))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (int i = 0; i < 3; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (int i = 0; i < 9; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every b=" + EVENT_B_CLASS + "())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); for (int i = 0; i < 4; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("Every( every (every (every b=" + EVENT_B_CLASS + "())))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (int i = 0; i < 4; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (int i = 0; i < 16; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, this.GetType()); util.RunTest(epService); }
public void TestOp() { var events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase = null; testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every (every b=" + EVENT_B_CLASS + "))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (var i = 0; i < 3; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (var i = 0; i < 9; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every b=" + EVENT_B_CLASS + "())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); for (var i = 0; i < 4; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every( every (every (every b=" + EVENT_B_CLASS + "())))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (var i = 0; i < 4; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (var i = 0; i < 16; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void Run(RegressionEnvironment env) { var events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("every b=SupportBean_B"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=SupportBean_B"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every (every b=SupportBean_B))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (var i = 0; i < 3; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (var i = 0; i < 9; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every b=SupportBean_B())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); for (var i = 0; i < 4; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every( every (every (every b=SupportBean_B())))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (var i = 0; i < 4; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (var i = 0; i < 16; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, GetType()); util.RunTest(env); }
public void Run(RegressionEnvironment env) { var events = EventCollectionFactory.GetSetTwoExternalClock(0, 1000); var results = new CaseList(); var desc = new EventExpressionCase("every a=SupportBean_A() and not a1=SupportBean_A(Id='A4')"); desc.Add("B1", "a", events.GetEvent("B1")); desc.Add("B2", "a", events.GetEvent("B2")); desc.Add("B3", "a", events.GetEvent("B3")); results.AddTest(desc); var util = new PatternTestHarness(events, results, GetType()); util.RunTest(env); }
private void RunAssertionUniformEvents(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetSetTwoExternalClock(0, 1000); var results = new CaseList(); var desc = new EventExpressionCase("every a=" + EVENT_A_CLASS + "() and not a1=" + EVENT_A_CLASS + "(id=\"A4\")"); desc.Add("B1", "a", events.GetEvent("B1")); desc.Add("B2", "a", events.GetEvent("B2")); desc.Add("B3", "a", events.GetEvent("B3")); results.AddTest(desc); var util = new PatternTestHarness(events, results, this.GetType()); util.RunTest(epService); }
public void TestUniformEvents() { var events = EventCollectionFactory.GetSetTwoExternalClock(0, 1000); var results = new CaseList(); EventExpressionCase desc = null; desc = new EventExpressionCase("every a=" + EVENT_A_CLASS + "() and not a1=" + EVENT_A_CLASS + "(id=\"A4\")"); desc.Add("B1", "a", events.GetEvent("B1")); desc.Add("B2", "a", events.GetEvent("B2")); desc.Add("B3", "a", events.GetEvent("B3")); results.AddTest(desc); var util = new PatternTestHarness(events, results, GetType(), GetType().FullName); util.RunTest(); }
public void Delete(EditCase editCase) { if (CaseList.Count <= Sugarism.CmdSwitch.MIN_COUNT_CASE) { string msg = string.Format(Properties.Resources.ErrDeleteCaseUnderMin, Sugarism.CmdSwitch.MIN_COUNT_CASE); Log.Error(msg); return; } if (null != editCase) { editCase.Owner = null; } CaseList.Remove(editCase); // List의 모든 element가 같은 object를 참조하는 경우는 없다고 가정. }
private void RunAssertionObjectId(EPServiceProvider epService) { string @event = typeof(SupportBean_S0).FullName; EventCollection events = EventCollectionFactory.GetSetFourExternalClock(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("X1=" + @event + "() -> X2=" + @event + "(p00=X1.p00)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=" + @event + "(p00='B') -> X2=" + @event + "(p00=X1.p00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=" + @event + "(p00='B') -> every X2=" + @event + "(p00=X1.p00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + @event + "(p00='B') -> every X2=" + @event + "(p00=X1.p00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + @event + "() -> X2=" + @event + "(p00=X1.p00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + @event + "() -> every X2=" + @event + "(p00=X1.p00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, this.GetType()); util.RunTest(epService); }
public void TestObjectId() { string EVENT = typeof(SupportBean_S0).FullName; EventCollection events = EventCollectionFactory.GetSetFourExternalClock(0, 1000); CaseList testCaseList = new CaseList(); EventExpressionCase testCase = null; testCase = new EventExpressionCase("X1=" + EVENT + "() -> X2=" + EVENT + "(p00=X1.P00)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=" + EVENT + "(p00='B') -> X2=" + EVENT + "(p00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=" + EVENT + "(p00='B') -> every X2=" + EVENT + "(p00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + EVENT + "(p00='B') -> every X2=" + EVENT + "(p00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + EVENT + "() -> X2=" + EVENT + "(p00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + EVENT + "() -> every X2=" + EVENT + "(p00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void Run(RegressionEnvironment env) { var events = EventCollectionFactory.GetSetFourExternalClock(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("X1=SupportBean_S0() -> X2=SupportBean_S0(P00=X1.P00)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=SupportBean_S0(P00='B') -> X2=SupportBean_S0(P00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=SupportBean_S0(P00='B') -> every X2=SupportBean_S0(P00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every X1=SupportBean_S0(P00='B') -> every X2=SupportBean_S0(P00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=SupportBean_S0() -> X2=SupportBean_S0(P00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=SupportBean_S0() -> every X2=SupportBean_S0(P00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, GetType()); util.RunTest(env); }
public CmdSwitch(Sugarism.CmdSwitch model) : base(model) { _model = model; _caseList = new ObservableCollection <CmdCase>(); foreach (Sugarism.CmdCase cmdCase in _model.CaseList) { CmdCase cmdCaseVm = new CmdCase(cmdCase); CaseList.Add(cmdCaseVm); cmdCaseVm.Parent = this; } IsExpanded = true; InputBindings.Add(new KeyBinding(CmdExpand, Key.Enter, ModifierKeys.None)); Common.Instance.CharacterListChangeEvent.Attach(onCharacterListChanged); }
public void TestOp() { var events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); var testCase = new EventExpressionCase("a=A -> (every b=B) while(b.Id != 'B2')"); testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("a=A -> (every b=B) while(b.Id != 'B3')"); testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1")); testCase.Add("B2", "a", events.GetEvent("A1"), "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=B) while(b.Id != 'B3')"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); String text = "select * from pattern [(every b=" + EVENT_B_CLASS + ") while (b.Id!=\"B3\")]"; var model = new EPStatementObjectModel(); model.SelectClause = SelectClause.CreateWildcard(); model = (EPStatementObjectModel)SerializableObjectCopier.Copy(model); Expression guardExpr = Expressions.Neq("b.Id", "B3"); PatternExpr every = Patterns.Every(Patterns.Filter(Filter.Create(EVENT_B_CLASS), "b")); PatternExpr patternGuarded = Patterns.WhileGuard(every, guardExpr); model.FromClause = FromClause.Create(PatternStream.Create(patternGuarded)); Assert.AreEqual(text, model.ToEPL()); testCase = new EventExpressionCase(model); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=B) while(b.Id != 'B1')"); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public DataSet GetDataSet(DO_CaseList objDoCaseList, CaseList flag) { DataSet ds = new DataSet(); SqlConnection conn = new SqlConnection(); SQLManager co = new SQLManager(); conn = co.GetConnection(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand("scrl_AddEditDeleteCaseList_SP", conn); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@FlagNo", SqlDbType.Int).Value = flag; da.SelectCommand.Parameters.Add("@CaseId", SqlDbType.BigInt).Value = objDoCaseList.Caseid; // da.SelectCommand.Parameters.Add("@AddedBy", SqlDbType.BigInt).Value = objDoCaseList.AddedBy; da.SelectCommand.Parameters.Add("@ContentTypeId", SqlDbType.Int).Value = objDoCaseList.ContentTypeId; da.Fill(ds); co.CloseConnection(conn); return(ds); }
public void Delete(CmdCase cmdCase) { if (CaseList.Count <= Sugarism.CmdSwitch.MIN_COUNT_CASE) { string msg = string.Format(Properties.Resources.ErrDeleteCaseUnderMin, Sugarism.CmdSwitch.MIN_COUNT_CASE); Log.Error(msg); return; } if (null != cmdCase) { cmdCase.Parent = null; } CaseList.Remove(cmdCase); // List의 모든 element가 같은 object를 참조하는 경우는 없다고 가정. delete(cmdCase.Model as Sugarism.CmdCase); OnPropertyChanged("ToText"); }
public void Run(RegressionEnvironment env) { var events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase = null; testCase = new EventExpressionCase("a=SupportBean_A -> (every b=SupportBean_B) while(b.Id != 'B2')"); testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("a=SupportBean_A -> (every b=SupportBean_B) while(b.Id != 'B3')"); testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1")); testCase.Add("B2", "a", events.GetEvent("A1"), "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=SupportBean_B) while(b.Id != 'B3')"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); var text = "select * from pattern [(every b=SupportBean_B) while (b.Id!=\"B3\")]"; var model = new EPStatementObjectModel(); model.SelectClause = SelectClause.CreateWildcard(); model = env.CopyMayFail(model); Expression guardExpr = Expressions.Neq("b.Id", "B3"); PatternExpr every = Patterns.Every(Patterns.Filter(Filter.Create("SupportBean_B"), "b")); PatternExpr patternGuarded = Patterns.WhileGuard(every, guardExpr); model.FromClause = FromClause.Create(PatternStream.Create(patternGuarded)); Assert.AreEqual(text, model.ToEPL()); testCase = new EventExpressionCase(model); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=SupportBean_B) while(b.Id != 'B1')"); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, GetType()); util.RunTest(env); }
public DataTable GetDataTable(DO_CaseList objDoCaseList, CaseList flag) { DataTable dt = new DataTable(); SqlConnection conn = new SqlConnection(); SQLManager co = new SQLManager(); conn = co.GetConnection(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand("scrl_AddEditDeleteCaseList_SP", conn); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@FlagNo", SqlDbType.Int).Value = flag; da.SelectCommand.Parameters.Add("@CaseId", SqlDbType.BigInt).Value = objDoCaseList.Caseid; da.SelectCommand.Parameters.Add("@StrContentTitle", SqlDbType.VarChar, 200).Value = objDoCaseList.ContentTitle; da.SelectCommand.Parameters.Add("@intAddedby", SqlDbType.BigInt).Value = objDoCaseList.AddedBy; da.SelectCommand.Parameters.Add("@ContentTypeId", SqlDbType.Int).Value = objDoCaseList.ContentTypeId; da.SelectCommand.Parameters.Add("@intTagType", SqlDbType.VarChar, 20).Value = objDoCaseList.intTagType; da.SelectCommand.Parameters.Add("@PageSize", SqlDbType.Int).Value = objDoCaseList.PageSize; da.SelectCommand.Parameters.Add("@Currentpage", SqlDbType.Int).Value = objDoCaseList.Currentpage; da.Fill(dt); co.CloseConnection(conn); return(dt); }
protected void Page_Load(object sender, EventArgs e) { var dataAdapter = new UserCasesDataAdapter(new PortalContextDataAdapterDependencies(Portal, PortalName, Request.RequestContext)); if (!IsPostBack) { CaseDeflection.Visible = CaseDeflectionEnabled; CreateCase.Visible = DirectCaseCreationEnabled; var permissionScopes = dataAdapter.SelectPermissionScopes(); HideControlsBasedOnAccess(permissionScopes); PopulateCustomerFilter(permissionScopes); } var cases = GetCases(dataAdapter); var columnsGenerator = new SavedQueryColumnsGenerator(XrmContext, "incident", "Cases Web View"); CaseList.DataKeyNames = new[] { "incidentid" }; CaseList.DataSource = columnsGenerator.ToDataTable(cases.Select(c => c.Entity), "o", CultureInfo.InvariantCulture); CaseList.ColumnsGenerator = columnsGenerator; CaseList.DataBind(); }
public void Insert(int index, CmdCase cmdCase) { if (index < 0) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdUnderMin, index, 0); Log.Error(errMsg); return; } if (index > CaseList.Count) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdOverMax, index, CaseList.Count); Log.Error(errMsg); return; } if (null == cmdCase) { Log.Error(Properties.Resources.ErrInsertCmdNullCmd); return; } if (CaseList.Count >= Sugarism.CmdSwitch.MAX_COUNT_CASE) { string msg = string.Format(Properties.Resources.ErrInsertCaseOverMax, Sugarism.CmdSwitch.MAX_COUNT_CASE); Log.Error(msg); return; } CaseList.Insert(index, cmdCase); cmdCase.Parent = this; insert(index, cmdCase.Model as Sugarism.CmdCase); OnPropertyChanged("ToText"); }
/// <summary> /// Retrieving a specific list of cases /// </summary> /// <param name="caseURNs">list of case urns</param> /// <returns>list of cases</returns> public CaseList GetCases(List<string> caseURNs) { Log.Debug("Retrieving cases..."); string URI = String.Format("pathology/cases"); CaseList result; IRestResponse response; try { RestStringArrayType urns = new RestStringArrayType(caseURNs); string body = ResponseParser.SerializeToXml<RestStringArrayType>(urns); response = ExecutePost(URI, VixServiceTypes.Pathology, body); ValidateRestResponse(response); result = ResponseParser.ParseGetCaseListResponse(response.Content); } catch (MagResponseParsingFailureException rpf) { Log.Error("Could not serialize urn lists.", rpf); result = new CaseList(); } catch (MagVixFailureException vfe) { Log.Error("Unexpected response.", vfe); result = new CaseList(); } catch (Exception ex) { Log.Error("Could not complete request to retrieve cases.", ex); result = new CaseList(); } return result; }
private void RunAssertionOp(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " and not d=" + EVENT_D_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); string text = "select * from pattern [every b=" + EVENT_B_CLASS + " and not g=" + EVENT_G_CLASS + "]"; var model = new EPStatementObjectModel(); model.SelectClause = SelectClause.CreateWildcard(); PatternExpr pattern = Patterns.And() .Add(Patterns.EveryFilter(EVENT_B_CLASS, "b")) .Add(Patterns.NotFilter(EVENT_G_CLASS, "g")); model.FromClause = FromClause.Create(PatternStream.Create(pattern)); model = (EPStatementObjectModel)SerializableObjectCopier.Copy(epService.Container, model); Assert.AreEqual(text, model.ToEPL()); testCase = new EventExpressionCase(model); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " and not g=" + EVENT_G_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " and not d=" + EVENT_D_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " and not a=" + EVENT_A_CLASS + "(id='A1')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " and not a2=" + EVENT_A_CLASS + "(id='A2')"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " and not b3=" + EVENT_B_CLASS + "(id='B3'))"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " or not " + EVENT_D_CLASS + "())"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every b=" + EVENT_B_CLASS + " and not " + EVENT_B_CLASS + "(id='B2'))"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B3", "b", events.GetEvent("B3")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " and not " + EVENT_B_CLASS + "(id='B2'))"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + ") and " + " not " + EVENT_A_CLASS); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + ") and " + " not " + EVENT_G_CLASS); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + ") and " + " not " + EVENT_G_CLASS); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + ") and " + " not " + EVENT_G_CLASS + "(id='x')"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, this.GetType()); util.RunTest(epService); }
void GetCases() { string unreadTime = null; string readTime = null; // clear current cases if (caseList != null) { caseList.Clear(); } // clear title if (Type == ExamListViewType.Patient) { Title = DefaultPatientTitle; } // get cases if (Type == ExamListViewType.Unread) { caseList = _dataSource.GetUnreleasedCases(); unreadTime = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss"); } else if (Type == ExamListViewType.Patient) { if (LastSelectedPatient != null) { // get patient information Patient patient = _dataSource.GetPatient(UserContext.LocalSite.SiteStationNumber, LastSelectedPatient.PatientICN); if (patient != null) { // update patient object patient.PatientShortID = LastSelectedPatient.PatientShortID; // get all cases belonging to the patient caseList = _dataSource.GetPatientCases(LastSelectedPatient.PatientICN); // update patient sensitive flag if ((caseList != null) && (caseList.Cases.Count > 0)) patient.PatientSensitive = caseList.Cases[0].PatientSensitive; else patient.PatientSensitive = false; // set title if (Type == ExamListViewType.Patient) { if (patient.PatientSensitive) Title = patient.PatientName; else Title = string.Format("{0} ({1}) {2} {3}", patient.PatientName, patient.PatientShortID, patient.Age, patient.Sex); } } else { Title = DefaultPatientTitle; caseList.Clear(); } } } else if (Type == ExamListViewType.Read) { caseList = _dataSource.GetReleasedCases(); readTime = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss"); } AppMessages.UpdateStatusesMessage.Send(new AppMessages.UpdateStatusesMessage.MessageData() { UnreadTime = unreadTime, ReadTime = readTime}); }
public void Run(RegressionEnvironment env) { var events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("b=SupportBean_B(Id='B1') where timer:withinmax(2 sec,100)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=SupportBean_B(Id='B1') where timer:withinmax(2001 msec,1)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=SupportBean_B(Id='B1') where timer:withinmax(1999 msec,10)"); testCaseList.AddTest(testCase); var text = "select * from pattern [b=SupportBean_B(Id='B3') where timer:withinmax(10.001d,1)]"; var model = new EPStatementObjectModel(); model.SelectClause = SelectClause.CreateWildcard(); model = env.CopyMayFail(model); Expression filter = Expressions.Eq("Id", "B3"); PatternExpr pattern = Patterns.TimerWithinMax( 10.001, 1, Patterns.Filter(Filter.Create("SupportBean_B", filter), "b")); model.FromClause = FromClause.Create(PatternStream.Create(pattern)); Assert.AreEqual(text, model.ToEPL().Replace("\"", "'")); testCase = new EventExpressionCase(model); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=SupportBean_B) where timer:withinmax(4.001, 0)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=SupportBean_B) where timer:withinmax(4.001, 1)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=SupportBean_B) where timer:withinmax(4.001, 2)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=SupportBean_B where timer:withinmax(2.001, 4)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); // Note how every restarts the max testCase = new EventExpressionCase("every (b=SupportBean_B where timer:withinmax(2001 msec, 2))"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=SupportBean_B where timer:withinmax(2001 msec, 3))"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=SupportBean_B where timer:withinmax(2001 msec, 1))"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=SupportBean_B where timer:withinmax(2001 msec, 0))"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every b=SupportBean_B -> d=SupportBean_D where timer:withinmax(4000 msec, 1)"); testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every b=SupportBean_B() -> every d=SupportBean_D where timer:withinmax(4000 msec, 1)"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1")); testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2")); testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2")); testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3")); testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every b=SupportBean_B() -> (every d=SupportBean_D) where timer:withinmax(1 day, 3)"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1")); testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2")); testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2")); testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3")); testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every b=SupportBean_B() -> (every d=SupportBean_D) where timer:withinmax(1 day, 2)"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1")); testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2")); testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every b=SupportBean_B() -> (every d=SupportBean_D) where timer:withinmax(1 day, 1)"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, GetType()); util.RunTest(env); }
public void TestOp() { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); CaseList testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase( "a=" + EVENT_A_CLASS + " or a=" + EVENT_A_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "a=" + EVENT_A_CLASS + " or b=" + EVENT_B_CLASS + " or c=" + EVENT_C_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every b=" + EVENT_B_CLASS + " or every d=" + EVENT_D_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("D1", "d", events.GetEvent("D1")); testCase.Add("D2", "d", events.GetEvent("D2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCase.Add("D3", "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "a=" + EVENT_A_CLASS + " or b=" + EVENT_B_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "a=" + EVENT_A_CLASS + " or every b=" + EVENT_B_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every a=" + EVENT_A_CLASS + " or d=" + EVENT_D_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCase.Add("A2", "a", events.GetEvent("A2")); testCase.Add("D1", "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every (every b=" + EVENT_B_CLASS + "() or d=" + EVENT_D_CLASS + "())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); for (int i = 0; i < 4; i++) { testCase.Add("D1", "d", events.GetEvent("D1")); } for (int i = 0; i < 4; i++) { testCase.Add("D2", "d", events.GetEvent("D2")); } for (int i = 0; i < 4; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } for (int i = 0; i < 8; i++) { testCase.Add("D3", "d", events.GetEvent("D3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every (b=" + EVENT_B_CLASS + "() or every d=" + EVENT_D_CLASS + "())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("D1", "d", events.GetEvent("D1")); testCase.Add("D2", "d", events.GetEvent("D2")); testCase.Add("D2", "d", events.GetEvent("D2")); for (int i = 0; i < 4; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } for (int i = 0; i < 4; i++) { testCase.Add("D3", "d", events.GetEvent("D3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every (every d=" + EVENT_D_CLASS + "() or every b=" + EVENT_B_CLASS + "())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); for (int i = 0; i < 4; i++) { testCase.Add("D1", "d", events.GetEvent("D1")); } for (int i = 0; i < 8; i++) { testCase.Add("D2", "d", events.GetEvent("D2")); } for (int i = 0; i < 16; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } for (int i = 0; i < 32; i++) { testCase.Add("D3", "d", events.GetEvent("D3")); } testCaseList.AddTest(testCase); PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void TestOp() { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); CaseList testCaseList = new CaseList(); EventExpressionCase testCase = null; testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B1\") where timer:within(2 sec)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B1\") where timer:within(2001 msec)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B1\") where timer:within(1999 msec)"); testCaseList.AddTest(testCase); String text = "select * from pattern [b=" + EVENT_B_CLASS + "(Id=\"B3\") where timer:within(10.001)]"; EPStatementObjectModel model = new EPStatementObjectModel(); model.SelectClause = SelectClause.CreateWildcard(); model = (EPStatementObjectModel)SerializableObjectCopier.Copy(model); Expression filter = Expressions.Eq("Id", "B3"); PatternExpr pattern = Patterns.TimerWithin(10.001, Patterns.Filter(Filter.Create(EVENT_B_CLASS, filter), "b")); model.FromClause = FromClause.Create(PatternStream.Create(pattern)); Assert.AreEqual(text, model.ToEPL()); testCase = new EventExpressionCase(model); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B3\") where timer:within(10001 msec)"); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B3\") where timer:within(10 sec)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B3\") where timer:within(9.999)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:within(2.001)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:within(4.001)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " where timer:within(2.001)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " where timer:within(2001 msec))"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every ((every b=" + EVENT_B_CLASS + ") where timer:within(2.001))"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCase.Add("B3", "b", events.GetEvent("B3")); testCase.Add("B3", "b", events.GetEvent("B3")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every ((every b=" + EVENT_B_CLASS + ") where timer:within(6.001))"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCase.Add("B3", "b", events.GetEvent("B3")); testCase.Add("B3", "b", events.GetEvent("B3")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:within(11.001)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:within(4001 milliseconds)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + ") where timer:within(6.001)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + " where timer:within(4001 milliseconds)"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() -> d=" + EVENT_D_CLASS + "() where timer:within(4 sec)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + "() where timer:within (4.001) and d=" + EVENT_D_CLASS + "() where timer:within(6.001))"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2001 msec) and d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2001 msec) and d=" + EVENT_D_CLASS + "() where timer:within(6000 msec)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2000 msec) and d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + " where timer:within(4000 msec)"); testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + "() -> every d=" + EVENT_D_CLASS + " where timer:within(4000 msec)"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1")); testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2")); testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2")); testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3")); testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() -> d=" + EVENT_D_CLASS + "() where timer:within(3999 msec)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + "() -> (every d=" + EVENT_D_CLASS + ") where timer:within(2001 msec)"); testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + "() -> d=" + EVENT_D_CLASS + "()) where timer:within(6001 msec)"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2000 msec) or d=" + EVENT_D_CLASS + "() where timer:within(6000 msec)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + "() where timer:within (2000 msec) or d=" + EVENT_D_CLASS + "() where timer:within(6000 msec)) where timer:within (1999 msec)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + "() where timer:within (2001 msec) and d=" + EVENT_D_CLASS + "() where timer:within(6001 msec))"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2001 msec) or d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2000 msec) or d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)"); testCase.Add("D1", "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + "() where timer:within (2001 msec) and every d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1")); testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2")); testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2")); testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1")); testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2")); testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3")); testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:within (2000 msec) and every d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)"); testCaseList.AddTest(testCase); PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void TestOp() { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); CaseList testCaseList = new CaseList(); EventExpressionCase testCase; // The wait is done when 2 seconds passed testCase = new EventExpressionCase("timer:interval(1999 msec)"); testCase.Add("B1"); testCaseList.AddTest(testCase); String text = "select * from pattern [timer:interval(1.999)]"; EPStatementObjectModel model = new EPStatementObjectModel(); model.SelectClause = SelectClause.CreateWildcard(); PatternExpr pattern = Patterns.TimerInterval(1.999d); model.FromClause = FromClause.Create(PatternStream.Create(pattern)); model = (EPStatementObjectModel)SerializableObjectCopier.Copy(model); Assert.AreEqual(text, model.ToEPL()); testCase = new EventExpressionCase(model); testCase.Add("B1"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(2 sec)"); testCase.Add("B1"); testCaseList.AddTest(testCase); // 3 seconds (>2001 microseconds) passed testCase = new EventExpressionCase("timer:interval(2.001)"); testCase.Add("C1"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(2999 milliseconds)"); testCase.Add("C1"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(3 seconds)"); testCase.Add("C1"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(3.001 seconds)"); testCase.Add("B2"); testCaseList.AddTest(testCase); // Try with an all ... repeated timer every 3 seconds testCase = new EventExpressionCase("every timer:interval(3.001 sec)"); testCase.Add("B2"); testCase.Add("F1"); testCase.Add("D3"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every timer:interval(5000 msec)"); testCase.Add("A2"); testCase.Add("B3"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(3.999 second) -> b=" + EVENT_B_CLASS); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(4 sec) -> b=" + EVENT_B_CLASS); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(4.001 sec) -> b=" + EVENT_B_CLASS); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(0) -> b=" + EVENT_B_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); // Try with an followed-by as a second argument testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> timer:interval(0.001)"); testCase.Add("C1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> timer:interval(0)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> timer:interval(1 sec)"); testCase.Add("C1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> timer:interval(1.001)"); testCase.Add("B2", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); // Try in a 3-way followed by testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() -> timer:interval(6.000) -> d=" + EVENT_D_CLASS); testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + "() -> timer:interval(2.001) -> d=" + EVENT_D_CLASS + "())"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + "() -> timer:interval(2.000) -> d=" + EVENT_D_CLASS + "())"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); // Try with an "or" testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() or timer:interval(1.001)"); testCase.Add("B1"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() or timer:interval(2.001)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id='B3') or timer:interval(8.500)"); testCase.Add("D2"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(8.500) or timer:interval(7.500)"); testCase.Add("F1"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(999999 msec) or g=" + EVENT_G_CLASS); testCase.Add("G1", "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); // Try with an "and" testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() and timer:interval(4000 msec)"); testCase.Add("B2", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() and timer:interval(4001 msec)"); testCase.Add("A2", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(9999999 msec) and b=" + EVENT_B_CLASS); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(1 msec) and b=" + EVENT_B_CLASS + "(Id=\"B2\")"); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); // Try with an "within" testCase = new EventExpressionCase("timer:interval(3.000) where timer:within(2.000)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(3.000) where timer:within (3.000)"); testCaseList.AddTest(testCase); // Run all tests PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void TestOp() { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); CaseList testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("a=A(id='A2') until D"); testCase.Add("D1", "a[0]", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("a=A until D"); testCase.Add("D1", "a[0]", events.GetEvent("A1"), "a[1]", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=B until a=A"); testCase.Add("A1", "b[0]", null, "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=B until D(id='D3')"); testCase.Add("D3", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(a=A or b=B) until d=D(id='D3')"); testCase.Add("D3", new Object[][] { new Object[] { "a[0]", events.GetEvent("A1") }, new Object[] { "a[1]", events.GetEvent("A2") }, new Object[] { "b[0]", events.GetEvent("B1") }, new Object[] { "b[1]", events.GetEvent("B2") }, new Object[] { "b[2]", events.GetEvent("B3") }, new Object[] { "d", events.GetEvent("D3") } }); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(a=A or b=B) until (g=G or d=D)"); testCase.Add("D1", new Object[][] { new Object[] { "a[0]", events.GetEvent("A1") }, new Object[] { "a[1]", events.GetEvent("A2") }, new Object[] { "b[0]", events.GetEvent("B1") }, new Object[] { "b[1]", events.GetEvent("B2") }, new Object[] { "d", events.GetEvent("D1") } }); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(d=D) until a=A(id='A1')"); testCase.Add("A1"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("a=A until G(id='GX')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2] a=A"); testCase.Add("A2", "a[0]", events.GetEvent("A1"), "a[1]", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2:2] a=A"); testCase.Add("A2", "a[0]", events.GetEvent("A1"), "a[1]", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1] a=A"); testCase.Add("A1", "a[0]", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:1] a=A"); testCase.Add("A1", "a[0]", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[3] a=A"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[3] b=B"); testCase.Add("B3", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[4] (a=A or b=B)"); testCase.Add("A2", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "a[0]", events.GetEvent("A1"), "a[1]", events.GetEvent("A2")); testCaseList.AddTest(testCase); // the until ends the matching returning permanently false testCase = new EventExpressionCase("[2] b=B until a=A(id='A1')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2] b=B until c=C"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2:2] b=B until g=G(id='G1')"); testCase.Add("B2", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[:4] b=B until g=G(id='G1')"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3"), "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[:3] b=B until g=G(id='G1')"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3"), "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[:2] b=B until g=G(id='G1')"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[:1] b=B until g=G(id='G1')"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[:1] b=B until a=A(id='A1')"); testCase.Add("A1", "b[0]", null, "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:] b=B until g=G(id='G1')"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3"), "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:] b=B until a=A"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2:] b=B until a=A(id='A2')"); testCase.Add("A2", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "a", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2:] b=B until c=C"); testCaseList.AddTest(testCase); // same event triggering both clauses, until always wins, match does not count testCase = new EventExpressionCase("[2:] b=B until e=B(id='B2')"); testCaseList.AddTest(testCase); // same event triggering both clauses, until always wins, match does not count testCase = new EventExpressionCase("[1:] b=B until e=B(id='B1')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:2] b=B until a=A(id='A2')"); testCase.Add("A2", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", null, "a", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:3] b=B until G"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3"), "b[3]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:2] b=B until G"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:10] b=B until F"); testCase.Add("F1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:10] b=B until C"); testCase.Add("C1", "b[0]", events.GetEvent("B1"), "b[1]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[0:1] b=B until C"); testCase.Add("C1", "b[0]", events.GetEvent("B1"), "b[1]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("c=C -> [2] b=B -> d=D"); testCase.Add("D3", "c", events.GetEvent("C1"), "b[0]", events.GetEvent("B2"), "b[1]", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[3] d=D or [3] b=B"); testCase.Add("B3", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[3] d=D or [4] b=B"); testCase.Add("D3", "d[0]", events.GetEvent("D1"), "d[1]", events.GetEvent("D2"), "d[2]", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2] d=D and [2] b=B"); testCase.Add("D2", "d[0]", events.GetEvent("D1"), "d[1]", events.GetEvent("D2"), "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("d=D until timer:interval(7 sec)"); testCase.Add("E1", "d[0]", events.GetEvent("D1"), "d[1]", null, "d[2]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (d=D until b=B)"); testCase.Add("B1", "d[0]", null, "b", events.GetEvent("B1")); testCase.Add("B2", "d[0]", null, "b", events.GetEvent("B2")); testCase.Add("B3", "d[0]", events.GetEvent("D1"), "d[1]", events.GetEvent("D2"), "d[2]", null, "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); // note precendence: every is higher then until testCase = new EventExpressionCase("every d=D until b=B"); testCase.Add("B1", "d[0]", null, "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every d=D) until b=B"); testCase.Add("B1", "d[0]", null, "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("a=A until (every (timer:interval(6 sec) and not A))"); testCase.Add("G1", "a[0]", events.GetEvent("A1"), "a[1]", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("A until (every (timer:interval(7 sec) and not A))"); testCase.Add("D3"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2] (a=A or b=B)"); testCase.Add("B1", "a[0]", events.GetEvent("A1"), "b[0]", events.GetEvent("B1"), "b[1]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every [2] a=A"); testCase.Add("A2", new Object[][] { new Object[] { "a[0]", events.GetEvent("A1") }, new Object[] { "a[1]", events.GetEvent("A2") }, }); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every [2] a=A until d=D"); // every has Precedence; ESPER-339 testCase.Add("D1", new Object[][] { new Object[] { "a[0]", events.GetEvent("A1") }, new Object[] { "a[1]", events.GetEvent("A2") }, new Object[] { "d", events.GetEvent("D1") }, }); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[3] (a=A or b=B)"); testCase.Add("B2", "a[0]", events.GetEvent("A1"), "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(a=A until b=B) until c=C"); testCase.Add("C1", "a[0]", events.GetEvent("A1"), "b[0]", events.GetEvent("B1"), "c", events.GetEvent("C1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(a=A until b=B) until g=G"); testCase.Add("G1", new Object[][] { new Object[] { "a[0]", events.GetEvent("A1") }, new Object[] { "b[0]", events.GetEvent("B1") }, new Object[] { "a[1]", events.GetEvent("A2") }, new Object[] { "b[1]", events.GetEvent("B2") }, new Object[] { "b[2]", events.GetEvent("B3") }, new Object[] { "g", events.GetEvent("G1") } }); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("B until not B"); testCaseList.AddTest(testCase); PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
/// <summary> /// Update a specific list of cases /// </summary> /// <param name="caseList">list of cases to be updated</param> public void UpdateCases(CaseList caseList) { if (this.vixClient != null) { // group cases by site id List<List<Case>> casesBySiteID = caseList.Cases.GroupBy(item => item.SiteID).Select(group => new List<Case>(group)).ToList(); foreach (List<Case> cases in casesBySiteID) { // build list of case URNS List<string> caseURNs = cases.Select(item => item.CaseURN).ToList(); CaseList updatedCaseList = this.vixClient.GetCases(caseURNs); if (updatedCaseList != null) { foreach (Case updatedCase in updatedCaseList.Cases) { // search for original case Case origCase = cases.Where(x => (x.CaseURN == updatedCase.CaseURN)).FirstOrDefault(); if (origCase != null) { origCase.CopyFrom(updatedCase); } } } } } else { Log.Error("VIX client is null."); } }
private void Refresh(ObservableCollection<CaseListItem> items, bool keepDisplayed) { // get cases using selected items CaseList caseList = new CaseList(); foreach (CaseListItem item in items) { Case caseObj = this.caseList.Cases.Where(x => (x.CaseURN == item.CaseURN)).FirstOrDefault(); if (caseObj != null) { caseList.Cases.Add(caseObj); } } // update cases (read in each from relevant data source) _dataSource.UpdateCases(caseList); // update nodes foreach (Case caseObj in caseList.Cases) { CaseListItem item = items.Where(x => (x.CaseURN == caseObj.CaseURN)).FirstOrDefault(); if (item != null) { if (CanDisplayCase(caseObj) || keepDisplayed) { item.Initialize(caseObj); } else { // no longer belongs to the worklist. // remove from case list Case caseObjRemove = this.Cases.Where(x => (x.CaseURN == caseObj.CaseURN)).FirstOrDefault(); if (caseObjRemove != null) { this.Cases.Remove(caseObjRemove); } // remove from selected list items.Remove(item); // remove from item list item = Root.Slides.Where(x => (x.CaseURN == caseObj.CaseURN)).FirstOrDefault(); if (item != null) { Root.Slides.Remove(item); RaisePropertyChanged("Nodes"); } } } } }
//private CaseList CombineLists(BlockingCollection<CaseList> results) //{ // CaseList consolidatedList = new CaseList(); // foreach (CaseList list in results) // { // if (list != null) // consolidatedList.Cases.AddRange(list.Cases); // } // if (consolidatedList.Cases.Count > 0) // { // List<Case> orderedCases = consolidatedList.Cases.OrderBy(d => d.SpecimenTakenDate).ThenBy(a => a.AccessionNumber).ThenBy(p => p.PatientName).ToList(); // consolidatedList.Cases = orderedCases; // } // return consolidatedList; //} /// <summary> /// Retrieve a list of released cases from vista /// </summary> /// <param name="siteID">site storing the cases</param> /// <returns>a list of read cases from the site</returns> public CaseList GetReleasedCases() { CaseList caseList = new CaseList(); if (vixClient != null) { // get the retention day range int dayRange = client.GetRetentionDays(); // gather cases from each acquisition site List<string> grabbedSites = new List<string>(); var watch = Stopwatch.StartNew(); foreach (AcquisitionSiteInfo site in UserContext.AcquisitionList.Items) { if ((site.Active) && (!grabbedSites.Contains(site.PrimeSiteStationNumber))) { CaseList siteCaseList = vixClient.GetReleasedCases(site.PrimeSiteStationNumber, dayRange); grabbedSites.Add(site.PrimeSiteStationNumber); if (siteCaseList != null) { caseList.Cases.AddRange(siteCaseList.Cases); } } } //Parallel.ForEach(UserContext.AcquisitionList.Items, site => //{ // if ((site.Active) && (!grabbedSites.Contains(site.PrimeSiteStationNumber))) // { // CaseList siteCaseList = vixClient.GetReleasedCases(site.PrimeSiteStationNumber); // grabbedSites.Add(site.PrimeSiteStationNumber); // if (siteCaseList != null) // { // caseList.Cases.AddRange(siteCaseList.Cases); // } // } //} // ); Log.Debug("Read time elapsed: " + watch.ElapsedMilliseconds.ToString()); // sort cases by accession number if (caseList.Cases.Count > 0) { List<Case> orderedCases = caseList.Cases.OrderBy(d => d.SpecimenTakenDate).ThenBy(a => a.AccessionNumber).ThenBy(p => p.PatientName).ToList(); caseList.Cases = orderedCases; } } return caseList; }
/// <summary> /// Retrieve a list of unread cases from vista /// </summary> /// <param name="siteID">site id to retrieve the list from</param> /// <returns>a case list of the site</returns> public CaseList GetUnreleasedCases() { // consolidate unread list CaseList unreadList = new CaseList(); if (vixClient != null) { // get the retention day range int dayRange = client.GetRetentionDays(); // gather cases from each acquisition site List<string> grabbedSites = new List<string>(); var watch = Stopwatch.StartNew(); foreach (AcquisitionSiteInfo site in UserContext.AcquisitionList.Items) { // only retrieve active site that hasn't been retrieved yet // since can have duplicate primary acquisition site if ((site.Active) && (!grabbedSites.Contains(site.PrimeSiteStationNumber))) { CaseList siteCaseList = vixClient.GetUnreleasedCases(site.PrimeSiteStationNumber, dayRange); grabbedSites.Add(site.PrimeSiteStationNumber); if (siteCaseList != null) { unreadList.Cases.AddRange(siteCaseList.Cases); } } } //Parallel.ForEach(UserContext.AcquisitionList.Items, site => //{ // Log.Debug("Start thread: " + site.PrimeSiteStationNumber + " " + DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss")); // if ((site.Active) && (!grabbedSites.Contains(site.PrimeSiteStationNumber))) // { // CaseList siteCaseList = vixClient.GetUnreleasedCases(site.PrimeSiteStationNumber); // grabbedSites.Add(site.PrimeSiteStationNumber); // if (siteCaseList != null) // { // unreadList.Cases.AddRange(siteCaseList.Cases); // } // } // Log.Debug("End thread: " + site.PrimeSiteStationNumber + " " + DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss")); //} // ); Log.Debug("Unread time elapsed: " + watch.ElapsedMilliseconds.ToString()); // sort cases by accession date/time if (unreadList.Cases.Count > 0) { List<Case> orderedCases = unreadList.Cases.OrderBy(d => d.SpecimenTakenDate).ThenBy(a => a.AccessionNumber).ThenBy(p => p.PatientName).ToList(); unreadList.Cases = orderedCases; } } else { Log.Error("VIX client is null."); } return unreadList; }
public void UpdateCases(CaseList cases) { vistaClient.UpdateCases(cases); }
/// <summary> /// Retrieve a list of released cases from vista /// </summary> /// <param name="siteID">site storing the cases</param> /// <returns>a list of read cases from the site</returns> public CaseList GetReleasedCases(string siteID, int dayrange) { Log.Debug("Retrieving released cases for site " + siteID + "..."); string URI; if (siteID == UserContext.LocalSite.PrimarySiteStationNUmber) { URI = String.Format("pathology/cases/released/{0}/{1}", siteID, dayrange); } else { URI = String.Format("pathology/cases/released/{0}/{1}/{2}", siteID, dayrange, UserContext.LocalSite.SiteStationNumber); } CaseList result; IRestResponse response; try { response = ExecuteGet(URI, VixServiceTypes.Pathology); ValidateRestResponse(response); result = ResponseParser.ParseGetCaseListResponse(response.Content); } catch (MagVixFailureException vfe) { Log.Error("Unexpected response.", vfe); result = new CaseList(); } catch (Exception ex) { Log.Error("Could not complete request to retrieve released cases.", ex); result = new CaseList(); } return result; }
public static void CreateNodes(CaseList caseList, CaseListItem root, WorkListFilter filter) { CaseListItem caseNode = null; root.Slides.Clear(); foreach (Case caseItem in caseList.Cases) { caseNode = null; if (filter == null) { caseNode = new CaseListItem(caseItem); } else { if (filter.MatchCase(caseItem) != WorkListFilterParameter.FilterMatchType.NotMatch) { caseNode = new CaseListItem(caseItem); } } if (caseNode != null) { // todo: add children using cached data // create place holder if no children if (caseNode.Slides.Count == 0) { caseNode.Slides.Add(new CaseListItem { Kind = CaseListItemKind.PlaceHolder }); } root.Slides.Add(caseNode); } } }