Examples of ExportReference


Examples of org.osgi.service.remoteserviceadmin.ExportReference

            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();
View Full Code Here

Examples of org.osgi.service.remoteserviceadmin.ExportReference

        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

Examples of org.osgi.service.remoteserviceadmin.ExportReference

    Properties props = getServiceProperties();
    // Put "1" for "testonekey"
    props.put("testonekey", "1");
    // Actually register with default service (IConcatService) as a remote service
    registration = registerDefaultService(props);
    ExportReference exportRef = null;
    Thread.sleep(15000);
    for(RemoteServiceAdminEvent e: remoteServiceAdminEvents)
      if (e.getType() == RemoteServiceAdminEvent.EXPORT_REGISTRATION) exportRef = e.getExportReference();
   
    assertTrue(exportRef != null);
    // remoteServiceAdminEvents should have the Export registration
    assertTrue(remoteServiceAdminEvents.size() > 0);
    // Get ExportReference
    EndpointDescription oldED = exportRef.getExportedEndpoint();
    assertNotNull(oldED);
    Map<String,?> oldEDProperties = oldED.getProperties();
    assertNotNull(oldEDProperties);
    assertTrue("1".equals(oldEDProperties.get("testonekey")));
    assertTrue(oldEDProperties.get("testtwokey")==null);

    // Change testonekey value to "two" and set a new property "testtwokey" to "2"
    props.put("testonekey", "two");
    props.put("testtwokey", "2");
    // Set/update the properties on the registration
    this.registration.setProperties(props);
   
    // Now get new EndpointDescription and test that new properties have been changed in EndpointDescription
    EndpointDescription updatedED = exportRef.getExportedEndpoint();
    assertNotNull(updatedED);
    Map<String,?> updatedEDProperties = updatedED.getProperties();
    assertNotNull(updatedEDProperties);
    assertTrue("two".equals(updatedEDProperties.get("testonekey")));
    assertTrue("2".equals(updatedEDProperties.get("testtwokey")));
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.