• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_DISTRIBUTED_HARDWARE_VERSION_INFO_MANAGER_TEST_H
17 #define OHOS_DISTRIBUTED_HARDWARE_VERSION_INFO_MANAGER_TEST_H
18 
19 #include <gtest/gtest.h>
20 #include <vector>
21 
22 #include "db_adapter.h"
23 #include "distributed_hardware_errno.h"
24 #include "version_info.h"
25 
26 namespace OHOS {
27 namespace DistributedHardware {
28 class VersionInfoManagerTest : public testing::Test {
29 public:
30     static void SetUpTestCase(void);
31     static void TearDownTestCase(void);
32     void SetUp();
33     void TearDown();
34 };
35 
36 class MockDBAdapter : public DBAdapter {
37 public:
MockDBAdapter(const std::string & appId,const std::string & storeId,const std::shared_ptr<DistributedKv::KvStoreObserver> changeListener)38 MockDBAdapter(const std::string &appId, const std::string &storeId,
39     const std::shared_ptr<DistributedKv::KvStoreObserver> changeListener)
40     : DBAdapter(appId, storeId, changeListener) {}
41 
RemoveCapabilityInfoByKey(const std::string & key)42 int32_t RemoveCapabilityInfoByKey(const std::string &key)
43 {
44     (void)key;
45     return DH_FWK_SUCCESS;
46 }
47 
GetDataByKey(const std::string & key,std::string & data)48 int32_t GetDataByKey(const std::string &key, std::string &data)
49 {
50     (void)key;
51     (void)data;
52     return DH_FWK_SUCCESS;
53 }
54 
RemoveDataByKey(const std::string & key)55 int32_t RemoveDataByKey(const std::string &key)
56 {
57     (void)key;
58     return DH_FWK_SUCCESS;
59 }
60 
GetDataByKeyPrefix(const std::string & keyPrefix,std::vector<std::string> & values)61 int32_t GetDataByKeyPrefix(const std::string &keyPrefix, std::vector<std::string> &values)
62 {
63     (void)keyPrefix;
64     (void)values;
65     return DH_FWK_SUCCESS;
66 }
67 };
68 } // namespace DistributedHardware
69 } // namespace OHOS
70 #endif
71