2020-09-30 09:14:00 +02:00
|
|
|
// Code generated by mockery v2.1.0. DO NOT EDIT.
|
|
|
|
|
|
|
|
package replication
|
|
|
|
|
|
|
|
import (
|
|
|
|
context "context"
|
|
|
|
|
2021-03-03 04:45:33 +01:00
|
|
|
controllerreplication "github.com/goharbor/harbor/src/controller/replication"
|
2020-09-30 09:14:00 +02:00
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
|
2021-03-03 04:45:33 +01:00
|
|
|
model "github.com/goharbor/harbor/src/replication/model"
|
|
|
|
|
2020-09-30 09:14:00 +02:00
|
|
|
q "github.com/goharbor/harbor/src/lib/q"
|
|
|
|
|
2021-03-03 04:45:33 +01:00
|
|
|
replication "github.com/goharbor/harbor/src/pkg/replication"
|
2020-09-30 09:14:00 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// Controller is an autogenerated mock type for the Controller type
|
|
|
|
type Controller struct {
|
|
|
|
mock.Mock
|
|
|
|
}
|
|
|
|
|
2021-03-03 04:45:33 +01:00
|
|
|
// CreatePolicy provides a mock function with given fields: ctx, policy
|
|
|
|
func (_m *Controller) CreatePolicy(ctx context.Context, policy *replication.Policy) (int64, error) {
|
|
|
|
ret := _m.Called(ctx, policy)
|
|
|
|
|
|
|
|
var r0 int64
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, *replication.Policy) int64); ok {
|
|
|
|
r0 = rf(ctx, policy)
|
|
|
|
} else {
|
|
|
|
r0 = ret.Get(0).(int64)
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *replication.Policy) error); ok {
|
|
|
|
r1 = rf(ctx, policy)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeletePolicy provides a mock function with given fields: ctx, id
|
|
|
|
func (_m *Controller) DeletePolicy(ctx context.Context, id int64) error {
|
|
|
|
ret := _m.Called(ctx, id)
|
|
|
|
|
|
|
|
var r0 error
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
|
|
|
|
r0 = rf(ctx, id)
|
|
|
|
} else {
|
|
|
|
r0 = ret.Error(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0
|
|
|
|
}
|
|
|
|
|
2020-09-30 09:14:00 +02:00
|
|
|
// ExecutionCount provides a mock function with given fields: ctx, query
|
|
|
|
func (_m *Controller) ExecutionCount(ctx context.Context, query *q.Query) (int64, error) {
|
|
|
|
ret := _m.Called(ctx, query)
|
|
|
|
|
|
|
|
var r0 int64
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) int64); ok {
|
|
|
|
r0 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
r0 = ret.Get(0).(int64)
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *q.Query) error); ok {
|
|
|
|
r1 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetExecution provides a mock function with given fields: ctx, executionID
|
2021-03-03 04:45:33 +01:00
|
|
|
func (_m *Controller) GetExecution(ctx context.Context, executionID int64) (*controllerreplication.Execution, error) {
|
2020-09-30 09:14:00 +02:00
|
|
|
ret := _m.Called(ctx, executionID)
|
|
|
|
|
2021-03-03 04:45:33 +01:00
|
|
|
var r0 *controllerreplication.Execution
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) *controllerreplication.Execution); ok {
|
2020-09-30 09:14:00 +02:00
|
|
|
r0 = rf(ctx, executionID)
|
|
|
|
} else {
|
|
|
|
if ret.Get(0) != nil {
|
2021-03-03 04:45:33 +01:00
|
|
|
r0 = ret.Get(0).(*controllerreplication.Execution)
|
2020-09-30 09:14:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
|
|
r1 = rf(ctx, executionID)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
2021-03-03 04:45:33 +01:00
|
|
|
// GetPolicy provides a mock function with given fields: ctx, id
|
|
|
|
func (_m *Controller) GetPolicy(ctx context.Context, id int64) (*replication.Policy, error) {
|
|
|
|
ret := _m.Called(ctx, id)
|
|
|
|
|
|
|
|
var r0 *replication.Policy
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) *replication.Policy); ok {
|
|
|
|
r0 = rf(ctx, id)
|
|
|
|
} else {
|
|
|
|
if ret.Get(0) != nil {
|
|
|
|
r0 = ret.Get(0).(*replication.Policy)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
|
|
r1 = rf(ctx, id)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
2020-09-30 09:14:00 +02:00
|
|
|
// GetTask provides a mock function with given fields: ctx, taskID
|
2021-03-03 04:45:33 +01:00
|
|
|
func (_m *Controller) GetTask(ctx context.Context, taskID int64) (*controllerreplication.Task, error) {
|
2020-09-30 09:14:00 +02:00
|
|
|
ret := _m.Called(ctx, taskID)
|
|
|
|
|
2021-03-03 04:45:33 +01:00
|
|
|
var r0 *controllerreplication.Task
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) *controllerreplication.Task); ok {
|
2020-09-30 09:14:00 +02:00
|
|
|
r0 = rf(ctx, taskID)
|
|
|
|
} else {
|
|
|
|
if ret.Get(0) != nil {
|
2021-03-03 04:45:33 +01:00
|
|
|
r0 = ret.Get(0).(*controllerreplication.Task)
|
2020-09-30 09:14:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
|
|
r1 = rf(ctx, taskID)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetTaskLog provides a mock function with given fields: ctx, taskID
|
|
|
|
func (_m *Controller) GetTaskLog(ctx context.Context, taskID int64) ([]byte, error) {
|
|
|
|
ret := _m.Called(ctx, taskID)
|
|
|
|
|
|
|
|
var r0 []byte
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) []byte); ok {
|
|
|
|
r0 = rf(ctx, taskID)
|
|
|
|
} else {
|
|
|
|
if ret.Get(0) != nil {
|
|
|
|
r0 = ret.Get(0).([]byte)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
|
|
r1 = rf(ctx, taskID)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// ListExecutions provides a mock function with given fields: ctx, query
|
2021-03-03 04:45:33 +01:00
|
|
|
func (_m *Controller) ListExecutions(ctx context.Context, query *q.Query) ([]*controllerreplication.Execution, error) {
|
2020-09-30 09:14:00 +02:00
|
|
|
ret := _m.Called(ctx, query)
|
|
|
|
|
2021-03-03 04:45:33 +01:00
|
|
|
var r0 []*controllerreplication.Execution
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) []*controllerreplication.Execution); ok {
|
2020-09-30 09:14:00 +02:00
|
|
|
r0 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
if ret.Get(0) != nil {
|
2021-03-03 04:45:33 +01:00
|
|
|
r0 = ret.Get(0).([]*controllerreplication.Execution)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *q.Query) error); ok {
|
|
|
|
r1 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// ListPolicies provides a mock function with given fields: ctx, query
|
|
|
|
func (_m *Controller) ListPolicies(ctx context.Context, query *q.Query) ([]*replication.Policy, error) {
|
|
|
|
ret := _m.Called(ctx, query)
|
|
|
|
|
|
|
|
var r0 []*replication.Policy
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) []*replication.Policy); ok {
|
|
|
|
r0 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
if ret.Get(0) != nil {
|
|
|
|
r0 = ret.Get(0).([]*replication.Policy)
|
2020-09-30 09:14:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *q.Query) error); ok {
|
|
|
|
r1 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// ListTasks provides a mock function with given fields: ctx, query
|
2021-03-03 04:45:33 +01:00
|
|
|
func (_m *Controller) ListTasks(ctx context.Context, query *q.Query) ([]*controllerreplication.Task, error) {
|
2020-09-30 09:14:00 +02:00
|
|
|
ret := _m.Called(ctx, query)
|
|
|
|
|
2021-03-03 04:45:33 +01:00
|
|
|
var r0 []*controllerreplication.Task
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) []*controllerreplication.Task); ok {
|
2020-09-30 09:14:00 +02:00
|
|
|
r0 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
if ret.Get(0) != nil {
|
2021-03-03 04:45:33 +01:00
|
|
|
r0 = ret.Get(0).([]*controllerreplication.Task)
|
2020-09-30 09:14:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *q.Query) error); ok {
|
|
|
|
r1 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
2021-03-03 04:45:33 +01:00
|
|
|
// PolicyCount provides a mock function with given fields: ctx, query
|
|
|
|
func (_m *Controller) PolicyCount(ctx context.Context, query *q.Query) (int64, error) {
|
|
|
|
ret := _m.Called(ctx, query)
|
|
|
|
|
|
|
|
var r0 int64
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) int64); ok {
|
|
|
|
r0 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
r0 = ret.Get(0).(int64)
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *q.Query) error); ok {
|
|
|
|
r1 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
2020-09-30 09:14:00 +02:00
|
|
|
// Start provides a mock function with given fields: ctx, policy, resource, trigger
|
2021-03-03 04:45:33 +01:00
|
|
|
func (_m *Controller) Start(ctx context.Context, policy *replication.Policy, resource *model.Resource, trigger string) (int64, error) {
|
2020-09-30 09:14:00 +02:00
|
|
|
ret := _m.Called(ctx, policy, resource, trigger)
|
|
|
|
|
|
|
|
var r0 int64
|
2021-03-03 04:45:33 +01:00
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, *replication.Policy, *model.Resource, string) int64); ok {
|
2020-09-30 09:14:00 +02:00
|
|
|
r0 = rf(ctx, policy, resource, trigger)
|
|
|
|
} else {
|
|
|
|
r0 = ret.Get(0).(int64)
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
2021-03-03 04:45:33 +01:00
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *replication.Policy, *model.Resource, string) error); ok {
|
2020-09-30 09:14:00 +02:00
|
|
|
r1 = rf(ctx, policy, resource, trigger)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stop provides a mock function with given fields: ctx, executionID
|
|
|
|
func (_m *Controller) Stop(ctx context.Context, executionID int64) error {
|
|
|
|
ret := _m.Called(ctx, executionID)
|
|
|
|
|
|
|
|
var r0 error
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
|
|
|
|
r0 = rf(ctx, executionID)
|
|
|
|
} else {
|
|
|
|
r0 = ret.Error(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0
|
|
|
|
}
|
|
|
|
|
|
|
|
// TaskCount provides a mock function with given fields: ctx, query
|
|
|
|
func (_m *Controller) TaskCount(ctx context.Context, query *q.Query) (int64, error) {
|
|
|
|
ret := _m.Called(ctx, query)
|
|
|
|
|
|
|
|
var r0 int64
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) int64); ok {
|
|
|
|
r0 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
r0 = ret.Get(0).(int64)
|
|
|
|
}
|
|
|
|
|
|
|
|
var r1 error
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *q.Query) error); ok {
|
|
|
|
r1 = rf(ctx, query)
|
|
|
|
} else {
|
|
|
|
r1 = ret.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0, r1
|
|
|
|
}
|
2021-03-03 04:45:33 +01:00
|
|
|
|
|
|
|
// UpdatePolicy provides a mock function with given fields: ctx, policy, props
|
|
|
|
func (_m *Controller) UpdatePolicy(ctx context.Context, policy *replication.Policy, props ...string) error {
|
|
|
|
_va := make([]interface{}, len(props))
|
|
|
|
for _i := range props {
|
|
|
|
_va[_i] = props[_i]
|
|
|
|
}
|
|
|
|
var _ca []interface{}
|
|
|
|
_ca = append(_ca, ctx, policy)
|
|
|
|
_ca = append(_ca, _va...)
|
|
|
|
ret := _m.Called(_ca...)
|
|
|
|
|
|
|
|
var r0 error
|
|
|
|
if rf, ok := ret.Get(0).(func(context.Context, *replication.Policy, ...string) error); ok {
|
|
|
|
r0 = rf(ctx, policy, props...)
|
|
|
|
} else {
|
|
|
|
r0 = ret.Error(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
return r0
|
|
|
|
}
|