Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
02f5c7ec
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看板
未验证
提交
02f5c7ec
编写于
11月 04, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6346 【ipc】跨应用connectability接口权限限制,服务端权限失败用例修改
Merge pull request !6346 from 杨启博/master
上级
cde60290
0a32ceac
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
515 addition
and
992 deletion
+515
-992
communication/BUILD.gn
communication/BUILD.gn
+0
-1
communication/dsoftbus/rpc/Test.json
communication/dsoftbus/rpc/Test.json
+1
-2
communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js
...ion/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js
+514
-166
communication/dsoftbus/rpc_server/BUILD.gn
communication/dsoftbus/rpc_server/BUILD.gn
+0
-34
communication/dsoftbus/rpc_server/Test.json
communication/dsoftbus/rpc_server/Test.json
+0
-20
communication/dsoftbus/rpc_server/signature/openharmony_sx.p7b
...nication/dsoftbus/rpc_server/signature/openharmony_sx.p7b
+0
-0
communication/dsoftbus/rpc_server/src/main/config.json
communication/dsoftbus/rpc_server/src/main/config.json
+0
-91
communication/dsoftbus/rpc_server/src/main/js/MainAbility/app.js
...cation/dsoftbus/rpc_server/src/main/js/MainAbility/app.js
+0
-23
communication/dsoftbus/rpc_server/src/main/js/MainAbility/i18n/en-US.json
...oftbus/rpc_server/src/main/js/MainAbility/i18n/en-US.json
+0
-11
communication/dsoftbus/rpc_server/src/main/js/MainAbility/i18n/zh-CN.json
...oftbus/rpc_server/src/main/js/MainAbility/i18n/zh-CN.json
+0
-11
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.css
.../rpc_server/src/main/js/MainAbility/pages/index/index.css
+0
-24
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.hml
.../rpc_server/src/main/js/MainAbility/pages/index/index.hml
+0
-6
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.js
...s/rpc_server/src/main/js/MainAbility/pages/index/index.js
+0
-32
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.css
...pc_server/src/main/js/MainAbility/pages/second/second.css
+0
-24
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.hml
...pc_server/src/main/js/MainAbility/pages/second/second.hml
+0
-6
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.js
...rpc_server/src/main/js/MainAbility/pages/second/second.js
+0
-27
communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js
...dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js
+0
-498
communication/dsoftbus/rpc_server/src/main/resources/base/element/string.json
...us/rpc_server/src/main/resources/base/element/string.json
+0
-16
communication/dsoftbus/rpc_server/src/main/resources/base/media/icon.png
...softbus/rpc_server/src/main/resources/base/media/icon.png
+0
-0
未找到文件。
communication/BUILD.gn
浏览文件 @
02f5c7ec
...
...
@@ -21,7 +21,6 @@ group("communication") {
"bluetooth_profile:ActsBluetoothProFileJsTest",
"bluetooth_standard:ActsBluetoothJsTest",
"dsoftbus/rpc:ActsRpcJsTest",
"dsoftbus/rpc_server:ActsRpcJsServer",
"nfc_Controller:ActsNFCJSTest",
"wifi_p2p:ActsP2PJSTest",
"wifi_standard:ActsWifiJSTest",
...
...
communication/dsoftbus/rpc/Test.json
浏览文件 @
02f5c7ec
...
...
@@ -12,8 +12,7 @@
"kits"
:
[
{
"test-file-name"
:
[
"ActsRpcHapTest.hap"
,
"ActsRpcHapServer.hap"
"ActsRpcHapTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
...
...
communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js
浏览文件 @
02f5c7ec
...
...
@@ -17,12 +17,15 @@ import rpc from '@ohos.rpc'
import fileio from '@ohos.fileio';
import FA from '@ohos.ability.featureAbility'
import {describe, expect, beforeAll, it} from 'deccjsunit/index'
var gIRemoteObject = null;
export default function actsRpcClientJsTest() {
var gIRemoteObject = undefined;
describe('ActsRpcClientJsTest', function(){
console.info("-----------------------SUB_Softbus_IPC_Compatibility_MessageParce_Test is starting-----------------------");
beforeAll(async function () {
console.info('beforeAll called')
gIRemoteObject = new Stub("rpcTestAbility");
return gIRemoteObject;
});
beforeEach(async function (){
console.info('beforeEach called');
...
...
@@ -73,87 +76,6 @@ export default function actsRpcClientJsTest() {
const CODE_ONREMOTEMESSAGE_OR_ONREMOTE = 32;
const CODE_ONREMOTEMESSAGEREQUEST = 33;
const ErrorCode = {
/* Check param failed */
CHECK_PARAM_ERROR:401,
/* Os mmap function failed */
OS_MMAP_ERROR:1900001,
/* Os ioctl function failed */
OS_IOCTL_ERROR:1900002,
/* Write to ashmem failed */
WRITE_TO_ASHMEM_ERROR:1900003,
/* Read from ashmem failed */
READ_FROM_ASHMEM_ERROR:1900004,
/* Only proxy object permitted */
ONLY_PROXY_OBJECT_PERMITTED_ERROR:1900005,
/* Only remote object permitted */
ONLY_REMOTE_OBJECT_PERMITTED_ERROR:1900006,
/* Communication failed */
COMMUNICATION_ERROR:1900007,
/* Proxy or remote object is invalid */
PROXY_OR_REMOTE_OBJECT_INVALID_ERROR:1900008,
/* Write data to message sequence failed */
WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR:1900009,
/* Read data from message sequence failed */
READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR:1900010,
/* Parcel memory alloc failed */
PARCEL_MEMORY_ALLOC_ERROR:1900011,
/* Call js method failed */
CALL_JS_METHOD_ERROR:1900012,
/* Os dup function failed */
OS_DUP_ERROR:1900013
}
function connectAbility() {
let want = {
"bundleName":"ohos.rpc.test.server",
"abilityName": "ohos.rpc.test.server.ServiceAbility",
};
let connect = {
onConnect:function (elementName, remoteProxy) {
console.info('RpcClient: onConnect called, instance of proxy: '
+ (remoteProxy instanceof rpc.RemoteProxy))
gIRemoteObject = remoteProxy
},
onDisconnect:function (elementName) {
console.info("RpcClient: onDisconnect")
},
onFailed:function () {
console.info("RpcClient: onFailed")
gIRemoteObject = null
}
};
FA.connectAbility(want, connect)
try {
let descriptor = gIRemoteObject.getDescriptor();
console.info("RpcClient: descriptor is " + descriptor);
} catch(error) {
console.info("rpc get interface descriptor fail, errorCode " + error.code);
console.info("rpc get interface descriptor fail, errorMessage " + error.message);
}
return new Promise((resolve, reject) =>{
console.info("start connect local ability, wait 5 seconds")
setTimeout(()=>{
console.info("resolve proxy: " + gIRemoteObject)
resolve(gIRemoteObject)
}, 5000)
})
}
function sleep(numberMillis)
{
var now = new Date();
...
...
@@ -218,6 +140,444 @@ export default function actsRpcClientJsTest() {
}
}
class Stub extends rpc.RemoteObject {
constructor(descriptor) {
super(descriptor);
}
onRemoteRequest(code, data, reply, option) {
try{
console.info("onRemoteRequest: " + 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
}
onRemoteMessageRequest(code, data, reply, option) {
try{
console.info("onRemoteMessageRequest: " + code)
switch(code) {
case 1:
{
console.info("case 1 start")
let tmp1 = data.readByteArray()
let result = reply.writeByteArray(tmp1)
return true
}
case 2:
{
console.info("case 2 start")
let tmp1 = data.readIntArray()
let result = reply.writeIntArray(tmp1)
return true
}
case 3:
{
console.info("case 3 start")
let tmp1 = data.readFloatArray()
let result = reply.writeFloatArray(tmp1)
return true
}
case 4:
{
console.info("case 4 start")
let tmp1 = data.readShort()
let result = reply.writeShort(tmp1)
return true
}
case 5:
{
console.info("case 5 start")
let tmp1 = data.readLong()
let result = reply.writeLong(tmp1)
return true
}
case 6:
{
console.info("case 6 start")
let tmp1 = data.readDouble()
let result = reply.writeDouble(tmp1)
return true
}
case 7:
{
console.info("case 7 start")
let tmp1 = data.readBoolean()
let result = reply.writeBoolean(tmp1)
return true
}
case 8:
{
console.info("case 8 start")
let tmp1 = data.readChar()
let result = reply.writeChar(tmp1)
return true
}
case 9:
{
console.info("case 9 start")
let tmp1 = data.readString()
let result = reply.writeString(tmp1)
return true
}
case 10:
{
console.info("case 10 start")
let tmp1 = data.readByte()
let result = reply.writeByte(tmp1)
return true
}
case 11:
{
console.info("case 11 start")
let tmp1 = data.readInt()
let result = reply.writeInt(tmp1)
return true
}
case 12:
{
console.info("case 12 start")
let tmp1 = data.readFloat()
let result = reply.writeFloat(tmp1)
return true
}
case 13:
{
console.info("case 13 start")
var size = data .readInt();
let tmp1 = data.readRawData(size);
let size1 = reply.writeInt(size);
let result = reply.writeRawData(tmp1, tmp.length)
return true
}
case 14:
{
console.info("case 14 start")
let listener = data.readRemoteObject();
let num = data.readInt()
let str = data.readString()
let option2 = new rpc.MessageOption()
let data2 = rpc.MessageParcel.create()
let reply2 = rpc.MessageParcel.create()
data2.writeInt(num)
data2.writeString(str)
listener.sendRequest(1, data2, reply2, option2)
.then(function(result) {
console.info("14 send request done, error code: " + result.errCode )
})
.catch(function(e) {
console.error("14 send request got exception: " + e)
})
.finally(() => {
data2.reclaim()
reply2.reclaim()
console.info("case 14 test done")
})
reply.writeNoException()
return true
}
case 15:
{
console.info("case 15 start")
let s = new MySequenceable(null, null)
var tmp1 = data.readParcelable(s)
let result = reply.writeParcelable(s)
return true
}
case 16:
{
console.info("case 16 start")
data.readException()
var tmp = data.readInt();
reply.writeNoException()
var result = reply.writeInt(tmp);
return true
}
case 17:
{
console.info("case 17 start")
var s = [new MySequenceable(null, null), new MySequenceable(null, null),
new MySequenceable(null, null)];
data.readParcelableArray(s);
let result = reply.writeParcelableArray(s);
return true
}
case 18:
{
console.info("case 18 start")
let listeners = data.readRemoteObjectArray();
for (let i = 0; i < listeners.length; i++) {
let option2 = new rpc.MessageOption()
let data2 = rpc.MessageParcel.create()
let reply2 = rpc.MessageParcel.create()
listeners[i].sendRequest(1, data2, reply2, option2)
.then(function(result) {
console.info("18 send request done, error code: " + result.errCode + ", index: " + i)
})
.catch(function(e) {
console.error("18 send request got exception: " + e)
})
.finally(() => {
data2.reclaim()
reply2.reclaim()
console.info("case 18 test done")
})
}
console.info("18 The server's writeRemoteObjectArray result is " + result);
return true
}
case 19:
{
console.info("case 19 start")
let tmp1 = data.readDoubleArray()
let result = reply.writeDoubleArray(tmp1)
return true
}
case 20:
{
console.info("case 20 start")
let tmp1 = data.readByte()
let tmp2 = data.readShort()
let tmp3 = data.readInt()
let tmp4 = data.readLong()
let tmp5 = data.readFloat()
let tmp6 = data.readDouble()
let tmp7 = data.readBoolean()
let tmp8 = data.readChar()
let tmp9 = data.readString()
let s = new MySequenceable(null, null)
let tmp10 = data.readParcelable(s)
let result1 = reply.writeByte(tmp1)
let result2 = reply.writeShort(tmp2)
let result3 = reply.writeInt(tmp3)
let result4 = reply.writeLong(tmp4)
let result5 = reply.writeFloat(tmp5)
let result6 = reply.writeDouble(tmp6)
let result7 = reply.writeBoolean(tmp7)
let result8 = reply.writeChar(tmp8)
let result9 = reply.writeString(tmp9)
let result10 = reply.writeParcelable(s)
return true
}
case 21:
{
console.info("case 21 start")
let tmp1 = data.readByteArray()
let tmp2 = data.readShortArray()
let tmp3 = data.readIntArray()
let tmp4 = data.readLongArray()
let tmp5 = data.readFloatArray()
let tmp6 = data.readDoubleArray()
let tmp7 = data.readBooleanArray()
let tmp8 = data.readCharArray()
let tmp9 = data.readStringArray()
let s = [new MySequenceable(null, null), new MySequenceable(null, null),
new MySequenceable(null, null)]
let tmp10 = data.readParcelableArray(s)
let result1 = reply.writeByteArray(tmp1)
let result2 = reply.writeShortArray(tmp2)
let result3 = reply.writeIntArray(tmp3)
let result4 = reply.writeLongArray(tmp4)
let result5 = reply.writeFloatArray(tmp5)
let result6 = reply.writeDoubleArray(tmp6)
let result7 = reply.writeBooleanArray(tmp7)
let result8 = reply.writeCharArray(tmp8)
let result9 = reply.writeStringArray(tmp9)
let result10 = reply.writeParcelableArray(s)
return true
}
case 22:
{
console.info("case 22 start")
let callingPid = rpc.IPCSkeleton.getCallingPid()
let callingUid = rpc.IPCSkeleton.getCallingUid()
reply.writeNoException()
reply.writeInt(callingPid)
reply.writeInt(callingUid)
reply.writeInt(this.getCallingPid())
reply.writeInt(this.getCallingUid())
let id = rpc.IPCSkeleton.resetCallingIdentity()
rpc.IPCSkeleton.setCallingIdentity(id)
reply.writeInt(rpc.IPCSkeleton.getCallingPid())
reply.writeInt(rpc.IPCSkeleton.getCallingUid())
reply.writeInt(rpc.IPCSkeleton.flushCommands(this))
return true
}
case 23:
{
console.info("case 23 start")
let s = new MySequenceable(null, null);
var tmp1 = data.readParcelable(s);
var result = reply.writeParcelable(s);
return true
}
case 24:
{
console.info("case 24 start")
var tmp1 = data.readShort();
var tmp2 = data.readShort();
var tmp3 = data.readShort();
var tmp4 = data.readShort();
var tmp5 = data.readShort();
var result1 = reply.writeShort(tmp1);
var result2 = reply.writeShort(tmp2);
var result3 = reply.writeShort(tmp3);
var result4 = reply.writeShort(tmp4);
var result5 = reply.writeShort(tmp5);
return true
}
case 25:
{
console.info("case 25 start")
var tmp1 = data.readByte();
var tmp2 = data.readByte();
var tmp3 = data.readByte();
var tmp4 = data.readByte();
var tmp5 = data.readByte();
var result1 = reply.writeByte(tmp1);
var result2 = reply.writeByte(tmp2);
var result3 = reply.writeByte(tmp3);
var result4 = reply.writeByte(tmp4);
var result5 = reply.writeByte(tmp5);
return true
}
case 26:
{
console.info("case 26 start")
var tmp1 = data.readInt();
var tmp2 = data.readInt();
var tmp3 = data.readInt();
var tmp4 = data.readInt();
var tmp5 = data.readInt();
var result1 = reply.writeInt(tmp1);
var result2 = reply.writeInt(tmp2);
var result3 = reply.writeInt(tmp3);
var result4 = reply.writeInt(tmp4);
var result5 = reply.writeInt(tmp5);
return true
}
case 28:
{
console.info("case 28 start")
let callingPid = rpc.IPCSkeleton.getCallingPid()
let callingUid = rpc.IPCSkeleton.getCallingUid()
let callingDeviceID = rpc.IPCSkeleton.getCallingDeviceID()
let localDeviceID = rpc.IPCSkeleton.getLocalDeviceID()
let isLocalCalling = rpc.IPCSkeleton.isLocalCalling()
reply.writeNoException()
reply.writeInt(callingPid)
reply.writeInt(callingUid)
reply.writeString(callingDeviceID)
reply.writeString(localDeviceID)
reply.writeBoolean(isLocalCalling)
reply.writeInt(this.getCallingPid())
reply.writeInt(this.getCallingUid())
let id = rpc.IPCSkeleton.resetCallingIdentity()
rpc.IPCSkeleton.setCallingIdentity(id)
reply.writeInt(rpc.IPCSkeleton.getCallingPid())
reply.writeInt(rpc.IPCSkeleton.getCallingUid())
reply.writeInt(rpc.IPCSkeleton.flushCommands(this))
return true
}
case 29:
{
console.info("case 29 starts")
let bytesWr = data.readInt()
let fd = data.readFileDescriptor()
let writeFileResult = fileio.writeSync(fd, "HELLO RPC", {position: bytesWr + 1});
rpc.MessageParcel.closeFileDescriptor(fd)
return true
}
case 30:
{
console.info("case 30 start")
let listeners = data.readRemoteObjectArray();
let num = data.readInt()
let str = data.readString()
for (let i = 0; i < listeners.length; i++) {
let option2 = new rpc.MessageOption()
let data2 = rpc.MessageParcel.create()
let reply2 = rpc.MessageParcel.create()
data2.writeInt(num)
data2.writeString(str)
listeners[i].sendRequest(1, data2, reply2, option2)
.then(function(result) {
console.info("30 send request done, error code: " + result.errCode + ", index: " + i)
})
.catch(function(e) {
console.error("30 send request got exception: " + e)
})
.finally(() => {
data2.reclaim()
reply2.reclaim()
console.info("case 30 test done")
})
}
reply.writeNoException()
return true
}
case 31:
{
console.info("case 31 start")
let listeners = data.readRemoteObjectArray();
let num = data.readInt()
let str = data.readString()
console.info("31 num: " + num);
console.info("31 str: " + str);
for (let i = 0; i < listeners.length; i++) {
let option2 = new rpc.MessageOption()
let data2 = rpc.MessageParcel.create()
let reply2 = rpc.MessageParcel.create()
data2.writeInt(num)
data2.writeString(str)
listeners[i].sendRequest(1, data2, reply2, option2)
.then(function(result) {
console.info("31 send request done, error code: " + result.errCode + ", index: " + i)
})
.catch(function(e) {
console.error("31 send request got exception: " + e)
})
.finally(() => {
data2.reclaim()
reply2.reclaim()
console.info("case 31 test done")
})
}
reply.writeNoException()
return true
}
case 32:
{
console.info("case 32 start")
let tmp1 = data.readString()
let result = reply.writeString("onRemoteMessageRequest invoking")
return true
}
default:
this.onRemoteRequest(code, data, reply, option)
}
} catch (error) {
console.info("onRemoteMessageRequest: " + error);
}
return false
}
}
class TestAbilityStub extends rpc.RemoteObject {
constructor(descriptor) {
super(descriptor)
...
...
@@ -270,7 +630,6 @@ export default function actsRpcClientJsTest() {
constructor(descriptor) {
super(descriptor)
}
onRemoteMessageRequest(code, data, reply, option) {
console.info("TestAbilityMessageStub: onRemoteMessageRequest called, code: " + code)
let descriptor = data.readInterfaceToken()
...
...
@@ -361,17 +720,6 @@ export default function actsRpcClientJsTest() {
}
}
beforeAll(async function (done) {
console.info('beforeAll called')
await connectAbility().then((remote) => {
console.info("got remote proxy: " + remote)
}).catch((err) => {
console.info("got exception: " + err)
})
done()
console.info("beforeAll done")
})
/*
* @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_00100
* @tc.name Call the writeinterfacetoken interface, write the interface descriptor, and read interfacetoken
...
...
@@ -5079,7 +5427,7 @@ export default function actsRpcClientJsTest() {
data.reclaim()
reply.reclaim()
console.info("test done")
done();
} catch(error) {
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13000: error = " + error);
}
...
...
@@ -5105,7 +5453,6 @@ export default function actsRpcClientJsTest() {
done()
}
}
try{
let option = new rpc.MessageOption()
let data = rpc.MessageParcel.create()
...
...
@@ -5121,26 +5468,26 @@ export default function actsRpcClientJsTest() {
expect(data.writeString("rpcListenerTest")).assertTrue()
await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY_2, data, reply, option)
.then((result)=> {
console.info("
sendRequest done,
error code: " + result.errCode)
console.info("
SUB_Softbus_IPC_Compatibility_MessageParcel_13100
error code: " + result.errCode)
expect(result.errCode).assertEqual(0)
result.reply.readException()
})
data.reclaim()
reply.reclaim()
console.info("test done")
} catch(error) {
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13100: error = " + error);
}
done();
console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13100---------------------------");
})
/*
* @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13200
* @tc.name Invoke the rewindRead interface, write the POS, and read the offset value
* @tc.desc Function test
* @tc.level 0
*/
* @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13200
* @tc.name Invoke the rewindRead interface, write the POS, and read the offset value
* @tc.desc Function test
* @tc.level 0
*/
it("SUB_Softbus_IPC_Compatibility_MessageParcel_13200", 0, async function(done){
console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13200---------------------------");
try{
...
...
@@ -5311,7 +5658,7 @@ export default function actsRpcClientJsTest() {
expect(result.errCode == 0).assertTrue();
let getMePaCapacity = result.reply.getCapacity();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600:run getCapacityis is " + getMePaCapacity);
expect(getMePaCapacity).assertEqual(
("constant".length * 2) +
8);
expect(getMePaCapacity).assertEqual(
"constant".length *
8);
expect(result.reply.readString()).assertEqual("constant");
});
data.reclaim();
...
...
@@ -5350,7 +5697,7 @@ export default function actsRpcClientJsTest() {
expect(result.reply.readString()).assertEqual("constant");
let getMeCa = result.reply.getCapacity();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13700:run getCapacityis is " + getMeCa);
expect(getMeCa).assertEqual(
("constant".length * 2) +
8);
expect(getMeCa).assertEqual(
"constant".length *
8);
});
data.reclaim();
reply.reclaim();
...
...
@@ -5425,7 +5772,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13900:run getSizeis is " + getSizeresult);
let setCapacityresult = result.reply.getCapacity();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13900:run getCapacityis is " + setCapacityresult);
expect(setCapacityresult).assertEqual(
("constant".length * 2) +
8);
expect(setCapacityresult).assertEqual(
"constant".length *
8);
});
data.reclaim();
reply.reclaim();
...
...
@@ -6020,7 +6367,7 @@ export default function actsRpcClientJsTest() {
{
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: gIRemoteObject is undefined");
}
await gIRemoteObject.sendRequest(CODE_
ONREMOTEMESSAGEREQUEST
, data, reply, option).then((result) => {
await gIRemoteObject.sendRequest(CODE_
WRITE_STRING
, data, reply, option).then((result) => {
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: sendRequestis is " + result.errCode);
var replyReadResult = result.reply.readString();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: run readString is " + replyReadResult);
...
...
@@ -6050,13 +6397,13 @@ export default function actsRpcClientJsTest() {
var reply = rpc.MessageSequence.create();
var option = new rpc.MessageOption();
var token = 'onRemoteMessageRequest invoking';
var result =
data.writeString(token);
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600:run writeStringis is
" + result
);
data.writeString(token);
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600:run writeStringis is
success"
);
if (gIRemoteObject == undefined)
{
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600: gIRemoteObject is undefined");
}
await gIRemoteObject.sendMessageRequest(CODE_
ONREMOTEMESSAGEREQUEST
, data, reply, option).then((result) => {
await gIRemoteObject.sendMessageRequest(CODE_
WRITE_STRING
, data, reply, option).then((result) => {
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600: sendRequestis is " + result.errCode);
var replyReadResult = result.reply.readString();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600: run readString is " + replyReadResult);
...
...
@@ -6162,7 +6509,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15900:run writeStringis is " + result);
data.reclaim();
} catch (error) {
let errCode =
ErrorCode.CHECK_PARAM_ERROR
let errCode =
`${rpc.ErrorCode.CHECK_PARAM_ERROR}`
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15900: errorCode " + error.code);
expect(error.code == errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15900: errorMessage " + error.message);
...
...
@@ -6189,7 +6536,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16000:run writeInterfaceToken result ");
data.reclaim();
} catch (error) {
let errCode =
ErrorCode.PARCEL_MEMORY_ALLOC_ERROR
;
let errCode =
`${rpc.ErrorCode.PARCEL_MEMORY_ALLOC_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16000: errorCode " + error.code);
expect(error.code == errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16000: errorMessage " + error.message);
...
...
@@ -6217,7 +6564,7 @@ export default function actsRpcClientJsTest() {
data.reclaim();
} catch (error) {
let errCode =
ErrorCode.WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR
;
let errCode =
`${rpc.ErrorCode.WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16100: errorCode " + error.code);
expect(error.code != errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16100: errorMessage " + error.message);
...
...
@@ -6244,7 +6591,7 @@ export default function actsRpcClientJsTest() {
data.readParcelable(ret);
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16200: readParcelable is." + ret);
} catch (error) {
let errCode =
ErrorCode.PARCEL_MEMORY_ALLOC_ERROR
;
let errCode =
`${rpc.ErrorCode.PARCEL_MEMORY_ALLOC_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16000: errorCode " + error.code);
expect(error.code == errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16000: errorMessage " + error.message);
...
...
@@ -6267,7 +6614,7 @@ export default function actsRpcClientJsTest() {
var token = {}
var result = data.writeRemoteObject(token);
} catch (error) {
let errCode =
ErrorCode.PROXY_OR_REMOTE_OBJECT_INVALID_ERROR
;
let errCode =
`${rpc.ErrorCode.PROXY_OR_REMOTE_OBJECT_INVALID_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16300: errorCode " + error.code);
expect(error.code == errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16300: errorMessage " + error.message);
...
...
@@ -6298,7 +6645,7 @@ export default function actsRpcClientJsTest() {
data.readParcelable(ret);
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16100: readParcelable is." + ret);
} catch (error) {
let errCode =
ErrorCode.CALL_JS_METHOD_ERROR
;
let errCode =
`${rpc.ErrorCode.CALL_JS_METHOD_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16400:error = " + error.message);
expect(error.message != null).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16400:error = " + error.code);
...
...
@@ -6326,7 +6673,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16500:run readInterfaceToken result is " + resultToken);
data.reclaim();
} catch (error) {
let errCode =
ErrorCode.READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR
;
let errCode =
`${rpc.ErrorCode.READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16500:error = " + error.message);
expect(error.message != null).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16500:error = " + error.code);
...
...
@@ -6349,7 +6696,7 @@ export default function actsRpcClientJsTest() {
let newFd = rpc.MessageSequence.dupFileDescriptor(fd);
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16600: newFd " +newFd);
} catch(error) {
let errCode =
ErrorCode.OS_DUP_ERROR
;
let errCode =
`${rpc.ErrorCode.OS_DUP_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16600: errorCode " + error.code);
expect(error.code != errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_16600: errorMessage" + error.message);
...
...
@@ -6668,7 +7015,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100: sendRequestis is " + result.errCode);
var replyReadResult = result.reply.readString();
console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100: run readString is " + replyReadResult);
expect(replyReadResult).assertEqual("");
expect(replyReadResult).assertEqual("
option
");
expect(option.getFlags()).assertEqual(1);
});
...
...
@@ -6709,7 +7056,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200: sendRequestis is " + result.errCode);
var replyReadResult = result.reply.readString();
console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200: run readString is " + replyReadResult);
expect(replyReadResult).assertEqual("");
expect(replyReadResult).assertEqual("
option
");
expect(option.getFlags()).assertEqual(3);
});
data.reclaim();
...
...
@@ -6747,7 +7094,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300: sendMessageRequest is " + result.errCode);
var replyReadResult = result.reply.readString();
console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300: run readString is " + replyReadResult);
expect(replyReadResult).assertEqual("");
expect(replyReadResult).assertEqual("
option
");
expect(option.getFlags()).assertEqual(1);
});
...
...
@@ -6826,7 +7173,7 @@ export default function actsRpcClientJsTest() {
let isAsyncData = option.isAsync();
expect(isAsyncData).assertTrue();
var replyReadResult = result.reply.readString();
expect(replyReadResult).assertEqual("");
expect(replyReadResult).assertEqual("
option
");
});
data.reclaim();
reply.reclaim();
...
...
@@ -7951,7 +8298,7 @@ export default function actsRpcClientJsTest() {
let ashmem = rpc.Ashmem.create("ashmem", (2*G + 1));
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04100: ashmem " + ashmem);
}catch(error){
let errCode =
ErrorCode.CHECK_PARAM_ERROR
;
let errCode =
`${rpc.ErrorCode.CHECK_PARAM_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04100: errorCode " + error.code);
expect(error.code == errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04100: errorMessage " + error.message);
...
...
@@ -7974,7 +8321,7 @@ export default function actsRpcClientJsTest() {
ashmem.mapReadWriteAshmem();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04200: run mapReadWriteAshmem is success");
}catch(error){
let errCode =
ErrorCode.OS_MMAP_ERROR
;
let errCode =
`${rpc.ErrorCode.OS_MMAP_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04200: error " + error.code);
expect(error.code != errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04200: error " + error.message);
...
...
@@ -7995,7 +8342,7 @@ export default function actsRpcClientJsTest() {
let ashmem = rpc.Ashmem.create("ashmem", 0);
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04300: ashmem " + ashmem);
}catch(error){
let errCode =
ErrorCode.CHECK_PARAM_ERROR
;
let errCode =
`${rpc.ErrorCode.CHECK_PARAM_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04300: errorCode " + error.code);
expect(error.code == errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04300: errorMessage " + error.message);
...
...
@@ -8038,7 +8385,7 @@ export default function actsRpcClientJsTest() {
ashmem.setProtectionType(rpc.Ashmem.PROT_WRITE, rpc.Ashmem.PROT_READ);
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04500: run setProtectionType is success");
}catch(error){
let errCode =
ErrorCode.CHECK_PARAM_ERROR
;
let errCode =
`${rpc.ErrorCode.CHECK_PARAM_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04500: errorCode " + error.code);
expect(error.code == errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04500: errorMessage " + error.message);
...
...
@@ -8061,7 +8408,7 @@ export default function actsRpcClientJsTest() {
ashmem.setProtectionType(null);
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04600: run setProtectionType is success");
}catch(error){
let errCode =
ErrorCode.OS_IOCTL_ERROR
;
let errCode =
`${rpc.ErrorCode.OS_IOCTL_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04600: errorCode " + error.code);
expect(error.code != errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04600: errorMessage " + error.message);
...
...
@@ -8087,7 +8434,7 @@ export default function actsRpcClientJsTest() {
data.reclaim();
data2.reclaim();
}catch(error){
let errCode =
ErrorCode.WRITE_TO_ASHMEM_ERROR
;
let errCode =
`${rpc.ErrorCode.WRITE_TO_ASHMEM_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04700: error " + error.code);
expect(error.code != errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04700: error " + error.message);
...
...
@@ -8114,7 +8461,7 @@ export default function actsRpcClientJsTest() {
let readResult = ashmem.readAshmem(5, 0);
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04800: readAshmem is : " + readResult);
}catch(error){
let errCode =
ErrorCode.READ_FROM_ASHMEM_ERROR
;
let errCode =
`${rpc.ErrorCode.READ_FROM_ASHMEM_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04800: error " + error.code);
expect(error.code != errCode).assertEqual(null);
}
...
...
@@ -8138,7 +8485,7 @@ export default function actsRpcClientJsTest() {
expect(size).assertEqual(mapSize);
ashmem.closeAshmem();
}catch(error){
let errCode =
ErrorCode.CHECK_PARAM_ERROR
;
let errCode =
`${rpc.ErrorCode.CHECK_PARAM_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04900: errorcode " + error.code);
expect(error.code == errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_04900: errormessage " + error.message);
...
...
@@ -8163,7 +8510,7 @@ export default function actsRpcClientJsTest() {
expect(result).assertEqual(false);
ashmem.closeAshmem()
}catch(error){
let errCode =
ErrorCode.CHECK_PARAM_ERROR
;
let errCode =
`${rpc.ErrorCode.CHECK_PARAM_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_05000: errorcode " + error.code);
expect(error.code == errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_05000: errormessage " + error.message);
...
...
@@ -8187,7 +8534,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_05100: run mapTypedAshmem is success");
ashmem.closeAshmem()
}catch(error){
let errCode =
ErrorCode.OS_MMAP_ERROR
;
let errCode =
`${rpc.ErrorCode.OS_MMAP_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_05100: error " + error.code);
expect(error.code != errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_05100: error " + error.message);
...
...
@@ -8211,7 +8558,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_05200: run mapTypedAshmem is success");
ashmem.closeAshmem()
}catch(error){
let errCode =
ErrorCode.CHECK_PARAM_ERROR
;
let errCode =
`${rpc.ErrorCode.CHECK_PARAM_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_05200: error " + error.code);
expect(error.code != errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_Ashmem_05200: error " + error.message);
...
...
@@ -8583,10 +8930,10 @@ export default function actsRpcClientJsTest() {
data.writeBoolean(true)
data.writeChar(96)
data.writeString("HelloWorld")
data.write
Sequence
able(new MySequenceable(1, "aaa"))
data.write
Parcel
able(new MySequenceable(1, "aaa"))
await gIRemoteObject.sendMessageRequest(CODE_ALL_TYPE, data, reply, option, (err, result) => {
console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900
:sendRequest done, error
code: " + result.errCode)
console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900
error
code: " + result.errCode)
expect(result.errCode).assertEqual(0)
expect(result.reply.readByte()).assertEqual(1)
expect(result.reply.readShort()).assertEqual(2)
...
...
@@ -8598,7 +8945,7 @@ export default function actsRpcClientJsTest() {
expect(result.reply.readChar()).assertEqual(96)
expect(result.reply.readString()).assertEqual("HelloWorld")
let s = new MySequenceable(0, '')
expect(result.reply.read
Sequence
able(s)).assertTrue()
expect(result.reply.read
Parcel
able(s)).assertTrue()
expect(s.num).assertEqual(1)
expect(s.str).assertEqual("aaa")
});
...
...
@@ -8724,7 +9071,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_01300:run registerDeathRecipient is done");
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_01300:error = " + error);
expect(error
=
= null).assertTrue();
expect(error
!
= null).assertTrue();
}
console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_01300---------------------------");
});
...
...
@@ -8745,7 +9092,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_01400:run unregisterDeathRecipient is done");
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_01400:error = " + error);
expect(error
=
= null).assertTrue();
expect(error
!
= null).assertTrue();
}
console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_01400---------------------------");
});
...
...
@@ -8761,14 +9108,14 @@ export default function actsRpcClientJsTest() {
try{
let recipient = new MyDeathRecipient(gIRemoteObject, null)
var resultAdd1 = gIRemoteObject.addDeathRecipient(recipient, 0)
expect(resultAdd1 ==
tru
e).assertTrue();
expect(resultAdd1 ==
fals
e).assertTrue();
var resultAdd2 = gIRemoteObject.addDeathRecipient(recipient, 0)
expect(resultAdd2 ==
tru
e).assertTrue();
expect(resultAdd2 ==
fals
e).assertTrue();
var resultRemove1 = gIRemoteObject.removeDeathRecipient(recipient, 0)
expect(resultRemove1 ==
tru
e).assertTrue();
expect(resultRemove1 ==
fals
e).assertTrue();
var resultRemove2 = gIRemoteObject.removeDeathRecipient(recipient, 0)
expect(resultRemove2 ==
tru
e).assertTrue();
expect(resultRemove2 ==
fals
e).assertTrue();
var resultRemove3 = gIRemoteObject.removeDeathRecipient(recipient, 0)
expect(resultRemove3 == false).assertTrue();
...
...
@@ -8789,9 +9136,9 @@ export default function actsRpcClientJsTest() {
try{
let recipient = new MyDeathRecipient(gIRemoteObject, null);
var resultAdd = gIRemoteObject.addDeathRecipient(recipient, -(2*G));
expect(resultAdd).assertTrue();
expect(resultAdd
== false
).assertTrue();
var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, -(2*G));
expect(resultRemove).assertTrue();
expect(resultRemove
== false
).assertTrue();
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00200:error = " + error);
}
...
...
@@ -8809,9 +9156,9 @@ export default function actsRpcClientJsTest() {
try{
let recipient = new MyDeathRecipient(gIRemoteObject, null);
var resultAdd = gIRemoteObject.addDeathRecipient(recipient, (2*G - 1));
expect(resultAdd).assertTrue();
expect(resultAdd
== false
).assertTrue();
var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, (2*G - 1));
expect(resultRemove).assertTrue();
expect(resultRemove
== false
).assertTrue();
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00300:error = " + error);
}
...
...
@@ -8830,10 +9177,10 @@ export default function actsRpcClientJsTest() {
let recipient = new MyDeathRecipient(gIRemoteObject, null);
var resultAdd = gIRemoteObject.addDeathRecipient(recipient, 2*G);
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00400:run addDeathRecipient first is " + resultAdd);
expect(resultAdd).assertTrue();
expect(resultAdd
== false
).assertTrue();
var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, 2*G);
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00400:run removeDeathRecipient1 is " + resultRemove);
expect(resultRemove).assertTrue();
expect(resultRemove
== false
).assertTrue();
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00400:error = " + error);
}
...
...
@@ -8852,10 +9199,10 @@ export default function actsRpcClientJsTest() {
let recipient = new MyDeathRecipient(gIRemoteObject, null);
var resultAdd = gIRemoteObject.addDeathRecipient(recipient, -(2*G + 1));
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00500:run addDeathRecipient first is " + resultAdd);
expect(resultAdd).assertTrue();
expect(resultAdd
== false
).assertTrue();
var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, -(2*G + 1));
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00500:run removeDeathRecipient1 is " + resultRemove);
expect(resultRemove).assertTrue();
expect(resultRemove
== false
).assertTrue();
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00500:error = " + error);
}
...
...
@@ -8878,7 +9225,7 @@ export default function actsRpcClientJsTest() {
var resultAdd1 = gIRemoteObject.addDeathRecipient(recipient, 0)
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run addDeathRecipient first result is " + resultAdd1);
expect(resultAdd1 ==
tru
e).assertTrue();
expect(resultAdd1 ==
fals
e).assertTrue();
var isDead1 = gIRemoteObject.isObjectDead();
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600: run isObjectDead result is " + isDead1);
...
...
@@ -8886,15 +9233,15 @@ export default function actsRpcClientJsTest() {
var resultRemove1 = gIRemoteObject.removeDeathRecipient(recipient, 0)
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run removeDeathRecipient result is " + resultRemove1);
expect(resultRemove1 ==
tru
e).assertTrue();
expect(resultRemove1 ==
fals
e).assertTrue();
var resultAdd2 = gIRemoteObject.addDeathRecipient(recipient, 0)
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run addDeathRecipient second result is " + resultAdd2);
expect(resultAdd2 ==
tru
e).assertTrue();
expect(resultAdd2 ==
fals
e).assertTrue();
var resultRemove2 = gIRemoteObject.removeDeathRecipient(recipient, 0)
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run removeDeathRecipient1 result is " + resultRemove2);
expect(resultRemove2 ==
tru
e).assertTrue();
expect(resultRemove2 ==
fals
e).assertTrue();
var resultRemove3 = gIRemoteObject.removeDeathRecipient(recipient, 0)
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run removeDeathRecipient3 result is " + resultRemove3);
...
...
@@ -9015,7 +9362,7 @@ export default function actsRpcClientJsTest() {
expect(isDead2 == false).assertTrue();
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01000:error = " + error);
expect(error
=
= null).assertTrue();
expect(error
!
= null).assertTrue();
}
console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_01000---------------------------");
});
...
...
@@ -9090,7 +9437,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01300: unregisterDeathRecipient is success");
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01300:error = " + error);
expect(error
=
= null).assertTrue();
expect(error
!
= null).assertTrue();
}
console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_01300---------------------------");
});
...
...
@@ -9111,7 +9458,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01400: unregisterDeathRecipient is success");
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01400:error = " + error);
expect(error
=
= null).assertTrue();
expect(error
!
= null).assertTrue();
}
console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_01400---------------------------");
});
...
...
@@ -9132,7 +9479,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01500: unregisterDeathRecipient is success");
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01500:error = " + error);
expect(error
=
= null).assertTrue();
expect(error
!
= null).assertTrue();
}
console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_01500---------------------------");
});
...
...
@@ -9153,7 +9500,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01600: unregisterDeathRecipient is success");
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01600:error = " + error);
expect(error
=
= null).assertTrue();
expect(error
!
= null).assertTrue();
}
console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_01600---------------------------");
});
...
...
@@ -9174,7 +9521,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01700: unregisterDeathRecipient is success");
} catch (error) {
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01700:error = " + error);
expect(error
=
= null).assertTrue();
expect(error
!
= null).assertTrue();
}
console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_01700---------------------------");
});
...
...
@@ -9197,7 +9544,7 @@ export default function actsRpcClientJsTest() {
let res2 = object.getLocalInterface(null);
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01800: run getLocalInterface success, res2 is " + res2);
} catch (error) {
let errCode =
ErrorCode.ONLY_PROXY_OBJECT_PERMITTED_ERROR
;
let errCode =
`${rpc.ErrorCode.ONLY_PROXY_OBJECT_PERMITTED_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01800:error = " + error.code);
expect(error.code != errCode).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_01800:error = " + error.message);
...
...
@@ -9516,6 +9863,7 @@ export default function actsRpcClientJsTest() {
let localDeviceID = rpc.IPCSkeleton.getLocalDeviceID();
let isLocalCalling = rpc.IPCSkeleton.isLocalCalling();
let id = rpc.IPCSkeleton.resetCallingIdentity();
console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200:" + id)
let ret = rpc.IPCSkeleton.setCallingIdentity(id);
expect(object.getInterfaceDescriptor()).assertEqual("");
expect(callingDeviceID).assertEqual("");
...
...
@@ -9523,7 +9871,7 @@ export default function actsRpcClientJsTest() {
expect(isLocalCalling).assertTrue();
expect(id).assertEqual("");
expect(ret).assertTrue();
expect(rpc.IPCSkeleton.flushCommands(gIRemoteObject)).assertEqual(
0
);
expect(rpc.IPCSkeleton.flushCommands(gIRemoteObject)).assertEqual(
101
);
console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200: callingPid: " + callingPid
+ ", callingUid: " + callingUid
+ ", callingDeviceID: " + callingDeviceID + ", localDeviceID: " + localDeviceID
...
...
@@ -9649,7 +9997,7 @@ export default function actsRpcClientJsTest() {
object.getDescriptor();
console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01600: is success");
} catch (error) {
let errCode =
ErrorCode.COMMUNICATION_ERROR
;
let errCode =
`${rpc.ErrorCode.COMMUNICATION_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01600 error is :" + error.message)
expect(error.message != null).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01600 error is :" + error.code)
...
...
@@ -9672,7 +10020,7 @@ export default function actsRpcClientJsTest() {
console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01700 RpcServer: flushCmdBuffer is success");
}
catch (error) {
let errCode =
ErrorCode.ONLY_REMOTE_OBJECT_PERMITTED_ERROR
;
let errCode =
`${rpc.ErrorCode.ONLY_REMOTE_OBJECT_PERMITTED_ERROR}`
;
console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01700 error is :" + error.message)
expect(error.message != null).assertTrue();
console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01700 error is :" + error.code)
...
...
communication/dsoftbus/rpc_server/BUILD.gn
已删除
100644 → 0
浏览文件 @
cde60290
# Copyright (C) 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsRpcJsServer") {
hap_profile = "./src/main/config.json"
deps = [
":rpc_js_assets",
":rpc_js_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsRpcHapServer"
subsystem_name = "communication"
part_name = "ipc"
}
ohos_js_assets("rpc_js_assets") {
source_dir = "./src/main/js"
hap_profile = "./src/main/config.json"
}
ohos_resources("rpc_js_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
communication/dsoftbus/rpc_server/Test.json
已删除
100644 → 0
浏览文件 @
cde60290
{
"description"
:
"Configuration for rpc Servers"
,
"driver"
:
{
"type"
:
"JSUnitServer"
,
"test-timeout"
:
"900000"
,
"package"
:
"ohos.rpc.test.server"
,
"abilityName"
:
".MainAbility"
,
"shell-timeout"
:
"900000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsRpcHapServer.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
communication/dsoftbus/rpc_server/signature/openharmony_sx.p7b
已删除
100644 → 0
浏览文件 @
cde60290
文件已删除
communication/dsoftbus/rpc_server/src/main/config.json
已删除
100644 → 0
浏览文件 @
cde60290
{
"app"
:
{
"bundleName"
:
"ohos.rpc.test.server"
,
"vendor"
:
"rpc"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
7
,
"target"
:
8
}
},
"deviceConfig"
:
{},
"module"
:
{
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.DISTRIBUTED_DATASYNC"
},
{
"name"
:
"ohos.permission.GET_DISTRIBUTED_DEVICE_INFO"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
}
],
"package"
:
"ohos.rpc.test.server"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
".MainAbility"
,
"deviceType"
:
[
"tablet"
,
"default"
,
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
,
"installationFree"
:
false
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility"
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"js"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"formsEnabled"
:
false
,
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"launchType"
:
"standard"
},
{
"srcPath"
:
"ServiceAbility"
,
"name"
:
".ServiceAbility"
,
"icon"
:
"$media:icon"
,
"srcLanguage"
:
"js"
,
"description"
:
"$string:serviceability_description"
,
"type"
:
"service"
,
"visible"
:
true
,
"formsEnabled"
:
false
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
,
"pages/second/second"
],
"name"
:
".MainAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
\ No newline at end of file
communication/dsoftbus/rpc_server/src/main/js/MainAbility/app.js
已删除
100644 → 0
浏览文件 @
cde60290
/*
* Copyright (c) 2021 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
onCreate
()
{
console
.
info
(
"
Application onCreate
"
);
},
onDestroy
()
{
console
.
info
(
"
Application onDestroy
"
);
}
};
communication/dsoftbus/rpc_server/src/main/js/MainAbility/i18n/en-US.json
已删除
100644 → 0
浏览文件 @
cde60290
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
,
"page"
:
"Second Page"
,
"next"
:
"Next Page"
,
"back"
:
"Back"
},
"Files"
:
{
}
}
\ No newline at end of file
communication/dsoftbus/rpc_server/src/main/js/MainAbility/i18n/zh-CN.json
已删除
100644 → 0
浏览文件 @
cde60290
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
,
"page"
:
"第二页"
,
"next"
:
"下一页"
,
"back"
:
"返回"
},
"Files"
:
{
}
}
\ No newline at end of file
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.css
已删除
100644 → 0
浏览文件 @
cde60290
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
60px
;
text-align
:
center
;
width
:
100%
;
height
:
40%
;
margin
:
10px
;
}
.btn
{
width
:
50%
;
height
:
100px
;
font-size
:
40px
;
}
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.hml
已删除
100644 → 0
浏览文件 @
cde60290
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.js
已删除
100644 → 0
浏览文件 @
cde60290
/*
* Copyright (c) 2021 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
router
from
'
@system.router
'
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onclick
:
function
()
{
router
.
replace
({
uri
:
"
pages/second/second
"
})
}
}
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.css
已删除
100644 → 0
浏览文件 @
cde60290
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
60px
;
text-align
:
center
;
width
:
100%
;
height
:
40%
;
margin
:
10px
;
}
.btn
{
width
:
50%
;
height
:
100px
;
font-size
:
40px
;
}
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.hml
已删除
100644 → 0
浏览文件 @
cde60290
<div class="container">
<text class="title">
{{ $t('strings.page') }}
</text>
<input class="btn" type="button" value="{{ $t('strings.back') }}" onclick="onclick"></input>
</div>
communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.js
已删除
100644 → 0
浏览文件 @
cde60290
/*
* Copyright (c) 2021 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
router
from
'
@system.router
'
export
default
{
data
:
{
title
:
'
World
'
},
onclick
:
function
()
{
router
.
replace
({
uri
:
"
pages/index/index
"
})
}
}
communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js
已删除
100644 → 0
浏览文件 @
cde60290
/*
* Copyright (c) 2021 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
rpc
from
"
@ohos.rpc
"
import
fileio
from
'
@ohos.fileio
'
;
import
process
from
'
@ohos.process
'
export
default
{
onStart
()
{
console
.
info
(
'
RpcServer: onStart
'
)
},
onStop
()
{
console
.
info
(
'
RpcServer: onStop
'
)
},
onCommand
(
want
,
startId
)
{
console
.
info
(
'
RpcServer: onCommand, want:
'
+
JSON
.
stringify
(
want
)
+
'
, startId:
'
+
startId
)
},
onConnect
(
want
)
{
console
.
info
(
'
RpcServer: service onConnect called.
'
)
return
new
Stub
(
"
rpcTestAbility
"
)
},
onDisconnect
(
want
)
{
console
.
info
(
'
RpcServer: service onDisConnect called.
'
)
},
onReconnect
(
want
)
{
console
.
info
(
'
RpcServer: service onReConnect called.
'
)
}
}
class
MySequenceable
{
num
=
null
str
=
null
constructor
(
num
,
string
)
{
this
.
num
=
num
;
this
.
str
=
string
;
}
marshalling
(
messageParcel
)
{
messageParcel
.
writeInt
(
this
.
num
);
messageParcel
.
writeString
(
this
.
str
);
return
true
;
}
unmarshalling
(
messageParcel
)
{
this
.
num
=
messageParcel
.
readInt
();
this
.
str
=
messageParcel
.
readString
();
return
true
;
}
}
class
Stub
extends
rpc
.
RemoteObject
{
constructor
(
descriptor
)
{
super
(
descriptor
);
}
onRemoteRequest
(
code
,
data
,
reply
,
option
)
{
try
{
console
.
info
(
"
onRemoteRequest:
"
+
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
}
onRemoteMessageRequest
(
code
,
data
,
reply
,
option
)
{
try
{
console
.
info
(
"
onRemoteMessageRequest:
"
+
code
)
switch
(
code
)
{
case
1
:
{
console
.
info
(
"
case 1 start
"
)
let
tmp1
=
data
.
readByteArray
()
let
result
=
reply
.
writeByteArray
(
tmp1
)
return
true
}
case
2
:
{
console
.
info
(
"
case 2 start
"
)
let
tmp1
=
data
.
readIntArray
()
let
result
=
reply
.
writeIntArray
(
tmp1
)
return
true
}
case
3
:
{
console
.
info
(
"
case 3 start
"
)
let
tmp1
=
data
.
readFloatArray
()
let
result
=
reply
.
writeFloatArray
(
tmp1
)
return
true
}
case
4
:
{
console
.
info
(
"
case 4 start
"
)
let
tmp1
=
data
.
readShort
()
let
result
=
reply
.
writeShort
(
tmp1
)
return
true
}
case
5
:
{
console
.
info
(
"
case 5 start
"
)
let
tmp1
=
data
.
readLong
()
let
result
=
reply
.
writeLong
(
tmp1
)
return
true
}
case
6
:
{
console
.
info
(
"
case 6 start
"
)
let
tmp1
=
data
.
readDouble
()
let
result
=
reply
.
writeDouble
(
tmp1
)
return
true
}
case
7
:
{
console
.
info
(
"
case 7 start
"
)
let
tmp1
=
data
.
readBoolean
()
let
result
=
reply
.
writeBoolean
(
tmp1
)
return
true
}
case
8
:
{
console
.
info
(
"
case 8 start
"
)
let
tmp1
=
data
.
readChar
()
let
result
=
reply
.
writeChar
(
tmp1
)
return
true
}
case
9
:
{
console
.
info
(
"
case 9 start
"
)
let
tmp1
=
data
.
readString
()
let
result
=
reply
.
writeString
(
tmp1
)
return
true
}
case
10
:
{
console
.
info
(
"
case 10 start
"
)
let
tmp1
=
data
.
readByte
()
let
result
=
reply
.
writeByte
(
tmp1
)
return
true
}
case
11
:
{
console
.
info
(
"
case 11 start
"
)
let
tmp1
=
data
.
readInt
()
let
result
=
reply
.
writeInt
(
tmp1
)
return
true
}
case
12
:
{
console
.
info
(
"
case 12 start
"
)
let
tmp1
=
data
.
readFloat
()
let
result
=
reply
.
writeFloat
(
tmp1
)
return
true
}
case
13
:
{
console
.
info
(
"
case 13 start
"
)
var
size
=
data
.
readInt
();
let
tmp1
=
data
.
readRawData
(
size
);
let
size1
=
reply
.
writeInt
(
size
);
let
result
=
reply
.
writeRawData
(
tmp1
,
tmp
.
length
)
return
true
}
case
14
:
{
console
.
info
(
"
case 14 start
"
)
let
listener
=
data
.
readRemoteObject
();
let
num
=
data
.
readInt
()
let
str
=
data
.
readString
()
let
option2
=
new
rpc
.
MessageOption
()
let
data2
=
rpc
.
MessageParcel
.
create
()
let
reply2
=
rpc
.
MessageParcel
.
create
()
data2
.
writeInt
(
num
)
data2
.
writeString
(
str
)
listener
.
sendRequest
(
1
,
data2
,
reply2
,
option2
)
.
then
(
function
(
result
)
{
console
.
info
(
"
14 send request done, error code:
"
+
result
.
errCode
)
})
.
catch
(
function
(
e
)
{
console
.
error
(
"
14 send request got exception:
"
+
e
)
})
.
finally
(()
=>
{
data2
.
reclaim
()
reply2
.
reclaim
()
console
.
info
(
"
case 14 test done
"
)
})
reply
.
writeNoException
()
return
true
}
case
15
:
{
console
.
info
(
"
case 15 start
"
)
let
s
=
new
MySequenceable
(
null
,
null
)
var
tmp1
=
data
.
readParcelable
(
s
)
let
result
=
reply
.
writeParcelable
(
s
)
return
true
}
case
16
:
{
console
.
info
(
"
case 16 start
"
)
data
.
readException
()
var
tmp
=
data
.
readInt
();
reply
.
writeNoException
()
var
result
=
reply
.
writeInt
(
tmp
);
return
true
}
case
17
:
{
console
.
info
(
"
case 17 start
"
)
var
s
=
[
new
MySequenceable
(
null
,
null
),
new
MySequenceable
(
null
,
null
),
new
MySequenceable
(
null
,
null
)];
data
.
readParcelableArray
(
s
);
let
result
=
reply
.
writeParcelableArray
(
s
);
return
true
}
case
18
:
{
console
.
info
(
"
case 18 start
"
)
let
listeners
=
data
.
readRemoteObjectArray
();
for
(
let
i
=
0
;
i
<
listeners
.
length
;
i
++
)
{
let
option2
=
new
rpc
.
MessageOption
()
let
data2
=
rpc
.
MessageParcel
.
create
()
let
reply2
=
rpc
.
MessageParcel
.
create
()
listeners
[
i
].
sendRequest
(
1
,
data2
,
reply2
,
option2
)
.
then
(
function
(
result
)
{
console
.
info
(
"
18 send request done, error code:
"
+
result
.
errCode
+
"
, index:
"
+
i
)
})
.
catch
(
function
(
e
)
{
console
.
error
(
"
18 send request got exception:
"
+
e
)
})
.
finally
(()
=>
{
data2
.
reclaim
()
reply2
.
reclaim
()
console
.
info
(
"
case 18 test done
"
)
})
}
console
.
info
(
"
18 The server's writeRemoteObjectArray result is
"
+
result
);
return
true
}
case
19
:
{
console
.
info
(
"
case 19 start
"
)
let
tmp1
=
data
.
readDoubleArray
()
let
result
=
reply
.
writeDoubleArray
(
tmp1
)
return
true
}
case
20
:
{
console
.
info
(
"
case 20 start
"
)
let
tmp1
=
data
.
readByte
()
let
tmp2
=
data
.
readShort
()
let
tmp3
=
data
.
readInt
()
let
tmp4
=
data
.
readLong
()
let
tmp5
=
data
.
readFloat
()
let
tmp6
=
data
.
readDouble
()
let
tmp7
=
data
.
readBoolean
()
let
tmp8
=
data
.
readChar
()
let
tmp9
=
data
.
readString
()
let
s
=
new
MySequenceable
(
null
,
null
)
let
tmp10
=
data
.
readParcelable
(
s
)
let
result1
=
reply
.
writeByte
(
tmp1
)
let
result2
=
reply
.
writeShort
(
tmp2
)
let
result3
=
reply
.
writeInt
(
tmp3
)
let
result4
=
reply
.
writeLong
(
tmp4
)
let
result5
=
reply
.
writeFloat
(
tmp5
)
let
result6
=
reply
.
writeDouble
(
tmp6
)
let
result7
=
reply
.
writeBoolean
(
tmp7
)
let
result8
=
reply
.
writeChar
(
tmp8
)
let
result9
=
reply
.
writeString
(
tmp9
)
let
result10
=
reply
.
writeParcelable
(
s
)
return
true
}
case
21
:
{
console
.
info
(
"
case 21 start
"
)
let
tmp1
=
data
.
readByteArray
()
let
tmp2
=
data
.
readShortArray
()
let
tmp3
=
data
.
readIntArray
()
let
tmp4
=
data
.
readLongArray
()
let
tmp5
=
data
.
readFloatArray
()
let
tmp6
=
data
.
readDoubleArray
()
let
tmp7
=
data
.
readBooleanArray
()
let
tmp8
=
data
.
readCharArray
()
let
tmp9
=
data
.
readStringArray
()
let
s
=
[
new
MySequenceable
(
null
,
null
),
new
MySequenceable
(
null
,
null
),
new
MySequenceable
(
null
,
null
)]
let
tmp10
=
data
.
readParcelableArray
(
s
)
let
result1
=
reply
.
writeByteArray
(
tmp1
)
let
result2
=
reply
.
writeShortArray
(
tmp2
)
let
result3
=
reply
.
writeIntArray
(
tmp3
)
let
result4
=
reply
.
writeLongArray
(
tmp4
)
let
result5
=
reply
.
writeFloatArray
(
tmp5
)
let
result6
=
reply
.
writeDoubleArray
(
tmp6
)
let
result7
=
reply
.
writeBooleanArray
(
tmp7
)
let
result8
=
reply
.
writeCharArray
(
tmp8
)
let
result9
=
reply
.
writeStringArray
(
tmp9
)
let
result10
=
reply
.
writeParcelableArray
(
s
)
return
true
}
case
22
:
{
console
.
info
(
"
case 22 start
"
)
let
callingPid
=
rpc
.
IPCSkeleton
.
getCallingPid
()
let
callingUid
=
rpc
.
IPCSkeleton
.
getCallingUid
()
reply
.
writeNoException
()
reply
.
writeInt
(
callingPid
)
reply
.
writeInt
(
callingUid
)
reply
.
writeInt
(
this
.
getCallingPid
())
reply
.
writeInt
(
this
.
getCallingUid
())
let
id
=
rpc
.
IPCSkeleton
.
resetCallingIdentity
()
rpc
.
IPCSkeleton
.
setCallingIdentity
(
id
)
reply
.
writeInt
(
rpc
.
IPCSkeleton
.
getCallingPid
())
reply
.
writeInt
(
rpc
.
IPCSkeleton
.
getCallingUid
())
reply
.
writeInt
(
rpc
.
IPCSkeleton
.
flushCommands
(
this
))
return
true
}
case
23
:
{
console
.
info
(
"
case 23 start
"
)
let
s
=
new
MySequenceable
(
null
,
null
);
var
tmp1
=
data
.
readParcelable
(
s
);
var
result
=
reply
.
writeParcelable
(
s
);
return
true
}
case
24
:
{
console
.
info
(
"
case 24 start
"
)
var
tmp1
=
data
.
readShort
();
var
tmp2
=
data
.
readShort
();
var
tmp3
=
data
.
readShort
();
var
tmp4
=
data
.
readShort
();
var
tmp5
=
data
.
readShort
();
var
result1
=
reply
.
writeShort
(
tmp1
);
var
result2
=
reply
.
writeShort
(
tmp2
);
var
result3
=
reply
.
writeShort
(
tmp3
);
var
result4
=
reply
.
writeShort
(
tmp4
);
var
result5
=
reply
.
writeShort
(
tmp5
);
return
true
}
case
25
:
{
console
.
info
(
"
case 25 start
"
)
var
tmp1
=
data
.
readByte
();
var
tmp2
=
data
.
readByte
();
var
tmp3
=
data
.
readByte
();
var
tmp4
=
data
.
readByte
();
var
tmp5
=
data
.
readByte
();
var
result1
=
reply
.
writeByte
(
tmp1
);
var
result2
=
reply
.
writeByte
(
tmp2
);
var
result3
=
reply
.
writeByte
(
tmp3
);
var
result4
=
reply
.
writeByte
(
tmp4
);
var
result5
=
reply
.
writeByte
(
tmp5
);
return
true
}
case
26
:
{
console
.
info
(
"
case 26 start
"
)
var
tmp1
=
data
.
readInt
();
var
tmp2
=
data
.
readInt
();
var
tmp3
=
data
.
readInt
();
var
tmp4
=
data
.
readInt
();
var
tmp5
=
data
.
readInt
();
var
result1
=
reply
.
writeInt
(
tmp1
);
var
result2
=
reply
.
writeInt
(
tmp2
);
var
result3
=
reply
.
writeInt
(
tmp3
);
var
result4
=
reply
.
writeInt
(
tmp4
);
var
result5
=
reply
.
writeInt
(
tmp5
);
return
true
}
case
28
:
{
console
.
info
(
"
case 28 start
"
)
let
callingPid
=
rpc
.
IPCSkeleton
.
getCallingPid
()
let
callingUid
=
rpc
.
IPCSkeleton
.
getCallingUid
()
let
callingDeviceID
=
rpc
.
IPCSkeleton
.
getCallingDeviceID
()
let
localDeviceID
=
rpc
.
IPCSkeleton
.
getLocalDeviceID
()
let
isLocalCalling
=
rpc
.
IPCSkeleton
.
isLocalCalling
()
reply
.
writeNoException
()
reply
.
writeInt
(
callingPid
)
reply
.
writeInt
(
callingUid
)
reply
.
writeString
(
callingDeviceID
)
reply
.
writeString
(
localDeviceID
)
reply
.
writeBoolean
(
isLocalCalling
)
reply
.
writeInt
(
this
.
getCallingPid
())
reply
.
writeInt
(
this
.
getCallingUid
())
let
id
=
rpc
.
IPCSkeleton
.
resetCallingIdentity
()
rpc
.
IPCSkeleton
.
setCallingIdentity
(
id
)
reply
.
writeInt
(
rpc
.
IPCSkeleton
.
getCallingPid
())
reply
.
writeInt
(
rpc
.
IPCSkeleton
.
getCallingUid
())
reply
.
writeInt
(
rpc
.
IPCSkeleton
.
flushCommands
(
this
))
return
true
}
case
29
:
{
console
.
info
(
"
case 29 starts
"
)
let
bytesWr
=
data
.
readInt
()
let
fd
=
data
.
readFileDescriptor
()
let
writeFileResult
=
fileio
.
writeSync
(
fd
,
"
HELLO RPC
"
,
{
position
:
bytesWr
+
1
});
rpc
.
MessageParcel
.
closeFileDescriptor
(
fd
)
return
true
}
case
30
:
{
console
.
info
(
"
case 30 start
"
)
let
listeners
=
data
.
readRemoteObjectArray
();
let
num
=
data
.
readInt
()
let
str
=
data
.
readString
()
for
(
let
i
=
0
;
i
<
listeners
.
length
;
i
++
)
{
let
option2
=
new
rpc
.
MessageOption
()
let
data2
=
rpc
.
MessageParcel
.
create
()
let
reply2
=
rpc
.
MessageParcel
.
create
()
data2
.
writeInt
(
num
)
data2
.
writeString
(
str
)
listeners
[
i
].
sendRequest
(
1
,
data2
,
reply2
,
option2
)
.
then
(
function
(
result
)
{
console
.
info
(
"
30 send request done, error code:
"
+
result
.
errCode
+
"
, index:
"
+
i
)
})
.
catch
(
function
(
e
)
{
console
.
error
(
"
30 send request got exception:
"
+
e
)
})
.
finally
(()
=>
{
data2
.
reclaim
()
reply2
.
reclaim
()
console
.
info
(
"
case 30 test done
"
)
})
}
reply
.
writeNoException
()
return
true
}
case
31
:
{
console
.
info
(
"
case 31 start
"
)
let
listeners
=
new
Array
(
3
)
data
.
readRemoteObjectArray
(
listeners
)
let
num
=
data
.
readInt
()
let
str
=
data
.
readString
()
for
(
let
i
=
0
;
i
<
listeners
.
length
;
i
++
)
{
let
option2
=
new
rpc
.
MessageOption
()
let
data2
=
rpc
.
MessageParcel
.
create
()
let
reply2
=
rpc
.
MessageParcel
.
create
()
data2
.
writeInt
(
num
)
data2
.
writeString
(
str
)
listeners
[
i
].
sendRequest
(
1
,
data2
,
reply2
,
option2
)
.
then
(
function
(
result
)
{
console
.
info
(
"
31 send request done, error code:
"
+
result
.
errCode
+
"
, index:
"
+
i
)
})
.
catch
(
function
(
e
)
{
console
.
error
(
"
31 send request got exception:
"
+
e
)
})
.
finally
(()
=>
{
data2
.
reclaim
()
reply2
.
reclaim
()
console
.
info
(
"
case 31 test done
"
)
})
}
reply
.
writeNoException
()
return
true
}
case
32
:
{
console
.
info
(
"
case 32 start
"
)
let
tmp1
=
data
.
readString
()
let
result
=
reply
.
writeString
(
"
onRemoteMessageRequest invoking
"
)
return
true
}
default
:
this
.
onRemoteRequest
(
code
,
data
,
reply
,
option
)
}
}
catch
(
error
)
{
console
.
info
(
"
onRemoteMessageRequest:
"
+
error
);
}
return
false
}
}
\ No newline at end of file
communication/dsoftbus/rpc_server/src/main/resources/base/element/string.json
已删除
100644 → 0
浏览文件 @
cde60290
{
"string"
:
[
{
"name"
:
"entry_MainAbility"
,
"value"
:
"RpcServer"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Empty Ability"
},
{
"name"
:
"serviceability_description"
,
"value"
:
"hap sample empty service"
}
]
}
\ No newline at end of file
communication/dsoftbus/rpc_server/src/main/resources/base/media/icon.png
已删除
100644 → 0
浏览文件 @
cde60290
6.6 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录