Search in sources :

Example 6 with FlatXmlDataSet

use of org.dbunit.dataset.xml.FlatXmlDataSet in project sonarqube by SonarSource.

the class AbstractDbTester method dbUnitDataSet.

private IDataSet dbUnitDataSet(InputStream stream) {
    try {
        ReplacementDataSet dataSet = new ReplacementDataSet(new FlatXmlDataSet(stream));
        dataSet.addReplacementObject("[null]", null);
        dataSet.addReplacementObject("[false]", Boolean.FALSE);
        dataSet.addReplacementObject("[true]", Boolean.TRUE);
        return dataSet;
    } catch (Exception e) {
        throw translateException("Could not read the dataset stream", e);
    }
}
Also used : FlatXmlDataSet(org.dbunit.dataset.xml.FlatXmlDataSet) ReplacementDataSet(org.dbunit.dataset.ReplacementDataSet) SQLException(java.sql.SQLException) DatabaseUnitException(org.dbunit.DatabaseUnitException)

Example 7 with FlatXmlDataSet

use of org.dbunit.dataset.xml.FlatXmlDataSet in project Asqatasun by Asqatasun.

the class AbstractDaoTestCase method getDataSet.

/**
     * Charge le jeu de données à partir d'un fichier XML d'import
     */
@Override
protected IDataSet getDataSet() throws Exception {
    FlatXmlDataSetBuilder flatXmlDataSetBuilder = new FlatXmlDataSetBuilder();
    FlatXmlDataSet loadedDataSet = flatXmlDataSetBuilder.build(new FileInputStream(getInputDataFileName()));
    return loadedDataSet;
}
Also used : FlatXmlDataSet(org.dbunit.dataset.xml.FlatXmlDataSet) FlatXmlDataSetBuilder(org.dbunit.dataset.xml.FlatXmlDataSetBuilder) FileInputStream(java.io.FileInputStream)

Aggregations

FlatXmlDataSet (org.dbunit.dataset.xml.FlatXmlDataSet)7 IDataSet (org.dbunit.dataset.IDataSet)5 StringReader (java.io.StringReader)3 IDatabaseConnection (org.dbunit.database.IDatabaseConnection)3 Connection (java.sql.Connection)2 DatabaseConnection (org.dbunit.database.DatabaseConnection)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 SQLException (java.sql.SQLException)1 DataSourceDatabaseTester (org.dbunit.DataSourceDatabaseTester)1 DatabaseUnitException (org.dbunit.DatabaseUnitException)1 IDatabaseTester (org.dbunit.IDatabaseTester)1 DatabaseDataSourceConnection (org.dbunit.database.DatabaseDataSourceConnection)1 ITable (org.dbunit.dataset.ITable)1 ReplacementDataSet (org.dbunit.dataset.ReplacementDataSet)1 FlatXmlDataSetBuilder (org.dbunit.dataset.xml.FlatXmlDataSetBuilder)1