Package org.osgi.service.discovery

Examples of org.osgi.service.discovery.ServiceEndpointDescription


       
        Map<String, Object> sdProps = new HashMap<String, Object>();
        sdProps.put("osgi.remote.configuration.type", Constants.POJO_CONFIG_TYPE);
        sdProps.put(Constants.POJO_ADDRESS_PROPERTY, "http://localhost:9876/abcd");
        sdProps.put(Constants.POJO_HTTP_SERVICE_CONTEXT, "/abc");
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
                Collections.singletonList("MyInterface"), sdProps);
       
        assertNull("Should not get a handler as this is a conflict situation",
                f.getHandler(bc, sd, null, new HashMap<String, Object>()));
    }
View Full Code Here


        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
       
        Map<String, Object> sdProps = new HashMap<String, Object>();
        sdProps.put("osgi.remote.configuration.type", Constants.WSDL_CONFIG_TYPE);
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
                Collections.singletonList("MyInterface"), sdProps);
       
        CxfDistributionProvider dp = new DistributionProviderImpl(bc);
        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
        assertTrue(handler instanceof WsdlConfigurationTypeHandler);       
View Full Code Here

       
        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
       
        Map<String, Object> sdProps = new HashMap<String, Object>();
        sdProps.put("osgi.remote.configuration.type", "foobar");
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(
                Collections.singletonList("MyInterface"), sdProps);
       
        assertNull("Should not get a handler as this an unsupported config type",
                f.getHandler(bc, sd, null, new HashMap<String, Object>()));       
    }
View Full Code Here

        List<String> iList = new ArrayList<String>();
        for (String iName : interfaceNames) {
            iList.add(iName);
        }
       
        ServiceEndpointDescription sd = EasyMock.createNiceMock(ServiceEndpointDescription.class);
        sd.getProvidedInterfaces();
        EasyMock.expectLastCall().andReturn(iList);
        return sd;
    }
View Full Code Here

        List<EndpointInfo> list = hook.getEndpoints().get(sref);
        assertNotNull(list);
        assertEquals(serviceNames.length, list.size());
        for (int i = 0; i < serviceNames.length; i++) {
            assertNotNull(list.get(i));
            ServiceEndpointDescription sd = list.get(i).getServiceDescription();
            assertNotNull(sd);
            assertNotNull(sd.getProvidedInterfaces());
            assertEquals(1, sd.getProvidedInterfaces().size());
            Collection names = sd.getProvidedInterfaces();
            assertEquals(1, names.size());
            assertEquals(serviceNames[i], names.toArray()[0]);
            String excludeProp = "osgi.remote.interfaces";
            assertNull(sd.getProperties().get(excludeProp));
            String addrProp =
                org.apache.cxf.dosgi.dsw.Constants.POJO_ADDRESS_PROPERTY;
            assertEquals(addresses[i], sd.getProperties().get(addrProp));
        }       

        Map<String, ServiceRegistration> registeredRegs =
            dswContext.getRegisteredRegistrations();
        assertNotNull(registeredRegs);
View Full Code Here

       
        Server srvr = control.createMock(Server.class);
        ServiceReference serviceReference = control.createMock(ServiceReference.class);
        BundleContext dswContext = control.createMock(BundleContext.class);
        BundleContext callingContext = control.createMock(BundleContext.class);
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("java.lang.String");
        Object service = "hi";

        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
        handler.createServer(serviceReference, dswContext, callingContext, sd, String.class, service);
        EasyMock.expectLastCall().andReturn(srvr);
View Full Code Here

       
        Server srvr = control.createMock(Server.class);
        ServiceReference serviceReference = control.createMock(ServiceReference.class);
        BundleContext dswContext = control.createMock(BundleContext.class);
        BundleContext callingContext = control.createMock(BundleContext.class);
        ServiceEndpointDescription sd = mockServiceDescription(control, "Foo");
        Object service = "hi";

        ConfigurationTypeHandler handler = control.createMock(ConfigurationTypeHandler.class);
        handler.createServer(serviceReference, dswContext, callingContext, sd, String.class, service);
        EasyMock.expectLastCall().andReturn(srvr);
View Full Code Here

                                                              String... interfaceNames) {
        List<String> iList = new ArrayList<String>();
        for (String iName : interfaceNames) {
          iList.add(iName);
      }
        ServiceEndpointDescription sd = control.createMock(ServiceEndpointDescription.class);
        sd.getProvidedInterfaces();
        EasyMock.expectLastCall().andReturn(iList);
        return sd;
    }
View Full Code Here

        EasyMock.replay(sr);
        EasyMock.replay(callingContext);

        Map<String, Object> props = new HashMap<String, Object>();
        props.put(Constants.POJO_HTTP_SERVICE_CONTEXT, "/myRunnable");
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Runnable.class.getName(), props);
       
        assertEquals("Precondition failed", 0, dp.getExposedServices().size());
        assertEquals("Precondition failed", "", sfb.getAddress());
        h.createServer(sr, dswContext, callingContext, sd, Runnable.class, myService);
        assertEquals("The address should be set to '/'. The Servlet context dictates the actual location.", "/", sfb.getAddress());
View Full Code Here

        BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(sr);
        EasyMock.replay(callingContext);

        Map<String, Object> props = new HashMap<String, Object>();
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Runnable.class.getName(), props);
       
        assertEquals("Precondition failed", 0, dp.getExposedServices().size());
        h.createServer(sr, dswContext, callingContext, sd, Runnable.class, myService);
        assertEquals(1, dp.getExposedServices().size());
        assertSame(sr, dp.getExposedServices().iterator().next());
View Full Code Here

TOP

Related Classes of org.osgi.service.discovery.ServiceEndpointDescription

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.