TRUNK-5065: Incorrect table name while executing a dataset

While writing tests for this issue, i got the following error :

Running org.openmrs.api.AdministrationServiceTest
Tests run: 60, Failures: 0, Errors: 1, Skipped: 2, Time elapsed: 14.664 sec <<< FAILURE! - in org.openmrs.api.AdministrationServiceTest
setImplementationId_shouldOverwriteImplementationIdInDatabaseIfExists(org.openmrs.api.AdministrationServiceTest)  Time elapsed: 0.016 sec  <<< ERROR!
org.dbunit.DatabaseUnitRuntimeException: org.dbunit.dataset.NoSuchTableException: concept_source
        at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:305)
        at org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:80)
        at org.dbunit.operation.RefreshOperation.execute(RefreshOperation.java:101)
        at org.openmrs.test.BaseContextSensitiveTest.executeDataSet(BaseContextSensitiveTest.java:785)
        at org.openmrs.test.BaseContextSensitiveTest.executeDataSet(BaseContextSensitiveTest.java:679)
        at org.openmrs.api.AdministrationServiceTest.setImplementationId_shouldOverwriteImplementationIdInDatabaseIfExists(AdministrationServiceTest.java:222)

I checked for the table name here and found the table name as concept_reference_source which i think is incorrectly written here as concept_source.

I tried changing it but the changes are getting automatically reverted when building the code.

Please anyone have a look at it and tell me how to change this.

Regards,

Prabodh :slight_smile:

Interesting, the only place where this faulty test dataset is referred to is in this test method (that is @Ignore-annotated). Perhaps could it be part of your ticket to clean that one up too?

I don’t understand why your changes would be reverted when building the code, are you sure that you are indeed editing the file at the below path?

api/src/test/resources/org/openmrs/api/include/AdministrationServiceTest-general.xml

Look carefully because there would be 3 version of it after a build is done:

$ find . -iname "AdministrationServiceTest-general.xml"
./api/bin/src/test/resources/org/openmrs/api/include/AdministrationServiceTest-general.xml
./api/src/test/resources/org/openmrs/api/include/AdministrationServiceTest-general.xml
./api/target/test-classes/org/openmrs/api/include/AdministrationServiceTest-general.xml

And the versions in api/bin or api/target would be overwritten by a build.

1 Like

Thanks @mksd! :slight_smile:

yes this was happening! I changed the version in api/src and it worked :slight_smile:

yes this was the only place this dataset was referred. I wrote a new test method with the given change in dataset though.

Thank you for your help @mksd

Regards,

Prabodh :slight_smile: