Package org.osgi.framework.launch

Examples of org.osgi.framework.launch.Framework


        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()
            + "/target/pax-exam-sample9-pde";
        Bundle bundle = bc.installBundle(reference);
        assertNotNull(bundle);
        assertEquals("org.ops4j.pax.exam.sample9.pde", bundle.getSymbolicName());

        bundle.start();
        ServiceReference serviceRef = bc
            .getServiceReference("org.ops4j.pax.exam.sample9.pde.HelloService");
        Object service = bc.getService(serviceRef);
        assertNotNull(service);
        assertEquals("org.ops4j.pax.exam.sample9.pde.impl.EnglishHelloService", service
            .getClass().getName());

        bundle.uninstall();
        framework.stop();
    }
View Full Code Here


    }

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

    }

    // @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();
View Full Code Here

  }

  @Override
  public FrameworkManager getFrameworkManager() {
    final FrameworkManager frameworkManagerMock = mock(FrameworkManager.class);
    final Framework frameworkMock = mock(Framework.class);
    final BundleContext contextMock = mock(BundleContext.class);

    when(frameworkManagerMock.getFramework()).thenReturn(frameworkMock);
    when(frameworkMock.getBundleContext()).thenReturn(contextMock);

    try {
      ServiceReference<?> serviceReferenceMock = mock(ServiceReference.class);
      when(contextMock.getAllServiceReferences(null, "(&(objectClass=java.lang.Runnable)(objectClass=java.lang.reflect.InvocationHandler))"))
        .thenReturn(new ServiceReference[]{serviceReferenceMock});
View Full Code Here

    moduleComponent.executeInternal();
  }

  // @Test
  public void testRegisteredServices() {
    final Framework framework = moduleComponent.getFrameworkManager().getFramework();
    final BundleContext bundleContext = framework.getBundleContext();
    assertNotNull(bundleContext.getServiceReference(CategoryService.class.getName()));
    assertNotNull(bundleContext.getServiceReference(ContentService.class.getName()));
    assertNotNull(bundleContext.getServiceReference(FileFolderService.class.getName()));
    assertNotNull(bundleContext.getServiceReference(NodeService.class.getName()));
    assertNotNull(bundleContext.getServiceReference(PolicyComponent.class.getName()));
View Full Code Here

TOP

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

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.