AttachmentsService ahead of REST API work (ATT-24)

@mksd I have added the test case according to your reveiws on first part of the issue ATT-24.

@mksd Thanks for the feedback. I submitted the required changes.

@mksd I tried out writing a lambda function as follows Screenshot from 2018-03-27 19-26-12

when I run mvn clean install, I get the following error

method references are not supported in -source 1.7

Ah yes you need Java 8 to use lambda expressions.

I guess you could move your test to the 2.x subpackage, could you try if that works?

@mksd ok I would try it. Thanks

@mksd In subproject attachments-api-2.0 there is no test folder found. Shall I go on and create the necessary files ?

Yes.

P.S. Iā€™m adding some random text here since ā€˜Yes.ā€™ was too short to make a valid post for Discourse.

@mksd Thank you very much, I tried it. When I ran mvn clean install I got the following error java.lang.IllegalStateException: Failed to load ApplicationContext

What about pasting everything on hastebin?

The only thing I can tell you is that the Spring context couldnā€™t be loadedā€¦

@mksd I pasted it here. I am also curious to know why the previous subproject can not be used to write this test class?

This is the actual error:

java.lang.ClassNotFoundException:
  org.openmrs.module.reporting.data.visit.definition.VisitDataDefinition

You will have to add a new test dependency in the subprojectā€™s POM.

It is, but you would be stuck with Java 7, hence preventing tools like lambda expressions. Eventually OpenMRS pre 2.x and Java 7 will not be supported anymore. The current exercise is a bit convoluted but one day or another everything will end up happening in 2.x subprojects, so we could as well start now.

1 Like

@mksd Thank you very much. I will add the dependency and try to push the changes.

You may stumble on further such errors, in which case you will have to chase the missing dependencies until the context loads properly.

1 Like

@mksd I went on adding dependencies for all the ClassNotFoundExceptions. But now I ran into this error

Could you try adding this in TestingApplicationContext.xml:

<bean class="org.openmrs.module.emrapi.encounter.EncounterTransactionMapper"/>

@mksd Currently there is no such file in this subproject. I will add the necessary folders and files to try this out.

I pointed you to the API file, which is good enough.

@mksd Thank you for the tip as always. I added the bean, but the error is unchanged. This shows few of the NoSuchBeanDefinitions I am getting.

Can you push this on a branch for me to have a look?

@mksd Here is the link to my remote branch. Thank you very much for your continuous support.