private void ok() { if ( Utils.isEmpty( wStepname.getText() ) ) { return; } stepname = wStepname.getText(); // return value input.setTypeField( wTypefield.getText() ); int i; // Table table = wFields.table; int nrfields = wFields.nrNonEmpty(); input.allocate( nrfields ); //CHECKSTYLE:Indentation:OFF for ( i = 0; i < nrfields; i++ ) { TableItem item = wFields.getNonEmpty( i ); input.getNormaliserFields()[i].setName( item.getText( NAME_INDEX ) ); input.getNormaliserFields()[i].setValue( item.getText( VALUE_INDEX ) ); input.getNormaliserFields()[i].setNorm( item.getText( NORM_INDEX ) ); } dispose(); }
@Test public void testNormaliserProcessRowsWikiData() throws Exception { // We should have 1 row as input to the normaliser and 3 rows as output to the normaliser with the data // shown on the Wiki page: http://wiki.pentaho.com/display/EAI/Row+Normaliser // // // Data input looks like this: // // DATE PR1_NR PR_SL PR2_NR PR2_SL PR3_NR PR3_SL // 2003010 5 100 10 250 4 150 // // Data output looks like this: // // DATE Type Product Sales Product Number // 2003010 Product1 100 5 // 2003010 Product2 250 10 // 2003010 Product3 150 4 // final String stepName = "Row Normaliser"; NormaliserMeta stepMeta = new NormaliserMeta(); stepMeta.setDefault(); stepMeta.setNormaliserFields( getTestNormaliserFieldsWiki() ); stepMeta.setTypeField( "Type" ); TransMeta transMeta = TransTestFactory.generateTestTransformation( null, stepMeta, stepName ); List<RowMetaAndData> inputList = getWikiInputRowMetaAndData(); List<RowMetaAndData> outputList = TransTestFactory.executeTestTransformation( transMeta, TransTestFactory.INJECTOR_STEPNAME, stepName, TransTestFactory.DUMMY_STEPNAME, inputList ); List<RowMetaAndData> expectedOutput = this.getExpectedWikiOutputRowMetaAndData(); checkResults( expectedOutput, outputList ); }