Search in sources :

Example 1 with ForwardOnlyResultSetTableFactory

use of org.dbunit.database.ForwardOnlyResultSetTableFactory in project openmrs-core by openmrs.

the class CreateConceptDictionaryDataSet method createConceptDictionaryDataSet.

@Test
@SkipBaseSetup
public void createConceptDictionaryDataSet() throws Exception {
    IDatabaseConnection connection = new DatabaseConnection(getConnection());
    DatabaseConfig config = connection.getConfig();
    config.setProperty(DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY, new ForwardOnlyResultSetTableFactory());
    String[] tableNames = new String[] { "concept_class", "concept_datatype", "concept_map_type", "concept_reference_source", "concept", "concept_numeric", "concept_description", "concept_name", "concept_reference_term", "concept_reference_map", "concept_reference_term_map", "concept_set", "concept_complex", "concept_answer", "concept_stop_word" };
    IDataSet dataSet = connection.createDataSet(tableNames);
    FlatXmlDataSet.write(dataSet, new FileOutputStream("target/conceptDictionaryDataSet.xml"));
}
Also used : FileOutputStream(java.io.FileOutputStream) IDatabaseConnection(org.dbunit.database.IDatabaseConnection) DatabaseConnection(org.dbunit.database.DatabaseConnection) ForwardOnlyResultSetTableFactory(org.dbunit.database.ForwardOnlyResultSetTableFactory) IDatabaseConnection(org.dbunit.database.IDatabaseConnection) IDataSet(org.dbunit.dataset.IDataSet) DatabaseConfig(org.dbunit.database.DatabaseConfig) Test(org.junit.Test)

Aggregations

FileOutputStream (java.io.FileOutputStream)1 DatabaseConfig (org.dbunit.database.DatabaseConfig)1 DatabaseConnection (org.dbunit.database.DatabaseConnection)1 ForwardOnlyResultSetTableFactory (org.dbunit.database.ForwardOnlyResultSetTableFactory)1 IDatabaseConnection (org.dbunit.database.IDatabaseConnection)1 IDataSet (org.dbunit.dataset.IDataSet)1 Test (org.junit.Test)1