@Test( expected = BundleWriterException.class ) public void writeKettleRepositoryProducer_exception_on_wrong_producer_type() throws IOException, BundleWriterException { KettleTransformationProducer producer = mock( KettleTransformationProducer.class ); handler.writeKettleRepositoryProducer( mock( WriteableDocumentBundle.class ), "TEST_FILE_NAME", mock( XmlWriter.class ), "TEST_QUERY_NAME", producer ); }
public void writeKettleRepositoryProducer( final WriteableDocumentBundle bundle, final String dataSourceFileName, final XmlWriter xmlWriter, final String queryName, final KettleTransformationProducer producer ) throws IOException, BundleWriterException { if ( producer instanceof EmbeddedKettleTransformationProducer == false ) { throw new BundleWriterException ( "Invalid object type registered for handler of " + EmbeddedKettleTransformationProducer.class .getSimpleName() ); } EmbeddedKettleTransformationProducer fileProducer = (EmbeddedKettleTransformationProducer) producer; String absoluteResourceName = writeFile( bundle, dataSourceFileName, queryName, fileProducer ); final AttributeList coreAttrs = new AttributeList(); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "name", queryName ); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "plugin-id", fileProducer.getPluginId() ); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "stop-on-error", String.valueOf( fileProducer.isStopOnError() ) ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "query-embedded", coreAttrs, XmlWriter.OPEN ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "resource", XmlWriter.OPEN ); final String resourceName = IOUtils.getInstance().createRelativePath( absoluteResourceName, dataSourceFileName ); xmlWriter.writeText( resourceName ); xmlWriter.writeCloseTag(); TransformationProducerWriteHandlerLib.writeParameterAndArguments( xmlWriter, fileProducer ); xmlWriter.writeCloseTag(); }
EmdeddedTransformationProducerWriteHandler implements TransformationProducerWriteHandler { public void writeKettleRepositoryProducer( final WriteableDocumentBundle bundle, final String dataSourceFileName, final XmlWriter xmlWriter, final String queryName, final KettleTransformationProducer producer ) throws IOException, BundleWriterException { if ( producer instanceof EmbeddedKettleTransformationProducer == false ) { throw new BundleWriterException ( "Invalid object type registered for handler of " + EmbeddedKettleTransformationProducer.class .getSimpleName() ); } EmbeddedKettleTransformationProducer fileProducer = (EmbeddedKettleTransformationProducer) producer; String absoluteResourceName = writeFile( bundle, dataSourceFileName, queryName, fileProducer ); final AttributeList coreAttrs = new AttributeList(); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "name", queryName ); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "plugin-id", fileProducer.getPluginId() ); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "stop-on-error", String.valueOf( fileProducer.isStopOnError() ) ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "query-embedded", coreAttrs, XmlWriter.OPEN ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "resource", XmlWriter.OPEN ); final String resourceName = IOUtils.getInstance().createRelativePath( absoluteResourceName, dataSourceFileName ); xmlWriter.writeText( resourceName ); xmlWriter.writeCloseTag(); TransformationProducerWriteHandlerLib.writeParameterAndArguments( xmlWriter, fileProducer ); xmlWriter.writeCloseTag(); } }
EmdeddedTransformationProducerWriteHandler implements TransformationProducerWriteHandler { public void writeKettleRepositoryProducer( final WriteableDocumentBundle bundle, final String dataSourceFileName, final XmlWriter xmlWriter, final String queryName, final KettleTransformationProducer producer ) throws IOException, BundleWriterException { if ( producer instanceof EmbeddedKettleTransformationProducer == false ) { throw new BundleWriterException ( "Invalid object type registered for handler of " + EmbeddedKettleTransformationProducer.class .getSimpleName() ); } EmbeddedKettleTransformationProducer fileProducer = (EmbeddedKettleTransformationProducer) producer; String absoluteResourceName = writeFile( bundle, dataSourceFileName, queryName, fileProducer ); final AttributeList coreAttrs = new AttributeList(); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "name", queryName ); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "plugin-id", fileProducer.getPluginId() ); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "stop-on-error", String.valueOf( fileProducer.isStopOnError() ) ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "query-embedded", coreAttrs, XmlWriter.OPEN ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "resource", XmlWriter.OPEN ); final String resourceName = IOUtils.getInstance().createRelativePath( absoluteResourceName, dataSourceFileName ); xmlWriter.writeText( resourceName ); xmlWriter.writeCloseTag(); TransformationProducerWriteHandlerLib.writeParameterAndArguments( xmlWriter, fileProducer ); xmlWriter.writeCloseTag(); } EmdeddedTransformationProducerWriteHandler(); }
EmdeddedTransformationProducerWriteHandler implements TransformationProducerWriteHandler { public void writeKettleRepositoryProducer( final WriteableDocumentBundle bundle, final String dataSourceFileName, final XmlWriter xmlWriter, final String queryName, final KettleTransformationProducer producer ) throws IOException, BundleWriterException { if ( producer instanceof EmbeddedKettleTransformationProducer == false ) { throw new BundleWriterException ( "Invalid object type registered for handler of " + EmbeddedKettleTransformationProducer.class .getSimpleName() ); } EmbeddedKettleTransformationProducer fileProducer = (EmbeddedKettleTransformationProducer) producer; String absoluteResourceName = writeFile( bundle, dataSourceFileName, queryName, fileProducer ); final AttributeList coreAttrs = new AttributeList(); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "name", queryName ); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "plugin-id", fileProducer.getPluginId() ); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "stop-on-error", String.valueOf( fileProducer.isStopOnError() ) ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "query-embedded", coreAttrs, XmlWriter.OPEN ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "resource", XmlWriter.OPEN ); final String resourceName = IOUtils.getInstance().createRelativePath( absoluteResourceName, dataSourceFileName ); xmlWriter.writeText( resourceName ); xmlWriter.writeCloseTag(); TransformationProducerWriteHandlerLib.writeParameterAndArguments( xmlWriter, fileProducer ); xmlWriter.writeCloseTag(); } EmdeddedTransformationProducerWriteHandler(); void writeKettleRepositoryProducer( final WriteableDocumentBundle bundle,
                                             final String dataSourceFileName,
                                             final XmlWriter xmlWriter,
                                             final String queryName,
                                             final KettleTransformationProducer producer ); }
EmdeddedTransformationProducerWriteHandler implements TransformationProducerWriteHandler { public void writeKettleRepositoryProducer( final WriteableDocumentBundle bundle, final String dataSourceFileName, final XmlWriter xmlWriter, final String queryName, final KettleTransformationProducer producer ) throws IOException, BundleWriterException { if ( producer instanceof EmbeddedKettleTransformationProducer == false ) { throw new BundleWriterException ( "Invalid object type registered for handler of " + EmbeddedKettleTransformationProducer.class .getSimpleName() ); } EmbeddedKettleTransformationProducer fileProducer = (EmbeddedKettleTransformationProducer) producer; String absoluteResourceName = writeFile( bundle, dataSourceFileName, queryName, fileProducer ); final AttributeList coreAttrs = new AttributeList(); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "name", queryName ); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "plugin-id", fileProducer.getPluginId() ); coreAttrs.setAttribute( KettleDataFactoryModule.NAMESPACE, "stop-on-error", String.valueOf( fileProducer.isStopOnError() ) ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "query-embedded", coreAttrs, XmlWriter.OPEN ); xmlWriter.writeTag( KettleDataFactoryModule.NAMESPACE, "resource", XmlWriter.OPEN ); final String resourceName = IOUtils.getInstance().createRelativePath( absoluteResourceName, dataSourceFileName ); xmlWriter.writeText( resourceName ); xmlWriter.writeCloseTag(); TransformationProducerWriteHandlerLib.writeParameterAndArguments( xmlWriter, fileProducer ); xmlWriter.writeCloseTag(); } EmdeddedTransformationProducerWriteHandler(); void writeKettleRepositoryProducer( final WriteableDocumentBundle bundle,
                                             final String dataSourceFileName,
                                             final XmlWriter xmlWriter,
                                             final String queryName,
                                             final KettleTransformationProducer producer );  }