@Test public void testProcessLinkedJobsWithNoFilename() { JobExecutorMeta jobExecutorMeta = spy( new JobExecutorMeta() ); jobExecutorMeta.setFileName( null ); jobExecutorMeta.setDirectoryPath( "/path/to" ); jobExecutorMeta.setJobName( "Job1" ); jobExecutorMeta.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); StepMeta transExecutorStep = mock( StepMeta.class ); when( transExecutorStep.getStepID() ).thenReturn( "JobExecutor" ); when( transExecutorStep.getStepMetaInterface() ).thenReturn( jobExecutorMeta ); TransMeta parent = mock( TransMeta.class ); when( parent.getSteps() ).thenReturn( Arrays.asList( transExecutorStep ) ); TransMeta result = transFileListener.processLinkedJobs( parent ); boolean found = false; for ( StepMeta stepMeta : result.getSteps() ) { if ( stepMeta.getStepID().equalsIgnoreCase( "JobExecutor" ) ) { found = true; JobExecutorMeta resultExecMeta = (JobExecutorMeta) stepMeta.getStepMetaInterface(); assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, resultExecMeta.getSpecificationMethod() ); assertEquals( resultExecMeta.getDirectoryPath(), "/path/to" ); assertEquals( resultExecMeta.getJobName(), "Job1" ); } } assertTrue( found ); }
protected TransMeta processLinkedJobs( TransMeta transMeta ) { for ( StepMeta stepMeta : transMeta.getSteps() ) { if ( stepMeta.getStepID().equalsIgnoreCase( "JobExecutor" ) ) { JobExecutorMeta jem = (JobExecutorMeta) stepMeta.getStepMetaInterface(); ObjectLocationSpecificationMethod specMethod = jem.getSpecificationMethod(); if ( specMethod == ObjectLocationSpecificationMethod.FILENAME ) { jem.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); String filename = jem.getFileName(); String jobname = filename.substring( filename.lastIndexOf( "/" ) + 1, filename.lastIndexOf( '.' ) ); String directory = filename.substring( 0, filename.lastIndexOf( "/" ) ); jem.setJobName( jobname ); jem.setDirectoryPath( directory ); } } } return transMeta; }
TransFileListener implements FileListener { protected TransMeta processLinkedJobs( TransMeta transMeta ) { for ( StepMeta stepMeta : transMeta.getSteps() ) { if ( stepMeta.getStepID().equalsIgnoreCase( "JobExecutor" ) ) { JobExecutorMeta jem = (JobExecutorMeta) stepMeta.getStepMetaInterface(); ObjectLocationSpecificationMethod specMethod = jem.getSpecificationMethod(); if ( specMethod == ObjectLocationSpecificationMethod.FILENAME ) { jem.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); String filename = jem.getFileName(); String jobname = filename.substring( filename.lastIndexOf( "/" ) + 1, filename.lastIndexOf( '.' ) ); String directory = filename.substring( 0, filename.lastIndexOf( "/" ) ); jem.setJobName( jobname ); jem.setDirectoryPath( directory ); } } } return transMeta; } }
TransFileListener implements FileListener { protected TransMeta processLinkedJobs( TransMeta transMeta ) { for ( StepMeta stepMeta : transMeta.getSteps() ) { if ( stepMeta.getStepID().equalsIgnoreCase( "JobExecutor" ) ) { JobExecutorMeta jem = (JobExecutorMeta) stepMeta.getStepMetaInterface(); ObjectLocationSpecificationMethod specMethod = jem.getSpecificationMethod(); if ( specMethod == ObjectLocationSpecificationMethod.FILENAME ) { jem.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); String filename = jem.getFileName(); String jobname = filename.substring( filename.lastIndexOf( "/" ) + 1, filename.lastIndexOf( '.' ) ); String directory = filename.substring( 0, filename.lastIndexOf( "/" ) ); jem.setJobName( jobname ); jem.setDirectoryPath( directory ); } } } return transMeta; }  }
TransFileListener implements FileListener { protected TransMeta processLinkedJobs( TransMeta transMeta ) { for ( StepMeta stepMeta : transMeta.getSteps() ) { if ( stepMeta.getStepID().equalsIgnoreCase( "JobExecutor" ) ) { JobExecutorMeta jem = (JobExecutorMeta) stepMeta.getStepMetaInterface(); ObjectLocationSpecificationMethod specMethod = jem.getSpecificationMethod(); if ( specMethod == ObjectLocationSpecificationMethod.FILENAME ) { jem.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); String filename = jem.getFileName(); String jobname = filename.substring( filename.lastIndexOf( "/" ) + 1, filename.lastIndexOf( '.' ) ); String directory = filename.substring( 0, filename.lastIndexOf( "/" ) ); jem.setJobName( jobname ); jem.setDirectoryPath( directory ); } } } return transMeta; }  boolean open( Node transNode, String fname, boolean importfile ); boolean save( EngineMetaInterface meta, String fname, boolean export ); void syncMetaName( EngineMetaInterface meta, String name ); boolean accepts( String fileName ); boolean acceptsXml( String nodeName ); String[] getFileTypeDisplayNames( Locale locale ); String getRootNodeName(); String[] getSupportedExtensions(); }
TransFileListener implements FileListener { protected TransMeta processLinkedJobs( TransMeta transMeta ) { for ( StepMeta stepMeta : transMeta.getSteps() ) { if ( stepMeta.getStepID().equalsIgnoreCase( "JobExecutor" ) ) { JobExecutorMeta jem = (JobExecutorMeta) stepMeta.getStepMetaInterface(); ObjectLocationSpecificationMethod specMethod = jem.getSpecificationMethod(); if ( specMethod == ObjectLocationSpecificationMethod.FILENAME ) { jem.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); String filename = jem.getFileName(); String jobname = filename.substring( filename.lastIndexOf( "/" ) + 1, filename.lastIndexOf( '.' ) ); String directory = filename.substring( 0, filename.lastIndexOf( "/" ) ); jem.setJobName( jobname ); jem.setDirectoryPath( directory ); } } } return transMeta; }  boolean open( Node transNode, String fname, boolean importfile ); boolean save( EngineMetaInterface meta, String fname, boolean export ); void syncMetaName( EngineMetaInterface meta, String name ); boolean accepts( String fileName ); boolean acceptsXml( String nodeName ); String[] getFileTypeDisplayNames( Locale locale ); String getRootNodeName(); String[] getSupportedExtensions();  }