| 1 | package executor |
| 2 | |
| 3 | import ( |
| 4 | "github.com/gogo/protobuf/proto" |
| 5 | "github.com/mesos/mesos-go/api/v0/messenger" |
| 6 | "github.com/mesos/mesos-go/api/v0/upid" |
| 7 | "golang.org/x/net/context" |
| 8 | ) |
| 9 | |
| 10 | type TestDriver struct { |
| 11 | *MesosExecutorDriver |
| 12 | } |
| 13 | |
| 14 | func (e *TestDriver) SetConnected(b bool) { |
| 15 | e.guarded(func() { |
| 16 | e.connected = b |
| 17 | }) |
| 18 | } |
| 19 | |
| 20 | func (e *TestDriver) SetMessenger(m messenger.Messenger) { |
| 21 | e.messenger = m |
| 22 | } |
| 23 | |
| 24 | func (e *TestDriver) Started() <-chan struct{} { |
| 25 | return e.started |
| 26 | } |
| 27 | |
| 28 | func (e *TestDriver) guarded(f func()) { |
| 29 | e.lock.Lock() |
| 30 | defer e.lock.Unlock() |
| 31 | f() |
| 32 | } |
| 33 | |
| 34 | func (e *TestDriver) Context() context.Context { |
| 35 | return e.context() |
| 36 | } |
| 37 | |
| 38 | func (e *TestDriver) StatusUpdateAcknowledgement(ctx context.Context, from *upid.UPID, msg proto.Message) { |
| 39 | e.guarded(func() { |
| 40 | e.statusUpdateAcknowledgement(ctx, from, msg) |
| 41 | }) |
| 42 | } |