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(); }
public void Run(RegressionEnvironment env) { var path = new RegressionPath(); var ns = NamespaceGenerator.Create(); var prefix = INLINEDCLASS_PREFIXMAP.Replace("${NAMESPACE}", ns); var epl = "@public @buseventtype create schema PersonEvent(name string, id string);" + "create " + prefix + ";\n" + "@Name('table') create table TableWithTrie(nameTrie trieState(string));\n" + "@Priority(1) into table TableWithTrie select trieEnter(name) as nameTrie from PersonEvent;\n" + "@Priority(0) @name('s0') select TableWithTrie.nameTrie.triePrefixMap(name) as c0 from PersonEvent;\n"; env.CompileDeploy(epl, path).AddListener("s0"); var p1 = MakeSendPerson(env, "Andreas", "P1"); AssertReceived(env, CollectionUtil.BuildMap("Andreas", SingletonList(p1))); var p2 = MakeSendPerson(env, "Andras", "P2"); AssertReceived(env, CollectionUtil.BuildMap("Andras", SingletonList(p2))); var p3 = MakeSendPerson(env, "Andras", "P3"); AssertReceived(env, CollectionUtil.BuildMap("Andras", Arrays.AsList(p2, p3))); var p4 = MakeSendPerson(env, "And", "P4"); AssertReceived(env, CollectionUtil.BuildMap("Andreas", SingletonList(p1), "Andras", Arrays.AsList(p2, p3), "And", SingletonList(p4))); var eplFAF = "select nameTrie as c0 from TableWithTrie"; var result = env.CompileExecuteFAF(eplFAF, path); var trie = (SupportTrie <string, IList <object> >)result.Array[0].Get("c0"); Assert.AreEqual(3, trie.PrefixMap("And").Count); trie = (SupportTrie <string, IList <object> >)env.GetEnumerator("table").Advance().Get("nameTrie"); Assert.AreEqual(3, trie.PrefixMap("And").Count); env.UndeployAll(); }