osgi / bugzilla-archive

Archive of OSGi Alliance Specification Bugzilla bugs. The Specification Bugzilla system was decommissioned with the move to GitHub. The issues in this repository are imported from the Specification Bugzilla system for archival purposes.
0 stars 1 forks source link

org.osgi.test.cases.resolver seems not correct #3005

Closed bjhargrave closed 4 years ago

bjhargrave commented 4 years ago

Original bug ID: BZ#3138 From: Georgi Boyvalenkov <georgi.boyvalenkov@bosch.io> Reported version: R7

bjhargrave commented 4 years ago

Comment author: Georgi Boyvalenkov <georgi.boyvalenkov@bosch.io>

There is one problem method - testRelatedFragmentResolvable. At line 213 there is: context.checkWires(result, new AbstractResolverTestCase.TestWire[] { new AbstractResolverTestCase.TestWire(this, rootResource, resolvableReq, providerResource, resolvableCap) });

but IMO it should be: context.checkWires(result, new AbstractResolverTestCase.TestWire[] { new AbstractResolverTestCase.TestWire(this, rootResourceFrag, resolvableReq, providerResource, resolvableCap) });

as resolvableReq comes from rootResourceFrag.

bjhargrave commented 4 years ago

Comment author: @tjwatson

This is a case that we call a hosted requirement/capability. There are several sections in the spec that discuss this. The following are examples:

https://osgi.org/specification/osgi.core/7.0.0/framework.wiring.html#framework.wiring-fragments

A fragment bundle will show all its declared capabilities and requirements on its Bundle Revision but during resolving the resolver only considers the osgi.wiring.host and osgi.ee requirements and the osgi.identity capability and requirements. The osgi.wiring.host requirement represents the Fragment-Host header. A fragment can be attached to different hosts and each attachment creates a wire from the fragment's Bundle Wiring to the host's Bundle Wiring. The osgi.ee requirement is also never hosted. The osgi.identity capability of a fragment is part of the fragment's Bundle Wiring and is not part of a host bundle's Bundle Wiring. That is, each Bundle Wiring has exactly one osgi.identity capability. However, osgi.identity requirements declared by a fragment are not part of the fragment's Bundle Wiring and are instead hosted by the host bundle's Bundle Wiring. Any other requirements and capabilities in a fragment bundle never become part of the fragment's Bundle Wiring; they are treated as part of the host's requirements and capabilities when the fragment is attached to that host.

https://osgi.org/specification/osgi.core/7.0.0/framework.module.html#framework.module.dependencies

... However, when a Resource is wired the Wire has a provider or requirer Resource which can differ from the corresponding declared Resource. When the declared Resource differs from the provider/requirer it is called hosting. This separation is caused by Fragments; with Fragments some requirements and Capabilities are hosted and others remain part of the Fragment.

For this testcase the resolvableReq is a hosted requirement with namespace "resolvable" so the Wire is expected to have a host resource as the getRequirer because that host wiring is hosting the requirement for the fragment.