@Test public void createCommandLineTest() { setInternalState( teraDataBulkLoader, "tempScriptFile", "scriptValue" ); when( teraDataBulkLoaderMetaMock.getTbuildPath() ).thenReturn( "buildpathvalue" ); when( teraDataBulkLoaderMetaMock.getVariableFile() ).thenReturn( "variablefilevalue" ); when( teraDataBulkLoaderMetaMock.getJobName() ).thenReturn( "jobnamevalue" ); try { String commandLine = teraDataBulkLoader.createCommandLine(); String expected = "buildpathvalue -f scriptValue -v variablefilevalue jobnamevalue"; assertTrue( commandLine.contains( expected ) ); } catch ( KettleException e ) { fail( e.getMessage() ); } }
public String createCommandLine() throws KettleException { if ( StringUtils.isBlank( this.meta.getTbuildPath() ) ) { throw new KettleException( BaseMessages.getString( PKG, "TeraDataBulkLoader.Exception.BuildPathNotSet" ) ); } final StringBuilder builder = new StringBuilder(); try { final FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( this.meta.getTbuildPath() ) ); final String tbuildExec = KettleVFS.getFilename( fileObject ); builder.append( tbuildExec + " " ); builder.append( "-f " + this.tempScriptFile + " " ); if ( !this.meta.getGenerateScript() ) { String varfile = environmentSubstitute( this.meta.getVariableFile() ); if ( varfile != null && !varfile.equals( "" ) ) { builder.append( "-v " + varfile + " " ); } } builder.append( environmentSubstitute( this.meta.getJobName() ) ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "TeraDataBulkLoader.Exception.ErrorBuildAppString" ), e ); } return builder.toString(); }
TeraDataBulkLoader extends BaseStep implements StepInterface { public String createCommandLine() throws KettleException { if ( StringUtils.isBlank( this.meta.getTbuildPath() ) ) { throw new KettleException( BaseMessages.getString( PKG, "TeraDataBulkLoader.Exception.BuildPathNotSet" ) ); } final StringBuilder builder = new StringBuilder(); try { final FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( this.meta.getTbuildPath() ) ); final String tbuildExec = KettleVFS.getFilename( fileObject ); builder.append( tbuildExec + " " ); builder.append( "-f " + this.tempScriptFile + " " ); if ( !this.meta.getGenerateScript() ) { String varfile = environmentSubstitute( this.meta.getVariableFile() ); if ( varfile != null && !varfile.equals( "" ) ) { builder.append( "-v " + varfile + " " ); } } builder.append( environmentSubstitute( this.meta.getJobName() ) ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "TeraDataBulkLoader.Exception.ErrorBuildAppString" ), e ); } return builder.toString(); } }
TeraDataBulkLoader extends BaseStep implements StepInterface { public String createCommandLine() throws KettleException { if ( StringUtils.isBlank( this.meta.getTbuildPath() ) ) { throw new KettleException( BaseMessages.getString( PKG, "TeraDataBulkLoader.Exception.BuildPathNotSet" ) ); } final StringBuilder builder = new StringBuilder(); try { final FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( this.meta.getTbuildPath() ) ); final String tbuildExec = KettleVFS.getFilename( fileObject ); builder.append( tbuildExec + " " ); builder.append( "-f " + this.tempScriptFile + " " ); if ( !this.meta.getGenerateScript() ) { String varfile = environmentSubstitute( this.meta.getVariableFile() ); if ( varfile != null && !varfile.equals( "" ) ) { builder.append( "-v " + varfile + " " ); } } builder.append( environmentSubstitute( this.meta.getJobName() ) ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "TeraDataBulkLoader.Exception.ErrorBuildAppString" ), e ); } return builder.toString(); } TeraDataBulkLoader( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); }
TeraDataBulkLoader extends BaseStep implements StepInterface { public String createCommandLine() throws KettleException { if ( StringUtils.isBlank( this.meta.getTbuildPath() ) ) { throw new KettleException( BaseMessages.getString( PKG, "TeraDataBulkLoader.Exception.BuildPathNotSet" ) ); } final StringBuilder builder = new StringBuilder(); try { final FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( this.meta.getTbuildPath() ) ); final String tbuildExec = KettleVFS.getFilename( fileObject ); builder.append( tbuildExec + " " ); builder.append( "-f " + this.tempScriptFile + " " ); if ( !this.meta.getGenerateScript() ) { String varfile = environmentSubstitute( this.meta.getVariableFile() ); if ( varfile != null && !varfile.equals( "" ) ) { builder.append( "-v " + varfile + " " ); } } builder.append( environmentSubstitute( this.meta.getJobName() ) ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "TeraDataBulkLoader.Exception.ErrorBuildAppString" ), e ); } return builder.toString(); } TeraDataBulkLoader( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); boolean execute( TeraDataBulkLoaderMeta meta ); String createCommandLine(); String[] createEnvironmentVariables(); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
TeraDataBulkLoader extends BaseStep implements StepInterface { public String createCommandLine() throws KettleException { if ( StringUtils.isBlank( this.meta.getTbuildPath() ) ) { throw new KettleException( BaseMessages.getString( PKG, "TeraDataBulkLoader.Exception.BuildPathNotSet" ) ); } final StringBuilder builder = new StringBuilder(); try { final FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( this.meta.getTbuildPath() ) ); final String tbuildExec = KettleVFS.getFilename( fileObject ); builder.append( tbuildExec + " " ); builder.append( "-f " + this.tempScriptFile + " " ); if ( !this.meta.getGenerateScript() ) { String varfile = environmentSubstitute( this.meta.getVariableFile() ); if ( varfile != null && !varfile.equals( "" ) ) { builder.append( "-v " + varfile + " " ); } } builder.append( environmentSubstitute( this.meta.getJobName() ) ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "TeraDataBulkLoader.Exception.ErrorBuildAppString" ), e ); } return builder.toString(); } TeraDataBulkLoader( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); boolean execute( TeraDataBulkLoaderMeta meta ); String createCommandLine(); String[] createEnvironmentVariables(); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); static String[] ActionTypes; static String[] ScriptTypes; static final long DEFAULT_ERROR_CODE; }