EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
public Object answer() throws Throwable {
System.out.println("-> addServiceListener: "
+ EasyMock.getCurrentArguments()[1]);
ServiceListener sl = (ServiceListener)EasyMock.getCurrentArguments()[0];
if ("(objectClass=org.osgi.service.remoteserviceadmin.RemoteServiceAdmin)"
.equals(EasyMock.getCurrentArguments()[1])) {
ServiceEvent se = new ServiceEvent(ServiceEvent.REGISTERED, rsaSref);
sl.serviceChanged(se);
} else if ("(objectClass=org.osgi.service.remoteserviceadmin.EndpointListener)"
.equals(EasyMock.getCurrentArguments()[1])) {
ServiceEvent se = new ServiceEvent(ServiceEvent.REGISTERED, eplSref);
sl.serviceChanged(se);
}
return null;
}
}).anyTimes();
bctx.addServiceListener((ServiceListener)EasyMock.anyObject());
EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
public Object answer() throws Throwable {
System.out.println("-> addServiceListener ");
ServiceListener sl = (ServiceListener)EasyMock.getCurrentArguments()[0];
ServiceEvent se = new ServiceEvent(ServiceEvent.REGISTERED, sref);
sl.serviceChanged(se);
se = new ServiceEvent(ServiceEvent.REGISTERED, eplSref);
sl.serviceChanged(se);
se = new ServiceEvent(ServiceEvent.REGISTERED, rsaSref);
sl.serviceChanged(se);
return null;
}
}).anyTimes();