+1

On Thursday, November 3, 2011, Nyoman Ribeka <[email protected]> wrote:
> Hi,
>
> I think the workaround Rowan did by adding the mapping manually reveal
> a problem with the way we package the module. Right now what we have
> in the API layer for a mavenized module is just the class file only
> and the output from the API layer for a module is just the java class
> file for that module. With the current approach, we won't be able to
> do unit testing on the API layer because there's no configuration to
> wire the DAO and Service layer. And if we want to include the API
> layer of another module, we will end up with the same situation as
> above (maybe adding the omod as dependency, instead of the api would
> fix the above problem!)
>
> I think the better way to package the module is putting the class
> files and hbm and spring configuration in the api layer. With this
> approach we will have a better separation between the API and the web
> layer for the module itself. API will contains all the beans for that
> module and omod will contains the API jar file and the web layer for
> the module.
>
> Somewhat related question from me in the answers website:
>
https://answers.openmrs.org/questions/85/how-does-maven-replace-hbm-filenames-in-test-hibernatecfgxml
>
> On Thu, Nov 3, 2011 at 12:04 PM, Rowan Seymour <[email protected]>
wrote:
>> I edited test-hibernate.cfg.xml to explicitly include
the TokenRegistration
>> mapping file and that seems to fix the unknown entity exception, i.e.
>>
>> <hibernate-configuration>
>>   <session-factory>
>>     ${hbmConfig}
>>     <mapping resource="TokenRegistration.hbm.xml" />
>>   </session-factory>
>> </hibernate-configuration>
>>
>> But now those 3 unit tests are failing with another exception...
>> java.lang.NoSuchMethodError:
>>
org.openmrs.logic.LogicContext.eval(Ljava/lang/Integer;Lorg/openmrs/logic/LogicCriteria;Ljava/util/Map;)Lorg/openmrs/logic/result/Result;
>> I've looked at the source for LogicContext and it appears that between
>> OpenMRS 1.7 and 1.8 it's eval methods switched from using Patient
objects as
>> parameters, to using integers. The same switch occurred
in LogicContextImpl
>> in the logic module between 0.4 and 0.5
>> So I need to depend on version 0.4 of the logic module which isn't in the
>> maven repository. Can someone who knows more about this module put it in
>> maven? Does html form entry work with OpenMRS 1.8?
>> On 3 November 2011 15:50, Rowan Seymour <[email protected]> wrote:
>>>
>>> It's using logic 0.5 same as Mark just showed. The 3 failing tests are:
>>>
>>>
applyExcludes_shouldReturnCorrectXmlAfterApplyExcludeIfTag(org.openmrs.module.htmlformentry.HtmlFormEntryGeneratorTest):
>>> Unknown entity: org.openmrs.logic.token.TokenRegistration
>>>
>>>
applyIncludes_shouldReturnCorrectXmlAfterApplyIncludeTag(org.openmrs.module.htmlformentry.HtmlFormEntryGeneratorTest):
>>> Unknown entity: org.openmrs.logic.token.TokenRegistration
>>>
>>>
processIncludeLogic_shouldReturnACorrectBooleanValueForLogicTestString(org.openmrs.module.htmlformentry.HtmlFormEntryGeneratorTest):
>>> Unknown entity: org.openmrs.logic.token.TokenRegistration
>>> Stack trace just shows that it didn't recognize TokenRegistration as an
>>> entity....
>>>
>>>
applyExcludes_shouldReturnCorrectXmlAfterApplyExcludeIfTag(org.openmrs.module.htmlformentry.HtmlFormEntryGeneratorTest)
>>>  Time elapsed: 0.255 sec  <<< ERROR!
>>> org.hibernate.MappingException: Unknown entity:
>>> org.openmrs.logic.token.TokenRegistration
>>> at
>>>
org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)
>>> at
>>> org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)
>>> at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
>>> at
>>>
org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512)
>>> at
>>>
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:80)
>>> at
>>>
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
>>> at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
>>> at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
>>> at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
>>> at
>>>
org.openmrs.logic.token.db.hibernate.HibernateTokenDAO.saveTokenRegistration(HibernateTokenDAO.java:118)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> at
>>>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at
>>>
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>>> at
>>> org.springframework.aop.framework.ReflectiveMethodIn--
> Thanks,
>
> Nyoman Ribeka
>
> _________________________________________
>
> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to
[email protected] with "SIGNOFF openmrs-devel-l" in the  body
(not the subject) of your e-mail.
>
> [mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]
>
>

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

Reply via email to