org.pentaho.di.trans.steps.textfileinput
Class TextFileInputTests

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.pentaho.di.trans.steps.textfileinput.TextFileInputTests
All Implemented Interfaces:
junit.framework.Test

public class TextFileInputTests
extends junit.framework.TestCase

This class was a "copy and modification" of Kettle's CsvInput1Test. I added comments as I was learning the architecture of the class.

Author:
sflatley

Constructor Summary
TextFileInputTests()
           
 
Method Summary
 List<RowMetaAndData> createData(String fileName)
          Creates data...
 List<RowMetaAndData> createResultData1()
          Create result data for test case 1.
 RowMetaInterface createResultRowMetaInterface()
          Creates a row meta interface for the fields that are defined by performing a getFields and by checking "Result filenames - Add filenames to result from "Text File Input" dialog.
 RowMetaInterface createRowMetaInterface()
          Creates a RowMetaInterface with a ValueMetaInterface with the name "filename".
 void testGetLine_FILE_FORMAT_MIXED()
          Verify that lines are properly identified when parsing a mixed format file.
 void testTextFileInput1()
           
 String writeInputFile()
          Write the file to be used as input (as a temporary file).
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, runBare, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextFileInputTests

public TextFileInputTests()
Method Detail

writeInputFile

public String writeInputFile()
                      throws IOException
Write the file to be used as input (as a temporary file).

Returns:
Absolute file name/path of the created file.
Throws:
IOException - UPON

createResultData1

public List<RowMetaAndData> createResultData1()
Create result data for test case 1. Each Object array in element in list should mirror the data written by writeInputFile().

Returns:
list of metadata/data couples of how the result should look like.

createRowMetaInterface

public RowMetaInterface createRowMetaInterface()
Creates a RowMetaInterface with a ValueMetaInterface with the name "filename".

Returns:

createData

public List<RowMetaAndData> createData(String fileName)
Creates data... Will add more as I figure what the data is.

Parameters:
fileName -
Returns:

createResultRowMetaInterface

public RowMetaInterface createResultRowMetaInterface()
Creates a row meta interface for the fields that are defined by performing a getFields and by checking "Result filenames - Add filenames to result from "Text File Input" dialog.

Returns:

testTextFileInput1

public void testTextFileInput1()
                        throws Exception
Throws:
Exception

testGetLine_FILE_FORMAT_MIXED

public void testGetLine_FILE_FORMAT_MIXED()
                                   throws Exception
Verify that lines are properly identified when parsing a mixed format file.

Throws:
Exception