Hi

CamelBlueprintTestSupport is not testing in a real osgi system, but uses
apache felix pojosr (afair) that has some kind of mocked/simulated osgi
that is limited.
You can use pax exam for testing with a real osgi system.



On Wed, Feb 1, 2023 at 5:19 PM Ephemeris Lappis <ephemeris.lap...@gmail.com>
wrote:

> Hello.
>
> I've observed that tests based on CamelBlueprintTestSupport have a
> strange OSGi context : the "FrameworkUtil" class doesn't work as
> expected and returns null.
>
> For some parts of our application code, where optional information is
> not required, we can handle the null value. But we can't do it for
> example for Liquibase that detects the OSGi context, but fails reading
> bundle information.
>
> Here is the code of Liquibase that fails :
>
>             Boolean osgiPlatform =
> Scope.getCurrentScope().get(Scope.Attr.osgiPlatform, Boolean.class);
>             if (Boolean.TRUE.equals(osgiPlatform)) {
>                 Bundle bundle =
> FrameworkUtil.getBundle(LiquibaseUtil.class);
>                 URL propURL =
> bundle.getEntry("liquibase.build.properties");
>
> As the returned bundle is null, Liquibase fails, and all the
> application code too.
>
> Could someone explain why the OSGi context of the test fails
> retrieving bundles, while it seems to work for all the rest ?
>
> Can we do something in the test setting to enable the expected behavior ?
>
> Thanks in advance for explanations and help !
>
> Regards.
>


-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to