Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
 public void HandleStartIndex(CreateIndexDesc spec)
 {
     try
     {
         var fields = spec.Columns
                      .Select(col => new VirtualDataWindowEventStartIndex.VDWCreateIndexField(col.Expressions, col.IndexType, col.Parameters))
                      .ToList();
         var create = new VirtualDataWindowEventStartIndex(
             spec.WindowName, spec.IndexName, fields, spec.IsUnique);
         _dataExternal.HandleEvent(create);
     }
     catch (Exception ex)
     {
         var message =
             "Exception encountered invoking virtual data window handle start-index event for window '" +
             _namedWindowName + "': " + ex.Message;
         Log.Warn(message, ex);
         throw new EPException(message, ex);
     }
 }