Example #1
0
        public void TestPlusMinusTimePeriod()
        {
            String startTime = "2002-05-30 9:00:00.000";

            _epService.EPRuntime.SendEvent(new CurrentTimeEvent(DateTimeParser.ParseDefaultMSec(startTime)));

            String[] fields      = "val0,val1,val2,val4,val5,val6".Split(',');
            String   eplFragment = "select " +
                                   "current_timestamp.plus(1 hour 10 sec 20 msec) as val0," +
                                   "utildate.plus(1 hour 10 sec 20 msec) as val1," +
                                   "msecdate.plus(1 hour 10 sec 20 msec) as val2," +
                                   "current_timestamp.minus(1 hour 10 sec 20 msec) as val4," +
                                   "utildate.minus(1 hour 10 sec 20 msec) as val5," +
                                   "msecdate.minus(1 hour 10 sec 20 msec) as val6" +
                                   " from SupportDateTime";
            EPStatement stmtFragment = _epService.EPAdministrator.CreateEPL(eplFragment);

            stmtFragment.Events += _listener.Update;
            LambdaAssertionUtil.AssertTypes(stmtFragment.EventType, fields, new Type[] { typeof(long?), typeof(DateTimeOffset?), typeof(long?), typeof(long?), typeof(DateTimeOffset?), typeof(long?) });

            _epService.EPRuntime.SendEvent(SupportDateTime.Make(startTime));
            Object[] expectedPlus  = SupportDateTime.GetArrayCoerced("2002-05-30 10:00:10.020", "msec", "util", "msec");
            Object[] expectedMinus = SupportDateTime.GetArrayCoerced("2002-05-30 07:59:49.980", "msec", "util", "msec");
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));

            _epService.EPRuntime.SendEvent(SupportDateTime.Make(null));
            expectedPlus  = SupportDateTime.GetArrayCoerced("2002-05-30 10:00:10.020", "msec", "null", "null");
            expectedMinus = SupportDateTime.GetArrayCoerced("2002-05-30 07:59:49.980", "msec", "null", "null");
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));
        }
Example #2
0
        private void RunAssertionPlusMinus(EPServiceProvider epService)
        {
            epService.EPAdministrator.CreateEPL("create variable long varmsec");
            string startTime = "2002-05-30T09:00:00.000";

            epService.EPRuntime.SendEvent(new CurrentTimeEvent(DateTimeParser.ParseDefaultMSec(startTime)));

            string[] fields      = "val0,val1,val2,val3,val4,val5".Split(',');
            string   eplFragment = "select " +
                                   "current_timestamp.Plus(varmsec) as val0," +
                                   "utildate.Plus(varmsec) as val1," +
                                   "longdate.Plus(varmsec) as val2," +
                                   "current_timestamp.minus(varmsec) as val3," +
                                   "utildate.Minus(varmsec) as val4," +
                                   "longdate.Minus(varmsec) as val5" +
                                   " from SupportDateTime";
            EPStatement stmtFragment = epService.EPAdministrator.CreateEPL(eplFragment);
            var         listener     = new SupportUpdateListener();

            stmtFragment.Events += listener.Update;
            LambdaAssertionUtil.AssertTypes(stmtFragment.EventType, fields, new Type[] {
                typeof(long?), typeof(DateTimeOffset?), typeof(long?),
                typeof(long?), typeof(DateTimeOffset?), typeof(long?)
            });

            epService.EPRuntime.SendEvent(SupportDateTime.Make(null));
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] {
                SupportDateTime.GetValueCoerced(startTime, "long"), null, null,
                SupportDateTime.GetValueCoerced(startTime, "long"), null, null
            });

            object[] expectedPlus  = SupportDateTime.GetArrayCoerced(startTime, "long", "util", "long");
            object[] expectedMinus = SupportDateTime.GetArrayCoerced(startTime, "long", "util", "long");
            epService.EPRuntime.SendEvent(SupportDateTime.Make(startTime));
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));

            epService.EPRuntime.SetVariableValue("varmsec", 1000);
            epService.EPRuntime.SendEvent(SupportDateTime.Make(startTime));
            //Log.Info("===> " + SupportDateTime.Print(listener.AssertOneGetNew().Get("val4")));
            expectedPlus  = SupportDateTime.GetArrayCoerced("2002-05-30T09:00:01.000", "long", "util", "long");
            expectedMinus = SupportDateTime.GetArrayCoerced("2002-05-30T08:59:59.000", "long", "util", "long");
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));

            epService.EPRuntime.SetVariableValue("varmsec", 2 * 24 * 60 * 60 * 1000);
            epService.EPRuntime.SendEvent(SupportDateTime.Make(startTime));
            expectedMinus = SupportDateTime.GetArrayCoerced("2002-05-28T09:00:00.000", "long", "util", "long");
            expectedPlus  = SupportDateTime.GetArrayCoerced("2002-06-1T09:00:00.000", "long", "util", "long");
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));

            stmtFragment.Dispose();
        }
Example #3
0
        public void TestPlusMinus()
        {
            _epService.EPAdministrator.CreateEPL("create variable long varmsec");
            String startTime = "2002-05-30 9:00:00.000";

            _epService.EPRuntime.SendEvent(new CurrentTimeEvent(DateTimeParser.ParseDefaultMSec(startTime)));

            String[] fields      = "val0,val1,val2,val4,val5,val6".Split(',');
            String   eplFragment = "select " +
                                   "current_timestamp.plus(varmsec) as val0," +
                                   "utildate.plus(varmsec) as val1," +
                                   "msecdate.plus(varmsec) as val2," +
                                   "current_timestamp.minus(varmsec) as val4," +
                                   "utildate.minus(varmsec) as val5," +
                                   "msecdate.minus(varmsec) as val6" +
                                   " from SupportDateTime";
            EPStatement stmtFragment = _epService.EPAdministrator.CreateEPL(eplFragment);

            stmtFragment.Events += _listener.Update;
            LambdaAssertionUtil.AssertTypes(stmtFragment.EventType, fields, new Type[] { typeof(long?), typeof(DateTimeOffset?), typeof(long?), typeof(long?), typeof(DateTimeOffset?), typeof(long?) });

            _epService.EPRuntime.SendEvent(SupportDateTime.Make(null));
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] {
                SupportDateTime.GetValueCoerced(startTime, "msec"), null, null,
                SupportDateTime.GetValueCoerced(startTime, "msec"), null, null,
            });

            Object[] expectedPlus  = SupportDateTime.GetArrayCoerced(startTime, "msec", "util", "msec");
            Object[] expectedMinus = SupportDateTime.GetArrayCoerced(startTime, "msec", "util", "msec");
            _epService.EPRuntime.SendEvent(SupportDateTime.Make(startTime));
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));

            _epService.EPRuntime.SetVariableValue("varmsec", 1000);
            _epService.EPRuntime.SendEvent(SupportDateTime.Make(startTime));
            //Console.WriteLine("===> " + SupportDateTime.Print(listener.AssertOneGetNew().Get("val4")));
            expectedPlus  = SupportDateTime.GetArrayCoerced("2002-05-30 09:00:01.000", "msec", "util", "msec");
            expectedMinus = SupportDateTime.GetArrayCoerced("2002-05-30 08:59:59.000", "msec", "util", "msec");
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));

            _epService.EPRuntime.SetVariableValue("varmsec", 2 * 24 * 60 * 60 * 1000);
            _epService.EPRuntime.SendEvent(SupportDateTime.Make(startTime));
            expectedMinus = SupportDateTime.GetArrayCoerced("2002-05-28 09:00:00.000", "msec", "util", "msec");
            expectedPlus  = SupportDateTime.GetArrayCoerced("2002-06-1 09:00:00.000", "msec", "util", "msec");
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));
        }
Example #4
0
        public override void Run(EPServiceProvider epService)
        {
            string startTime = "2002-05-30T09:00:00.000";

            epService.EPRuntime.SendEvent(new CurrentTimeEvent(DateTimeParser.ParseDefaultMSec(startTime)));

            string[] fields      = "val0,val1,val2,val3,val4,val5,val6,val7,val8".Split(',');
            string   eplFragment = "select " +
                                   "current_timestamp.toDate() as val0," +
                                   "utildate.toDate() as val1," +
                                   "longdate.toDate() as val2," +
                                   "current_timestamp.toCalendar() as val3," +
                                   "utildate.toCalendar() as val4," +
                                   "longdate.toCalendar() as val5," +
                                   "current_timestamp.toMillisec() as val6," +
                                   "utildate.toMillisec() as val7," +
                                   "longdate.toMillisec() as val8" +
                                   " from SupportDateTime";
            EPStatement stmtFragment = epService.EPAdministrator.CreateEPL(eplFragment);
            var         listener     = new SupportUpdateListener();

            stmtFragment.Events += listener.Update;
            LambdaAssertionUtil.AssertTypes(stmtFragment.EventType, fields, new Type[] {
                typeof(DateTimeOffset), typeof(DateTimeOffset), typeof(DateTimeOffset),
                typeof(DateTimeEx), typeof(DateTimeEx), typeof(DateTimeEx),
                typeof(long), typeof(long), typeof(long)
            });

            epService.EPRuntime.SendEvent(SupportDateTime.Make(startTime));
            object[] expectedUtil = SupportDateTime.GetArrayCoerced(startTime, "util", "util", "util");
            object[] expectedCal  = SupportDateTime.GetArrayCoerced(startTime, "cal", "cal", "cal");
            object[] expectedMsec = SupportDateTime.GetArrayCoerced(startTime, "long", "long", "long");
            object[] expected     = EPAssertionUtil.ConcatenateArray(expectedUtil, expectedCal, expectedMsec);
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, expected);

            epService.EPRuntime.SendEvent(SupportDateTime.Make(null));
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] {
                SupportDateTime.GetValueCoerced(startTime, "util"), null, null,
                SupportDateTime.GetValueCoerced(startTime, "cal"), null, null,
                SupportDateTime.GetValueCoerced(startTime, "long"), null, null
            });
        }
        public void TestToDateCalMilli()
        {
            String startTime = "2002-05-30 09:00:00.000";

            _epService.EPRuntime.SendEvent(new CurrentTimeEvent(DateTimeParser.ParseDefaultMSec(startTime)));

            String[] fields      = "val0,val1,val2,val4,val5,val6,val8,val9,val10".Split(',');
            String   eplFragment = "select " +
                                   "current_timestamp.ToDate() as val0," +
                                   "utildate.ToDate() as val1," +
                                   "msecdate.ToDate() as val2," +
                                   "current_timestamp.ToCalendar() as val4," +
                                   "utildate.ToCalendar() as val5," +
                                   "msecdate.ToCalendar() as val6," +
                                   "current_timestamp.ToMillisec() as val8," +
                                   "utildate.ToMillisec() as val9," +
                                   "msecdate.ToMillisec() as val10" +
                                   " from SupportDateTime";
            EPStatement stmtFragment = _epService.EPAdministrator.CreateEPL(eplFragment);

            stmtFragment.Events += _listener.Update;
            LambdaAssertionUtil.AssertTypes(stmtFragment.EventType, fields, new Type[] {
                typeof(DateTimeOffset?), typeof(DateTimeOffset?), typeof(DateTimeOffset?),
                typeof(DateTimeOffset?), typeof(DateTimeOffset?), typeof(DateTimeOffset?),
                typeof(long?), typeof(long?), typeof(long?)
            });

            _epService.EPRuntime.SendEvent(SupportDateTime.Make(startTime));
            Object[] expectedUtil = SupportDateTime.GetArrayCoerced(startTime, "util", "util", "util");
            Object[] expectedCal  = SupportDateTime.GetArrayCoerced(startTime, "cal", "cal", "cal");
            Object[] expectedMsec = SupportDateTime.GetArrayCoerced(startTime, "msec", "msec", "msec");
            Object[] expected     = EPAssertionUtil.ConcatenateArray(expectedUtil, expectedCal, expectedMsec);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, expected);

            _epService.EPRuntime.SendEvent(SupportDateTime.Make(null));
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] {
                SupportDateTime.GetValueCoerced(startTime, "util"), null, null,
                SupportDateTime.GetValueCoerced(startTime, "cal"), null, null,
                SupportDateTime.GetValueCoerced(startTime, "msec"), null, null,
            });
        }
Example #6
0
        private void RunAssertionPlusMinusTimePeriod(EPServiceProvider epService)
        {
            string startTime = "2002-05-30T09:00:00.000";

            epService.EPRuntime.SendEvent(new CurrentTimeEvent(DateTimeParser.ParseDefaultMSec(startTime)));

            string[] fields      = "val0,val1,val2,val3,val4,val5".Split(',');
            string   eplFragment = "select " +
                                   "current_timestamp.Plus(1 hour 10 sec 20 msec) as val0," +
                                   "utildate.Plus(1 hour 10 sec 20 msec) as val1," +
                                   "longdate.Plus(1 hour 10 sec 20 msec) as val2," +
                                   "current_timestamp.Minus(1 hour 10 sec 20 msec) as val3," +
                                   "utildate.Minus(1 hour 10 sec 20 msec) as val4," +
                                   "longdate.Minus(1 hour 10 sec 20 msec) as val5" +
                                   " from SupportDateTime";
            EPStatement stmtFragment = epService.EPAdministrator.CreateEPL(eplFragment);
            var         listener     = new SupportUpdateListener();

            stmtFragment.Events += listener.Update;
            LambdaAssertionUtil.AssertTypes(stmtFragment.EventType, fields, new Type[] {
                typeof(long?), typeof(DateTimeOffset?), typeof(long?),
                typeof(long?), typeof(DateTimeOffset?), typeof(long?)
            });

            epService.EPRuntime.SendEvent(SupportDateTime.Make(startTime));
            object[] expectedPlus  = SupportDateTime.GetArrayCoerced("2002-05-30T010:00:10.020", "long", "util", "long");
            object[] expectedMinus = SupportDateTime.GetArrayCoerced("2002-05-30T07:59:49.980", "long", "util", "long");
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));

            epService.EPRuntime.SendEvent(SupportDateTime.Make(null));
            expectedPlus  = SupportDateTime.GetArrayCoerced("2002-05-30T010:00:10.020", "long", "null", "null");
            expectedMinus = SupportDateTime.GetArrayCoerced("2002-05-30T07:59:49.980", "long", "null", "null");
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));

            stmtFragment.Dispose();
        }
Example #7
0
            public void Run(RegressionEnvironment env)
            {
                env.CompileDeploy("select current_timestamp.toDateTimeEx().AddDays(1) from SupportBean");

                var startTime = "2002-05-30T09:00:00.000";
                env.AdvanceTime(DateTimeParsingFunctions.ParseDefaultMSec(startTime));

                string[] fields = {
                    "val1a", "val1b", "val1c", "val1d", "val1e",
                    "val2a", "val2b", "val2c", "val2d", "val2e",
                    "val3a", "val3b", "val3c", "val3d", "val3e",
                    "val4a", "val4b", "val4c", "val4d", "val4e",
                };

                var eplFragment =
                    "@Name('s0') select " +

                    "current_timestamp.toDateTime() as val1a," +
                    "LongDate.toDateTime() as val1b," +
                    "DateTimeEx.toDateTime() as val1c," +
                    "DateTimeOffset.toDateTime() as val1d," +
                    "DateTimeEx.toDateTime() as val1e," +

                    "current_timestamp.toDateTimeOffset() as val2a," +
                    "LongDate.toDateTimeOffset() as val2b," +
                    "DateTime.toDateTimeOffset() as val2c," +
                    "DateTimeOffset.toDateTimeOffset() as val2d," +
                    "DateTimeEx.toDateTimeOffset() as val2e," +

                    "current_timestamp.toDateTimeEx() as val3a," +
                    "LongDate.toDateTimeEx() as val3b," +
                    "DateTime.toDateTimeEx() as val3c," +
                    "DateTimeOffset.toDateTimeEx() as val3d," +
                    "DateTimeEx.toDateTimeEx() as val3e," +

                    "current_timestamp.toMillisec() as val4a," +
                    "LongDate.toMillisec() as val4b," +
                    "DateTime.toMillisec() as val4c," +
                    "DateTimeOffset.toMillisec() as val4d," +
                    "DateTimeEx.toMillisec() as val4e" +

                    " from SupportDateTime";

                env.CompileDeploy(eplFragment).AddListener("s0");
                LambdaAssertionUtil.AssertTypes(
                    env.Statement("s0").EventType,
                    fields,
                    new[] {
                        typeof(DateTime?),
                        typeof(DateTime?),
                        typeof(DateTime?),
                        typeof(DateTime?),
                        typeof(DateTime?),

                        typeof(DateTimeOffset?),
                        typeof(DateTimeOffset?),
                        typeof(DateTimeOffset?),
                        typeof(DateTimeOffset?),
                        typeof(DateTimeOffset?),

                        typeof(DateTimeEx),
                        typeof(DateTimeEx),
                        typeof(DateTimeEx),
                        typeof(DateTimeEx),
                        typeof(DateTimeEx),

                        typeof(long?),
                        typeof(long?),
                        typeof(long?),
                        typeof(long?),
                        typeof(long?)
                    });

                env.SendEventBean(SupportDateTime.Make(startTime));

                var expected = EPAssertionUtil.ConcatenateArray(
                    SupportDateTime.GetArrayCoerced(startTime, "date".Repeat(5)),
                    SupportDateTime.GetArrayCoerced(startTime, "dto".Repeat(5)),
                    SupportDateTime.GetArrayCoerced(startTime, "dtx".Repeat(5)),
                    SupportDateTime.GetArrayCoerced(startTime, "long".Repeat(5)));

                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, expected);

                env.SendEventBean(SupportDateTime.Make(null));
                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    new[] {
                        SupportDateTime.GetValueCoerced(startTime, "date"), null, null, null, null,
                        SupportDateTime.GetValueCoerced(startTime, "dto"), null, null, null, null,
                        SupportDateTime.GetValueCoerced(startTime, "dtx"), null, null, null, null,
                        SupportDateTime.GetValueCoerced(startTime, "long"), null, null, null, null
                    });

                env.UndeployAll();
            }
Example #8
0
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                env.CompileDeploy("@Name('var') create variable long varmsec", path);
                var startTime = "2002-05-30T09:00:00.000";
                env.AdvanceTime(DateTimeParsingFunctions.ParseDefaultMSec(startTime));

                var fields = new[] {
                    "val1a", "val1b", "val1c", "val1d", "val1e",
                    "val2a", "val2b", "val2c", "val2d", "val2e",
                };
                var epl = "@Name('s0') select " +
                          
                          "current_timestamp.plus(varmsec) as val1a," +
                          "DateTimeEx.plus(varmsec) as val1b," +
                          "DateTimeOffset.plus(varmsec) as val1c," +
                          "DateTime.plus(varmsec) as val1d," +
                          "LongDate.plus(varmsec) as val1e," +

                          "current_timestamp.minus(varmsec) as val2a," +
                          "DateTimeEx.minus(varmsec) as val2b," +
                          "DateTimeOffset.minus(varmsec) as val2c," +
                          "DateTime.minus(varmsec) as val2d," +
                          "LongDate.minus(varmsec) as val2e" +

                          " from SupportDateTime";

                env.CompileDeploy(epl, path).AddListener("s0");
                LambdaAssertionUtil.AssertTypes(
                    env.Statement("s0").EventType,
                    fields,
                    new[] {
                        typeof(long?), typeof(DateTimeEx), typeof(DateTimeOffset?), typeof(DateTime?), typeof(long?),
                        typeof(long?), typeof(DateTimeEx), typeof(DateTimeOffset?), typeof(DateTime?), typeof(long?)
                    });

                env.SendEventBean(SupportDateTime.Make(null));

                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    new[] {
                        SupportDateTime.GetValueCoerced(startTime, "long"), null, null, null, null,
                        SupportDateTime.GetValueCoerced(startTime, "long"), null, null, null, null,
                    });

                var expectedPlus = SupportDateTime.GetArrayCoerced(startTime, "long", "dtx", "dto", "date", "long");
                var expectedMinus = SupportDateTime.GetArrayCoerced(startTime, "long", "dtx", "dto", "date", "long");
                env.SendEventBean(SupportDateTime.Make(startTime));

                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    EPAssertionUtil.ConcatenateArray(
                        expectedPlus,
                        expectedMinus));

                env.Runtime.VariableService.SetVariableValue(env.DeploymentId("var"), "varmsec", 1000);
                env.SendEventBean(SupportDateTime.Make(startTime));

                //System.out.println("==-> " + SupportDateTime.print(env.Listener("s0").assertOneGetNew().Get("val4")));
                expectedPlus = SupportDateTime.GetArrayCoerced(
                    "2002-05-30T09:00:01.000",
                    "long",
                    "dtx", 
                    "dto",
                    "date",
                    "long");
                expectedMinus = SupportDateTime.GetArrayCoerced(
                    "2002-05-30T08:59:59.000",
                    "long",
                    "dtx",
                    "dto",
                    "date",
                    "long");

                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    EPAssertionUtil.ConcatenateArray(
                        expectedPlus,
                        expectedMinus));

                env.Runtime.VariableService.SetVariableValue(
                    env.DeploymentId("var"),
                    "varmsec",
                    2 * 24 * 60 * 60 * 1000);
                env.SendEventBean(SupportDateTime.Make(startTime));
                expectedMinus = SupportDateTime.GetArrayCoerced(
                    "2002-05-28T09:00:00.000",
                    "long", 
                    "dtx",
                    "dto",
                    "date",
                    "long");
                expectedPlus = SupportDateTime.GetArrayCoerced(
                    "2002-06-1T09:00:00.000",
                    "long",
                    "dtx",
                    "dto",
                    "date",
                    "long");

                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    EPAssertionUtil.ConcatenateArray(
                        expectedPlus,
                        expectedMinus));

                env.UndeployAll();
            }
Example #9
0
            public void Run(RegressionEnvironment env)
            {
                var startTime = "2002-05-30T09:00:00.000";
                env.AdvanceTime(DateTimeParsingFunctions.ParseDefaultMSec(startTime));

                var fields = new[] {
                    "val1a",
                    "val1b",
                    "val1c",
                    "val1d",
                    "val1e",

                    "val2a",
                    "val2b",
                    "val2c",
                    "val2d",
                    "val2e"
                };
                var eplFragment = "@Name('s0') select " +
                                  
                                  "current_timestamp.plus(1 hour 10 sec 20 msec) as val1a," +
                                  "DateTimeEx.plus(1 hour 10 sec 20 msec) as val1b," +
                                  "DateTimeOffset.plus(1 hour 10 sec 20 msec) as val1c," +
                                  "DateTime.plus(1 hour 10 sec 20 msec) as val1d," +
                                  "LongDate.plus(1 hour 10 sec 20 msec) as val1e," +

                                  "current_timestamp.minus(1 hour 10 sec 20 msec) as val2a," +
                                  "DateTimeEx.minus(1 hour 10 sec 20 msec) as val2b," +
                                  "DateTimeOffset.minus(1 hour 10 sec 20 msec) as val2c," +
                                  "DateTime.minus(1 hour 10 sec 20 msec) as val2d," +
                                  "LongDate.minus(1 hour 10 sec 20 msec) as val2e" +

                                  " from SupportDateTime";

                env.CompileDeploy(eplFragment).AddListener("s0");
                LambdaAssertionUtil.AssertTypes(
                    env.Statement("s0").EventType,
                    fields,
                    new[] {
                        typeof(long?), typeof(DateTimeEx), typeof(DateTimeOffset?), typeof(DateTime?), typeof(long?),
                        typeof(long?), typeof(DateTimeEx), typeof(DateTimeOffset?), typeof(DateTime?), typeof(long?)
                    });

                env.SendEventBean(SupportDateTime.Make(startTime));
                var expectedPlus = SupportDateTime.GetArrayCoerced(
                    "2002-05-30T10:00:10.020",
                    "long",
                    "dtx",
                    "dto",
                    "date",
                    "long");
                var expectedMinus = SupportDateTime.GetArrayCoerced(
                    "2002-05-30T07:59:49.980",
                    "long",
                    "dtx",
                    "dto",
                    "date",
                    "long");

                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));

                env.SendEventBean(SupportDateTime.Make(null));
                expectedPlus = SupportDateTime.GetArrayCoerced(
                    "2002-05-30T10:00:10.020",
                    "long",
                    "null",
                    "null",
                    "null",
                    "null");
                expectedMinus = SupportDateTime.GetArrayCoerced(
                    "2002-05-30T07:59:49.980",
                    "long",
                    "null",
                    "null",
                    "null",
                    "null");

                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    EPAssertionUtil.ConcatenateArray(expectedPlus, expectedMinus));

                env.UndeployAll();
            }