From 7701f5eb09d30b0592a98691f0a9b583d89f376e Mon Sep 17 00:00:00 2001 From: Niklas Roeske Date: Tue, 29 Oct 2024 13:57:10 +0100 Subject: [PATCH] #24 replace DoguVersion with QualifiedDoguVersion --- dogu/doguVersionRegistry.go | 42 ++++++------ dogu/doguVersionRegistry_test.go | 48 +++++++------- dogu/interfaces.go | 19 ++---- dogu/localDoguDescriptorRepository.go | 10 +-- dogu/localDoguDescriptorRepository_test.go | 24 +++---- dogu/mock_DoguVersionRegistry_test.go | 66 ++++++++++--------- ...mock_LocalDoguDescriptorRepository_test.go | 65 +++++++++--------- 7 files changed, 137 insertions(+), 137 deletions(-) diff --git a/dogu/doguVersionRegistry.go b/dogu/doguVersionRegistry.go index def2dac..8480fa7 100644 --- a/dogu/doguVersionRegistry.go +++ b/dogu/doguVersionRegistry.go @@ -41,27 +41,27 @@ func NewDoguVersionRegistry(configMapClient configMapClient) *doguVersionRegistr } } -func (vr *doguVersionRegistry) GetCurrent(ctx context.Context, name cescommon.SimpleDoguName) (DoguVersion, error) { +func (vr *doguVersionRegistry) GetCurrent(ctx context.Context, name cescommon.SimpleDoguName) (cescommon.QualifiedDoguVersion, error) { descriptor, err := getDescriptorConfigMapForDogu(ctx, vr.configMapClient, name) if err != nil { - return DoguVersion{}, err + return cescommon.QualifiedDoguVersion{}, err } currentDoguVersion, ok := descriptor.Data[currentVersionKey] if !ok { - return DoguVersion{}, getDoguRegistryKeyNotFoundError(currentVersionKey, name) + return cescommon.QualifiedDoguVersion{}, getDoguRegistryKeyNotFoundError(currentVersionKey, name) } version, err := parseDoguVersion(currentDoguVersion, name) if err != nil { - return DoguVersion{}, cloudoguerrors.NewGenericError(err) + return cescommon.QualifiedDoguVersion{}, cloudoguerrors.NewGenericError(err) } qualifiedDoguName := cescommon.QualifiedDoguName{ SimpleName: name, } - return DoguVersion{Name: qualifiedDoguName, Version: version}, nil + return cescommon.QualifiedDoguVersion{Name: qualifiedDoguName, Version: version}, nil } func parseDoguVersion(version string, name cescommon.SimpleDoguName) (core.Version, error) { @@ -89,14 +89,14 @@ func getDescriptorConfigMapForDogu(ctx context.Context, configMapClient configMa return get, nil } -func (vr *doguVersionRegistry) GetCurrentOfAll(ctx context.Context) ([]DoguVersion, error) { +func (vr *doguVersionRegistry) GetCurrentOfAll(ctx context.Context) ([]cescommon.QualifiedDoguVersion, error) { registryList, err := getAllDescriptorConfigMaps(ctx, vr.configMapClient) if err != nil { return nil, err } var errs []error - doguVersions := make([]DoguVersion, 0, len(registryList.Items)) + doguVersions := make([]cescommon.QualifiedDoguVersion, 0, len(registryList.Items)) for _, localRegistry := range registryList.Items { currentVersion, ok := localRegistry.Data[currentVersionKey] if !ok { @@ -114,7 +114,7 @@ func (vr *doguVersionRegistry) GetCurrentOfAll(ctx context.Context) ([]DoguVersi SimpleName: doguName, } - doguVersions = append(doguVersions, DoguVersion{Name: qualifiedDoguName, Version: version}) + doguVersions = append(doguVersions, cescommon.QualifiedDoguVersion{Name: qualifiedDoguName, Version: version}) } err = errors.Join(errs...) @@ -138,7 +138,7 @@ func getAllLocalDoguRegistriesSelector() string { return fmt.Sprintf("%s=%s,%s,%s=%s", appLabelKey, appLabelValueCes, doguNameLabelKey, typeLabelKey, typeLabelValueLocalDoguRegistry) } -func (vr *doguVersionRegistry) IsEnabled(ctx context.Context, doguVersion DoguVersion) (bool, error) { +func (vr *doguVersionRegistry) IsEnabled(ctx context.Context, doguVersion cescommon.QualifiedDoguVersion) (bool, error) { descriptorConfigMap, err := getDescriptorConfigMapForDogu(ctx, vr.configMapClient, doguVersion.Name.SimpleName) if err != nil { return false, err @@ -152,7 +152,7 @@ func (vr *doguVersionRegistry) IsEnabled(ctx context.Context, doguVersion DoguVe return true, nil } -func (vr *doguVersionRegistry) Enable(ctx context.Context, doguVersion DoguVersion) error { +func (vr *doguVersionRegistry) Enable(ctx context.Context, doguVersion cescommon.QualifiedDoguVersion) error { err := retry.RetryOnConflict(retry.DefaultRetry, func() error { // do not create the registry here if not existent because it would be an invalid state without the dogu descriptor. descriptorConfigMap, err := getDescriptorConfigMapForDogu(ctx, vr.configMapClient, doguVersion.Name.SimpleName) @@ -315,7 +315,7 @@ func handleDeleteWatchEvent(ctx context.Context, event watch.Event, persistenceC oldPersistenceContext := copyPersistenceContext(persistenceContext) delete(persistenceContext, eventDoguVersion.Name.SimpleName) - fireWatchResult(currentVersionsWatchResult, oldPersistenceContext, persistenceContext, []DoguVersion{eventDoguVersion}) + fireWatchResult(currentVersionsWatchResult, oldPersistenceContext, persistenceContext, []cescommon.QualifiedDoguVersion{eventDoguVersion}) return nil } @@ -340,7 +340,7 @@ func handleModifiedWatchEvent(ctx context.Context, event watch.Event, persistenc qualifiedDoguName := cescommon.QualifiedDoguName{ SimpleName: doguName, } - fireWatchResult(currentVersionsWatchResult, oldPersistenceContext, persistenceContext, []DoguVersion{{Name: qualifiedDoguName, Version: version}}) + fireWatchResult(currentVersionsWatchResult, oldPersistenceContext, persistenceContext, []cescommon.QualifiedDoguVersion{{Name: qualifiedDoguName, Version: version}}) delete(persistenceContext, doguName) } else { // Detect change @@ -356,7 +356,7 @@ func handleModifiedWatchEvent(ctx context.Context, event watch.Event, persistenc } persistenceContext[eventDoguVersion.Name.SimpleName] = eventDoguVersion.Version - fireWatchResult(currentVersionsWatchResult, oldPersistenceContext, persistenceContext, []DoguVersion{eventDoguVersion}) + fireWatchResult(currentVersionsWatchResult, oldPersistenceContext, persistenceContext, []cescommon.QualifiedDoguVersion{eventDoguVersion}) } return nil @@ -382,7 +382,7 @@ func handleAddWatchEvent(ctx context.Context, event watch.Event, persistenceCont oldPersistenceContext := copyPersistenceContext(persistenceContext) persistenceContext[eventDoguVersion.Name.SimpleName] = eventDoguVersion.Version - fireWatchResult(currentVersionsWatchResult, oldPersistenceContext, persistenceContext, []DoguVersion{eventDoguVersion}) + fireWatchResult(currentVersionsWatchResult, oldPersistenceContext, persistenceContext, []cescommon.QualifiedDoguVersion{eventDoguVersion}) return nil } @@ -393,11 +393,11 @@ func copyPersistenceContext(persistenceContext map[cescommon.SimpleDoguName]core return oldPersistenceContext } -func fireWatchResult(channel chan CurrentVersionsWatchResult, prevPersistenceContext map[cescommon.SimpleDoguName]core.Version, newPersistenceContext map[cescommon.SimpleDoguName]core.Version, diffs []DoguVersion) { +func fireWatchResult(channel chan CurrentVersionsWatchResult, prevPersistenceContext map[cescommon.SimpleDoguName]core.Version, newPersistenceContext map[cescommon.SimpleDoguName]core.Version, diffs []cescommon.QualifiedDoguVersion) { fireWatchResultWithError(channel, prevPersistenceContext, newPersistenceContext, diffs, nil) } -func fireWatchResultWithError(channel chan CurrentVersionsWatchResult, prevPersistenceContext map[cescommon.SimpleDoguName]core.Version, newPersistenceContext map[cescommon.SimpleDoguName]core.Version, diffs []DoguVersion, err error) { +func fireWatchResultWithError(channel chan CurrentVersionsWatchResult, prevPersistenceContext map[cescommon.SimpleDoguName]core.Version, newPersistenceContext map[cescommon.SimpleDoguName]core.Version, diffs []cescommon.QualifiedDoguVersion, err error) { result := CurrentVersionsWatchResult{ PrevVersions: prevPersistenceContext, Versions: newPersistenceContext, @@ -417,25 +417,25 @@ func getDescriptorConfigMapFromEvent(event watch.Event) (*corev1.ConfigMap, erro return configMap, nil } -func getCurrentDoguVersionFromDoguDescriptorConfigMap(cm corev1.ConfigMap) (DoguVersion, error) { +func getCurrentDoguVersionFromDoguDescriptorConfigMap(cm corev1.ConfigMap) (cescommon.QualifiedDoguVersion, error) { doguName, ok := cm.Labels[doguNameLabelKey] if !ok { - return DoguVersion{}, fmt.Errorf("dogu descriptor configmap does not contain label %q", doguNameLabelKey) + return cescommon.QualifiedDoguVersion{}, fmt.Errorf("dogu descriptor configmap does not contain label %q", doguNameLabelKey) } currentVersion, ok := cm.Data[currentVersionKey] if !ok { - return DoguVersion{}, fmt.Errorf("dogu descriptor configmap does not contain key %q", currentVersionKey) + return cescommon.QualifiedDoguVersion{}, fmt.Errorf("dogu descriptor configmap does not contain key %q", currentVersionKey) } version, err := core.ParseVersion(currentVersion) if err != nil { - return DoguVersion{}, fmt.Errorf("error parsing version %q for dogu version registry %q", currentVersion, cm.Name) + return cescommon.QualifiedDoguVersion{}, fmt.Errorf("error parsing version %q for dogu version registry %q", currentVersion, cm.Name) } qualifiedDoguName := cescommon.QualifiedDoguName{ SimpleName: cescommon.SimpleDoguName(doguName), } - return DoguVersion{Name: qualifiedDoguName, Version: version}, nil + return cescommon.QualifiedDoguVersion{Name: qualifiedDoguName, Version: version}, nil } func hasDoguDescriptorConfigMapCurrentKey(cm *corev1.ConfigMap) bool { diff --git a/dogu/doguVersionRegistry_test.go b/dogu/doguVersionRegistry_test.go index 15e3705..8178c0a 100644 --- a/dogu/doguVersionRegistry_test.go +++ b/dogu/doguVersionRegistry_test.go @@ -40,7 +40,7 @@ func TestNewDoguVersionRegistry(t *testing.T) { } func Test_versionRegistry_GetCurrent(t *testing.T) { - expectedDoguVersion := DoguVersion{ + expectedDoguVersion := cescommon.QualifiedDoguVersion{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("cas")}, Version: parseVersionStr(t, casVersionStr), } @@ -58,7 +58,7 @@ func Test_versionRegistry_GetCurrent(t *testing.T) { name string configMapClientFn func(t *testing.T) configMapClient args args - want DoguVersion + want cescommon.QualifiedDoguVersion wantErr assert.ErrorAssertionFunc }{ { @@ -82,7 +82,7 @@ func Test_versionRegistry_GetCurrent(t *testing.T) { return configMapClientMock }, args: casArgs, - want: DoguVersion{}, + want: cescommon.QualifiedDoguVersion{}, wantErr: func(t assert.TestingT, err error, i ...interface{}) bool { return assert.True(t, cloudoguerrors.IsGenericError(err), i) && assert.ErrorContains(t, err, "failed to get dogu descriptor config map for dogu \"cas\"", i) @@ -97,7 +97,7 @@ func Test_versionRegistry_GetCurrent(t *testing.T) { return configMapClientMock }, args: casArgs, - want: DoguVersion{}, + want: cescommon.QualifiedDoguVersion{}, wantErr: func(t assert.TestingT, err error, i ...interface{}) bool { return assert.True(t, cloudoguerrors.IsNotFoundError(err), i) && assert.ErrorContains(t, err, "failed to get value for key \"current\" for dogu registry \"cas\"", i) @@ -112,7 +112,7 @@ func Test_versionRegistry_GetCurrent(t *testing.T) { return configMapClientMock }, args: casArgs, - want: DoguVersion{}, + want: cescommon.QualifiedDoguVersion{}, wantErr: func(t assert.TestingT, err error, i ...interface{}) bool { return assert.True(t, cloudoguerrors.IsGenericError(err), i) && assert.ErrorContains(t, err, "failed to parse version \"abc\" for dogu \"cas\"", i) @@ -135,11 +135,11 @@ func Test_versionRegistry_GetCurrent(t *testing.T) { } func Test_versionRegistry_GetCurrentOfAll(t *testing.T) { - expectedCasDoguVersion := DoguVersion{ + expectedCasDoguVersion := cescommon.QualifiedDoguVersion{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("cas")}, Version: parseVersionStr(t, casVersionStr), } - expectedLdapDoguVersion := DoguVersion{ + expectedLdapDoguVersion := cescommon.QualifiedDoguVersion{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("ldap")}, Version: parseVersionStr(t, ldapVersionStr), } @@ -154,7 +154,7 @@ func Test_versionRegistry_GetCurrentOfAll(t *testing.T) { name string configMapClientFn func(t *testing.T) configMapClient args args - want []DoguVersion + want []cescommon.QualifiedDoguVersion wantErr assert.ErrorAssertionFunc }{ { @@ -166,7 +166,7 @@ func Test_versionRegistry_GetCurrentOfAll(t *testing.T) { return configMapClientMock }, args: args{ctx: testCtx}, - want: []DoguVersion{expectedCasDoguVersion, expectedLdapDoguVersion}, + want: []cescommon.QualifiedDoguVersion{expectedCasDoguVersion, expectedLdapDoguVersion}, wantErr: assert.NoError, }, { @@ -180,7 +180,7 @@ func Test_versionRegistry_GetCurrentOfAll(t *testing.T) { return configMapClientMock }, args: args{ctx: testCtx}, - want: []DoguVersion{expectedLdapDoguVersion}, + want: []cescommon.QualifiedDoguVersion{expectedLdapDoguVersion}, wantErr: assert.NoError, }, { @@ -210,7 +210,7 @@ func Test_versionRegistry_GetCurrentOfAll(t *testing.T) { return configMapClientMock }, args: args{ctx: testCtx}, - want: []DoguVersion{}, + want: []cescommon.QualifiedDoguVersion{}, wantErr: func(t assert.TestingT, err error, i ...interface{}) bool { return assert.True(t, cloudoguerrors.IsGenericError(err), i) && assert.ErrorContains(t, err, "failed to get some dogu versions: failed to parse version \"abc\" for dogu \"cas\": failed to parse major version abc: strconv.Atoi: parsing \"abc\": invalid syntax\nfailed to parse version \"abcd\" for dogu \"ldap\": failed to parse major version abcd: strconv.Atoi: parsing \"abcd\": invalid syntax") @@ -228,7 +228,7 @@ func Test_versionRegistry_GetCurrentOfAll(t *testing.T) { return configMapClientMock }, args: args{ctx: testCtx}, - want: []DoguVersion{ + want: []cescommon.QualifiedDoguVersion{ { Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("ldap")}, Version: parseVersionStr(t, "1.0.0"), @@ -259,7 +259,7 @@ func Test_versionRegistry_IsEnabled(t *testing.T) { casRegistryCmWithOutCurrent := &corev1.ConfigMap{Data: map[string]string{casVersionStr: readCasDoguStr(t)}, ObjectMeta: metav1.ObjectMeta{Labels: casVersionRegistryLabelMap}} type args struct { ctx context.Context - doguVersion DoguVersion + doguVersion cescommon.QualifiedDoguVersion } tests := []struct { name string @@ -276,7 +276,7 @@ func Test_versionRegistry_IsEnabled(t *testing.T) { return configMapClientMock }, - args: args{ctx: testCtx, doguVersion: DoguVersion{ + args: args{ctx: testCtx, doguVersion: cescommon.QualifiedDoguVersion{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("cas")}, Version: parseVersionStr(t, casVersionStr)}}, want: true, @@ -290,7 +290,7 @@ func Test_versionRegistry_IsEnabled(t *testing.T) { return configMapClientMock }, - args: args{ctx: testCtx, doguVersion: DoguVersion{ + args: args{ctx: testCtx, doguVersion: cescommon.QualifiedDoguVersion{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("cas")}, Version: parseVersionStr(t, casVersionStr)}}, want: false, @@ -304,7 +304,7 @@ func Test_versionRegistry_IsEnabled(t *testing.T) { return configMapClientMock }, - args: args{ctx: testCtx, doguVersion: DoguVersion{ + args: args{ctx: testCtx, doguVersion: cescommon.QualifiedDoguVersion{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("cas")}, Version: parseVersionStr(t, "7.0.5.1-2")}}, want: false, @@ -318,7 +318,7 @@ func Test_versionRegistry_IsEnabled(t *testing.T) { return configMapClientMock }, - args: args{ctx: testCtx, doguVersion: DoguVersion{ + args: args{ctx: testCtx, doguVersion: cescommon.QualifiedDoguVersion{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("cas")}, Version: parseVersionStr(t, casVersionStr)}}, wantErr: func(t assert.TestingT, err error, i ...interface{}) bool { @@ -347,11 +347,11 @@ func Test_versionRegistry_Enable(t *testing.T) { type args struct { ctx context.Context - doguVersion DoguVersion + doguVersion cescommon.QualifiedDoguVersion } casArgs := args{ ctx: testCtx, - doguVersion: DoguVersion{ + doguVersion: cescommon.QualifiedDoguVersion{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("cas")}, Version: parseVersionStr(t, casVersionStr)}, } tests := []struct { @@ -522,7 +522,7 @@ func Test_versionRegistry_WatchAllCurrent(t *testing.T) { assert.Equal(t, initialDoguVersionCtx, result.PrevVersions) casVersion := parseVersionStr(t, casVersionStr) assert.Equal(t, result.Versions, map[cescommon.SimpleDoguName]core.Version{"ldap": parseVersionStr(t, ldapVersionStr), "cas": casVersion}) - assert.Equal(t, []DoguVersion{{ + assert.Equal(t, []cescommon.QualifiedDoguVersion{{ Name: cescommon.QualifiedDoguName{SimpleName: "cas"}, Version: casVersion}}, result.Diff) addCancelFunc() @@ -550,7 +550,7 @@ func Test_versionRegistry_WatchAllCurrent(t *testing.T) { assert.Equal(t, initialDoguVersionCtx, result.PrevVersions) casVersion := parseVersionStr(t, casVersionStr) assert.Equal(t, result.Versions, map[cescommon.SimpleDoguName]core.Version{"ldap": parseVersionStr(t, ldapVersionStr), "cas": casVersion}) - assert.Equal(t, []DoguVersion{{ + assert.Equal(t, []cescommon.QualifiedDoguVersion{{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("cas")}, Version: casVersion}}, result.Diff) emptyAddCancelFunc() @@ -577,7 +577,7 @@ func Test_versionRegistry_WatchAllCurrent(t *testing.T) { assert.Equal(t, initialDoguVersionCtx, result.PrevVersions) upgradedLdapVersion := parseVersionStr(t, upgradeLdapVersionStr) assert.Equal(t, result.Versions, map[cescommon.SimpleDoguName]core.Version{"ldap": upgradedLdapVersion}) - assert.Equal(t, []DoguVersion{{ + assert.Equal(t, []cescommon.QualifiedDoguVersion{{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("ldap")}, Version: upgradedLdapVersion}}, result.Diff) modifyCancelFunc() @@ -604,7 +604,7 @@ func Test_versionRegistry_WatchAllCurrent(t *testing.T) { assert.Equal(t, initialDoguVersionCtx, result.PrevVersions) ldapVersion := parseVersionStr(t, ldapVersionStr) assert.Equal(t, result.Versions, map[cescommon.SimpleDoguName]core.Version{}) - assert.Equal(t, []DoguVersion{{ + assert.Equal(t, []cescommon.QualifiedDoguVersion{{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("ldap")}, Version: ldapVersion}}, result.Diff) deleteCancelFunc() @@ -865,7 +865,7 @@ func Test_handleModifiedWatchEvent(t *testing.T) { require.NoError(t, result.Err) assert.Len(t, result.Versions, 0) assert.Equal(t, result.PrevVersions, expectedOldVersions) - assert.Equal(t, result.Diff, []DoguVersion{{ + assert.Equal(t, result.Diff, []cescommon.QualifiedDoguVersion{{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("ldap")}, Version: parseVersionStr(t, "1.0.0")}}) assert.Len(t, persistentContext, 0) }) diff --git a/dogu/interfaces.go b/dogu/interfaces.go index a5ffcea..f22f160 100644 --- a/dogu/interfaces.go +++ b/dogu/interfaces.go @@ -28,30 +28,25 @@ type configMapClient interface { corev1client.ConfigMapInterface } -type SimpleDoguName string - -// in common lib -type DoguVersion = cescommon.QualifiedDoguVersion - type DoguVersionRegistry interface { - GetCurrent(context.Context, cescommon.SimpleDoguName) (DoguVersion, error) - GetCurrentOfAll(context.Context) ([]DoguVersion, error) - IsEnabled(context.Context, DoguVersion) (bool, error) - Enable(context.Context, DoguVersion) error + GetCurrent(context.Context, cescommon.SimpleDoguName) (cescommon.QualifiedDoguVersion, error) + GetCurrentOfAll(context.Context) ([]cescommon.QualifiedDoguVersion, error) + IsEnabled(context.Context, cescommon.QualifiedDoguVersion) (bool, error) + Enable(context.Context, cescommon.QualifiedDoguVersion) error WatchAllCurrent(context.Context) (<-chan CurrentVersionsWatchResult, error) } type CurrentVersionsWatchResult struct { Versions map[cescommon.SimpleDoguName]core.Version PrevVersions map[cescommon.SimpleDoguName]core.Version - Diff []DoguVersion + Diff []cescommon.QualifiedDoguVersion Err error } // LocalDoguDescriptorRepository is an append-only Repository, no updates will happen type LocalDoguDescriptorRepository interface { - Get(context.Context, DoguVersion) (*core.Dogu, error) - GetAll(context.Context, []DoguVersion) (map[DoguVersion]*core.Dogu, error) + Get(context.Context, cescommon.QualifiedDoguVersion) (*core.Dogu, error) + GetAll(context.Context, []cescommon.QualifiedDoguVersion) (map[cescommon.QualifiedDoguVersion]*core.Dogu, error) Add(context.Context, cescommon.SimpleDoguName, *core.Dogu) error DeleteAll(context.Context, cescommon.SimpleDoguName) error } diff --git a/dogu/localDoguDescriptorRepository.go b/dogu/localDoguDescriptorRepository.go index 3752c94..2756f84 100644 --- a/dogu/localDoguDescriptorRepository.go +++ b/dogu/localDoguDescriptorRepository.go @@ -23,7 +23,7 @@ func NewLocalDoguDescriptorRepository(configMapClient configMapClient) *localDog } } -func (lddr *localDoguDescriptorRepository) Get(ctx context.Context, doguVersion DoguVersion) (*core.Dogu, error) { +func (lddr *localDoguDescriptorRepository) Get(ctx context.Context, doguVersion cescommon.QualifiedDoguVersion) (*core.Dogu, error) { doguName := doguVersion.Name.SimpleName descriptorConfigMap, err := getDescriptorConfigMapForDogu(ctx, lddr.configMapClient, doguName) if err != nil { @@ -53,12 +53,12 @@ func unmarshalDoguJsonStr(doguStr string, doguName cescommon.SimpleDoguName, dog return dogu, nil } -func (lddr *localDoguDescriptorRepository) GetAll(ctx context.Context, doguVersions []DoguVersion) (map[DoguVersion]*core.Dogu, error) { - allDogus := make(map[DoguVersion]*core.Dogu, len(doguVersions)) - versionsByDogu := map[cescommon.SimpleDoguName][]DoguVersion{} +func (lddr *localDoguDescriptorRepository) GetAll(ctx context.Context, doguVersions []cescommon.QualifiedDoguVersion) (map[cescommon.QualifiedDoguVersion]*core.Dogu, error) { + allDogus := make(map[cescommon.QualifiedDoguVersion]*core.Dogu, len(doguVersions)) + versionsByDogu := map[cescommon.SimpleDoguName][]cescommon.QualifiedDoguVersion{} for _, doguVersion := range doguVersions { if versionsByDogu[doguVersion.Name.SimpleName] == nil { - versionsByDogu[doguVersion.Name.SimpleName] = []DoguVersion{} + versionsByDogu[doguVersion.Name.SimpleName] = []cescommon.QualifiedDoguVersion{} } versionsByDogu[doguVersion.Name.SimpleName] = append(versionsByDogu[doguVersion.Name.SimpleName], doguVersion) } diff --git a/dogu/localDoguDescriptorRepository_test.go b/dogu/localDoguDescriptorRepository_test.go index 39e8a4e..8549cc6 100644 --- a/dogu/localDoguDescriptorRepository_test.go +++ b/dogu/localDoguDescriptorRepository_test.go @@ -213,12 +213,12 @@ func Test_localDoguDescriptorRepository_DeleteAll(t *testing.T) { func Test_localDoguDescriptorRepository_Get(t *testing.T) { casVersion := parseVersionStr(t, casVersionStr) - doguVersion := DoguVersion{ + doguVersion := cescommon.QualifiedDoguVersion{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("cas")}, Version: casVersion, } - notFoundDoguVersion := DoguVersion{ + notFoundDoguVersion := cescommon.QualifiedDoguVersion{ Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName("cas")}, Version: parseVersionStr(t, "1.11.12-1"), } @@ -229,7 +229,7 @@ func Test_localDoguDescriptorRepository_Get(t *testing.T) { type args struct { ctx context.Context - doguVersion DoguVersion + doguVersion cescommon.QualifiedDoguVersion } tests := []struct { name string @@ -313,27 +313,27 @@ func Test_localDoguDescriptorRepository_GetAll(t *testing.T) { ldapDogu := readLdapDogu(t) casRegistryCm := &corev1.ConfigMap{Data: map[string]string{casVersionStr: string(casBytes)}} ldapRegistryCm := &corev1.ConfigMap{Data: map[string]string{ldapVersionStr: string(ldapBytes)}} - casDoguVersion := DoguVersion{Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName(casDogu.GetSimpleName())}, Version: casVersion} - ldapDoguVersion := DoguVersion{Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName(ldapDogu.GetSimpleName())}, Version: ldapVersion} - notFoundCasDoguVersion := DoguVersion{Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName(casDogu.GetSimpleName())}, Version: parseVersionStr(t, "1.222.11-1")} - notFoundLdapDoguVersion := DoguVersion{Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName(ldapDogu.GetSimpleName())}, Version: parseVersionStr(t, "1.222.11-1")} - doguVersions := []DoguVersion{casDoguVersion, ldapDoguVersion} - notFoundDoguVersions := []DoguVersion{notFoundCasDoguVersion, notFoundLdapDoguVersion} + casDoguVersion := cescommon.QualifiedDoguVersion{Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName(casDogu.GetSimpleName())}, Version: casVersion} + ldapDoguVersion := cescommon.QualifiedDoguVersion{Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName(ldapDogu.GetSimpleName())}, Version: ldapVersion} + notFoundCasDoguVersion := cescommon.QualifiedDoguVersion{Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName(casDogu.GetSimpleName())}, Version: parseVersionStr(t, "1.222.11-1")} + notFoundLdapDoguVersion := cescommon.QualifiedDoguVersion{Name: cescommon.QualifiedDoguName{SimpleName: cescommon.SimpleDoguName(ldapDogu.GetSimpleName())}, Version: parseVersionStr(t, "1.222.11-1")} + doguVersions := []cescommon.QualifiedDoguVersion{casDoguVersion, ldapDoguVersion} + notFoundDoguVersions := []cescommon.QualifiedDoguVersion{notFoundCasDoguVersion, notFoundLdapDoguVersion} - expectedDoguVersionMap := map[DoguVersion]*core.Dogu{casDoguVersion: casDogu, ldapDoguVersion: ldapDogu} + expectedDoguVersionMap := map[cescommon.QualifiedDoguVersion]*core.Dogu{casDoguVersion: casDogu, ldapDoguVersion: ldapDogu} invalidCasRegistryCm := &corev1.ConfigMap{Data: map[string]string{casVersionStr: "not valid"}} invalidLdapRegistryCm := &corev1.ConfigMap{Data: map[string]string{ldapVersionStr: "not valid"}} type args struct { ctx context.Context - doguVersions []DoguVersion + doguVersions []cescommon.QualifiedDoguVersion } tests := []struct { name string configMapClientFn func(t *testing.T) configMapClient args args - want map[DoguVersion]*core.Dogu + want map[cescommon.QualifiedDoguVersion]*core.Dogu wantErr assert.ErrorAssertionFunc }{ { diff --git a/dogu/mock_DoguVersionRegistry_test.go b/dogu/mock_DoguVersionRegistry_test.go index f67524b..e402516 100644 --- a/dogu/mock_DoguVersionRegistry_test.go +++ b/dogu/mock_DoguVersionRegistry_test.go @@ -5,6 +5,8 @@ package dogu import ( context "context" + ces_commons_libdogu "github.com/cloudogu/ces-commons-lib/dogu" + mock "github.com/stretchr/testify/mock" ) @@ -22,7 +24,7 @@ func (_m *MockDoguVersionRegistry) EXPECT() *MockDoguVersionRegistry_Expecter { } // Enable provides a mock function with given fields: _a0, _a1 -func (_m *MockDoguVersionRegistry) Enable(_a0 context.Context, _a1 DoguVersion) error { +func (_m *MockDoguVersionRegistry) Enable(_a0 context.Context, _a1 ces_commons_libdogu.QualifiedDoguVersion) error { ret := _m.Called(_a0, _a1) if len(ret) == 0 { @@ -30,7 +32,7 @@ func (_m *MockDoguVersionRegistry) Enable(_a0 context.Context, _a1 DoguVersion) } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, DoguVersion) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, ces_commons_libdogu.QualifiedDoguVersion) error); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Error(0) @@ -46,14 +48,14 @@ type MockDoguVersionRegistry_Enable_Call struct { // Enable is a helper method to define mock.On call // - _a0 context.Context -// - _a1 DoguVersion +// - _a1 ces_commons_libdogu.QualifiedDoguVersion func (_e *MockDoguVersionRegistry_Expecter) Enable(_a0 interface{}, _a1 interface{}) *MockDoguVersionRegistry_Enable_Call { return &MockDoguVersionRegistry_Enable_Call{Call: _e.mock.On("Enable", _a0, _a1)} } -func (_c *MockDoguVersionRegistry_Enable_Call) Run(run func(_a0 context.Context, _a1 DoguVersion)) *MockDoguVersionRegistry_Enable_Call { +func (_c *MockDoguVersionRegistry_Enable_Call) Run(run func(_a0 context.Context, _a1 ces_commons_libdogu.QualifiedDoguVersion)) *MockDoguVersionRegistry_Enable_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(DoguVersion)) + run(args[0].(context.Context), args[1].(ces_commons_libdogu.QualifiedDoguVersion)) }) return _c } @@ -63,31 +65,31 @@ func (_c *MockDoguVersionRegistry_Enable_Call) Return(_a0 error) *MockDoguVersio return _c } -func (_c *MockDoguVersionRegistry_Enable_Call) RunAndReturn(run func(context.Context, DoguVersion) error) *MockDoguVersionRegistry_Enable_Call { +func (_c *MockDoguVersionRegistry_Enable_Call) RunAndReturn(run func(context.Context, ces_commons_libdogu.QualifiedDoguVersion) error) *MockDoguVersionRegistry_Enable_Call { _c.Call.Return(run) return _c } // GetCurrent provides a mock function with given fields: _a0, _a1 -func (_m *MockDoguVersionRegistry) GetCurrent(_a0 context.Context, _a1 SimpleDoguName) (DoguVersion, error) { +func (_m *MockDoguVersionRegistry) GetCurrent(_a0 context.Context, _a1 ces_commons_libdogu.SimpleDoguName) (ces_commons_libdogu.QualifiedDoguVersion, error) { ret := _m.Called(_a0, _a1) if len(ret) == 0 { panic("no return value specified for GetCurrent") } - var r0 DoguVersion + var r0 ces_commons_libdogu.QualifiedDoguVersion var r1 error - if rf, ok := ret.Get(0).(func(context.Context, SimpleDoguName) (DoguVersion, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, ces_commons_libdogu.SimpleDoguName) (ces_commons_libdogu.QualifiedDoguVersion, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, SimpleDoguName) DoguVersion); ok { + if rf, ok := ret.Get(0).(func(context.Context, ces_commons_libdogu.SimpleDoguName) ces_commons_libdogu.QualifiedDoguVersion); ok { r0 = rf(_a0, _a1) } else { - r0 = ret.Get(0).(DoguVersion) + r0 = ret.Get(0).(ces_commons_libdogu.QualifiedDoguVersion) } - if rf, ok := ret.Get(1).(func(context.Context, SimpleDoguName) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, ces_commons_libdogu.SimpleDoguName) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -103,46 +105,46 @@ type MockDoguVersionRegistry_GetCurrent_Call struct { // GetCurrent is a helper method to define mock.On call // - _a0 context.Context -// - _a1 SimpleDoguName +// - _a1 ces_commons_libdogu.SimpleDoguName func (_e *MockDoguVersionRegistry_Expecter) GetCurrent(_a0 interface{}, _a1 interface{}) *MockDoguVersionRegistry_GetCurrent_Call { return &MockDoguVersionRegistry_GetCurrent_Call{Call: _e.mock.On("GetCurrent", _a0, _a1)} } -func (_c *MockDoguVersionRegistry_GetCurrent_Call) Run(run func(_a0 context.Context, _a1 SimpleDoguName)) *MockDoguVersionRegistry_GetCurrent_Call { +func (_c *MockDoguVersionRegistry_GetCurrent_Call) Run(run func(_a0 context.Context, _a1 ces_commons_libdogu.SimpleDoguName)) *MockDoguVersionRegistry_GetCurrent_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(SimpleDoguName)) + run(args[0].(context.Context), args[1].(ces_commons_libdogu.SimpleDoguName)) }) return _c } -func (_c *MockDoguVersionRegistry_GetCurrent_Call) Return(_a0 DoguVersion, _a1 error) *MockDoguVersionRegistry_GetCurrent_Call { +func (_c *MockDoguVersionRegistry_GetCurrent_Call) Return(_a0 ces_commons_libdogu.QualifiedDoguVersion, _a1 error) *MockDoguVersionRegistry_GetCurrent_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockDoguVersionRegistry_GetCurrent_Call) RunAndReturn(run func(context.Context, SimpleDoguName) (DoguVersion, error)) *MockDoguVersionRegistry_GetCurrent_Call { +func (_c *MockDoguVersionRegistry_GetCurrent_Call) RunAndReturn(run func(context.Context, ces_commons_libdogu.SimpleDoguName) (ces_commons_libdogu.QualifiedDoguVersion, error)) *MockDoguVersionRegistry_GetCurrent_Call { _c.Call.Return(run) return _c } // GetCurrentOfAll provides a mock function with given fields: _a0 -func (_m *MockDoguVersionRegistry) GetCurrentOfAll(_a0 context.Context) ([]DoguVersion, error) { +func (_m *MockDoguVersionRegistry) GetCurrentOfAll(_a0 context.Context) ([]ces_commons_libdogu.QualifiedDoguVersion, error) { ret := _m.Called(_a0) if len(ret) == 0 { panic("no return value specified for GetCurrentOfAll") } - var r0 []DoguVersion + var r0 []ces_commons_libdogu.QualifiedDoguVersion var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]DoguVersion, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) ([]ces_commons_libdogu.QualifiedDoguVersion, error)); ok { return rf(_a0) } - if rf, ok := ret.Get(0).(func(context.Context) []DoguVersion); ok { + if rf, ok := ret.Get(0).(func(context.Context) []ces_commons_libdogu.QualifiedDoguVersion); ok { r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]DoguVersion) + r0 = ret.Get(0).([]ces_commons_libdogu.QualifiedDoguVersion) } } @@ -173,18 +175,18 @@ func (_c *MockDoguVersionRegistry_GetCurrentOfAll_Call) Run(run func(_a0 context return _c } -func (_c *MockDoguVersionRegistry_GetCurrentOfAll_Call) Return(_a0 []DoguVersion, _a1 error) *MockDoguVersionRegistry_GetCurrentOfAll_Call { +func (_c *MockDoguVersionRegistry_GetCurrentOfAll_Call) Return(_a0 []ces_commons_libdogu.QualifiedDoguVersion, _a1 error) *MockDoguVersionRegistry_GetCurrentOfAll_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockDoguVersionRegistry_GetCurrentOfAll_Call) RunAndReturn(run func(context.Context) ([]DoguVersion, error)) *MockDoguVersionRegistry_GetCurrentOfAll_Call { +func (_c *MockDoguVersionRegistry_GetCurrentOfAll_Call) RunAndReturn(run func(context.Context) ([]ces_commons_libdogu.QualifiedDoguVersion, error)) *MockDoguVersionRegistry_GetCurrentOfAll_Call { _c.Call.Return(run) return _c } // IsEnabled provides a mock function with given fields: _a0, _a1 -func (_m *MockDoguVersionRegistry) IsEnabled(_a0 context.Context, _a1 DoguVersion) (bool, error) { +func (_m *MockDoguVersionRegistry) IsEnabled(_a0 context.Context, _a1 ces_commons_libdogu.QualifiedDoguVersion) (bool, error) { ret := _m.Called(_a0, _a1) if len(ret) == 0 { @@ -193,16 +195,16 @@ func (_m *MockDoguVersionRegistry) IsEnabled(_a0 context.Context, _a1 DoguVersio var r0 bool var r1 error - if rf, ok := ret.Get(0).(func(context.Context, DoguVersion) (bool, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, ces_commons_libdogu.QualifiedDoguVersion) (bool, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, DoguVersion) bool); ok { + if rf, ok := ret.Get(0).(func(context.Context, ces_commons_libdogu.QualifiedDoguVersion) bool); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Get(0).(bool) } - if rf, ok := ret.Get(1).(func(context.Context, DoguVersion) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, ces_commons_libdogu.QualifiedDoguVersion) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -218,14 +220,14 @@ type MockDoguVersionRegistry_IsEnabled_Call struct { // IsEnabled is a helper method to define mock.On call // - _a0 context.Context -// - _a1 DoguVersion +// - _a1 ces_commons_libdogu.QualifiedDoguVersion func (_e *MockDoguVersionRegistry_Expecter) IsEnabled(_a0 interface{}, _a1 interface{}) *MockDoguVersionRegistry_IsEnabled_Call { return &MockDoguVersionRegistry_IsEnabled_Call{Call: _e.mock.On("IsEnabled", _a0, _a1)} } -func (_c *MockDoguVersionRegistry_IsEnabled_Call) Run(run func(_a0 context.Context, _a1 DoguVersion)) *MockDoguVersionRegistry_IsEnabled_Call { +func (_c *MockDoguVersionRegistry_IsEnabled_Call) Run(run func(_a0 context.Context, _a1 ces_commons_libdogu.QualifiedDoguVersion)) *MockDoguVersionRegistry_IsEnabled_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(DoguVersion)) + run(args[0].(context.Context), args[1].(ces_commons_libdogu.QualifiedDoguVersion)) }) return _c } @@ -235,7 +237,7 @@ func (_c *MockDoguVersionRegistry_IsEnabled_Call) Return(_a0 bool, _a1 error) *M return _c } -func (_c *MockDoguVersionRegistry_IsEnabled_Call) RunAndReturn(run func(context.Context, DoguVersion) (bool, error)) *MockDoguVersionRegistry_IsEnabled_Call { +func (_c *MockDoguVersionRegistry_IsEnabled_Call) RunAndReturn(run func(context.Context, ces_commons_libdogu.QualifiedDoguVersion) (bool, error)) *MockDoguVersionRegistry_IsEnabled_Call { _c.Call.Return(run) return _c } diff --git a/dogu/mock_LocalDoguDescriptorRepository_test.go b/dogu/mock_LocalDoguDescriptorRepository_test.go index dbf1825..29bbbb8 100644 --- a/dogu/mock_LocalDoguDescriptorRepository_test.go +++ b/dogu/mock_LocalDoguDescriptorRepository_test.go @@ -5,7 +5,10 @@ package dogu import ( context "context" + ces_commons_libdogu "github.com/cloudogu/ces-commons-lib/dogu" + core "github.com/cloudogu/cesapp-lib/core" + mock "github.com/stretchr/testify/mock" ) @@ -23,7 +26,7 @@ func (_m *MockLocalDoguDescriptorRepository) EXPECT() *MockLocalDoguDescriptorRe } // Add provides a mock function with given fields: _a0, _a1, _a2 -func (_m *MockLocalDoguDescriptorRepository) Add(_a0 context.Context, _a1 SimpleDoguName, _a2 *core.Dogu) error { +func (_m *MockLocalDoguDescriptorRepository) Add(_a0 context.Context, _a1 ces_commons_libdogu.SimpleDoguName, _a2 *core.Dogu) error { ret := _m.Called(_a0, _a1, _a2) if len(ret) == 0 { @@ -31,7 +34,7 @@ func (_m *MockLocalDoguDescriptorRepository) Add(_a0 context.Context, _a1 Simple } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, SimpleDoguName, *core.Dogu) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, ces_commons_libdogu.SimpleDoguName, *core.Dogu) error); ok { r0 = rf(_a0, _a1, _a2) } else { r0 = ret.Error(0) @@ -47,15 +50,15 @@ type MockLocalDoguDescriptorRepository_Add_Call struct { // Add is a helper method to define mock.On call // - _a0 context.Context -// - _a1 SimpleDoguName +// - _a1 ces_commons_libdogu.SimpleDoguName // - _a2 *core.Dogu func (_e *MockLocalDoguDescriptorRepository_Expecter) Add(_a0 interface{}, _a1 interface{}, _a2 interface{}) *MockLocalDoguDescriptorRepository_Add_Call { return &MockLocalDoguDescriptorRepository_Add_Call{Call: _e.mock.On("Add", _a0, _a1, _a2)} } -func (_c *MockLocalDoguDescriptorRepository_Add_Call) Run(run func(_a0 context.Context, _a1 SimpleDoguName, _a2 *core.Dogu)) *MockLocalDoguDescriptorRepository_Add_Call { +func (_c *MockLocalDoguDescriptorRepository_Add_Call) Run(run func(_a0 context.Context, _a1 ces_commons_libdogu.SimpleDoguName, _a2 *core.Dogu)) *MockLocalDoguDescriptorRepository_Add_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(SimpleDoguName), args[2].(*core.Dogu)) + run(args[0].(context.Context), args[1].(ces_commons_libdogu.SimpleDoguName), args[2].(*core.Dogu)) }) return _c } @@ -65,13 +68,13 @@ func (_c *MockLocalDoguDescriptorRepository_Add_Call) Return(_a0 error) *MockLoc return _c } -func (_c *MockLocalDoguDescriptorRepository_Add_Call) RunAndReturn(run func(context.Context, SimpleDoguName, *core.Dogu) error) *MockLocalDoguDescriptorRepository_Add_Call { +func (_c *MockLocalDoguDescriptorRepository_Add_Call) RunAndReturn(run func(context.Context, ces_commons_libdogu.SimpleDoguName, *core.Dogu) error) *MockLocalDoguDescriptorRepository_Add_Call { _c.Call.Return(run) return _c } // DeleteAll provides a mock function with given fields: _a0, _a1 -func (_m *MockLocalDoguDescriptorRepository) DeleteAll(_a0 context.Context, _a1 SimpleDoguName) error { +func (_m *MockLocalDoguDescriptorRepository) DeleteAll(_a0 context.Context, _a1 ces_commons_libdogu.SimpleDoguName) error { ret := _m.Called(_a0, _a1) if len(ret) == 0 { @@ -79,7 +82,7 @@ func (_m *MockLocalDoguDescriptorRepository) DeleteAll(_a0 context.Context, _a1 } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, SimpleDoguName) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, ces_commons_libdogu.SimpleDoguName) error); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Error(0) @@ -95,14 +98,14 @@ type MockLocalDoguDescriptorRepository_DeleteAll_Call struct { // DeleteAll is a helper method to define mock.On call // - _a0 context.Context -// - _a1 SimpleDoguName +// - _a1 ces_commons_libdogu.SimpleDoguName func (_e *MockLocalDoguDescriptorRepository_Expecter) DeleteAll(_a0 interface{}, _a1 interface{}) *MockLocalDoguDescriptorRepository_DeleteAll_Call { return &MockLocalDoguDescriptorRepository_DeleteAll_Call{Call: _e.mock.On("DeleteAll", _a0, _a1)} } -func (_c *MockLocalDoguDescriptorRepository_DeleteAll_Call) Run(run func(_a0 context.Context, _a1 SimpleDoguName)) *MockLocalDoguDescriptorRepository_DeleteAll_Call { +func (_c *MockLocalDoguDescriptorRepository_DeleteAll_Call) Run(run func(_a0 context.Context, _a1 ces_commons_libdogu.SimpleDoguName)) *MockLocalDoguDescriptorRepository_DeleteAll_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(SimpleDoguName)) + run(args[0].(context.Context), args[1].(ces_commons_libdogu.SimpleDoguName)) }) return _c } @@ -112,13 +115,13 @@ func (_c *MockLocalDoguDescriptorRepository_DeleteAll_Call) Return(_a0 error) *M return _c } -func (_c *MockLocalDoguDescriptorRepository_DeleteAll_Call) RunAndReturn(run func(context.Context, SimpleDoguName) error) *MockLocalDoguDescriptorRepository_DeleteAll_Call { +func (_c *MockLocalDoguDescriptorRepository_DeleteAll_Call) RunAndReturn(run func(context.Context, ces_commons_libdogu.SimpleDoguName) error) *MockLocalDoguDescriptorRepository_DeleteAll_Call { _c.Call.Return(run) return _c } // Get provides a mock function with given fields: _a0, _a1 -func (_m *MockLocalDoguDescriptorRepository) Get(_a0 context.Context, _a1 DoguVersion) (*core.Dogu, error) { +func (_m *MockLocalDoguDescriptorRepository) Get(_a0 context.Context, _a1 ces_commons_libdogu.QualifiedDoguVersion) (*core.Dogu, error) { ret := _m.Called(_a0, _a1) if len(ret) == 0 { @@ -127,10 +130,10 @@ func (_m *MockLocalDoguDescriptorRepository) Get(_a0 context.Context, _a1 DoguVe var r0 *core.Dogu var r1 error - if rf, ok := ret.Get(0).(func(context.Context, DoguVersion) (*core.Dogu, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, ces_commons_libdogu.QualifiedDoguVersion) (*core.Dogu, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, DoguVersion) *core.Dogu); ok { + if rf, ok := ret.Get(0).(func(context.Context, ces_commons_libdogu.QualifiedDoguVersion) *core.Dogu); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { @@ -138,7 +141,7 @@ func (_m *MockLocalDoguDescriptorRepository) Get(_a0 context.Context, _a1 DoguVe } } - if rf, ok := ret.Get(1).(func(context.Context, DoguVersion) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, ces_commons_libdogu.QualifiedDoguVersion) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -154,14 +157,14 @@ type MockLocalDoguDescriptorRepository_Get_Call struct { // Get is a helper method to define mock.On call // - _a0 context.Context -// - _a1 DoguVersion +// - _a1 ces_commons_libdogu.QualifiedDoguVersion func (_e *MockLocalDoguDescriptorRepository_Expecter) Get(_a0 interface{}, _a1 interface{}) *MockLocalDoguDescriptorRepository_Get_Call { return &MockLocalDoguDescriptorRepository_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} } -func (_c *MockLocalDoguDescriptorRepository_Get_Call) Run(run func(_a0 context.Context, _a1 DoguVersion)) *MockLocalDoguDescriptorRepository_Get_Call { +func (_c *MockLocalDoguDescriptorRepository_Get_Call) Run(run func(_a0 context.Context, _a1 ces_commons_libdogu.QualifiedDoguVersion)) *MockLocalDoguDescriptorRepository_Get_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(DoguVersion)) + run(args[0].(context.Context), args[1].(ces_commons_libdogu.QualifiedDoguVersion)) }) return _c } @@ -171,33 +174,33 @@ func (_c *MockLocalDoguDescriptorRepository_Get_Call) Return(_a0 *core.Dogu, _a1 return _c } -func (_c *MockLocalDoguDescriptorRepository_Get_Call) RunAndReturn(run func(context.Context, DoguVersion) (*core.Dogu, error)) *MockLocalDoguDescriptorRepository_Get_Call { +func (_c *MockLocalDoguDescriptorRepository_Get_Call) RunAndReturn(run func(context.Context, ces_commons_libdogu.QualifiedDoguVersion) (*core.Dogu, error)) *MockLocalDoguDescriptorRepository_Get_Call { _c.Call.Return(run) return _c } // GetAll provides a mock function with given fields: _a0, _a1 -func (_m *MockLocalDoguDescriptorRepository) GetAll(_a0 context.Context, _a1 []DoguVersion) (map[DoguVersion]*core.Dogu, error) { +func (_m *MockLocalDoguDescriptorRepository) GetAll(_a0 context.Context, _a1 []ces_commons_libdogu.QualifiedDoguVersion) (map[ces_commons_libdogu.QualifiedDoguVersion]*core.Dogu, error) { ret := _m.Called(_a0, _a1) if len(ret) == 0 { panic("no return value specified for GetAll") } - var r0 map[DoguVersion]*core.Dogu + var r0 map[ces_commons_libdogu.QualifiedDoguVersion]*core.Dogu var r1 error - if rf, ok := ret.Get(0).(func(context.Context, []DoguVersion) (map[DoguVersion]*core.Dogu, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, []ces_commons_libdogu.QualifiedDoguVersion) (map[ces_commons_libdogu.QualifiedDoguVersion]*core.Dogu, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, []DoguVersion) map[DoguVersion]*core.Dogu); ok { + if rf, ok := ret.Get(0).(func(context.Context, []ces_commons_libdogu.QualifiedDoguVersion) map[ces_commons_libdogu.QualifiedDoguVersion]*core.Dogu); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[DoguVersion]*core.Dogu) + r0 = ret.Get(0).(map[ces_commons_libdogu.QualifiedDoguVersion]*core.Dogu) } } - if rf, ok := ret.Get(1).(func(context.Context, []DoguVersion) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, []ces_commons_libdogu.QualifiedDoguVersion) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -213,24 +216,24 @@ type MockLocalDoguDescriptorRepository_GetAll_Call struct { // GetAll is a helper method to define mock.On call // - _a0 context.Context -// - _a1 []DoguVersion +// - _a1 []ces_commons_libdogu.QualifiedDoguVersion func (_e *MockLocalDoguDescriptorRepository_Expecter) GetAll(_a0 interface{}, _a1 interface{}) *MockLocalDoguDescriptorRepository_GetAll_Call { return &MockLocalDoguDescriptorRepository_GetAll_Call{Call: _e.mock.On("GetAll", _a0, _a1)} } -func (_c *MockLocalDoguDescriptorRepository_GetAll_Call) Run(run func(_a0 context.Context, _a1 []DoguVersion)) *MockLocalDoguDescriptorRepository_GetAll_Call { +func (_c *MockLocalDoguDescriptorRepository_GetAll_Call) Run(run func(_a0 context.Context, _a1 []ces_commons_libdogu.QualifiedDoguVersion)) *MockLocalDoguDescriptorRepository_GetAll_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].([]DoguVersion)) + run(args[0].(context.Context), args[1].([]ces_commons_libdogu.QualifiedDoguVersion)) }) return _c } -func (_c *MockLocalDoguDescriptorRepository_GetAll_Call) Return(_a0 map[DoguVersion]*core.Dogu, _a1 error) *MockLocalDoguDescriptorRepository_GetAll_Call { +func (_c *MockLocalDoguDescriptorRepository_GetAll_Call) Return(_a0 map[ces_commons_libdogu.QualifiedDoguVersion]*core.Dogu, _a1 error) *MockLocalDoguDescriptorRepository_GetAll_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockLocalDoguDescriptorRepository_GetAll_Call) RunAndReturn(run func(context.Context, []DoguVersion) (map[DoguVersion]*core.Dogu, error)) *MockLocalDoguDescriptorRepository_GetAll_Call { +func (_c *MockLocalDoguDescriptorRepository_GetAll_Call) RunAndReturn(run func(context.Context, []ces_commons_libdogu.QualifiedDoguVersion) (map[ces_commons_libdogu.QualifiedDoguVersion]*core.Dogu, error)) *MockLocalDoguDescriptorRepository_GetAll_Call { _c.Call.Return(run) return _c }