You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by John Kramer <Jo...@panerabread.com> on 2020/01/22 18:44:33 UTC
org.apache.sling.api.resource.Resource from Image File
Hi guys,
I need to build an org.apache.sling.api.resource.Resource obect from a file (specifically a .png file) for the purpose of unit testing.
How do I do that?
Thanks!
John Kramer
Java Software Engineer
E-Commerce Web Team
e: john.kramer@panerabread.com<ma...@panera.com>
m: 314-435-2370
Re: org.apache.sling.api.resource.Resource from Image File
Posted by John Kramer <Jo...@panerabread.com>.
I understand. That makes sense.
Your example was quite useful.
Thanks!
John Kramer
Java Software Engineer
E-Commerce Web Team
e: john.kramer@panerabread.com <ma...@panera.com>
m: 314-435-2370
On 1/22/20, 13:35, "Daniel Klco" <dk...@apache.org> wrote:
John, to clarify, the provided link was just an example of how one might
import files into a mock Sling repository for Unit testing with Sling
Mocks. I would not expect you to import it as a dependency in your project.
On Wed, Jan 22, 2020 at 2:31 PM John Kramer <Jo...@panerabread.com>
wrote:
> Looking at the maven repo, it looks like there is no test-jar built:
>
>
> https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/transformer/pom.xml
>
> I can pull down the source and push a test-jar to our local repo, but if
> this is really the best way to implement this, this project should probably
> build a test jar itself.
>
> John Kramer
> Java Software Engineer
> E-Commerce Web Team
> e: john.kramer@panerabread.com <ma...@panera.com>
> m: 314-435-2370
>
> On 1/22/20, 13:02, "Daniel Klco" <dk...@apache.org> wrote:
>
> Warning: This email originated from outside of Panera. Beware of
> clicking links and attachments.
>
>
> Assuming you are using Sling Mocks, you can load the file in as a
> resource
> into the Sling Context, see:
>
> https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/transformer/src/test/java/org/apache/sling/cms/transformer/helpers/SlingCMSContextHelper.java
>
> https://sling.apache.org/documentation/development/sling-mock.html
>
> On Wed, Jan 22, 2020 at 1:44 PM John Kramer <
> John.Kramer@panerabread.com>
> wrote:
>
> > Hi guys,
> >
> > I need to build an org.apache.sling.api.resource.Resource obect from
> a
> > file (specifically a .png file) for the purpose of unit testing.
> >
> > How do I do that?
> >
> > Thanks!
> >
> > John Kramer
> > Java Software Engineer
> > E-Commerce Web Team
> > e: john.kramer@panerabread.com<ma...@panera.com>
> > m: 314-435-2370
> >
>
>
>
Re: org.apache.sling.api.resource.Resource from Image File
Posted by Daniel Klco <dk...@apache.org>.
John, to clarify, the provided link was just an example of how one might
import files into a mock Sling repository for Unit testing with Sling
Mocks. I would not expect you to import it as a dependency in your project.
On Wed, Jan 22, 2020 at 2:31 PM John Kramer <Jo...@panerabread.com>
wrote:
> Looking at the maven repo, it looks like there is no test-jar built:
>
>
> https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/transformer/pom.xml
>
> I can pull down the source and push a test-jar to our local repo, but if
> this is really the best way to implement this, this project should probably
> build a test jar itself.
>
> John Kramer
> Java Software Engineer
> E-Commerce Web Team
> e: john.kramer@panerabread.com <ma...@panera.com>
> m: 314-435-2370
>
> On 1/22/20, 13:02, "Daniel Klco" <dk...@apache.org> wrote:
>
> Warning: This email originated from outside of Panera. Beware of
> clicking links and attachments.
>
>
> Assuming you are using Sling Mocks, you can load the file in as a
> resource
> into the Sling Context, see:
>
> https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/transformer/src/test/java/org/apache/sling/cms/transformer/helpers/SlingCMSContextHelper.java
>
> https://sling.apache.org/documentation/development/sling-mock.html
>
> On Wed, Jan 22, 2020 at 1:44 PM John Kramer <
> John.Kramer@panerabread.com>
> wrote:
>
> > Hi guys,
> >
> > I need to build an org.apache.sling.api.resource.Resource obect from
> a
> > file (specifically a .png file) for the purpose of unit testing.
> >
> > How do I do that?
> >
> > Thanks!
> >
> > John Kramer
> > Java Software Engineer
> > E-Commerce Web Team
> > e: john.kramer@panerabread.com<ma...@panera.com>
> > m: 314-435-2370
> >
>
>
>
Re: org.apache.sling.api.resource.Resource from Image File
Posted by John Kramer <Jo...@panerabread.com>.
Looking at the maven repo, it looks like there is no test-jar built:
https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/transformer/pom.xml
I can pull down the source and push a test-jar to our local repo, but if this is really the best way to implement this, this project should probably build a test jar itself.
John Kramer
Java Software Engineer
E-Commerce Web Team
e: john.kramer@panerabread.com <ma...@panera.com>
m: 314-435-2370
On 1/22/20, 13:02, "Daniel Klco" <dk...@apache.org> wrote:
Warning: This email originated from outside of Panera. Beware of clicking links and attachments.
Assuming you are using Sling Mocks, you can load the file in as a resource
into the Sling Context, see:
https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/transformer/src/test/java/org/apache/sling/cms/transformer/helpers/SlingCMSContextHelper.java
https://sling.apache.org/documentation/development/sling-mock.html
On Wed, Jan 22, 2020 at 1:44 PM John Kramer <Jo...@panerabread.com>
wrote:
> Hi guys,
>
> I need to build an org.apache.sling.api.resource.Resource obect from a
> file (specifically a .png file) for the purpose of unit testing.
>
> How do I do that?
>
> Thanks!
>
> John Kramer
> Java Software Engineer
> E-Commerce Web Team
> e: john.kramer@panerabread.com<ma...@panera.com>
> m: 314-435-2370
>
Re: org.apache.sling.api.resource.Resource from Image File
Posted by Daniel Klco <dk...@apache.org>.
Assuming you are using Sling Mocks, you can load the file in as a resource
into the Sling Context, see:
https://github.com/apache/sling-org-apache-sling-app-cms/blob/master/transformer/src/test/java/org/apache/sling/cms/transformer/helpers/SlingCMSContextHelper.java
https://sling.apache.org/documentation/development/sling-mock.html
On Wed, Jan 22, 2020 at 1:44 PM John Kramer <Jo...@panerabread.com>
wrote:
> Hi guys,
>
> I need to build an org.apache.sling.api.resource.Resource obect from a
> file (specifically a .png file) for the purpose of unit testing.
>
> How do I do that?
>
> Thanks!
>
> John Kramer
> Java Software Engineer
> E-Commerce Web Team
> e: john.kramer@panerabread.com<ma...@panera.com>
> m: 314-435-2370
>