Ejemplo n.º 1
0
 public void AddAggregationFunction(AggregationMultiFunctionDeclarationContext declarationContext)
 {
 }
        private static void TryAssertion(RegressionEnvironment env)
        {
            var fields    = "c0,c1".SplitCsv();
            var eventType = env.Statement("s0").EventType;

            foreach (var prop in fields)
            {
                Assert.AreEqual(typeof(SupportBean), eventType.GetPropertyDescriptor(prop).PropertyType);
                Assert.AreEqual(true, eventType.GetPropertyDescriptor(prop).IsFragment);
                Assert.AreEqual(typeof(SupportBean).FullName, eventType.GetFragmentType(prop).FragmentType.Name);
            }

            // there should be just 1 forge instance for all of the registered functions for this statement
            Assert.AreEqual(1, SupportAggMFMultiRTForge.Forges.Count);
            Assert.AreEqual(2, SupportAggMFMultiRTForge.FunctionDeclContexts.Count);
            for (var i = 0; i < 2; i++)
            {
                AggregationMultiFunctionDeclarationContext contextDecl = SupportAggMFMultiRTForge.FunctionDeclContexts[i];
                Assert.AreEqual(i == 0 ? "se1" : "se2", contextDecl.FunctionName);
                Assert.IsFalse(contextDecl.IsDistinct());
                Assert.IsNotNull(contextDecl.Configuration);

                AggregationMultiFunctionValidationContext contextValid = SupportAggMFMultiRTForge.FunctionHandlerValidationContexts[i];
                Assert.AreEqual(i == 0 ? "se1" : "se2", contextValid.FunctionName);
                Assert.IsNotNull(contextValid.ParameterExpressions);
                Assert.IsNotNull(contextValid.AllParameterExpressions);
                Assert.AreEqual("someinfovalue", contextValid.Config.AdditionalConfiguredProperties.Get("someinfokey"));
                Assert.IsNotNull(contextValid.EventTypes);
                Assert.IsNotNull(contextValid.ValidationContext);
                Assert.IsNotNull(contextValid.StatementName);
            }

            Assert.AreEqual(2, SupportAggMFMultiRTHandler.ProviderKeys.Count);
            if (!SupportAggMFMultiRTHandler.AccessorModes.IsEmpty())
            {
                Assert.AreEqual(2, SupportAggMFMultiRTHandler.AccessorModes.Count);
                Assert.AreEqual(1, SupportAggMFMultiRTHandler.StateFactoryModes.Count);
            }

            Assert.AreEqual(0, SupportAggMFMultiRTSingleEventStateFactory.StateContexts.Count);

            // group 1
            var eventOne = new SupportBean("E1", 1);

            env.SendEventBean(eventOne);
            EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] { eventOne, eventOne });
            if (!SupportAggMFMultiRTSingleEventStateFactory.StateContexts.IsEmpty())
            {
                Assert.AreEqual(1, SupportAggMFMultiRTSingleEventStateFactory.StateContexts.Count);
                SupportAggMFMultiRTSingleEventState context = SupportAggMFMultiRTSingleEventStateFactory.StateContexts[0];
                // Not available: assertEquals("E1", context.getGroupKey());
            }

            // group 2
            var eventTwo = new SupportBean("E2", 2);

            env.SendEventBean(eventTwo);
            EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] { eventTwo, eventTwo });
            if (!SupportAggMFMultiRTSingleEventStateFactory.StateContexts.IsEmpty())
            {
                Assert.AreEqual(2, SupportAggMFMultiRTSingleEventStateFactory.StateContexts.Count);
            }

            env.UndeployAll();
        }
Ejemplo n.º 3
0
 public void AddAggregationFunction(AggregationMultiFunctionDeclarationContext declarationContext)
 {
     Forges.Add(this);
     FunctionDeclContexts.Add(declarationContext);
 }