Package org.apache.karaf.features.internal.service

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


        try {
            eventAdminListener = new EventAdminListener(bundleContext);
        } catch (Throwable t) {
            eventAdminListener = null;
        }
        featuresService = new FeaturesServiceImpl(
                bundleContext.getBundle(),
                bundleContext.getBundle(0).getBundleContext(),
                stateStorage,
                featureFinder,
                eventAdminListener,
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>");

        FeaturesServiceImpl svc = new FeaturesServiceImpl(null, null, new Storage(), null, null, null, null, null, null, null, null, null);
        svc.addRepository(uri);

        assertEquals(feature("f2", "0.2"), svc.getFeature("f2", "[0.1,0.3)"));
        assertEquals(feature("f2", "0.2"), svc.getFeature("f2", "0.0.0"));
        assertEquals(feature("f2", "0.2"), svc.getFeature("f2", "0.2"));
        assertNull(svc.getFeature("f2", "0.3"));
    }
View Full Code Here

        expect(bundle.adapt(FrameworkStartLevel.class)).andReturn(fsl);
        expect(fsl.getInitialBundleStartLevel()).andReturn(50);
        expect(fsl.getStartLevel()).andReturn(100);
        replay(bundleContext, bundle, fsl);

        FeaturesServiceImpl svc = new FeaturesServiceImpl(null, bundleContext, new Storage(), null, null, null, null, null, null, null, null, null);
        svc.addRepository(uri);
        try {
            List<String> features = new ArrayList<String>();
            for (Feature feature : svc.listFeatures()) {
                features.add(feature.getId());
            }
            Collections.reverse(features);
            svc.installFeatures(new CopyOnWriteArraySet<String>(features),
                                EnumSet.noneOf(FeaturesService.Option.class));
            fail("Call should have thrown an exception");
        } catch (Exception t) {
            // Expected
        }
View Full Code Here

    @Test
    public void testSchemaValidation() throws Exception {
        URI uri = createTempRepo("<features name='test' xmlns='http://karaf.apache.org/xmlns/features/v1.0.0'>"
                + "  <featur><bundle>somebundle</bundle></featur></features>");

        FeaturesServiceImpl svc = new FeaturesServiceImpl(null, null, new Storage(), null, null, null, null, null, null, null, null, null);
        try {
            svc.addRepository(uri);
            fail("exception expected");
        } catch (Exception e) {
            assertTrue(e.getMessage().contains("Unable to validate"));
        }
    }
View Full Code Here

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

        FeaturesServiceImpl svc = new FeaturesServiceImpl(null, null, new Storage(), null, null, null, null, null, null, null, null, null);
        svc.addRepository(uri);
        Feature feature = svc.getFeature("f1");
        Assert.assertNotNull("No feature named fi found", feature);       
        List<BundleInfo> bundles = feature.getBundles();
        Assert.assertEquals(2, bundles.size());
    }
View Full Code Here

TOP

Related Classes of org.apache.karaf.features.internal.service.FeaturesServiceImpl

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.