Package org.osgi.service.remoteserviceadmin

Examples of org.osgi.service.remoteserviceadmin.EndpointDescription


            .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);

View Full Code Here


        BundleContext bc = c.createMock(BundleContext.class);
        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>( ) {
View Full Code Here

        BundleContext bc = c.createMock(BundleContext.class);
        ServiceReference sref = c.createMock(ServiceReference.class);
        ExportRegistration exReg = c.createMock(ExportRegistration.class);
        ExportRegistration exReg2 = c.createMock(ExportRegistration.class);
        EndpointListener epl = EasyMock.createMock(EndpointListener.class);
        EndpointDescription epd = c.createMock(EndpointDescription.class);
        EndpointDescription epd2 = c.createMock(EndpointDescription.class);
        ExportReference exRef = c.createMock(ExportReference.class);
        ExportReference exRef2 = c.createMock(ExportReference.class);
       
       
        Map props = new HashMap();
        String[] oc = new String[1];
        oc[0] = "myClass";
        props.put("objectClass", oc);
       
        Map props2 = new HashMap();
        oc = new String[1];
        oc[0] = "notMyClass";
        props2.put("objectClass", oc);
       
       
        EasyMock.expect(bc.getService(EasyMock.eq(sref))).andReturn(epl).anyTimes();
        EasyMock.expect(bc.createFilter((String)EasyMock.anyObject())).andAnswer(new IAnswer<Filter>() {
            public Filter answer() throws Throwable {
                return FrameworkUtil.createFilter((String)EasyMock.getCurrentArguments()[0]);
            }
        }).anyTimes();
        EasyMock.expect(sref.getProperty(EasyMock.eq(EndpointListener.ENDPOINT_LISTENER_SCOPE)))
            .andReturn("(objectClass=myClass)").anyTimes();

       
        EasyMock.expect(exReg.getExportReference()).andReturn(exRef).anyTimes();
        EasyMock.expect(exRef.getExportedEndpoint()).andReturn(epd).anyTimes();
        EasyMock.expect(epd.getProperties()).andReturn(props).anyTimes();
       
        EasyMock.expect(exReg2.getExportReference()).andReturn(exRef2).anyTimes();
        EasyMock.expect(exRef2.getExportedEndpoint()).andReturn(epd2).anyTimes();
        EasyMock.expect(epd2.getProperties()).andReturn(props2).anyTimes();
       
        // must only be called for the first EndpointDestription !
        epl.endpointRemoved(EasyMock.eq(epd), EasyMock.eq("(objectClass=myClass)"));
        EasyMock.expectLastCall().once();
       
View Full Code Here

                Collections.enumeration(Arrays.asList(ed1URL))).anyTimes();
        EasyMock.replay(b);
       
        List<EndpointDescription> eds = LocalDiscoveryUtils.getAllEndpointDescriptions(b);
        assertEquals(4, eds.size());
        EndpointDescription ed0 = eds.get(0);
        assertEquals("http://somewhere:12345", ed0.getId());
        assertEquals(Arrays.asList("SomeService"), ed0.getInterfaces());
        assertEquals(Arrays.asList("confidentiality"),
            ed0.getProperties().get("osgi.remote.requires.intents"));
        assertEquals("testValue", ed0.getProperties().get("testKey"));
       
        EndpointDescription ed1 = eds.get(1);
        assertEquals("myScheme://somewhere:12345", ed1.getId());
        assertEquals(Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), ed1.getInterfaces());
       
        EndpointDescription ed2 = eds.get(2);
        assertEquals("http://somewhere", ed2.getId());
        assertEquals(Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), ed2.getInterfaces());

        EndpointDescription ed3 = eds.get(3);
        assertEquals("http://somewhere:1/2/3/4?5", ed3.getId());
        assertEquals(Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), ed3.getInterfaces());
    }
View Full Code Here

                Collections.enumeration(Arrays.asList(ed2URL))).anyTimes();
        EasyMock.replay(b);
       
        List<EndpointDescription> eds = LocalDiscoveryUtils.getAllEndpointDescriptions(b);
        assertEquals(2, eds.size());
        EndpointDescription ed0 = eds.get(0);
        assertEquals("foo:bar", ed0.getId());
        assertEquals(Arrays.asList("com.acme.HelloService"), ed0.getInterfaces());
        assertEquals(Arrays.asList("SOAP"), ed0.getIntents());
        // changed from exported to imported
        assertEquals("org.apache.cxf.ws", ed0.getProperties().get("service.imported.configs"));
       
        EndpointDescription ed1 = eds.get(1);
        Map<String, Object> props = ed1.getProperties();
        assertEquals(Arrays.asList("com.acme.HelloService", "some.other.Service"), ed1.getInterfaces());
        assertEquals("org.apache.cxf.ws", props.get("service.imported.configs"));
        // exports should have been removed
        assertNull(props.get("service.exported.configs"));
       
        assertEquals(normXML("<other:t1 xmlns:other='http://www.acme.org/xmlns/other/v1.0.0' xmlns='http://www.acme.org/xmlns/other/v1.0.0'><foo type='bar'>haha</foo></other:t1>"),
View Full Code Here

                Collections.enumeration(Arrays.asList(sdURL))).anyTimes();
        EasyMock.replay(b);
       
        List<EndpointDescription> eds = LocalDiscoveryUtils.getAllEndpointDescriptions(b);
        assertEquals(1, eds.size());
        EndpointDescription ed = eds.get(0);
        assertEquals("http://localhost:9090/greeter", ed.getId());
        assertEquals(Arrays.asList("org.apache.cxf.ws"), ed.getConfigurationTypes());
        assertEquals(Arrays.asList("org.apache.cxf.dosgi.samples.greeter.GreeterService"), ed.getInterfaces());
        assertNull("Should not contain service.exported.*",
                ed.getProperties().get(RemoteConstants.SERVICE_EXPORTED_INTERFACES));
        assertNull("Should not contain service.exported.*",
                ed.getProperties().get(RemoteConstants.SERVICE_EXPORTED_CONFIGS));
    }
View Full Code Here

        EasyMock.replay(b);
       
        List<EndpointDescription> eds = LocalDiscoveryUtils.getAllEndpointDescriptions(b);
        assertEquals(2, eds.size());
       
        EndpointDescription ed0 = eds.get(0);
        assertEquals("http://localhost:9000/org/example/SomeService", ed0.getId());
        assertEquals(Arrays.asList("org.apache.cxf.ws"), ed0.getConfigurationTypes());
        assertEquals(Arrays.asList("org.example.SomeService"), ed0.getInterfaces());
        assertEquals(Arrays.asList("confidentiality"), ed0.getIntents());
       
        EndpointDescription ed1 = eds.get(1);
        assertEquals(Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), ed1.getInterfaces());
        assertEquals("5", ed1.getProperties().get("blah"));
    }
View Full Code Here

                value = prop.getText();
            }
            String type = getTypeName(prop);
            map.put(name, instantiate(type, value));
        }
        return new EndpointDescription(map);
    }
View Full Code Here

            if (it.next().startsWith("service.exported.")) {
                it.remove();
            }
        }
       
        return new EndpointDescription(remoteProps);
    }
View Full Code Here

       
        // Start the bundle
        BundleEvent be = new BundleEvent(BundleEvent.STARTED, bundle);
        ld.bundleChanged(be);
        assertEquals(1, ld.endpointDescriptions.size());
        EndpointDescription ed = ld.endpointDescriptions.keySet().iterator().next();
        assertEquals("http://somewhere:12345", ed.getId());
        assertSame(bundle, ld.endpointDescriptions.get(ed));
       
        EasyMock.verify(el);

        // Stop the bundle
View Full Code Here

TOP

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

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.