Ejemplo n.º 1
0
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                env.CompileDeploy("create window MyWindow#keepall as SupportSpatialPoint", path);

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

                // invalid column type
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Id, Py) pointregionquadtree(0, 0, 100, 100))",
                    "Index of type 'pointregionquadtree' for column 0 that is providing X-values expecting type System.Object but received type System.String");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Id) pointregionquadtree(0, 0, 100, 100))",
                    "Index of type 'pointregionquadtree' for column 1 that is providing Y-values expecting type System.Object but received type System.String");

                // invalid expressions for column or parameter
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((dummy, dummy2) pointregionquadtree(0, 0, 100, 100))",
                    "Failed to validate create-index index-column expression 'dummy': Property named 'dummy' is not valid in any stream");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree(dummy, 0, 100, 100))",
                    "Failed to validate create-index index-parameter expression 'dummy': Property named 'dummy' is not valid in any stream");

                // invalid property use in parameter
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree(Px, 0, 100, 100))",
                    "Index parameters may not refer to event properties");

                // invalid number of parameters
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree)",
                    "Index of type 'pointregionquadtree' requires at least 4 parameters but received 0");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree('a'))",
                    "Index of type 'pointregionquadtree' requires at least 4 parameters but received 1");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree(0, 0, 0, 0, 0, 0, 0))",
                    "Index of type 'pointregionquadtree' requires at least 4 parameters but received 7");

                // invalid parameter type
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree('a', 0, 100, 100))",
                    "Index of type 'pointregionquadtree' for parameter 0 that is providing XMin-values expecting type System.Object but received type System.String");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree(0, 'a', 100, 100))",
                    "Index of type 'pointregionquadtree' for parameter 1 that is providing YMin-values expecting type System.Object but received type System.String");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree(0, 0, 'a', 100))",
                    "Index of type 'pointregionquadtree' for parameter 2 that is providing Width-values expecting type System.Object but received type System.String");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree(0, 0, 100, 'a'))",
                    "Index of type 'pointregionquadtree' for parameter 3 that is providing Height-values expecting type System.Object but received type System.String");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree(0, 0, 100, 100, 'a'))",
                    "Index of type 'pointregionquadtree' for parameter 4 that is providing LeafCapacity-values expecting type System.Nullable<System.Int32> but received type System.String");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree(0, 0, 100, 100, 1, 'a'))",
                    "Index of type 'pointregionquadtree' for parameter 5 that is providing MaxTreeHeight-values expecting type System.Nullable<System.Int32> but received type System.String");

                // invalid parameter value
                SupportMessageAssertUtil.TryInvalidDeploy(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Px, Py) pointregionquadtree(cast(null, double), 0, 0, 0))",
                    "Failed to deploy: Invalid value for index 'MyIndex' parameter 'XMin' received null and expected non-null");
                SupportMessageAssertUtil.TryInvalidDeploy(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Py, Px) pointregionquadtree(0, 0, -100, 0))",
                    "Failed to deploy: Invalid value for index 'MyIndex' parameter 'Width' received -100.0d and expected value>0");
                SupportMessageAssertUtil.TryInvalidDeploy(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Py, Px) pointregionquadtree(0, 0, 1, -200))",
                    "Failed to deploy: Invalid value for index 'MyIndex' parameter 'Height' received -200.0d and expected value>0");
                SupportMessageAssertUtil.TryInvalidDeploy(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Py, Px) pointregionquadtree(0, 0, 1, 1, -1))",
                    "Failed to deploy: Invalid value for index 'MyIndex' parameter 'LeafCapacity' received -1 and expected value>=1");
                SupportMessageAssertUtil.TryInvalidDeploy(
                    env,
                    path,
                    "create index MyIndex on MyWindow((Py, Px) pointregionquadtree(0, 0, 1, 1, 10, -1))",
                    "Failed to deploy: Invalid value for index 'MyIndex' parameter 'MaxTreeHeight' received -1 and expected value>=2");

                // same index twice, by-name and by-columns
                env.CompileDeploy("create window SomeWindow#keepall as SupportSpatialPoint", path);
                env.CompileDeploy(
                    "create index SomeWindowIdx1 on SomeWindow((Px, Py) pointregionquadtree(0, 0, 1, 1))",
                    path);
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index SomeWindowIdx2 on SomeWindow((Px, Py) pointregionquadtree(0, 0, 1, 1))",
                    "An index for the same columns already exists");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index SomeWindowIdx1 on SomeWindow((Py, Px) pointregionquadtree(0, 0, 1, 1))",
                    "An index by name 'SomeWindowIdx1' already exists");

                // non-plain column or parameter expressions
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndexInv on MyWindow((sum(Px), Py) pointregionquadtree(0, 0, 1, 1))",
                    "Invalid create-index index-column expression 'sum(Px)': Aggregation, sub-select, previous or prior functions are not supported in this context");
                SupportMessageAssertUtil.TryInvalidCompile(
                    env,
                    path,
                    "create index MyIndexInv on MyWindow((Px, Py) pointregionquadtree(count(*), 0, 1, 1))",
                    "Invalid create-index index-parameter expression 'count(*)': Aggregation, sub-select, previous or prior functions are not supported in this context");

                env.UndeployAll();
            }