changeset 1689:a1dd52f5f6dd

Refactor boot options PR2288 Reviewed-by: omajid Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2015-March/013445.html
author Jie Kang <jkang@redhat.com>
date Tue, 19 May 2015 10:55:20 -0400
parents f1daf6d1812f
children ebb0f807c7aa
files main/src/main/java/com/redhat/thermostat/main/Thermostat.java main/src/main/java/com/redhat/thermostat/main/impl/FrameworkOptions.java main/src/main/java/com/redhat/thermostat/main/impl/FrameworkProvider.java main/src/test/java/com/redhat/thermostat/main/ThermostatTest.java main/src/test/java/com/redhat/thermostat/main/impl/FrameworkOptionsTest.java main/src/test/java/com/redhat/thermostat/main/impl/FrameworkProviderTest.java
diffstat 6 files changed, 293 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/main/src/main/java/com/redhat/thermostat/main/Thermostat.java	Thu May 07 09:07:23 2015 -0400
+++ b/main/src/main/java/com/redhat/thermostat/main/Thermostat.java	Tue May 19 10:55:20 2015 -0400
@@ -41,6 +41,7 @@
 import java.util.Iterator;
 import java.util.List;
 
+import com.redhat.thermostat.main.impl.FrameworkOptions;
 import com.redhat.thermostat.main.impl.FrameworkProvider;
 import com.redhat.thermostat.shared.config.CommonPaths;
 import com.redhat.thermostat.shared.config.internal.CommonPathsImpl;
@@ -58,36 +59,15 @@
     }
 
     public void start(CommonPaths paths, String[] args) {
-        boolean printOSGiInfo = false;
-        boolean ignoreBundleVersions = false;
-        String bootDelegation = null;
+        FrameworkOptions frameworkOptions = new FrameworkOptions(args);
 
-        List<String> toProcess = new ArrayList<>(Arrays.asList(args));
-        Iterator<String> iter = toProcess.iterator();
-        while (iter.hasNext()) {
-            String arg = iter.next();
-            if ("--print-osgi-info".equals(arg)) {
-                printOSGiInfo = true;
-                iter.remove();
-            }
-            if ("--ignore-bundle-versions".equals(arg)) {
-                ignoreBundleVersions = true;
-                iter.remove();
-            }
-            if (arg.startsWith("--boot-delegation=")) {
-                int startIndex = "--boot-delegation=".length();
-                bootDelegation = arg.substring(startIndex);
-                iter.remove();
-            }
-        }
-
-        FrameworkProvider frameworkProvider = createFrameworkProvider(paths, printOSGiInfo, ignoreBundleVersions, bootDelegation);
-        frameworkProvider.start(toProcess.toArray(new String[0]));
+        FrameworkProvider frameworkProvider = createFrameworkProvider(paths, frameworkOptions);
+        frameworkProvider.start(frameworkOptions.getOtherOptions());
     }
 
     /* allow overriding for unit testing */
-    protected FrameworkProvider createFrameworkProvider(CommonPaths paths, boolean printOSGiInfo, boolean ignoreBundleVersions, String bootDelegation) {
-        return new FrameworkProvider(paths, printOSGiInfo, ignoreBundleVersions, bootDelegation);
+    protected FrameworkProvider createFrameworkProvider(CommonPaths paths, FrameworkOptions options) {
+        return new FrameworkProvider(paths, options);
     }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/src/main/java/com/redhat/thermostat/main/impl/FrameworkOptions.java	Tue May 19 10:55:20 2015 -0400
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2012-2015 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.main.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Thermostat options for the OSGi framework and relevant debug output.
+ *
+ */
+public class FrameworkOptions {
+
+    public enum Option {
+
+        /**
+         * Print debug information related to the OSGi framework's boot/shutdown
+         * process.
+         */
+        PRINT_OSGI_INFO("--print-osgi-info"),
+        /**
+         * Ignore exact bundle versions and use whatever version is available.
+         */
+        IGNORE_BUNDLE_VERSIONS("--ignore-bundle-versions"),
+        /**
+         * Boot delegation string passed on to the OSGi framework.
+         */
+        BOOT_DELEGATION("--boot-delegation"),
+        ;
+
+        private final String optString;
+
+        private Option(String optString) {
+            this.optString = optString;
+        }
+
+        public String getOptString() {
+            return optString;
+        }
+    }
+
+    private final Map<Option, String> globalOptions;
+    private final String[] otherOptions;
+
+    public FrameworkOptions(String[] args) {
+        this.globalOptions = new HashMap<>();
+        this.otherOptions = processGlobalOptions(args);
+    }
+
+    private String[] processGlobalOptions(String[] args) {
+        List<String> toProcess = new ArrayList<>(Arrays.asList(args));
+        Iterator<String> iter = toProcess.iterator();
+        while (iter.hasNext()) {
+            String arg = iter.next();
+            if (Option.PRINT_OSGI_INFO.getOptString().equals(arg)) {
+                globalOptions.put(Option.PRINT_OSGI_INFO,
+                        Boolean.TRUE.toString());
+                iter.remove();
+            }
+            if (Option.IGNORE_BUNDLE_VERSIONS.getOptString().equals(arg)) {
+                globalOptions.put(Option.IGNORE_BUNDLE_VERSIONS,
+                        Boolean.TRUE.toString());
+                iter.remove();
+            }
+            if (arg.startsWith(Option.BOOT_DELEGATION.getOptString() + "=")) {
+                int startIndex = (Option.BOOT_DELEGATION.getOptString() + "=")
+                        .length();
+                String bootDelegation = arg.substring(startIndex);
+                if ("".equals(bootDelegation)) {
+                    throw new RuntimeException(
+                            "Unexpected string used with boot delegation: '"
+                                    + bootDelegation + "'");
+                }
+                globalOptions.put(Option.BOOT_DELEGATION, bootDelegation);
+                iter.remove();
+            }
+        }
+        return toProcess.toArray(new String[] {});
+    }
+
+    public String[] getOtherOptions() {
+        return otherOptions;
+    }
+
+    public boolean printOsgiInfo() {
+        return globalOptions.containsKey(Option.PRINT_OSGI_INFO);
+    }
+
+    public boolean ignoreBundleVersions() {
+        return globalOptions.containsKey(Option.IGNORE_BUNDLE_VERSIONS);
+    }
+
+    public String bootDelegationValue() {
+        return globalOptions.get(Option.BOOT_DELEGATION);
+    }
+
+}
--- a/main/src/main/java/com/redhat/thermostat/main/impl/FrameworkProvider.java	Thu May 07 09:07:23 2015 -0400
+++ b/main/src/main/java/com/redhat/thermostat/main/impl/FrameworkProvider.java	Tue May 19 10:55:20 2015 -0400
@@ -68,24 +68,16 @@
     private static final String PROPS_FILE = "/com/redhat/thermostat/main/impl/bootstrapbundles.properties";
     private static final String BUNDLELIST = "bundles";
 
-    private CommonPaths paths;
-    private boolean printOSGiInfo;
-    private boolean ignoreBundleVersions;
-    private String bootDelegation;
-
+    private final CommonPaths paths;
+    private final FrameworkOptions frameworkOptions;
+    
     // The framework cache location; Must not be shared between apps!
     private Path osgiCacheStorage;
-
-    public FrameworkProvider(CommonPaths paths, boolean printOSGiInfo, boolean ignoreBundleVersions, String bootDelegation) {
-        this.paths = paths;
+    
 
-        this.printOSGiInfo = printOSGiInfo;
-        this.ignoreBundleVersions = ignoreBundleVersions;
-        this.bootDelegation = bootDelegation;
-
-        if ("".equals(bootDelegation)) {
-            throw new RuntimeException("Unexpected string used with boot delegation: '" + bootDelegation + "'");
-        }
+    public FrameworkProvider(CommonPaths paths, FrameworkOptions options) {
+        this.paths = paths;
+        this.frameworkOptions = options;
     }
 
     // This is our ticket into OSGi land. Unfortunately, we to use a bit of reflection here.
@@ -134,7 +126,7 @@
     private void prepareFramework(final Framework framework) throws BundleException, IOException {
         framework.init();
         framework.start();
-        if (printOSGiInfo) {
+        if (frameworkOptions.printOsgiInfo()) {
             System.out.println(DEBUG_PREFIX + "OSGi framework has started.");
         }
 
@@ -144,11 +136,11 @@
                 try {
                     framework.stop();
                     framework.waitForStop(0);
-                    if (printOSGiInfo) {
+                    if (frameworkOptions.printOsgiInfo()) {
                         System.out.println(DEBUG_PREFIX + "OSGi framework has shut down.");
                     }
                     recursivelyDeleteDirectory(osgiCacheStorage.toFile());
-                    if (printOSGiInfo) {
+                    if (frameworkOptions.printOsgiInfo()) {
                         System.out.println(DEBUG_PREFIX + "Removed OSGi cache directory: "
                                 + osgiCacheStorage.toFile().getAbsolutePath());
                     }
@@ -169,7 +161,8 @@
         }
         directory.delete();
     }
-
+    
+    
     private Framework makeFramework() throws FileNotFoundException, IOException {
         File osgiCacheDir = new File(paths.getUserCacheDirectory(), "osgi-cache");
         if (!osgiCacheDir.isDirectory() && !osgiCacheDir.mkdirs()) {
@@ -188,7 +181,7 @@
         // 
         // This fixes Thermostat BZ 1110.
         osgiCacheStorage = Files.createTempDirectory(osgiCacheDir.toPath(), null);
-        if (printOSGiInfo) {
+        if (frameworkOptions.printOsgiInfo()) {
             System.out.println(DEBUG_PREFIX + "OSGi cache location: "
                     + osgiCacheStorage.toFile().getAbsolutePath());
         }
@@ -199,11 +192,11 @@
         String extraPackages = getOSGiPublicPackages();
         bundleConfigurations.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, extraPackages);
         bundleConfigurations.put(Constants.FRAMEWORK_STORAGE, osgiCacheStorage.toFile().getAbsolutePath());
-        if (bootDelegation != null) {
-            if (printOSGiInfo) {
-                System.out.println("Boot delegation: " + bootDelegation);
+        if (frameworkOptions.bootDelegationValue() != null) {
+            if (frameworkOptions.printOsgiInfo()) {
+                System.out.println("Boot delegation: " + frameworkOptions.bootDelegationValue());
             }
-            bundleConfigurations.put(Constants.FRAMEWORK_BOOTDELEGATION, bootDelegation);
+            bundleConfigurations.put(Constants.FRAMEWORK_BOOTDELEGATION, frameworkOptions.bootDelegationValue());
         }
         Iterator<FrameworkFactory> factories = loader.iterator();
         if (factories.hasNext()) {
@@ -234,17 +227,17 @@
                 locations.add(location);
             }
         }
-        BundleManager.preLoadBundles(framework, locations, printOSGiInfo);
+        BundleManager.preLoadBundles(framework, locations, frameworkOptions.printOsgiInfo());
     }
 
     private void setLoaderVerbosity(Framework framework) throws InterruptedException {
         Object loader = getService(framework, BundleManager.class.getName());
-        callVoidReflectedMethod(loader, "setPrintOSGiInfo", printOSGiInfo);
+        callVoidReflectedMethod(loader, "setPrintOSGiInfo", frameworkOptions.printOsgiInfo());
     }
 
     private void setIgnoreBundleVersions(Framework framework) throws InterruptedException {
         Object loader = getService(framework, BundleManager.class.getName());
-        callVoidReflectedMethod(loader, "setIgnoreBundleVersions", ignoreBundleVersions);
+        callVoidReflectedMethod(loader, "setIgnoreBundleVersions", frameworkOptions.ignoreBundleVersions());
     }
 
     private void runLauncher(Framework framework, String[] args) throws InterruptedException {
@@ -313,5 +306,6 @@
             return file.toURI().toString();
         }
     }
+
 }
 
--- a/main/src/test/java/com/redhat/thermostat/main/ThermostatTest.java	Thu May 07 09:07:23 2015 -0400
+++ b/main/src/test/java/com/redhat/thermostat/main/ThermostatTest.java	Tue May 19 10:55:20 2015 -0400
@@ -37,6 +37,7 @@
 package com.redhat.thermostat.main;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.doCallRealMethod;
@@ -48,6 +49,7 @@
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
+import com.redhat.thermostat.main.impl.FrameworkOptions;
 import com.redhat.thermostat.main.impl.FrameworkProvider;
 import com.redhat.thermostat.shared.config.CommonPaths;
 
@@ -55,30 +57,24 @@
 
     private FrameworkProvider provider;
     private CommonPaths paths;
-    private ArgumentCaptor<Boolean> printOsgiInfoCaptor;
-    private ArgumentCaptor<Boolean> ignoreBundleVersionsCaptor;
+    private ArgumentCaptor<FrameworkOptions> optsCaptor;
     private Thermostat thermostat;
-    private ArgumentCaptor<String> bootDelgationCaptor;
 
     @Before
     public void setUp() {
         provider = mock(FrameworkProvider.class);
         paths = mock(CommonPaths.class);
+        
 
-        printOsgiInfoCaptor = ArgumentCaptor.forClass(Boolean.class);
-        ignoreBundleVersionsCaptor = ArgumentCaptor.forClass(Boolean.class);
-        bootDelgationCaptor = ArgumentCaptor.forClass(String.class);
+        optsCaptor = ArgumentCaptor.forClass(FrameworkOptions.class);
 
         thermostat = mock(Thermostat.class);
 
         when(thermostat
                 .createFrameworkProvider(eq(paths),
-                        printOsgiInfoCaptor.capture(),
-                        ignoreBundleVersionsCaptor.capture(),
-                        bootDelgationCaptor.capture()))
+                        optsCaptor.capture()))
                 .thenReturn(provider);
         doCallRealMethod().when(thermostat).start(eq(paths), any(String[].class));
-
     }
 
     @Test
@@ -87,7 +83,8 @@
         thermostat.start(paths, args);
 
         verify(provider).start(eq(new String[]{}));
-        assertEquals(false, printOsgiInfoCaptor.getValue());
+        FrameworkOptions opts = optsCaptor.getValue();
+        assertEquals(false, opts.printOsgiInfo());
     }
 
     @Test
@@ -96,7 +93,8 @@
         thermostat.start(paths, args);
 
         verify(provider).start(eq(new String[]{}));
-        assertEquals(true, printOsgiInfoCaptor.getValue());
+        FrameworkOptions opts = optsCaptor.getValue();
+        assertEquals(true, opts.printOsgiInfo());
     }
 
     @Test
@@ -105,7 +103,8 @@
         thermostat.start(paths, args);
 
         verify(provider).start(eq(new String[]{}));
-        assertEquals(false, ignoreBundleVersionsCaptor.getValue());
+        FrameworkOptions opts = optsCaptor.getValue();
+        assertEquals(false, opts.ignoreBundleVersions());
     }
 
     @Test
@@ -114,7 +113,8 @@
         thermostat.start(paths, args);
 
         verify(provider).start(eq(new String[]{}));
-        assertEquals(true, ignoreBundleVersionsCaptor.getValue());
+        FrameworkOptions opts = optsCaptor.getValue();
+        assertEquals(true, opts.ignoreBundleVersions());
     }
 
     @Test
@@ -123,7 +123,8 @@
         thermostat.start(paths, args);
 
         verify(provider).start(eq(new String[]{}));
-        assertEquals(null, bootDelgationCaptor.getValue());
+        FrameworkOptions opts = optsCaptor.getValue();
+        assertNull(opts.bootDelegationValue());
     }
 
     @Test
@@ -132,16 +133,16 @@
         thermostat.start(paths, args);
 
         verify(provider).start(eq(new String[]{}));
-        assertEquals("foo", bootDelgationCaptor.getValue());
+        FrameworkOptions opts = optsCaptor.getValue();
+        assertEquals("foo", opts.bootDelegationValue());
     }
 
-    @Test
-    public void verifyBootDelegationIsPassedAlong2() {
+    @Test(expected=RuntimeException.class)
+    public void verifyBootDelegationFailsForIllegalValue() {
         String[] args = {"--boot-delegation="};
+        // This throws runtime exception due to empty boot delegation
+        // string.
         thermostat.start(paths, args);
-
-        verify(provider).start(eq(new String[]{}));
-        assertEquals("", bootDelgationCaptor.getValue());
     }
 
     @Test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/src/test/java/com/redhat/thermostat/main/impl/FrameworkOptionsTest.java	Tue May 19 10:55:20 2015 -0400
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2012-2015 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.main.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+
+import org.junit.Test;
+
+public class FrameworkOptionsTest {
+
+    @Test
+    public void canGetPrintOsgiInfo() {
+        String[] args = new String[] { "--print-osgi-info", "help" };
+        FrameworkOptions opts = new FrameworkOptions(args);
+        assertNull(opts.bootDelegationValue());
+        assertFalse(opts.ignoreBundleVersions());
+        assertTrue(opts.printOsgiInfo());
+        assertEquals(Arrays.asList("help"),
+                Arrays.asList(opts.getOtherOptions()));
+    }
+
+    @Test
+    public void canGetBootDelegation() {
+        String[] args = new String[] { "--boot-delegation=foo", "help" };
+        FrameworkOptions opts = new FrameworkOptions(args);
+        assertEquals("foo", opts.bootDelegationValue());
+        assertFalse(opts.ignoreBundleVersions());
+        assertFalse(opts.printOsgiInfo());
+        assertEquals(Arrays.asList("help"),
+                Arrays.asList(opts.getOtherOptions()));
+    }
+
+    @Test
+    public void canGetIgnoreBundleVersion() {
+        String[] args = new String[] { "--ignore-bundle-versions", "help" };
+        FrameworkOptions opts = new FrameworkOptions(args);
+        assertNull(opts.bootDelegationValue());
+        assertTrue(opts.ignoreBundleVersions());
+        assertFalse(opts.printOsgiInfo());
+        assertEquals(Arrays.asList("help"),
+                Arrays.asList(opts.getOtherOptions()));
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void emtpyStringForBootDelegationThrowsException() {
+        String[] args = new String[] { "--boot-delegation=", "help" };
+        // This is expected to fail since the boot delegation value is an empty
+        // string.
+        new FrameworkOptions(args);
+    }
+}
--- a/main/src/test/java/com/redhat/thermostat/main/impl/FrameworkProviderTest.java	Thu May 07 09:07:23 2015 -0400
+++ b/main/src/test/java/com/redhat/thermostat/main/impl/FrameworkProviderTest.java	Tue May 19 10:55:20 2015 -0400
@@ -49,6 +49,8 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
@@ -202,7 +204,8 @@
 
     @Test
     public void testStartRunsOSGiFramework() throws Exception {
-        FrameworkProvider provider = new FrameworkProvider(paths, false, false, null);
+        FrameworkOptions opts = new FrameworkOptions(new String[] {});
+        FrameworkProvider provider = new FrameworkProvider(paths, opts);
 
         provider.start(new String[] {});
 
@@ -212,7 +215,8 @@
 
     @Test
     public void testStartRunsLauncher() throws Exception {
-        FrameworkProvider provider = new FrameworkProvider(paths, false, false, null);
+        FrameworkOptions opts = new FrameworkOptions(new String[] {});
+        FrameworkProvider provider = new FrameworkProvider(paths, opts);
 
         provider.start(new String[] {});
 
@@ -221,7 +225,9 @@
 
     @Test
     public void testPrintOSGiInfoParameterIsPassedToBundleManager() {
-        FrameworkProvider provider = new FrameworkProvider(paths, true, false, null);
+        FrameworkOptions opts = mock(FrameworkOptions.class);
+        when(opts.printOsgiInfo()).thenReturn(true);
+        FrameworkProvider provider = new FrameworkProvider(paths, opts);
 
         provider.start(new String[] {});
 
@@ -230,23 +236,20 @@
 
     @Test
     public void testIgnoreBundleVersionsParameterIsPassedToBundleManager() {
-        FrameworkProvider provider = new FrameworkProvider(paths, false, true, null);
+        FrameworkOptions opts = mock(FrameworkOptions.class);
+        when(opts.ignoreBundleVersions()).thenReturn(true);
+        FrameworkProvider provider = new FrameworkProvider(paths, opts);
 
         provider.start(new String[] {});
 
         assertEquals(true, bundleManager.ignoreBundleVersion);
     }
 
-    @Test(expected=RuntimeException.class)
-    public void testErrorThrownOnEmptyBootDelegationParameter() {
-        FrameworkProvider provider = new FrameworkProvider(paths, false, true, "");
-
-        provider.start(new String[] {});
-    }
-
     @Test
     public void testNullBootDelegationIsNotSetInConfiguration() {
-        FrameworkProvider provider = new FrameworkProvider(paths, false, false, null);
+        FrameworkOptions opts = mock(FrameworkOptions.class);
+        when(opts.bootDelegationValue()).thenReturn(null);
+        FrameworkProvider provider = new FrameworkProvider(paths, opts);
 
         provider.start(new String[] {});
 
@@ -256,11 +259,14 @@
 
     @Test
     public void testPackagesListedInBootDelegationArePassedToFramework() {
-        FrameworkProvider provider = new FrameworkProvider(paths, false, true, "foo");
+        FrameworkOptions opts = mock(FrameworkOptions.class);
+        when(opts.bootDelegationValue()).thenReturn("foo");
+        FrameworkProvider provider = new FrameworkProvider(paths, opts);
 
         provider.start(new String[] {});
 
         Map<String, String> config = TestFrameworkFactory.getConfig();
         assertEquals("foo", config.get(Constants.FRAMEWORK_BOOTDELEGATION));
     }
+
 }