diff options
Diffstat (limited to 'usecaseui-portal/src/assets/images/update.png')
0 files changed, 0 insertions, 0 deletions
![]() |
index : usecase-ui | |
Graphical User Interface wifor operators and end-users from the point of view of use cases. | Grokmirror user |
summaryrefslogtreecommitdiffstats |
/*
Copyright 2018 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package db
import (
"strings"
pkgerrors "github.com/pkg/errors"
)
type MockEtcdClient struct {
Items map[string]string
Err error
}
func (c *MockEtcdClient) Put(key, value string) error {
if c.Items == nil {
c.Items = make(map[string]string)
}
c.Items[key] = value
return c.Err
}
func (c *MockEtcdClient) Get(key string) ([]byte, error) {
for kvKey, kvValue := range c.Items {
if kvKey == key {
return []byte(kvValue), nil
}
}
return nil, pkgerrors.Errorf("Key doesn't exist")
}
func (c *MockEtcdClient) GetAll(key string) ([][]byte, error) {
result := make([][]byte, 0)
for kvKey, kvValue := range c.Items {
if strings.HasPrefix(kvKey, key) {
result = append(result, []byte(kvValue))
}
}
return result, nil
}
func (c *MockEtcdClient) Delete(key string) error {
delete(c.Items, key)
return c.Err
}
© 2017 ONAP a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use