org.pentaho.di.trans.steps.splitfieldtorows
Class SplitFieldToRowsTest

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

public class SplitFieldToRowsTest
extends junit.framework.TestCase

Test class for the SplitFieldToRows step. The expected results were obtained by running the "Split field To Rows" Kettle step with Spoon 4.3.0.

Author:
Sean Flatley

Constructor Summary
SplitFieldToRowsTest()
           
 
Method Summary
 List<RowMetaAndData> createData(String value)
          Create a list of RowMetaAndData from the passed value and returns it.
 RowMetaInterface createRowMetaInterface()
          Creates the row meta interface.
 List<RowMetaAndData> splitFieldToRows(String testName, String stringToSplit, boolean isDelimiterRegex, String delimiter)
          Splits the "stringToSplit" with the passed "delimiter".
 List<RowMetaAndData> splitFieldToRows(String testName, String stringToSplit, boolean isDelimiterRegex, String delimiter, String delimiterVariableValue)
          Splits the "stringToSplit" with the passed "delimiter".
 List<RowMetaAndData> test(String testName, String stringToSplit, boolean isDelimiterRegex, String delimiter, String[] expectedResult)
          Execute a test with the passed parameters.
 List<RowMetaAndData> test(String testName, String stringToSplit, boolean isDelimiterRegex, String delimiter, String delimiterVariableValue, String[] expectedResult)
          Execute a test with the passed parameters.
 void testNonRegex1()
          Test: Non regex, delimiter = ";"
 void testNonRegex2()
          Test: Non regex, delimiter = "!;"
 void testNonRegex3()
          Test: Non regex, delimiter = ";", "!" appears in field.
 void testNonRegex4()
          Test: Non regex, delimiter = "."
 void testNonRegex5()
          Test: Non regex, delimiter = "\\.", delmiter "." appears in field.
 void testNonRegex6()
          Test: Non regex, delimiter = "${DELIMITER}, value of delimiter = ";"
 void testRegex1()
          Test: Regex test, delimiter = ";"
 void testRegex2()
          Test: Regex, delimiter = "!;"
 void testRegex3()
          Test: Regex, delimiter = ";", "!;" appears in the field.
 void testRegex4()
          Test: Regex, delimiter = "."
 void testRegex5()
          Test: Regex, delimiter = "\\."
 void testRegex6()
          Test: Regex, delimiter = "[0-9]"
 
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

SplitFieldToRowsTest

public SplitFieldToRowsTest()
Method Detail

createRowMetaInterface

public RowMetaInterface createRowMetaInterface()
Creates the row meta interface.

Returns:
the row meta interface

createData

public List<RowMetaAndData> createData(String value)
Create a list of RowMetaAndData from the passed value and returns it.

Parameters:
value -
Returns:
List

test

public List<RowMetaAndData> test(String testName,
                                 String stringToSplit,
                                 boolean isDelimiterRegex,
                                 String delimiter,
                                 String delimiterVariableValue,
                                 String[] expectedResult)
                          throws Exception
Execute a test with the passed parameters.

Parameters:
testName -
stringToSplit -
isDelimiterRegex -
delimiter -
delimiterVariableValue -
expectedResult -
Returns:
Throws:
Exception

test

public List<RowMetaAndData> test(String testName,
                                 String stringToSplit,
                                 boolean isDelimiterRegex,
                                 String delimiter,
                                 String[] expectedResult)
                          throws Exception
Execute a test with the passed parameters.

Parameters:
testName -
stringToSplit -
isDelimiterRegex -
delimiter -
expectedResult -
Returns:
Throws:
Exception

testNonRegex1

public void testNonRegex1()
                   throws Exception
Test: Non regex, delimiter = ";"

Throws:
Exception

testNonRegex2

public void testNonRegex2()
                   throws Exception
Test: Non regex, delimiter = "!;"

Throws:
Exception

testNonRegex3

public void testNonRegex3()
                   throws Exception
Test: Non regex, delimiter = ";", "!" appears in field.

Throws:
Exception

testNonRegex4

public void testNonRegex4()
                   throws Exception
Test: Non regex, delimiter = "."

Throws:
Exception

testNonRegex5

public void testNonRegex5()
                   throws Exception
Test: Non regex, delimiter = "\\.", delmiter "." appears in field.

Throws:
Exception

testNonRegex6

public void testNonRegex6()
                   throws Exception
Test: Non regex, delimiter = "${DELIMITER}, value of delimiter = ";"

Throws:
Exception

testRegex1

public void testRegex1()
                throws Exception
Test: Regex test, delimiter = ";"

Throws:
Exception

testRegex2

public void testRegex2()
                throws Exception
Test: Regex, delimiter = "!;"

Throws:
Exception

testRegex3

public void testRegex3()
                throws Exception
Test: Regex, delimiter = ";", "!;" appears in the field.

Throws:
Exception

testRegex4

public void testRegex4()
                throws Exception
Test: Regex, delimiter = "."

Throws:
Exception

testRegex5

public void testRegex5()
                throws Exception
Test: Regex, delimiter = "\\."

Throws:
Exception

testRegex6

public void testRegex6()
                throws Exception
Test: Regex, delimiter = "[0-9]"

Throws:
Exception

splitFieldToRows

public List<RowMetaAndData> splitFieldToRows(String testName,
                                             String stringToSplit,
                                             boolean isDelimiterRegex,
                                             String delimiter)
                                      throws Exception
Splits the "stringToSplit" with the passed "delimiter". The "isDelimiterRegex" parameter will process the use regex for pattern matching if true.

Parameters:
testName -
stringToSplit -
isDelimiterRegex -
delimiter -
Returns:
Throws:
Exception

splitFieldToRows

public List<RowMetaAndData> splitFieldToRows(String testName,
                                             String stringToSplit,
                                             boolean isDelimiterRegex,
                                             String delimiter,
                                             String delimiterVariableValue)
                                      throws Exception
Splits the "stringToSplit" with the passed "delimiter". The "delimiter" is assumed by this method to be a Kettle variable. The parameter "delimiterVariableValue" should contain the variables value. The "isDelimiterRegex" parameter will process the use regex for pattern matching if true.

Parameters:
testName -
stringToSplit -
isDelimiterRegex -
delimiter -
delimiterVariableValue -
Returns:
Throws:
Exception