Examples of waitForService()


Examples of org.apache.felix.dm.tracker.ServiceTracker.waitForService()

        tracker.open();

        ServiceRegistration reg = null;

        try {
            ConfigurationAdmin configAdmin = (ConfigurationAdmin) tracker.waitForService(TimeUnit.SECONDS.toMillis(5));
            assertNotNull("No configuration admin service found?!", configAdmin);

            final CountDownLatch latch = new CountDownLatch(1);
            final int configEvent = (props != null) ? ConfigurationEvent.CM_UPDATED : ConfigurationEvent.CM_DELETED;
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker.waitForService()

                } else {
                    LOGGER.debug("Optional resolver '" + resolver + "' not found, using the default resolver");
                    return feature.getBundles();
                }
            } else {
                Resolver r = (Resolver) tracker.waitForService(resolverTimeout);
                if (r == null) {
                    throw new Exception("Unable to find required resolver '" + resolver + "'");
                }
                return r.resolve(feature);
            }
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker.waitForService()

    public void setup() throws Exception {
        final ServiceTracker st = new ServiceTracker(bundleContext, SlingRepository.class.getName(), null);
        st.open(true);
        try {
            this.repository = (SlingRepository) st.waitForService(10000);
        } catch (InterruptedException e) {
        }
       
        // Make sure the JcrResourceProvider is initialized, as it
        // setups conversion of JCR to OSGi events, and some tests use this
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker.waitForService()

    public void test() throws Exception {
        ServiceTracker tracker = new ServiceTracker(bundleContext, TransactionManager.class.getName(), null);
        tracker.open();

        tracker.waitForService(5000L);
        ServiceReference ref = tracker.getServiceReference();
        assertNotNull(ref);
        String[] objClass = (String[]) ref.getProperty(Constants.OBJECTCLASS);
        assertNotNull(objClass);
        boolean found = false;
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker.waitForService()

        System.err.println("Bundle refreshed");
        Thread.sleep(500);
        System.err.println("Starting bundle");
        bundle.start();

        tracker.waitForService(5000L);
        ref = tracker.getServiceReference();
        assertNotNull(ref);
        objClass = (String[]) ref.getProperty(Constants.OBJECTCLASS);
        assertNotNull(objClass);
        found = false;
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker.waitForService()

        ServiceTracker tracker = new ServiceTracker(m_context, serviceName, null);
        tracker.open();
        T result;
        try
        {
            result = (T) tracker.waitForService(DEFAULT_TIMEOUT);
        }
        finally
        {
            tracker.close();
        }
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker.waitForService()

        ServiceRegistration reg = null;
        org.osgi.service.cm.Configuration config = null;

        try
        {
            ConfigurationAdmin configAdmin = (ConfigurationAdmin) tracker.waitForService(TimeUnit.SECONDS.toMillis(5));
            assertNotNull("No configuration admin service found?!", configAdmin);

            final CountDownLatch latch = new CountDownLatch(1);
            final int configEvent = (props != null) ? ConfigurationEvent.CM_UPDATED : ConfigurationEvent.CM_DELETED;
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker.waitForService()

        ServiceTracker tracker = new ServiceTracker(m_context, serviceName, null);
        tracker.open();
        T result;
        try
        {
            result = (T) tracker.waitForService(DEFAULT_TIMEOUT);
        }
        finally
        {
            tracker.close();
        }
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker.waitForService()

    protected <T> T awaitService(String serviceName) throws Exception {
        ServiceTracker tracker = new ServiceTracker(m_context, serviceName, null);
        tracker.open();
        T result;
        try {
            result = (T) tracker.waitForService(DEFAULT_TIMEOUT);
        }
        finally {
            tracker.close();
        }
        return result;
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker.waitForService()


    private static ServiceTracker getServiceManager(final BundleContext context) throws InterruptedException {
        final ServiceTracker serviceManagerTracker = new ServiceTracker(context, SERVICE_MANAGER_NAME, null);
        serviceManagerTracker.open();
        serviceManagerTracker.waitForService(TRACKER_TIMEOUT);
        return serviceManagerTracker;
    }

    @Override
    public void stop(final BundleContext context) throws Exception {
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.