You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Roy Teeuwen <ro...@teeuwen.be> on 2017/08/28 12:44:47 UTC

Running junit integration tests with login administrative

Hey all,

I am trying to run integration tests based on the org.apache.sling.junit.core bundle. So far this always used to work, because I was able to use loginAdministrative, but now that this feature is disabled I can not do this anymore without providing a  org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment-junitcore config.

I have seen in the caconfig bundle for integration tests that it is done there by using the provisioning model to give the config and a repoinit to provide the user, but this is not possible in my use-case, I am creating an integration test bundle for AEM 6.3, so there is no more provisioning, it's against a running test instance.

Anyone has a good approach to tackle this issue, that the config (and possibly even the user mapping) is still inside the integration test bundle, and not that I have to pre provision it to the running instance?

Thanks,
Roy

Re: Running junit integration tests with login administrative

Posted by Roy Teeuwen <ro...@teeuwen.be>.
Hey,

Ok i will give it a try, cant seem to find any projects online that use the testing.clients bundle sadly enough.

Thanks
Roy

> Op 29 aug. 2017 om 13:09 heeft Robert Munteanu <ro...@apache.org> het volgende geschreven:
> 
> 
> Hi Roy,
> 
>> On Tue, 2017-08-29 at 13:06 +0200, Roy Teeuwen wrote:
>> Hey Robert,
>> 
>> Thanks for the info! It does look like something I could definitely
>> use for this, but if I look at the methods, I only see an
>> editConfiguration, and deleteConfiguration not an addConfiguration?
>> 
>> When I look at the comments, it says:
>> 
>> Sets properties of a config referenced by its PID. the properties to
>> be edited are passed as
>> * a map of property name,value pairs.
>> 
>> So I don't know if I can also actually add a new one with this
>> method?
> 
> You should definitely be able to add a new configuration.
> 
> Robert

Re: Running junit integration tests with login administrative

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

On Tue, 2017-08-29 at 13:06 +0200, Roy Teeuwen wrote:
> Hey Robert,
> 
> Thanks for the info! It does look like something I could definitely
> use for this, but if I look at the methods, I only see an
> editConfiguration, and deleteConfiguration not an addConfiguration?
> 
> When I look at the comments, it says:
> 
>  Sets properties of a config referenced by its PID. the properties to
> be edited are passed as
> * a map of property name,value pairs.
> 
> So I don't know if I can also actually add a new one with this
> method?

You should definitely be able to add a new configuration.

Robert

Re: Running junit integration tests with login administrative

Posted by Roy Teeuwen <ro...@teeuwen.be>.
Hey Robert,

Thanks for the info! It does look like something I could definitely use for this, but if I look at the methods, I only see an editConfiguration, and deleteConfiguration not an addConfiguration?

When I look at the comments, it says:

 Sets properties of a config referenced by its PID. the properties to be edited are passed as
* a map of property name,value pairs.

So I don't know if I can also actually add a new one with this method?

Thanks,
Roy
> On 29 Aug 2017, at 12:40, Robert Munteanu <ro...@apache.org> wrote:
> 
> Hi Roy,
> 
> On Mon, 2017-08-28 at 14:44 +0200, Roy Teeuwen wrote:
>> Hey all,
>> 
>> I am trying to run integration tests based on the
>> org.apache.sling.junit.core bundle. So far this always used to work,
>> because I was able to use loginAdministrative, but now that this
>> feature is disabled I can not do this anymore without providing
>> a  org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment-
>> junitcore config.
>> 
>> I have seen in the caconfig bundle for integration tests that it is
>> done there by using the provisioning model to give the config and a
>> repoinit to provide the user, but this is not possible in my use-
>> case, I am creating an integration test bundle for AEM 6.3, so there
>> is no more provisioning, it's against a running test instance.
>> 
>> Anyone has a good approach to tackle this issue, that the config (and
>> possibly even the user mapping) is still inside the integration test
>> bundle, and not that I have to pre provision it to the running
>> instance?
> 
> I would try and install the OSGi config at test time, using the
> OSGiConsoleClient.
> 
> Robert


Re: Running junit integration tests with login administrative

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

On Mon, 2017-08-28 at 14:44 +0200, Roy Teeuwen wrote:
> Hey all,
> 
> I am trying to run integration tests based on the
> org.apache.sling.junit.core bundle. So far this always used to work,
> because I was able to use loginAdministrative, but now that this
> feature is disabled I can not do this anymore without providing
> a  org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment-
> junitcore config.
> 
> I have seen in the caconfig bundle for integration tests that it is
> done there by using the provisioning model to give the config and a
> repoinit to provide the user, but this is not possible in my use-
> case, I am creating an integration test bundle for AEM 6.3, so there
> is no more provisioning, it's against a running test instance.
> 
> Anyone has a good approach to tackle this issue, that the config (and
> possibly even the user mapping) is still inside the integration test
> bundle, and not that I have to pre provision it to the running
> instance?

I would try and install the OSGi config at test time, using the
OSGiConsoleClient.

Robert