public void TestCanReuse()
        {
            EventType parentType = SupportEventTypeFactory.CreateBeanType(typeof(SupportBean));

            _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { "LongBoxed", 1000 }));
            _factory.Attach(parentType, SupportStatementContextFactory.MakeContext(), null, null);
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null)));
            Assert.IsFalse(_factory.CanReuse(new ExternallyTimedWindowView(_factory, SupportExprNodeFactory.MakeIdentNodeBean("LongPrimitive"), null, new ExprTimePeriodEvalDeltaConstMsec(1000), null, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext())));
            Assert.IsFalse(_factory.CanReuse(new ExternallyTimedWindowView(_factory, SupportExprNodeFactory.MakeIdentNodeBean("LongBoxed"), null, new ExprTimePeriodEvalDeltaConstMsec(999), null, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext())));
            Assert.IsTrue(_factory.CanReuse(new ExternallyTimedWindowView(_factory, SupportExprNodeFactory.MakeIdentNodeBean("LongBoxed"), null, new ExprTimePeriodEvalDeltaConstMsec(1000000), null, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext())));
        }
Esempio n. 2
0
        private void TryParameter(Object[] @params, String fieldName, long msec)
        {
            ExternallyTimedWindowViewFactory factory = new ExternallyTimedWindowViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(@params));
            factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportBean)), SupportStatementContextFactory.MakeContext(), null, null);
            ExternallyTimedWindowView view = (ExternallyTimedWindowView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            Assert.AreEqual(fieldName, view.TimestampExpression.ToExpressionStringMinPrecedenceSafe());
            Assert.IsTrue(new ExprTimePeriodEvalDeltaConstGivenDelta(msec).EqualsTimePeriod(view.TimeDeltaComputation));
        }
Esempio n. 3
0
 private void TryInvalidParameter(Object[] param)
 {
     try
     {
         ExternallyTimedWindowViewFactory factory = new ExternallyTimedWindowViewFactory();
         factory.SetViewParameters(null, TestViewSupport.ToExprListBean(new Object[] { param }));
         factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportBean)), SupportStatementContextFactory.MakeContext(), null, null);
         Assert.Fail();
     }
     catch (ViewParameterException ex)
     {
         // expected
     }
 }