Exemplo n.º 1
0
// manifoldStart creates a cleaner worker, given a base.APICaller.
func manifoldStart(apiCaller base.APICaller) (worker.Worker, error) {
	api := cleaner.NewAPI(apiCaller)
	w, err := NewCleaner(api)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return w, nil
}
Exemplo n.º 2
0
// Init returns a new, initialised instance of TestCommon.
func Init(c *gc.C, method string, expectArgs, useResults interface{}, err error) (t *TestCommon) {
	t = &TestCommon{}
	t.apiArgs = apitesting.CheckArgs{
		Facade:        "Cleaner",
		VersionIsZero: true,
		IdIsEmpty:     true,
		Method:        method,
		Args:          expectArgs,
		Results:       useResults,
	}

	t.called = make(chan struct{}, 100)
	t.apiCaller = apitesting.NotifyingCheckingAPICaller(c, &t.apiArgs, t.called, err)
	t.api = cleaner.NewAPI(t.apiCaller)

	c.Check(t.api, gc.NotNil)
	return
}
Exemplo n.º 3
0
// Cleaner returns a version of the state that provides access to the cleaner API
func (st *State) Cleaner() *cleaner.API {
	return cleaner.NewAPI(st)
}