Ejemplo n.º 1
0
            public void Run(RegressionEnvironment env)
            {
                var ns      = NamespaceGenerator.Create();
                var inlined = INLINEDCLASS_CONCAT.Replace("${NAMESPACE}", ns);

                var eplCreateInlined = "@Name('clazz') @public create " + inlined + ";\n";
                var path             = new RegressionPath();

                env.Compile(eplCreateInlined.Replace("builder.ToString()", "null"), path);

                var eplSelect      = "@Name('s0') select concat(TheString) as c0 from SupportBean";
                var compiledSelect = env.Compile(eplSelect, path);

                env.CompileDeploy(eplCreateInlined);
                env.Deploy(compiledSelect).AddListener("s0");

                SendAssertConcat(env, "A", "A");

                env.Milestone(0);

                SendAssertConcat(env, "B", "A,B");

                // assert dependencies
                SupportDeploymentDependencies.AssertSingle(env, "s0", "clazz", EPObjectType.CLASSPROVIDED, "ConcatAggForge");

                env.UndeployAll();
            }
            public void Run(RegressionEnvironment env)
            {
                var ns               = NamespaceGenerator.Create();
                var prefix           = INLINEDCLASS_PREFIXMAP.Replace("${NAMESPACE}", ns);
                var eplCreateInlined = "@Name('clazz') @public create " + prefix + ";\n";
                var path             = new RegressionPath();

                env.Compile(eplCreateInlined, path);

                var epl =
                    "@public @buseventtype create schema PersonEvent(name string, id string);" +
                    "@Name('table') create table TableWithTrie(nameTrie trieState(string));\n" +
                    "into table TableWithTrie select trieEnter(name) as nameTrie from PersonEvent;\n";
                var compiledTable = env.Compile(epl, path);

                env.CompileDeploy(eplCreateInlined);
                env.Deploy(compiledTable);

                MakeSendPerson(env, "Andreas", "P1");
                MakeSendPerson(env, "Andras", "P2");
                MakeSendPerson(env, "Andras", "P3");
                MakeSendPerson(env, "And", "P4");

                var trie = (SupportTrie <string, IList <object> >)env.GetEnumerator("table").Advance().Get("nameTrie");

                Assert.AreEqual(3, trie.PrefixMap("And").Count);

                // assert dependencies
                SupportDeploymentDependencies.AssertSingle(env, "table", "clazz", EPObjectType.CLASSPROVIDED, ns + ".TrieAggForge");

                env.UndeployAll();
            }
Ejemplo n.º 3
0
            public void Run(RegressionEnvironment env)
            {
                var @namespace = NamespaceGenerator.Create();
                var epl        =
                    "create inlined_class \"\"\"\n" +
                    " namespace " + @namespace + " {\n" +
                    "   [" + typeof(ExtensionSingleRowFunctionAttribute).FullName + "(Name=\"multiply\", MethodName=\"Multiply\")]\n" +
                    "   public class MultiplyHelper {\n" +
                    "     public static int Multiply(int a, int b) {\n" +
                    "       return a*b;\n" +
                    "     }\n" +
                    "   }\n" +
                    " }\n" +
                    "\"\"\"\n;" +
                    "@Name('s0') select multiply(IntPrimitive,IntPrimitive) as c0 from SupportBean;\n";

                env.CompileDeploy(epl).AddListener("s0");

                SendAssertIntMultiply(env, 5, 25);

                env.Milestone(0);

                SendAssertIntMultiply(env, 6, 36);

                SupportDeploymentDependencies.AssertEmpty(env, "s0");

                env.UndeployAll();
            }
Ejemplo n.º 4
0
            public void Run(RegressionEnvironment env)
            {
                var eplCreateInlined =
                    "@Name('clazz') @public create inlined_class \"\"\"\n" +
                    " namespace %NAMESPACE% {\n" +
                    "   [" + typeof(ExtensionSingleRowFunctionAttribute).FullName + "(Name=\"multiply\", MethodName=\"Multiply\")]\n" +
                    "   public class MultiplyHelper {\n" +
                    "     public static int Multiply(int a, int b) {\n" +
                    "       %BEHAVIOR%\n" +
                    "     }\n" +
                    "   }\n" +
                    " }\n" +
                    "\"\"\"\n;";
                var path = new RegressionPath();
                var ns1  = NamespaceGenerator.Create();

                env.Compile(
                    eplCreateInlined
                    .Replace("%NAMESPACE%", ns1)
                    .Replace("%BEHAVIOR%", "return -1;"), path);

                var eplSelect      = "@Name('s0') select multiply(IntPrimitive,IntPrimitive) as c0 from SupportBean";
                var compiledSelect = env.Compile(eplSelect, path);

                var ns2 = NamespaceGenerator.Create();

                env.CompileDeploy(
                    eplCreateInlined
                    .Replace("%NAMESPACE%", ns2)
                    .Replace("%BEHAVIOR%", "return a*b;"));
                env.Deploy(compiledSelect).AddListener("s0");

                SendAssertIntMultiply(env, 3, 9);

                env.Milestone(0);

                SendAssertIntMultiply(env, 13, 13 * 13);

                // assert dependencies
                SupportDeploymentDependencies.AssertSingle(env, "s0", "clazz", EPObjectType.CLASSPROVIDED, "MultiplyHelper");

                env.UndeployAll();
            }
Ejemplo n.º 5
0
            public void Run(RegressionEnvironment env)
            {
                var ns      = NamespaceGenerator.Create();
                var inlined = INLINEDCLASS_CONCAT.Replace("${NAMESPACE}", ns);

                var epl =
                    "create " + inlined + ";\n" +
                    "@Name('s0') select concat(TheString) as c0 from SupportBean;\n";

                env.CompileDeploy(epl).AddListener("s0");

                SendAssertConcat(env, "A", "A");

                env.Milestone(0);

                SendAssertConcat(env, "B", "A,B");

                SupportDeploymentDependencies.AssertEmpty(env, "s0");

                env.UndeployAll();
            }
Ejemplo n.º 6
0
            public void Run(RegressionEnvironment env)
            {
                RegressionPath path     = new RegressionPath();
                string         eplClass = "@public @name('clazz') create inlined_class \"\"\"\n" +
                                          "[System.Serializable]\n" +
                                          "public class MyStatefulValue {\n" +
                                          "    private string _value = \"X\";\n" +
                                          "    public string Value {\n" +
                                          "        get => _value;\n" +
                                          "        set => _value = value;\n" +
                                          "    }\n" +
                                          "}\n" +
                                          "\"\"\"\n";

                env.CompileDeploy(eplClass, path);

                string epl = "create variable MyStatefulValue msf = new MyStatefulValue();\n" +
                             "@Name('s0') select msf.Value as c0 from SupportBean;\n" +
                             "on SupportBean_S0 set msf.Value = P00;\n";

                env.CompileDeploy(epl, path).AddListener("s0");

                SendAssert(env, "X");
                env.SendEventBean(new SupportBean_S0(1, "A"));
                SendAssert(env, "A");

                env.Milestone(0);

                SendAssert(env, "A");
                env.SendEventBean(new SupportBean_S0(2, "B"));
                SendAssert(env, "B");

                SupportDeploymentDependencies.AssertSingle(env, "s0", "clazz", EPObjectType.CLASSPROVIDED, "MyStatefulValue");

                env.UndeployAll();
            }