Extending BaseModuleContextSensitiveTest fails out of the box against Core 1.10.x

@dkayiwa I wonder if you could have a look at this quickly. I stumbled upon this in Attachments and perhaps something is misconfigured somewhere…

Look at this test in Attachments. It an API test (located in api/) and if you attempt to extend BaseModuleContextSensitiveTest (rather than the current BaseModuleWebContextSensitiveTest), you get this:

No matching bean of type
[org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter]

This bean is defined in Core’s openmrs-servlet.xml (here) and indeed only BaseModuleWebContextSensitiveTest is grasping that (see here).

Is this a known issue (the problem seems to go away from 1.11.x) or did I miss something?

I see that you have openmrs-web dependencies in your api project. Shouldn’t these go to the web/omod?

I think it comes down to what ImageAttachmentHandlerContextSensitiveTest is testing, if the functionality it’s testing is in the web layer then it shouldn’t be in the api sub project in the first place and it should extend BaseModuleWebContextSensitiveTest

Actually Daniel makes a good point, having web dependencies i.e. this and this must be the problem, you should never have web dependencies in the api otherwise that’s what happens.

Oh! and this, omods are technically web dependencies.

Thanks both @dkayiwa and @wyclif.

Clearly some initial (not so well thought through) copy/paste is still lingering in the api/pom.xml. Removing the undesired web dependencies indeed solves the issue.

This is taking me into some more refactoring but nothing major I think. I’ll push that soon on master.

1 Like

Done, fixed on this commit 645101f.

1 Like