[ 
https://issues.apache.org/jira/browse/ARIES-9?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869805#action_12869805
 ] 

Bartosz Kowalewski commented on ARIES-9:
----------------------------------------

Hi Jarek,

This issue was spoiling my tests, so I debugged Aries Blueprint core. It turned 
out that the explanation why this weird behavior is observed is extremely 
simple. ServiceRecipe.register() behaves a little bit different if auto export 
is enabled. When auto export is disabled, service.create() is called inside 
blueprintContainer.registerService(). It is retrived from 
TriggerServiceFactory, which triggers internalGetService() to create the 
service. With auto export enabled it's a little bit different. 
internalGetService() is called much earlier and the service is also initialized 
earlier. If auto export is enabled retrieving interfaces to be used during the 
process of registration requires the service to be initialized, so that it 
could be analyzed using reflection. 

This given issue is extremely easy to fix. We only need to ensure that the 
field that holds properties in the ServiceRecipe class is initialized before 
getClasses() is called. 

I'll attach a patch/diff created against the trunk (rev 946813). It contains a 
fix and a simple Pax Exam test that checks if this fix works. I used the 
already exisiting managers from the Blueprint sample project to test 
registration listeners that use auto export. However, I had to modify the 
registration listener that was used in this sample project, so that I can check 
if properties passed during registration are not null. 
I would prefer to create a testcase that would be completely separated from 
other Blueprint iTests. However, it seems that Aries uses a shared file with 
Blueprint definitions for all tests and nobody uses more dynamic aproaches to 
creating test bundles - i.e. bundles created during the test process using Tiny 
Bundles. I don't want to meddle :) - I used the same approach as the one that 
was already present in Aries.

Thanks,
  Bartek 

> Registration callback called with null service registration properties
> ----------------------------------------------------------------------
>
>                 Key: ARIES-9
>                 URL: https://issues.apache.org/jira/browse/ARIES-9
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>            Reporter: Jarek Gawor
>
> A service with explicitly set auto-export attribute might cause the 
> registration callback to be invoked with null service registration properties 
> (if auto-export is set to anything else besides 'disabled'). For example:
>    <service id="fooService" ref="fooBean" auto-export="all-classes">
>       <registration-listener 
>               registration-method="register" 
> unregistration-method="unregister">
>           <bean class="org.apache.geronimo.osgi.RegistrationListener"/>       
>   
>       </registration-listener>
>    </service>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to