[ 
https://issues.apache.org/jira/browse/SLING-4541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14605698#comment-14605698
 ] 

Bertrand Delacretaz commented on SLING-4541:
--------------------------------------------

Your patch didn't apply cleanly but I have looked at contentloader/src/test 
code from your https://github.com/PetrShypila/sling-builder repository. 

They look good in general but there's one code pattern that you used several 
times and might not be reliable, like this example:

{code}
        uninstallBundle(FIRST_SYMBOLIC);
        uninstallBundle(SECOND_SYMBOLIC);

        //Since uninstall and overwrite parameters are not set, content should 
not be deleted
        assertTrue("Property foo should not be deleted",
                
session.getNode(testNodeName).getProperty("foo").getString().equals("bar"));
{code}

Isn't the bundle uninstall processed asynchronously by the content loader code?

If yes there's no guarantee that that processing is finished before the above 
assertTrue - you would either need a way to find out when the contentloader 
operation is done (which might need slight changes to its code, like sending an 
OSGi event that identifies the operation + bundle symbolic name), or retry 
until you see changes in the content that confirm the contentloader processing 
is done.

If you have reasons to think that assertTrue in the above code happens at the 
right time I'm happy to hear them, I don't know this module in all details. But 
otherwise this pattern needs to be changed, we can discuss on list how to best 
solve that.

Thanks for your work so far, this is somewhat tricky to test!

> Provide an extensive test suite for the JCR content loader
> ----------------------------------------------------------
>
>                 Key: SLING-4541
>                 URL: https://issues.apache.org/jira/browse/SLING-4541
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR ContentLoader 2.1.10
>            Reporter: Radu Cotescu
>            Assignee: Petr Shypila
>             Fix For: JCR ContentLoader 2.2.0
>
>         Attachments: week-4-completed.patch, week-4_first_part.patch, 
> week2-part1-pathentry.patch, week2-part2-defaultcontentcreator.patch, 
> week2-part3-single-jcrmock-test.patch, week3.patch, week4-5.patch
>
>
> The JCR content loader is a sensible bundle. An extensive IT suite should be 
> written to make sure that code changes don't affect core functionality.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to