示例#1
0
        private void TryAssertionCreateSchema(
            RegressionEnvironment env,
            EventRepresentationChoice eventRepresentationEnum)
        {
            var startA = "2002-05-30T09:00:00.000";
            var endA = "2002-05-30T09:00:01.000";
            var startB = "2002-05-30T09:00:00.500";
            var endB = "2002-05-30T09:00:00.700";

            // test Map type Long-type timestamps
            RunAssertionCreateSchemaWTypes<MyLocalJsonProvidedLong>(
                env,
                eventRepresentationEnum,
                "long",
                DateTimeParsingFunctions.ParseDefaultMSec(startA),
                DateTimeParsingFunctions.ParseDefaultMSec(endA),
                DateTimeParsingFunctions.ParseDefaultMSec(startB),
                DateTimeParsingFunctions.ParseDefaultMSec(endB));

            // test Map type DateTimeEx-type timestamps
            if (!eventRepresentationEnum.IsAvroOrJsonEvent()) {
                RunAssertionCreateSchemaWTypes<MyLocalJsonProvidedDateTimeEx>(
                    env,
                    eventRepresentationEnum,
                    typeof(DateTimeEx).FullName,
                    DateTimeParsingFunctions.ParseDefaultEx(startA),
                    DateTimeParsingFunctions.ParseDefaultEx(endA),
                    DateTimeParsingFunctions.ParseDefaultEx(startB),
                    DateTimeParsingFunctions.ParseDefaultEx(endB));
            }

            // test Map type DateTimeOffset-type timestamps
            if (!eventRepresentationEnum.IsAvroOrJsonEvent()) {
                RunAssertionCreateSchemaWTypes<MyLocalJsonProvidedDateTimeOffset>(
                    env,
                    eventRepresentationEnum,
                    typeof(DateTimeOffset).FullName,
                    DateTimeParsingFunctions.ParseDefaultDateTimeOffset(startA),
                    DateTimeParsingFunctions.ParseDefaultDateTimeOffset(endA),
                    DateTimeParsingFunctions.ParseDefaultDateTimeOffset(startB),
                    DateTimeParsingFunctions.ParseDefaultDateTimeOffset(endB));
            }

            // test Map type DateTime-type timestamps
            if (!eventRepresentationEnum.IsAvroOrJsonEvent()) {
                RunAssertionCreateSchemaWTypes<MyLocalJsonProvidedDateTime>(
                    env,
                    eventRepresentationEnum,
                    typeof(DateTime).FullName,
                    DateTimeParsingFunctions.ParseDefaultDateTimeOffset(startA).DateTime,
                    DateTimeParsingFunctions.ParseDefaultDateTimeOffset(endA).DateTime,
                    DateTimeParsingFunctions.ParseDefaultDateTimeOffset(startB).DateTime,
                    DateTimeParsingFunctions.ParseDefaultDateTimeOffset(endB).DateTime);
            }
        }
示例#2
0
        private static void AssertCreateStreamTwo(
            EventRepresentationChoice eventRepresentationEnum,
            EventBean eventBean,
            EPStatement statement)
        {
            if (eventRepresentationEnum.IsAvroOrJsonEvent()) {
                Assert.AreEqual(1, eventBean.Get("myEvent.myId"));
            }
            else {
                Assert.IsTrue(eventBean.Get("myEvent") is EventBean);
                Assert.AreEqual(1, ((EventBean) eventBean.Get("myEvent")).Get("myId"));
            }

            Assert.IsNotNull(statement.EventType.GetFragmentType("myEvent"));
        }