@Test public void writeParameterAndArguments() throws IOException { XmlWriter xmlWriter = mock( XmlWriter.class ); AbstractKettleTransformationProducer fileProducer = mock( AbstractKettleTransformationProducer.class ); when( fileProducer.getArguments() ).thenReturn( new FormulaArgument[] { FormulaArgument.create( "TEST_REPORT_FIELD" ) } ); when( fileProducer.getParameter() ).thenReturn( new FormulaParameter[] { FormulaParameter.create( "TEST_REPORT_FIELD", "TEST_TRANS_PARAMETER_NAME" ) } ); TransformationProducerWriteHandlerLib.writeParameterAndArguments( xmlWriter, fileProducer ); verify( xmlWriter ).writeTag( KettleDataFactoryModule.NAMESPACE, "argument", "formula", "=[TEST_REPORT_FIELD]", XmlWriter.CLOSE ); verify( xmlWriter ).writeTag( eq( KettleDataFactoryModule.NAMESPACE ), eq( "variable" ), any( AttributeList.class ), eq( XmlWriter.CLOSE ) ); }
public static void writeParameterAndArguments( final XmlWriter xmlWriter, final AbstractKettleTransformationProducer fileProducer ) throws IOException { final FormulaArgument[] definedArgumentNames = fileProducer.getArguments(); final FormulaParameter[] parameterMappings = fileProducer.getParameter(); for ( int i = 0; i < definedArgumentNames.length; i++ ) { final FormulaArgument arg = definedArgumentNames[i]; xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "argument", "formula", arg.getFormula(), XmlWriter.CLOSE ); } for ( int i = 0; i < parameterMappings.length; i++ ) { final FormulaParameter parameterMapping = parameterMappings[i]; final AttributeList paramAttr = new AttributeList(); paramAttr.setAttribute( KettleDataFactoryModule.NAMESPACE, "variable-name", parameterMapping.getName() ); paramAttr.setAttribute( KettleDataFactoryModule.NAMESPACE, "formula", parameterMapping.getFormula() ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "variable", paramAttr, XmlWriter.CLOSE ); } }
TransformationProducerWriteHandlerLib { public static void writeParameterAndArguments( final XmlWriter xmlWriter, final AbstractKettleTransformationProducer fileProducer ) throws IOException { final FormulaArgument[] definedArgumentNames = fileProducer.getArguments(); final FormulaParameter[] parameterMappings = fileProducer.getParameter(); for ( int i = 0; i < definedArgumentNames.length; i++ ) { final FormulaArgument arg = definedArgumentNames[i]; xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "argument", "formula", arg.getFormula(), XmlWriter.CLOSE ); } for ( int i = 0; i < parameterMappings.length; i++ ) { final FormulaParameter parameterMapping = parameterMappings[i]; final AttributeList paramAttr = new AttributeList(); paramAttr.setAttribute( KettleDataFactoryModule.NAMESPACE, "variable-name", parameterMapping.getName() ); paramAttr.setAttribute( KettleDataFactoryModule.NAMESPACE, "formula", parameterMapping.getFormula() ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "variable", paramAttr, XmlWriter.CLOSE ); } } }
TransformationProducerWriteHandlerLib { public static void writeParameterAndArguments( final XmlWriter xmlWriter, final AbstractKettleTransformationProducer fileProducer ) throws IOException { final FormulaArgument[] definedArgumentNames = fileProducer.getArguments(); final FormulaParameter[] parameterMappings = fileProducer.getParameter(); for ( int i = 0; i < definedArgumentNames.length; i++ ) { final FormulaArgument arg = definedArgumentNames[i]; xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "argument", "formula", arg.getFormula(), XmlWriter.CLOSE ); } for ( int i = 0; i < parameterMappings.length; i++ ) { final FormulaParameter parameterMapping = parameterMappings[i]; final AttributeList paramAttr = new AttributeList(); paramAttr.setAttribute( KettleDataFactoryModule.NAMESPACE, "variable-name", parameterMapping.getName() ); paramAttr.setAttribute( KettleDataFactoryModule.NAMESPACE, "formula", parameterMapping.getFormula() ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "variable", paramAttr, XmlWriter.CLOSE ); } } private  TransformationProducerWriteHandlerLib(); }
TransformationProducerWriteHandlerLib { public static void writeParameterAndArguments( final XmlWriter xmlWriter, final AbstractKettleTransformationProducer fileProducer ) throws IOException { final FormulaArgument[] definedArgumentNames = fileProducer.getArguments(); final FormulaParameter[] parameterMappings = fileProducer.getParameter(); for ( int i = 0; i < definedArgumentNames.length; i++ ) { final FormulaArgument arg = definedArgumentNames[i]; xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "argument", "formula", arg.getFormula(), XmlWriter.CLOSE ); } for ( int i = 0; i < parameterMappings.length; i++ ) { final FormulaParameter parameterMapping = parameterMappings[i]; final AttributeList paramAttr = new AttributeList(); paramAttr.setAttribute( KettleDataFactoryModule.NAMESPACE, "variable-name", parameterMapping.getName() ); paramAttr.setAttribute( KettleDataFactoryModule.NAMESPACE, "formula", parameterMapping.getFormula() ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "variable", paramAttr, XmlWriter.CLOSE ); } } private  TransformationProducerWriteHandlerLib(); static void writeParameterAndArguments( final XmlWriter xmlWriter,
      final AbstractKettleTransformationProducer fileProducer ); }
TransformationProducerWriteHandlerLib { public static void writeParameterAndArguments( final XmlWriter xmlWriter, final AbstractKettleTransformationProducer fileProducer ) throws IOException { final FormulaArgument[] definedArgumentNames = fileProducer.getArguments(); final FormulaParameter[] parameterMappings = fileProducer.getParameter(); for ( int i = 0; i < definedArgumentNames.length; i++ ) { final FormulaArgument arg = definedArgumentNames[i]; xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "argument", "formula", arg.getFormula(), XmlWriter.CLOSE ); } for ( int i = 0; i < parameterMappings.length; i++ ) { final FormulaParameter parameterMapping = parameterMappings[i]; final AttributeList paramAttr = new AttributeList(); paramAttr.setAttribute( KettleDataFactoryModule.NAMESPACE, "variable-name", parameterMapping.getName() ); paramAttr.setAttribute( KettleDataFactoryModule.NAMESPACE, "formula", parameterMapping.getFormula() ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "variable", paramAttr, XmlWriter.CLOSE ); } } private  TransformationProducerWriteHandlerLib(); static void writeParameterAndArguments( final XmlWriter xmlWriter,
      final AbstractKettleTransformationProducer fileProducer );  }