Examples of FeaturesServiceImpl


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

        URI uri = tmp.toURI();

        BundleContext bundleContext = prepareBundleContextForInstallUninstall();

        FeaturesServiceImpl svc = new FeaturesServiceImpl();
        svc.setBundleContext(bundleContext);
        svc.addRepository(uri);

        svc.installFeature("f1", "0.1");

        // Uninstall repository
        svc.uninstallFeature("f1", "0.1");
        svc.uninstallFeature("f2", "0.2");
    }
View Full Code Here

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

        URI uri = tmp.toURI();

        BundleContext bundleContext = prepareBundleContextForInstallUninstall();

        FeaturesServiceImpl svc = new FeaturesServiceImpl();
        svc.setBundleContext(bundleContext);
        svc.addRepository(uri);

        svc.installFeature("f1", "0.1");

        // Uninstall repository
        svc.uninstallFeature("f1", "0.1");
        svc.uninstallFeature("f2", "0.2");
    }
View Full Code Here

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

            }
        });

        replay(bundleContext, installedBundle, sysBundle, frameworkWiring);

        FeaturesServiceImpl svc = new FeaturesServiceImpl();
        svc.setBundleContext(bundleContext);
        svc.addRepository(uri);

        svc.installFeature("f2", "0.1");
        svc.installFeature("f1", "0.1");

        // Uninstall repository
        svc.uninstallFeature("f1", "0.1");
        svc.uninstallFeature("f2", "0.1");
    }
View Full Code Here

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

        pw.println("</features>");
        pw.close();

        URI uri = tmp.toURI();

        FeaturesServiceImpl svc = new FeaturesServiceImpl() {
            @Override
            protected void saveState() {
            }
            @Override
            protected Set<Bundle> findBundlesToRefresh() {
                return Collections.emptySet();
            }
        };
        svc.addRepository(uri);

        Feature feature = svc.getFeature("f2", "[0.1,0.3)");
        assertEquals("f2", feature.getName());
        assertEquals("0.2", feature.getVersion());

        Feature feature2 = svc.getFeature("f2", "0.0.0");
        assertEquals("f2", feature2.getName());
        assertEquals("0.2", feature2.getVersion());

        Feature feature3 = svc.getFeature("f2", "0.2");
        assertEquals("f2", feature3.getName());
        assertEquals("0.2", feature3.getVersion());

        Feature feature4 = svc.getFeature("f2", "0.3");
        assertNull(feature4);
    }
View Full Code Here

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

                + "  <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);
       
        Feature[] installed = svc.listInstalledFeatures();
        assertEquals(1, installed.length);
        assertEquals("f1", installed[0].getName());
    }
View Full Code Here

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

            Bundle installedBundle) throws IOException, BundleException, Exception {
        expect(bundleManager.getDataFile(EasyMock.anyObject(String.class))).andReturn(dataFile);
        expect(bundleManager.installBundleIfNeeded(eq(name), eq(0), eq((String)null))).andReturn(new BundleInstallerResult(installedBundle, true)).anyTimes();

        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
        svc.addRepository(uri);
        Repository[] repositories = svc.listRepositories();
        verify(bundleManager);

        assertNotNull(repositories);
        assertEquals(1, repositories.length);
        assertNotNull(repositories[0]);
View Full Code Here

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

        bundleManager.uninstall(Collections.EMPTY_LIST);       
        EasyMock.expectLastCall().times(2);
       
       
        replay(bundleManager);
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
        svc.addRepository(uri);

        try {
            svc.uninstallFeature("f1");
            fail("Uninstall should have failed as feature is not installed");
        } catch (Exception e) {
            // ok
        }

        svc.installFeature("f1", "0.1", EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
        svc.installFeature("f1", "0.2", EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));

        try {
            svc.uninstallFeature("f1");
            fail("Uninstall should have failed as feature is installed in multiple versions");
        } catch (Exception e) {
            // ok
        }

        svc.uninstallFeature("f1", "0.1");
        svc.uninstallFeature("f1");
        verify(bundleManager);
    }   
View Full Code Here

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

        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);

        svc.addRepository(uri);                                                    
        svc.removeRepository(uri);
        verify(bundleManager);
    }
View Full Code Here

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

        bundleManager.uninstall(Collections.EMPTY_LIST);
      
        EasyMock.expectLastCall().anyTimes();
        replay(bundleManager);
       
        FeaturesServiceImpl svc = new FeaturesServiceImpl(bundleManager);
        svc.addRepository(uri);
        svc.installFeature("f1", "0.1");
        svc.uninstallFeature("f1", "0.1");
        verify(bundleManager);

    }
View Full Code Here

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

                + "</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");
        svc.uninstallFeature("f1", "0.1");
        svc.uninstallFeature("f2", "0.1");
        verify(bundleManager);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.