stefanseifert commented on a change in pull request #10:
URL:
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/10#discussion_r749389029
##########
File path:
core/src/test/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtilTest.java
##########
@@ -100,7 +100,6 @@ public void testService3() {
List<Map<String, Object>> reference3Configs =
service3.getReference3Configs();
assertEquals(1, reference3Configs.size());
- assertEquals(200,
reference3Configs.get(0).get(Constants.SERVICE_RANKING));
Review comment:
why are you removing this test (and the testWithOsgiMetadata test case
above)?
i think because the call to `MapMergeUtil.propertiesMergeWithOsgiMetadata`
was moved to MockOsgi and out of MockBundleContext it is not longer applied to
all code paths - e.g. when registering a service instance directly with the
bundle context without instantiating or activating it via MockOsgi (e.g. a
mockito mock object). that's why those test cases are failing.
##########
File path:
core/src/main/java/org/apache/sling/testing/mock/osgi/MapMergeUtil.java
##########
@@ -98,6 +104,9 @@ private MapMergeUtil() {
mergedProperties.putAll(properties);
}
+ // add non overwritable properties
+ mergedProperties.put(ComponentConstants.COMPONENT_NAME,
targetClass.getName());
Review comment:
maybe a better place would be `MockServiceRegistration#updateProperties`
where other "implicit" properties are set already? this would ensure all code
paths are affected regardless by which way the component was created when it is
registered.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]