예제 #1
0
 public void HandleStopIndex(CreateIndexDesc spec)
 {
     try
     {
         var theEvent = new VirtualDataWindowEventStopIndex(
             spec.WindowName, spec.IndexName);
         _dataExternal.HandleEvent(theEvent);
     }
     catch (Exception ex)
     {
         var message =
             "Exception encountered invoking virtual data window handle stop-index event for window '" +
             _namedWindowName + "': " + ex.Message;
         Log.Warn(message, ex);
     }
 }
예제 #2
0
        private void RunAssertionManagementEvents(EPServiceProvider epService)
        {
            SupportVirtualDW vdw = RegisterTypeSetMapData(epService);

            // create-index event
            vdw.Events.Clear();
            EPStatement stmtIndex = epService.EPAdministrator.CreateEPL("create index IndexOne on MyVDW (col3, col2 btree)");
            VirtualDataWindowEventStartIndex startEvent = (VirtualDataWindowEventStartIndex)vdw.Events[0];

            Assert.AreEqual("MyVDW", startEvent.NamedWindowName);
            Assert.AreEqual("IndexOne", startEvent.IndexName);
            Assert.AreEqual(2, startEvent.Fields.Count);
            Assert.AreEqual("col3", ExprNodeUtility.ToExpressionStringMinPrecedenceSafe(startEvent.Fields[0].Expressions[0]));
            Assert.AreEqual("hash", startEvent.Fields[0].Type);
            Assert.AreEqual("col2", ExprNodeUtility.ToExpressionStringMinPrecedenceSafe(startEvent.Fields[1].Expressions[0]));
            Assert.AreEqual("btree", startEvent.Fields[1].Type);
            Assert.IsFalse(startEvent.IsUnique);

            // stop-index event
            vdw.Events.Clear();
            stmtIndex.Stop();
            VirtualDataWindowEventStopIndex stopEvent = (VirtualDataWindowEventStopIndex)vdw.Events[0];

            Assert.AreEqual("MyVDW", stopEvent.NamedWindowName);
            Assert.AreEqual("IndexOne", stopEvent.IndexName);

            // stop named window
            vdw.Events.Clear();
            epService.EPAdministrator.GetStatement("create-nw").Stop();
            VirtualDataWindowEventStopWindow stopWindow = (VirtualDataWindowEventStopWindow)vdw.Events[0];

            Assert.AreEqual("MyVDW", stopWindow.NamedWindowName);

            // start named window (not an event but a new factory call)
            SupportVirtualDWFactory.Windows.Clear();
            SupportVirtualDWFactory.Initializations.Clear();
            epService.EPAdministrator.GetStatement("create-nw").Start();
            Assert.AreEqual(1, SupportVirtualDWFactory.Windows.Count);
            Assert.AreEqual(1, SupportVirtualDWFactory.Initializations.Count);

            DestroyStmtsRemoveTypes(epService);
        }