diff --git a/docs/helpers/configenvextractor.go b/docs/helpers/configenvextractor.go index 1e231a776..b20c36900 100644 --- a/docs/helpers/configenvextractor.go +++ b/docs/helpers/configenvextractor.go @@ -67,8 +67,8 @@ func generateIntermediateCode(templatePath string, intermediateCodePath string, func runIntermediateCode(intermediateCodePath string) { fmt.Println("Running intermediate go code for " + intermediateCodePath) - defaultConfigPath := "/etc/ocis" - defaultDataPath := "/var/lib/ocis" + defaultConfigPath := "/etc/opencloud" + defaultDataPath := "/var/lib/opencloud" os.Setenv("OC_BASE_DATA_PATH", defaultDataPath) os.Setenv("OC_CONFIG_DIR", defaultConfigPath) out, err := exec.Command("go", "run", intermediateCodePath).CombinedOutput() diff --git a/opencloud/pkg/init/functions.go b/opencloud/pkg/init/functions.go index 8961dd9d0..a65b4c873 100644 --- a/opencloud/pkg/init/functions.go +++ b/opencloud/pkg/init/functions.go @@ -77,7 +77,7 @@ func writeConfig(configPath, ocisAdminServicePassword, targetBackupConfig string // writePatch writes the diff to a file func writePatch(configPath string, yamlOutput []byte) error { fmt.Println("running in diff mode") - tmpFile := path.Join(configPath, "ocis.yaml.tmp") + tmpFile := path.Join(configPath, "opencloud.yaml.tmp") err := os.WriteFile(tmpFile, yamlOutput, 0600) if err != nil { return err diff --git a/opencloud/pkg/init/init.go b/opencloud/pkg/init/init.go index b8315901e..172ddd022 100644 --- a/opencloud/pkg/init/init.go +++ b/opencloud/pkg/init/init.go @@ -6,12 +6,13 @@ import ( "path" "github.com/gofrs/uuid" - "github.com/opencloud-eu/opencloud/pkg/generators" "gopkg.in/yaml.v2" + + "github.com/opencloud-eu/opencloud/pkg/generators" ) const ( - configFilename = "ocis.yaml" + configFilename = "opencloud.yaml" passwordLength = 32 ) diff --git a/pkg/config/defaults/paths.go b/pkg/config/defaults/paths.go index c05e86c48..db9395e4a 100644 --- a/pkg/config/defaults/paths.go +++ b/pkg/config/defaults/paths.go @@ -6,13 +6,11 @@ import ( "path" ) -const () - var ( // switch between modes BaseDataPathType = "homedir" // or "path" // default data path - BaseDataPathValue = "/var/lib/ocis" + BaseDataPathValue = "/var/lib/opencloud" ) func BaseDataPath() string { @@ -32,7 +30,7 @@ func BaseDataPath() string { // fallback to BaseDatapathValue for users without home return BaseDataPathValue } - return path.Join(dir, ".ocis") + return path.Join(dir, ".opencloud") case "path": return BaseDataPathValue default: @@ -45,7 +43,7 @@ var ( // switch between modes BaseConfigPathType = "homedir" // or "path" // default config path - BaseConfigPathValue = "/etc/ocis" + BaseConfigPathValue = "/etc/opencloud" ) func BaseConfigPath() string { @@ -65,7 +63,7 @@ func BaseConfigPath() string { // fallback to BaseConfigPathValue for users without home return BaseConfigPathValue } - return path.Join(dir, ".ocis", "config") + return path.Join(dir, ".opencloud", "config") case "path": return BaseConfigPathValue default: diff --git a/pkg/config/parser/parse.go b/pkg/config/parser/parse.go index 012b4b9c3..a763e2a6b 100644 --- a/pkg/config/parser/parse.go +++ b/pkg/config/parser/parse.go @@ -9,11 +9,11 @@ import ( "github.com/opencloud-eu/opencloud/pkg/structs" ) -// ParseConfig loads the ocis configuration and +// ParseConfig loads the opencloud configuration and // copies applicable parts into the commons part, from // where the services can copy it into their own config func ParseConfig(cfg *config.Config, skipValidate bool) error { - err := config.BindSourcesToStructs("ocis", cfg) + err := config.BindSourcesToStructs("opencloud", cfg) if err != nil { return err } diff --git a/protogen/gen/opencloud/services/eventhistory/v0/mocks/event_history_service.go b/protogen/gen/opencloud/services/eventhistory/v0/mocks/event_history_service.go new file mode 100644 index 000000000..1d755b0bf --- /dev/null +++ b/protogen/gen/opencloud/services/eventhistory/v0/mocks/event_history_service.go @@ -0,0 +1,188 @@ +// Code generated by mockery v2.50.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + client "go-micro.dev/v4/client" + + mock "github.com/stretchr/testify/mock" + + v0 "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/services/eventhistory/v0" +) + +// EventHistoryService is an autogenerated mock type for the EventHistoryService type +type EventHistoryService struct { + mock.Mock +} + +type EventHistoryService_Expecter struct { + mock *mock.Mock +} + +func (_m *EventHistoryService) EXPECT() *EventHistoryService_Expecter { + return &EventHistoryService_Expecter{mock: &_m.Mock} +} + +// GetEvents provides a mock function with given fields: ctx, in, opts +func (_m *EventHistoryService) GetEvents(ctx context.Context, in *v0.GetEventsRequest, opts ...client.CallOption) (*v0.GetEventsResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetEvents") + } + + var r0 *v0.GetEventsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) (*v0.GetEventsResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) *v0.GetEventsResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.GetEventsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EventHistoryService_GetEvents_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEvents' +type EventHistoryService_GetEvents_Call struct { + *mock.Call +} + +// GetEvents is a helper method to define mock.On call +// - ctx context.Context +// - in *v0.GetEventsRequest +// - opts ...client.CallOption +func (_e *EventHistoryService_Expecter) GetEvents(ctx interface{}, in interface{}, opts ...interface{}) *EventHistoryService_GetEvents_Call { + return &EventHistoryService_GetEvents_Call{Call: _e.mock.On("GetEvents", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *EventHistoryService_GetEvents_Call) Run(run func(ctx context.Context, in *v0.GetEventsRequest, opts ...client.CallOption)) *EventHistoryService_GetEvents_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v0.GetEventsRequest), variadicArgs...) + }) + return _c +} + +func (_c *EventHistoryService_GetEvents_Call) Return(_a0 *v0.GetEventsResponse, _a1 error) *EventHistoryService_GetEvents_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EventHistoryService_GetEvents_Call) RunAndReturn(run func(context.Context, *v0.GetEventsRequest, ...client.CallOption) (*v0.GetEventsResponse, error)) *EventHistoryService_GetEvents_Call { + _c.Call.Return(run) + return _c +} + +// GetEventsForUser provides a mock function with given fields: ctx, in, opts +func (_m *EventHistoryService) GetEventsForUser(ctx context.Context, in *v0.GetEventsForUserRequest, opts ...client.CallOption) (*v0.GetEventsResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetEventsForUser") + } + + var r0 *v0.GetEventsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) (*v0.GetEventsResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) *v0.GetEventsResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.GetEventsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EventHistoryService_GetEventsForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEventsForUser' +type EventHistoryService_GetEventsForUser_Call struct { + *mock.Call +} + +// GetEventsForUser is a helper method to define mock.On call +// - ctx context.Context +// - in *v0.GetEventsForUserRequest +// - opts ...client.CallOption +func (_e *EventHistoryService_Expecter) GetEventsForUser(ctx interface{}, in interface{}, opts ...interface{}) *EventHistoryService_GetEventsForUser_Call { + return &EventHistoryService_GetEventsForUser_Call{Call: _e.mock.On("GetEventsForUser", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *EventHistoryService_GetEventsForUser_Call) Run(run func(ctx context.Context, in *v0.GetEventsForUserRequest, opts ...client.CallOption)) *EventHistoryService_GetEventsForUser_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v0.GetEventsForUserRequest), variadicArgs...) + }) + return _c +} + +func (_c *EventHistoryService_GetEventsForUser_Call) Return(_a0 *v0.GetEventsResponse, _a1 error) *EventHistoryService_GetEventsForUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EventHistoryService_GetEventsForUser_Call) RunAndReturn(run func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) (*v0.GetEventsResponse, error)) *EventHistoryService_GetEventsForUser_Call { + _c.Call.Return(run) + return _c +} + +// NewEventHistoryService creates a new instance of EventHistoryService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewEventHistoryService(t interface { + mock.TestingT + Cleanup(func()) +}) *EventHistoryService { + mock := &EventHistoryService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/protogen/gen/opencloud/services/policies/v0/mocks/policies_provider_service.go b/protogen/gen/opencloud/services/policies/v0/mocks/policies_provider_service.go new file mode 100644 index 000000000..7c6f41d0b --- /dev/null +++ b/protogen/gen/opencloud/services/policies/v0/mocks/policies_provider_service.go @@ -0,0 +1,114 @@ +// Code generated by mockery v2.50.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + client "go-micro.dev/v4/client" + + mock "github.com/stretchr/testify/mock" + + v0 "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/services/policies/v0" +) + +// PoliciesProviderService is an autogenerated mock type for the PoliciesProviderService type +type PoliciesProviderService struct { + mock.Mock +} + +type PoliciesProviderService_Expecter struct { + mock *mock.Mock +} + +func (_m *PoliciesProviderService) EXPECT() *PoliciesProviderService_Expecter { + return &PoliciesProviderService_Expecter{mock: &_m.Mock} +} + +// Evaluate provides a mock function with given fields: ctx, in, opts +func (_m *PoliciesProviderService) Evaluate(ctx context.Context, in *v0.EvaluateRequest, opts ...client.CallOption) (*v0.EvaluateResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Evaluate") + } + + var r0 *v0.EvaluateResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) (*v0.EvaluateResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) *v0.EvaluateResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.EvaluateResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// PoliciesProviderService_Evaluate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Evaluate' +type PoliciesProviderService_Evaluate_Call struct { + *mock.Call +} + +// Evaluate is a helper method to define mock.On call +// - ctx context.Context +// - in *v0.EvaluateRequest +// - opts ...client.CallOption +func (_e *PoliciesProviderService_Expecter) Evaluate(ctx interface{}, in interface{}, opts ...interface{}) *PoliciesProviderService_Evaluate_Call { + return &PoliciesProviderService_Evaluate_Call{Call: _e.mock.On("Evaluate", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *PoliciesProviderService_Evaluate_Call) Run(run func(ctx context.Context, in *v0.EvaluateRequest, opts ...client.CallOption)) *PoliciesProviderService_Evaluate_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v0.EvaluateRequest), variadicArgs...) + }) + return _c +} + +func (_c *PoliciesProviderService_Evaluate_Call) Return(_a0 *v0.EvaluateResponse, _a1 error) *PoliciesProviderService_Evaluate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PoliciesProviderService_Evaluate_Call) RunAndReturn(run func(context.Context, *v0.EvaluateRequest, ...client.CallOption) (*v0.EvaluateResponse, error)) *PoliciesProviderService_Evaluate_Call { + _c.Call.Return(run) + return _c +} + +// NewPoliciesProviderService creates a new instance of PoliciesProviderService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewPoliciesProviderService(t interface { + mock.TestingT + Cleanup(func()) +}) *PoliciesProviderService { + mock := &PoliciesProviderService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/protogen/gen/opencloud/services/search/v0/mocks/search_provider_service.go b/protogen/gen/opencloud/services/search/v0/mocks/search_provider_service.go new file mode 100644 index 000000000..19d51b0be --- /dev/null +++ b/protogen/gen/opencloud/services/search/v0/mocks/search_provider_service.go @@ -0,0 +1,188 @@ +// Code generated by mockery v2.50.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + client "go-micro.dev/v4/client" + + mock "github.com/stretchr/testify/mock" + + v0 "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/services/search/v0" +) + +// SearchProviderService is an autogenerated mock type for the SearchProviderService type +type SearchProviderService struct { + mock.Mock +} + +type SearchProviderService_Expecter struct { + mock *mock.Mock +} + +func (_m *SearchProviderService) EXPECT() *SearchProviderService_Expecter { + return &SearchProviderService_Expecter{mock: &_m.Mock} +} + +// IndexSpace provides a mock function with given fields: ctx, in, opts +func (_m *SearchProviderService) IndexSpace(ctx context.Context, in *v0.IndexSpaceRequest, opts ...client.CallOption) (*v0.IndexSpaceResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for IndexSpace") + } + + var r0 *v0.IndexSpaceResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v0.IndexSpaceRequest, ...client.CallOption) (*v0.IndexSpaceResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v0.IndexSpaceRequest, ...client.CallOption) *v0.IndexSpaceResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.IndexSpaceResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v0.IndexSpaceRequest, ...client.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SearchProviderService_IndexSpace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IndexSpace' +type SearchProviderService_IndexSpace_Call struct { + *mock.Call +} + +// IndexSpace is a helper method to define mock.On call +// - ctx context.Context +// - in *v0.IndexSpaceRequest +// - opts ...client.CallOption +func (_e *SearchProviderService_Expecter) IndexSpace(ctx interface{}, in interface{}, opts ...interface{}) *SearchProviderService_IndexSpace_Call { + return &SearchProviderService_IndexSpace_Call{Call: _e.mock.On("IndexSpace", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SearchProviderService_IndexSpace_Call) Run(run func(ctx context.Context, in *v0.IndexSpaceRequest, opts ...client.CallOption)) *SearchProviderService_IndexSpace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v0.IndexSpaceRequest), variadicArgs...) + }) + return _c +} + +func (_c *SearchProviderService_IndexSpace_Call) Return(_a0 *v0.IndexSpaceResponse, _a1 error) *SearchProviderService_IndexSpace_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SearchProviderService_IndexSpace_Call) RunAndReturn(run func(context.Context, *v0.IndexSpaceRequest, ...client.CallOption) (*v0.IndexSpaceResponse, error)) *SearchProviderService_IndexSpace_Call { + _c.Call.Return(run) + return _c +} + +// Search provides a mock function with given fields: ctx, in, opts +func (_m *SearchProviderService) Search(ctx context.Context, in *v0.SearchRequest, opts ...client.CallOption) (*v0.SearchResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Search") + } + + var r0 *v0.SearchResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v0.SearchRequest, ...client.CallOption) (*v0.SearchResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v0.SearchRequest, ...client.CallOption) *v0.SearchResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.SearchResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v0.SearchRequest, ...client.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SearchProviderService_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search' +type SearchProviderService_Search_Call struct { + *mock.Call +} + +// Search is a helper method to define mock.On call +// - ctx context.Context +// - in *v0.SearchRequest +// - opts ...client.CallOption +func (_e *SearchProviderService_Expecter) Search(ctx interface{}, in interface{}, opts ...interface{}) *SearchProviderService_Search_Call { + return &SearchProviderService_Search_Call{Call: _e.mock.On("Search", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *SearchProviderService_Search_Call) Run(run func(ctx context.Context, in *v0.SearchRequest, opts ...client.CallOption)) *SearchProviderService_Search_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v0.SearchRequest), variadicArgs...) + }) + return _c +} + +func (_c *SearchProviderService_Search_Call) Return(_a0 *v0.SearchResponse, _a1 error) *SearchProviderService_Search_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SearchProviderService_Search_Call) RunAndReturn(run func(context.Context, *v0.SearchRequest, ...client.CallOption) (*v0.SearchResponse, error)) *SearchProviderService_Search_Call { + _c.Call.Return(run) + return _c +} + +// NewSearchProviderService creates a new instance of SearchProviderService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewSearchProviderService(t interface { + mock.TestingT + Cleanup(func()) +}) *SearchProviderService { + mock := &SearchProviderService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/protogen/gen/opencloud/services/settings/v0/mocks/value_service.go b/protogen/gen/opencloud/services/settings/v0/mocks/value_service.go new file mode 100644 index 000000000..940d6e64f --- /dev/null +++ b/protogen/gen/opencloud/services/settings/v0/mocks/value_service.go @@ -0,0 +1,336 @@ +// Code generated by mockery v2.50.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + client "go-micro.dev/v4/client" + + mock "github.com/stretchr/testify/mock" + + v0 "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/services/settings/v0" +) + +// ValueService is an autogenerated mock type for the ValueService type +type ValueService struct { + mock.Mock +} + +type ValueService_Expecter struct { + mock *mock.Mock +} + +func (_m *ValueService) EXPECT() *ValueService_Expecter { + return &ValueService_Expecter{mock: &_m.Mock} +} + +// GetValue provides a mock function with given fields: ctx, in, opts +func (_m *ValueService) GetValue(ctx context.Context, in *v0.GetValueRequest, opts ...client.CallOption) (*v0.GetValueResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetValue") + } + + var r0 *v0.GetValueResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueRequest, ...client.CallOption) (*v0.GetValueResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueRequest, ...client.CallOption) *v0.GetValueResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.GetValueResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v0.GetValueRequest, ...client.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ValueService_GetValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValue' +type ValueService_GetValue_Call struct { + *mock.Call +} + +// GetValue is a helper method to define mock.On call +// - ctx context.Context +// - in *v0.GetValueRequest +// - opts ...client.CallOption +func (_e *ValueService_Expecter) GetValue(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_GetValue_Call { + return &ValueService_GetValue_Call{Call: _e.mock.On("GetValue", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ValueService_GetValue_Call) Run(run func(ctx context.Context, in *v0.GetValueRequest, opts ...client.CallOption)) *ValueService_GetValue_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v0.GetValueRequest), variadicArgs...) + }) + return _c +} + +func (_c *ValueService_GetValue_Call) Return(_a0 *v0.GetValueResponse, _a1 error) *ValueService_GetValue_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValueService_GetValue_Call) RunAndReturn(run func(context.Context, *v0.GetValueRequest, ...client.CallOption) (*v0.GetValueResponse, error)) *ValueService_GetValue_Call { + _c.Call.Return(run) + return _c +} + +// GetValueByUniqueIdentifiers provides a mock function with given fields: ctx, in, opts +func (_m *ValueService) GetValueByUniqueIdentifiers(ctx context.Context, in *v0.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*v0.GetValueResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetValueByUniqueIdentifiers") + } + + var r0 *v0.GetValueResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) (*v0.GetValueResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) *v0.GetValueResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.GetValueResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ValueService_GetValueByUniqueIdentifiers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValueByUniqueIdentifiers' +type ValueService_GetValueByUniqueIdentifiers_Call struct { + *mock.Call +} + +// GetValueByUniqueIdentifiers is a helper method to define mock.On call +// - ctx context.Context +// - in *v0.GetValueByUniqueIdentifiersRequest +// - opts ...client.CallOption +func (_e *ValueService_Expecter) GetValueByUniqueIdentifiers(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_GetValueByUniqueIdentifiers_Call { + return &ValueService_GetValueByUniqueIdentifiers_Call{Call: _e.mock.On("GetValueByUniqueIdentifiers", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ValueService_GetValueByUniqueIdentifiers_Call) Run(run func(ctx context.Context, in *v0.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption)) *ValueService_GetValueByUniqueIdentifiers_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v0.GetValueByUniqueIdentifiersRequest), variadicArgs...) + }) + return _c +} + +func (_c *ValueService_GetValueByUniqueIdentifiers_Call) Return(_a0 *v0.GetValueResponse, _a1 error) *ValueService_GetValueByUniqueIdentifiers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValueService_GetValueByUniqueIdentifiers_Call) RunAndReturn(run func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) (*v0.GetValueResponse, error)) *ValueService_GetValueByUniqueIdentifiers_Call { + _c.Call.Return(run) + return _c +} + +// ListValues provides a mock function with given fields: ctx, in, opts +func (_m *ValueService) ListValues(ctx context.Context, in *v0.ListValuesRequest, opts ...client.CallOption) (*v0.ListValuesResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for ListValues") + } + + var r0 *v0.ListValuesResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v0.ListValuesRequest, ...client.CallOption) (*v0.ListValuesResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v0.ListValuesRequest, ...client.CallOption) *v0.ListValuesResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.ListValuesResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v0.ListValuesRequest, ...client.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ValueService_ListValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListValues' +type ValueService_ListValues_Call struct { + *mock.Call +} + +// ListValues is a helper method to define mock.On call +// - ctx context.Context +// - in *v0.ListValuesRequest +// - opts ...client.CallOption +func (_e *ValueService_Expecter) ListValues(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_ListValues_Call { + return &ValueService_ListValues_Call{Call: _e.mock.On("ListValues", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ValueService_ListValues_Call) Run(run func(ctx context.Context, in *v0.ListValuesRequest, opts ...client.CallOption)) *ValueService_ListValues_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v0.ListValuesRequest), variadicArgs...) + }) + return _c +} + +func (_c *ValueService_ListValues_Call) Return(_a0 *v0.ListValuesResponse, _a1 error) *ValueService_ListValues_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValueService_ListValues_Call) RunAndReturn(run func(context.Context, *v0.ListValuesRequest, ...client.CallOption) (*v0.ListValuesResponse, error)) *ValueService_ListValues_Call { + _c.Call.Return(run) + return _c +} + +// SaveValue provides a mock function with given fields: ctx, in, opts +func (_m *ValueService) SaveValue(ctx context.Context, in *v0.SaveValueRequest, opts ...client.CallOption) (*v0.SaveValueResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for SaveValue") + } + + var r0 *v0.SaveValueResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v0.SaveValueRequest, ...client.CallOption) (*v0.SaveValueResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v0.SaveValueRequest, ...client.CallOption) *v0.SaveValueResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.SaveValueResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v0.SaveValueRequest, ...client.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ValueService_SaveValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveValue' +type ValueService_SaveValue_Call struct { + *mock.Call +} + +// SaveValue is a helper method to define mock.On call +// - ctx context.Context +// - in *v0.SaveValueRequest +// - opts ...client.CallOption +func (_e *ValueService_Expecter) SaveValue(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_SaveValue_Call { + return &ValueService_SaveValue_Call{Call: _e.mock.On("SaveValue", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ValueService_SaveValue_Call) Run(run func(ctx context.Context, in *v0.SaveValueRequest, opts ...client.CallOption)) *ValueService_SaveValue_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v0.SaveValueRequest), variadicArgs...) + }) + return _c +} + +func (_c *ValueService_SaveValue_Call) Return(_a0 *v0.SaveValueResponse, _a1 error) *ValueService_SaveValue_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValueService_SaveValue_Call) RunAndReturn(run func(context.Context, *v0.SaveValueRequest, ...client.CallOption) (*v0.SaveValueResponse, error)) *ValueService_SaveValue_Call { + _c.Call.Return(run) + return _c +} + +// NewValueService creates a new instance of ValueService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewValueService(t interface { + mock.TestingT + Cleanup(func()) +}) *ValueService { + mock := &ValueService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/protogen/gen/opencloud/services/thumbnails/v0/mocks/thumbnail_service.go b/protogen/gen/opencloud/services/thumbnails/v0/mocks/thumbnail_service.go new file mode 100644 index 000000000..f61f331a6 --- /dev/null +++ b/protogen/gen/opencloud/services/thumbnails/v0/mocks/thumbnail_service.go @@ -0,0 +1,114 @@ +// Code generated by mockery v2.50.2. DO NOT EDIT. + +package mocks + +import ( + context "context" + + client "go-micro.dev/v4/client" + + mock "github.com/stretchr/testify/mock" + + v0 "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/services/thumbnails/v0" +) + +// ThumbnailService is an autogenerated mock type for the ThumbnailService type +type ThumbnailService struct { + mock.Mock +} + +type ThumbnailService_Expecter struct { + mock *mock.Mock +} + +func (_m *ThumbnailService) EXPECT() *ThumbnailService_Expecter { + return &ThumbnailService_Expecter{mock: &_m.Mock} +} + +// GetThumbnail provides a mock function with given fields: ctx, in, opts +func (_m *ThumbnailService) GetThumbnail(ctx context.Context, in *v0.GetThumbnailRequest, opts ...client.CallOption) (*v0.GetThumbnailResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetThumbnail") + } + + var r0 *v0.GetThumbnailResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *v0.GetThumbnailRequest, ...client.CallOption) (*v0.GetThumbnailResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *v0.GetThumbnailRequest, ...client.CallOption) *v0.GetThumbnailResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.GetThumbnailResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *v0.GetThumbnailRequest, ...client.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ThumbnailService_GetThumbnail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetThumbnail' +type ThumbnailService_GetThumbnail_Call struct { + *mock.Call +} + +// GetThumbnail is a helper method to define mock.On call +// - ctx context.Context +// - in *v0.GetThumbnailRequest +// - opts ...client.CallOption +func (_e *ThumbnailService_Expecter) GetThumbnail(ctx interface{}, in interface{}, opts ...interface{}) *ThumbnailService_GetThumbnail_Call { + return &ThumbnailService_GetThumbnail_Call{Call: _e.mock.On("GetThumbnail", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *ThumbnailService_GetThumbnail_Call) Run(run func(ctx context.Context, in *v0.GetThumbnailRequest, opts ...client.CallOption)) *ThumbnailService_GetThumbnail_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.CallOption) + } + } + run(args[0].(context.Context), args[1].(*v0.GetThumbnailRequest), variadicArgs...) + }) + return _c +} + +func (_c *ThumbnailService_GetThumbnail_Call) Return(_a0 *v0.GetThumbnailResponse, _a1 error) *ThumbnailService_GetThumbnail_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ThumbnailService_GetThumbnail_Call) RunAndReturn(run func(context.Context, *v0.GetThumbnailRequest, ...client.CallOption) (*v0.GetThumbnailResponse, error)) *ThumbnailService_GetThumbnail_Call { + _c.Call.Return(run) + return _c +} + +// NewThumbnailService creates a new instance of ThumbnailService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewThumbnailService(t interface { + mock.TestingT + Cleanup(func()) +}) *ThumbnailService { + mock := &ThumbnailService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}