karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raman Gupta (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-957) Cannot specify systemPackage options when using karaf.testing.Helper
Date Mon, 24 Oct 2011 04:24:32 GMT

    [ https://issues.apache.org/jira/browse/KARAF-957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13133822#comment-13133822
] 

Raman Gupta commented on KARAF-957:
-----------------------------------

Well, it doesn't seem to work anyway when using systemPackages(...), probably because of a
bug in the ancient version of Pax-Exam that is being used by the Karaf tooling.

However, the fix for this issue will still be useful since a work-around for the pax-exam
bug is to use:

systemProperty("org.osgi.framework.system.packages.extra").value("...");

but that does not work unless this issue is resolved, since Pax-Exam adds the new system property
before the VMOptions defined by karaf, and therefore the Karaf empty value for the same property
overrides it.

The work-around to THAT is to use this little chunk of code instead of Helper.getDefaultOptions()
directly (this assumes the value for org.osgi.framework.system.packages.extra is empty, which
it is by default):

        Option[] karafHelperOptions = Helper.getDefaultOptions();
        List<Option> karafOptions = new ArrayList<Option>(karafHelperOptions.length);

        for(Option o : karafHelperOptions) {
            if(o instanceof VMOption) {
                String oldVmOption = ((VMOption)o).getOption();
                StringBuilder builder = new StringBuilder(oldVmOption.length());
                final String extraStr = "-Dorg.osgi.framework.system.packages.extra=";
                final int startExtra = oldVmOption.indexOf(extraStr);
                builder
                    .append(oldVmOption.substring(0, startExtra))
                    .append(oldVmOption.substring(startExtra + extraStr.length() + 1));
                VMOption newVmOption = new VMOption(builder.toString());
                karafOptions.add(newVmOption);
            } else {
                karafOptions.add(o);
            }
        }

                
> Cannot specify systemPackage options when using karaf.testing.Helper
> --------------------------------------------------------------------
>
>                 Key: KARAF-957
>                 URL: https://issues.apache.org/jira/browse/KARAF-957
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-tooling
>    Affects Versions: 2.2.4
>            Reporter: Raman Gupta
>
> When using the karaf.testing.Helper, it pre-sets the "org.osgi.framework.system.packages.extra"
property to an empty value. Then, when using pax-exam systemPackages(...) option to add system
packages to the list, it does not work since org.osgi.framework.system.packages.extra already
exists in the option list.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message