felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malte Burkert (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FELIX-4575) Unexpected behavior using proxies in declarative services
Date Tue, 22 Jul 2014 10:23:39 GMT
Malte Burkert created FELIX-4575:
------------------------------------

             Summary: Unexpected behavior using proxies in declarative services
                 Key: FELIX-4575
                 URL: https://issues.apache.org/jira/browse/FELIX-4575
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR)
         Environment: Operating System: Windows 8
Software platform: Java 1.7.0_45 with 
- org.eclipse.osgi (3.9.1.v20140110-1610)
- org.apache.felix.scr (1.8.2)
            Reporter: Malte Burkert


I have created the following setup which always shows the wrong and unexpected behavior, which
I describe after the setup.

===Setup===
.Hook-Bundle consisting of: 
- Hook implementing EventListenerHook and FindHook
> overridden event(event, listeners): creates new proxy instance with InvocationHandlerProxy
and registers the service (only services with a MANAGED property become proxied)
> overridden find(bundleContext, name, filter, allServices, references): removes non-proxied
services with a MANAGED property from references
- InvocationHandlerProxy implementing InvocationHandler
> overriden invoke(proxy, method, args): logging invocation to system.out and invokes the
passed method on the passed service

.Dateservice-Bundle
registers Service which returns current date; has component property MANAGED defined in the
related component description

.Multiplyservice-Bundle
returns the product of the numbers; has component property MANAGED defined in the related
component description

.Test-Bundle consisting of:
- Test implementing CommandProvider
> _test(commandInterpreter): gives an command line interface for executing the test by
using the command "test"; test consists of calling the Dateservice and Multiplyservice and
prints the results with the callee's classes (to check if proxy is called or not)
> setter for Dateservice and Multiplyservice, which get called as soon as service references
are fulfilled (both are described as static 1..1 service references by the component description)
> unsetter for  Dateservice and Multiplyservice, which get called as soon as at least on
of the service references is not fulfilled any more

===Test Scenarios showing the unexpected behavior===
-Test-Scenario 1:
1. Start Hook-Bundle
2. Start Test-Bundle
3. Start Multiplyservice-Bundle
4. Start Dateservice-Bundle
5. Execute "test"

>Expected result: Dateservice and Multiplyservice become proxied, test calls methods on
proxies
>Observed result: Both proxies are created, but only the Dateservice-Proxy is passed to
the corresponding setter in the Test-class; test calls method on Dateservice's Proxy and Multiplyservice

-Test-Scenario 2:
1. Start Hook-Bundle
2. Start Test-Bundle
3. Start Dateservice-Bundle
4. Start Multiplyservice-Bundle
5. Execute "test"

>Expected result: Dateservice and Multiplyservice become proxied, test calls methods on
proxies
>Observed result: Both proxies are created, but only the Multiplyservice-Proxy is passed
to the corresponding setter in the Test-class; test calls method on Multiplyservice's Proxy
and Dateservice

-Test-Scenario 3:
1. Start Hook-Bundle
2. Start Dateservice-Bundle
3. Start Multiplyservice-Bundle
4. Start Test-Bundle
5. Execute "test"
6. Stop Multiplyservice-Bundle
7. Start Multiplyservice-Bundle
8. Execute "test"
9. Stop Dateservice-Bundle
10. Start Dateservice-Bundle
11. Execute "test"
12. Stop Multiplyservice-Bundle
13. Start Multiplyservice-Bundle
14. Execute "test"
15. Stop Test-Bundle
16. Start Test-Bundle
17. Execute "test"

>Expected result: whenever Dateservice-, Multiplyservice- or Test-Bundle are started executing
test should make calls on the Proxies of Dateservice and Multiplyservice
>Observed results in executing test in step:
5: everything as expected
8. everything as expected
11. only proxy for Dateservice called
14. only proxy for Multiplyservice called
17. everything as expected



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message