Dirk Rudolph created SLING-7788:
-----------------------------------

             Summary: registerInjectActivateService() causes non-conform 
ServiceRegistration
                 Key: SLING-7788
                 URL: https://issues.apache.org/jira/browse/SLING-7788
             Project: Sling
          Issue Type: Bug
          Components: Testing
    Affects Versions: Testing OSGi Mock 2.3.8
            Reporter: Dirk Rudolph


According to the OSGI R6 Spec 5.2.3 the framework has to automatically set the 
{{objectClass}} property to the service registration for the types the service 
is registered for. 
{quote}The service interface names under which a service object has been 
successfully registered are automatically added to the service's properties 
under the key objectClass. This value must be set automatically by the 
Framework and any value provided by the bundle must be overridden.
{quote}
This is correctly implemented in 
[MockServiceRegistration#L67|https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/5adc8b7eb2c2bbffdd422959388e8c998684eda0/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java#L67]
 by using the passed array of full qualified class names given to it from the 
[MockBundleContext#L101|https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/5adc8b7eb2c2bbffdd422959388e8c998684eda0/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java#L101]
 and 
[MockBundleContext#L121|https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/5adc8b7eb2c2bbffdd422959388e8c998684eda0/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java#L121]
 respectively.

On the other hand the the execution flow of 
[registerInjectActivateService|https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/5adc8b7eb2c2bbffdd422959388e8c998684eda0/src/main/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImpl.java#L155]
 always causes 
[MockBundleContext#L101|https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/5adc8b7eb2c2bbffdd422959388e8c998684eda0/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java#L101]
 to be called with {{null}} as service class and so the array of services 
provided by the given object s missing for that registration.

This causes for example the ServiceTracker according to 701.6.4.6 OSGI R6 to 
not work properly as the Filter it creates internally is referring to 
objectClass.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to