private static View copyChildView( GroupByView groupView, String[] propertyNames, Object groupByValues, AgentInstanceViewFactoryChainContext agentInstanceContext, View originalChildView) { if (originalChildView instanceof MergeView) { String message = "Unexpected merge view as child of group-by view"; log.fatal(".copySubViews " + message); throw new EPException(message); } if (!(originalChildView instanceof CloneableView)) { throw new EPException( "Unexpected error copying subview " + originalChildView.getClass().getName()); } CloneableView cloneableView = (CloneableView) originalChildView; // Copy child node View copyChildView = cloneableView.cloneView(); copyChildView.setParent(groupView); // Make the sub views for child copying from the original to the child copySubViews( groupView.getCriteriaExpressions(), propertyNames, groupByValues, originalChildView, copyChildView, agentInstanceContext); return copyChildView; }
private void tryParameter(Object[] params, String[] fieldNames) throws Exception { GroupByViewFactory factory = new GroupByViewFactory(); factory.setViewParameters(viewFactoryContext, TestViewSupport.toExprListBean(params)); factory.attach( SupportEventTypeFactory.createBeanType(SupportBean.class), SupportStatementContextFactory.makeContext(), null, null); GroupByView view = (GroupByView) factory.makeView(SupportStatementContextFactory.makeContext()); assertEquals(fieldNames[0], view.getCriteriaExpressions()[0].toExpressionString()); }