!711 【distributedhardware】【master】分布式设备新增验证deviceID用例维护

Merge pull request !711 from bjliang/master
This commit is contained in:
openharmony_ci 2024-09-20 09:00:06 +00:00 committed by Gitee
commit 5753edfe69
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
15 changed files with 75 additions and 15 deletions

View File

@ -1,4 +1,4 @@
# Copyright (C) 2023 Huawei Device Co., Ltd.
# Copyright (C) 2023-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2022-2023 - 2024 Huawei Device Co., Ltd.
# Copyright (c) 2022-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Copyright (C) 2022-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Copyright (C) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -1492,5 +1492,65 @@ export default function distributedDeviceManager() {
await sleep(1000);
console.info("-----------------SUB_DH_DeviceManager_Dcts_4300 end------------------------");
})
/*
* @tc.number SUB_DH_DeviceManager_Dcts_4400
* @tc.name To manage devices, you must first call this method to obtain a {@code DeviceManager} instance and then
* use this instance to call other device management methods, verification deviceID.
* @tc.desc Function test
* @tc.size MediumTest
* @tc.type: Function
* @tc.level Level1
*/
it("SUB_DH_DeviceManager_Dcts_4400", 0, async function (done) {
console.info("-----------------SUB_DH_DeviceManager_Dcts_4400 start------------------------");
let dmDeviceId = null;
let bindParam = {
"bindType" : 1,
"targetPkgName" : "com.ohos.distributedDeviceManager",
"appName" : "SubDctsdisDeviceJsTest",
"appOperation": "想要连接本机。",
"customDescription": "device manager"
};
try {
dmInstance = deviceManager.createDeviceManager("com.ohos.distributedscreenjstest");
if (!dmInstance) {
console.error("SUB_DH_DeviceManager_Dcts_4400 createDeviceManager errCode:" + err.code + ",errMessage:" + err.message);
expect(false).assertFail();
done();
}
console.info("SUB_DH_DeviceManager_Dcts_4400 createDeviceManager success");
dmDeviceInfo = dmInstance.getAvailableDeviceListSync();
if (dmDeviceInfo === null) {
console.log('SUB_DH_DeviceManager_Dcts_4400 getAvailableDeviceListSync info fail');
expect(false).assertFail();
done();
}
console.log('SUB_DH_DeviceManager_Dcts_4400 getAvailableDeviceListSync info:' + JSON.stringify(dmDeviceInfo[0]["deviceId"]));
dmDeviceId = dmDeviceInfo[0]["deviceId"];
console.log('SUB_DH_DeviceManager_Dcts_4400 dmDeviceId info:' + JSON.stringify(dmDeviceId));
dmInstance.bindTarget(dmDeviceId, bindParam, (err, data) => {
if (err) {
console.error('SUB_DH_DeviceManager_Dcts_4400 bindTarget errCode:' + err.code + ',errMessage:' + err.message);
expect(false).assertFail();
done();
}
console.info('SUB_DH_DeviceManager_Dcts_4400 bindTarget result:' + JSON.stringify(data));
});
console.info("SUB_DH_DeviceManager_Dcts_4400 bindTarget success");
deviceManager.releaseDeviceManager(dmInstance);
console.info("SUB_DH_DeviceManager_Dcts_4400 releaseDeviceManager success");
expect(dmInstance !== null).assertTrue();
done();
} catch(err) {
console.error("SUB_DH_DeviceManager_Dcts_4400 createDeviceManager errCode:" + err.code + ",errMessage:" + err.message);
expect(false).assertFail();
done();
}
await sleep(1000);
console.info("-----------------SUB_DH_DeviceManager_Dcts_4400 end------------------------");
})
})
}