Initialising a dataset

Am having an error when initialising a dataset for my tests which I am failing to figure out a solution.The dataset was loading well until I introduced this obs https://github.com/METS-Programme/openmrs-module-aijar/pull/487/commits/1cefa98c272e83ab0604c1b7aaf5b978733b7b14#diff-36ac744089526d455a8abca7d5d6d512R23 This is strange to me because the one am introducing is very similar to https://github.com/METS-Programme/openmrs-module-aijar/pull/487/commits/1cefa98c272e83ab0604c1b7aaf5b978733b7b14#diff-36ac744089526d455a8abca7d5d6d512R20 .The entire PR is https://github.com/METS-Programme/openmrs-module-aijar/pull/487/commits/1cefa98c272e83ab0604c1b7aaf5b978733b7b14#diff-8ad1669a2141e05686ac84123fafa4aeR41 The error can be seen here https://travis-ci.org/github/METS-Programme/openmrs-module-aijar/builds/674075018… I wonder what am missing :thinking: @dkayiwa @ssmusoke @ibacher

NULL not allowed for column "STATUS" . Did you intentionally leave out the status field?

1 Like

When I included it as status=FINAL…I got the same error…

Can you do the same for the rest of the obs rows in that dataset file?

A new error here still related to my new concept https://travis-ci.org/github/METS-Programme/openmrs-module-aijar/builds/674285824#L4418

Referential integrity constraint violation: "FK_4T2S7IO9VTX85L7LA56ITT51U: PUBLIC.OBS FOREIGN KEY(CONCEPT_ID) REFERENCES PUBLIC.CONCEPT(CONCEPT_ID) (5096)

This looks like you are using a non existing concept.

Thanks @dkayiwa ur very right, I have been able to solve it with the help of @ssmusoke…I hadn’t added the concept…

1 Like

@dkayiwa I seem to have a new challenge while firing an http request at this line…The error seems to suggest that the controller can’t be found…Is there an issue with my annotation or a different issue entirely that am not seeing…errors at https://travis-ci.org/github/METS-Programme/openmrs-module-aijar/builds/674407086

The controller is found. The problem is with your controller’s GET method return type `AppointmentController.getNumberOfPatients’

Thanks @dkayiwa makes all the difference…Had not added the annotation of @ResponseBody and correct returnType class…

@dkayiwa I have a new followup challenge. My controller seems to be serving the purpose at least as far as the unit test goes…However when I try to integrate the module into a distro: Initializing EhCache CacheManager takes a long time and still the server fails to start with the following errors. https://pastebin.com/XBa2DGw7 This failure seems to follow the annotation of Controller on my rest-bean https://github.com/METS-Programme/openmrs-module-aijar/pull/487/files#diff-c21952d28dd2fa48dcfede5f2077cf68R21. If I make this a component then the server builds…What could i be missing.

The log you shared is not related to your controller. Do you have anything after it? And by the way, did you get a chance to look at this? https://wiki.openmrs.org/display/docs/Adding+a+Web+Service+Step+by+Step+Guide+for+Module+Developers

@dkayiwa Unfortunately, I didnt have any logs related to the controller.

I did look at it but since I was creating an end point which isn’t a resource in Openmrs I followed a pattern seen in some modules for example https://github.com/openmrs/openmrs-module-attachments/blob/master/omod-1.10/src/main/java/org/openmrs/module/attachments/rest/AttachmentBytesResource1_10.java#L32 and https://github.com/openmrs/openmrs-module-emrapi/blob/master/omod/src/main/java/org/openmrs/module/emrapi/web/controller/ActiveVisitController.java#L25

The first thing to fix is, ensure that all your references to the rest webservices module in pom.xml have the scope of provided or test as necessary. Then compile, run and tell me if you still have the same problem.

1 Like

@dkayiwa I have been trying to add scope to the webservices dependencies however the classes throw errors when I do so. Not sure if there is a plugin in the pom that stops this or something else. This being said: I have been able to go past the earlier hung at Initializing EhCache CacheManager when I refined the pom. https://github.com/METS-Programme/openmrs-module-aijar/pull/487/files but now I get errors when the server has started and I try to access the homePage. https://pastebin.com/4Xhb90DL

Are all your changes committed?

@dkayiwa yes they are…

@reagan i did not mean that you remove the rest webservices dependencies. But rather that those which do not have scope get it as <scope>provided</scope>

1 Like

@dkayiwa whenever I try to do that…I end up with errors in the controller and unit test class…

@reagan what exact changes did you make? I do not expect adding scope provided to dependencies that did not have any scope before, to lead into test failures.