On 2010-02-08 15.59, Stanislav Muhametsin wrote:
thanks Rickard for implementing test case. I am not familiar with Qi4j
testing system at all at the moment. Also, I didn't know I could submit
JIRA issues, I thought they were not open for submitting to everyone.
Will need to look into that.
Unfortunately, I remembered that Qi4j lazy-loads mixins, and I actually
am calling a method in mixin after getting it from query. The
initialize() is still not called. I just did a little test case of my
own to verify that (I am using 1.0 version of Qi4j).
As for accurate description, it goes something like this:
Query entities.
Execute some method on them.
Return them.
Observe mixins not being called initialize().
I posted a test that does exactly that (InitializableTest in qi4j-tests
module), and it works. Here's the code:
{
finder.setId( id );
UnitOfWork uow = assembler.unitOfWorkFactory().newUnitOfWork();
EntityTest entity = assembler.queryBuilderFactory().
newQueryBuilder( EntityTest.class ).
where( QueryExpressions.eq(
QueryExpressions.templateFor(EntityTest.class ).identity(), id)).
newQuery( uow ).find();
Assert.assertTrue( entity.initialized() );
uow.complete();
}
"finder" here is a mock entity finder. The initialize() method is run
due to .initialized() being called.
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev