public GenericExpressionRuntime( final TableModel data, final int currentRow, final ProcessingContext processingContext ) { this( new StaticDataRow(), data, currentRow, processingContext ); }
/** * Translates the given string and resolves the embedded property references. * * @param value * the raw value, * @return the fully translated string. */ public String translateAndLookup( final String value ) { return translateAndLookup( value, new StaticDataRow() ); }
protected DataRow computeData( Band band, ExpressionRuntime runtime ) { if ( band.getComputedStyle().getBooleanStyleProperty( ElementStyleKeys.VISIBLE ) == false ) { return new StaticDataRow(); } this.values.clear(); compute( band, runtime ); return new StaticDataRow( values ); }
@Test( expected = NullPointerException.class ) public void testCreationWithoutStaticDataRowParam() { StaticDataRow dataRow = null; new StaticDataRow( dataRow ); }
@Test( expected = NullPointerException.class ) public void testCreationWithoutNames() { new StaticDataRow( null, null ); }
@Test( expected = NullPointerException.class ) public void testCreationWithoutDataRowParam() { DataRow dataRow = null; new StaticDataRow( dataRow ); }
public void setup( final ParameterDefinitionEntry parameter, final DataAttributes globalAttributes, final ReportEnvironment reportEnvironment, final ResourceManager resourceManager ) throws ReportDataFactoryException { if ( globalAttributes == null ) { throw new NullPointerException(); } if ( parameter == null ) { throw new NullPointerException(); } this.globalAttributes = globalAttributes; this.entry = parameter; this.parameterContext = new DefaultParameterContext( new CompoundDataFactory(), new StaticDataRow(), ClassicEngineBoot.getInstance() .getGlobalConfig(), new DefaultResourceBundleFactory(), resourceManager, null, reportEnvironment ); }
@Test( expected = NullPointerException.class ) public void testCreationWithoutValues() { new StaticDataRow( new String[]{ }, null ); }
public DataFactory getDataFactoryForQuery( final String queryName, final boolean freeform ) { final DataRow dr = new StaticDataRow(); for ( int i = 0; i < size(); i++ ) { final DataFactory df = dataFactories.get( i ); if ( df instanceof CompoundDataFactorySupport ) { final CompoundDataFactorySupport cdf = (CompoundDataFactorySupport) df; final DataFactory r = cdf.getDataFactoryForQuery( queryName, freeform ); if ( r != null ) { return r; } } if ( ( isFreeFormQueryDataFactory( df ) == freeform ) && df.isQueryExecutable( queryName, dr ) ) { return df; } } return null; }
public GenericExpressionRuntime( final ExpressionRuntime runtime ) { this( new StaticDataRow( runtime.getDataRow() ), runtime.getData(), runtime.getCurrentRow(), runtime .getProcessingContext() ); }
@Test( expected = IllegalArgumentException.class ) public void testUpdateDataException() { String[] names = new String[]{ "name_0" }; Object[] values = new Object[]{ "value_0" }; StaticDataRow dataRow = new StaticDataRow( names, values ); Object[] newValues = new Object[]{ "new_value_0", "new_value_1" }; dataRow.updateData( newValues ); }
@Test public void testIsChanged() { StaticDataRow dataRow = new StaticDataRow(); assertThat( dataRow.isChanged( "test" ), is( equalTo( false ) ) ); }
@SuppressWarnings( "deprecation" ) @Test public void deprecatedConstructor_int_int() { final int limit = 1; final int timeout = 2; QueryDataRowWrapper wrapper = new QueryDataRowWrapper( new StaticDataRow(), limit, timeout ); assertEquals( wrapper.get( DataFactory.QUERY_LIMIT ), Integer.valueOf( limit ) ); assertEquals( wrapper.get( DataFactory.QUERY_TIMEOUT ), Integer.valueOf( timeout ) ); }
@Test public void testUpdateData() { String[] names = new String[]{ "name_0" }; Object[] values = new Object[]{ "value_0" }; StaticDataRow dataRow = new StaticDataRow( names, values ); Object[] newValues = new Object[]{ "new_value_0" }; dataRow.updateData( newValues ); assertThat( dataRow.getColumnNames(), is( equalTo( new String[]{ "name_0" } ) ) ); assertThat( (String) dataRow.get( "name_0" ), is( equalTo( "new_value_0" ) ) ); }
@SuppressWarnings( "deprecation" ) @Test public void deprecatedConstructor_Integer_Integer() { final Integer limit = 1; final Integer timeout = 2; QueryDataRowWrapper wrapper = new QueryDataRowWrapper( new StaticDataRow(), timeout, limit ); assertEquals( wrapper.get( DataFactory.QUERY_LIMIT ), limit ); assertEquals( wrapper.get( DataFactory.QUERY_TIMEOUT ), timeout ); } }
@Test public void testEquals() { StaticDataRow dataRow = new StaticDataRow(); assertThat( dataRow.equals( dataRow ), is( equalTo( true ) ) ); assertThat( dataRow.equals( "incorrect" ), is( equalTo( false ) ) ); String[] names = new String[]{ "name_0" }; Object[] values = new Object[]{ "value_0" }; StaticDataRow newDataRow = new StaticDataRow( names, values ); assertThat( dataRow.equals( newDataRow ), is( equalTo( false ) ) ); dataRow.setData( names, new Object[]{ "test_val" } ); assertThat( dataRow.equals( newDataRow ), is( equalTo( false ) ) ); dataRow.setData( names, values ); assertThat( dataRow.equals( newDataRow ), is( equalTo( true ) ) ); } }
@Test public void testExtraColumn() { QueryDataRowWrapper wrapper = new QueryDataRowWrapper( new StaticDataRow(), 10, 12, sortConstraintList ); String[] expecteds = { DataFactory.QUERY_LIMIT, DataFactory.QUERY_TIMEOUT, DataFactory.QUERY_SORT }; assertArrayEquals( expecteds, wrapper.getColumnNames() ); assertEquals( wrapper.get( DataFactory.QUERY_LIMIT ), Integer.valueOf( 12 ) ); assertEquals( wrapper.get( DataFactory.QUERY_TIMEOUT ), Integer.valueOf( 10 ) ); assertEquals( wrapper.get( DataFactory.QUERY_SORT ), sortConstraintList ); }
public void testQuotedExample() { final String example = "$(\"customer.firstName\") $(\"customer.lastName\")"; final MessageFormatSupport support = new MessageFormatSupport(); support.setFormatString( example ); support.performFormat( new StaticDataRow() ); assertEquals( "CompiledFormat", "{0} {1}", support.getCompiledFormat() ); }
public void testNestedPattern() { final MessageFormatSupport support = new MessageFormatSupport(); support.setFormatString( "$(null,choice,0#$(null)|0<$(dummy))" ); final StaticDataRow sdr = new StaticDataRow( new String[] { "null", "dummy" }, new Object[] { IntegerCache.getInteger( 0 ), IntegerCache.getInteger( 1 ) } ); final String text = support.performFormat( sdr ); assertEquals( "Expected content ", "0", text ); final StaticDataRow sdr2 = new StaticDataRow( new String[] { "null", "dummy" }, new Object[] { IntegerCache.getInteger( 1 ), IntegerCache.getInteger( 2 ) } ); support.setNullString( "-" ); final String ntext = support.performFormat( sdr2 ); assertEquals( "Expected content w nullString", "2", ntext ); } }
public void testComplexReplacement() { final MessageFormatSupport support = new MessageFormatSupport(); support.setFormatString( "$(null,number,integer), $(dummy), $(null,date), $(null,number,integer)" ); final StaticDataRow sdr = new StaticDataRow( new String[] { "null", "dummy" }, new String[] { null, "Content" } ); final String text = support.performFormat( sdr ); assertEquals( "Expected content w/o nullString", "<null>, Content, <null>, <null>", text ); support.setNullString( "-" ); final String ntext = support.performFormat( sdr ); assertEquals( "Expected content w nullString", "-, Content, -, -", ntext ); }