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(){
const
CODE_FILESDIR
=
29
;
const
CODE_WRITE_REMOTEOBJECTARRAY_1
=
30
;
const
CODE_WRITE_REMOTEOBJECTARRAY_2
=
31
;
const
CODE_ONREMOTEREQUESTEX_OR_ONREMOTEREQUEST
=
32
;
const
CODE_ONREMOTEREQUESTEX
=
33
;
function
connectAbility
()
{
let
want
=
{
...
...
@@ -5735,22 +5737,18 @@ describe('ActsRpcClientJsTest', function(){
it
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000
"
,
0
,
async
function
(
done
){
console
.
info
(
"
---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15000---------------------------
"
);
try
{
let
maxsize
=
3
;
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
option
=
new
rpc
.
MessageOption
();
let
reply
=
rpc
.
MessageParcel
.
create
();
expect
(
data
.
writeInt
(
maxsize
)).
assertTrue
();
let
result
=
data
.
writeRawData
(
rawdata
,
maxsize
);
expect
(
data
.
writeInt
(
rawdata
.
length
)).
assertTrue
();
let
result
=
data
.
writeRawData
(
rawdata
,
rawdata
.
length
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000:run writeRawDatais is
"
+
result
);
expect
(
result
).
assertTrue
();
if
(
gIRemoteObject
==
undefined
){
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000: gIRemoteObject undefined
"
);
}
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
();
let
size
=
result
.
reply
.
readInt
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15000:run readIntis is
"
+
size
);
...
...
@@ -5858,22 +5856,19 @@ describe('ActsRpcClientJsTest', function(){
it
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400
"
,
0
,
async
function
(
done
){
console
.
info
(
"
---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15400---------------------------
"
);
try
{
let
maxsize
=
3
;
let
data
=
rpc
.
MessageParcel
.
create
();
let
Capacity
=
data
.
getRawDataCapacity
()
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400:run Capacity success, Capacity is
"
+
Capacity
);
let
rawdata
=
[
1
,
2
,
3
];
let
option
=
new
rpc
.
MessageOption
();
let
reply
=
rpc
.
MessageParcel
.
create
();
expect
(
data
.
writeInt
(
maxsize
)).
assertTrue
();
let
result
=
data
.
writeRawData
(
rawdata
,
maxsize
);
expect
(
data
.
writeInt
(
rawdata
.
length
)).
assertTrue
();
let
result
=
data
.
writeRawData
(
rawdata
,
rawdata
.
length
);
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400:run writeRawData is
"
+
result
);
expect
(
result
).
assertTrue
();
if
(
gIRemoteObject
==
undefined
){
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400: gIRemoteObject undefined
"
);
}
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
();
let
size
=
result
.
reply
.
readInt
();
console
.
info
(
"
SUB_Softbus_IPC_Compatility_MessageParcel_15400:run readInt is
"
+
size
);
...
...
@@ -5890,7 +5885,156 @@ describe('ActsRpcClientJsTest', function(){
done
();
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.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 {
onRemoteRequest
(
code
,
data
,
reply
,
option
)
{
try
{
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
)
{
case
1
:
{
...
...
@@ -210,7 +230,7 @@ class Stub extends rpc.RemoteObject {
{
console
.
info
(
"
case 17 start
"
)
var
s
=
[
new
MySequenceable
(
null
,
null
),
new
MySequenceable
(
null
,
null
),
new
MySequenceable
(
null
,
null
)];
new
MySequenceable
(
null
,
null
)];
data
.
readSequenceableArray
(
s
);
let
result
=
reply
.
writeSequenceableArray
(
s
);
return
true
...
...
@@ -286,7 +306,7 @@ class Stub extends rpc.RemoteObject {
let
tmp8
=
data
.
readCharArray
()
let
tmp9
=
data
.
readStringArray
()
let
s
=
[
new
MySequenceable
(
null
,
null
),
new
MySequenceable
(
null
,
null
),
new
MySequenceable
(
null
,
null
)]
new
MySequenceable
(
null
,
null
)]
let
tmp10
=
data
.
readSequenceableArray
(
s
)
let
result1
=
reply
.
writeByteArray
(
tmp1
)
let
result2
=
reply
.
writeShortArray
(
tmp2
)
...
...
@@ -460,12 +480,18 @@ class Stub extends rpc.RemoteObject {
reply
.
writeNoException
()
return
true
}
case
32
:
{
console
.
info
(
"
case 32 start
"
)
let
tmp1
=
data
.
readString
()
let
result
=
reply
.
writeString
(
"
onRemoteRequestEx invoking
"
)
return
true
}
default
:
console
.
error
(
"
default case
"
+
code
)
return
super
.
onRemoteRequest
(
code
,
data
,
reply
,
option
)
this
.
onRemoteRequest
(
code
,
data
,
reply
,
option
)
}
}
catch
(
error
)
{
console
.
info
(
"
onRemoteRequest:
"
+
error
);
console
.
info
(
"
onRemoteRequest
Ex
:
"
+
error
);
}
return
false
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录