You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Amit.. Gupta." <am...@adobe.com> on 2014/10/10 09:57:37 UTC

Question on dependency management while adding a test case

Hello Team,


I am adding a test case of [0], for this I need to use latest of


           <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>

?

This introduces a dependency to sling.api:2.7.0, because of resource.getValueMap


sling event module, otherwise is quite content with older api dependency. So, I don't want to introduce this higher dependency.

I can explicitly give a lower bound in import, which isn't nice either. Is there any other way.


Regards,

Amit


[0] https://issues.apache.org/jira/browse/SLING-4014

Re: Question on dependency management while adding a test case

Posted by "Amit.. Gupta." <am...@adobe.com>.
Hi Robert,

Currently tests are part of sling event module.

Thanks
-Amit
________________________________________
From: Robert Munteanu <ro...@apache.org>
Sent: Friday, October 10, 2014 1:41 PM
To: dev@sling.apache.org
Subject: Re: Question on dependency management while adding a test case

Hi Amit,

On Fri, Oct 10, 2014 at 10:57 AM, Amit.. Gupta. <am...@adobe.com> wrote:
> Hello Team,
>
>
> I am adding a test case of [0], for this I need to use latest of
>
>
>            <groupId>org.apache.sling</groupId>
>             <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
>
> ?
>
> This introduces a dependency to sling.api:2.7.0, because of resource.getValueMap
>
>
> sling event module, otherwise is quite content with older api dependency. So, I don't want to introduce this higher dependency.
>
> I can explicitly give a lower bound in import, which isn't nice either. Is there any other way.

Are the Event tests part of the same module? If they are, you can move
them to a different module and then test + runtime dependencies are
separated.

Robert

>
>
> Regards,
>
> Amit
>
>
> [0] https://issues.apache.org/jira/browse/SLING-4014

Re: Question on dependency management while adding a test case

Posted by Robert Munteanu <ro...@apache.org>.
Hi Amit,

On Fri, Oct 10, 2014 at 10:57 AM, Amit.. Gupta. <am...@adobe.com> wrote:
> Hello Team,
>
>
> I am adding a test case of [0], for this I need to use latest of
>
>
>            <groupId>org.apache.sling</groupId>
>             <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
>
> ?
>
> This introduces a dependency to sling.api:2.7.0, because of resource.getValueMap
>
>
> sling event module, otherwise is quite content with older api dependency. So, I don't want to introduce this higher dependency.
>
> I can explicitly give a lower bound in import, which isn't nice either. Is there any other way.

Are the Event tests part of the same module? If they are, you can move
them to a different module and then test + runtime dependencies are
separated.

Robert

>
>
> Regards,
>
> Amit
>
>
> [0] https://issues.apache.org/jira/browse/SLING-4014

Re: Question on dependency management while adding a test case

Posted by "Amit.. Gupta." <am...@adobe.com>.
Hi Carsten,

That won't work, because the mock resource resolver implementation uses the Resource.getValueMap.

Julian's suggestion works, but I need to change the MockResourceResolver to use ResourceUtil.getValueMap instead.

Using above, I can stay on sling.api:2.4.0, but then my test fails, since it relies on SLING-2894 in ResourceUtil, which came in sling.api:2.5.0

I have attached my test case patch to the bug [0]

Thanks,
Amit

[0] https://issues.apache.org/jira/secure/attachment/12674209/SLING-4014-Test.patch
________________________________________
From: Carsten Ziegeler <cz...@apache.org>
Sent: Friday, October 10, 2014 8:17 PM
To: dev@sling.apache.org
Subject: Re: Question on dependency management while adding a test case

Rethinking this, can't we simply exclude the api dependency when
including the resourceresolver-mock ?

<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
<exclusions>
  <exclusion>
   <groupId>org.apache.sling</groupId>
   <artifactId>org.apache.sling.api</artifactId>
  </exclusion>
</exclusions>

Carsten

Am 10.10.14 um 16:27 schrieb Julian Sedding:
> Hi Amit
>
> We could change the resourceresolver-mock to "use" a lower Sling API
> version than it "implements". I.e. in MockResourceResolver, change all
> resource.getValueMap() to ResourceUtil.getValueMap(resource). Then it
> should be compatible with lower API versions. This should work as long
> as there are no major API changes.
>
> Regards
> Julian
>
> On Fri, Oct 10, 2014 at 9:57 AM, Amit.. Gupta. <am...@adobe.com> wrote:
>> Hello Team,
>>
>>
>> I am adding a test case of [0], for this I need to use latest of
>>
>>
>>            <groupId>org.apache.sling</groupId>
>>             <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
>>
>> ?
>>
>> This introduces a dependency to sling.api:2.7.0, because of resource.getValueMap
>>
>>
>> sling event module, otherwise is quite content with older api dependency. So, I don't want to introduce this higher dependency.
>>
>> I can explicitly give a lower bound in import, which isn't nice either. Is there any other way.
>>
>>
>> Regards,
>>
>> Amit
>>
>>
>> [0] https://issues.apache.org/jira/browse/SLING-4014
>


--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: Question on dependency management while adding a test case

Posted by Carsten Ziegeler <cz...@apache.org>.
Rethinking this, can't we simply exclude the api dependency when
including the resourceresolver-mock ?

<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
<exclusions>
  <exclusion>
   <groupId>org.apache.sling</groupId>
   <artifactId>org.apache.sling.api</artifactId>
  </exclusion>
</exclusions>

Carsten

Am 10.10.14 um 16:27 schrieb Julian Sedding:
> Hi Amit
> 
> We could change the resourceresolver-mock to "use" a lower Sling API
> version than it "implements". I.e. in MockResourceResolver, change all
> resource.getValueMap() to ResourceUtil.getValueMap(resource). Then it
> should be compatible with lower API versions. This should work as long
> as there are no major API changes.
> 
> Regards
> Julian
> 
> On Fri, Oct 10, 2014 at 9:57 AM, Amit.. Gupta. <am...@adobe.com> wrote:
>> Hello Team,
>>
>>
>> I am adding a test case of [0], for this I need to use latest of
>>
>>
>>            <groupId>org.apache.sling</groupId>
>>             <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
>>
>> ?
>>
>> This introduces a dependency to sling.api:2.7.0, because of resource.getValueMap
>>
>>
>> sling event module, otherwise is quite content with older api dependency. So, I don't want to introduce this higher dependency.
>>
>> I can explicitly give a lower bound in import, which isn't nice either. Is there any other way.
>>
>>
>> Regards,
>>
>> Amit
>>
>>
>> [0] https://issues.apache.org/jira/browse/SLING-4014
> 


-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

RE: Question on dependency management while adding a test case

Posted by Stefan Seifert <ss...@pro-vision.de>.
this worked well, resolved in https://issues.apache.org/jira/browse/SLING-4033

stefan

>-----Original Message-----
>From: Julian Sedding [mailto:jsedding@gmail.com]
>Sent: Friday, October 10, 2014 4:28 PM
>To: dev@sling.apache.org
>Subject: Re: Question on dependency management while adding a test case
>
>Hi Amit
>
>We could change the resourceresolver-mock to "use" a lower Sling API
>version than it "implements". I.e. in MockResourceResolver, change all
>resource.getValueMap() to ResourceUtil.getValueMap(resource). Then it
>should be compatible with lower API versions. This should work as long
>as there are no major API changes.
>
>Regards
>Julian
>
>On Fri, Oct 10, 2014 at 9:57 AM, Amit.. Gupta. <am...@adobe.com> wrote:
>> Hello Team,
>>
>>
>> I am adding a test case of [0], for this I need to use latest of
>>
>>
>>            <groupId>org.apache.sling</groupId>
>>             <artifactId>org.apache.sling.testing.resourceresolver-
>mock</artifactId>
>>
>> ?
>>
>> This introduces a dependency to sling.api:2.7.0, because of
>resource.getValueMap
>>
>>
>> sling event module, otherwise is quite content with older api dependency.
>So, I don't want to introduce this higher dependency.
>>
>> I can explicitly give a lower bound in import, which isn't nice either. Is
>there any other way.
>>
>>
>> Regards,
>>
>> Amit
>>
>>
>> [0] https://issues.apache.org/jira/browse/SLING-4014

Re: Question on dependency management while adding a test case

Posted by Julian Sedding <js...@gmail.com>.
Hi Amit

We could change the resourceresolver-mock to "use" a lower Sling API
version than it "implements". I.e. in MockResourceResolver, change all
resource.getValueMap() to ResourceUtil.getValueMap(resource). Then it
should be compatible with lower API versions. This should work as long
as there are no major API changes.

Regards
Julian

On Fri, Oct 10, 2014 at 9:57 AM, Amit.. Gupta. <am...@adobe.com> wrote:
> Hello Team,
>
>
> I am adding a test case of [0], for this I need to use latest of
>
>
>            <groupId>org.apache.sling</groupId>
>             <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId>
>
> ?
>
> This introduces a dependency to sling.api:2.7.0, because of resource.getValueMap
>
>
> sling event module, otherwise is quite content with older api dependency. So, I don't want to introduce this higher dependency.
>
> I can explicitly give a lower bound in import, which isn't nice either. Is there any other way.
>
>
> Regards,
>
> Amit
>
>
> [0] https://issues.apache.org/jira/browse/SLING-4014