Eric Norman created SLING-11860:
-----------------------------------
Summary: OsgiServiceUtil#activateDeactivate may invoke the wrong
activate method
Key: SLING-11860
URL: https://issues.apache.org/jira/browse/SLING-11860
Project: Sling
Issue Type: Bug
Components: Testing
Reporter: Eric Norman
Assignee: Eric Norman
Fix For: Testing OSGi Mock 3.3.8
The scenario where this happens is when the parent class has an activate(Map)
method and the subclass has an activate(Config) method.
When the context.registerInjectActivateService(..) call is invoked, it finds
the activate(Map) method from the parent class and invokes it and then returns.
Expected:
The activate(Config) method from the subclass should have been the activate
method that was invoked.
For example:
{code:java}
public class ParentComponent {
protected void activate(Map<String, Object> props) {
// this should not be invoked when activating SubComponent
}
}
@Designate(ocd=SubComponent.Config.class)
public class SubComponent extends ParentComponent {
@ObjectClassDefinition(name = "SubComponent Config")
public @interface Config {
@AttributeDefinition(name = "Prop One")
boolean prop1() default true;
}
@Activate
protected void activate(Config cfg) {
// should be invoked when activating
}
} {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)