private void RunAssertionInsertInto(EPServiceProvider epService) { string statementText = "insert into MyStream select " + "map.mapOne as val1" + " from NestedMap#length(5)"; epService.EPAdministrator.CreateEPL(statementText); statementText = "select val1 as a from MyStream"; EPStatement statement = epService.EPAdministrator.CreateEPL(statementText); var listener = new SupportUpdateListener(); statement.Events += listener.Update; IDictionary <string, Object> testdata = GetTestData(); epService.EPRuntime.SendEvent(testdata, "NestedMap"); // test all properties exist string[] fields = "a".Split(','); EventBean received = listener.AssertOneGetNewAndReset(); EPAssertionUtil.AssertProps(received, fields, new object[] { ExecEventMap.GetNestedKeyMap(testdata, "map", "mapOne") }); epService.EPAdministrator.DestroyAllStatements(); }
private void RunAssertionNestedPojo(EPServiceProvider epService) { string statementText = "select " + "simple, object, nodefmap, map, " + "object.id as a1, nodefmap.key1? as a2, nodefmap.key2? as a3, nodefmap.key3?.key4 as a4, " + "map.objectOne as b1, map.simpleOne as b2, map.nodefmapOne.key2? as b3, map.mapOne.simpleTwo? as b4, " + "map.objectOne.indexed[1] as c1, map.objectOne.nested.nestedValue as c2," + "map.mapOne.simpleTwo as d1, map.mapOne.objectTwo as d2, map.mapOne.nodefmapTwo as d3, " + "map.mapOne.mapTwo as e1, map.mapOne.mapTwo.simpleThree as e2, map.mapOne.mapTwo.objectThree as e3, " + "map.mapOne.objectTwo.array[1].Mapped('1ma').value as f1, map.mapOne.mapTwo.objectThree.id as f2" + " from NestedMap#length(5)"; EPStatement statement = epService.EPAdministrator.CreateEPL(statementText); var listener = new SupportUpdateListener(); statement.Events += listener.Update; IDictionary <string, Object> testdata = GetTestData(); epService.EPRuntime.SendEvent(testdata, "NestedMap"); // test all properties exist EventBean received = listener.AssertOneGetNewAndReset(); EPAssertionUtil.AssertProps(received, "simple,object,nodefmap,map".Split(','), new object[] { "abc", new SupportBean_A("A1"), testdata.Get("nodefmap"), testdata.Get("map") }); EPAssertionUtil.AssertProps(received, "a1,a2,a3,a4".Split(','), new object[] { "A1", "val1", null, null }); EPAssertionUtil.AssertProps(received, "b1,b2,b3,b4".Split(','), new object[] { ExecEventMap.GetNestedKeyMap(testdata, "map", "objectOne"), 10, "val2", 300 }); EPAssertionUtil.AssertProps(received, "c1,c2".Split(','), new object[] { 2, "NestedValue" }); EPAssertionUtil.AssertProps(received, "d1,d2,d3".Split(','), new object[] { 300, ExecEventMap.GetNestedKeyMap(testdata, "map", "mapOne", "objectTwo"), ExecEventMap.GetNestedKeyMap(testdata, "map", "mapOne", "nodefmapTwo") }); EPAssertionUtil.AssertProps(received, "e1,e2,e3".Split(','), new object[] { ExecEventMap.GetNestedKeyMap(testdata, "map", "mapOne", "mapTwo"), 4000L, new SupportBean_B("B1") }); EPAssertionUtil.AssertProps(received, "f1,f2".Split(','), new object[] { "1ma0", "B1" }); // test partial properties exist testdata = GetTestDataThree(); epService.EPRuntime.SendEvent(testdata, "NestedMap"); received = listener.AssertOneGetNewAndReset(); EPAssertionUtil.AssertProps(received, "simple,object,nodefmap,map".Split(','), new object[] { "abc", new SupportBean_A("A1"), testdata.Get("nodefmap"), testdata.Get("map") }); EPAssertionUtil.AssertProps(received, "a1,a2,a3,a4".Split(','), new object[] { "A1", "val1", null, null }); EPAssertionUtil.AssertProps(received, "b1,b2,b3,b4".Split(','), new object[] { ExecEventMap.GetNestedKeyMap(testdata, "map", "objectOne"), null, null, null }); EPAssertionUtil.AssertProps(received, "c1,c2".Split(','), new object[] { null, null }); EPAssertionUtil.AssertProps(received, "d1,d2,d3".Split(','), new object[] { null, ExecEventMap.GetNestedKeyMap(testdata, "map", "mapOne", "objectTwo"), ExecEventMap.GetNestedKeyMap(testdata, "map", "mapOne", "nodefmapTwo") }); EPAssertionUtil.AssertProps(received, "e1,e2,e3".Split(','), new object[] { ExecEventMap.GetNestedKeyMap(testdata, "map", "mapOne", "mapTwo"), 4000L, null }); EPAssertionUtil.AssertProps(received, "f1,f2".Split(','), new object[] { "1ma0", null }); }