示例#1
0
 private void MakeSendScoreEvent(String typeName, EventRepresentationChoice eventRepresentationEnum, String userId, String keyword, String productId, long score)
 {
     if (eventRepresentationEnum.IsMapEvent())
     {
         var theEvent = new LinkedHashMap <string, Object>();
         theEvent.Put("userId", userId);
         theEvent.Put("keyword", keyword);
         theEvent.Put("productId", productId);
         theEvent.Put("score", score);
         _epService.EPRuntime.SendEvent(theEvent, typeName);
     }
     else if (eventRepresentationEnum.IsObjectArrayEvent())
     {
         _epService.EPRuntime.SendEvent(new Object[] { userId, keyword, productId, score }, typeName);
     }
     else if (eventRepresentationEnum.IsAvroEvent())
     {
         var record = SupportAvroUtil.GetAvroRecord(_epService, typeName);
         record.Put("userId", userId);
         record.Put("keyword", keyword);
         record.Put("productId", productId);
         record.Put("score", score);
         _epService.EPRuntime.SendEventAvro(record, typeName);
     }
     else
     {
         Assert.Fail();
     }
 }
示例#2
0
        private void RunAssertionWildcard(bool bean, EventRepresentationChoice?rep)
        {
            if (bean)
            {
                _epService.EPAdministrator.CreateEPL("create schema MySchema as " + typeof(MyP0P1Event).MaskTypeName());
            }
            else
            {
                _epService.EPAdministrator.CreateEPL("create " + rep.Value.GetOutputTypeCreateSchemaName() + " schema MySchema (P0 string, P1 string)");
            }

            EPStatement stmtTheTable = _epService.EPAdministrator.CreateEPL("create table TheTable (P0 string, P1 string)");

            _epService.EPAdministrator.CreateEPL("insert into TheTable select * from MySchema");

            if (bean)
            {
                _epService.EPRuntime.SendEvent(new MyP0P1Event("a", "b"));
            }
            else if (rep.Value.IsMapEvent())
            {
                IDictionary <String, object> map = new Dictionary <string, object>();
                map.Put("P0", "a");
                map.Put("P1", "b");
                _epService.EPRuntime.SendEvent(map, "MySchema");
            }
            else if (rep.Value.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(
                    new object[] { "a", "b" }, "MySchema");
            }
            else if (rep.Value.IsAvroEvent())
            {
                var theEvent = SupportAvroUtil.GetAvroRecord(_epService, "MySchema");
                theEvent.Put("P0", "a");
                theEvent.Put("P1", "b");
                _epService.EPRuntime.SendEventAvro(theEvent, "MySchema");
            }
            else
            {
            }
            EPAssertionUtil.AssertProps(stmtTheTable.First(), "P0,P1".Split(','), new object[] { "a", "b" });
            _epService.EPAdministrator.DestroyAllStatements();
            _epService.EPAdministrator.Configuration.RemoveEventType("MySchema", false);
        }