1 /* 2 * Copyright (c) 2022 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 DISTRIBUTED_TEST_HELPER_INCLUDE_H 17 #define DISTRIBUTED_TEST_HELPER_INCLUDE_H 18 19 #include <gtest/gtest.h> 20 #include <unistd.h> 21 #include <cstddef> 22 #include <cstdint> 23 #include <vector> 24 #include "distributed_kv_data_manager.h" 25 #include "types.h" 26 #include "distributed_major.h" 27 #include "refbase.h" 28 #include "hilog/log.h" 29 30 class DistributedTestHelper : public OHOS::DistributeSystemTest::DistributeTest { 31 public: 32 static void SetUpTestCase(void); 33 static void TearDownTestCase(void); 34 void SetUp() override; 35 void TearDown() override; 36 void TestBody() override; 37 38 OHOS::DistributedKv::Status GetRemote(const OHOS::DistributedKv::Key &key, 39 OHOS::DistributedKv::Value &value); 40 OHOS::DistributedKv::Status PutRemote(const OHOS::DistributedKv::Key &key, 41 const OHOS::DistributedKv::Value &value); 42 OHOS::DistributedKv::Status DeleteRemote(const OHOS::DistributedKv::Key &key); 43 OHOS::DistributedKv::Status RemoveDeviceDataRemote(); 44 OHOS::DistributedKv::Status SyncRemote(OHOS::DistributedKv::SyncMode mode, uint32_t delay = 0); 45 }; 46 #endif // DISTRIBUTED_TEST_HELPER_INCLUDE_H