Fill the reporting queue for testing

Hello,

Does anybody know a good way to get report requests for testing purposes into the reporting queue UI (openmrs/module/reporting/reports/manageReportQueue.htm)? Scheduling it does not do that, since they’re ran immediately when their scheduled time is reached and don’t show up in the queue for me. I’m testing the deletion of a report request from the queue through clicking the delete icon, but for that I need a report there.

It’s really not a complicated change I need to check, but it’s bugging me and I don’t want to submit a pull request for something I haven’t seen work in the first place.

Things I’ve tried yet without success:

  • tried to get a report there by adding report requests in the UI
  • checked the DB for any flags I could possibly set to make reports show up in the queue
  • commented out the contents of purgeReportRequest() in hopes they might not be removed then

Thanks in advance already!

One approach would be to put a quick hack in place in the reporting module to make reports take an unrealistically long time.

So, between these two lines: https://github.com/openmrs/openmrs-module-reporting/blob/1.12.0/api/src/main/java/org/openmrs/module/reporting/report/service/ReportServiceImpl.java#L450-L451

…you would do Thread.sleep(5 minutes).

@darius I think that’s just what I was looking for, thanks a lot.

@darius It works, but when I add just that single line of code to the module, that I freshly pulled from upstream/master I get “Unable to locate named class org.openmrs.module.reporting.serializer.ReportingSerializer” when I press the cancel button on manageReportQueue.htm. With my own changes I even get a nullpointer exception, but that might be some other problem so I’d first need to get this error out of the way.

Oh, by the way, I don’t know if double-posting is discouraged here but I don’t think notifications would be sent out if I just edited my latest reply, so :/…

@flobue,

As an alternative to modifying and rebuilding the code, you should also just be able to set the global property “reporting.maxReportsToRun” to 0. This will result in all reports that you run to be queued, but never picked off of the queue to be executed.

Mike

@mseaton

Edit: nevermind my original post, I misunderstood that. Thanks for the tip.

But of course this does not fix the exception I get when cancelling a request from manageReportQueue.htm: “Unable to locate named class org.openmrs.module.reporting.serializer.ReportingSerializer” :/.

Here’s the stacktrace by the way: https://pastebin.com/mbQg6FAn

I can also confirm that I get the same exception if I leave everything untouched, meaning it should be reproduceable with:

  1. Update openmrs-sdk
  2. openmrs-sdk:setup a 2.7-SNAPSHOT Reference Application Distribution Server
  3. openmrs-sdk:run this server
  4. set maxReportsToRun property to 0, had to restart server to take effect
  5. add a report to the queue
  6. cancel the report from module/reporting/reports/manageReportQueue.htm (not via the individual report’s page!)

I have just tried it but failed to get your error message. Can you redownload the unmodified reporting module from https://modules.openmrs.org/#/show/119/reporting and test again?

I did and I still get the error. I don’t know any specific details that might lead to this since I’m working with the SDK and without modifying anything but the global property mseaton mentioned.

Maybe I should mention the details of the report, although it probably won’t make a difference: It’s an immediate request, with the report having no parameters, on all patients and having one SQL dataset definition where I query some table (doesn’t matter which) with SELECT * FROM table.

@k.joseph did you get to fix this? org.hibernate.HibernateException: Unable to locate named class org.openmrs.module.reporting.serializer.ReportingSerializer

@flobue what is the character set and collation for your openmrs database and report_object table?

It is utf8, utf8_general_ci as collation.

@flobue in DWRReportingService.purgeReportRequest() put this line at the beginning of the method, then compile the module and test again.

 Thread.currentThread().setContextClassLoader(OpenmrsClassLoader.getInstance());

@dkayiwa I did that and it worked. Am I supposed to use this as a temporary solution, or was this just for testing purposes?

On a sidenote: Does this only have to do with the DWR Reporting Service or does it affect everything coming from manageReportQueue.htm? Because the DWR Reporting Service will be gone anyway once I submit my pull request.

It was only for DWR Reporting Service. So once you get a rid of it, we do not need this fix. :slight_smile:

That’s good, although that also means I will have to look elsewhere to find the reason for the nullpointer exception I get with my changes, hehe. But it’s good to know it’s not related to this problem. Thanks for the help.