diff --git a/frameworks/libs/distributeddb/common/src/auto_launch.cpp b/frameworks/libs/distributeddb/common/src/auto_launch.cpp index dad896e5573599096758a9e43641647165907d3f..9447d5b42eb38043f81a173b8804512abf89baff 100644 --- a/frameworks/libs/distributeddb/common/src/auto_launch.cpp +++ b/frameworks/libs/distributeddb/common/src/auto_launch.cpp @@ -162,6 +162,7 @@ int AutoLaunch::EnableKvStoreAutoLaunchParmCheck(AutoLaunchItem &autoLaunchItem, int AutoLaunch::EnableKvStoreAutoLaunch(const KvDBProperties &properties, AutoLaunchNotifier notifier, const AutoLaunchOption &option) { +#ifdef USE_DISTRIBUTEDDB_DEVICE LOGI("[AutoLaunch] EnableKvStoreAutoLaunch"); bool isDualTupleMode = properties.GetBoolProp(KvDBProperties::SYNC_DUAL_TUPLE_MODE, false); std::string dualTupleIdentifier = properties.GetStringProp(KvDBProperties::DUAL_TUPLE_IDENTIFIER_DATA, ""); @@ -190,6 +191,9 @@ int AutoLaunch::EnableKvStoreAutoLaunch(const KvDBProperties &properties, AutoLa LOGE("[AutoLaunch] EnableKvStoreAutoLaunch failed errCode:%d", errCode); } return errCode; +#else + return E_OK; +#endif } void AutoLaunch::GetKVConnectionInEnableInner(const AutoLaunchItem &autoLaunchItem, const std::string &identifier, diff --git a/frameworks/libs/distributeddb/common/src/runtime_context_impl.cpp b/frameworks/libs/distributeddb/common/src/runtime_context_impl.cpp index 2dbd8767c029755d5ebd2d0857db08ca4b2e86bc..ca334b1aba3fd5c75718fe09cb91d3cbafed6065 100644 --- a/frameworks/libs/distributeddb/common/src/runtime_context_impl.cpp +++ b/frameworks/libs/distributeddb/common/src/runtime_context_impl.cpp @@ -25,6 +25,7 @@ #include "thread_pool_stub.h" namespace DistributedDB { +#ifdef USE_DISTRIBUTEDDB_DEVICE RuntimeContextImpl::RuntimeContextImpl() : adapter_(nullptr), communicatorAggregator_(nullptr), @@ -40,6 +41,21 @@ RuntimeContextImpl::RuntimeContextImpl() isBatchDownloadAssets_(true) { } +#else +RuntimeContextImpl::RuntimeContextImpl() + : mainLoop_(nullptr), + currentTimerId_(0), + taskPoolReportsTimerId_(0), + timeTickMonitor_(nullptr), + systemApiAdapter_(nullptr), + lockStatusObserver_(nullptr), + currentSessionId_(1), + dbStatusAdapter_(nullptr), + subscribeRecorder_(nullptr), + isBatchDownloadAssets_(true) +{ +} +#endif // Destruct the object. RuntimeContextImpl::~RuntimeContextImpl() @@ -80,6 +96,7 @@ std::string RuntimeContextImpl::GetProcessLabel() const int RuntimeContextImpl::SetCommunicatorAdapter(IAdapter *adapter) { +#ifdef USE_DISTRIBUTEDDB_DEVICE { std::lock_guard autoLock(communicatorLock_); if (adapter_ != nullptr) { @@ -94,10 +111,14 @@ int RuntimeContextImpl::SetCommunicatorAdapter(IAdapter *adapter) GetCommunicatorAggregator(communicatorAggregator); autoLaunch_.SetCommunicatorAggregator(communicatorAggregator); return E_OK; +#else + return E_OK; +#endif } int RuntimeContextImpl::GetCommunicatorAggregator(ICommunicatorAggregator *&outAggregator) { +#ifdef USE_DISTRIBUTEDDB_DEVICE outAggregator = nullptr; const std::shared_ptr statusAdapter = GetDBStatusAdapter(); if (statusAdapter == nullptr) { @@ -128,10 +149,14 @@ int RuntimeContextImpl::GetCommunicatorAggregator(ICommunicatorAggregator *&outA } outAggregator = communicatorAggregator_; return errCode; +#else + return E_OK; +#endif } void RuntimeContextImpl::SetCommunicatorAggregator(ICommunicatorAggregator *inAggregator) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::lock_guard autoLock(communicatorLock_); if (communicatorAggregator_ != nullptr) { autoLaunch_.SetCommunicatorAggregator(nullptr); @@ -140,16 +165,21 @@ void RuntimeContextImpl::SetCommunicatorAggregator(ICommunicatorAggregator *inAg } communicatorAggregator_ = inAggregator; autoLaunch_.SetCommunicatorAggregator(communicatorAggregator_); +#endif } int RuntimeContextImpl::GetLocalIdentity(std::string &outTarget) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::lock_guard autoLock(communicatorLock_); if (communicatorAggregator_ != nullptr) { return communicatorAggregator_->GetLocalIdentity(outTarget); } LOGW("[RuntimeContextImpl] Get local id without communicatorAggregator"); return -E_NOT_INIT; +#else + return E_OK; +#endif } // Add and start a timer. @@ -615,11 +645,15 @@ void RuntimeContextImpl::NotifyTimestampChanged(TimeOffset offset) const bool RuntimeContextImpl::IsCommunicatorAggregatorValid() const { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::lock_guard autoLock(communicatorLock_); if (communicatorAggregator_ == nullptr && adapter_ == nullptr) { return false; } return true; +#else + return false; +#endif } void RuntimeContextImpl::SetStoreStatusNotifier(const StoreStatusNotifier ¬ifier) @@ -785,6 +819,7 @@ void RuntimeContextImpl::StopTimeTickMonitorIfNeed() void RuntimeContextImpl::SetDBInfoHandle(const std::shared_ptr &handle) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr) { dbStatusAdapter->SetDBInfoHandle(handle); @@ -793,14 +828,17 @@ void RuntimeContextImpl::SetDBInfoHandle(const std::shared_ptr &ha if (subscribeRecorder != nullptr) { subscribeRecorder->RemoveAllSubscribe(); } +#endif } void RuntimeContextImpl::NotifyDBInfos(const DeviceInfos &devInfos, const std::vector &dbInfos) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr) { dbStatusAdapter->NotifyDBInfos(devInfos, dbInfos); } +#endif } std::shared_ptr RuntimeContextImpl::GetDBStatusAdapter() @@ -818,6 +856,7 @@ std::shared_ptr RuntimeContextImpl::GetDBStatusAdapter() void RuntimeContextImpl::RecordRemoteSubscribe(const DBInfo &dbInfo, const DeviceID &deviceId, const QuerySyncObject &query) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -826,10 +865,12 @@ void RuntimeContextImpl::RecordRemoteSubscribe(const DBInfo &dbInfo, const Devic if (subscribeRecorder != nullptr) { subscribeRecorder->RecordSubscribe(dbInfo, deviceId, query); } +#endif } void RuntimeContextImpl::RemoveRemoteSubscribe(const DeviceID &deviceId) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -838,10 +879,12 @@ void RuntimeContextImpl::RemoveRemoteSubscribe(const DeviceID &deviceId) if (subscribeRecorder != nullptr) { subscribeRecorder->RemoveRemoteSubscribe(deviceId); } +#endif } void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -850,10 +893,12 @@ void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo) if (subscribeRecorder != nullptr) { subscribeRecorder->RemoveRemoteSubscribe(dbInfo); } +#endif } void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo, const DeviceID &deviceId) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -862,11 +907,13 @@ void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo, const Devic if (subscribeRecorder != nullptr) { subscribeRecorder->RemoveRemoteSubscribe(dbInfo, deviceId); } +#endif } void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo, const DeviceID &deviceId, const QuerySyncObject &query) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -875,11 +922,13 @@ void RuntimeContextImpl::RemoveRemoteSubscribe(const DBInfo &dbInfo, const Devic if (subscribeRecorder != nullptr) { subscribeRecorder->RemoveRemoteSubscribe(dbInfo, deviceId, query); } +#endif } void RuntimeContextImpl::GetSubscribeQuery(const DBInfo &dbInfo, std::map> &subscribeQuery) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter != nullptr && dbStatusAdapter->IsSendLabelExchange()) { return; @@ -888,6 +937,7 @@ void RuntimeContextImpl::GetSubscribeQuery(const DBInfo &dbInfo, if (subscribeRecorder != nullptr) { subscribeRecorder->GetSubscribeQuery(dbInfo, subscribeQuery); } +#endif } std::shared_ptr RuntimeContextImpl::GetSubscribeRecorder() @@ -905,20 +955,26 @@ std::shared_ptr RuntimeContextImpl::GetSubscribeRecorder() bool RuntimeContextImpl::IsNeedAutoSync(const std::string &userId, const std::string &appId, const std::string &storeId, const std::string &devInfo) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter == nullptr) { return true; } return dbStatusAdapter->IsNeedAutoSync(userId, appId, storeId, devInfo); +#else + return false; +#endif } void RuntimeContextImpl::SetRemoteOptimizeCommunication(const std::string &dev, bool optimize) { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::shared_ptr dbStatusAdapter = GetDBStatusAdapter(); if (dbStatusAdapter == nullptr) { return; } dbStatusAdapter->SetRemoteOptimizeCommunication(dev, optimize); +#endif } void RuntimeContextImpl::SetTranslateToDeviceIdCallback(const TranslateToDeviceIdCallback &callback) @@ -1225,11 +1281,13 @@ std::shared_ptr RuntimeContextImpl::GetAssetsDownloadMana void RuntimeContextImpl::ClearOnlineLabel() { +#ifdef USE_DISTRIBUTEDDB_DEVICE std::lock_guard autoLock(communicatorLock_); if (communicatorAggregator_ == nullptr) { LOGE("[Runtime] clear online label with null aggregator"); return; } communicatorAggregator_->ClearOnlineLabel(); +#endif } } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/common/src/runtime_context_impl.h b/frameworks/libs/distributeddb/common/src/runtime_context_impl.h index cdcbdfd3b46ffad19e1362e0f1e14aa2693887a7..01b636d10f69dda54cae0725c1581b2d9faedb84 100644 --- a/frameworks/libs/distributeddb/common/src/runtime_context_impl.h +++ b/frameworks/libs/distributeddb/common/src/runtime_context_impl.h @@ -215,11 +215,12 @@ private: // Context fields mutable std::mutex labelMutex_; std::string processLabel_; - +#ifdef USE_DISTRIBUTEDDB_DEVICE // Communicator mutable std::mutex communicatorLock_; IAdapter *adapter_; ICommunicatorAggregator *communicatorAggregator_; +#endif // Loop and timer mutable std::mutex loopLock_; diff --git a/frameworks/libs/distributeddb/communicator/include/combine_status.h b/frameworks/libs/distributeddb/communicator/include/combine_status.h index 1f602e88c9c4d30755046cad3e4ed6db3c0015ad..01f9fc67c3f47f5917622e8a854a8a5f6b10caf1 100644 --- a/frameworks/libs/distributeddb/communicator/include/combine_status.h +++ b/frameworks/libs/distributeddb/communicator/include/combine_status.h @@ -28,6 +28,7 @@ class CombineStatus { public: CombineStatus() = default; ~CombineStatus() = default; +#ifdef USE_DISTRIBUTEDDB_DEVICE void UpdateProgressId(uint64_t inProgressId); uint64_t GetProgressId() const; bool CheckProgress(); @@ -51,6 +52,7 @@ private: uint16_t fragmentCount_ = 0; std::set combinedFragmentNo_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/include/communicator_aggregator.h b/frameworks/libs/distributeddb/communicator/include/communicator_aggregator.h index d685b8b5a3e86d0d47d79f3891f283f318a216f7..3f122e0b16ed02540373c07f99423f93a68cc317 100644 --- a/frameworks/libs/distributeddb/communicator/include/communicator_aggregator.h +++ b/frameworks/libs/distributeddb/communicator/include/communicator_aggregator.h @@ -49,6 +49,7 @@ struct TaskConfig { * Upper layer Module should comply with calling convention, Inner Module interface will not do excessive check */ class CommunicatorAggregator : public ICommunicatorAggregator { +#ifdef USE_DISTRIBUTEDDB_DEVICE public: CommunicatorAggregator(); ~CommunicatorAggregator() override; @@ -197,7 +198,7 @@ private: SendTaskScheduler scheduler_; IAdapter *adapterHandle_ = nullptr; CommunicatorLinker *commLinker_ = nullptr; - + // Thread related std::thread exclusiveThread_; bool wakingSignal_ = false; @@ -238,6 +239,7 @@ private: std::mutex sendSequenceMutex_; std::map sendSequence_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/include/db_status_adapter.h b/frameworks/libs/distributeddb/communicator/include/db_status_adapter.h index 35b5cc3fe1c292f38ac3be0bfd6348d3a6cdf4c0..7dcce2987ff44ad5e1514f81de7378b435d215ce 100644 --- a/frameworks/libs/distributeddb/communicator/include/db_status_adapter.h +++ b/frameworks/libs/distributeddb/communicator/include/db_status_adapter.h @@ -25,6 +25,7 @@ using RemoteDBChangeCallback = std::function; using RemoteSupportChangeCallback = std::function; class DBStatusAdapter { +#ifdef USE_DISTRIBUTEDDB_DEVICE public: DBStatusAdapter(); ~DBStatusAdapter() = default; @@ -68,6 +69,7 @@ private: bool localSendLabelExchange_; bool cacheLocalSendLabelExchange_; std::map remoteOptimizeInfo_; // key: device uuid, value: is support notified by user +#endif }; } #endif // DB_STATUS_ADAPTER_H diff --git a/frameworks/libs/distributeddb/communicator/include/frame_combiner.h b/frameworks/libs/distributeddb/communicator/include/frame_combiner.h index d1ec81f82671369e3cfbdaee5aea45d27b8db7e6..e4d50e0f2a11ed81caf542547766915bd3adaa1c 100644 --- a/frameworks/libs/distributeddb/communicator/include/frame_combiner.h +++ b/frameworks/libs/distributeddb/communicator/include/frame_combiner.h @@ -38,6 +38,7 @@ class FrameCombiner { public: FrameCombiner() = default; // Default constructor must be explicitly provided due to DISABLE_COPY_ASSIGN_MOVE ~FrameCombiner() = default; // Since constructor must be provided, codedex demand deconstructor be provided as well +#ifdef USE_DISTRIBUTEDDB_DEVICE DISABLE_COPY_ASSIGN_MOVE(FrameCombiner); // Start the timer to supervise the progress @@ -73,6 +74,7 @@ private: uint64_t incProgressId_ = 0; uint64_t totalSizeByByte_ = 0; std::map> combineWorkPool_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/include/frame_retainer.h b/frameworks/libs/distributeddb/communicator/include/frame_retainer.h index 7e2c5f17f525aba2ecf07775e12963027f21db6f..c8a6cc6fda8be8af7b0f0e1ea459de411797385d 100644 --- a/frameworks/libs/distributeddb/communicator/include/frame_retainer.h +++ b/frameworks/libs/distributeddb/communicator/include/frame_retainer.h @@ -47,6 +47,7 @@ class FrameRetainer { public: FrameRetainer() = default; // Default constructor must be explicitly provided due to DISABLE_COPY_ASSIGN_MOVE ~FrameRetainer() = default; // Since constructor must be provided, codedex demand deconstructor be provided as well +#ifdef USE_DISTRIBUTEDDB_DEVICE DISABLE_COPY_ASSIGN_MOVE(FrameRetainer); // Start the timer to clear up overtime frames @@ -82,6 +83,7 @@ private: uint64_t incRetainOrder_ = 0; std::map>> retainWorkPool_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/include/network_adapter.h b/frameworks/libs/distributeddb/communicator/include/network_adapter.h index fc1c390ab95b69d5b0527f3b407f11cd420a302b..b30bc0995f98be2029e313f9e9fece13953cfc3f 100644 --- a/frameworks/libs/distributeddb/communicator/include/network_adapter.h +++ b/frameworks/libs/distributeddb/communicator/include/network_adapter.h @@ -27,6 +27,7 @@ namespace DistributedDB { class NetworkAdapter : public IAdapter { +#ifdef USE_DISTRIBUTEDDB_DEVICE public: NetworkAdapter(); explicit NetworkAdapter(const std::string &inProcessLabel); @@ -93,6 +94,7 @@ private: mutable std::mutex onReceiveMutex_; mutable std::mutex onChangeMutex_; mutable std::mutex onSendableMutex_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/include/parse_result.h b/frameworks/libs/distributeddb/communicator/include/parse_result.h index 9cf5cdb7344f6e7254bfba854e185c2801063d62..1b24a1961770bc298cda991996d216d1291f11c4 100644 --- a/frameworks/libs/distributeddb/communicator/include/parse_result.h +++ b/frameworks/libs/distributeddb/communicator/include/parse_result.h @@ -25,7 +25,7 @@ class ParseResult { public: ParseResult() = default; ~ParseResult() = default; - +#ifdef USE_DISTRIBUTEDDB_DEVICE void SetFrameId(uint32_t inFrameId) { frameId_ = inFrameId; @@ -181,6 +181,7 @@ private: uint64_t labelExchangeSequenceId_ = 0; // For Both LabelExchange And LabelExchangeAck Frame std::set latestCommLabels_; // For Only LabelExchange Frame uint16_t dbVersion_ = 0; +#endif }; } diff --git a/frameworks/libs/distributeddb/communicator/src/combine_status.cpp b/frameworks/libs/distributeddb/communicator/src/combine_status.cpp index 8157e0953c343f0cba1bef534040fac762cc685f..034ae3921168453f1994d921d745c31e023616af 100644 --- a/frameworks/libs/distributeddb/communicator/src/combine_status.cpp +++ b/frameworks/libs/distributeddb/communicator/src/combine_status.cpp @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "combine_status.h" namespace DistributedDB { @@ -79,3 +79,4 @@ bool CombineStatus::IsCombineDone() const return (combinedFragmentNo_.size() >= fragmentCount_); } } // namespace DistributedDB +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/communicator.cpp b/frameworks/libs/distributeddb/communicator/src/communicator.cpp index 1011ae152220c89c81a032bda30f4f0cde1c7c59..f6a87cf38e6fe29c3fa99483b46aeb4d7ba613ba 100644 --- a/frameworks/libs/distributeddb/communicator/src/communicator.cpp +++ b/frameworks/libs/distributeddb/communicator/src/communicator.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "communicator.h" #include "db_common.h" #include "log_print.h" @@ -303,3 +304,4 @@ bool Communicator::ExchangeClosePending(bool expected) } DEFINE_OBJECT_TAG_FACILITIES(Communicator) } // namespace DistributedDB +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/communicator.h b/frameworks/libs/distributeddb/communicator/src/communicator.h index 80c3f0e66bf4966161f8a15d0d1718778993b7c6..244088eeedc81b756a9442bf3b5d69e8034bbd5d 100644 --- a/frameworks/libs/distributeddb/communicator/src/communicator.h +++ b/frameworks/libs/distributeddb/communicator/src/communicator.h @@ -29,6 +29,7 @@ namespace DistributedDB { class Communicator : public ICommunicator { +#ifdef USE_DISTRIBUTEDDB_DEVICE public: Communicator(CommunicatorAggregator *inCommAggregator, const LabelType &inLabel); ~Communicator() override; @@ -92,6 +93,7 @@ private: std::mutex messageHandleMutex_; std::mutex connectHandleMutex_; std::mutex sendableHandleMutex_; +#endif }; } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp b/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp index 1b5cf4e067e77bd680175361757dd60e8e6b2533..5e2ef227ea6f7fd3bf54e8ebe4ed2b62e08cdfe8 100644 --- a/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp +++ b/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp @@ -25,6 +25,7 @@ #include "protocol_proto.h" namespace DistributedDB { +#ifdef USE_DISTRIBUTEDDB_DEVICE namespace { constexpr int RETRY_TIME_SPLIT = 4; inline std::string GetThreadId() @@ -1237,4 +1238,5 @@ int32_t CommunicatorAggregator::GetRetryCount(const std::string &dev, bool isRet return scheduler_.GetRetryCount(dev, isRetryTask); } DEFINE_OBJECT_TAG_FACILITIES(CommunicatorAggregator) +#endif } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/src/communicator_linker.cpp b/frameworks/libs/distributeddb/communicator/src/communicator_linker.cpp index 83513365b52b23d83d1cb58efb1e696e558bd7ae..a765d49646e0e20a501f58b21b0b77d1f2b688c5 100644 --- a/frameworks/libs/distributeddb/communicator/src/communicator_linker.cpp +++ b/frameworks/libs/distributeddb/communicator/src/communicator_linker.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "communicator_linker.h" #include @@ -507,3 +508,4 @@ void CommunicatorLinker::ClearOnlineLabel() } DEFINE_OBJECT_TAG_FACILITIES(CommunicatorLinker) } // namespace DistributedDB +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/communicator_linker.h b/frameworks/libs/distributeddb/communicator/src/communicator_linker.h index f02630ac6ebf9208a39efc57db6656797a0badb3..ee518bef276f727e0b1c0d015fa22d3f11d8040f 100644 --- a/frameworks/libs/distributeddb/communicator/src/communicator_linker.h +++ b/frameworks/libs/distributeddb/communicator/src/communicator_linker.h @@ -33,6 +33,7 @@ namespace DistributedDB { class CommunicatorAggregator; // Forward Declaration class CommunicatorLinker : public virtual RefObject { +#ifdef USE_DISTRIBUTEDDB_DEVICE public: explicit CommunicatorLinker(CommunicatorAggregator *inAggregator, std::shared_ptr statusAdapter); @@ -126,6 +127,7 @@ private: std::map> targetMapOnlineLabels_; std::shared_ptr statusAdapter_; +#endif }; } diff --git a/frameworks/libs/distributeddb/communicator/src/db_status_adapter.cpp b/frameworks/libs/distributeddb/communicator/src/db_status_adapter.cpp index 79c076683a080c36a305f49fb4a055e9eb2100b3..4ace320443f832ed380c3d3b8ee8fdc9a682ab32 100644 --- a/frameworks/libs/distributeddb/communicator/src/db_status_adapter.cpp +++ b/frameworks/libs/distributeddb/communicator/src/db_status_adapter.cpp @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "db_status_adapter.h" #include "db_common.h" @@ -341,4 +343,5 @@ bool DBStatusAdapter::IsLocalDeviceId(const std::string &deviceId) } return deviceId == localId; } -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/frame_combiner.cpp b/frameworks/libs/distributeddb/communicator/src/frame_combiner.cpp index 5fafb9e88d8b33b1efe1838c1348e832492822d2..a51c20f105d134d7407b8826d3231d82001362fe 100644 --- a/frameworks/libs/distributeddb/communicator/src/frame_combiner.cpp +++ b/frameworks/libs/distributeddb/communicator/src/frame_combiner.cpp @@ -19,6 +19,7 @@ #include "protocol_proto.h" namespace DistributedDB { +#ifdef USE_DISTRIBUTEDDB_DEVICE static const uint32_t MAX_WORK_PER_SRC_TARGET = 1; // Only allow 1 CombineWork for each target static const int COMBINER_SURVAIL_PERIOD_IN_MILLISECOND = 10000; // Period is 10 s @@ -253,4 +254,5 @@ SerialBuffer *FrameCombiner::CreateNewFrameBuffer(const ParseResult &inInfo) } return buffer; } +#endif } // namespace DistributedDB \ No newline at end of file diff --git a/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp b/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp index 4c81e86181f237575df308e52bca83b5e8583326..238c8533a61e6b9f2bec0609dd9189b07a99c517 100644 --- a/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp +++ b/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp @@ -19,6 +19,7 @@ #include "serial_buffer.h" namespace DistributedDB { +#ifdef USE_DISTRIBUTEDDB_DEVICE namespace { const uint32_t MAX_RETAIN_CAPACITY = 67108864; // 64 M bytes const uint32_t MAX_RETAIN_PERIOD_COUNT = 2; // One period is RETAIN_SURVAIL_PERIOD_IN_MILLISECOND. @@ -252,4 +253,5 @@ void FrameRetainer::ShrinkRetainWorkPool() retainWorkPool_.erase(entry); } } +#endif } // namespace DistributedDB \ No newline at end of file diff --git a/frameworks/libs/distributeddb/communicator/src/message_transform.cpp b/frameworks/libs/distributeddb/communicator/src/message_transform.cpp index dfcfc5162e86d38824d2eaf38988935b8f7406c9..30dbbef161838303c09cda88ec7a1e55724ca85d 100644 --- a/frameworks/libs/distributeddb/communicator/src/message_transform.cpp +++ b/frameworks/libs/distributeddb/communicator/src/message_transform.cpp @@ -19,6 +19,10 @@ namespace DistributedDB { int MessageTransform::RegTransformFunction(uint32_t msgId, const TransformFunc &inFunc) { +#ifdef USE_DISTRIBUTEDDB_DEVICE return ProtocolProto::RegTransformFunction(msgId, inFunc); +#else + return 0; +#endif } -} // namespace DistributedDB \ No newline at end of file +} // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/communicator/src/network_adapter.cpp b/frameworks/libs/distributeddb/communicator/src/network_adapter.cpp index 6a4ac21b84e9151f28bbb550a04ec9ea71da49d0..2d3fef958e72336091f3e05d180629808e49b0f2 100644 --- a/frameworks/libs/distributeddb/communicator/src/network_adapter.cpp +++ b/frameworks/libs/distributeddb/communicator/src/network_adapter.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "network_adapter.h" #include "db_constant.h" #include "db_common.h" @@ -450,3 +451,4 @@ std::shared_ptr NetworkAdapter::GetExtendHeaderHandle(const return processCommunicator_->GetExtendHeaderHandle(paramInfo); } } // namespace DistributedDB +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/protocol_proto.cpp b/frameworks/libs/distributeddb/communicator/src/protocol_proto.cpp index 8234aa2d7ed019abffddf3c46f62814451823d75..7ded2363b31d29d338dc4986784d4748c4ae903f 100644 --- a/frameworks/libs/distributeddb/communicator/src/protocol_proto.cpp +++ b/frameworks/libs/distributeddb/communicator/src/protocol_proto.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "protocol_proto.h" #include #include @@ -1123,3 +1124,4 @@ int ProtocolProto::GetTransformFunc(uint32_t messageId, DistributedDB::Transform return E_OK; } } // namespace DistributedDB +#endif diff --git a/frameworks/libs/distributeddb/communicator/src/protocol_proto.h b/frameworks/libs/distributeddb/communicator/src/protocol_proto.h index 34c021071867f5ec82810c144ecbdda01324409e..e512f1ad6ab9a660bf333481dd7dd87cddfcc114 100644 --- a/frameworks/libs/distributeddb/communicator/src/protocol_proto.h +++ b/frameworks/libs/distributeddb/communicator/src/protocol_proto.h @@ -47,6 +47,7 @@ struct FragmentPacket { uint32_t leftLength = 0u; }; +#ifdef USE_DISTRIBUTEDDB_DEVICE class ProtocolProto { public: // For application layer frame @@ -137,6 +138,7 @@ private: static std::shared_mutex msgIdMutex_; static std::map msgIdMapFunc_; }; +#endif } // namespace DistributedDB #endif // PROTOCOLPROTO_H diff --git a/frameworks/libs/distributeddb/communicator/src/send_task_scheduler.cpp b/frameworks/libs/distributeddb/communicator/src/send_task_scheduler.cpp index edbee34414b2ff3c0db96b1334ea26cb13e71dc3..a46f4bff8744742d6c68e71544776b5672201bf3 100644 --- a/frameworks/libs/distributeddb/communicator/src/send_task_scheduler.cpp +++ b/frameworks/libs/distributeddb/communicator/src/send_task_scheduler.cpp @@ -405,4 +405,4 @@ void SendTaskScheduler::IncreaseRetryCountIfNeed(const std::string &dev, bool is std::lock_guard autoLock(overallMutex_); retryCount_[dev][isRetryTask]++; } -} \ No newline at end of file +} diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp b/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp index f0276b8ae5d86d2397d5e86bc1418b8b934a521d..d7b44b7570c8b623832e09a42d4f2a96172969f5 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp @@ -24,10 +24,12 @@ using namespace DistributedDB; +#ifdef USE_DISTRIBUTEDDB_DEVICE namespace { const uint32_t STUB_MTU_SIZE = 5 * 1024 * 1024; // 5 M, 1024 is scale const uint32_t STUB_TIME_OUT = 5 * 1000; // 5 S, 1000 is scale } +#endif /* * Override Part @@ -36,7 +38,7 @@ AdapterStub::~AdapterStub() { // Do nothing } - +#ifdef USE_DISTRIBUTEDDB_DEVICE int AdapterStub::StartAdapter() { return E_OK; @@ -476,4 +478,5 @@ std::vector AdapterStub::GetUserInfo() void AdapterStub::SetProcessCommunicator(std::shared_ptr processCommunicator) { processCommunicator_ = std::move(processCommunicator); -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.h b/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.h index 638c2599eb89c8d704e53d67b25b97bd9393a159..e0d0cdd6c6b437004c4ab50fbc2cfefd29c0df70 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.h +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/adapter_stub.h @@ -33,7 +33,7 @@ public: * Override Part */ ~AdapterStub() override; - +#ifdef USE_DISTRIBUTEDDB_DEVICE int StartAdapter() override; void StopAdapter() override; uint32_t GetMtuSize() override; @@ -149,6 +149,7 @@ private: std::vector userInfo_; std::shared_ptr processCommunicator_ = nullptr; +#endif }; } diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp index cf2bb2e0458e76773fcbdd47da257026842f2ce3..9c4c00d3c3a28fd8236276ea4e0e423640a4a288 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include "distributeddb_communicator_common.h" #include #include "db_errno.h" @@ -348,4 +349,5 @@ bool RegedGiantObject::CheckEqual(const RegedGiantObject &inLeft, const RegedGia index++; } return true; -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.h b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.h index dbf2a0641ba7f5dd00bc5d166468887123dfc473..4c56f4d1f9b7243a579a88c06a4c484a5e47a76a 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.h +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.h @@ -37,7 +37,7 @@ struct OnOfflineDevice { std::string latestOnlineDevice; std::string latestOfflineDevice; }; - +#ifdef USE_DISTRIBUTEDDB_DEVICE bool SetUpEnv(EnvHandle &inEnv, const std::string &inName, const std::shared_ptr &adapter); bool SetUpEnv(EnvHandle &inEnv, const std::string &inName); @@ -150,5 +150,5 @@ DistributedDB::Message *BuildUnRegedTinyMessage(); ASSERT_NE(communicator, nullptr); \ (communicator)->Activate(userId); \ } - +#endif #endif // DISTRIBUTEDDB_COMMUNICATOR_COMMON_H \ No newline at end of file diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_deep_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_deep_test.cpp index 74b5922e4a7e42ef1b2a46a2e176afb25510a94d..00655324681b7fda8b73609ddaf56de22e54eea6 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_deep_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_deep_test.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include #include #include @@ -1611,4 +1612,5 @@ HWTEST_F(DistributedDBCommunicatorDeepTest, SendFailed002, TestSize.Level0) adapterStub->ForkSendBytes(nullptr); EXPECT_EQ(aggregator->GetRetryCount(DEVICE_NAME_B, true), 0); EXPECT_EQ(aggregator->GetRetryCount(DEVICE_NAME_B, false), 0); -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_send_receive_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_send_receive_test.cpp index a02bc2f7fb2d251f3b24d5c3167eb1a50ba09240..cde1d7754c6b0e86ee1d5f9d896aa8db27ffaa4d 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_send_receive_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_send_receive_test.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#ifdef USE_DISTRIBUTEDDB_DEVICE #include #include #include "db_errno.h" @@ -919,4 +920,5 @@ HWTEST_F(DistributedDBCommunicatorSendReceiveTest, ToMessageTest001, TestSize.Le Message* msg = ProtocolProto::ToMessage(nullptr, errorNo, false); EXPECT_EQ(errorNo, -E_INVALID_ARGS); EXPECT_EQ(msg, nullptr); -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_import_and_export_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_import_and_export_test.cpp index 7347837fd3aad5f9a13af16992b3e8d739a68675..4a35c78286c73443376c497c89bc603bebef053a 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_import_and_export_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_import_and_export_test.cpp @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#ifdef USE_DISTRIBUTEDDB_DEVICE #ifndef OMIT_ENCRYPT #include #include @@ -92,10 +94,8 @@ public: void DistributedDBInterfacesImportAndExportTest::SetUpTestCase(void) { -#ifdef USE_DISTRIBUTEDDB_DEVICE g_mgr.SetProcessLabel("6666", "8888"); g_mgr.SetProcessCommunicator(std::make_shared()); -#endif DistributedDBToolsUnitTest::TestDirInit(g_testDir); g_config.dataDir = g_testDir; g_mgr.SetKvStoreConfig(g_config); @@ -1482,4 +1482,5 @@ HWTEST_F(DistributedDBInterfacesImportAndExportTest, CheckSecurityLabel002, Test RuntimeContext::GetInstance()->SetProcessSystemApiAdapter(nullptr); g_junkFilesList.push_back(singleFileName); } -#endif // OMIT_ENCRYPT \ No newline at end of file +#endif // OMIT_ENCRYPT +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_local_batch_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_local_batch_test.cpp index 1c22712414b52973be24bfd91f67dc4488b7ec1b..4aa76968c01b4cf3bf0b4019134ee7f4e612cd0d 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_local_batch_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_local_batch_test.cpp @@ -485,6 +485,7 @@ HWTEST_F(DistributedDBInterfacesNBDelegateLocalBatchTest, SingleVerPutLocalBatch } #ifndef LOW_LEVEL_MEM_DEV +#ifdef USE_DISTRIBUTEDDB_DEVICE /** * @tc.name: SingleVerPutLocalBatch005 * @tc.desc: Check for legal parameters that the sum size of all entries is smaller than 512M. @@ -578,6 +579,7 @@ HWTEST_F(DistributedDBInterfacesNBDelegateLocalBatchTest, SingleVerPutLocalBatch EXPECT_EQ(g_mgr.DeleteKvStore("SingleVerPutLocalBatch006"), OK); g_kvNbDelegatePtr = nullptr; } +#endif /** * @tc.name: SingleVerPutLocalBatch007 diff --git a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp index 7d684f3ddbb5c87bccb90afbf309cad14d59f182..15c91426b174138d2380b3ac1a3a8fce5a8cc34e 100755 --- a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp @@ -1176,6 +1176,7 @@ static void CreatEntrys(int recordSize, vector &keys, vector &values } #ifndef LOW_LEVEL_MEM_DEV +#ifdef USE_DISTRIBUTEDDB_DEVICE /** * @tc.name: SingleVerPutBatch005 * @tc.desc: Check for legal parameters that the sum size of all entries is smaller than 512M. @@ -1269,6 +1270,7 @@ HWTEST_F(DistributedDBInterfacesNBDelegateTest, SingleVerPutBatch006, TestSize.L EXPECT_EQ(g_mgr.DeleteKvStore("distributed_SingleVerPutBatch_006"), OK); g_kvNbDelegatePtr = nullptr; } +#endif /** * @tc.name: SingleVerPutBatch007 diff --git a/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp index 99382c950194336018ab020be5ea190725f3e9e1..af530798b8adbca2a88101740bbedf33fa3fd851 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp @@ -1778,6 +1778,7 @@ HWTEST_F(DistributedDBRelationalGetDataTest, StopSync001, TestSize.Level1) userChangeThread.join(); } +#ifdef USE_DISTRIBUTEDDB_DEVICE /** * @tc.name: EraseDeviceWaterMark001 * @tc.desc: Test Relational erase water mark. @@ -1791,6 +1792,7 @@ HWTEST_F(DistributedDBRelationalGetDataTest, EraseDeviceWaterMark001, TestSize.L ASSERT_NE(syncAbleEngine, nullptr); EXPECT_EQ(syncAbleEngine->EraseDeviceWaterMark("", true), -E_INVALID_ARGS); } +#endif /** * @tc.name: AbnormalSyncerProxyTest001 diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_ability_sync_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_ability_sync_test.cpp index 15b8b5d133d83561a4697a6ec6cfb02d1f21e013..b97447a4fd5708af5d005914984832333fc1e4f1 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_ability_sync_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_ability_sync_test.cpp @@ -382,6 +382,7 @@ HWTEST_F(DistributedDBAbilitySyncTest, AckPacketTest001, TestSize.Level0) ASSERT_TRUE(schema == TEST_SCHEMA); } +#ifdef USE_DISTRIBUTEDDB_DEVICE /** * @tc.name: SyncStartTest001 * @tc.desc: Verify Ability sync SyncStart function. @@ -414,6 +415,7 @@ HWTEST_F(DistributedDBAbilitySyncTest, SyncStart001, TestSize.Level0) */ EXPECT_TRUE(async.SyncStart(1, 1, 1) == -E_PERIPHERAL_INTERFACE_FAIL); } + #ifndef OMIT_JSON /** * @tc.name: RequestReceiveTest001 @@ -485,6 +487,8 @@ HWTEST_F(DistributedDBAbilitySyncTest, RequestReceiveTest001, TestSize.Level0) RefObject::KillAndDecObjRef(context); } #endif +#endif + /** * @tc.name: AckReceiveTest001 * @tc.desc: Verify Ability AckReceive callback. diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_anti_dos_sync_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_anti_dos_sync_test.cpp index 97a459c93c7d700e2e6150341952208f4d197364..84e5741fd8d1b556865b84d2b104756f47ece6fa 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_anti_dos_sync_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_anti_dos_sync_test.cpp @@ -153,6 +153,7 @@ void DistributeddbAntiDosSyncTest::TearDown(void) g_mgr.DeleteKvStore(ANTI_DOS_STORE_ID); } +#ifdef USE_DISTRIBUTEDDB_DEVICE /** * @tc.name: Anti Dos attack Sync 001 * @tc.desc: Whether function run normally when the amount of message is lower than the maximum of threads @@ -318,4 +319,5 @@ HWTEST_F(DistributeddbAntiDosSyncTest, AntiDosAttackSync003, TestSize.Level3) EXPECT_TRUE(g_syncEngine->GetDiscardMsgNum() > 0); EXPECT_TRUE(g_syncEngine->GetQueueCacheSize() > 0); g_communicatorAggregator->SetBlockValue(false); -} \ No newline at end of file +} +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp index 076a2287534c5bbbccbb4627006d8a95f6fe8ec6..2a7ed22968b449f7a15fae136b1a8e27630a017d 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/distributeddb_mock_sync_module_test.cpp @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#ifdef USE_DISTRIBUTEDDB_DEVICE #include #include #ifdef RUN_AS_ROOT @@ -2735,3 +2737,4 @@ HWTEST_F(DistributedDBMockSyncModuleTest, IsNeedRetrySyncTest, TestSize.Level0) RefObject::KillAndDecObjRef(context); } } +#endif diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/virtual_communicator.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/virtual_communicator.cpp index 66d749d06c0e2a05a0e30133c3c82e96231882b4..2c41edee19d3e87840eb4cbbadec6db24a4dc4be 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/virtual_communicator.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/virtual_communicator.cpp @@ -216,6 +216,7 @@ VirtualCommunicator::VirtualCommunicator(const std::string &deviceId, int VirtualCommunicator::TranslateMsg(const Message *inMsg, Message *&outMsg) { +#ifdef USE_DISTRIBUTEDDB_DEVICE int errCode = E_OK; std::shared_ptr extendHandle = nullptr; auto buffer = ProtocolProto::ToSerialBuffer(inMsg, extendHandle, false, errCode); @@ -227,6 +228,9 @@ int VirtualCommunicator::TranslateMsg(const Message *inMsg, Message *&outMsg) delete buffer; buffer = nullptr; return errCode; +#else + return E_OK; +#endif } void VirtualCommunicator::SetDropMessageTypeByDevice(MessageId msgid, uint32_t dropTimes)