// RPCObserver implements Observer. It will create an // rpc.ObserverMultiplexer by calling all the Observer's RPCObserver // methods. func (m *Multiplexer) RPCObserver() rpc.Observer { rpcObservers := make([]rpc.Observer, len(m.observers)) for i, o := range m.observers { rpcObservers[i] = o.RPCObserver() } return rpc.NewObserverMultiplexer(rpcObservers...) }
func (*multiplexerSuite) TestServerRequest_CallsAllObservers(c *gc.C) { observers := []*fakeobserver.RPCInstance{ (&fakeobserver.Instance{}).RPCObserver().(*fakeobserver.RPCInstance), (&fakeobserver.Instance{}).RPCObserver().(*fakeobserver.RPCInstance), } o := rpc.NewObserverMultiplexer(observers[0], observers[1]) var ( hdr rpc.Header body string ) o.ServerRequest(&hdr, body) for _, f := range observers { f.CheckCall(c, 0, "ServerRequest", &hdr, body) } }