Jiri Simsa | d7616c9 | 2015-03-24 23:44:30 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Vanadium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 5 | package fake |
| 6 | |
| 7 | import ( |
| 8 | "v.io/v23/context" |
| 9 | "v.io/v23/rpc" |
Cosmos Nicolaou | f3c1909 | 2015-05-27 17:53:37 -0700 | [diff] [blame^] | 10 | "v.io/x/ref/lib/apilog" |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 11 | ) |
| 12 | |
| 13 | // SetClient can be used to inject a mock client implementation into the context. |
| 14 | func SetClient(ctx *context.T, client rpc.Client) *context.T { |
| 15 | return context.WithValue(ctx, clientKey, client) |
| 16 | } |
Todd Wang | ad49204 | 2015-04-17 15:58:40 -0700 | [diff] [blame] | 17 | func (r *Runtime) WithNewClient(ctx *context.T, opts ...rpc.ClientOpt) (*context.T, rpc.Client, error) { |
Cosmos Nicolaou | f3c1909 | 2015-05-27 17:53:37 -0700 | [diff] [blame^] | 18 | defer apilog.LogCallf(ctx, "opts...=%v", opts)(ctx, "") // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 19 | panic("unimplemented") |
| 20 | } |
| 21 | func (r *Runtime) GetClient(ctx *context.T) rpc.Client { |
Cosmos Nicolaou | f3c1909 | 2015-05-27 17:53:37 -0700 | [diff] [blame^] | 22 | defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 23 | c, _ := ctx.Value(clientKey).(rpc.Client) |
| 24 | return c |
| 25 | } |
| 26 | |
| 27 | func (r *Runtime) NewServer(ctx *context.T, opts ...rpc.ServerOpt) (rpc.Server, error) { |
Cosmos Nicolaou | f3c1909 | 2015-05-27 17:53:37 -0700 | [diff] [blame^] | 28 | defer apilog.LogCallf(ctx, "opts...=%v", opts)(ctx, "") // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 29 | panic("unimplemented") |
| 30 | } |
Todd Wang | ad49204 | 2015-04-17 15:58:40 -0700 | [diff] [blame] | 31 | func (r *Runtime) WithNewStreamManager(ctx *context.T) (*context.T, error) { |
Cosmos Nicolaou | f3c1909 | 2015-05-27 17:53:37 -0700 | [diff] [blame^] | 32 | defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 33 | panic("unimplemented") |
| 34 | } |
| 35 | |
| 36 | func (r *Runtime) GetListenSpec(ctx *context.T) rpc.ListenSpec { |
Cosmos Nicolaou | f3c1909 | 2015-05-27 17:53:37 -0700 | [diff] [blame^] | 37 | defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT |
Matt Rosencrantz | 94502cf | 2015-03-18 09:43:44 -0700 | [diff] [blame] | 38 | return rpc.ListenSpec{} |
| 39 | } |