From 37be43d7eedc2241c869338e97871dde02f35729 Mon Sep 17 00:00:00 2001 From: yang-qibo Date: Thu, 13 Oct 2022 17:43:42 +0800 Subject: [PATCH] =?UTF-8?q?onRemoteRequestEx=E6=96=B9=E6=B3=95=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=9B=B4=E6=94=B9=E7=94=A8=E4=BE=8B=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yang-qibo --- .../src/main/js/test/RpcClientJsunit.test.js | 48 +++++++++---------- .../src/main/js/ServiceAbility/service.js | 46 +++++++++--------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js b/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js index 071579dff..19b2fb306 100755 --- a/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js +++ b/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js @@ -70,8 +70,8 @@ export default function actsRpcClientJsTest() { 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; + const CODE_onRemoteMessageRequest_OR_ONREMOTEREQUEST = 32; + const CODE_onRemoteMessageRequest = 33; function connectAbility() { let want = { @@ -4118,7 +4118,7 @@ export default function actsRpcClientJsTest() { /* * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11200 - * @tc.name Call the writesequenceable interface to write the custom serialized + * @tc.name Call the writeSequenceable interface to write the custom serialized * object to the messageparcel instance * @tc.desc Function test * @tc.level 0 @@ -4346,8 +4346,8 @@ export default function actsRpcClientJsTest() { /* * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11800 - * @tc.name Call the writesequenceable interface to write the custom serialized object to the - * messageparcel instance, and call readsequenceable to read the data + * @tc.name Call the writeSequenceable interface to write the custom serialized object to the + * messageparcel instance, and call readSequenceable to read the data * @tc.desc Function test * @tc.level 0 */ @@ -4387,8 +4387,8 @@ export default function actsRpcClientJsTest() { /* * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11900 - * @tc.name Call the writesequenceablearray interface to write the custom serialized object to the - * messageparcel instance, and call readsequenceablearray to read the data + * @tc.name Call the writeSequenceablearray interface to write the custom serialized object to the + * messageparcel instance, and call readSequenceablearray to read the data * @tc.desc Function test * @tc.level 0 */ @@ -4432,8 +4432,8 @@ export default function actsRpcClientJsTest() { /* * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12000 - * @tc.name Call the writesequenceablearray interface to write the custom serialized object to the - * messageparcel instance, and call readsequenceablearray to read the data + * @tc.name Call the writeSequenceablearray interface to write the custom serialized object to the + * messageparcel instance, and call readSequenceablearray to read the data * @tc.desc Function test * @tc.level 0 */ @@ -4477,7 +4477,7 @@ export default function actsRpcClientJsTest() { /* * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12100 - * @tc.name Call the writesequenceablearray interface to write the custom + * @tc.name Call the writeSequenceablearray interface to write the custom * serialized object to the messageparcel instance * @tc.desc Function test * @tc.level 0 @@ -5887,7 +5887,7 @@ export default function actsRpcClientJsTest() { /* * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15500 * @tc.name Invoke the writestring interface to write data to the messageparcel instance SendRequest Asynchronous - * Authentication onRemoteRequestEx Server Processing + * Authentication onRemoteMessageRequest Server Processing * @tc.desc Function test * @tc.level 0 */ @@ -5898,7 +5898,7 @@ export default function actsRpcClientJsTest() { console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); - var token = 'onRemoteRequestEx invoking'; + var token = 'onRemoteMessageRequest invoking'; var result = data.writeString(token); console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500:run writeStringis is " + result); expect(result == true).assertTrue(); @@ -5906,7 +5906,7 @@ export default function actsRpcClientJsTest() { { console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: gIRemoteObject is undefined"); } - await gIRemoteObject.sendRequest(CODE_ONREMOTEREQUESTEX, data, reply, option).then((result) => { + await gIRemoteObject.sendRequest(CODE_onRemoteMessageRequest, 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); @@ -5924,7 +5924,7 @@ export default function actsRpcClientJsTest() { /* * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15600 * @tc.name Invoke the writestring interface to write data to the messageparcel instance sendMessageRequest Asynchronous - * Authentication onRemoteRequestEx Server Processing + * Authentication onRemoteMessageRequest Server Processing * @tc.desc Function test * @tc.level 0 */ @@ -5935,14 +5935,14 @@ export default function actsRpcClientJsTest() { console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600: create object successfully."); var reply = rpc.MessageSequence.create(); var option = new rpc.MessageOption(); - var token = 'onRemoteRequestEx invoking'; + var token = 'onRemoteMessageRequest invoking'; var result = data.writeString(token); console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600:run writeStringis is " + result); if (gIRemoteObject == undefined) { console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600: gIRemoteObject is undefined"); } - await gIRemoteObject.sendMessageRequest(CODE_ONREMOTEREQUESTEX, data, reply, option).then((result) => { + await gIRemoteObject.sendMessageRequest(CODE_onRemoteMessageRequest, 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); @@ -5960,7 +5960,7 @@ export default function actsRpcClientJsTest() { /* * @tc.number SUB_Softbus_IPC_Compatibility_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 + * verifies the priority processing levels of onRemoteMessageRequest and onRemoteRequest * @tc.desc Function test * @tc.level 0 */ @@ -5971,7 +5971,7 @@ export default function actsRpcClientJsTest() { console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); - var token = "onRemoteRequest or onRemoteRequestEx invoking"; + var token = "onRemoteRequest or onRemoteMessageRequest invoking"; var result = data.writeString(token); console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700:run writeStringis is " + result); expect(result == true).assertTrue(); @@ -5979,11 +5979,11 @@ export default function actsRpcClientJsTest() { { console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700: gIRemoteObject is undefined"); } - await gIRemoteObject.sendRequest(CODE_ONREMOTEREQUESTEX_OR_ONREMOTEREQUEST, data, reply, option).then((result) => { + await gIRemoteObject.sendRequest(CODE_onRemoteMessageRequest_OR_ONREMOTEREQUEST, data, reply, option).then((result) => { console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readString(); console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700: run readString is " + replyReadResult); - expect(replyReadResult).assertEqual("onRemoteRequestEx invoking"); + expect(replyReadResult).assertEqual("onRemoteMessageRequest invoking"); }); data.reclaim(); reply.reclaim(); @@ -5997,7 +5997,7 @@ export default function actsRpcClientJsTest() { /* * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15800 * @tc.name Invoke the writestring interface to write data to the messageparcel instance. sendMessageRequest asynchronously verifies - * the priority processing levels of onRemoteRequestEx and onRemoteRequest + * the priority processing levels of onRemoteMessageRequest and onRemoteRequest * @tc.desc Function test * @tc.level 0 */ @@ -6008,17 +6008,17 @@ export default function actsRpcClientJsTest() { console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800: create object successfully."); var reply = rpc.MessageSequence.create(); var option = new rpc.MessageOption(); - var token = 'onRemoteRequest or onRemoteRequestEx invoking'; + var token = 'onRemoteRequest or onRemoteMessageRequest invoking'; data.writeString(token); if (gIRemoteObject == undefined) { console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800: gIRemoteObject is undefined"); } - await gIRemoteObject.sendMessageRequest(CODE_ONREMOTEREQUESTEX_OR_ONREMOTEREQUEST, data, reply, option).then((result) => { + await gIRemoteObject.sendMessageRequest(CODE_onRemoteMessageRequest_OR_ONREMOTEREQUEST, data, reply, option).then((result) => { console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readString(); console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800: run readString is " + replyReadResult); - expect(replyReadResult).assertEqual("onRemoteRequestEx invoking"); + expect(replyReadResult).assertEqual("onRemoteMessageRequest invoking"); }); data.reclaim(); reply.reclaim(); diff --git a/communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js b/communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js index b2a68a0d7..815d1a4be 100644 --- a/communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js +++ b/communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js @@ -86,9 +86,9 @@ class Stub extends rpc.RemoteObject { } return false } - onRemoteRequestEx(code, data, reply, option) { + onRemoteMessageRequest(code, data, reply, option) { try{ - console.info("onRemoteRequestEx: " + code) + console.info("onRemoteMessageRequest: " + code) switch(code) { case 1: { @@ -196,10 +196,10 @@ class Stub extends rpc.RemoteObject { data2.writeString(str) listener.sendRequest(1, data2, reply2, option2) .then(function(result) { - console.info("send request done, error code: " + result.errCode ) + console.info("14 send request done, error code: " + result.errCode ) }) .catch(function(e) { - console.error("send request got exception: " + e) + console.error("14 send request got exception: " + e) }) .finally(() => { data2.reclaim() @@ -213,8 +213,8 @@ class Stub extends rpc.RemoteObject { { console.info("case 15 start") let s = new MySequenceable(null, null) - var tmp1 = data.readSequenceable(s) - let result = reply.writeSequenceable(s) + var tmp1 = data.readParcelable(s) + let result = reply.writeParcelable(s) return true } case 16: @@ -231,8 +231,8 @@ class Stub extends rpc.RemoteObject { console.info("case 17 start") var s = [new MySequenceable(null, null), new MySequenceable(null, null), new MySequenceable(null, null)]; - data.readSequenceableArray(s); - let result = reply.writeSequenceableArray(s); + data.readParcelableArray(s); + let result = reply.writeParcelableArray(s); return true } case 18: @@ -245,10 +245,10 @@ class Stub extends rpc.RemoteObject { let reply2 = rpc.MessageParcel.create() listeners[i].sendRequest(1, data2, reply2, option2) .then(function(result) { - console.info("send request done, error code: " + result.errCode + ", index: " + i) + console.info("18 send request done, error code: " + result.errCode + ", index: " + i) }) .catch(function(e) { - console.error("send request got exception: " + e) + console.error("18 send request got exception: " + e) }) .finally(() => { data2.reclaim() @@ -256,7 +256,7 @@ class Stub extends rpc.RemoteObject { console.info("case 18 test done") }) } - console.info("The server's writeRemoteObjectArray result is " + result); + console.info("18 The server's writeRemoteObjectArray result is " + result); return true } case 19: @@ -280,7 +280,7 @@ class Stub extends rpc.RemoteObject { let tmp8 = data.readChar() let tmp9 = data.readString() let s = new MySequenceable(null, null) - let tmp10 = data.readSequenceable(s) + let tmp10 = data.readParcelable(s) let result1 = reply.writeByte(tmp1) let result2 = reply.writeShort(tmp2) let result3 = reply.writeInt(tmp3) @@ -290,7 +290,7 @@ class Stub extends rpc.RemoteObject { let result7 = reply.writeBoolean(tmp7) let result8 = reply.writeChar(tmp8) let result9 = reply.writeString(tmp9) - let result10 = reply.writeSequenceable(s) + let result10 = reply.writeParcelable(s) return true } case 21: @@ -307,7 +307,7 @@ class Stub extends rpc.RemoteObject { let tmp9 = data.readStringArray() let s = [new MySequenceable(null, null), new MySequenceable(null, null), new MySequenceable(null, null)] - let tmp10 = data.readSequenceableArray(s) + let tmp10 = data.readParcelableArray(s) let result1 = reply.writeByteArray(tmp1) let result2 = reply.writeShortArray(tmp2) let result3 = reply.writeIntArray(tmp3) @@ -317,7 +317,7 @@ class Stub extends rpc.RemoteObject { let result7 = reply.writeBooleanArray(tmp7) let result8 = reply.writeCharArray(tmp8) let result9 = reply.writeStringArray(tmp9) - let result10 = reply.writeSequenceableArray(s) + let result10 = reply.writeParcelableArray(s) return true } case 22: @@ -341,8 +341,8 @@ class Stub extends rpc.RemoteObject { { console.info("case 23 start") let s = new MySequenceable(null, null); - var tmp1 = data.readSequenceable(s); - var result = reply.writeSequenceable(s); + var tmp1 = data.readParcelable(s); + var result = reply.writeParcelable(s); return true } case 24: @@ -436,10 +436,10 @@ class Stub extends rpc.RemoteObject { data2.writeString(str) listeners[i].sendRequest(1, data2, reply2, option2) .then(function(result) { - console.info("send request done, error code: " + result.errCode + ", index: " + i) + console.info("30 send request done, error code: " + result.errCode + ", index: " + i) }) .catch(function(e) { - console.error("send request got exception: " + e) + console.error("30 send request got exception: " + e) }) .finally(() => { data2.reclaim() @@ -466,10 +466,10 @@ class Stub extends rpc.RemoteObject { data2.writeString(str) listeners[i].sendRequest(1, data2, reply2, option2) .then(function(result) { - console.info("send request done, error code: " + result.errCode + ", index: " + i) + console.info("31 send request done, error code: " + result.errCode + ", index: " + i) }) .catch(function(e) { - console.error("send request got exception: " + e) + console.error("31 send request got exception: " + e) }) .finally(() => { data2.reclaim() @@ -484,14 +484,14 @@ class Stub extends rpc.RemoteObject { { console.info("case 32 start") let tmp1 = data.readString() - let result = reply.writeString("onRemoteRequestEx invoking") + let result = reply.writeString("onRemoteMessageRequest invoking") return true } default: this.onRemoteRequest(code, data, reply, option) } } catch (error) { - console.info("onRemoteRequestEx: " + error); + console.info("onRemoteMessageRequest: " + error); } return false } -- GitLab