osgi
osgi copied to clipboard
[ds annotation tck] ConstructorInjection test does not honor default values
ConstructorInjection testcase currently fails when one do not set the field-collection-type attribute with the following error:
java.lang.AssertionError: [reference[@name='multiple']/@field-collection-type for node testConstructorInjection]
Expecting actual not to be null
at org.osgi.test.support.xpath.AbstractXPathAssert.hasValue(AbstractXPathAssert.java:87)
at org.osgi.test.cases.component.annotations.junit.DS14AnnotationsTestCase.testConstructorInjection(DS14AnnotationsTestCase.java:530)
The type of objects set in the collection are specified by the field-collection-type attribute in the component description:
- service - The bound service object. This is the default field collection type.
Also looking at the schema the attribute is marked as optional with a default of service
<attribute name="field-collection-type" type="scr:Tfield-collection-type" default="service" use="optional" />
I therefore thing that here
https://github.com/osgi/osgi/blob/8ab4f46152fe43176b2a157f32e205a94487a481/org.osgi.test.cases.component.annotations/src/org/osgi/test/cases/component/annotations/junit/DS14AnnotationsTestCase.java#L530-L531
it must also accept the case that the value is not specified what will mean default attribute value is used.
Could you Pplease add a Test? here that covers this issue?
Yes, the test should be hasOptionalValue instead of hasValue to allow for the default value of service.
Could you Pplease add a Test? here that covers this issue?
I'm not aware that TCKs itself has tests :-)
so please fixe a test or make it more distinct
I'm not aware that TCKs itself has tests :-)
You referenced the tests above. osgi/org.osgi.test.cases.component.annotations/src/org/osgi/test/cases/component/annotations/junit/DS14AnnotationsTestCase.java
@bjhargrave I mean there is no test that tests that the TCK itself is correct right?
I mean there is no test that tests that the TCK itself is correct right?
That is a bit meta. We don't have tests to test the tests...