private void TryAssertionMultipleParams(EPServiceProvider epService, bool soda) { string text = "select irstream countboundary(1,10,IntPrimitive,*) as val from " + typeof(SupportBean).FullName; EPStatement statement = SupportModelHelper.CreateByCompileOrParse(epService, soda, text); var listener = new SupportUpdateListener(); statement.Events += listener.Update; AggregationValidationContext validContext = SupportPluginAggregationMethodThreeFactory.Contexts[0]; EPAssertionUtil.AssertEqualsExactOrder(new Type[] { typeof(int), typeof(int), typeof(int), typeof(SupportBean) }, validContext.ParameterTypes); EPAssertionUtil.AssertEqualsExactOrder(new object[] { 1, 10, null, null }, validContext.ConstantValues); EPAssertionUtil.AssertEqualsExactOrder(new bool[] { true, true, false, false }, validContext.IsConstantValue); var e1 = new SupportBean("E1", 5); epService.EPRuntime.SendEvent(e1); EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), "val", new object[] { 1 }, new object[] { 0 }); EPAssertionUtil.AssertEqualsExactOrder(new object[] { 1, 10, 5, e1 }, SupportPluginAggregationMethodThree.LastEnterParameters); epService.EPRuntime.SendEvent(new SupportBean("E1", 0)); EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), "val", new object[] { 1 }, new object[] { 1 }); epService.EPRuntime.SendEvent(new SupportBean("E1", 11)); EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), "val", new object[] { 1 }, new object[] { 1 }); epService.EPRuntime.SendEvent(new SupportBean("E1", 1)); EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), "val", new object[] { 2 }, new object[] { 1 }); epService.EPAdministrator.DestroyAllStatements(); }
public void Validate(AggregationValidationContext validationContext) { throw new ArgumentException("Invalid parameter type '" + validationContext.ParameterTypes[0].FullName + "', expecting string"); }
public void Validate(AggregationValidationContext validationContext) { contexts.Add(validationContext); }
public override AggregationMethodFactory ValidateAggregationChild(ExprValidationContext validationContext) { var positionalParams = PositionalParams; var parameterTypes = new Type[positionalParams.Length]; var constant = new Object[positionalParams.Length]; var isConstant = new bool[positionalParams.Length]; var expressions = new ExprNode[positionalParams.Length]; var count = 0; var hasDataWindows = true; var evaluateParams = new EvaluateParams(null, true, validationContext.ExprEvaluatorContext); foreach (var child in positionalParams) { if (child.IsConstantResult) { isConstant[count] = true; constant[count] = child.ExprEvaluator.Evaluate(evaluateParams); } parameterTypes[count] = child.ExprEvaluator.ReturnType; expressions[count] = child; if (!ExprNodeUtility.HasRemoveStreamForAggregations(child, validationContext.StreamTypeService, validationContext.IsResettingAggregations)) { hasDataWindows = false; } if (child is ExprWildcard) { ExprAggMultiFunctionUtil.CheckWildcardNotJoinOrSubquery(validationContext.StreamTypeService, _functionName); parameterTypes[count] = validationContext.StreamTypeService.EventTypes[0].UnderlyingType; isConstant[count] = false; constant[count] = null; } count++; } var context = new AggregationValidationContext(parameterTypes, isConstant, constant, base.IsDistinct, hasDataWindows, expressions); try { // the aggregation function factory is transient, obtain if not provided if (_aggregationFunctionFactory == null) { _aggregationFunctionFactory = validationContext.MethodResolutionService.EngineImportService.ResolveAggregationFactory(_functionName); } _aggregationFunctionFactory.Validate(context); } catch (Exception ex) { throw new ExprValidationException("Plug-in aggregation function '" + _functionName + "' failed validation: " + ex.Message, ex); } Type childType = null; if (positionalParams.Length > 0) { childType = positionalParams[0].ExprEvaluator.ReturnType; } return(new ExprPlugInAggFunctionFactory(this, _aggregationFunctionFactory, childType)); }
public void Validate(AggregationValidationContext validationContext) { }
public void Validate(AggregationValidationContext validationContext) { // No need to check the expression node type }
public void Validate(AggregationValidationContext validationContext) { Assert.IsNotNull(validationContext.NamedParameters.Get("filter").First()); }
public void Validate(AggregationValidationContext validationContext) { throw new ArgumentException(string.Format( "Invalid parameter type '{0}', expecting string", Name.Clean(validationContext.ParameterTypes[0]))); }