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)); }
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 } }
/// <summary> /// Constructor. /// </summary> /// <param name="externallyTimedWindowViewFactory">for copying this view in a group-by</param> /// <param name="timestampExpression">is the field name containing a long timestamp valuethat should be in ascending order for the natural order of /// events and is intended to reflect /// System.currentTimeInMillis but does not necessarily have to. /// out of the window as oldData in the update method. The view compares /// each events timestamp against the newest event timestamp and those with a delta /// greater then secondsBeforeExpiry are pushed out of the window.</param> /// <param name="timestampExpressionEval">The timestamp expression eval.</param> /// <param name="timeDeltaComputation">The time delta computation.</param> /// <param name="viewUpdatedCollection">is a collection that the view must update when receiving events</param> /// <param name="agentInstanceViewFactoryContext">context for expression evalauation</param> public ExternallyTimedWindowView( ExternallyTimedWindowViewFactory externallyTimedWindowViewFactory, ExprNode timestampExpression, ExprEvaluator timestampExpressionEval, ExprTimePeriodEvalDeltaConst timeDeltaComputation, ViewUpdatedCollection viewUpdatedCollection, AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext) { _externallyTimedWindowViewFactory = externallyTimedWindowViewFactory; _timestampExpression = timestampExpression; _timestampExpressionEval = timestampExpressionEval; _timeDeltaComputation = timeDeltaComputation; _viewUpdatedCollection = viewUpdatedCollection; _timeWindow = new TimeWindow(agentInstanceViewFactoryContext.IsRemoveStream); AgentInstanceViewFactoryContext = agentInstanceViewFactoryContext; }
public void SetUp() { _factory = new ExternallyTimedWindowViewFactory(); }
public void SetUp() { _container = SupportContainer.Reset(); _factory = new ExternallyTimedWindowViewFactory(); }