change dir of proxy

Signed-off-by: 张文迪 <zhangwendi3@huawei.com>
This commit is contained in:
张文迪 2023-03-11 17:24:41 +08:00
parent 929b8c8cd9
commit 90ff661a86
16 changed files with 115 additions and 76 deletions

View File

@ -69,6 +69,7 @@
"header": {
"header_files": [
"istorage_manager.h",
"storage_manager_proxy.h",
"bundle_stats.h",
"storage_stats.h",
"disk.h",

View File

@ -12,6 +12,7 @@
# limitations under the License.
import("//build/ohos.gni")
import("//build/ohos_var.gni")
import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni")
config("public_config") {
include_dirs = [ "." ]
@ -19,21 +20,21 @@ config("public_config") {
config("private_config") {
include_dirs = [
"//foundation/filemanagement/storage_service/services/storage_manager/include",
"${storage_manager_path}/include",
"//foundation/filemanagement/storage_service/services/storage_daemon/include",
"//foundation/filemanagement/storage_service/services/common/include",
"${storage_service_common_path}/include",
]
}
ohos_shared_library("storage_manager_sa_proxy") {
sources = [
"//foundation/filemanagement/storage_service/services/storage_daemon/ipc/src/storage_daemon_proxy.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/bundle_stats.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/disk.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/storage_stats.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/volume_core.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/volume_external.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/src/storage_manager_proxy.cpp",
"${storage_daemon_path}/ipc/src/storage_daemon_proxy.cpp",
"${storage_manager_path}/innerkits_impl/src/bundle_stats.cpp",
"${storage_manager_path}/innerkits_impl/src/disk.cpp",
"${storage_manager_path}/innerkits_impl/src/storage_manager_proxy.cpp",
"${storage_manager_path}/innerkits_impl/src/storage_stats.cpp",
"${storage_manager_path}/innerkits_impl/src/volume_core.cpp",
"${storage_manager_path}/innerkits_impl/src/volume_external.cpp",
]
defines = [

View File

@ -51,12 +51,6 @@ declare_args() {
ohos_executable("storage_daemon") {
sources = [
"../storage_manager/innerkits_impl/src/bundle_stats.cpp",
"../storage_manager/innerkits_impl/src/disk.cpp",
"../storage_manager/innerkits_impl/src/storage_stats.cpp",
"../storage_manager/innerkits_impl/src/volume_core.cpp",
"../storage_manager/innerkits_impl/src/volume_external.cpp",
"../storage_manager/ipc/src/storage_manager_proxy.cpp",
"disk/src/disk_config.cpp",
"disk/src/disk_info.cpp",
"disk/src/disk_manager.cpp",
@ -98,6 +92,7 @@ ohos_executable("storage_daemon") {
deps = [
":sdc",
":storage_common_utils",
"${storage_interface_path}/innerkits/storage_manager/native:storage_manager_sa_proxy",
"crypto:libsdcrypto",
"libfscrypt:libfscryptutils",
]
@ -139,13 +134,6 @@ config("sdc_config") {
ohos_executable("sdc") {
sources = [
"../storage_manager/client/storage_manager_client.cpp",
"../storage_manager/innerkits_impl/src/bundle_stats.cpp",
"../storage_manager/innerkits_impl/src/disk.cpp",
"../storage_manager/innerkits_impl/src/storage_stats.cpp",
"../storage_manager/innerkits_impl/src/volume_core.cpp",
"../storage_manager/innerkits_impl/src/volume_external.cpp",
"../storage_manager/ipc/src/storage_manager_proxy.cpp",
"client/storage_daemon_client.cpp",
"ipc/src/storage_daemon_proxy.cpp",
"sdc.cpp",
@ -160,6 +148,7 @@ ohos_executable("sdc") {
deps = [
":storage_common_utils",
"${storage_interface_path}/innerkits/storage_manager/native:storage_manager_sa_proxy",
"libfscrypt:libfscryptutils",
]

View File

@ -275,6 +275,7 @@ HWTEST_F(ExternalVolumeInfoTest, Storage_Service_ExternalVolumeInfoTest_GetFsUui
ExternalVolumeInfo *evi = new ExternalVolumeInfo();
std::string ret = evi->GetFsUuid();
GTEST_LOG_(INFO) << ret;
EXPECT_TRUE(ret.empty());
GTEST_LOG_(INFO) << "Storage_Service_ExternalVolumeInfoTest_GetFsUuid_001 end";
}
@ -292,6 +293,7 @@ HWTEST_F(ExternalVolumeInfoTest, Storage_Service_ExternalVolumeInfoTest_GetFsLab
ExternalVolumeInfo *evi = new ExternalVolumeInfo();
std::string ret = evi->GetFsLabel();
GTEST_LOG_(INFO) << ret;
EXPECT_TRUE(ret.empty());
GTEST_LOG_(INFO) << "Storage_Service_ExternalVolumeInfoTest_GetFsLabel_001 end";
}
@ -309,6 +311,7 @@ HWTEST_F(ExternalVolumeInfoTest, Storage_Service_ExternalVolumeInfoTest_GetMount
ExternalVolumeInfo *evi = new ExternalVolumeInfo();
std::string ret = evi->GetMountPath();
GTEST_LOG_(INFO) << ret;
EXPECT_TRUE(ret.empty());
GTEST_LOG_(INFO) << "Storage_Service_ExternalVolumeInfoTest_GetMountPath_001 end";
}

View File

@ -19,7 +19,7 @@
#include "iremote_proxy.h"
#include "istorage_manager.h"
#include "ipc/storage_manager.h"
#include "ipc/storage_manager_proxy.h"
#include "storage_manager_proxy.h"
namespace OHOS {
namespace StorageManager {

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
#include "ipc/storage_manager_proxy.h"
#include "storage_manager_proxy.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"

View File

@ -12,24 +12,25 @@
# limitations under the License.
import("//build/test.gni")
import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni")
ohos_unittest("storage_manager_proxy_test") {
module_out_path = "filemanagement/storage_service/storage_manager"
sources = [
"//foundation/filemanagement/storage_service/services/storage_manager/disk/src/disk_manager_service.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/src/storage_manager_proxy.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/storage_daemon_communication/src/storage_daemon_communication.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/volume/src/notification.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/volume/src/volume_manager_service.cpp",
"${storage_manager_path}/disk/src/disk_manager_service.cpp",
"${storage_manager_path}/innerkits_impl/src/storage_manager_proxy.cpp",
"${storage_manager_path}/storage_daemon_communication/src/storage_daemon_communication.cpp",
"${storage_manager_path}/volume/src/notification.cpp",
"${storage_manager_path}/volume/src/volume_manager_service.cpp",
"storage_manager_proxy_test.cpp",
]
include_dirs = [
"//foundation/filemanagement/storage_service/interfaces/innerkits/storage_manager/native",
"//foundation/filemanagement/storage_service/services/common/include",
"//foundation/filemanagement/storage_service/services/storage_daemon/include",
"//foundation/filemanagement/storage_service/services/storage_manager/include",
"${storage_interface_path}/innerkits/storage_manager/native",
"${storage_service_common_path}/include",
"${storage_daemon_path}/include",
"${storage_manager_path}/include",
"//foundation/filemanagement/storage_service/utils/include",
"include",
"//third_party/googletest/googlemock/include/gmock",
@ -70,25 +71,25 @@ ohos_unittest("storage_manager_stub_test") {
]
include_dirs = [
"//foundation/filemanagement/storage_service/services/storage_manager/client/test",
"//foundation/filemanagement/storage_service/interfaces/innerkits/storage_manager/native",
"//foundation/filemanagement/storage_service/services/storage_manager/include",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/test/",
"//foundation/filemanagement/storage_service/services/common/include",
"${storage_manager_path}/client/test",
"${storage_interface_path}/innerkits/storage_manager/native",
"${storage_manager_path}/include",
"${storage_manager_path}/ipc/test/",
"${storage_service_common_path}/include",
"//foundation/communication/ipc/interfaces/innerkits/libdbinder/include",
"//base/security/access_token/interfaces/innerkits/accesstoken/include",
]
sources = [
"//foundation/filemanagement/storage_service/services/storage_manager/client/test/get_self_permissions.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/bundle_stats.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/disk.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/storage_stats.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/volume_core.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/volume_external.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/src/storage_manager_proxy.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/src/storage_manager_stub.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/test/storage_manager_stub_test.cpp",
"${storage_manager_path}/client/test/get_self_permissions.cpp",
"${storage_manager_path}/innerkits_impl/src/bundle_stats.cpp",
"${storage_manager_path}/innerkits_impl/src/disk.cpp",
"${storage_manager_path}/innerkits_impl/src/storage_manager_proxy.cpp",
"${storage_manager_path}/innerkits_impl/src/storage_stats.cpp",
"${storage_manager_path}/innerkits_impl/src/volume_core.cpp",
"${storage_manager_path}/innerkits_impl/src/volume_external.cpp",
"${storage_manager_path}/ipc/src/storage_manager_stub.cpp",
"${storage_manager_path}/ipc/test/storage_manager_stub_test.cpp",
]
deps = [
@ -123,24 +124,24 @@ ohos_unittest("storage_manager_stub_nonpermission_test") {
]
include_dirs = [
"//foundation/filemanagement/storage_service/services/storage_manager/client/test",
"//foundation/filemanagement/storage_service/interfaces/innerkits/storage_manager/native",
"//foundation/filemanagement/storage_service/services/storage_manager/include",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/test/",
"//foundation/filemanagement/storage_service/services/common/include",
"${storage_manager_path}/client/test",
"${storage_interface_path}/innerkits/storage_manager/native",
"${storage_manager_path}/include",
"${storage_manager_path}/ipc/test/",
"${storage_service_common_path}/include",
"//foundation/communication/ipc/interfaces/innerkits/libdbinder/include",
"//base/security/access_token/interfaces/innerkits/accesstoken/include",
]
sources = [
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/bundle_stats.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/disk.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/storage_stats.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/volume_core.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/innerkits_impl/src/volume_external.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/src/storage_manager_proxy.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/src/storage_manager_stub.cpp",
"//foundation/filemanagement/storage_service/services/storage_manager/ipc/test/storage_manager_stub_noper_test.cpp",
"${storage_manager_path}/innerkits_impl/src/bundle_stats.cpp",
"${storage_manager_path}/innerkits_impl/src/disk.cpp",
"${storage_manager_path}/innerkits_impl/src/storage_manager_proxy.cpp",
"${storage_manager_path}/innerkits_impl/src/storage_stats.cpp",
"${storage_manager_path}/innerkits_impl/src/volume_core.cpp",
"${storage_manager_path}/innerkits_impl/src/volume_external.cpp",
"${storage_manager_path}/ipc/src/storage_manager_stub.cpp",
"${storage_manager_path}/ipc/test/storage_manager_stub_noper_test.cpp",
]
deps = [

View File

@ -16,7 +16,7 @@
#include <cstdio>
#include <gtest/gtest.h>
#include "ipc/storage_manager_proxy.h"
#include "storage_manager_proxy.h"
#include "ipc/storage_manager.h"
#include "ipc_skeleton.h"
#include "iservice_registry.h"
@ -603,7 +603,8 @@ HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyDiskCreated_0000,
auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
auto proxy = iface_cast<IStorageManager>(remote);
proxy->NotifyDiskCreated(disk);
int32_t result = proxy->NotifyDiskCreated(disk);
EXPECT_EQ(result, E_PERMISSION_DENIED);
GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyDiskCreated_0000";
}
@ -623,7 +624,8 @@ HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyDiskDestroyed_0000
auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
auto proxy = iface_cast<IStorageManager>(remote);
proxy->NotifyDiskDestroyed(diskId);
int32_t result = proxy->NotifyDiskDestroyed(diskId);
EXPECT_EQ(result, E_PERMISSION_DENIED);
GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyDiskDestroyed_0000";
}

View File

@ -16,7 +16,7 @@
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "ipc/storage_manager_proxy.h"
#include "storage_manager_proxy.h"
#include "ipc/storage_manager_stub.h"
#include "storage_manager_stub_mock.h"

View File

@ -16,7 +16,7 @@
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "ipc/storage_manager_proxy.h"
#include "storage_manager_proxy.h"
#include "ipc/storage_manager_stub.h"
#include "storage_manager_stub_mock.h"
#include "get_self_permissions.h"

View File

@ -18,8 +18,7 @@
#include <iservice_registry.h>
#include <system_ability_definition.h>
#include "ipc/storage_manager.h"
#include "ipc/storage_manager_proxy.h"
#include "storage_manager_proxy.h"
#include "ipc_skeleton.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"

View File

@ -44,9 +44,14 @@ HWTEST_F(NotificationTest, Notification_NotifyVolumeChange_0000, testing::ext::T
{
GTEST_LOG_(INFO) << "NotificationTest-begin Notification_NotifyVolumeChange_0000";
int32_t notifyCode = VOLUME_REMOVED;
std::shared_ptr<VolumeExternal> volume;
std::string volumeId = "vol-1-1";
int32_t fsType = 1;
std::string diskId = "disk-1-1";
VolumeCore vc(volumeId, fsType, diskId);
std::shared_ptr<VolumeExternal> volume = make_shared<VolumeExternal>(vc);
std::shared_ptr<Notification> notification = DelayedSingleton<Notification>::GetInstance();
notification->NotifyVolumeChange(notifyCode, volume);
EXPECT_EQ(vc.GetDiskId(), diskId);
GTEST_LOG_(INFO) << "NotificationTest-end Notification_NotifyVolumeChange_0000";
}
@ -64,9 +69,14 @@ HWTEST_F(NotificationTest, Notification_NotifyVolumeChange_0001, testing::ext::T
{
GTEST_LOG_(INFO) << "NotificationTestt-begin Notification_NotifyVolumeChange_0001";
int32_t notifyCode = VOLUME_UNMOUNTED;
std::shared_ptr<VolumeExternal> volume;
std::string volumeId = "vol-1-1";
int32_t fsType = 1;
std::string diskId = "disk-1-1";
VolumeCore vc(volumeId, fsType, diskId);
std::shared_ptr<VolumeExternal> volume = make_shared<VolumeExternal>(vc);
std::shared_ptr<Notification> notification = DelayedSingleton<Notification>::GetInstance();
notification->NotifyVolumeChange(notifyCode, volume);
EXPECT_EQ(vc.GetDiskId(), diskId);
GTEST_LOG_(INFO) << "NotificationTest-end Notification_NotifyVolumeChange_0001";
}
@ -84,9 +94,16 @@ HWTEST_F(NotificationTest, Notification_NotifyVolumeChange_0002, testing::ext::T
{
GTEST_LOG_(INFO) << "NotificationTest-begin Notification_NotifyVolumeChange_0002";
int32_t notifyCode = VOLUME_MOUNTED;
std::shared_ptr<VolumeExternal> volume;
std::string volumeId = "vol-1-1";
int32_t fsType = 1;
std::string diskId = "disk-1-1";
VolumeCore vc(volumeId, fsType, diskId);
std::shared_ptr<VolumeExternal> volume = make_shared<VolumeExternal>(vc);
volume->SetFsUuid("uuid1");
volume->SetPath("path1");
std::shared_ptr<Notification> notification = DelayedSingleton<Notification>::GetInstance();
notification->NotifyVolumeChange(notifyCode, volume);
EXPECT_EQ(vc.GetDiskId(), diskId);
GTEST_LOG_(INFO) << "NotificationTest-end Notification_NotifyVolumeChange_0002";
}
@ -104,9 +121,14 @@ HWTEST_F(NotificationTest, Notification_NotifyVolumeChange_0003, testing::ext::T
{
GTEST_LOG_(INFO) << "NotificationTest-begin Notification_NotifyVolumeChange_0003";
int32_t notifyCode = VOLUME_BAD_REMOVAL;
std::shared_ptr<VolumeExternal> volume;
std::string volumeId = "vol-1-1";
int32_t fsType = 1;
std::string diskId = "disk-1-1";
VolumeCore vc(volumeId, fsType, diskId);
std::shared_ptr<VolumeExternal> volume = make_shared<VolumeExternal>(vc);
std::shared_ptr<Notification> notification = DelayedSingleton<Notification>::GetInstance();
notification->NotifyVolumeChange(notifyCode, volume);
EXPECT_EQ(vc.GetDiskId(), diskId);
GTEST_LOG_(INFO) << "NotificationTest-end Notification_NotifyVolumeChange_0003";
}
@ -124,9 +146,14 @@ HWTEST_F(NotificationTest, Notification_NotifyVolumeChange_0004, testing::ext::T
{
GTEST_LOG_(INFO) << "NotificationTest-begin Notification_NotifyVolumeChange_0004";
int32_t notifyCode = VOLUME_EJECT;
std::shared_ptr<VolumeExternal> volume;
std::string volumeId = "vol-1-1";
int32_t fsType = 1;
std::string diskId = "disk-1-1";
VolumeCore vc(volumeId, fsType, diskId);
std::shared_ptr<VolumeExternal> volume = make_shared<VolumeExternal>(vc);
std::shared_ptr<Notification> notification = DelayedSingleton<Notification>::GetInstance();
notification->NotifyVolumeChange(notifyCode, volume);
EXPECT_EQ(vc.GetDiskId(), diskId);
GTEST_LOG_(INFO) << "NotificationTest-end Notification_NotifyVolumeChange_0004";
}
@ -144,9 +171,14 @@ HWTEST_F(NotificationTest, Notification_NotifyVolumeChange_0005, testing::ext::T
{
GTEST_LOG_(INFO) << "NotificationTest-begin Notification_NotifyVolumeChange_0005";
int32_t notifyCode = 5;
std::shared_ptr<VolumeExternal> volume;
std::string volumeId = "vol-1-1";
int32_t fsType = 1;
std::string diskId = "disk-1-1";
VolumeCore vc(volumeId, fsType, diskId);
std::shared_ptr<VolumeExternal> volume = make_shared<VolumeExternal>(vc);
std::shared_ptr<Notification> notification = DelayedSingleton<Notification>::GetInstance();
notification->NotifyVolumeChange(notifyCode, volume);
EXPECT_EQ(vc.GetDiskId(), diskId);
GTEST_LOG_(INFO) << "NotificationTest-end Notification_NotifyVolumeChange_0005";
}
}

View File

@ -162,6 +162,9 @@ HWTEST_F(VolumeManagerServiceTest, Volume_manager_service_OnVolumeCreated_0000,
VolumeCore vc(volumeId, type, diskId);
if (vmService != nullptr) {
vmService->OnVolumeCreated(vc);
VolumeExternal ve;
int32_t res = vmService->GetVolumeById(volumeId, ve);
EXPECT_EQ(res, E_OK);
vmService->OnVolumeDestroyed(volumeId);
}
GTEST_LOG_(INFO) << "VolumeManagerServiceTest-end Volume_manager_service_OnVolumeCreated_0000";
@ -181,13 +184,16 @@ HWTEST_F(VolumeManagerServiceTest, Volume_manager_service_OnVolumeMounted_0000,
GTEST_LOG_(INFO) << "VolumeManagerServiceTest-begin Volume_manager_service_OnVolumeMounted_0000";
std::shared_ptr<VolumeManagerService> vmService =
DelayedSingleton<VolumeManagerService>::GetInstance();
std::string volumeId = "";
std::string volumeId = "vol-1-5";
int32_t fsType = 1;
std::string fsUuid = "";
std::string path = "";
std::string description = "";
if (vmService != nullptr) {
vmService->OnVolumeMounted(volumeId, fsType, fsUuid, path, description);
VolumeExternal ve;
int32_t res = vmService->GetVolumeById(volumeId, ve);
EXPECT_EQ(res, E_NON_EXIST);
}
GTEST_LOG_(INFO) << "VolumeManagerServiceTest-end Volume_manager_service_OnVolumeMounted_0000";
}
@ -206,9 +212,12 @@ HWTEST_F(VolumeManagerServiceTest, Volume_manager_service_OnVolumeDestroyed_0000
GTEST_LOG_(INFO) << "VolumeManagerServiceTest-begin Volume_manager_service_OnVolumeDestroyed_0000";
std::shared_ptr<VolumeManagerService> vmService =
DelayedSingleton<VolumeManagerService>::GetInstance();
std::string volumeId = "";
std::string volumeId = "vol-1-5";
if (vmService != nullptr) {
vmService->OnVolumeDestroyed(volumeId);
VolumeExternal ve;
int32_t res = vmService->GetVolumeById(volumeId, ve);
EXPECT_EQ(res, E_NON_EXIST);
}
GTEST_LOG_(INFO) << "VolumeManagerServiceTest-end Volume_manager_service_OnVolumeDestroyed_0000";
}

View File

@ -22,3 +22,5 @@ storage_daemon_path =
"//foundation/filemanagement/storage_service/services/storage_daemon"
storage_interface_path =
"//foundation/filemanagement/storage_service/interfaces"
storage_service_common_path =
"//foundation/filemanagement/storage_service/services/common"

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
#include "storagemanagerproxy_fuzzer.h"
#include "ipc/storage_manager_proxy.h"
#include "storage_manager_proxy.h"
#include <vector>
using namespace OHOS::StorageManager;