On Wednesday 21 February 2018 12:43:42 Christian Schneider wrote:
> I can create the mapping at runtime but then I have to somehow wait until
> it is processed asynchronously before I can try the login.

The ServiceUserMapped is a marker service that can be used to ensure that 
there is an already registered mapping for a certain service/subService. A 
service reference targeting a ServiceUserMapped will be satisfied only if 
ServiceUserMapper.getServiceUserID will resolve the subService to an userID. 
For example setting the reference target to "(subServiceName=mySubService)" 
ensures that your component only starts when the subService is available. The 
subServiceName will not be set for mappings that do not have one, and those 
can be referenced with a negating target "(!(subServiceName=*))". Trying to 
reference a sub service from a bundle for which it was not registered for will 
not work. As the service user mapper implementation is using a fallback, it is 
usually best to use a reference target that includes both options, the sub 
service name and the fallback, therefore a target like "(|
((subServiceName=mySubService)(!(subServiceName=*))))" should be used.

https://sling.apache.org/apidocs/sling10/org/apache/sling/serviceusermapping/ServiceUserMapped.html

Regards,
O.

> Christian
> 
> 2018-02-21 12:32 GMT+01:00 'Christoph Läubrich' via OPS4J <
> 
> [email protected]>:
> > The name is derived from the Exam-System with createID but I think that
> > can't be accessed from your test.
> > You might be able to set it by providing an own ProbeBuilder. But can't
> > you simply create the mapping at runtime? e.g. with a @Before you can
> > fetch
> > the current Bunlde name (via injected BundleContext) and then create the
> > mapping?
> > 
> > Am 21.02.2018 um 12:26 schrieb Christian Schneider:
> >> Just for some background on what I try to do:
> >> I am doing a test with sling (OSGi) in pax exam.
> >> There I need to do a login into the jcr repository using a service user.
> >> To be able to do that I need to create a so called usermapping.
> >> There I configure that if a bundle with a specific symbolic name tries to
> >> login, map it to a certain user.
> >> 
> >> The problem now is that I can not predict the name of the probe bundle.
> >> Is there a way to either set this name or to get it during the pax exam
> >> configuration?
> >> 
> >> 
> >> Christian
> > 
> > --
> > --
> > ------------------
> > OPS4J - http://www.ops4j.org - [email protected]
> > 
> > --- You received this message because you are subscribed to the Google
> > Groups "OPS4J" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > For more options, visit https://groups.google.com/d/optout.

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to