コード例 #1
0
            public void Run(RegressionEnvironment env)
            {
                var epl = "select * from SupportBean_S0 unidirectional, SupportBean_S1#keepall";
                // no params
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "@Hint('exclude_plan') " + epl,
                    "Failed to process statement annotations: Hint 'EXCLUDE_PLAN' requires additional parameters in parentheses");

                // empty parameter allowed, to be filled in
                env.CompileDeploy("@Hint('exclude_plan()') " + epl);
                env.SendEventBean(new SupportBean_S0(1));

                // invalid return type
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "@Hint('exclude_plan(1)') " + epl,
                    "Expression provided for hint EXCLUDE_PLAN must return a boolean value");

                // invalid expression
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "@Hint('exclude_plan(dummy = 1)') " + epl,
                    "Failed to validate hint expression 'dummy=1': Property named 'dummy' is not valid in any stream");

                env.UndeployAll();
            }
コード例 #2
0
            public void Run(RegressionEnvironment env)
            {
                string epl;

                // invalid initiated-by type
                epl = "create context InvalidCtx partition by TheString from SupportBean initiated by SupportBean_S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Segmented context 'InvalidCtx' requires that all of the event types that are listed in the initialized-by also appear in the partition-by, type 'SupportBean_S0' is not one of the types listed in partition-by");

                // cannot assign name in different places
                epl =
                    "create context InvalidCtx partition by P00 from SupportBean_S0 as n1 initiated by SupportBean_S0 as n2";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Segmented context 'InvalidCtx' requires that either partition-by or initialized-by assign stream names, but not both");

                // name assigned is already used
                var message = "Name 'a' already used for type 'SupportBean_S0'";
                epl =
                    "create context InvalidCtx partition by P00 from SupportBean_S0, P10 from SupportBean_S1 initiated by SupportBean_S0 as a, SupportBean_S1 as a";
                SupportMessageAssertUtil.TryInvalidCompile(env, epl, message);
                epl =
                    "create context InvalidCtx partition by P00 from SupportBean_S0 as a, P10 from SupportBean_S1 as a";
                SupportMessageAssertUtil.TryInvalidCompile(env, epl, message);
            }
コード例 #3
0
            public void Run(RegressionEnvironment env)
            {
                // most are covered by point-region test already
                var path = new RegressionPath();
                env.CompileDeploy("create window MyWindow#keepall as SupportSpatialEventRectangle", path);

                // invalid number of columns
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow(X mxcifquadtree(0, 0, 100, 100))",
                    "Index of type 'mxcifquadtree' requires 4 expressions as index columns but received 1");

                // same index twice, by-columns
                env.CompileDeploy("create window SomeWindow#keepall as SupportSpatialEventRectangle", path);
                env.CompileDeploy(
                    "create index SomeWindowIdx1 on SomeWindow((X, Y, Width, Height) mxcifquadtree(0, 0, 1, 1))",
                    path);
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index SomeWindowIdx2 on SomeWindow((X, Y, Width, Height) mxcifquadtree(0, 0, 1, 1))",
                    "An index for the same columns already exists");

                env.UndeployAll();
            }
コード例 #4
0
 public void Run(RegressionEnvironment env)
 {
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "create schema MyPrivateEvent as " + typeof(MyPrivateEvent).MaskTypeName(),
         "Event class '" + typeof(MyPrivateEvent).FullName + "' does not have public visibility");
 }
コード例 #5
0
            public void Run(RegressionEnvironment env)
            {
                // invalid without explicit conversion
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "insert into MyEvent(isodate) select DateTime from SupportEventWithDateTime",
                    "Invalid assignment of column 'isodate' of type '" +
                    typeof(DateTime?).CleanName() +
                    "' to event property 'isodate' typed as '" +
                    typeof(string).CleanName() +
                    "', column and parameter types mismatch");

                // with hook
                env.CompileDeploy(
                        "@Name('s0') insert into MyEvent(isodate) select DateTimeOffset from SupportEventWithDateTimeOffset")
                    .AddListener("s0");

                var now = DateTimeHelper.GetCurrentTimeUniversal();
                env.SendEventBean(new SupportEventWithDateTimeOffset(now));
                Assert.AreEqual(
                    DateTimeFormat.ISO_DATE_TIME.Format(now),
                    env.Listener("s0").AssertOneGetNewAndReset().Get("isodate"));

                env.UndeployAll();
            }
コード例 #6
0
ファイル: ViewRank.cs プロジェクト: lanicon/nesper
            public void Run(RegressionEnvironment env)
            {
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean#rank(1, IntPrimitive desc)",
                    "Failed to validate data window declaration: Rank view requires a list of expressions providing unique keys, a numeric size parameter and a list of expressions providing sort keys [select * from SupportBean#rank(1, IntPrimitive desc)]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean#rank(1, IntPrimitive, TheString desc)",
                    "Failed to validate data window declaration: Failed to find unique value expressions that are expected to occur before the numeric size parameter [select * from SupportBean#rank(1, IntPrimitive, TheString desc)]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean#rank(TheString, IntPrimitive, 1)",
                    "Failed to validate data window declaration: Failed to find sort key expressions after the numeric size parameter [select * from SupportBean#rank(TheString, IntPrimitive, 1)]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean#rank(TheString, IntPrimitive, TheString desc)",
                    "Failed to validate data window declaration: Failed to find constant value for the numeric size parameter [select * from SupportBean#rank(TheString, IntPrimitive, TheString desc)]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean#rank(TheString, 1, 1, IntPrimitive, TheString desc)",
                    "Failed to validate data window declaration: Invalid view parameter expression 2 for Rank view, the expression returns a constant result value, are you sure? [select * from SupportBean#rank(TheString, 1, 1, IntPrimitive, TheString desc)]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean#rank(TheString, IntPrimitive, 1, IntPrimitive, 1, TheString desc)",
                    "Failed to validate data window declaration: Invalid view parameter expression 4 for Rank view, the expression returns a constant result value, are you sure? [select * from SupportBean#rank(TheString, IntPrimitive, 1, IntPrimitive, 1, TheString desc)]");
            }
コード例 #7
0
        private static void TryAssertionSortedMinMaxBy(
            RegressionEnvironment env,
            bool soda,
            AtomicLong milestone)
        {
            var fields = new[] {"maxbyeveru", "minbyeveru", "sortedb"};
            var path = new RegressionPath();

            var eplDeclare = "create table varagg (" +
                             "maxbyeveru maxbyever(IntPrimitive) @type('SupportBean'), " +
                             "minbyeveru minbyever(IntPrimitive) @type('SupportBean'), " +
                             "sortedb sorted(IntPrimitive) @type('SupportBean'))";
            env.CompileDeploy(soda, eplDeclare, path);

            var eplIterate = "@Name('iterate') select varagg from SupportBean_S0#lastevent";
            env.CompileDeploy(soda, eplIterate, path);
            env.SendEventBean(new SupportBean_S0(0));

            var eplBoundInto = "into table varagg select sorted() as sortedb from SupportBean#length(2)";
            env.CompileDeploy(soda, eplBoundInto, path);

            var eplUnboundInto =
                "into table varagg select maxbyever() as maxbyeveru, minbyever() as minbyeveru from SupportBean";
            env.CompileDeploy(soda, eplUnboundInto, path);

            var b1 = MakeSendBean(env, "E1", 20);
            var b2 = MakeSendBean(env, "E2", 15);

            env.MilestoneInc(milestone);

            var b3 = MakeSendBean(env, "E3", 10);
            AssertResults(
                env.Statement("iterate"),
                fields,
                new object[] {
                    b1, b3,
                    new object[] {b3, b2}
                });

            // invalid: bound aggregation into unbound max
            SupportMessageAssertUtil.TryInvalidCompile(
                env,
                path,
                "into table varagg select maxby(IntPrimitive) as maxbyeveru from SupportBean#length(2)",
                "Failed to validate select-clause expression 'maxby(IntPrimitive)': When specifying into-table a sort expression cannot be provided [");
            // invalid: unbound aggregation into bound max
            SupportMessageAssertUtil.TryInvalidCompile(
                env,
                path,
                "into table varagg select maxbyever() as sortedb from SupportBean#length(2)",
                "Incompatible aggregation function for table 'varagg' column 'sortedb', expecting 'sorted(IntPrimitive)' and received 'maxbyever()': The required aggregation function name is 'sorted' and provided is 'maxbyever' [");

            // valid: bound with unbound variable
            var eplBoundIntoUnbound = "into table varagg select " +
                                      "maxbyever() as maxbyeveru, minbyever() as minbyeveru " +
                                      "from SupportBean#length(2)";
            env.CompileDeploy(soda, eplBoundIntoUnbound, path);

            env.UndeployAll();
        }
コード例 #8
0
ファイル: ContextCategory.cs プロジェクト: lanicon/nesper
            public void Run(RegressionEnvironment env)
            {
                string epl;

                // invalid filter spec
                epl = "create context ACtx group TheString is not null as cat1 from SupportBean(dummy = 1)";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to validate filter expression 'dummy=1': Property named 'dummy' is not valid in any stream [");

                // not a boolean expression
                epl = "create context ACtx group IntPrimitive as grp1 from SupportBean";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Filter expression not returning a boolean value: 'IntPrimitive' [");

                // validate statement not applicable filters
                var path = new RegressionPath();
                env.CompileDeploy("create context ACtx group IntPrimitive < 10 as cat1 from SupportBean", path);
                epl = "context ACtx select * from SupportBean_S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    epl,
                    "Category context 'ACtx' requires that any of the events types that are listed in the category context also appear in any of the filter expressions of the statement [");

                env.UndeployAll();
            }
コード例 #9
0
 public void Run(RegressionEnvironment env)
 {
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select countever(distinct IntPrimitive) from SupportBean",
         "Failed to validate select-clause expression 'countever(distinct IntPrimitive)': Aggregation function 'countever' does now allow distinct [");
 }
コード例 #10
0
            public void Run(RegressionEnvironment env)
            {
                SendTimeEvent(env, "2002-05-1T10:00:00.000");

                var path = new RegressionPath();
                var epl =
                    "\n @Name('ctx') create context RuleActivityTime as start (0, 9, *, *, *) end (0, 17, *, *, *);" +
                    "\n @Name('window') context RuleActivityTime create window EventsWindow#firstunique(ProductID) as SupportProductIdEvent;" +
                    "\n @Name('variable') create variable boolean IsOutputTriggered_2 = false;" +
                    "\n @Name('A') context RuleActivityTime insert into EventsWindow select * from SupportProductIdEvent(not exists (select * from EventsWindow));" +
                    "\n @Name('B') context RuleActivityTime insert into EventsWindow select * from SupportProductIdEvent(not exists (select * from EventsWindow));" +
                    "\n @Name('C') context RuleActivityTime insert into EventsWindow select * from SupportProductIdEvent(not exists (select * from EventsWindow));" +
                    "\n @Name('D') context RuleActivityTime insert into EventsWindow select * from SupportProductIdEvent(not exists (select * from EventsWindow));" +
                    "\n @Name('out') context RuleActivityTime select * from EventsWindow";
                env.CompileDeploy(epl, path).AddListener("out");

                env.SendEventBean(new SupportProductIdEvent("A1"));

                // invalid - subquery not the same context
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "insert into EventsWindow select * from SupportProductIdEvent(not exists (select * from EventsWindow))",
                    "Failed to validate subquery number 1 querying EventsWindow: Named window by name 'EventsWindow' has been declared for context 'RuleActivityTime' and can only be used within the same context");

                env.UndeployAll();
            }
コード例 #11
0
ファイル: ExprCoreNewStruct.cs プロジェクト: lanicon/nesper
            public void Run(RegressionEnvironment env)
            {
                string epl;

                epl = "select case when true then new { col1 = 'a' } else 1 end from SupportBean";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to validate select-clause expression 'case when true then new{col1=\"a\"} e...(44 chars)': Case node 'when' expressions require that all results either return a single value or a Map-type (new-operator) value, check the else-condition [select case when true then new { col1 = 'a' } else 1 end from SupportBean]");

                epl = "select case when true then new { col1 = 'a' } when false then 1 end from SupportBean";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to validate select-clause expression 'case when true then new{col1=\"a\"} w...(55 chars)': Case node 'when' expressions require that all results either return a single value or a Map-type (new-operator) value, check when-condition number 1 [select case when true then new { col1 = 'a' } when false then 1 end from SupportBean]");

                epl = "select case when true then new { col1 = 'a' } else new { col1 = 1 } end from SupportBean";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to validate select-clause expression 'case when true then new{col1=\"a\"} e...(54 chars)': Incompatible case-when return types by new-operator in case-when number 1: Type by name 'Case-when number 1' in property 'col1' expected System.String but receives System.Nullable<System.Int32> [select case when true then new { col1 = 'a' } else new { col1 = 1 } end from SupportBean]");

                epl = "select case when true then new { col1 = 'a' } else new { col2 = 'a' } end from SupportBean";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to validate select-clause expression 'case when true then new{col1=\"a\"} e...(56 chars)': Incompatible case-when return types by new-operator in case-when number 1: The property 'col1' is not provided but required [select case when true then new { col1 = 'a' } else new { col2 = 'a' } end from SupportBean]");

                epl = "select case when true then new { col1 = 'a', col1 = 'b' } end from SupportBean";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to validate select-clause expression 'case when true then new{col1=\"a\",co...(46 chars)': Failed to validate new-keyword property names, property 'col1' has already been declared [select case when true then new { col1 = 'a', col1 = 'b' } end from SupportBean]");
            }
コード例 #12
0
ファイル: ExprCoreTypeOf.cs プロジェクト: lanicon/nesper
 public void Run(RegressionEnvironment env)
 {
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select typeof(xx) from SupportBean",
         "Failed to validate select-clause expression 'typeof(xx)': Property named 'xx' is not valid in any stream [select typeof(xx) from SupportBean]");
 }
コード例 #13
0
ファイル: InfraTableContext.cs プロジェクト: lanicon/nesper
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                env.CompileDeploy("create context SimpleCtx start after 1 sec end after 1 sec", path);
                env.CompileDeploy(
                    "context SimpleCtx create table MyTable(pkey string primary key, thesum sum(int), col0 string)",
                    path);

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "select * from MyTable",
                    "Table by name 'MyTable' has been declared for context 'SimpleCtx' and can only be used within the same context [");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "select (select * from MyTable) from SupportBean",
                    "Failed to plan subquery number 1 querying MyTable: Mismatch in context specification, the context for the table 'MyTable' is 'SimpleCtx' and the query specifies no context  [select (select * from MyTable) from SupportBean]");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "insert into MyTable select TheString as pkey from SupportBean",
                    "Table by name 'MyTable' has been declared for context 'SimpleCtx' and can only be used within the same context [");

                env.UndeployAll();
            }
コード例 #14
0
            public void Run(RegressionEnvironment env)
            {
                // require stream name assignment using 'as'
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "create context MyContext initiated by distinct(TheString) SupportBean terminated after 15 seconds",
                    "Distinct-expressions require that a stream name is assigned to the stream using 'as' [create context MyContext initiated by distinct(TheString) SupportBean terminated after 15 seconds]");

                // require stream
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "create context MyContext initiated by distinct(a.TheString) pattern [a=SupportBean] terminated after 15 seconds",
                    "Distinct-expressions require a stream as the initiated-by condition [create context MyContext initiated by distinct(a.TheString) pattern [a=SupportBean] terminated after 15 seconds]");

                // invalid distinct-clause expression
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "create context MyContext initiated by distinct((select * from MyWindow)) SupportBean as sb terminated after 15 seconds",
                    "Invalid context distinct-clause expression 'subselect_0': Aggregation, sub-select, previous or prior functions are not supported in this context [create context MyContext initiated by distinct((select * from MyWindow)) SupportBean as sb terminated after 15 seconds]");

                // empty list of expressions
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "create context MyContext initiated by distinct() SupportBean terminated after 15 seconds",
                    "Distinct-expressions have not been provided [create context MyContext initiated by distinct() SupportBean terminated after 15 seconds]");

                // non-overlapping context not allowed with distinct
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "create context MyContext start distinct(TheString) SupportBean end after 15 seconds",
                    "Incorrect syntax near 'distinct' (a reserved keyword) at line 1 column 31 [create context MyContext start distinct(TheString) SupportBean end after 15 seconds]");
            }
コード例 #15
0
 public void Run(RegressionEnvironment env)
 {
     var epl = "select IntArr in (1, 2, 3) as r1 from SupportBeanArrayCollMap";
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         epl,
         "Failed to validate select-clause expression 'IntArr in (1,2,3)': Collection or array comparison is not allowed for the IN, ANY, SOME or ALL keywords");
 }
コード例 #16
0
            public void Run(RegressionEnvironment env)
            {
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select (select Id from SupportBean_S1) from SupportBean_S0",
                    "Failed to plan subquery number 1 querying SupportBean_S1: Subqueries require one or more views to limit the stream, consider declaring a length or time window (applies to correlated or non-fully-aggregated subqueries) [");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select (select dummy from SupportBean_S1#lastevent) as IdS1 from SupportBean_S0",
                    "Failed to plan subquery number 1 querying SupportBean_S1: Failed to validate select-clause expression 'dummy': Property named 'dummy' is not valid in any stream [select (select dummy from SupportBean_S1#lastevent) as IdS1 from SupportBean_S0]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select (select (select Id from SupportBean_S1#lastevent) Id from SupportBean_S1#lastevent) as IdS1 from SupportBean_S0",
                    "Invalid nested subquery, subquery-within-subquery is not supported [select (select (select Id from SupportBean_S1#lastevent) Id from SupportBean_S1#lastevent) as IdS1 from SupportBean_S0]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select (select Id from SupportBean_S1#lastevent where (sum(Id) = 5)) as IdS1 from SupportBean_S0",
                    "Failed to plan subquery number 1 querying SupportBean_S1: Aggregation functions are not supported within subquery filters, consider using a having-clause or insert-into instead [select (select Id from SupportBean_S1#lastevent where (sum(Id) = 5)) as IdS1 from SupportBean_S0]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean_S0(Id=5 and (select Id from SupportBean_S1))",
                    "Failed to validate subquery number 1 querying SupportBean_S1: Subqueries require one or more views to limit the stream, consider declaring a length or time window [select * from SupportBean_S0(Id=5 and (select Id from SupportBean_S1))]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean_S0 group by Id + (select Id from SupportBean_S1)",
                    "Subselects not allowed within group-by [select * from SupportBean_S0 group by Id + (select Id from SupportBean_S1)]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean_S0 order by (select Id from SupportBean_S1) asc",
                    "Subselects not allowed within order-by clause [select * from SupportBean_S0 order by (select Id from SupportBean_S1) asc]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select (select Id from SupportBean_S1#lastevent where 'a') from SupportBean_S0",
                    "Failed to plan subquery number 1 querying SupportBean_S1: Subselect filter expression must return a boolean value [select (select Id from SupportBean_S1#lastevent where 'a') from SupportBean_S0]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select (select Id from SupportBean_S1#lastevent where Id = P00) from SupportBean_S0",
                    "Failed to plan subquery number 1 querying SupportBean_S1: Failed to validate filter expression 'Id=P00': Property named 'P00' must be prefixed by a stream name, use the stream name itself or use the as-clause to name the stream with the property in the format \"stream.property\" [select (select Id from SupportBean_S1#lastevent where Id = P00) from SupportBean_S0]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select Id in (select * from SupportBean_S1#length(1000)) as value from SupportBean_S0",
                    "Failed to validate select-clause expression subquery number 1 querying SupportBean_S1: Implicit conversion from datatype '" +
                    typeof(SupportBean_S1).CleanName() +
                    "' to '" +
                    typeof(int?).CleanName() +
                    "' is not allowed [select Id in (select * from SupportBean_S1#length(1000)) as value from SupportBean_S0]");
            }
コード例 #17
0
 public void Run(RegressionEnvironment env)
 {
     // invalid index for filter
     var epl = "expression myindex {pointregionquadtree(0, 0, 100, 100)}" +
               "select * from SupportSpatialEventRectangle(rectangle(10, 20, 5, 6, filterindex:myindex).intersects(rectangle(X, Y, Width, Height)))";
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         epl,
         "Failed to validate filter expression 'rectangle(10,20,5,6,filterindex:myi...(82 chars)': Invalid index type 'pointregionquadtree', expected 'mxcifquadtree'");
 }
コード例 #18
0
            public void Run(RegressionEnvironment env)
            {
                // we allow empty class text
                env.Compile("inlined_class \"\"\" \"\"\" select * from SupportBean");
                // invalid class
                TryInvalidCompile(
                    env,
                    "inlined_class \"\"\" x \"\"\" select * from SupportBean",
                    "Exception processing statement: " +
                    "Failure during module compilation: " +
                    "[(1,2): error CS0116:");
                //"Failed to compile class: Line 1, Column 2: One of 'class enum interface @' expected instead of 'x' for class [\"\"\" x \"\"\"]");

                // invalid already deployed
                var path           = new RegressionPath();
                var createClassEPL = "create inlined_class \"\"\" public class MyClass {}\"\"\"";

                env.Compile(createClassEPL, path);
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    createClassEPL,
                    "Class 'MyClass' has already been declared");

                // duplicate local class
                var eplDuplLocal =
                    "inlined_class \"\"\" class MyDuplicate{} \"\"\" inlined_class \"\"\" class MyDuplicate{} \"\"\" select * from SupportBean";

                TryInvalidCompile(
                    env,
                    eplDuplLocal,
                    "Exception processing statement: " +
                    "Failure during module compilation: " +
                    "[(1,8): error CS0101: The namespace '<global namespace>' already contains a definition for 'MyDuplicate']");

                // duplicate local class and create-class class
                var eplDuplLocalAndCreate = "inlined_class \"\"\" class MyDuplicate{} \"\"\" create inlined_class \"\"\" class MyDuplicate{} \"\"\"";

                TryInvalidCompile(
                    env,
                    eplDuplLocalAndCreate,
                    "Exception processing statement: " +
                    "Failure during module compilation: " +
                    "[(1,8): error CS0101: The namespace '<global namespace>' already contains a definition for 'MyDuplicate']");

                // duplicate create-class class
                var eplDuplCreate =
                    "create inlined_class \"\"\" public class MyDuplicate{} \"\"\";\n" +
                    "create inlined_class \"\"\" public class MyDuplicate{} \"\"\";\n";

                TryInvalidCompile(
                    env,
                    eplDuplCreate,
                    "Class 'MyDuplicate' has already been declared");
            }
コード例 #19
0
            public void Run(RegressionEnvironment env)
            {
                string epl;

                // invalid filter spec
                epl = "create context ACtx coalesce hash_code(IntPrimitive) from SupportBean(dummy = 1) granularity 10";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to validate filter expression 'dummy=1': Property named 'dummy' is not valid in any stream [");

                // invalid hash code function
                epl = "create context ACtx coalesce hash_code_xyz(IntPrimitive) from SupportBean granularity 10";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "For context 'ACtx' expected a hash function that is any of {consistent_hash_crc32, hash_code} or a plug-in single-row function or script but received 'hash_code_xyz' [");

                epl = "create context ACtx coalesce IntPrimitive from SupportBean granularity 10";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "For context 'ACtx' expected a hash function that is any of {consistent_hash_crc32, hash_code} or a plug-in single-row function or script but received 'IntPrimitive' [");


                // invalid no-param hash code function
                epl = "create context ACtx coalesce hash_code() from SupportBean granularity 10";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "For context 'ACtx' expected one or more parameters to the hash function, but found no parameter list [");

                // validate statement not applicable filters
                var path = new RegressionPath();
                env.CompileDeploy(
                    "create context ACtx coalesce hash_code(IntPrimitive) from SupportBean granularity 10",
                    path);
                epl = "context ACtx select * from SupportBean_S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    epl,
                    "Segmented context 'ACtx' requires that any of the event types that are listed in the segmented context also appear in any of the filter expressions of the statement, type 'SupportBean_S0' is not one of the types listed [");

                // invalid attempt to partition a named window's streams
                env.CompileDeploy("create window MyWindow#keepall as SupportBean", path);
                epl = "create context SegmentedByWhat partition by TheString from MyWindow";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    epl,
                    "Partition criteria may not include named windows [create context SegmentedByWhat partition by TheString from MyWindow]");

                env.UndeployAll();
            }
コード例 #20
0
ファイル: PatternGuardWhile.cs プロジェクト: lanicon/nesper
 public void Run(RegressionEnvironment env)
 {
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select * from pattern [every SupportBean while ('abc')]",
         "Invalid parameter for pattern guard 'SupportBean while (\"abc\")': Expression pattern guard requires a single expression as a parameter returning a true or false (boolean) value [select * from pattern [every SupportBean while ('abc')]]");
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select * from pattern [every SupportBean while (abc)]",
         "Failed to validate pattern guard expression 'abc': Property named 'abc' is not valid in any stream [select * from pattern [every SupportBean while (abc)]]");
 }
コード例 #21
0
            public void Run(RegressionEnvironment env)
            {
                // unrecognized named parameter
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportSpatialAABB#keepall where point(0, 0, a:1).inside(rectangle(X, Y, Width, Height))",
                    "Failed to validate expression: Failed to validate filter expression 'point(0,0,a:1).inside(rectangle(X,Y...(50 chars)': point does not accept 'a' as a named parameter");

                // not a filter
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "expression myindex {pointregionquadtree(0, 0, 100, 100)} select * from SupportSpatialAABB#keepall where point(0, 0, filterindex:myindex).inside(rectangle(X, Y, Width, Height))",
                    "Failed to validate expression: Failed to validate filter expression 'point(0,0,filterindex:myindex()).in...(68 chars)': The 'filterindex' named parameter can only be used in in filter expressions");

                // invalid index expression
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportSpatialAABB(point(0, 0, filterindex:1).inside(rectangle(X, Y, Width, Height)))",
                    "Failed to validate filter expression 'point(0,0,filterindex:1).inside(rec...(60 chars)': Named parameter 'filterindex' requires an expression name");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportSpatialAABB(point(0, 0, filterindex:dummy).inside(rectangle(X, Y, Width, Height)))",
                    "Failed to validate filter expression 'point(0,0,filterindex:dummy).inside...(64 chars)': Named parameter 'filterindex' requires an expression name");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "expression myindex {0} select * from SupportSpatialAABB(point(0, 0, filterindex:myindex).inside(rectangle(X, Y, Width, Height)))",
                    "Failed to validate filter expression 'point(0,0,filterindex:myindex()).in...(68 chars)': Named parameter 'filterindex' requires an index expression");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "expression myindex {dummy(0)} select * from SupportSpatialAABB(point(0, 0, filterindex:myindex).inside(rectangle(X, Y, Width, Height)))",
                    "Failed to validate filter expression 'point(0,0,filterindex:myindex()).in...(68 chars)': Unrecognized advanced-type index 'dummy'");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "expression myindex {pointregionquadtree(0)} select * from SupportSpatialAABB(point(0, 0, filterindex:myindex).inside(rectangle(X, Y, Width, Height)))",
                    "Failed to validate filter expression 'point(0,0,filterindex:myindex()).in...(68 chars)': Index of type 'pointregionquadtree' requires at least 4 parameters but received 1 [");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "expression myindex {pointregionquadtree(0,0,0,0)} select * from SupportSpatialAABB(point(0, 0, filterindex:myindex).inside(rectangle(X, Y, Width, Height)))",
                    "Failed to validate filter expression 'point(0,0,filterindex:myindex()).in...(68 chars)': Invalid value for index 'myindex' parameter 'Width' received 0.0d and expected value>0");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "expression myindex {pointregionquadtree(0,0,100,100).help()} select * from SupportSpatialAABB(point(0, 0, filterindex:myindex).inside(rectangle(X, Y, Width, Height)))",
                    "Failed to validate filter expression 'point(0,0,filterindex:myindex()).in...(68 chars)': Named parameter 'filterindex' invalid chained index expression");

                // filter-not-optimizable
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "expression myindex {pointregionquadtree(0, 0, 100, 100)} select * from SupportSpatialAABB(point(X, Y, filterindex:myindex).inside(rectangle(X, Y, Width, Height)))",
                    "Invalid filter-indexable expression 'X' in respect to index 'myindex': expected either a constant, context-builtin or property from a previous pattern match [expression myindex {pointregionquadtree(0, 0, 100, 100)} select * from SupportSpatialAABB(point(X, Y, filterindex:myindex).inside(rectangle(X, Y, Width, Height)))]");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "expression myindex {pointregionquadtree(0, 0, 100, 100)} select * from SupportSpatialAABB(point(0, 0, filterindex:myindex).inside(rectangle(0, Y, Width, Height)))",
                    "Invalid filter-index lookup expression '0' in respect to index 'myindex': expected an event property");
            }
コード例 #22
0
 public void Run(RegressionEnvironment env)
 {
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select * from SupportSpatialEventRectangle(rectangle('a', 0).inside(rectangle(0, 0, 0, 0)))",
         "Failed to validate filter expression 'rectangle(\"a\",0).inside(rectangle(0...(43 chars)': Failed to validate method-chain parameter expression 'rectangle(0,0,0,0)': Unknown single-row function, expression declaration, script or aggregation function named 'rectangle' could not be resolved (did you mean 'rectangle.intersects')");
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select * from SupportSpatialEventRectangle(rectangle(0).intersects(rectangle(0, 0, 0, 0)))",
         "Failed to validate filter expression 'rectangle(0).intersects(rectangle(0...(43 chars)': Failed to validate left-hand-side method 'rectangle', expected 4 parameters but received 1 parameters");
 }
コード例 #23
0
 public void Run(RegressionEnvironment env)
 {
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select * from pattern[a=SupportBean_A -[a.IntPrimitive]> SupportBean_B]",
         "Invalid maximum expression in followed-by, event properties are not allowed within the expression [select * from pattern[a=SupportBean_A -[a.IntPrimitive]> SupportBean_B]]");
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select * from pattern[a=SupportBean_A -[false]> SupportBean_B]",
         "Invalid maximum expression in followed-by, the expression must return an integer value [select * from pattern[a=SupportBean_A -[false]> SupportBean_B]]");
 }
コード例 #24
0
            public void Run(RegressionEnvironment env)
            {
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean#expr(1)",
                    "Failed to validate data window declaration: Invalid return value for expiry expression, expected a boolean return value but received System.Int32 [select * from SupportBean#expr(1)]");

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select * from SupportBean#expr((select * from SupportBean#lastevent))",
                    "Failed to validate data window declaration: Invalid expiry expression: Sub-select, previous or prior functions are not supported in this context [select * from SupportBean#expr((select * from SupportBean#lastevent))]");
            }
コード例 #25
0
            public void Run(RegressionEnvironment env)
            {
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select IntOne=BooleanOne from SupportEventWithManyArray",
                    "Failed to validate select-clause expression 'IntOne=BooleanOne': Cannot convert datatype 'System.Array' to a value that fits both type 'System.Int32[]' and type 'System.Boolean[]'");
                //"Failed to validate select-clause expression 'IntOne=BooleanOne': Implicit conversion from datatype 'System.Boolean[]' to 'System.Int32[]' is not allowed"

                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    "select objectOne=BooleanOne from SupportEventWithManyArray",
                    "skip");
            }
コード例 #26
0
            public void Run(RegressionEnvironment env)
            {
                var epl =
                    "select (select TheString, sum(IntPrimitive) from SupportBean#lastevent as sb) from SupportBean_S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to plan subquery number 1 querying SupportBean: Subquery with multi-column select requires that either all or none of the selected columns are under aggregation, unless a group-by clause is also specified [select (select TheString, sum(IntPrimitive) from SupportBean#lastevent as sb) from SupportBean_S0]");

                epl = "select (select TheString, TheString from SupportBean#lastevent as sb) from SupportBean_S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Column 1 in subquery does not have a unique column name assigned [select (select TheString, TheString from SupportBean#lastevent as sb) from SupportBean_S0]");

                epl =
                    "select * from SupportBean_S0(P00 = (select TheString, TheString from SupportBean#lastevent as sb))";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to validate subquery number 1 querying SupportBean: Subquery multi-column select is not allowed in this context. [select * from SupportBean_S0(P00 = (select TheString, TheString from SupportBean#lastevent as sb))]");

                epl =
                    "select exists(select sb.* as v1, IntPrimitive*2 as v3 from SupportBean#lastevent as sb) as subrow from SupportBean_S0 as S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to plan subquery number 1 querying SupportBean: Subquery multi-column select does not allow wildcard or stream wildcard when selecting multiple columns. [select exists(select sb.* as v1, IntPrimitive*2 as v3 from SupportBean#lastevent as sb) as subrow from SupportBean_S0 as S0]");

                epl =
                    "select (select sb.* as v1, IntPrimitive*2 as v3 from SupportBean#lastevent as sb) as subrow from SupportBean_S0 as S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to plan subquery number 1 querying SupportBean: Subquery multi-column select does not allow wildcard or stream wildcard when selecting multiple columns. [select (select sb.* as v1, IntPrimitive*2 as v3 from SupportBean#lastevent as sb) as subrow from SupportBean_S0 as S0]");

                epl =
                    "select (select *, IntPrimitive from SupportBean#lastevent as sb) as subrow from SupportBean_S0 as S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to plan subquery number 1 querying SupportBean: Subquery multi-column select does not allow wildcard or stream wildcard when selecting multiple columns. [select (select *, IntPrimitive from SupportBean#lastevent as sb) as subrow from SupportBean_S0 as S0]");

                epl =
                    "select * from SupportBean_S0(P00 in (select TheString, TheString from SupportBean#lastevent as sb))";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    epl,
                    "Failed to validate subquery number 1 querying SupportBean: Subquery multi-column select is not allowed in this context. [select * from SupportBean_S0(P00 in (select TheString, TheString from SupportBean#lastevent as sb))]");
            }
コード例 #27
0
            public void Run(RegressionEnvironment env)
            {
                // invalid tests
                string stmtText;

                stmtText =
                    "select (select sum(S0.Id) from SupportBean_S1#length(3) as S1) as value from SupportBean_S0 as S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    stmtText,
                    "Failed to plan subquery number 1 querying SupportBean_S1: Subselect aggregation functions cannot aggregate across correlated properties");

                stmtText =
                    "select (select S1.Id + sum(S1.Id) from SupportBean_S1#length(3) as S1) as value from SupportBean_S0 as S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    stmtText,
                    "Failed to plan subquery number 1 querying SupportBean_S1: Subselect properties must all be within aggregation functions");

                stmtText =
                    "select (select sum(S0.Id + S1.Id) from SupportBean_S1#length(3) as S1) as value from SupportBean_S0 as S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    stmtText,
                    "Failed to plan subquery number 1 querying SupportBean_S1: Subselect aggregation functions cannot aggregate across correlated properties");

                // having-clause cannot aggregate over properties from other streams
                stmtText =
                    "select (select TheString from SupportBean#keepall having sum(S0.P00) = 1) as c0 from SupportBean_S0 as S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    stmtText,
                    "Failed to plan subquery number 1 querying SupportBean: Failed to validate having-clause expression '(sum(S0.P00))=1': Implicit conversion from datatype 'System.String' to numeric is not allowed for aggregation function 'sum' [");

                // having-clause properties must be aggregated
                stmtText =
                    "select (select TheString from SupportBean#keepall having sum(IntPrimitive) = IntPrimitive) as c0 from SupportBean_S0 as S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    stmtText,
                    "Failed to plan subquery number 1 querying SupportBean: Subselect having-clause requires that all properties are under aggregation, consider using the 'first' aggregation function instead");

                // having-clause not returning boolean
                stmtText =
                    "select (select TheString from SupportBean#keepall having sum(IntPrimitive)) as c0 from SupportBean_S0";
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    stmtText,
                    "Failed to plan subquery number 1 querying SupportBean: Subselect having-clause expression must return a boolean value ");
            }
コード例 #28
0
 public void Run(RegressionEnvironment env)
 {
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select * from pattern[every a=SupportBean@consume()]",
         "Incorrect syntax near ')' expecting any of the following tokens {IntegerLiteral, FloatingPointLiteral} but found a closing parenthesis ')' at line 1 column 50, please check the filter specification within the pattern expression within the from clause [select * from pattern[every a=SupportBean@consume()]]");
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select * from pattern[every a=SupportBean@consume(-1)]",
         "Incorrect syntax near '-' expecting any of the following tokens {IntegerLiteral, FloatingPointLiteral} but found a minus '-' at line 1 column 50, please check the filter specification within the pattern expression within the from clause [select * from pattern[every a=SupportBean@consume(-1)]]");
     SupportMessageAssertUtil.TryInvalidCompile(
         env,
         "select * from pattern[every a=SupportBean@xx]",
         "Unexpected pattern filter @ annotation, expecting 'consume' but received 'xx' [select * from pattern[every a=SupportBean@xx]]");
 }
コード例 #29
0
        private static void TryAssertionReturnTypeIsEventsInvalid(RegressionEnvironment env)
        {
            env.CompileDeploy("select myItemProducerInvalidNoType(TheString) as c0 from SupportBean");
            SupportMessageAssertUtil.TryInvalidCompile(
                env,
                "select myItemProducerInvalidNoType(TheString).where(v -> v.Id='Id1') as c0 from SupportBean",
                "Failed to validate select-clause expression 'myItemProducerInvalidNoType(TheStri...(68 chars)': Method 'MyItemProducerEventBeanArray' returns EventBean-array but does not provide the event type name [");

            // test invalid: event type name invalid
            SupportMessageAssertUtil.TryInvalidCompile(
                env,
                "select myItemProducerInvalidWrongType(TheString).where(v -> v.Id='Id1') as c0 from SupportBean",
                "Failed to validate select-clause expression 'myItemProducerInvalidWrongType(TheS...(74 chars)': Method 'MyItemProducerEventBeanArray' returns event type 'dummy' and the event type cannot be found [select myItemProducerInvalidWrongType(TheString).where(v -> v.Id='Id1') as c0 from SupportBean]");

            env.UndeployAll();
        }
コード例 #30
0
        public void Run(RegressionEnvironment env)
        {
            var path = new RegressionPath();
            env.CompileDeploy("create table MyTable(pkey string primary key, col0 int)", path);
            env.CompileDeploy(
                "insert into MyTable select TheString as pkey, IntPrimitive as col0 from SupportBean",
                path);

            for (var i = 0; i < 5; i++) {
                env.SendEventBean(new SupportBean("E" + i, i));
            }

            var fields = new[] {"col0"};

            // test FAF filter
            var events = env.CompileExecuteFAF("select col0 from MyTable(pkey='E1')", path).Array;
            EPAssertionUtil.AssertPropsPerRow(
                events,
                fields,
                new[] {new object[] {1}});

            // test iterate
            env.CompileDeploy("@Name('iterate') select col0 from MyTable(pkey='E2')", path);
            EPAssertionUtil.AssertPropsPerRow(
                env.GetEnumerator("iterate"),
                fields,
                new[] {new object[] {2}});
            env.UndeployModuleContaining("iterate");

            // test subquery
            env.CompileDeploy(
                    "@Name('subq') select (select col0 from MyTable(pkey='E3')) as col0 from SupportBean_S0",
                    path)
                .AddListener("subq");
            env.SendEventBean(new SupportBean_S0(0));
            Assert.AreEqual(3, env.Listener("subq").AssertOneGetNewAndReset().Get("col0"));
            env.UndeployModuleContaining("subq");

            // test join
            SupportMessageAssertUtil.TryInvalidCompile(
                env,
                path,
                "select col0 from SupportBean_S0, MyTable(pkey='E4')",
                "Joins with tables do not allow table filter expressions, please add table filters to the where-clause instead [");

            env.UndeployAll();
        }