forked from cloudfoundry/bosh-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_applier_provider.go
37 lines (31 loc) · 1.01 KB
/
fake_applier_provider.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
package fakes
import (
boshbc "github.com/cloudfoundry/bosh-agent/agent/applier/bundlecollection"
boshpackages "github.com/cloudfoundry/bosh-agent/agent/applier/packages"
)
type FakeApplierProvider struct {
RootApplier *FakeApplier
JobSpecificAppliers map[string]*FakeApplier
RootBundleCollectionBundleCollection boshbc.BundleCollection
}
func NewFakeApplierProvider() *FakeApplierProvider {
return &FakeApplierProvider{
JobSpecificAppliers: map[string]*FakeApplier{},
}
}
func (p *FakeApplierProvider) Root() boshpackages.Applier {
if p.RootApplier == nil {
panic("Root package applier not found")
}
return p.RootApplier
}
func (p *FakeApplierProvider) JobSpecific(jobName string) boshpackages.Applier {
applier := p.JobSpecificAppliers[jobName]
if applier == nil {
panic("Job specific package applier not found")
}
return applier
}
func (p *FakeApplierProvider) RootBundleCollection() boshbc.BundleCollection {
return p.RootBundleCollectionBundleCollection
}