Running junit integration tests with login administrative

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Running junit integration tests with login administrative

Roy Teeuwen
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

signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Running junit integration tests with login administrative

Robert Munteanu-2
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
Reply | Threaded
Open this post in threaded view
|

Re: Running junit integration tests with login administrative

Roy Teeuwen
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 <[hidden email]> 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


signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Running junit integration tests with login administrative

Robert Munteanu-2

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
Reply | Threaded
Open this post in threaded view
|

Re: Running junit integration tests with login administrative

Roy Teeuwen
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 <[hidden email]> 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