Package org.osgi.framework

Examples of org.osgi.framework.Bundle.uninstall()


        awaitRefreshPackagesEvent();

        assertTrue("Two bundles should be started!", getCurrentBundles().size() == 2);

        Bundle rpBundle = dp.getBundle(getSymbolicName("rp1"));
        rpBundle.uninstall();

        assertTrue("One bundle should be started!", getCurrentBundles().size() == 1);

        assertEquals("Expected no deployment package?!", 1, countDeploymentPackages());
View Full Code Here


        jarOut.close();
        out.close();
       
        if (existingBundle != null) {
            existingBundle.stop();
            existingBundle.uninstall();
        }

        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());

        Bundle bundle = bundleContext.installBundle("file://" + bundleName
View Full Code Here

     * @see org.osgi.jmx.framework.FrameworkMBean#uninstallBundle(long)
     */
    public void uninstallBundle(long bundleIdentifier) throws IOException {
        Bundle bundle = FrameworkUtils.resolveBundle(context, bundleIdentifier);
        try {
            bundle.uninstall();
        } catch (Exception be) {
            IOException ioex = new IOException("Failed to uninstall bundle with id " + bundleIdentifier);
            ioex.initCause(be);
            throw ioex;
        }
View Full Code Here

            bundles.removeAll(b);
        }
        for (long bundleId : bundles) {
            Bundle b = getBundleContext().getBundle(bundleId);
            if (b != null) {
                b.uninstall();
            }
        }
        if (refresh) {
            if (verbose) {
                System.out.println("Refreshing packages");
View Full Code Here

   @Override
   public void uninstallBundle(BundleHandle handle) throws BundleException
   {
      Bundle bundle = getBundle(handle);
      bundle.uninstall();
   }

   @Override
   public int getBundleState(BundleHandle handle)
   {
View Full Code Here

                bundle.start();
                Assert.assertEquals(Bundle.ACTIVE, bundle.getState());
                ServiceReference sref = context.getServiceReference("org.osgi.service.event.EventAdmin");
                assertNotNull("EventAdmin service not null", sref);
            } finally {
                bundle.uninstall();
            }
        } finally {
            content.close();
        }
    }
View Full Code Here

        // Stop the bundle
        bundle.stop();
        assertEquals(Bundle.RESOLVED, bundle.getState());

        bundle.uninstall();
        assertEquals(Bundle.UNINSTALLED, bundle.getState());
    }

    @Deployment(name = DEPLOYMENT_NAME, managed = false, testable = false)
    public static JavaArchive getTestArchive() {
View Full Code Here

                ServiceReference sref = context.getServiceReference(StringBuffer.class.getName());
                StringBuffer service = (StringBuffer) context.getService(sref);
                assertEquals("hello world", service.toString());
            } finally {
                // Uninstall the client bundle
                clientBundle.uninstall();
            }
        } finally {
            // Undeploy the target module
            deployer.undeploy(TARGET_MODULE_NAME);
        }
View Full Code Here

            // Stop the bundle
            bundle.stop();
            Assert.assertEquals(Bundle.RESOLVED, bundle.getState());
        } finally {
            bundle.uninstall();
            Assert.assertEquals(Bundle.UNINSTALLED, bundle.getState());
        }
    }

    @Deployment(name = BUNDLE_DEPLOYMENT_NAME, managed = false, testable = false)
View Full Code Here

        Method testMethod = testClass.getMethod("runAllTestsFromBundle", Bundle.class);
        Object testObject = testClass.newInstance();
        testMethod.invoke(testObject, testBundle);
       
        testBundle.stop();
        testBundle.uninstall();
    }
   
    // Create and install a bundle with the specified manifest file
    // The bundle contains all files from the list of directories specified
    public Bundle createAndInstallBundle(String bundleLocation, String manifestFileName,
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.