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

Bertrand Delacretaz commented on SLING-5352:
--------------------------------------------

Thanks for this. I won't apply the patch until we clarify the situation with 
Eclipse and other IDEs, we don't want to break that. If the class rule breaks 
IDEs we might want to enable the "install test bundle once per class only" mode 
based on a system property that can be set only for non-IDE builds.

Also, I'm wary of using a static member variable to keep track of the installed 
bundles, as this will break if running tests in parallel, which the maven 
surefire plugin allows. We should instead use a map of Class -> installed 
bundle.

These two requirements combined speak for creating a separate class that just 
takes care of installing the test bundles, and can use different strategies 
depending on the test environment.

I have more urgent things on my list at for the moment, will postpone this 
accordingly, but if another committer wants to have a look feel free.

> TeleporterRule should also work as a ClassRule
> ----------------------------------------------
>
>                 Key: SLING-5352
>                 URL: https://issues.apache.org/jira/browse/SLING-5352
>             Project: Sling
>          Issue Type: Improvement
>          Components: Testing
>    Affects Versions: JUnit Tests Teleporter 1.0.4
>            Reporter: Thierry Ygé
>         Attachments: clientsideteleporter_patch.txt, 
> clientsideteleporter_patch_v2.txt, teleporter_test_classrule.tgz
>
>
> Currently it's not possible to use the TeleporterRule as Rule and ClassRule 
> annotation. 
> The idea is that BeforeClass will create the bundle and install it.
> AfterClass will uninstall it. This will optimize the processing and avoid a 
> lot of round trip  and waits. It still allow to use it as in the original 
> version with only Rule annotation.
> I have made some test , and will attach my suggested solution. It allow to 
> use it as before:
> {code}
>     @Rule
>     public TeleporterRule classRule = 
> TeleporterRule.forClass(SomeMoreTest.class, "Launchpad");
> {code}
> or as follow with a ClassRule annotation:
> {code}
>     @ClassRule
>     public static TeleporterRule classRule = 
> TeleporterRule.forClass(SomeTest.class, "Launchpad");
>     @Rule
>     public TeleporterRule teleporterRule = classRule;
> {code}
> The changes are not so big, it only need a static field to store the bundle  
> symbolic name value in the case it is used with the ClassRule annotation. 
> Then adapt the logic in the statement to differentiate between ClassRule and 
> Rule usages.



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

Reply via email to