public override void Run(EPServiceProvider epService)
        {
            epService.EPAdministrator.Configuration.AddEventType(BEAN_TYPE);
            AddMapEventType(epService);
            AddOAEventType(epService);
            AddAvroEventType(epService);

            RunAssertion(
                epService,
                BEAN_TYPE.Name,
                FBEAN,
                new MyIMEvent(new[] { "v1", "v2" }, Collections.SingletonMap("k1", "v1")));

            RunAssertion(
                epService,
                SupportEventInfra.MAP_TYPENAME,
                SupportEventInfra.FMAP,
                SupportEventInfra.TwoEntryMap("indexed", new[] { "v1", "v2" }, "mapped", Collections.SingletonMap("k1", "v1")));

            RunAssertion(
                epService,
                SupportEventInfra.OA_TYPENAME,
                SupportEventInfra.FOA,
                new object[] { new[] { "v1", "v2" }, Collections.SingletonMap("k1", "v1") });

            // Avro
            var datum = new GenericRecord(GetAvroSchema());

            datum.Put("indexed", Collections.List("v1", "v2"));
            datum.Put("mapped", Collections.SingletonMap("k1", "v1"));
            RunAssertion(epService, AVRO_TYPENAME, FAVRO, datum);
        }
        public void TestIt()
        {
            ValueWithExistsFlag[] NOT_EXISTS = ValueWithExistsFlag.MultipleNotExists(4);

            // Bean
            SupportBeanComplexProps bean = SupportBeanComplexProps.MakeDefaultBean();
            var beanTests = new Pair <SupportBeanComplexProps, ValueWithExistsFlag[]>[] {
                new Pair <SupportBeanComplexProps, ValueWithExistsFlag[]>(bean, ValueWithExistsFlag.AllExist(bean.GetIndexed(0), bean.GetIndexed(1), bean.GetMapped("keyOne"), bean.GetMapped("keyTwo")))
            };

            RunAssertion(BEAN_TYPE.Name, SupportEventInfra.FBEAN, null, beanTests, typeof(object));

            // Map
            var mapTests = new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>[] {
                new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>(Collections.SingletonDataMap("somekey", "10"), NOT_EXISTS),
                new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>(SupportEventInfra.TwoEntryMap("indexed", new int[] { 1, 2 }, "mapped", SupportEventInfra.TwoEntryMap("keyOne", 3, "keyTwo", 4)), ValueWithExistsFlag.AllExist(1, 2, 3, 4)),
            };

            RunAssertion(SupportEventInfra.MAP_TYPENAME, SupportEventInfra.FMAP, null, mapTests, typeof(object));

            // Object-Array
            var oaTests = new Pair <object[], ValueWithExistsFlag[]>[] {
                new Pair <object[], ValueWithExistsFlag[]>(new object[] { null, null }, NOT_EXISTS),
                new Pair <object[], ValueWithExistsFlag[]>(new object[] { new int[] { 1, 2 }, SupportEventInfra.TwoEntryMap("keyOne", 3, "keyTwo", 4) }, ValueWithExistsFlag.AllExist(1, 2, 3, 4)),
            };

            RunAssertion(SupportEventInfra.OA_TYPENAME, SupportEventInfra.FOA, null, oaTests, typeof(object));

            // XML
            var xmlTests = new Pair <string, ValueWithExistsFlag[]>[] {
                new Pair <string, ValueWithExistsFlag[]>("", NOT_EXISTS),
                new Pair <string, ValueWithExistsFlag[]>("<indexed>1</indexed><indexed>2</indexed><mapped id=\"keyOne\">3</mapped><mapped id=\"keyTwo\">4</mapped>", ValueWithExistsFlag.AllExist("1", "2", "3", "4"))
            };

            RunAssertion(SupportEventInfra.XML_TYPENAME, SupportEventInfra.FXML, SupportEventInfra.XML_TO_VALUE, xmlTests, typeof(XmlNode));

            // Avro
            var datumOne = new GenericRecord(SchemaBuilder.Record(SupportEventInfra.AVRO_TYPENAME));
            var datumTwo = new GenericRecord(GetAvroSchema());

            datumTwo.Put("indexed", Collections.List(1, 2));
            datumTwo.Put("mapped", SupportEventInfra.TwoEntryMap("keyOne", 3, "keyTwo", 4));
            var avroTests = new Pair <GenericRecord, ValueWithExistsFlag[]>[] {
                new Pair <GenericRecord, ValueWithExistsFlag[]>(datumOne, NOT_EXISTS),
                new Pair <GenericRecord, ValueWithExistsFlag[]>(datumTwo, ValueWithExistsFlag.AllExist(1, 2, 3, 4)),
            };

            RunAssertion(SupportEventInfra.AVRO_TYPENAME, SupportEventInfra.FAVRO, null, avroTests, typeof(object));
        }
        public void TestIt()
        {
            RunAssertion(
                BEAN_TYPE.Name,
                SupportEventInfra.FBEAN,
                new MyIMEvent(new string[] { "v1", "v2" }, Collections.SingletonMap("k1", "v1")));

            RunAssertion(
                SupportEventInfra.MAP_TYPENAME,
                SupportEventInfra.FMAP,
                SupportEventInfra.TwoEntryMap("indexed", new string[] { "v1", "v2" }, "mapped", Collections.SingletonMap("k1", "v1")));

            RunAssertion(
                SupportEventInfra.OA_TYPENAME,
                SupportEventInfra.FOA,
                new object[] { new string[] { "v1", "v2" }, Collections.SingletonMap("k1", "v1") });

            // Avro
            GenericRecord datum = new GenericRecord(GetAvroSchema());

            datum.Put("indexed", Collections.List("v1", "v2"));
            datum.Put("mapped", Collections.SingletonMap("k1", "v1"));
            RunAssertion(SupportEventInfra.AVRO_TYPENAME, SupportEventInfra.FAVRO, datum);
        }
 private void AddMapEventType()
 {
     _epService.EPAdministrator.Configuration.AddEventType(SupportEventInfra.MAP_TYPENAME + "_4", Collections.SingletonDataMap("lvl4", typeof(int)));
     _epService.EPAdministrator.Configuration.AddEventType(SupportEventInfra.MAP_TYPENAME + "_3", SupportEventInfra.TwoEntryMap("l4", SupportEventInfra.MAP_TYPENAME + "_4[]", "lvl3", typeof(int)));
     _epService.EPAdministrator.Configuration.AddEventType(SupportEventInfra.MAP_TYPENAME + "_2", SupportEventInfra.TwoEntryMap("l3", SupportEventInfra.MAP_TYPENAME + "_3[]", "lvl2", typeof(int)));
     _epService.EPAdministrator.Configuration.AddEventType(SupportEventInfra.MAP_TYPENAME + "_1", SupportEventInfra.TwoEntryMap("l2", SupportEventInfra.MAP_TYPENAME + "_2[]", "lvl1", typeof(int)));
     _epService.EPAdministrator.Configuration.AddEventType(SupportEventInfra.MAP_TYPENAME, Collections.SingletonDataMap("l1", SupportEventInfra.MAP_TYPENAME + "_1[]"));
 }
Example #5
0
        public void TestIt()
        {
            var NOT_EXISTS = ValueWithExistsFlag.MultipleNotExists(3);

            // Bean
            var beanTests = new Pair <SupportMarkerInterface, ValueWithExistsFlag[]>[] {
                new Pair <SupportMarkerInterface, ValueWithExistsFlag[]>(SupportBeanComplexProps.MakeDefaultBean(), ValueWithExistsFlag.AllExist("Simple", "NestedValue", "NestedNestedValue")),
                new Pair <SupportMarkerInterface, ValueWithExistsFlag[]>(new SupportMarkerImplA("x"), NOT_EXISTS),
            };

            RunAssertion(BEAN_TYPE.Name, SupportEventInfra.FBEAN, null, beanTests, typeof(object));

            // Map
            var mapNestedNestedOne = Collections.SingletonDataMap("nestedNestedValue", 101);
            IDictionary <string, object> mapNestedOne = SupportEventInfra.TwoEntryMap("nestedNested", mapNestedNestedOne, "nestedValue", "abc");
            IDictionary <string, object> mapOne       = SupportEventInfra.TwoEntryMap("simpleProperty", 5, "nested", mapNestedOne);
            var mapTests = new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>[] {
                new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>(Collections.SingletonDataMap("simpleProperty", "a"), new ValueWithExistsFlag[] { ValueWithExistsFlag.Exists("a"), ValueWithExistsFlag.NotExists(), ValueWithExistsFlag.NotExists() }),
                new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>(mapOne, ValueWithExistsFlag.AllExist(5, "abc", 101)),
            };

            RunAssertion(SupportEventInfra.MAP_TYPENAME, SupportEventInfra.FMAP, null, mapTests, typeof(object));

            // Object-Array
            var oaNestedNestedOne = new object[] { 101 };
            var oaNestedOne       = new object[] { "abc", oaNestedNestedOne };
            var oaOne             = new object[] { 5, oaNestedOne };
            var oaTests           = new Pair <object[], ValueWithExistsFlag[]>[] {
                new Pair <object[], ValueWithExistsFlag[]>(new object[] { "a", null }, new ValueWithExistsFlag[] { ValueWithExistsFlag.Exists("a"), ValueWithExistsFlag.NotExists(), ValueWithExistsFlag.NotExists() }),
                new Pair <object[], ValueWithExistsFlag[]>(oaOne, ValueWithExistsFlag.AllExist(5, "abc", 101)),
            };

            RunAssertion(SupportEventInfra.OA_TYPENAME, SupportEventInfra.FOA, null, oaTests, typeof(object));

            // XML
            var xmlTests = new Pair <string, ValueWithExistsFlag[]>[]
            {
                new Pair <string, ValueWithExistsFlag[]>(
                    "<simpleProperty>abc</simpleProperty>" +
                    "<nested nestedValue=\"100\">\n" +
                    "\t<nestedNested nestedNestedValue=\"101\">\n" +
                    "\t</nestedNested>\n" +
                    "</nested>\n", ValueWithExistsFlag.AllExist("abc", "100", "101")),
                new Pair <string, ValueWithExistsFlag[]>("<nested/>", NOT_EXISTS),
            };

            RunAssertion(SupportEventInfra.XML_TYPENAME, SupportEventInfra.FXML, SupportEventInfra.XML_TO_VALUE, xmlTests, typeof(XmlNode));

            // Avro
            var schema             = GetAvroSchema();
            var datumNull          = new GenericRecord(schema);
            var nestedSchema       = AvroSchemaUtil.FindUnionRecordSchemaSingle(schema.GetField("nested").Schema).AsRecordSchema();
            var nestedNestedSchema = AvroSchemaUtil.FindUnionRecordSchemaSingle(nestedSchema.GetField("nestedNested").Schema).AsRecordSchema();
            var nestedNestedDatum  = new GenericRecord(nestedNestedSchema);

            nestedNestedDatum.Put("nestedNestedValue", 101);
            var nestedDatum = new GenericRecord(nestedSchema);

            nestedDatum.Put("nestedValue", 100);
            nestedDatum.Put("nestedNested", nestedNestedDatum);
            var datumOne = new GenericRecord(schema);

            datumOne.Put("simpleProperty", "abc");
            datumOne.Put("nested", nestedDatum);

            var avroTests = new Pair <GenericRecord, ValueWithExistsFlag[]>[] {
                new Pair <GenericRecord, ValueWithExistsFlag[]>(new GenericRecord(SchemaBuilder.Record(SupportEventInfra.AVRO_TYPENAME)), NOT_EXISTS),
                new Pair <GenericRecord, ValueWithExistsFlag[]>(datumNull, new ValueWithExistsFlag[] { ValueWithExistsFlag.Exists(null), ValueWithExistsFlag.NotExists(), ValueWithExistsFlag.NotExists() }),
                new Pair <GenericRecord, ValueWithExistsFlag[]>(datumOne, ValueWithExistsFlag.AllExist("abc", 100, 101)),
            };

            RunAssertion(SupportEventInfra.AVRO_TYPENAME, SupportEventInfra.FAVRO, null, avroTests, typeof(object));
        }
Example #6
0
        public void TestIt()
        {
            var NOT_EXISTS = ValueWithExistsFlag.MultipleNotExists(6);

            // Bean
            SupportBeanComplexProps inner = SupportBeanComplexProps.MakeDefaultBean();
            var beanTests = new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>[] {
                new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>(new SupportBeanDynRoot("xxx"), NOT_EXISTS),
                new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>(new SupportBeanDynRoot(inner), ValueWithExistsFlag.AllExist(
                                                                         inner.GetIndexed(0),
                                                                         inner.GetIndexed(1),
                                                                         inner.ArrayProperty[1],
                                                                         inner.GetMapped("keyOne"),
                                                                         inner.GetMapped("keyTwo"),
                                                                         inner.MapProperty.Get("xOne"))),
            };

            RunAssertion(BEAN_TYPE.Name, SupportEventInfra.FBEAN, null, beanTests, typeof(object));

            // Map
            IDictionary <string, object> mapNestedOne = new Dictionary <string, object>();

            mapNestedOne.Put("indexed", new int[] { 1, 2 });
            mapNestedOne.Put("arrayProperty", null);
            mapNestedOne.Put("mapped", SupportEventInfra.TwoEntryMap("keyOne", 100, "keyTwo", 200));
            mapNestedOne.Put("mapProperty", null);
            var mapOne   = Collections.SingletonDataMap("item", mapNestedOne);
            var mapTests = new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>[] {
                new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>(Collections.EmptyDataMap, NOT_EXISTS),
                new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>(mapOne, new ValueWithExistsFlag[]
                {
                    ValueWithExistsFlag.Exists(1),
                    ValueWithExistsFlag.Exists(2),
                    ValueWithExistsFlag.NotExists(),
                    ValueWithExistsFlag.Exists(100),
                    ValueWithExistsFlag.Exists(200),
                    ValueWithExistsFlag.NotExists()
                }),
            };

            RunAssertion(SupportEventInfra.MAP_TYPENAME, SupportEventInfra.FMAP, null, mapTests, typeof(object));

            // Object-Array
            var oaNestedOne = new object[] { new int[] { 1, 2 }, SupportEventInfra.TwoEntryMap("keyOne", 100, "keyTwo", 200), new int[] { 1000, 2000 }, Collections.SingletonMap("xOne", "abc") };
            var oaOne       = new object[] { null, oaNestedOne };
            var oaTests     = new Pair <object[], ValueWithExistsFlag[]>[] {
                new Pair <object[], ValueWithExistsFlag[]>(new object[] { null, null }, NOT_EXISTS),
                new Pair <object[], ValueWithExistsFlag[]>(oaOne, ValueWithExistsFlag.AllExist(1, 2, 2000, 100, 200, "abc")),
            };

            RunAssertion(SupportEventInfra.OA_TYPENAME, SupportEventInfra.FOA, null, oaTests, typeof(object));

            // XML
            var xmlTests = new Pair <string, ValueWithExistsFlag[]>[] {
                new Pair <string, ValueWithExistsFlag[]>("", NOT_EXISTS),
                new Pair <string, ValueWithExistsFlag[]>(
                    "<item>" +
                    "<indexed>1</indexed><indexed>2</indexed><mapped id=\"keyOne\">3</mapped><mapped id=\"keyTwo\">4</mapped>" +
                    "</item>", new ValueWithExistsFlag[]
                {
                    ValueWithExistsFlag.Exists("1"),
                    ValueWithExistsFlag.Exists("2"),
                    ValueWithExistsFlag.NotExists(),
                    ValueWithExistsFlag.Exists("3"),
                    ValueWithExistsFlag.Exists("4"),
                    ValueWithExistsFlag.NotExists()
                })
            };

            RunAssertion(SupportEventInfra.XML_TYPENAME, SupportEventInfra.FXML, SupportEventInfra.XML_TO_VALUE, xmlTests, typeof(XmlNode));

            // Avro
            var schema     = GetAvroSchema();
            var itemSchema = AvroSchemaUtil.FindUnionRecordSchemaSingle(schema.GetField("item").Schema).AsRecordSchema();
            var datumOne   = new GenericRecord(schema);

            datumOne.Put("item", null);
            var datumItemTwo = new GenericRecord(itemSchema);

            datumItemTwo.Put("indexed", Collections.List(1, 2));
            datumItemTwo.Put("mapped", SupportEventInfra.TwoEntryMap("keyOne", 3, "keyTwo", 4));
            var datumTwo = new GenericRecord(schema);

            datumTwo.Put("item", datumItemTwo);
            var avroTests = new Pair <GenericRecord, ValueWithExistsFlag[]>[] {
                new Pair <GenericRecord, ValueWithExistsFlag[]>(new GenericRecord(schema), NOT_EXISTS),
                new Pair <GenericRecord, ValueWithExistsFlag[]>(datumOne, NOT_EXISTS),
                new Pair <GenericRecord, ValueWithExistsFlag[]>(datumTwo, new ValueWithExistsFlag[]
                {
                    ValueWithExistsFlag.Exists(1),
                    ValueWithExistsFlag.Exists(2),
                    ValueWithExistsFlag.NotExists(),
                    ValueWithExistsFlag.Exists(3),
                    ValueWithExistsFlag.Exists(4),
                    ValueWithExistsFlag.NotExists()
                }),
            };

            RunAssertion(SupportEventInfra.AVRO_TYPENAME, SupportEventInfra.FAVRO, null, avroTests, typeof(object));
        }
 private void AddMapEventType()
 {
     _epService.EPAdministrator.Configuration.AddEventType(SupportEventInfra.MAP_TYPENAME, SupportEventInfra.TwoEntryMap("indexed", typeof(string[]), "mapped", typeof(IDictionary <string, string>)));
 }