Search in sources :

Example 16 with ReplacementDataSet

use of org.dbunit.dataset.ReplacementDataSet in project Asqatasun by Asqatasun.

the class AbstractDaoTestCase method getDataSet.

/**
 * Charge le jeu de données à partir d'un fichier XML d'import
 * @return
 * @throws java.lang.Exception
 */
@Override
protected IDataSet getDataSet() throws Exception {
    FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
    builder.setColumnSensing(true);
    ReplacementDataSet dataSet = new ReplacementDataSet(builder.build(new FileInputStream(getDataSetFilename())));
    dataSet.addReplacementObject("[NULL]", null);
    return dataSet;
}
Also used : ReplacementDataSet(org.dbunit.dataset.ReplacementDataSet) FlatXmlDataSetBuilder(org.dbunit.dataset.xml.FlatXmlDataSetBuilder) FileInputStream(java.io.FileInputStream)

Example 17 with ReplacementDataSet

use of org.dbunit.dataset.ReplacementDataSet in project cals-api by ca-cwds.

the class RFA1aCoreSubmitApplicationTest method testIfEmergencyContactDetailWasCreatedProperly.

private void testIfEmergencyContactDetailWasCreatedProperly(String placementHomeId) throws Exception {
    DBUnitAssertHelper helper = DBUnitAssertHelper.builder(dbUnitSupport).setExpectedResultTemplatePath("/dbunit/EmergencyContactDetail.xml").setTestedTableName("EM_CNT_T").appendTableFilter("ESTBLSH_ID", placementHomeId).build();
    ReplacementDataSet expectedDataSet = helper.getExpectedDataSet();
    expectedDataSet.addReplacementObject("$placementHomeId", placementHomeId);
    helper.assertEquals(new String[] { "IDENTIFIER", "LST_UPD_TS" });
}
Also used : DBUnitAssertHelper(gov.ca.cwds.cals.persistence.DBUnitAssertHelper) ReplacementDataSet(org.dbunit.dataset.ReplacementDataSet)

Aggregations

ReplacementDataSet (org.dbunit.dataset.ReplacementDataSet)17 DBUnitAssertHelper (gov.ca.cwds.cals.persistence.DBUnitAssertHelper)6 FileInputStream (java.io.FileInputStream)3 InputStream (java.io.InputStream)3 Connection (java.sql.Connection)3 IDatabaseConnection (org.dbunit.database.IDatabaseConnection)3 FlatXmlDataSet (org.dbunit.dataset.xml.FlatXmlDataSet)3 FlatXmlDataSetBuilder (org.dbunit.dataset.xml.FlatXmlDataSetBuilder)3 DatabaseEnvironment (io.shardingjdbc.core.common.env.DatabaseEnvironment)2 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 InputStreamReader (java.io.InputStreamReader)2 DatabaseUnitException (org.dbunit.DatabaseUnitException)2 DataSetException (org.dbunit.dataset.DataSetException)2 IDataSet (org.dbunit.dataset.IDataSet)2 ITable (org.dbunit.dataset.ITable)2 Reader (java.io.Reader)1 PreparedStatement (java.sql.PreparedStatement)1 SQLException (java.sql.SQLException)1