@Test public void convertPostRepoSave() throws Exception { StreamToTransNodeConverter converter = mock( StreamToTransNodeConverter.class ); doCallRealMethod().when( converter ).convertPostRepoSave( any( RepositoryFile.class ) ); Repository repository = mock( Repository.class ); when( converter.connectToRepository() ).thenReturn( repository ); TransMeta transMeta = mock( TransMeta.class ); when( repository.loadTransformation( any(), anyString() ) ).thenReturn( transMeta ); RepositoryFile file = mock( RepositoryFile.class ); when( file.getId() ).thenReturn( "fileId" ); PluginMockInterface pluginInterface = mock( PluginMockInterface.class ); when( pluginInterface.getName() ).thenReturn( KettleExtensionPoint.TransImportAfterSaveToRepo.id ); when( pluginInterface.getMainType() ).thenReturn( (Class) ExtensionPointInterface.class ); when( pluginInterface.getIds() ).thenReturn( new String[] {"extensionpointId"} ); ExtensionPointInterface extensionPoint = mock( ExtensionPointInterface.class ); when( pluginInterface.loadClass( ExtensionPointInterface.class ) ).thenReturn( extensionPoint ); PluginRegistry.addPluginType( ExtensionPointPluginType.getInstance() ); PluginRegistry.getInstance().registerPlugin( ExtensionPointPluginType.class, pluginInterface ); converter.convertPostRepoSave( file ); verify( extensionPoint, times( 1 ) ).callExtensionPoint( any( LogChannelInterface.class ), same( transMeta ) ); }
public void convertPostRepoSave( RepositoryFile repositoryFile ) { if ( repositoryFile != null ) { try { Repository repo = connectToRepository(); if ( repo != null ) { TransMeta transMeta = repo.loadTransformation( new StringObjectId( repositoryFile.getId().toString() ), null ); ExtensionPointHandler.callExtensionPoint( new LogChannel( this ), KettleExtensionPoint.TransImportAfterSaveToRepo.id, transMeta ); } } catch ( Exception e ) { logger.error( KettleExtensionPoint.TransImportAfterSaveToRepo.id, e ); } } }
StreamToTransNodeConverter implements Converter { public void convertPostRepoSave( RepositoryFile repositoryFile ) { if ( repositoryFile != null ) { try { Repository repo = connectToRepository(); if ( repo != null ) { TransMeta transMeta = repo.loadTransformation( new StringObjectId( repositoryFile.getId().toString() ), null ); ExtensionPointHandler.callExtensionPoint( new LogChannel( this ), KettleExtensionPoint.TransImportAfterSaveToRepo.id, transMeta ); } } catch ( Exception e ) { logger.error( KettleExtensionPoint.TransImportAfterSaveToRepo.id, e ); } } } }
StreamToTransNodeConverter implements Converter { public void convertPostRepoSave( RepositoryFile repositoryFile ) { if ( repositoryFile != null ) { try { Repository repo = connectToRepository(); if ( repo != null ) { TransMeta transMeta = repo.loadTransformation( new StringObjectId( repositoryFile.getId().toString() ), null ); ExtensionPointHandler.callExtensionPoint( new LogChannel( this ), KettleExtensionPoint.TransImportAfterSaveToRepo.id, transMeta ); } } catch ( Exception e ) { logger.error( KettleExtensionPoint.TransImportAfterSaveToRepo.id, e ); } } } StreamToTransNodeConverter( IUnifiedRepository unifiedRepository ); }
StreamToTransNodeConverter implements Converter { public void convertPostRepoSave( RepositoryFile repositoryFile ) { if ( repositoryFile != null ) { try { Repository repo = connectToRepository(); if ( repo != null ) { TransMeta transMeta = repo.loadTransformation( new StringObjectId( repositoryFile.getId().toString() ), null ); ExtensionPointHandler.callExtensionPoint( new LogChannel( this ), KettleExtensionPoint.TransImportAfterSaveToRepo.id, transMeta ); } } catch ( Exception e ) { logger.error( KettleExtensionPoint.TransImportAfterSaveToRepo.id, e ); } } } StreamToTransNodeConverter( IUnifiedRepository unifiedRepository ); InputStream convert( final IRepositoryFileData data ); InputStream convert( final Serializable fileId ); IRepositoryFileData convert( final InputStream inputStream, final String charset, final String mimeType ); void convertPostRepoSave( RepositoryFile repositoryFile ); }
StreamToTransNodeConverter implements Converter { public void convertPostRepoSave( RepositoryFile repositoryFile ) { if ( repositoryFile != null ) { try { Repository repo = connectToRepository(); if ( repo != null ) { TransMeta transMeta = repo.loadTransformation( new StringObjectId( repositoryFile.getId().toString() ), null ); ExtensionPointHandler.callExtensionPoint( new LogChannel( this ), KettleExtensionPoint.TransImportAfterSaveToRepo.id, transMeta ); } } catch ( Exception e ) { logger.error( KettleExtensionPoint.TransImportAfterSaveToRepo.id, e ); } } } StreamToTransNodeConverter( IUnifiedRepository unifiedRepository ); InputStream convert( final IRepositoryFileData data ); InputStream convert( final Serializable fileId ); IRepositoryFileData convert( final InputStream inputStream, final String charset, final String mimeType ); void convertPostRepoSave( RepositoryFile repositoryFile );  }