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() { 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)); }
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)); }
public void TestIt() { var NOT_EXISTS = ValueWithExistsFlag.MultipleNotExists(6); // Bean SupportBeanComplexProps beanOne = SupportBeanComplexProps.MakeDefaultBean(); string n1_v = beanOne.Nested.NestedValue; string n1_n_v = beanOne.Nested.NestedNested.NestedNestedValue; SupportBeanComplexProps beanTwo = SupportBeanComplexProps.MakeDefaultBean(); beanTwo.Nested.NestedValue = "nested1"; beanTwo.Nested.NestedNested.SetNestedNestedValue("nested2"); var beanTests = new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>[] { new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>(new SupportBeanDynRoot(beanOne), ValueWithExistsFlag.AllExist(n1_v, n1_v, n1_n_v, n1_n_v, n1_n_v, n1_n_v)), new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>(new SupportBeanDynRoot(beanTwo), ValueWithExistsFlag.AllExist("nested1", "nested1", "nested2", "nested2", "nested2", "nested2")), new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>(new SupportBeanDynRoot("abc"), NOT_EXISTS) }; RunAssertion(BEAN_TYPENAME, SupportEventInfra.FBEAN, null, beanTests, typeof(object)); // Map IDictionary <string, object> mapOneL2 = new Dictionary <string, object>(); mapOneL2.Put("nestedNestedValue", 101); IDictionary <string, object> mapOneL1 = new Dictionary <string, object>(); mapOneL1.Put("nestedNested", mapOneL2); mapOneL1.Put("nestedValue", 100); IDictionary <string, object> mapOneL0 = new Dictionary <string, object>(); mapOneL0.Put("nested", mapOneL1); var mapOne = Collections.SingletonDataMap("item", mapOneL0); var mapTests = new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>[] { new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>(mapOne, ValueWithExistsFlag.AllExist(100, 100, 101, 101, 101, 101)), new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>(Collections.EmptyDataMap, NOT_EXISTS), }; RunAssertion(SupportEventInfra.MAP_TYPENAME, SupportEventInfra.FMAP, null, mapTests, typeof(object)); // Object-Array var oaOneL2 = new object[] { 101 }; var oaOneL1 = new object[] { oaOneL2, 100 }; var oaOneL0 = new object[] { oaOneL1 }; var oaOne = new object[] { oaOneL0 }; var oaTests = new Pair <object[], ValueWithExistsFlag[]>[] { new Pair <object[], ValueWithExistsFlag[]>(oaOne, ValueWithExistsFlag.AllExist(100, 100, 101, 101, 101, 101)), new Pair <object[], ValueWithExistsFlag[]>(new object[] { null }, NOT_EXISTS), }; RunAssertion(SupportEventInfra.OA_TYPENAME, SupportEventInfra.FOA, null, oaTests, typeof(object)); // XML var xmlTests = new Pair <string, ValueWithExistsFlag[]>[] { new Pair <string, ValueWithExistsFlag[]>("<item>\n" + "\t<nested nestedValue=\"100\">\n" + "\t\t<nestedNested nestedNestedValue=\"101\">\n" + "\t\t</nestedNested>\n" + "\t</nested>\n" + "</item>\n", ValueWithExistsFlag.AllExist("100", "100", "101", "101", "101", "101")), new Pair <string, ValueWithExistsFlag[]>("<item/>", NOT_EXISTS), }; RunAssertion(SupportEventInfra.XML_TYPENAME, SupportEventInfra.FXML, SupportEventInfra.XML_TO_VALUE, xmlTests, typeof(XmlNode)); // Avro var schema = GetAvroSchema(); var nestedSchema = AvroSchemaUtil.FindUnionRecordSchemaSingle( schema.GetField("item").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 emptyDatum = new GenericRecord(SchemaBuilder.Record(SupportEventInfra.AVRO_TYPENAME)); var avroTests = new Pair <object, ValueWithExistsFlag[]>[] { new Pair <object, ValueWithExistsFlag[]>(nestedDatum, ValueWithExistsFlag.AllExist(100, 100, 101, 101, 101, 101)), new Pair <object, ValueWithExistsFlag[]>(emptyDatum, NOT_EXISTS), new Pair <object, ValueWithExistsFlag[]>(null, NOT_EXISTS) }; RunAssertion(SupportEventInfra.AVRO_TYPENAME, FAVRO, null, avroTests, typeof(object)); }