org.pentaho.di
Class TestUtilities

java.lang.Object
  extended by org.pentaho.di.TestUtilities

public class TestUtilities
extends Object


Constructor Summary
TestUtilities()
           
 
Method Summary
static void checkRows(List<RowMetaAndData> rows1, List<RowMetaAndData> rows2)
          Check the 2 lists comparing the rows in order.
static void checkRows(List<RowMetaAndData> rows1, List<RowMetaAndData> rows2, int fileNameColumn)
          Check the 2 lists comparing the rows in order.
static StepMeta createDummyStep(String name, PluginRegistry pluginRegistry)
          Creates a dummy
static String createEmptyTempFile(String fileName)
          Create an empty temp file and return it's absolute path.
static String createEmptyTempFile(String fileName, String suffix)
          Create an empty temp file and return it's absolute path.
static StepMeta createInjectorStep(String name, PluginRegistry pluginRegistry)
          Create an injector step.
static StepMeta createSortRowsStep(String name, String[] sortFields, boolean[] ascending, boolean[] caseSensitive, String directory, int sortSize, PluginRegistry pluginRegistry)
          Create and return a SortRows step.
static String createTempFolder(String folderName)
          Creates a the folder folderName under the java io temp directory.
static String getEndOfLineCharacters()
          Return the end of line character based on value returned by getFileFormat.
static String getFileFormat()
          Return the file format based on the OS type.
static String now()
          Returns the current date using this classes DATE_FORMAT_NOW format string.
static String writeTextFile(String folderName, String fileName, String delimiter)
          Write the file to be used as input (as a temporary file).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestUtilities

public TestUtilities()
Method Detail

getEndOfLineCharacters

public static String getEndOfLineCharacters()
Return the end of line character based on value returned by getFileFormat.

Returns:
the end of line character sequence

getFileFormat

public static String getFileFormat()
Return the file format based on the OS type. We set the file format to DOS if it is Windows since that is the only Windows file type that shows up in the TextFileInput dialog.

Returns:
String the file format

checkRows

public static void checkRows(List<RowMetaAndData> rows1,
                             List<RowMetaAndData> rows2)
                      throws TestFailedException
Check the 2 lists comparing the rows in order. If they are not the same fail the test.

Parameters:
rows1 - set 1 of rows to compare
rows2 - set 2 of rows to compare
Throws:
TestFailedException

checkRows

public static void checkRows(List<RowMetaAndData> rows1,
                             List<RowMetaAndData> rows2,
                             int fileNameColumn)
                      throws TestFailedException
Check the 2 lists comparing the rows in order. If they are not the same fail the test.

Parameters:
rows1 - set 1 of rows to compare
rows2 - set 2 of rows to compare
fileNameColumn - Number of the column containing the filename. This is only checked for being non-null (some systems maybe canonize names differently than we input).
Throws:
TestFailedException

createDummyStep

public static StepMeta createDummyStep(String name,
                                       PluginRegistry pluginRegistry)
Creates a dummy

Parameters:
name -
pluginRegistry -
Returns:
StepMata

createInjectorStep

public static StepMeta createInjectorStep(String name,
                                          PluginRegistry pluginRegistry)
Create an injector step.

Parameters:
name -
registry -
Returns:
StepMeta

createEmptyTempFile

public static String createEmptyTempFile(String fileName)
                                  throws IOException
Create an empty temp file and return it's absolute path.

Parameters:
fileName -
Returns:
Throws:
IOException

createEmptyTempFile

public static String createEmptyTempFile(String fileName,
                                         String suffix)
                                  throws IOException
Create an empty temp file and return it's absolute path.

Parameters:
fileName -
suffix - A suffix to add at the end of the file name
Returns:
Throws:
IOException

createTempFolder

public static String createTempFolder(String folderName)
Creates a the folder folderName under the java io temp directory. We suffix the file with ???

Parameters:
folderName -
Returns:

now

public static String now()
Returns the current date using this classes DATE_FORMAT_NOW format string.

Returns:

writeTextFile

public static String writeTextFile(String folderName,
                                   String fileName,
                                   String delimiter)
                            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

createSortRowsStep

public static StepMeta createSortRowsStep(String name,
                                          String[] sortFields,
                                          boolean[] ascending,
                                          boolean[] caseSensitive,
                                          String directory,
                                          int sortSize,
                                          PluginRegistry pluginRegistry)
Create and return a SortRows step.

Parameters:
name -
sortFields[] - Fields to sort by
ascending[] - Boolean indicating whether the corresponding field is to be sorted in ascending or descending order.
caseSensitive[] - Boolean indicating whether the corresponding field is to have case as a factor in the sort.
directory - The directory in the file system where the sort is to take place if it can't fit into memory?
sortSize - ???
pluginRegistry - The environment's Kettle plugin registry.
Returns: