Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgraded omrs version to 2.5.0 #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<jackson.version>2.10.3</jackson.version>
<skipDump>true</skipDump>
<skipConfig>true</skipConfig>
<openMRSVersion>2.1.6</openMRSVersion>
<openMRSVersion>2.5.0</openMRSVersion>
<log4jVersion>2.17.1</log4jVersion>
<bahmniJavaUtils.version>0.94.2</bahmniJavaUtils.version>
</properties>
Expand Down Expand Up @@ -62,7 +62,7 @@
<configuration>
<target>1.8</target>
<source>1.8</source>

<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.bahmni.reports.wrapper.CsvReport;
import org.bahmni.webclients.HttpClient;
import org.dbunit.DatabaseUnitException;
import org.dbunit.DatabaseUnitRuntimeException;
import org.dbunit.database.DatabaseConfig;
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
Expand All @@ -35,8 +36,8 @@
import org.openmrs.test.SkipBaseSetup;
import org.springframework.http.ResponseEntity;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.test.annotation.Commit;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
Expand All @@ -63,7 +64,7 @@
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@Transactional
@TransactionConfiguration(defaultRollback = false)
@Commit
@SkipBaseSetup
public class BaseIntegrationTest extends BaseContextSensitiveTest {

Expand Down Expand Up @@ -211,27 +212,32 @@ protected JasperReportBuilder fetchReportBuilder(String reportName, String start
}

@Override
public void deleteAllData() throws Exception {
Context.clearSession();
Connection connection = this.getConnection();
this.turnOffDBConstraints(connection);
String[] types = {"Table"};
IDatabaseConnection dbUnitConn = this.setupDatabaseConnection(connection);
ResultSet resultSet = connection.getMetaData().getTables((String) null, "PUBLIC", "%", types);
DefaultDataSet dataset = new DefaultDataSet();

while (resultSet.next()) {
String tableName = resultSet.getString(3);
dataset.addTable(new DefaultTable(tableName));
public void deleteAllData() {
try {
Context.clearSession();
Connection connection = this.getConnection();
this.turnOffDBConstraints(connection);
String[] types = {"Table"};
IDatabaseConnection dbUnitConn = this.setupDatabaseConnection(connection);
ResultSet resultSet = connection.getMetaData().getTables((String) null, "PUBLIC", "%", types);
DefaultDataSet dataset = new DefaultDataSet();

while (resultSet.next()) {
String tableName = resultSet.getString(3);
dataset.addTable(new DefaultTable(tableName));
}

DatabaseOperation.DELETE_ALL.execute(dbUnitConn, dataset);
this.turnOnDBConstraints(connection);
connection.commit();
this.updateSearchIndex();
}
catch (DatabaseUnitException | SQLException var6) {
throw new DatabaseUnitRuntimeException(var6);
}

DatabaseOperation.DELETE_ALL.execute(dbUnitConn, dataset);
this.turnOnDBConstraints(connection);
connection.commit();
this.updateSearchIndex();
}

private void turnOffDBConstraints(Connection connection) throws SQLException {
protected void turnOffDBConstraints(Connection connection) throws SQLException {
String constraintsOffSql;
if (this.useInMemoryDatabase().booleanValue()) {
constraintsOffSql = "SET REFERENTIAL_INTEGRITY FALSE";
Expand All @@ -244,7 +250,7 @@ private void turnOffDBConstraints(Connection connection) throws SQLException {
ps.close();
}

private IDatabaseConnection setupDatabaseConnection(Connection connection) throws DatabaseUnitException {
protected IDatabaseConnection setupDatabaseConnection(Connection connection) throws DatabaseUnitException {
DatabaseConnection dbUnitConn = new DatabaseConnection(connection);
if (this.useInMemoryDatabase().booleanValue()) {
DatabaseConfig config = dbUnitConn.getConfig();
Expand All @@ -254,7 +260,7 @@ private IDatabaseConnection setupDatabaseConnection(Connection connection) throw
return dbUnitConn;
}

private void turnOnDBConstraints(Connection connection) throws SQLException {
protected void turnOnDBConstraints(Connection connection) throws SQLException {
String constraintsOnSql;
if (this.useInMemoryDatabase().booleanValue()) {
constraintsOnSql = "SET REFERENTIAL_INTEGRITY TRUE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static org.bahmni.reports.scheduler.ReportStatus.COMPLETED;
import static org.bahmni.reports.scheduler.ReportStatus.ERROR;
import static org.bahmni.reports.scheduler.ReportStatus.QUEUED;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
Expand All @@ -35,7 +36,6 @@
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.whenNew;
import static org.springframework.test.util.MatcherAssertionErrors.assertThat;

@RunWith(PowerMockRunner.class)
@PowerMockIgnore({"org.hibernate.*", "org.springframework.*", "javax.management.*"})
Expand Down