private void TryAssertion(EPServiceProvider epService, EPStatement stmt) { var listener = new SupportUpdateListener(); stmt.Events += listener.Update; string[] fields = "c0,c1".Split(','); foreach (string prop in fields) { Assert.AreEqual(typeof(SupportBean), stmt.EventType.GetPropertyDescriptor(prop).PropertyType); Assert.AreEqual(true, stmt.EventType.GetPropertyDescriptor(prop).IsFragment); Assert.AreEqual("SupportBean", stmt.EventType.GetFragmentType(prop).FragmentType.Name); } // there should be just 1 factory instance for all of the registered functions for this statement Assert.AreEqual(1, SupportAggMFFactory.Factories.Count); Assert.AreEqual(2, SupportAggMFFactory.FunctionDeclContexts.Count); for (int i = 0; i < 2; i++) { PlugInAggregationMultiFunctionDeclarationContext contextDecl = SupportAggMFFactory.FunctionDeclContexts[i]; Assert.AreEqual(i == 0 ? "se1" : "se2", contextDecl.FunctionName); Assert.AreEqual(EPServiceProviderConstants.DEFAULT_ENGINE_URI, contextDecl.EngineURI); Assert.IsFalse(contextDecl.IsDistinct); Assert.IsNotNull(contextDecl.Configuration); PlugInAggregationMultiFunctionValidationContext contextValid = SupportAggMFFactory.FunctionHandlerValidationContexts[i]; Assert.AreEqual(i == 0 ? "se1" : "se2", contextValid.FunctionName); Assert.AreEqual(EPServiceProviderConstants.DEFAULT_ENGINE_URI, contextValid.EngineURI); Assert.IsNotNull(contextValid.ParameterExpressions); Assert.IsNotNull(contextValid.AllParameterExpressions); Assert.IsNotNull(contextValid.Config); Assert.IsNotNull(contextValid.EventTypes); Assert.IsNotNull(contextValid.ValidationContext); Assert.IsNotNull(contextValid.StatementName); } Assert.AreEqual(2, SupportAggMFHandler.ProviderKeys.Count); Assert.AreEqual(2, SupportAggMFHandler.Accessors.Count); Assert.AreEqual(1, SupportAggMFHandler.ProviderFactories.Count); Assert.AreEqual(0, SupportAggMFFactorySingleEvent.StateContexts.Count); // group 1 var eventOne = new SupportBean("E1", 1); epService.EPRuntime.SendEvent(eventOne); EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] { eventOne, eventOne }); Assert.AreEqual(1, SupportAggMFFactorySingleEvent.StateContexts.Count); PlugInAggregationMultiFunctionStateContext context = SupportAggMFFactorySingleEvent.StateContexts[0]; Assert.AreEqual("E1", context.GroupKey); // group 2 var eventTwo = new SupportBean("E2", 2); epService.EPRuntime.SendEvent(eventTwo); EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] { eventTwo, eventTwo }); Assert.AreEqual(2, SupportAggMFFactorySingleEvent.StateContexts.Count); stmt.Dispose(); }
public AggregationState MakeAggregationState(PlugInAggregationMultiFunctionStateContext stateContext) { return(new SupportAggMFStateArrayCollScalar(this)); }
public AggregationState MakeAggregationState(PlugInAggregationMultiFunctionStateContext stateContext) { stateContexts.Add(stateContext);; return(new SupportAggMFStateSingleEvent()); }
public AggregationState MakeAccessAggPlugin(int agentInstanceId, int groupId, int aggregationId, bool join, PlugInAggregationMultiFunctionStateFactory providerFactory, object groupKey) { PlugInAggregationMultiFunctionStateContext context = new PlugInAggregationMultiFunctionStateContext(agentInstanceId, groupKey); return(providerFactory.MakeAggregationState(context)); }
public AggregationState CreateAccess(int agentInstanceId, bool join, object groupBy, AggregationServicePassThru passThru) { var context = new PlugInAggregationMultiFunctionStateContext(agentInstanceId, groupBy); return(StateFactory.MakeAggregationState(context)); }