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>() {