Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
db62b215
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
db62b215
编写于
9月 26, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5673 【beta3-代码上库】【dsoftbus】【ipc新增onRemoteRequestEx接口用例】
Merge pull request !5673 from 杨启博/OpenHarmony-3.2-Beta3
上级
43f5a168
6a6236f6
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
188 addition
and
18 deletion
+188
-18
communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js
...ion/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js
+155
-11
communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js
...dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js
+33
-7
未找到文件。
communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js
100755 → 100644
浏览文件 @
db62b215
...
@@ -70,6 +70,8 @@ describe('ActsRpcClientJsTest', function(){
...
@@ -70,6 +70,8 @@ describe('ActsRpcClientJsTest', function(){
const
CODE_FILESDIR
=
29
;
const
CODE_FILESDIR
=
29
;
const
CODE_WRITE_REMOTEOBJECTARRAY_1
=
30
;
const
CODE_WRITE_REMOTEOBJECTARRAY_1
=
30
;
const
CODE_WRITE_REMOTEOBJECTARRAY_2
=
31
;
const
CODE_WRITE_REMOTEOBJECTARRAY_2
=
31
;
const
CODE_ONREMOTEREQUESTEX_OR_ONREMOTEREQUEST
=
32
;
const
CODE_ONREMOTEREQUESTEX
=
33
;
function
connectAbility
()
{
function
connectAbility
()
{
let
want
=
{
let
want
=
{
...
@@ -5735,22 +5737,18 @@ describe('ActsRpcClientJsTest', function(){
...
@@ -5735,22 +5737,18 @@ describe('ActsRpcClientJsTest', function(){
it
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000
"
,
0
,
async
function
(
done
){
it
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000
"
,
0
,
async
function
(
done
){
console
.
info
(
"
---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15000---------------------------
"
);
console
.
info
(
"
---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15000---------------------------
"
);
try
{
try
{
let
maxsize
=
3
;
let
data
=
rpc
.
MessageParcel
.
create
();
let
data
=
rpc
.
MessageParcel
.
create
();
let
Capacity
=
data
.
getRawDataCapacity
()
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000:run Capacity success, Capacity is
"
+
Capacity
);
let
rawdata
=
[
1
,
2
,
3
];
let
rawdata
=
[
1
,
2
,
3
];
let
option
=
new
rpc
.
MessageOption
();
let
option
=
new
rpc
.
MessageOption
();
let
reply
=
rpc
.
MessageParcel
.
create
();
let
reply
=
rpc
.
MessageParcel
.
create
();
expect
(
data
.
writeInt
(
maxsize
)).
assertTrue
();
expect
(
data
.
writeInt
(
rawdata
.
length
)).
assertTrue
();
let
result
=
data
.
writeRawData
(
rawdata
,
maxsize
);
let
result
=
data
.
writeRawData
(
rawdata
,
rawdata
.
length
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000:run writeRawDatais is
"
+
result
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000:run writeRawDatais is
"
+
result
);
expect
(
result
).
assertTrue
();
expect
(
result
).
assertTrue
();
if
(
gIRemoteObject
==
undefined
){
if
(
gIRemoteObject
==
undefined
){
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000: gIRemoteObject undefined
"
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000: gIRemoteObject undefined
"
);
}
}
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_RAWDATA
,
data
,
reply
,
option
).
then
((
result
)
=>
{
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_RAWDATA
,
data
,
reply
,
option
).
then
((
result
)
=>
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000: result is
"
+
result
.
errCode
);
expect
(
result
.
errCode
==
0
).
assertTrue
();
expect
(
result
.
errCode
==
0
).
assertTrue
();
let
size
=
result
.
reply
.
readInt
();
let
size
=
result
.
reply
.
readInt
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000:run readIntis is
"
+
size
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000:run readIntis is
"
+
size
);
...
@@ -5858,22 +5856,19 @@ describe('ActsRpcClientJsTest', function(){
...
@@ -5858,22 +5856,19 @@ describe('ActsRpcClientJsTest', function(){
it
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400
"
,
0
,
async
function
(
done
){
it
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400
"
,
0
,
async
function
(
done
){
console
.
info
(
"
---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15400---------------------------
"
);
console
.
info
(
"
---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15400---------------------------
"
);
try
{
try
{
let
maxsize
=
3
;
let
data
=
rpc
.
MessageParcel
.
create
();
let
data
=
rpc
.
MessageParcel
.
create
();
let
Capacity
=
data
.
getRawDataCapacity
()
let
Capacity
=
data
.
getRawDataCapacity
()
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400:run Capacity success, Capacity is
"
+
Capacity
);
let
rawdata
=
[
1
,
2
,
3
];
let
rawdata
=
[
1
,
2
,
3
];
let
option
=
new
rpc
.
MessageOption
();
let
option
=
new
rpc
.
MessageOption
();
let
reply
=
rpc
.
MessageParcel
.
create
();
let
reply
=
rpc
.
MessageParcel
.
create
();
expect
(
data
.
writeInt
(
maxsize
)).
assertTrue
();
expect
(
data
.
writeInt
(
rawdata
.
length
)).
assertTrue
();
let
result
=
data
.
writeRawData
(
rawdata
,
maxsize
);
let
result
=
data
.
writeRawData
(
rawdata
,
rawdata
.
length
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400:run writeRawData is
"
+
result
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400:run writeRawData is
"
+
result
);
expect
(
result
).
assertTrue
();
expect
(
result
).
assertTrue
();
if
(
gIRemoteObject
==
undefined
){
if
(
gIRemoteObject
==
undefined
){
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400: gIRemoteObject undefined
"
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400: gIRemoteObject undefined
"
);
}
}
await
gIRemoteObject
.
sendRequestAsync
(
CODE_WRITE_RAWDATA
,
data
,
reply
,
option
).
then
((
result
)
=>
{
await
gIRemoteObject
.
sendRequestAsync
(
CODE_WRITE_RAWDATA
,
data
,
reply
,
option
).
then
((
result
)
=>
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400: sendRequestAsync is
"
+
result
.
errCode
);
expect
(
result
.
errCode
==
0
).
assertTrue
();
expect
(
result
.
errCode
==
0
).
assertTrue
();
let
size
=
result
.
reply
.
readInt
();
let
size
=
result
.
reply
.
readInt
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400:run readInt is
"
+
size
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400:run readInt is
"
+
size
);
...
@@ -5891,6 +5886,155 @@ describe('ActsRpcClientJsTest', function(){
...
@@ -5891,6 +5886,155 @@ describe('ActsRpcClientJsTest', function(){
console
.
info
(
"
---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_15400---------------------------
"
);
console
.
info
(
"
---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_15400---------------------------
"
);
});
});
/*
* @tc.number SUB_Softbus_IPC_Compatility_MessageParcel_15500
* @tc.name Invoke the writestring interface to write data to the messageparcel instance SendRequest Asynchronous
* Authentication onRemoteRequestEx Server Processing
* @tc.desc Function test
* @tc.level 0
*/
it
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15500
"
,
0
,
async
function
(
done
){
console
.
info
(
"
---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15500---------------------------
"
);
try
{
var
data
=
rpc
.
MessageParcel
.
create
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15500: create object successfully.
"
);
var
reply
=
rpc
.
MessageParcel
.
create
();
var
option
=
new
rpc
.
MessageOption
();
var
token
=
'
onRemoteRequestEx invoking
'
;
var
result
=
data
.
writeString
(
token
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15500:run writeStringis is
"
+
result
);
expect
(
result
==
true
).
assertTrue
();
if
(
gIRemoteObject
==
undefined
)
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15500: gIRemoteObject is undefined
"
);
}
await
gIRemoteObject
.
sendRequest
(
CODE_ONREMOTEREQUESTEX
,
data
,
reply
,
option
).
then
((
result
)
=>
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15500: sendRequestis is
"
+
result
.
errCode
);
var
replyReadResult
=
result
.
reply
.
readString
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15500: run readString is
"
+
replyReadResult
);
expect
(
replyReadResult
).
assertEqual
(
token
);
});
data
.
reclaim
();
reply
.
reclaim
();
done
();
}
catch
(
error
)
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15500:error =
"
+
error
);
}
console
.
info
(
"
---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_15500---------------------------
"
);
});
/*
* @tc.number SUB_Softbus_IPC_Compatility_MessageParcel_15600
* @tc.name Invoke the writestring interface to write data to the messageparcel instance sendRequestAsync Asynchronous
* Authentication onRemoteRequestEx Server Processing
* @tc.desc Function test
* @tc.level 0
*/
it
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15600
"
,
0
,
async
function
(
done
){
console
.
info
(
"
---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15600---------------------------
"
);
try
{
var
data
=
rpc
.
MessageParcel
.
create
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15600: create object successfully.
"
);
var
reply
=
rpc
.
MessageParcel
.
create
();
var
option
=
new
rpc
.
MessageOption
();
var
token
=
'
onRemoteRequestEx invoking
'
;
var
result
=
data
.
writeString
(
token
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15600:run writeStringis is
"
+
result
);
expect
(
result
==
true
).
assertTrue
();
if
(
gIRemoteObject
==
undefined
)
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15600: gIRemoteObject is undefined
"
);
}
await
gIRemoteObject
.
sendRequestAsync
(
CODE_ONREMOTEREQUESTEX
,
data
,
reply
,
option
).
then
((
result
)
=>
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15600: sendRequestis is
"
+
result
.
errCode
);
var
replyReadResult
=
result
.
reply
.
readString
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15600: run readString is
"
+
replyReadResult
);
expect
(
replyReadResult
).
assertEqual
(
token
);
});
data
.
reclaim
();
reply
.
reclaim
();
done
();
}
catch
(
error
)
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15600:error =
"
+
error
);
}
console
.
info
(
"
---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_15600---------------------------
"
);
});
/*
* @tc.number SUB_Softbus_IPC_Compatility_MessageParcel_15700
* @tc.name Invoke the writestring interface to write data to the messageparcel instance. SendRequest asynchronously
* verifies the priority processing levels of onRemoteRequestEx and onRemoteRequest
* @tc.desc Function test
* @tc.level 0
*/
it
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15700
"
,
0
,
async
function
(
done
){
console
.
info
(
"
---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15700---------------------------
"
);
try
{
var
data
=
rpc
.
MessageParcel
.
create
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15700: create object successfully.
"
);
var
reply
=
rpc
.
MessageParcel
.
create
();
var
option
=
new
rpc
.
MessageOption
();
var
token
=
"
onRemoteRequest or onRemoteRequestEx invoking
"
;
var
result
=
data
.
writeString
(
token
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15700:run writeStringis is
"
+
result
);
expect
(
result
==
true
).
assertTrue
();
if
(
gIRemoteObject
==
undefined
)
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15700: gIRemoteObject is undefined
"
);
}
await
gIRemoteObject
.
sendRequest
(
CODE_ONREMOTEREQUESTEX_OR_ONREMOTEREQUEST
,
data
,
reply
,
option
).
then
((
result
)
=>
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15700: sendRequestis is
"
+
result
.
errCode
);
var
replyReadResult
=
result
.
reply
.
readString
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15700: run readString is
"
+
replyReadResult
);
expect
(
replyReadResult
).
assertEqual
(
"
onRemoteRequestEx invoking
"
);
});
data
.
reclaim
();
reply
.
reclaim
();
done
();
}
catch
(
error
)
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15700:error =
"
+
error
);
}
console
.
info
(
"
---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_15700---------------------------
"
);
});
/*
* @tc.number SUB_Softbus_IPC_Compatility_MessageParcel_15800
* @tc.name Invoke the writestring interface to write data to the messageparcel instance. sendRequestAsync asynchronously verifies
* the priority processing levels of onRemoteRequestEx and onRemoteRequest
* @tc.desc Function test
* @tc.level 0
*/
it
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15800
"
,
0
,
async
function
(
done
){
console
.
info
(
"
---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15800---------------------------
"
);
try
{
var
data
=
rpc
.
MessageParcel
.
create
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15800: create object successfully.
"
);
var
reply
=
rpc
.
MessageParcel
.
create
();
var
option
=
new
rpc
.
MessageOption
();
var
token
=
'
onRemoteRequest or onRemoteRequestEx invoking
'
;
var
result
=
data
.
writeString
(
token
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15800:run writeStringis is
"
+
result
);
expect
(
result
==
true
).
assertTrue
();
if
(
gIRemoteObject
==
undefined
)
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15800: gIRemoteObject is undefined
"
);
}
await
gIRemoteObject
.
sendRequestAsync
(
CODE_ONREMOTEREQUESTEX_OR_ONREMOTEREQUEST
,
data
,
reply
,
option
).
then
((
result
)
=>
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15800: sendRequestis is
"
+
result
.
errCode
);
var
replyReadResult
=
result
.
reply
.
readString
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15800: run readString is
"
+
replyReadResult
);
expect
(
replyReadResult
).
assertEqual
(
"
onRemoteRequestEx invoking
"
);
});
data
.
reclaim
();
reply
.
reclaim
();
done
();
}
catch
(
error
)
{
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15800:error =
"
+
error
);
}
console
.
info
(
"
---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_15800---------------------------
"
);
});
/*
/*
* @tc.number SUB_Softbus_IPC_Compatility_MessageOption_00100
* @tc.number SUB_Softbus_IPC_Compatility_MessageOption_00100
* @tc.name Basic method of testing messageoption
* @tc.name Basic method of testing messageoption
...
...
communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js
浏览文件 @
db62b215
...
@@ -67,8 +67,28 @@ class Stub extends rpc.RemoteObject {
...
@@ -67,8 +67,28 @@ class Stub extends rpc.RemoteObject {
onRemoteRequest
(
code
,
data
,
reply
,
option
)
{
onRemoteRequest
(
code
,
data
,
reply
,
option
)
{
try
{
try
{
console
.
info
(
"
onRemoteRequest:
"
+
code
)
console
.
info
(
"
onRemoteRequest:
"
+
code
)
console
.
info
(
"
-----------------syhsyhsysh:
"
+
code
)
if
(
code
===
32
){
console
.
info
(
"
case 32 start
"
)
let
tmp1
=
data
.
readString
()
let
result
=
reply
.
writeString
(
"
onRemoteRequest invoking
"
)
return
true
}
else
if
(
code
===
33
){
console
.
info
(
"
case 33 start
"
)
let
tmp1
=
data
.
readString
()
let
result
=
reply
.
writeString
(
tmp1
)
return
true
}
else
{
console
.
error
(
"
default case
"
+
code
)
return
super
.
onRemoteRequest
(
code
,
data
,
reply
,
option
)
}
}
catch
(
error
)
{
console
.
info
(
"
onRemoteRequest:
"
+
error
);
}
return
false
}
onRemoteRequestEx
(
code
,
data
,
reply
,
option
)
{
try
{
console
.
info
(
"
onRemoteRequestEx:
"
+
code
)
switch
(
code
)
{
switch
(
code
)
{
case
1
:
case
1
:
{
{
...
@@ -460,12 +480,18 @@ class Stub extends rpc.RemoteObject {
...
@@ -460,12 +480,18 @@ class Stub extends rpc.RemoteObject {
reply
.
writeNoException
()
reply
.
writeNoException
()
return
true
return
true
}
}
case
32
:
{
console
.
info
(
"
case 32 start
"
)
let
tmp1
=
data
.
readString
()
let
result
=
reply
.
writeString
(
"
onRemoteRequestEx invoking
"
)
return
true
}
default
:
default
:
console
.
error
(
"
default case
"
+
code
)
this
.
onRemoteRequest
(
code
,
data
,
reply
,
option
)
return
super
.
onRemoteRequest
(
code
,
data
,
reply
,
option
)
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
"
onRemoteRequest:
"
+
error
);
console
.
info
(
"
onRemoteRequest
Ex
:
"
+
error
);
}
}
return
false
return
false
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录