Package org.osgi.service.remoteserviceadmin

Examples of org.osgi.service.remoteserviceadmin.RemoteServiceAdmin


       
        BundleContext bctx = c.createMock(BundleContext.class);
       
        Bundle topMgrBundle = c.createMock(Bundle.class);
       
        RemoteServiceAdmin rsa = c.createMock(RemoteServiceAdmin.class);
        final ServiceReference rsaSref = c.createMock(ServiceReference.class);
        EndpointListener epl = c.createMock(EndpointListener.class);
        final ServiceReference eplSref = c.createMock(ServiceReference.class);
        EasyMock.expect(eplSref.getProperty(EasyMock.same(EndpointListener.ENDPOINT_LISTENER_SCOPE)))
            .andReturn(scope).anyTimes();
        EasyMock.expect(eplSref.getBundle()).andReturn(topMgrBundle).anyTimes();

        final ServiceReference sref = c.createMock(ServiceReference.class);
        EasyMock.expect(sref.getProperty(EasyMock.same(RemoteConstants.SERVICE_EXPORTED_INTERFACES)))
            .andReturn("*").anyTimes();
        Bundle srefBundle = c.createMock(Bundle.class);
        EasyMock.expect(sref.getBundle()).andReturn(srefBundle).anyTimes();
       
       
        EndpointDescription endpoint = c.createMock(EndpointDescription.class);
        {
            Map props = new HashMap();
            String[] objs = new String[1];
            objs[0] = "abc";
            props.put("objectClass", objs);
            EasyMock.expect(endpoint.getProperties()).andReturn(props).anyTimes();
        }

        ExportRegistration exportRegistration = c.createMock(ExportRegistration.class);
        ExportReference exportReference = c.createMock(ExportReference.class);

        EasyMock.expect(exportRegistration.getExportReference()).andReturn(exportReference).anyTimes();
        EasyMock.expect(exportReference.getExportedEndpoint()).andReturn(endpoint).anyTimes();
        {
            List ret = new ArrayList();
            ret.add(exportRegistration);
            EasyMock.expect(rsa.exportService(EasyMock.same(sref), (Map)EasyMock.anyObject())).andReturn(ret)
                .once();
        }

        epl.endpointAdded((EndpointDescription)EasyMock.anyObject(), (String)EasyMock.anyObject());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
View Full Code Here


        ServiceRegistration sreg = c.createMock(ServiceRegistration.class);
        EasyMock.expect(bc.registerService((String)EasyMock.anyObject(), EasyMock.anyObject(), (Dictionary)EasyMock.anyObject())).andReturn(sreg).anyTimes();
        
       
        EndpointDescription epd = c.createMock(EndpointDescription.class);
        RemoteServiceAdmin rsa  = c.createMock(RemoteServiceAdmin.class);
        final ImportRegistration ireg = c.createMock(ImportRegistration.class);
        ImportReference iref = c.createMock(ImportReference.class);
       
        EasyMock.expect(rsa.importService(EasyMock.eq(epd))).andAnswer(new IAnswer<ImportRegistration>( ) {

            public ImportRegistration answer() throws Throwable {
                sema.release();
                return ireg;
            }
View Full Code Here

        BundleContext bc = control.createMock(BundleContext.class);
        TopologyManager tm = control.createMock(TopologyManager.class);
        TopologyManagerImport tmi = control.createMock(TopologyManagerImport.class);
       
       
        RemoteServiceAdmin rsa = control.createMock(RemoteServiceAdmin.class);
        final ServiceReference rsaSref = control.createMock(ServiceReference.class);
       
       
        tm.removeRemoteServiceAdmin(EasyMock.eq(rsa));
        EasyMock.expectLastCall().once();
View Full Code Here

       
        stRemoteServiceAdmin = new ServiceTracker(bctx, RemoteServiceAdmin.class.getName(), null) {
            @Override
            public Object addingService(ServiceReference reference) {
                LOG.info("Adding RemoteServiceAdmin to list of admins ");
                RemoteServiceAdmin rsa = (RemoteServiceAdmin)bctx.getService(reference);
                synchronized (rsal) {
                    rsal.add(rsa);
                }
                LOG.info("enlisted RemoteEventAdmins: " + this.size());
View Full Code Here

        if (admins == null) {
            // Ignore
            logger.warning("No RemoteAdmin services are available.");
        } else {
            for (Object ra : admins) {
                RemoteServiceAdmin remoteAdmin = (RemoteServiceAdmin)ra;
                Collection<ExportRegistration> exportRegistrations = remoteAdmin.exportService(reference, null);
                if (exportRegistrations != null && !exportRegistrations.isEmpty()) {
                    exportedServices.putValues(reference, exportRegistrations);
                }
            }
        }
View Full Code Here

            props.put(Constants.OBJECTCLASS, new String[] {interfaceClass.getName()});
            EndpointDescription description = new EndpointDescription(props);

            if (admins != null) {
                for (Object ra : admins) {
                    RemoteServiceAdmin remoteAdmin = (RemoteServiceAdmin)ra;
                    ImportRegistration importRegistration = remoteAdmin.importService(description);
                    if (importRegistration != null) {
                        importedServices.putValue(new ImportKey(description, listener), importRegistration);
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.osgi.service.remoteserviceadmin.RemoteServiceAdmin

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.