/
simulations_service.go
89 lines (75 loc) · 2.63 KB
/
simulations_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package fake
import (
"github.com/gazebo-web/cloudsim/pkg/simulations"
"github.com/stretchr/testify/mock"
)
// Service is a fake simulations.Service implementation.
type Service struct {
*mock.Mock
}
// Create mocks the Create method.
func (s *Service) Create(input simulations.CreateSimulationInput) (simulations.Simulation, error) {
args := s.Called(input)
sim := args.Get(0).(simulations.Simulation)
return sim, args.Error(1)
}
// UpdateScore mocks the UpdateScore method.
func (s *Service) UpdateScore(groupID simulations.GroupID, score *float64) error {
args := s.Called(groupID, score)
return args.Error(0)
}
// GetWebsocketToken mocks the GetWebsocketToken method.
func (s *Service) GetWebsocketToken(groupID simulations.GroupID) (string, error) {
args := s.Called(groupID)
return args.String(0), args.Error(1)
}
// GetRobots is a mock for the GetRobots method.
func (s *Service) GetRobots(groupID simulations.GroupID) ([]simulations.Robot, error) {
args := s.Called(groupID)
robots := args.Get(0).([]simulations.Robot)
return robots, args.Error(1)
}
// Reject is a mock for the Reject method.
func (s *Service) Reject(groupID simulations.GroupID) (simulations.Simulation, error) {
args := s.Called(groupID)
sim := args.Get(0).(simulations.Simulation)
return sim, args.Error(1)
}
// GetParent is a mock for the GetParent method.
func (s *Service) GetParent(groupID simulations.GroupID) (simulations.Simulation, error) {
args := s.Called(groupID)
sim := args.Get(0).(simulations.Simulation)
return sim, args.Error(1)
}
// UpdateStatus is a mock for the UpdateStatus method.
func (s *Service) UpdateStatus(groupID simulations.GroupID, status simulations.Status) error {
args := s.Called(groupID, status)
return args.Error(0)
}
// Update is a mock for the Update method.
func (s *Service) Update(groupID simulations.GroupID, simulation simulations.Simulation) error {
args := s.Called(groupID)
return args.Error(0)
}
// Get is a mock for the Get method.
func (s *Service) Get(groupID simulations.GroupID) (simulations.Simulation, error) {
args := s.Called(groupID)
sim := args.Get(0).(simulations.Simulation)
return sim, args.Error(1)
}
// MarkStopped is a mock for the MarkStopped method.
func (s *Service) MarkStopped(groupID simulations.GroupID) error {
args := s.Called(groupID)
return args.Error(0)
}
// MarkCharged marks a simulation identified with the given Group ID as charged.
func (s *Service) MarkCharged(groupID simulations.GroupID) error {
args := s.Called(groupID)
return args.Error(0)
}
// NewService initializes a new fake service implementation.
func NewService() *Service {
return &Service{
Mock: new(mock.Mock),
}
}