forked from I-TECH-UW/OpenELIS-Global-2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
creacted a utitlity classand a dataset postgres failures
- Loading branch information
1 parent
c500ccd
commit 44e52e9
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.openelisglobal; | ||
|
||
|
||
import java.io.FileInputStream; | ||
import java.io.FileNotFoundException; | ||
|
||
import org.dbunit.DBTestCase; | ||
import org.dbunit.PropertiesBasedJdbcDatabaseTester; | ||
import org.dbunit.dataset.IDataSet; | ||
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; | ||
|
||
public class DbUnitUtil extends DBTestCase { | ||
|
||
private final String datasetName; | ||
private final String dbDriverClass="org.postgresql.Driver"; | ||
private final String dbConnetionURL="jdbc:postgresql://localhost:5432/clinlims"; | ||
private final String userName="clinlims"; | ||
private final String password="clinlims"; | ||
|
||
public DbUnitUtil(String datasetName) | ||
{ | ||
super(); | ||
|
||
this.datasetName = datasetName; | ||
|
||
System.setProperty( PropertiesBasedJdbcDatabaseTester.DBUNIT_DRIVER_CLASS, dbDriverClass); | ||
System.setProperty( PropertiesBasedJdbcDatabaseTester.DBUNIT_CONNECTION_URL, dbConnetionURL ); | ||
System.setProperty( PropertiesBasedJdbcDatabaseTester.DBUNIT_USERNAME, userName ); | ||
System.setProperty( PropertiesBasedJdbcDatabaseTester.DBUNIT_PASSWORD, password ); | ||
// System.setProperty( PropertiesBasedJdbcDatabaseTester.DBUNIT_SCHEMA, "" ); | ||
} | ||
|
||
public IDataSet getDataSet() throws Exception { | ||
try { | ||
return new FlatXmlDataSetBuilder().build(new FileInputStream(datasetName)); | ||
} catch (FileNotFoundException e) { | ||
throw new RuntimeException("Failed to load dataset: " + datasetName, e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<dataset> | ||
<person id="1" last_name= "Tom" first_name= "Mulalu" middle_name= "Ian" multiple_unit="" street_address="Lumu" city="Kampala" state="" zip_code="256" country="Uganda" work_phone="12345" home_phone="112233" cell_phone="776655" fax="6654" email="12sd@gmail.com" primary_phone="12345"/> | ||
<person id="2" last_name= "Sanny" first_name= "Bijambiya" middle_name= "Von" multiple_unit="" street_address="Kasige" city="Kabale" state="" zip_code="256" country="Uganda" work_phone="67890" home_phone="445566" cell_phone="332211" fax="9881" email="weds@gmail.com" primary_phone="67890"/> | ||
<person id="3" last_name= "Job" first_name= "Asiimwe" middle_name= "Laban" multiple_unit="" street_address="Bulindo" city="" state="Jinja" zip_code="256" country="Uganda" work_phone="09876" home_phone="778899" cell_phone="443377" fax="0055" email="qwee@gmail.com" primary_phone="09876"/> | ||
<person id="4" last_name= "Jackie" first_name= "Nakazzi" middle_name= "Pretty" multiple_unit="" street_address="Zanna" city="" state="Masaka" zip_code="256" country="Uganda" work_phone="54321" home_phone="009988" cell_phone="112233" fax="2233" email="23@gmail.com" primary_phone="54321"/> | ||
|
||
</dataset> |