@Test public void configureRelationalAggreation() { DefaultFlowController fc = Mockito.mock( DefaultFlowController.class ); DataSchema schema = Mockito.mock( DataSchema.class ); SubReport section = new SubReport(); AggregateFieldPreProcessor afpp = Mockito.spy( AggregateFieldPreProcessor.class ); Element element = new Element(); RelationalGroup group = Mockito.spy( new RelationalGroup() ); group.setName( "a" ); GroupDataBody groupBody = new GroupDataBody(); ItemBand ib = new ItemBand(); Mockito.doReturn( schema ).when( fc ).getDataSchema(); Mockito.doReturn( new String[] { "a" } ).when( schema ).getNames(); AggregationFunction o = Mockito.mock( AggregationFunction.class ); Object o1 = ItemSumFunction.class; try { element.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE, o1 ); ib.addElement( element ); groupBody.setElementAt(1, ib ); group.setElementAt(1, groupBody ); section.setElementAt( 2, group ); SubReport result = afpp.performPreProcessing( section, fc ); Mockito.verify( group, Mockito.times( 1 ) ).getGeneratedName(); String name = ( (ItemSumFunction) result.getExpressions().getExpression( 0 ) ).getGroup(); Assert.assertEquals( name, group.getGeneratedName() ); } catch ( Exception e ) { e.printStackTrace(); Assert.fail(); } }
private void configureRelationalAggreation( final ReportElement element, final AggregationFunction o ) { final String group = (String) element.getAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_GROUP ); if ( group != null ) { o.setGroup( group ); } else { final Group g = findGroup( element ); if ( g != null ) { o.setGroup( g.getGeneratedName() ); } } }
AggregateFieldPreProcessor extends AbstractReportPreProcessor { private void configureRelationalAggreation( final ReportElement element, final AggregationFunction o ) { final String group = (String) element.getAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_GROUP ); if ( group != null ) { o.setGroup( group ); } else { final Group g = findGroup( element ); if ( g != null ) { o.setGroup( g.getGeneratedName() ); } } } }
AggregateFieldPreProcessor extends AbstractReportPreProcessor { private void configureRelationalAggreation( final ReportElement element, final AggregationFunction o ) { final String group = (String) element.getAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_GROUP ); if ( group != null ) { o.setGroup( group ); } else { final Group g = findGroup( element ); if ( g != null ) { o.setGroup( g.getGeneratedName() ); } } } AggregateFieldPreProcessor(); }
AggregateFieldPreProcessor extends AbstractReportPreProcessor { private void configureRelationalAggreation( final ReportElement element, final AggregationFunction o ) { final String group = (String) element.getAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_GROUP ); if ( group != null ) { o.setGroup( group ); } else { final Group g = findGroup( element ); if ( g != null ) { o.setGroup( g.getGeneratedName() ); } } } AggregateFieldPreProcessor(); MasterReport performPreProcessing( final MasterReport definition, final DefaultFlowController flowController ); SubReport performPreProcessing( final SubReport definition, final DefaultFlowController flowController ); }
AggregateFieldPreProcessor extends AbstractReportPreProcessor { private void configureRelationalAggreation( final ReportElement element, final AggregationFunction o ) { final String group = (String) element.getAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_GROUP ); if ( group != null ) { o.setGroup( group ); } else { final Group g = findGroup( element ); if ( g != null ) { o.setGroup( g.getGeneratedName() ); } } } AggregateFieldPreProcessor(); MasterReport performPreProcessing( final MasterReport definition, final DefaultFlowController flowController ); SubReport performPreProcessing( final SubReport definition, final DefaultFlowController flowController );  }