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

Bertrand Delacretaz commented on SLING-5294:
--------------------------------------------

Thanks for your contribution. We'll need automated tests for it, but before 
that I'm not sure if the usage is convenient.

Each test class might need their own resources, so I think which resources to 
embed is best defined in the test itself, as opposed to here where IIUC you 
require the teleporter's client-side customizer to call 
ClientSideTeleporter.embedResource(...) multiple times. The idea is to have a 
single customizer per test environment, it shouldn't need to know about 
specific tests.

I haven't looked at what's easier to implement but IMO the ideal syntax is 
something like

{code}
@TeleportResources("/test/*")
class Foo {
  @Rule
    public TeleporterRule teleporter = 
      TeleporterRule.forClass(getClass(), "MyCustomizer");  
}
{code}

or maybe

{code}
class Bar {
  @Rule
    public TeleporterRule teleporter = 
      TeleporterRule.forClass(getClass(), "MyCustomizer").
      .withResources("/somePath/*")
      .withResources("/some/other/resource.txt")
}
{code}

WDYT?




> Resources need to be added in the bundle generated by the teleporter
> --------------------------------------------------------------------
>
>                 Key: SLING-5294
>                 URL: https://issues.apache.org/jira/browse/SLING-5294
>             Project: Sling
>          Issue Type: Improvement
>          Components: Testing
>    Affects Versions: JUnit Tests Teleporter 1.0.2
>            Reporter: Thierry Ygé
>         Attachments: ClientSideTeleporter.java_patch
>
>
> Currently you can add classes to the bundle, but not resources.
> It would be nice to simply add the following code (see attached diff).



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

Reply via email to