-
Notifications
You must be signed in to change notification settings - Fork 601
/
Copy pathsnappy_part_iface_test.go
88 lines (78 loc) · 2.71 KB
/
snappy_part_iface_test.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
// -*- Mode: Go; indent-tabs-mode: t -*-
/*
* Copyright (C) 2014-2015 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package daemon
import (
"time"
"github.com/ubuntu-core/snappy/progress"
"github.com/ubuntu-core/snappy/snap"
"github.com/ubuntu-core/snappy/snappy"
)
// a for-testing Part
type tP struct {
name string
version string
description string
origin string
hash string
isActive bool
isInstalled bool
needsReboot bool
date time.Time
channel string
icon string
_type snap.Type
installedSize int64
downloadSize int64
installName string
installErr error
uninstallErr error
config string
configErr error
setActiveErr error
frameworks []string
frameworksErr error
svcYamls []snappy.ServiceYaml
}
func (p *tP) Name() string { return p.name }
func (p *tP) Version() string { return p.version }
func (p *tP) Description() string { return p.description }
func (p *tP) Origin() string { return p.origin }
func (p *tP) Hash() string { return p.hash }
func (p *tP) IsActive() bool { return p.isActive }
func (p *tP) IsInstalled() bool { return p.isInstalled }
func (p *tP) NeedsReboot() bool { return p.needsReboot }
func (p *tP) Date() time.Time { return p.date }
func (p *tP) Channel() string { return p.channel }
func (p *tP) Icon() string { return p.icon }
func (p *tP) Type() snap.Type { return p._type }
func (p *tP) InstalledSize() int64 { return p.installedSize }
func (p *tP) DownloadSize() int64 { return p.downloadSize }
func (p *tP) Install(progress.Meter, snappy.InstallFlags) (string, error) {
return p.installName, p.installErr
}
func (p *tP) Uninstall(pb progress.Meter) error { return p.uninstallErr }
func (p *tP) Config(cfg []byte) (string, error) {
if len(cfg) > 0 {
p.config = string(cfg)
}
return p.config, p.configErr
}
func (p *tP) SetActive(bool, progress.Meter) error { return p.setActiveErr }
func (p *tP) Frameworks() ([]string, error) { return p.frameworks, p.frameworksErr }
// for ServiceYamler interface:
func (p *tP) ServiceYamls() []snappy.ServiceYaml { return p.svcYamls }