Ejemplo n.º 1
0
        private void TryParameter(Object[] param)
        {
            LastElementViewFactory factory = new LastElementViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(param));
            Assert.IsTrue(factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()) is LastElementView);
        }
Ejemplo n.º 2
0
 public void TestCanReuse()
 {
     _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { 1000 }));
     Assert.IsFalse(_factory.CanReuse(new FirstElementView(null)));
     Assert.IsFalse(_factory.CanReuse(new LengthWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), _factory, 1, null)));
     Assert.IsTrue(_factory.CanReuse(new LengthWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), _factory, 1000, null)));
 }
Ejemplo n.º 3
0
 public void TestCanReuse()
 {
     _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { 1000 }));
     Assert.IsFalse(_factory.CanReuse(new FirstElementView(null)));
     Assert.IsFalse(_factory.CanReuse(new TimeBatchView(null, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), new ExprTimePeriodEvalDeltaConstMsec(1000), null, false, false, null)));
     Assert.IsTrue(_factory.CanReuse(new TimeWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), _factory, new ExprTimePeriodEvalDeltaConstMsec(1000000), null)));
 }
Ejemplo n.º 4
0
        private void TryParameter(Object[] param, int size)
        {
            var factory = new LengthWindowViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(param));
            var view = (LengthWindowView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            Assert.AreEqual(size, view.Size);
        }
        public void TestCanReuse()
        {
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext(_container);

            _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(_container), TestViewSupport.ToExprListBean(new Object[] { 1000 }));
            Assert.False(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            Assert.False(_factory.CanReuse(new LengthBatchView(null, _factory, 1, null), agentInstanceContext));
            Assert.True(_factory.CanReuse(new LengthBatchView(null, _factory, 1000, null), agentInstanceContext));
        }
Ejemplo n.º 6
0
        private void TryParameter(Object param, long msec)
        {
            var factory = new TimeWindowViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(_container), TestViewSupport.ToExprListBean(new Object[] { param }));
            var view = (TimeWindowView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container));

            Assert.AreEqual(msec, view.TimeDeltaComputation.DeltaAdd(0));
        }
Ejemplo n.º 7
0
        private void TryParameter(Object[] param, long msec, long?referencePoint)
        {
            var factory = new TimeBatchViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(param));
            var view = (TimeBatchView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            Assert.IsTrue(new ExprTimePeriodEvalDeltaConstGivenDelta(msec).EqualsTimePeriod(view.TimeDeltaComputation));
            Assert.AreEqual(referencePoint, view.InitialReferencePoint);
        }
Ejemplo n.º 8
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));
        }
        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())));
        }
Ejemplo n.º 10
0
 private void TryInvalidParameter(Object param)
 {
     try
     {
         _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { param }));
         Assert.Fail();
     }
     catch (ViewParameterException ex)
     {
         // expected
     }
 }
Ejemplo n.º 11
0
 private void TryInvalidParameter(Object param)
 {
     try
     {
         var factory = new TimeWindowViewFactory();
         factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(_container), TestViewSupport.ToExprListBean(new Object[] { param }));
         Assert.Fail();
     }
     catch (ViewParameterException)
     {
         // expected
     }
 }
Ejemplo n.º 12
0
        public void TestCanReuse()
        {
            var agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();

            _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { 1000 }));
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new TimeBatchView(_factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), new ExprTimePeriodEvalDeltaConstGivenDelta(1), null, false, false, null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new TimeBatchView(_factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), new ExprTimePeriodEvalDeltaConstGivenDelta(1000000), null, false, false, null), agentInstanceContext));

            _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { 1000, 2000L }));
            Assert.IsFalse(_factory.CanReuse(new TimeBatchView(_factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), new ExprTimePeriodEvalDeltaConstGivenDelta(1), null, false, false, null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new TimeBatchView(_factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), new ExprTimePeriodEvalDeltaConstGivenDelta(1000000), 2000L, false, false, null), agentInstanceContext));
        }