Package org.osgi.framework.launch

Examples of org.osgi.framework.launch.FrameworkFactory


        if (framework != null) {
            throw new IllegalStateException("The framework is started already");
        }
        ServiceDeclaration sd = ServiceDiscovery.getInstance().getServiceDeclaration(FrameworkFactory.class.getName());
        Class<?> factoryCls = sd.loadClass();
        FrameworkFactory factory = (FrameworkFactory)factoryCls.newInstance();
        Map<Object, Object> props = new HashMap<Object, Object>();
        props.put("osgi.clean", "true");
        props.put("osgi.instance.area", new File("target/workspace").toURI().toString());
        props.put("osgi.install.area", new File("target/eclipse").toURI().toString());
        props.put("osgi.configuration.area", new File("target/eclipse").toURI().toString());
        framework = factory.newFramework(props);
        framework.start();
        return framework.getBundleContext();
    }
View Full Code Here


        Map<String, String> props = new HashMap<String, String>();
        props.put("osgi.clean", "true");
        props.put("osgi.dev", "target/classes");

        FrameworkFactory frameworkFactory = FrameworkFactoryFinder.loadSingleFrameworkFactory();
        Framework framework = frameworkFactory.newFramework(props);
        framework.start();
        BundleContext bc = framework.getBundleContext();
        assertNotNull(bc);

        String reference = "reference:file:" + PathUtils.getBaseDir()
View Full Code Here

        props = new HashMap<String, String>();
    }

    @Test
    public void provisionMvnUrl() throws BundleException, IOException {
        FrameworkFactory frameworkFactory = FrameworkFactoryFinder.loadSingleFrameworkFactory();
        Framework framework = frameworkFactory.newFramework(props);
        provisionToFramework(framework);
    }
View Full Code Here

*/
public class NativeContainerTest {

    @Test
    public void emptySetup() throws IOException {
        FrameworkFactory ff = mock(FrameworkFactory.class);
        ExamSystem system = mock(ExamSystem.class);
        NativeTestContainer container = new NativeTestContainer(system, ff);
        assertThat(container, is(notNullValue()));
        verifyNoMoreInteractions(ff);
    }
View Full Code Here

        verifyNoMoreInteractions(ff);
    }

    // @Test
    public void starting() throws IOException {
        FrameworkFactory ff = mock(FrameworkFactory.class);
        Framework fw = mock(Framework.class);
        when(ff.newFramework(Matchers.<Map<String, String>> anyObject())).thenReturn(fw);
        ExamSystem system = mock(ExamSystem.class);

        NativeTestContainer container = new NativeTestContainer(system, ff);
        container.start();
        verifyNoMoreInteractions(ff);
View Full Code Here

    @Test
    public void forkEquinox() throws BundleException, IOException, InterruptedException,
        NotBoundException, URISyntaxException {
        ServiceLoader<FrameworkFactory> loader = ServiceLoader.load(FrameworkFactory.class);
        FrameworkFactory frameworkFactory = loader.iterator().next();

        ForkedFrameworkFactory forkedFactory = new ForkedFrameworkFactory(frameworkFactory);

        Map<String, Object> frameworkProperties = new HashMap<String, Object>();
        frameworkProperties.put(Constants.FRAMEWORK_STORAGE, storage.getAbsolutePath());
View Full Code Here

    @Test
    public void forkWithBootClasspath() throws BundleException, IOException, InterruptedException,
        NotBoundException, URISyntaxException {
        ServiceLoader<FrameworkFactory> loader = ServiceLoader.load(FrameworkFactory.class);
        FrameworkFactory frameworkFactory = loader.iterator().next();

        ForkedFrameworkFactory forkedFactory = new ForkedFrameworkFactory(frameworkFactory);

        List<String> bootClasspath = Arrays.asList(
            new File("target/bundles/metainf-services.jar").getCanonicalPath()
View Full Code Here

    @Test(expected = TestContainerException.class)
    public void forkWithInvalidBootClasspath() throws BundleException, IOException, InterruptedException,
        NotBoundException, URISyntaxException {
        ServiceLoader<FrameworkFactory> loader = ServiceLoader.load(FrameworkFactory.class);
        FrameworkFactory frameworkFactory = loader.iterator().next();

        ForkedFrameworkFactory forkedFactory = new ForkedFrameworkFactory(frameworkFactory);

        List<String> bootClasspath = Arrays.asList(
                CoreOptions.maven("org.kohsuke.metainf-services", "metainf-services", "1.2").getURL()
View Full Code Here

        List<File> bundleDirs = getBundleRepos();
        ArtifactResolver resolver = new SimpleMavenResolver(bundleDirs);

        // Start up the OSGI framework
        ClassLoader classLoader = createClassLoader(resolver);
        FrameworkFactory factory = loadFrameworkFactory(classLoader);
        framework = factory.newFramework(config.props);

        // Hack to set felix logger
        try {
            if (framework.getClass().getName().startsWith("org.apache.felix.")) {
                Field field = framework.getClass().getDeclaredField("m_logger");
View Full Code Here

            InputStream is = classLoader.getResourceAsStream("META-INF/services/" + FrameworkFactory.class.getName());
            BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
            factoryClass = br.readLine();
            br.close();
        }
        FrameworkFactory factory = (FrameworkFactory) classLoader.loadClass(factoryClass).newInstance();
        return factory;
    }
View Full Code Here

TOP

Related Classes of org.osgi.framework.launch.FrameworkFactory

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.