Package org.dbunit.dataset
Class DataSetUtils
java.lang.Object
org.dbunit.dataset.DataSetUtils
This class contains various methods for manipulating datasets.
- Since:
- Feb 19, 2002
- Version:
- $Revision$
- Author:
- Manuel Laflamme
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertEquals(IDataSet expectedDataSet, IDataSet actualDataSet) Deprecated.Use Assertion.assertEqualsstatic voidassertEquals(ITable expectedTable, ITable actualTable) Deprecated.Use Assertion.assertEqualsstatic ColumnDeprecated.since 2.3.0 - prefer usage ofColumns.getColumn(String, Column[])static StringgetEscapedName(String name, String escapePattern) Deprecated.since 2.3.0.static StringgetQualifiedName(String prefix, String name) Deprecated.since 2.3.0.static StringgetQualifiedName(String prefix, String name, String escapePattern) Deprecated.since 2.3.0.static String[]getReverseTableNames(IDataSet dataSet) Returns the table names from the specified dataset in reverse order.static StringgetSqlValueString(Object value, DataType dataType) Returns the specified value as a string to be use in an SQL Statement.static ITable[]Search and returns the specified tables from the specified dataSet.static ITable[]Returns the tables from the specified dataset.static ITable[]getTables(ITableIterator iterator) Returns the tables from the specified iterator.static String[]reverseStringArray(String[] array) reverses a String array.
-
Method Details
-
assertEquals
Deprecated.Use Assertion.assertEqualsAsserts that the two specified dataset are equals. This method ignore the tables order.- Throws:
Exception
-
assertEquals
Deprecated.Use Assertion.assertEqualsAsserts that the two specified tables are equals. This method ignore the table names, the columns order, the columns data type and the primary keys.- Throws:
Exception
-
getQualifiedName
Deprecated.since 2.3.0. Prefer usage ofQualifiedTableName.getQualifiedName()creating a newQualifiedTableNameobjectReturns the specified name qualified with the specified prefix. The name is not modified if the prefix isnullor if the name is already qualified.Example:
getQualifiedName(null, "NAME")returns"NAME".getQualifiedName("PREFIX", "NAME")returns"PREFIX.NAME"andgetQualifiedName("PREFIX2", "PREFIX1.NAME")returns"PREFIX1.NAME".- Parameters:
prefix- the prefix that qualifies the name and is prepended if the name is not qualified yetname- the name The name to be qualified if it is not qualified already- Returns:
- the qualified name
-
getQualifiedName
Deprecated.since 2.3.0. Prefer usage ofQualifiedTableName.getQualifiedName()creating a newQualifiedTableNameobject- Parameters:
prefix- the prefix that qualifies the name and is prepended if the name is not qualified yetname- the name The name to be qualified if it is not qualified alreadyescapePattern- The escape pattern to be applied on the prefix and the name. Can be null.- Returns:
- The qualified name
-
getEscapedName
Deprecated.since 2.3.0. Prefer usage ofQualifiedTableName.getQualifiedName()creating a newQualifiedTableNameobject- Parameters:
name-escapePattern-- Returns:
- The escaped name if the escape pattern is not null
-
getSqlValueString
Returns the specified value as a string to be use in an SQL Statement. For example the stringmyValueis returned as'myValue'.- Parameters:
value- the valuedataType- the value data type- Returns:
- the SQL string value
- Throws:
TypeCastException
-
getColumn
Deprecated.since 2.3.0 - prefer usage ofColumns.getColumn(String, Column[])Search and returns the specified column from the specified column array.- Parameters:
columnName- the name of the column to search.columns- the array of columns from which the column must be searched.- Returns:
- the column or
nullif the column is not found
-
getTables
Search and returns the specified tables from the specified dataSet.- Parameters:
names- the names of the tables to search.dataSet- the dataset from which the tables must be searched.- Returns:
- the tables or an empty array if no tables are found.
- Throws:
DataSetException
-
getTables
Returns the tables from the specified dataset.- Throws:
DataSetException
-
getTables
Returns the tables from the specified iterator.- Throws:
DataSetException
-
getReverseTableNames
Returns the table names from the specified dataset in reverse order.- Throws:
DataSetException
-
reverseStringArray
reverses a String array.- Parameters:
array-- Returns:
- String[] - reversed array.
-