-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock.go
60 lines (51 loc) · 1.73 KB
/
mock.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
package common_type
var _ IInstanceDescription = (*MockInstanceDesc)(nil)
var _ IPluginDescriptor = (*MockPluginDescriptor)(nil)
var _ IHost = (*MockHost)(nil)
var _ IHostBoot = (*MockHostBoot)(nil)
type MockInstanceDesc struct {
PluginInstanceID string
PluginDescriptor *MockPluginDescriptor
}
func (i *MockInstanceDesc) InstanceID() string { return i.PluginInstanceID }
func (i *MockInstanceDesc) PluginDescription() IPluginDescriptor { return i.PluginDescriptor }
type MockPluginDescriptor struct {
AppID string
PluginName string
Lang string
LangVer string
AppVer string
HostVer string
MinSysVer string
}
func (i *MockPluginDescriptor) ApplicationID() string { return i.AppID }
func (i *MockPluginDescriptor) Name() string { return i.PluginName }
func (i *MockPluginDescriptor) Language() string { return i.Lang }
func (i *MockPluginDescriptor) LanguageVersion() IVersion {
result, _ := ParseVersionString(i.LangVer)
return result
}
func (i *MockPluginDescriptor) ApplicationVersion() IVersion {
result, _ := ParseVersionString(i.AppVer)
return result
}
func (i *MockPluginDescriptor) HostVersion() IVersion {
result, _ := ParseVersionString(i.HostVer)
return result
}
func (i *MockPluginDescriptor) MinSystemVersion() IVersion {
result, _ := ParseVersionString(i.MinSysVer)
return result
}
type MockHost struct {
Info HostInfo
Status HostStatus
}
func (h *MockHost) GetInfo() HostInfo { return h.Info }
func (h *MockHost) GetStatus() HostStatus { return h.Status }
type MockHostBoot struct {
Info HostBootInfo
Status HostBootStatus
}
func (b *MockHostBoot) GetInfo() HostBootInfo { return b.Info }
func (b *MockHostBoot) GetStatus() HostBootStatus { return b.Status }