| 1 | /** |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
| 18 | |
| 19 | package mock |
| 20 | |
| 21 | import ( |
| 22 | "github.com/mesos/mesos-go/api/v0/executor" |
| 23 | "github.com/mesos/mesos-go/api/v0/mesosproto" |
| 24 | "github.com/stretchr/testify/mock" |
| 25 | ) |
| 26 | |
| 27 | // Executor is used for testing the executor driver. |
| 28 | type Executor struct { |
| 29 | mock.Mock |
| 30 | } |
| 31 | |
| 32 | // New returns a mocked executor. |
| 33 | func New() *Executor { |
| 34 | return &Executor{} |
| 35 | } |
| 36 | |
| 37 | // Registered implements the Registered handler. |
| 38 | func (e *Executor) Registered(executor.ExecutorDriver, *mesosproto.ExecutorInfo, *mesosproto.FrameworkInfo, *mesosproto.SlaveInfo) { |
| 39 | e.Called() |
| 40 | } |
| 41 | |
| 42 | // Reregistered implements the Reregistered handler. |
| 43 | func (e *Executor) Reregistered(executor.ExecutorDriver, *mesosproto.SlaveInfo) { |
| 44 | e.Called() |
| 45 | } |
| 46 | |
| 47 | // Disconnected implements the Disconnected handler. |
| 48 | func (e *Executor) Disconnected(executor.ExecutorDriver) { |
| 49 | e.Called() |
| 50 | } |
| 51 | |
| 52 | // LaunchTask implements the LaunchTask handler. |
| 53 | func (e *Executor) LaunchTask(executor.ExecutorDriver, *mesosproto.TaskInfo) { |
| 54 | e.Called() |
| 55 | } |
| 56 | |
| 57 | // KillTask implements the KillTask handler. |
| 58 | func (e *Executor) KillTask(executor.ExecutorDriver, *mesosproto.TaskID) { |
| 59 | e.Called() |
| 60 | } |
| 61 | |
| 62 | // FrameworkMessage implements the FrameworkMessage handler. |
| 63 | func (e *Executor) FrameworkMessage(executor.ExecutorDriver, string) { |
| 64 | e.Called() |
| 65 | } |
| 66 | |
| 67 | // Shutdown implements the Shutdown handler. |
| 68 | func (e *Executor) Shutdown(executor.ExecutorDriver) { |
| 69 | e.Called() |
| 70 | } |
| 71 | |
| 72 | // Error implements the Error handler. |
| 73 | func (e *Executor) Error(executor.ExecutorDriver, string) { |
| 74 | e.Called() |
| 75 | } |