public void SetupTest() { _supportExprNodeFactory = SupportExprNodeFactory.GetInstance(container); _existsNodes = new ExprPropertyExistsNode[2]; _existsNodes[0] = new ExprPropertyExistsNode(); _existsNodes[0].AddChildNode(_supportExprNodeFactory.MakeIdentNode("dummy?", "s0")); _existsNodes[1] = new ExprPropertyExistsNode(); _existsNodes[1].AddChildNode(_supportExprNodeFactory.MakeIdentNode("BoolPrimitive?", "s0")); }
public void SetUp() { _container = SupportContainer.Reset(); _agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext(_container); var selectExprEventTypeRegistry = new SelectExprEventTypeRegistry( "abc", new StatementEventTypeRefImpl(_container.RWLockManager())); var factory = new SelectExprProcessorHelper( Collections.GetEmptyList <int>(), SupportSelectExprFactory.MakeSelectListFromIdent("TheString", "s0"), Collections.GetEmptyList <SelectExprStreamDesc>(), null, null, false, new SupportStreamTypeSvc1Stream(), _container.Resolve <EventAdapterService>(), null, selectExprEventTypeRegistry, _agentInstanceContext.StatementContext.EngineImportService, 1, "stmtname", null, new Configuration(_container), null, new TableServiceImpl(_container), null); var selectProcessor = factory.GetEvaluator(); _supportAggregationService = new SupportAggregationService(); var groupKeyNodes = new ExprEvaluator[2]; groupKeyNodes[0] = SupportExprNodeFactory.MakeIdentNode("IntPrimitive", "s0").ExprEvaluator; groupKeyNodes[1] = SupportExprNodeFactory.MakeIdentNode("IntBoxed", "s0").ExprEvaluator; var prototype = new ResultSetProcessorRowPerGroupFactory(selectProcessor, null, groupKeyNodes, null, true, false, null, false, false, false, false, null, false, 1, null); _processor = (ResultSetProcessorRowPerGroup)prototype.Instantiate(null, _supportAggregationService, _agentInstanceContext); }
public void TestGetProcessorSimpleSelect() { // empty group-by and no event properties aggregated in select clause (wildcard), no having clause var wildcardSelect = new SelectClauseElementCompiled[] { new SelectClauseElementWildcard() }; var spec = MakeSpec(new SelectClauseSpecCompiled(wildcardSelect, false), null, _groupByList, null, null, _orderByList); var processor = ResultSetProcessorFactoryFactory.GetProcessorPrototype( spec, _stmtContext, _typeService3Stream, null, new bool[0], true, ContextPropertyRegistryImpl.EMPTY_REGISTRY, null, new Configuration(_container), null, false, false); Assert.IsTrue(processor.ResultSetProcessorFactory is ResultSetProcessorHandThroughFactory); // empty group-by with select clause elements var selectList = SupportSelectExprFactory.MakeNoAggregateSelectListUnnamed(); spec = MakeSpec(new SelectClauseSpecCompiled(selectList, false), null, _groupByList, null, null, _orderByList); processor = ResultSetProcessorFactoryFactory.GetProcessorPrototype( spec, _stmtContext, _typeService1Stream, null, new bool[0], true, ContextPropertyRegistryImpl.EMPTY_REGISTRY, null, new Configuration(_container), null, false, false); Assert.IsTrue(processor.ResultSetProcessorFactory is ResultSetProcessorHandThroughFactory); // non-empty group-by and wildcard select, group by ignored _groupByList.Add(SupportExprNodeFactory.MakeIdentNode("DoubleBoxed", "s0")); spec = MakeSpec(new SelectClauseSpecCompiled(wildcardSelect, false), null, _groupByList, null, null, _orderByList); processor = ResultSetProcessorFactoryFactory.GetProcessorPrototype( spec, _stmtContext, _typeService1Stream, null, new bool[0], true, ContextPropertyRegistryImpl.EMPTY_REGISTRY, null, new Configuration(_container), null, false, false); Assert.IsTrue(processor.ResultSetProcessorFactory is ResultSetProcessorSimpleFactory); }
public void TestGetProcessorInvalid() { var selectionList = new SelectClauseElementCompiled[2]; var identNode = SupportExprNodeFactory.MakeIdentNode("DoubleBoxed", "s0"); var mathNode = SupportExprNodeFactory.MakeMathNode(); selectionList[0] = new SelectClauseExprCompiledSpec(identNode, "result", "result", false); selectionList[1] = new SelectClauseExprCompiledSpec(mathNode, "result", "result", false); try { SelectExprProcessorFactory.GetProcessor( _container, Collections.GetEmptyList <int>(), selectionList, false, null, null, null, new SupportStreamTypeSvc3Stream(), null, null, null, null, null, null, null, null, null, null, null, 1, null, null, null, new Configuration(_container), null, null, null, null, null); Assert.Fail(); } catch (ExprValidationException) { // Expected } }
public void SetUp() { _existsNodes = new ExprPropertyExistsNode[2]; _existsNodes[0] = new ExprPropertyExistsNode(); _existsNodes[0].AddChildNode(SupportExprNodeFactory.MakeIdentNode("dummy?", "s0")); _existsNodes[1] = new ExprPropertyExistsNode(); _existsNodes[1].AddChildNode(SupportExprNodeFactory.MakeIdentNode("BoolPrimitive?", "s0")); }
public void TestGetProcessorRowPerGroup() { // with group-by and the non-aggregated event properties are all listed in the group by (output per group) // no having clause var selectList = SupportSelectExprFactory.MakeAggregateMixed(); _groupByList.Add(SupportExprNodeFactory.MakeIdentNode("DoubleBoxed", "s0")); var spec = MakeSpec(new SelectClauseSpecCompiled(selectList, false), null, _groupByList, null, null, _orderByList); var processor = ResultSetProcessorFactoryFactory.GetProcessorPrototype(spec, _stmtContext, _typeService1Stream, null, new bool[0], true, ContextPropertyRegistryImpl.EMPTY_REGISTRY, null, new Configuration()); Assert.IsTrue(processor.ResultSetProcessorFactory is ResultSetProcessorRowPerGroupFactory); }
public void TestGetProcessorValid() { var selectionList = new SelectClauseElementCompiled[1]; var identNode = SupportExprNodeFactory.MakeIdentNode("DoubleBoxed", "s0"); selectionList[0] = new SelectClauseExprCompiledSpec(identNode, "result", null, false); var statementContext = SupportStatementContextFactory.MakeContext(); var processor = SelectExprProcessorFactory.GetProcessor(Collections.GetEmptyList <int>(), selectionList, false, null, null, null, new SupportStreamTypeSvc3Stream(), SupportEventAdapterService.Service, _statementResultService, null, _selectExprEventTypeRegistry, statementContext.MethodResolutionService, null, null, null, null, null, null, null, null, null, null, new Configuration(), null, null, null); Assert.IsTrue(processor != null); }
public void TestGetProcessorAggregatingGrouped() { // with group-by but either // wildcard // or one or more non-aggregated event properties are not in the group by (output per event) var selectList = SupportSelectExprFactory.MakeAggregateMixed(); var identNode = SupportExprNodeFactory.MakeIdentNode("TheString", "s0"); selectList = (SelectClauseElementCompiled[])CollectionUtil.ArrayExpandAddSingle(selectList, new SelectClauseExprCompiledSpec(identNode, null, null, false)); _groupByList.Add(SupportExprNodeFactory.MakeIdentNode("DoubleBoxed", "s0")); var spec = MakeSpec(new SelectClauseSpecCompiled(selectList, false), null, _groupByList, null, null, _orderByList); var processor = ResultSetProcessorFactoryFactory.GetProcessorPrototype(spec, _stmtContext, _typeService1Stream, null, new bool[0], true, ContextPropertyRegistryImpl.EMPTY_REGISTRY, null, new Configuration()); Assert.IsTrue(processor.ResultSetProcessorFactory is ResultSetProcessorAggregateGroupedFactory); }