1 /*
2 * Copyright (c) 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 #include "connection_detector_mock.h"
17
18 namespace OHOS {
19 namespace Storage {
20 namespace DistributedFile {
GetCellByIndex(const std::string & str,int targetIndex)21 std::string ConnectionDetector::GetCellByIndex(const std::string &str, int targetIndex)
22 {
23 return "";
24 }
25
MatchConnectionStatus(ifstream & inputFile)26 bool ConnectionDetector::MatchConnectionStatus(ifstream &inputFile)
27 {
28 return true;
29 }
30
MatchConnectionGroup(const std::string & fileName,const string & networkId)31 bool ConnectionDetector::MatchConnectionGroup(const std::string &fileName, const string &networkId)
32 {
33 return true;
34 }
35
CheckValidDir(const std::string & path)36 bool ConnectionDetector::CheckValidDir(const std::string &path)
37 {
38 return true;
39 }
40
GetConnectionStatus(const std::string & targetDir,const std::string & networkId)41 bool ConnectionDetector::GetConnectionStatus(const std::string &targetDir, const std::string &networkId)
42 {
43 if (IConnectionDetectorMock::iConnectionDetectorMock_ == nullptr) {
44 return false;
45 }
46 return IConnectionDetectorMock::iConnectionDetectorMock_->GetConnectionStatus(targetDir, networkId);
47 }
48
MocklispHash(const string & str)49 uint64_t ConnectionDetector::MocklispHash(const string &str)
50 {
51 return 1;
52 }
53
RepeatGetConnectionStatus(const std::string & targetDir,const std::string & networkId)54 int32_t ConnectionDetector::RepeatGetConnectionStatus(const std::string &targetDir, const std::string &networkId)
55 {
56 if (IConnectionDetectorMock::iConnectionDetectorMock_ == nullptr) {
57 return -1;
58 }
59 return IConnectionDetectorMock::iConnectionDetectorMock_->RepeatGetConnectionStatus(targetDir, networkId);
60 }
61
GetCurrentUserId()62 int32_t ConnectionDetector::GetCurrentUserId()
63 {
64 return 0;
65 }
66
ParseHmdfsPath()67 std::string ConnectionDetector::ParseHmdfsPath()
68 {
69 return "";
70 }
71 } // namespace DistributedFile
72 } // namespace Storage
73 } // namespace OHOS