Exemple #1
0
 public EPDeploymentAdminImpl(
     EPAdministratorSPI epService,
     ILockManager lockManager,
     IReaderWriterLock eventProcessingRWLock,
     IResourceManager resourceManager,
     DeploymentStateService deploymentStateService,
     StatementEventTypeRef statementEventTypeRef,
     EventAdapterService eventAdapterService,
     StatementIsolationService statementIsolationService,
     FilterService filterService,
     TimeZoneInfo timeZone,
     ConfigurationEngineDefaults.UndeployRethrowPolicy undeployRethrowPolicy)
 {
     _iLock                     = lockManager.CreateDefaultLock();
     _epService                 = epService;
     _resourceManager           = resourceManager;
     _eventProcessingRwLock     = eventProcessingRWLock;
     _deploymentStateService    = deploymentStateService;
     _statementEventTypeRef     = statementEventTypeRef;
     _eventAdapterService       = eventAdapterService;
     _statementIsolationService = statementIsolationService;
     _filterService             = filterService;
     _timeZone                  = timeZone;
     _undeployRethrowPolicy     = undeployRethrowPolicy;
 }
 public EPServiceEngine(
     IContainer container,
     EPServicesContext services,
     EPRuntimeSPI runtimeSPI,
     EPAdministratorSPI admin)
 {
     Container = container;
     Services  = services;
     Runtime   = runtimeSPI;
     Admin     = admin;
 }
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="epService">administrative SPI</param>
 /// <param name="deploymentStateService">deployment state maintenance service</param>
 /// <param name="statementEventTypeRef">maintains statement-eventtype relationship</param>
 /// <param name="eventAdapterService">event wrap service</param>
 /// <param name="statementIsolationService">for isolated statement execution</param>
 /// <param name="optionalStatementIdGenerator">The optional statement id generator.</param>
 /// <param name="filterService">The filter service.</param>
 /// <param name="timeZone">The time zone.</param>
 public EPDeploymentAdminImpl(EPAdministratorSPI epService,
                              DeploymentStateService deploymentStateService,
                              StatementEventTypeRef statementEventTypeRef,
                              EventAdapterService eventAdapterService,
                              StatementIsolationService statementIsolationService,
                              StatementIdGenerator optionalStatementIdGenerator,
                              FilterService filterService,
                              TimeZoneInfo timeZone)
 {
     _epService = epService;
     _deploymentStateService       = deploymentStateService;
     _statementEventTypeRef        = statementEventTypeRef;
     _eventAdapterService          = eventAdapterService;
     _statementIsolationService    = statementIsolationService;
     _optionalStatementIdGenerator = optionalStatementIdGenerator;
     _filterService = filterService;
     _timeZone      = timeZone;
 }
Exemple #4
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="epService">administrative SPI</param>
 /// <param name="deploymentStateService">deployment state maintenance service</param>
 /// <param name="statementEventTypeRef">maintains statement-eventtype relationship</param>
 /// <param name="eventAdapterService">event wrap service</param>
 /// <param name="statementIsolationService">for isolated statement execution</param>
 /// <param name="optionalStatementIdGenerator">The optional statement id generator.</param>
 /// <param name="filterService">The filter service.</param>
 /// <param name="timeZone">The time zone.</param>
 public EPDeploymentAdminImpl(EPAdministratorSPI epService,
                              DeploymentStateService deploymentStateService,
                              StatementEventTypeRef statementEventTypeRef,
                              EventAdapterService eventAdapterService,
                              StatementIsolationService statementIsolationService,
                              FilterService filterService,
                              TimeZoneInfo timeZone,
                              ConfigurationEngineDefaults.UndeployRethrowPolicy undeployRethrowPolicy)
 {
     _epService = epService;
     _deploymentStateService    = deploymentStateService;
     _statementEventTypeRef     = statementEventTypeRef;
     _eventAdapterService       = eventAdapterService;
     _statementIsolationService = statementIsolationService;
     _filterService             = filterService;
     _timeZone = timeZone;
     _undeployRethrowPolicy = undeployRethrowPolicy;
 }
 public EPServiceEngine(EPServicesContext services, EPRuntimeSPI runtimeSPI, EPAdministratorSPI admin)
 {
     Services = services;
     Runtime  = runtimeSPI;
     Admin    = admin;
 }
Exemple #6
0
        public void TestSPI()
        {
            EPAdministratorSPI spi = (EPAdministratorSPI)_epService.EPAdministrator;

            ExprDotNode funcnode = (ExprDotNode)spi.CompileExpression("func()");

            Assert.IsFalse(funcnode.ChainSpec[0].IsProperty);

            ExprNode node = spi.CompileExpression("value=5 and /* comment */ True");

            Assert.AreEqual("value=5 and true", node.ToExpressionStringMinPrecedenceSafe());

            Expression   expr = spi.CompileExpressionToSODA("value=5 and True");
            StringWriter buf  = new StringWriter();

            expr.ToEPL(buf, ExpressionPrecedenceEnum.MINIMUM);
            Assert.AreEqual("value=5 and true", buf.ToString());

            expr = spi.CompileExpressionToSODA("5 sec");
            buf  = new StringWriter();
            expr.ToEPL(buf, ExpressionPrecedenceEnum.MINIMUM);
            Assert.AreEqual("5 seconds", buf.ToString());

            EvalFactoryNode pattern = spi.CompilePatternToNode("every A -> B");

            Assert.That(pattern, Is.InstanceOf <EvalFollowedByFactoryNode>());

            PatternExpr patternExpr = spi.CompilePatternToSODA("every A -> B");

            Assert.AreEqual(typeof(PatternFollowedByExpr), patternExpr.GetType());

            EPStatementObjectModel modelPattern = spi.CompilePatternToSODAModel("@Name('test') every A -> B");

            Assert.AreEqual("Name", modelPattern.Annotations[0].Name);
            Assert.AreEqual(typeof(PatternFollowedByExpr), ((PatternStream)modelPattern.FromClause.Streams[0]).Expression.GetType());

            AnnotationPart part = spi.CompileAnnotationToSODA("@somevalue(a='test', b=5)");

            Assert.AreEqual("somevalue", part.Name);
            Assert.AreEqual(2, part.Attributes.Count);
            Assert.AreEqual("a", part.Attributes[0].Name);
            Assert.AreEqual("test", part.Attributes[0].Value);
            Assert.AreEqual("b", part.Attributes[1].Name);
            Assert.AreEqual(5, part.Attributes[1].Value);

            MatchRecognizeRegEx regex = spi.CompileMatchRecognizePatternToSODA("a b* c+ d? e?");

            Assert.AreEqual(5, regex.Children.Count);

            // test fail cases
            string expected = "Incorrect syntax near 'in' (a reserved keyword) at line 1 column 42 [goofy in in]";
            String compiled = "goofy in in";

            try
            {
                spi.CompileExpression(compiled);
                Assert.Fail();
            }
            catch (EPException ex)
            {
                Assert.AreEqual(expected, ex.Message);
            }

            try
            {
                spi.CompileExpressionToSODA(compiled);
                Assert.Fail();
            }
            catch (EPException ex)
            {
                Assert.AreEqual(expected, ex.Message);
            }

            expected = "Incorrect syntax near 'in' (a reserved keyword) at line 1 column 6 [goofy in in]";
            try
            {
                spi.CompilePatternToNode(compiled);
                Assert.Fail();
            }
            catch (EPException ex)
            {
                Assert.AreEqual(expected, ex.Message);
            }

            try
            {
                spi.CompilePatternToSODA(compiled);
                Assert.Fail();
            }
            catch (EPException ex)
            {
                Assert.AreEqual(expected, ex.Message);
            }

            try
            {
                spi.CompileAnnotationToSODA("not an annotation");
                Assert.Fail();
            }
            catch (EPException ex)
            {
                Assert.AreEqual("Incorrect syntax near 'not' (a reserved keyword) [not an annotation]", ex.Message);
            }

            try
            {
                spi.CompileMatchRecognizePatternToSODA("a b???");
                Assert.Fail();
            }
            catch (EPException ex)
            {
                Assert.AreEqual("Incorrect syntax near '?' expecting a closing parenthesis ')' but found a questionmark '?' at line 1 column 76 [a b???]", ex.Message);
            }

            StatementSpecRaw raw = spi.CompileEPLToRaw("select * from System.Object");

            Assert.NotNull(raw);
            EPStatementObjectModel model = spi.MapRawToSODA(raw);

            Assert.NotNull(model);

            // try control characters
            TryInvalidControlCharacters();
        }