Package org.apache.karaf.features.internal

Examples of org.apache.karaf.features.internal.BundleManager


    }

    @SuppressWarnings("unchecked")
    private BundleManager prepareBundleManagerForInstallUninstall(String bundleUri, String bundlename) throws Exception {
        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        BundleContext bundleContext = EasyMock.createMock(BundleContext.class);
        Bundle installedBundle = createDummyBundle(12345L, bundlename, headers());
        expect(bundleManager.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();
        expect(bundleManager.installBundleIfNeeded(bundleUri, 0, null)).andReturn(new BundleInstallerResult(installedBundle, true));
        expect(bundleManager.getBundleContext()).andReturn(bundleContext);
        ignoreRefreshes(bundleManager);
        bundleManager.uninstall(Collections.EMPTY_LIST, true);
        EasyMock.expectLastCall().times(2);
        return bundleManager;
    }
View Full Code Here


                + "  <feature name='f1' version='0.1'><feature version='0.1'>f2</feature></feature>"
                + "  <feature name='f2' version='0.1'><bundle>bundle-0.1</bundle></feature>"
                + "  <feature name='f2' version='0.2'><bundle>bundle-0.2</bundle></feature>"
                + "</features>");

        BundleManager bundleManager = prepareBundleManagerForInstallUninstall("bundle-0.1", "bundle-0.1");

        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
        svc.addRepository(uri);
        svc.installFeature("f1", "0.1");
View Full Code Here

                + "  <feature name='f1' version='0.1'><feature>f2</feature></feature>"
                + "  <feature name='f2' version='0.1'><bundle>bundle-0.1</bundle></feature>"
                + "  <feature name='f2' version='0.2'><bundle>bundle-0.2</bundle></feature>"
                + "</features>");

        BundleManager bundleManager = prepareBundleManagerForInstallUninstall("bundle-0.2", "bundle-0.2");

        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
        svc.addRepository(uri);
        svc.installFeature("f1", "0.1");
View Full Code Here

                + "  <feature name='f1' version='0.1'><feature version='[0.1,0.3)'>f2</feature></feature>"
                + "  <feature name='f2' version='0.1'><bundle>bundle-0.1</bundle></feature>"
                + "  <feature name='f2' version='0.2'><bundle>bundle-0.2</bundle></feature>"
                + "</features>");

        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        BundleContext bundleContext = EasyMock.createMock(BundleContext.class);
        Bundle bundleVer02 = createDummyBundle(54321L, "bundleVer02", headers());
        expect(bundleManager.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();
        expect(bundleManager.installBundleIfNeeded("bundle-0.2", 0, null)).andReturn(new BundleInstallerResult(bundleVer02, true));
        expect(bundleManager.getBundleContext()).andReturn(bundleContext);
        ignoreRefreshes(bundleManager);
        bundleManager.uninstall(Collections.EMPTY_LIST, true);

        EasyMock.expectLastCall().times(2);

        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
View Full Code Here

                + "<feature name='f1' version='0.1'><feature version='[0.1,0.3)'>f2</feature></feature>"
                + "  <feature name='f2' version='0.1'><bundle>%s</bundle></feature>"
                + "  <feature name='f2' version='0.2'><bundle>%s</bundle></feature>"
                + "</features>", bundleVer01Uri, bundleVer02Uri);
       
        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        BundleContext bundleContext = EasyMock.createMock(BundleContext.class);
        Bundle bundleVer01 = createDummyBundle(12345L, "bundleVer01", headers());
        expect(bundleManager.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();
        expect(bundleManager.installBundleIfNeeded(bundleVer01Uri, 0, null)).andReturn(new BundleInstallerResult(bundleVer01, true));
        expect(bundleManager.installBundleIfNeeded(bundleVer01Uri, 0, null)).andReturn(new BundleInstallerResult(bundleVer01, false));
        expect(bundleManager.getBundleContext()).andReturn(bundleContext);
        ignoreRefreshes(bundleManager);
        bundleManager.uninstall(Collections.EMPTY_LIST, true);
       
        EasyMock.expectLastCall().times(2);

        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
View Full Code Here

                + "  <feature name='f1' version='0.1'><feature version='[0.1,0.3)'>f2</feature></feature>"
                + "  <feature name='f2' version='0.1'><bundle>bundle1</bundle></feature>"
                + "  <feature name='f2' version='0.2'><bundle>bundle2</bundle></feature>"
                + "</features>");
       
        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        expect(bundleManager.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();
       
        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
        svc.addRepository(uri);
        verify(bundleManager);
View Full Code Here

        URI uri = createTempRepo(
                "<features name='test' xmlns='http://karaf.apache.org/xmlns/features/v1.0.0'>"
                + "  <feature name='f1'><bundle start='true'>bundle-f1</bundle></feature>"
                + "</features>");

        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        Bundle installedBundle = createDummyBundle(12345L, "bundle-f1", headers());
        FeaturesServiceImpl svc = testAddRepository("bundle-f1", uri, bundleManager, installedBundle);
       
        reset(bundleManager);
       
        expect(bundleManager.installBundleIfNeeded(eq("bundle-f1"), eq(0), eq((String)null))).andReturn(new BundleInstallerResult(installedBundle, true));
        expect(bundleManager.getDataFile(EasyMock.anyObject(String.class))).andReturn(dataFile);
        ignoreRefreshes(bundleManager);
        replay(bundleManager);
        svc.installFeature("f1", org.apache.karaf.features.internal.model.Feature.DEFAULT_VERSION, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
        verify(bundleManager);
       
View Full Code Here

                + "  <feature name='f1' version='0.2'><bundle>bundle-0.1</bundle></feature>"
                + "</features>");

        Bundle bundlef101 = createDummyBundle(12345L, "bundle-0.1", headers());

        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        BundleContext bundleContext = EasyMock.createMock(BundleContext.class);
        expect(bundleManager.getDataFile(EasyMock.anyObject(String.class))).andReturn(dataFile).anyTimes();
        expect(bundleManager.installBundleIfNeeded("bundle-0.1", 0, null)).andReturn(new BundleInstallerResult(bundlef101, true));
        expect(bundleManager.installBundleIfNeeded("bundle-0.1", 0, null)).andReturn(new BundleInstallerResult(bundlef101, false));
        expect(bundleManager.getBundleContext()).andReturn(bundleContext);
        ignoreRefreshes(bundleManager);
        bundleManager.uninstall(Collections.EMPTY_LIST);       
        EasyMock.expectLastCall().times(2);
       
       
        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
View Full Code Here

    public void testAddAndRemoveRepository() throws Exception {
        URI uri = createTempRepo("<features name='test' xmlns='http://karaf.apache.org/xmlns/features/v1.0.0'>"
                + "  <feature name='f1' version='0.1'><bundle>bundle-f1-0.1</bundle></feature>"
                + "</features>");

        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        expect(bundleManager.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();

        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
        EasyMock.verify(bundleManager);
View Full Code Here

        URI uri = createTempRepo("<features name='test' xmlns='http://karaf.apache.org/xmlns/features/v1.0.0'>"
                                 + "  <feature name='f1' version='0.1'><feature version='0.1'>f2</feature><bundle>bundle-f1-0.1</bundle></feature>"
                                 + "  <feature name='f2' version='0.1'><bundle>bundle-f2-0.1</bundle></feature>"
                                 + "</features>");

        BundleManager bundleManager = EasyMock.createMock(BundleManager.class);
        BundleContext bundleContext = EasyMock.createMock(BundleContext.class);
        Bundle bundlef101 = createDummyBundle(12345L, "bundle-f1-0.1", headers());
        Bundle bundlef201 = createDummyBundle(54321L, "bundle-f2-0.1", headers());
        expect(bundleManager.getDataFile(EasyMock.<String> anyObject())).andReturn(dataFile).anyTimes();
        expect(bundleManager.installBundleIfNeeded("bundle-f1-0.1", 0, null))
            .andReturn(new BundleInstallerResult(bundlef101, true));
        expect(bundleManager.installBundleIfNeeded("bundle-f2-0.1", 0, null))
            .andReturn(new BundleInstallerResult(bundlef201, true));
        expect(bundleManager.getBundleContext()).andReturn(bundleContext).anyTimes();
        expect(bundleContext.getBundle(12345)).andReturn(bundlef101).anyTimes();
        ignoreRefreshes(bundleManager);
        bundleManager.uninstall(Collections.EMPTY_LIST);
      
        EasyMock.expectLastCall().anyTimes();
        replay(bundleManager);
       
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
View Full Code Here

TOP

Related Classes of org.apache.karaf.features.internal.BundleManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.