本文整理汇总了Java中org.pentaho.di.core.playlist.FilePlayListAll类的典型用法代码示例。如果您正苦于以下问题:Java FilePlayListAll类的具体用法?Java FilePlayListAll怎么用?Java FilePlayListAll使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FilePlayListAll类属于org.pentaho.di.core.playlist包,在下文中一共展示了FilePlayListAll类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDataObject
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
private TextFileInputData createDataObject( String file,
String separator,
String... outputFields ) throws Exception {
TextFileInputData data = new TextFileInputData();
data.files = new FileInputList();
data.files.addFile( KettleVFS.getFileObject( file ) );
data.separator = separator;
data.outputRowMeta = new RowMeta();
if ( outputFields != null ) {
for ( String field : outputFields ) {
data.outputRowMeta.addValueMeta( new ValueMetaString( field ) );
}
}
data.dataErrorLineHandler = mock( FileErrorHandler.class );
data.fileFormatType = TextFileInputMeta.FILE_FORMAT_UNIX;
data.filterProcessor = new TextFileFilterProcessor( new TextFileFilter[ 0 ], new Variables() );
data.filePlayList = new FilePlayListAll();
return data;
}
示例2: initReplayFactory
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
private void initReplayFactory()
{
Date replayDate = getTrans().getReplayDate();
if (replayDate == null)
data.filePlayList = FilePlayListAll.INSTANCE;
else
data.filePlayList = new FilePlayListReplay(replayDate, meta.getLineNumberFilesDestinationDirectory(), meta.getLineNumberFilesExtension(), meta.getErrorFilesDestinationDirectory(), meta
.getErrorFilesExtension(), "Latin1");
}
示例3: initReplayFactory
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
private void initReplayFactory()
{
Date replayDate = getTrans().getReplayDate();
if (replayDate == null) data.filePlayList = FilePlayListAll.INSTANCE;
else data.filePlayList = new FilePlayListReplay(replayDate, meta.getLineNumberFilesDestinationDirectory(),
meta.getLineNumberFilesExtension(), meta.getErrorFilesDestinationDirectory(), meta.getErrorLineFilesExtension(), meta.getEncoding());
}
示例4: initReplayFactory
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
private void initReplayFactory()
{
Date replayDate = getTrans().getReplayDate();
if (replayDate == null)
data.filePlayList = FilePlayListAll.INSTANCE;
else
data.filePlayList = new FilePlayListReplay(replayDate, environmentSubstitute(meta.getLineNumberFilesDestinationDirectory()), meta.getLineNumberFilesExtension(), environmentSubstitute(meta.getErrorFilesDestinationDirectory()), meta
.getErrorFilesExtension(), "Latin1");
}
示例5: init
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
@Override
public boolean init() {
Date replayDate = getTrans().getReplayDate();
if ( replayDate == null ) {
data.filePlayList = FilePlayListAll.INSTANCE;
} else {
data.filePlayList =
new FilePlayListReplay( replayDate, meta.errorHandling.lineNumberFilesDestinationDirectory,
meta.errorHandling.lineNumberFilesExtension, meta.errorHandling.errorFilesDestinationDirectory,
meta.errorHandling.errorFilesExtension, meta.content.encoding );
}
data.filterProcessor = new TextFileFilterProcessor( meta.getFilter(), this );
// calculate the file format type in advance so we can use a switch
data.fileFormatType = meta.getFileFormatTypeNr();
// calculate the file type in advance CSV or Fixed?
data.fileType = meta.getFileTypeNr();
// Handle the possibility of a variable substitution
data.separator = environmentSubstitute( meta.content.separator );
data.enclosure = environmentSubstitute( meta.content.enclosure );
data.escapeCharacter = environmentSubstitute( meta.content.escapeCharacter );
// CSV without separator defined
if ( meta.content.fileType.equalsIgnoreCase( "CSV" ) && ( meta.content.separator == null || meta.content.separator
.isEmpty() ) ) {
logError( BaseMessages.getString( PKG, "TextFileInput.Exception.NoSeparator" ) );
return false;
}
return true;
}
示例6: initReplayFactory
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
private void initReplayFactory() {
Date replayDate = getTrans().getReplayDate();
if ( replayDate == null ) {
data.filePlayList = FilePlayListAll.INSTANCE;
} else {
data.filePlayList =
new FilePlayListReplay(
replayDate, environmentSubstitute( meta.getLineNumberFilesDestinationDirectory() ), meta
.getLineNumberFilesExtension(),
environmentSubstitute( meta.getErrorFilesDestinationDirectory() ), meta.getErrorFilesExtension(),
"Latin1" );
}
}
示例7: initReplayFactory
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
private void initReplayFactory() {
Date replayDate = getTrans().getReplayDate();
if ( replayDate == null ) {
data.filePlayList = FilePlayListAll.INSTANCE;
} else {
data.filePlayList =
new FilePlayListReplay( replayDate, meta.getLineNumberFilesDestinationDirectory(), meta
.getLineNumberFilesExtension(), meta.getErrorFilesDestinationDirectory(), meta
.getErrorLineFilesExtension(), meta.getEncoding() );
}
}
示例8: readWrappedInputWithoutHeaders
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
@Test
public void readWrappedInputWithoutHeaders() throws Exception {
final String content = new StringBuilder()
.append( "r1c1" ).append( '\n' ).append( ";r1c2\n" )
.append( "r2c1" ).append( '\n' ).append( ";r2c2" )
.toString();
final String virtualFile = createVirtualFile( "pdi-2607.txt", content );
TextFileInputMeta meta = new TextFileInputMeta();
meta.setLineWrapped( true );
meta.setNrWraps( 1 );
meta.setInputFields( new TextFileInputField[] { field( "col1" ), field( "col2" ) } );
meta.setFileCompression( "None" );
meta.setFileType( "CSV" );
meta.setHeader( false );
meta.setNrHeaderLines( -1 );
meta.setFooter( false );
meta.setNrFooterLines( -1 );
TextFileInputData data = new TextFileInputData();
data.setFiles( new FileInputList() );
data.getFiles().addFile( KettleVFS.getFileObject( virtualFile ) );
data.outputRowMeta = new RowMeta();
data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) );
data.outputRowMeta.addValueMeta( new ValueMetaString( "col2" ) );
data.dataErrorLineHandler = Mockito.mock( FileErrorHandler.class );
data.fileFormatType = TextFileInputMeta.FILE_FORMAT_UNIX;
data.separator = ";";
data.filterProcessor = new TextFileFilterProcessor( new TextFileFilter[ 0 ] );
data.filePlayList = new FilePlayListAll();
TextFileInput input = StepMockUtil.getStep( TextFileInput.class, TextFileInputMeta.class, "test" );
List<Object[]> output = TransTestingUtil.execute( input, meta, data, 2, false );
TransTestingUtil.assertResult( new Object[] { "r1c1", "r1c2" }, output.get( 0 ) );
TransTestingUtil.assertResult( new Object[] { "r2c1", "r2c2" }, output.get( 1 ) );
deleteVfsFile( virtualFile );
}
示例9: readInputWithMissedValues
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
@Test
public void readInputWithMissedValues() throws Exception {
final String virtualFile = createVirtualFile( "pdi-14172.txt", "1,1,1\n", "2,,2\n" );
TextFileInputMeta meta = new TextFileInputMeta();
TextFileInputField field2 = field( "col2" );
field2.setRepeated( true );
meta.setInputFields( new TextFileInputField[] {
field( "col1" ), field2, field( "col3" )
} );
meta.setFileCompression( "None" );
meta.setFileType( "CSV" );
meta.setHeader( false );
meta.setNrHeaderLines( -1 );
meta.setFooter( false );
meta.setNrFooterLines( -1 );
TextFileInputData data = new TextFileInputData();
data.setFiles( new FileInputList() );
data.getFiles().addFile( KettleVFS.getFileObject( virtualFile ) );
data.outputRowMeta = new RowMeta();
data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) );
data.outputRowMeta.addValueMeta( new ValueMetaString( "col2" ) );
data.outputRowMeta.addValueMeta( new ValueMetaString( "col3" ) );
data.dataErrorLineHandler = Mockito.mock( FileErrorHandler.class );
data.fileFormatType = TextFileInputMeta.FILE_FORMAT_UNIX;
data.separator = ",";
data.filterProcessor = new TextFileFilterProcessor( new TextFileFilter[ 0 ] );
data.filePlayList = new FilePlayListAll();
TextFileInput input = StepMockUtil.getStep( TextFileInput.class, TextFileInputMeta.class, "test" );
List<Object[]> output = TransTestingUtil.execute( input, meta, data, 2, false );
TransTestingUtil.assertResult( new Object[] { "1", "1", "1" }, output.get( 0 ) );
TransTestingUtil.assertResult( new Object[] { "2", "1", "2" }, output.get( 1 ) );
deleteVfsFile( virtualFile );
}
示例10: readInputWithDefaultValues
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
@Test
public void readInputWithDefaultValues() throws Exception {
final String virtualFile = createVirtualFile( "pdi-14832.txt", "1,\n" );
TextFileInputMeta meta = new TextFileInputMeta();
TextFileInputField field2 = field( "col2" );
field2.setIfNullValue( "DEFAULT" );
meta.setInputFields( new TextFileInputField[] { field( "col1" ), field2 } );
meta.setFileCompression( "None" );
meta.setFileType( "CSV" );
meta.setHeader( false );
meta.setNrHeaderLines( -1 );
meta.setFooter( false );
meta.setNrFooterLines( -1 );
TextFileInputData data = new TextFileInputData();
data.setFiles( new FileInputList() );
data.getFiles().addFile( KettleVFS.getFileObject( virtualFile ) );
data.outputRowMeta = new RowMeta();
data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) );
data.outputRowMeta.addValueMeta( new ValueMetaString( "col2" ) );
data.dataErrorLineHandler = Mockito.mock( FileErrorHandler.class );
data.fileFormatType = TextFileInputMeta.FILE_FORMAT_UNIX;
data.separator = ",";
data.filterProcessor = new TextFileFilterProcessor( new TextFileFilter[ 0 ] );
data.filePlayList = new FilePlayListAll();
TextFileInput input = StepMockUtil.getStep( TextFileInput.class, TextFileInputMeta.class, "test" );
List<Object[]> output = TransTestingUtil.execute( input, meta, data, 1, false );
TransTestingUtil.assertResult( new Object[] { "1", "DEFAULT" }, output.get( 0 ) );
deleteVfsFile( virtualFile );
}
示例11: testMinimalWidth_PDI_14253
import org.pentaho.di.core.playlist.FilePlayListAll; //导入依赖的package包/类
@Test
public void testMinimalWidth_PDI_14253() throws Exception {
final String virtualFile = "ram://pdi-14253.txt";
KettleVFS.getFileObject( virtualFile ).createFile();
final String content = "r1c1, r1c2\nr2c1 , r2c2 ";
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bos.write( content.getBytes() );
OutputStream os = KettleVFS.getFileObject( virtualFile ).getContent().getOutputStream();
IOUtils.copy( new ByteArrayInputStream( bos.toByteArray() ), os );
os.close();
TextFileInputMeta meta = new TextFileInputMeta();
meta.content.lineWrapped = false;
meta.inputFields = new BaseFileField[]{
new BaseFileField( "col1", -1, -1 ),
new BaseFileField( "col2", -1, -1 )
};
meta.content.fileCompression = "None";
meta.content.fileType = "CSV";
meta.content.header = false;
meta.content.nrHeaderLines = -1;
meta.content.footer = false;
meta.content.nrFooterLines = -1;
TextFileInputData data = new TextFileInputData();
data.files = new FileInputList();
data.files.addFile( KettleVFS.getFileObject( virtualFile ) );
data.outputRowMeta = new RowMeta();
data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) );
data.outputRowMeta.addValueMeta( new ValueMetaString( "col2" ) );
data.dataErrorLineHandler = mock( FileErrorHandler.class );
data.fileFormatType = TextFileInputMeta.FILE_FORMAT_UNIX;
data.separator = ",";
data.filterProcessor = new TextFileFilterProcessor( new TextFileFilter[0], new Variables() { } );
data.filePlayList = new FilePlayListAll();
TextFileInputDialog dialog =
new TextFileInputDialog( mock( Shell.class ), meta, mock( TransMeta.class ), "TFIMinimalWidthTest" );
TableView tv = mock( TableView.class );
when( tv.nrNonEmpty() ).thenReturn( 0 );
// click the Minimal width button
dialog.setMinimalWidth( tv );
RowSet output = new BlockingRowSet( 5 );
TextFileInput input = StepMockUtil.getStep( TextFileInput.class, TextFileInputMeta.class, "test" );
input.setOutputRowSets( Collections.singletonList( output ) );
while ( input.processRow( meta, data ) ) {
// wait until the step completes executing
}
Object[] row1 = output.getRowImmediate();
assertRow( row1, "r1c1", "r1c2" );
Object[] row2 = output.getRowImmediate();
assertRow( row2, "r2c1", "r2c2" );
KettleVFS.getFileObject( virtualFile ).delete();
}