Package org.dbunit.dataset.yaml
Class YamlDataSet
java.lang.Object
org.dbunit.dataset.AbstractDataSet
org.dbunit.dataset.CachedDataSet
org.dbunit.dataset.yaml.YamlDataSet
- All Implemented Interfaces:
IDataSet,IDataSetConsumer
Reads and writes flat YAML-based dataset documents. Contrary to the flat XML layout,
columns are calculated by parsing the entire data set, not just the first row.
The format looks like this:
I.e.:
The format looks like this:
<table_name>:
- <column>: <value>
<column>: <value>
...
- <column>: <value>
<column>: <value>
...
...
...
I.e.:
TEST_TABLE:
- COL0: "row 0 col 0"
COL1: "row 0 col 1"
COL2: "row 0 col 2"
- COL1: "row 1 col 1"
SECOND_TABLE:
- COL0: "row 0 col 0"
COL1: "row 0 col 1"
EMPTY_TABLE: []
- Version:
- $Revision$ $Date$
- Author:
- Björn Beskow
-
Field Summary
Fields inherited from class org.dbunit.dataset.AbstractDataSet
_orderedTableNameMap -
Constructor Summary
ConstructorsConstructorDescriptionYamlDataSet(File file) Creates a YAML dataset based on a yaml fileYamlDataSet(InputStream inputStream) Creates a YAML dataset based on an inputstream -
Method Summary
Modifier and TypeMethodDescriptionstatic voidwrite(IDataSet dataSet, OutputStream out) Writes the specified dataset to the specified output stream as YAML, encoded in UTF-8, matching whatYamlProducerdecodes.static voidWrite the specified dataset to the specified writer as YAML.Methods inherited from class org.dbunit.dataset.CachedDataSet
createIterator, endDataSet, endTable, row, startDataSet, startTableMethods inherited from class org.dbunit.dataset.AbstractDataSet
createTableNameMap, getTable, getTableMetaData, getTableNames, getTables, initialize, isCaseSensitiveTableNames, iterator, reverseIterator, toString
-
Constructor Details
-
YamlDataSet
Creates a YAML dataset based on a yaml file- Parameters:
file- the YAML file to load.- Throws:
IOException- if the file cannot be read.DataSetException- if the document cannot be parsed.
-
YamlDataSet
Creates a YAML dataset based on an inputstream- Parameters:
inputStream- An inputstream pointing to a YAML dataset- Throws:
DataSetException- if the document cannot be parsed.
-
-
Method Details
-
write
Writes the specified dataset to the specified output stream as YAML, encoded in UTF-8, matching whatYamlProducerdecodes.- Parameters:
dataSet- the dataset to write.out- the stream to write the YAML document to.- Throws:
DataSetException- if the dataset cannot be read.
-
write
Write the specified dataset to the specified writer as YAML.- Parameters:
dataSet- the dataset to write.out- the writer to write the YAML document to.- Throws:
DataSetException- if the dataset cannot be read.
-