RpcClientJsunit.test.js 449.6 KB
Newer Older
J
jiyong 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * 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';
Z
zhangpa2021 已提交
18
import FA from '@ohos.ability.featureAbility'
Y
yang-qibo 已提交
19
import {describe, expect, beforeAll, it} from 'deccjsunit/index'
Z
zhangpa2021 已提交
20
export default function actsRpcClientJsTest() {
J
jiyong 已提交
21

Y
yang-qibo 已提交
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
    var gIRemoteObject = undefined;

    describe('ActsRpcClientJsTest', function(){
        console.info("-----------------------SUB_Softbus_IPC_Compatibility_MessageParce_Test is starting-----------------------");

        beforeEach(async function (){
            console.info('beforeEach called');
        });

        afterEach(async function (){
            console.info('afterEach called');
        });

        afterAll(async function (){
            console.info('afterAll called');
        });

        const K = 1024;
        const M = 1024*1024;
        const G = 1024*1024*1024;
        const CODE_WRITE_BYTEARRAY = 1;
        const CODE_SAME_PROCESS = 1;
        const CODE_WRITE_INTARRAY = 2;
        const CODE_WRITE_FLOATARRAY = 3;
        const CODE_WRITE_SHORT = 4;
        const CODE_WRITE_LONG = 5;
        const CODE_WRITE_DOUBLE = 6;
        const CODE_WRITE_BOOLEAN = 7;
        const CODE_WRITE_CHAR = 8;
        const CODE_WRITE_STRING = 9;
        const CODE_WRITE_BYTE = 10;
        const CODE_WRITE_INT = 11;
        const CODE_WRITE_FLOAT = 12;
        const CODE_WRITE_RAWDATA = 13;
        const CODE_WRITE_REMOTEOBJECT = 14;
        const CODE_WRITE_SEQUENCEABLE = 15;
        const CODE_WRITE_NOEXCEPTION = 16;
        const CODE_WRITE_SEQUENCEABLEARRAY = 17;
        const CODE_WRITE_REMOTEOBJECTARRAY = 18;
        const CODE_ALL_TYPE = 20;
        const CODE_ALL_ARRAY_TYPE = 21;
        const CODE_IPCSKELETON_INT = 22;
        const CODE_WRITESEQUENCEABLE = 23
        const CODE_WRITE_SHORT_MULTI = 24;
        const CODE_WRITE_BYTE_MULTI = 25;
        const CODE_WRITE_INT_MULTI = 26;
        const CODE_TRANSACTION = 27;
        const CODE_IPCSKELETON = 28;
        const CODE_FILESDIR = 29;
        const CODE_WRITE_REMOTEOBJECTARRAY_1 = 30;
        const CODE_WRITE_REMOTEOBJECTARRAY_2 = 31;
73 74
        const CODE_ONREMOTEMESSAGE_OR_ONREMOTE = 32;
        const CODE_ONREMOTEMESSAGEREQUEST = 33;
Y
yang-qibo 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103

        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)
            return new Promise((resolve, reject) =>{
                console.info("start connect local ability, wait 5 seconds")
                setTimeout(()=>{
                    console.info("resolve proxy: " + gIRemoteObject)
                    resolve(gIRemoteObject)
                }, 5000)
            })
J
jiyong 已提交
104 105
        }

Y
yang-qibo 已提交
106 107 108 109 110 111 112 113 114
        function sleep(numberMillis)
        {
            var now = new Date();
            var exitTime = now.getTime() + numberMillis;
            while (true) {
                now = new Date();
                if (now.getTime() > exitTime)
                    return;
            }
115
        }
Y
yang-qibo 已提交
116

Y
yang-qibo 已提交
117 118 119 120 121 122 123
        class TestRemoteObject extends rpc.RemoteObject {
            constructor(descriptor) {
                super(descriptor);
            }
            asObject(){
                return this;
            }
Y
yang-qibo 已提交
124
        }
J
jiyong 已提交
125

Y
yang-qibo 已提交
126 127 128 129 130 131 132 133 134 135
        class TestProxy {
            remote = rpc.RemoteObject;
            constructor(remote) {
                this.remote = remote;
                console.info("test remote")
            }
            asObject() {
                console.info("server remote")
                return this.remote;
            }
J
jiyong 已提交
136 137
        }

Y
yang-qibo 已提交
138 139 140 141 142
        class MyDeathRecipient {
            constructor(gIRemoteObject, done) {
                this.gIRemoteObject = gIRemoteObject
                this.done = done
            }
J
jiyong 已提交
143

Y
yang-qibo 已提交
144 145 146 147 148 149 150 151
            onRemoteDied() {
                console.info("server died")
                expect(this.proxy.removeDeathRecipient(this, 0)).assertTrue()
                let _done = this.done
                setTimeout(function() {
                    _done()
                }, 1000)
            }
J
jiyong 已提交
152
        }
Z
zhangpa2021 已提交
153

Y
yang-qibo 已提交
154 155 156
        class TestAbilityStub extends rpc.RemoteObject {
            constructor(descriptor) {
                super(descriptor)
Z
zhangpa2021 已提交
157
            }
Y
yang-qibo 已提交
158 159 160 161 162 163

            onRemoteRequest(code, data, reply, option) {
                console.info("TestAbilityStub: onRemoteRequest called, code: " + code)
                let descriptor = data.readInterfaceToken()
                if (descriptor !== "TestAbilityStub") {
                    console.error("received unknown descriptor: " + descriptor)
164
                    return false
165
                }
Y
yang-qibo 已提交
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
                switch (code) {
                    case 1:
                    {
                        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)
                        data.readSequenceable(s)
                        reply.writeNoException()
                        reply.writeByte(tmp1)
                        reply.writeShort(tmp2)
                        reply.writeInt(tmp3)
                        reply.writeLong(tmp4)
                        reply.writeFloat(tmp5)
                        reply.writeDouble(tmp6)
                        reply.writeBoolean(tmp7)
                        reply.writeChar(tmp8)
                        reply.writeString(tmp9)
                        reply.writeSequenceable(s)
                        return true
                    }
                    default:
                    {
                        console.error("default case, code: " + code)
                        return false
                    }
                }
Z
zhangpa2021 已提交
199 200
            }
        }
J
jiyong 已提交
201

Z
zhangpa2021 已提交
202

Y
yang-qibo 已提交
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
        class TestListener extends rpc.RemoteObject {
            constructor(descriptor, checkResult) {
                super(descriptor);
                this.checkResult = checkResult
            }
            onRemoteRequest(code, data, reply, option) {
                let result = false
                if (code  == 1) {
                    console.info("onRemoteRequest called, descriptor: " + this.getInterfaceDescriptor())
                    result = true
                } else {
                    console.info("unknown code: " + code)
                }
                let _checkResult = this.checkResult
                let _num = data.readInt()
                let _str = data.readString()
                setTimeout(function(){
                    _checkResult(_num, _str)
                }, 2*1000);
                return result
            }
J
jiyong 已提交
224 225
        }

Y
yang-qibo 已提交
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
        class MySequenceable {
            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;
            }
241
        }
242

Y
yang-qibo 已提交
243 244 245 246 247
        function assertArrayElementEqual(actual, expected) {
            expect(actual.length).assertEqual(expected.length)
            for (let i = 0; i < actual.length; i++) {
                expect(actual[i]).assertEqual(expected[i])
            }
248
        }
Y
yang-qibo 已提交
249 250 251 252 253 254 255 256 257 258

        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")
J
jiyong 已提交
259 260
        })

Y
yang-qibo 已提交
261
        /*
Z
zhangpa2021 已提交
262
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_00100
Z
zhangpa2021 已提交
263 264 265 266
     * @tc.name    Call the writeinterfacetoken interface, write the interface descriptor, and read interfacetoken
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
267 268 269 270 271
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_00100", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00100: create object successfully.");
Z
zhangpa2021 已提交
272

Y
yang-qibo 已提交
273 274 275 276
                var token = "hello ruan zong xian";
                var result = data.writeInterfaceToken(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00100:run writeInterfaceToken result is " + result);
                expect(result).assertTrue();
Z
zhangpa2021 已提交
277

Y
yang-qibo 已提交
278 279 280
                var resultToken = data.readInterfaceToken();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00100:run readInterfaceToken result is " + resultToken);
                expect(resultToken).assertEqual(token);
Z
zhangpa2021 已提交
281

Y
yang-qibo 已提交
282 283 284 285 286 287
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00100:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00100---------------------------");
        });
Y
yang-qibo 已提交
288

Y
yang-qibo 已提交
289
        /*
Z
zhangpa2021 已提交
290
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_00200
Y
yang-qibo 已提交
291 292 293 294
     * @tc.name    Call the writeinterfacetoken interface, write the interface descriptor, and read interfacetoken
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
295 296 297 298 299 300
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_00200", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00200---------------------------");
            try{
                for (let i = 0; i<5; i++){
                    var data = rpc.MessageParcel.create();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00200: create object successfully.");
Y
yang-qibo 已提交
301

Y
yang-qibo 已提交
302 303 304 305
                    var token = "hello ruan zong xian";
                    var result = data.writeInterfaceToken(token);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00200:run writeInterfaceToken result is " + result);
                    expect(result).assertTrue();
Y
yang-qibo 已提交
306

Y
yang-qibo 已提交
307 308 309
                    var resultToken = data.readInterfaceToken();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00200:run readInterfaceToken result is " + resultToken);
                    expect(resultToken).assertEqual(token);
Y
yang-qibo 已提交
310

Y
yang-qibo 已提交
311 312 313 314
                    data.reclaim();
                }
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00200:error = " + error);
Y
yang-qibo 已提交
315
            }
Y
yang-qibo 已提交
316 317
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00200---------------------------");
        });
Z
zhangpa2021 已提交
318

Y
yang-qibo 已提交
319
        /*
Z
zhangpa2021 已提交
320
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_00300
Z
zhangpa2021 已提交
321
     * @tc.name    Call the writeinterfacetoken interface to write a non string interface descriptor
Y
yang-qibo 已提交
322
                   and read interfacetoken
Z
zhangpa2021 已提交
323 324 325
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
326 327 328 329 330
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_00300", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00300: create object successfully.");
Y
yang-qibo 已提交
331

Y
yang-qibo 已提交
332 333 334 335 336 337 338
                var token = "";
                for(let i = 0; i < (40*K -1); i++){
                    token += 'a';
                };
                var result = data.writeInterfaceToken(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00300:run writeInterfaceToken is" + result);
                expect(result).assertTrue();
Y
yang-qibo 已提交
339

Y
yang-qibo 已提交
340 341 342 343 344 345 346 347 348
                var resultToken = data.readInterfaceToken();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00300:run readInterfaceToken is " + resultToken.length);
                expect(resultToken).assertEqual(token);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00300: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00300---------------------------");
        });
Y
yang-qibo 已提交
349

Y
yang-qibo 已提交
350
        /*
Z
zhangpa2021 已提交
351
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_00400
Y
yang-qibo 已提交
352 353 354 355 356
     * @tc.name    The WriteInterfaceToken interface is called, the exceeding-length interface descriptor is written,
                    and the InterfaceToken is read
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
357 358 359 360 361
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_00400", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00400: create object successfully.");
Y
yang-qibo 已提交
362

Y
yang-qibo 已提交
363 364 365 366 367 368 369 370 371 372 373 374 375 376
                var token = "";
                for(let i = 0; i < 40*K; i++){
                    token += 'a';
                };
                var result = data.writeInterfaceToken(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00400:run writeInterfaceToken is " + result);
                expect(result).assertEqual(false);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00400: error = " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00400---------------------------");
        });
Z
zhangpa2021 已提交
377

Y
yang-qibo 已提交
378
        /*
Z
zhangpa2021 已提交
379
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_00500
Y
yang-qibo 已提交
380 381 382 383 384
     * @tc.name    Call the writeinterfacetoken interface to write a non string interface descriptor
                   and read interfacetoken
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
385 386 387 388 389
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_00500", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00500: create object successfully.");
Z
zhangpa2021 已提交
390

Y
yang-qibo 已提交
391 392 393 394 395 396 397 398 399 400 401
                var token = 123;
                var result = data.writeInterfaceToken(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00500:run writeInterfaceToken is " + result);
                expect(result).assertEqual(false);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00500: error = " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00500---------------------------");
        });
Z
zhangpa2021 已提交
402

Y
yang-qibo 已提交
403
        /*
Z
zhangpa2021 已提交
404
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_00600
Z
zhangpa2021 已提交
405 406 407 408
     * @tc.name    The data size of the messageparcel obtained by calling the getSize interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
409 410 411 412 413
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_00600", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00600: create object successfully.");
Z
zhangpa2021 已提交
414

Y
yang-qibo 已提交
415 416 417
                var size = data.getSize();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00600:run getSize is " + size);
                expect(size).assertEqual(0);
Z
zhangpa2021 已提交
418

Y
yang-qibo 已提交
419 420 421 422
                var addData = 1;
                var result = data.writeInt(addData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00600:run writeInt is " + result);
                expect(result).assertTrue();
Z
zhangpa2021 已提交
423

Y
yang-qibo 已提交
424 425 426
                size = data.getSize();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00600:run getSize is " + size);
                expect(size).assertEqual(4);
Z
zhangpa2021 已提交
427

Y
yang-qibo 已提交
428 429 430 431 432 433
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00600: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00600---------------------------");
        });
Z
zhangpa2021 已提交
434

Y
yang-qibo 已提交
435
        /*
Z
zhangpa2021 已提交
436
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_00700
Z
zhangpa2021 已提交
437 438 439 440
     * @tc.name    The capacity of the messageparcel obtained by calling the getcapacity interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
441 442 443 444 445
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_00700", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00700: create object successfully.");
Z
zhangpa2021 已提交
446

Y
yang-qibo 已提交
447 448 449
                var size = data.getCapacity();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00700:run getCapacity is " + size);
                expect(size).assertEqual(0);
Z
zhangpa2021 已提交
450

Y
yang-qibo 已提交
451 452 453 454
                var addData = 1;
                var result = data.writeInt(addData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00700:run writeInt is " + result);
                expect(result).assertTrue();
Z
zhangpa2021 已提交
455

Y
yang-qibo 已提交
456 457 458
                size = data.getCapacity();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00700:run getCapacity is " + size);
                expect(size).assertEqual(64);
Z
zhangpa2021 已提交
459

Y
yang-qibo 已提交
460 461 462 463 464 465
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00700: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00700---------------------------");
        });
Z
zhangpa2021 已提交
466

Y
yang-qibo 已提交
467
        /*
Z
zhangpa2021 已提交
468
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_00800
Z
zhangpa2021 已提交
469 470 471 472
     * @tc.name    Call the SetSize interface to set the data size of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
473 474 475 476 477
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_00800", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00800: create object successfully.");
Z
zhangpa2021 已提交
478

Y
yang-qibo 已提交
479 480 481 482
                var addData = 1;
                var result = data.writeInt(addData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00800:run writeInt is " + result);
                expect(result).assertTrue();
Z
zhangpa2021 已提交
483

Y
yang-qibo 已提交
484 485 486 487
                var size = 6;
                var setResult = data.setSize(size);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00800:run setSize " + setResult);
                expect(setResult).assertTrue();
Z
zhangpa2021 已提交
488

Y
yang-qibo 已提交
489 490 491 492 493 494
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00800: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00800---------------------------");
        });
Y
yang-qibo 已提交
495

Y
yang-qibo 已提交
496
        /*
Z
zhangpa2021 已提交
497
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_00900
Y
yang-qibo 已提交
498 499 500 501
     * @tc.name    Call the SetSize interface to set the data size of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
502 503 504 505 506
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_00900", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00900: create object successfully.");
Y
yang-qibo 已提交
507

Y
yang-qibo 已提交
508 509 510 511
                var addData = 1;
                var result = data.writeInt(addData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00900:run writeInt is " + result);
                expect(result).assertTrue();
Y
yang-qibo 已提交
512

Y
yang-qibo 已提交
513 514 515 516
                var size = 4*G;
                var setResult = data.setSize(size);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00900:run setSize " + setResult);
                expect(setResult).assertTrue();
Y
yang-qibo 已提交
517

Y
yang-qibo 已提交
518 519 520 521 522 523
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00900: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00900---------------------------");
        });
Y
yang-qibo 已提交
524

Y
yang-qibo 已提交
525
        /*
Z
zhangpa2021 已提交
526
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_01000
Y
yang-qibo 已提交
527 528 529 530
     * @tc.name    Call the SetSize interface to set the data size of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
531 532 533 534 535
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_01000", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01000: create object successfully.");
Y
yang-qibo 已提交
536

Y
yang-qibo 已提交
537 538 539 540
                var addData = 1;
                var result = data.writeInt(addData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01000:run writeInt is " + result);
                expect(result).assertTrue();
Y
yang-qibo 已提交
541

Y
yang-qibo 已提交
542 543 544 545 546 547 548 549 550 551
                var size = 4*G - 4;
                var setResult = data.setSize(size);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01000:run setSize " + setResult);
                expect(setResult).assertEqual(false);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01000: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01000---------------------------");
        });
Z
zhangpa2021 已提交
552

Y
yang-qibo 已提交
553
        /*
Z
zhangpa2021 已提交
554
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_01100
Z
zhangpa2021 已提交
555
     * @tc.name    Call the SetSize interface to set the data size of messageparcel. The write data size
Y
yang-qibo 已提交
556
                   does not match the set value
Z
zhangpa2021 已提交
557 558 559
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
560 561 562 563 564
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_01100", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01100: create object successfully.");
Z
zhangpa2021 已提交
565

Y
yang-qibo 已提交
566 567 568 569
                var capacity = 64;
                var setResult = data.setCapacity(capacity);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01100:run setCapacity " + setResult);
                expect(setResult).assertTrue();
Z
zhangpa2021 已提交
570

Y
yang-qibo 已提交
571 572 573 574
                var size = 4;
                setResult = data.setSize(size);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01100:run setSize " + setResult);
                expect(setResult).assertTrue();
Z
zhangpa2021 已提交
575

Y
yang-qibo 已提交
576 577 578 579
                var addData = 2;
                var result = data.writeLong(addData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01100:run writeInt is " + result);
                expect(result).assertTrue();
Z
zhangpa2021 已提交
580

Y
yang-qibo 已提交
581 582 583 584 585 586
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01100: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01100---------------------------");
        });
Z
zhangpa2021 已提交
587

Y
yang-qibo 已提交
588
        /*
Z
zhangpa2021 已提交
589
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_01200
Z
zhangpa2021 已提交
590 591 592 593
     * @tc.name    Call the setcapacity interface to set the capacity of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
594 595 596 597 598
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_01200", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01200: create object successfully.");
Z
zhangpa2021 已提交
599

Y
yang-qibo 已提交
600 601 602 603
                var size = 64;
                var setResult = data.setCapacity(size);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01200:run setSize " + setResult);
                expect(setResult).assertTrue();
Z
zhangpa2021 已提交
604

Y
yang-qibo 已提交
605 606 607 608
                var addData = 1;
                var result = data.writeInt(addData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01200:run writeInt is " + result);
                expect(result).assertTrue();
Z
zhangpa2021 已提交
609

Y
yang-qibo 已提交
610 611 612 613 614 615
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01200: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01200---------------------------");
        });
Y
yang-qibo 已提交
616

Y
yang-qibo 已提交
617
        /*
Z
zhangpa2021 已提交
618
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_01300
Y
yang-qibo 已提交
619 620 621 622
     * @tc.name    Call the setcapacity interface to set the capacity of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
623 624 625 626 627
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_01300", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01300: create object successfully.");
Y
yang-qibo 已提交
628

Y
yang-qibo 已提交
629 630 631 632
                var size = M;
                var setResult = data.setCapacity(size);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01300:run setSize " + setResult);
                expect(setResult).assertTrue();
Y
yang-qibo 已提交
633

Y
yang-qibo 已提交
634 635 636 637
                var addData = 1;
                var result = data.writeInt(addData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01300:run writeInt is " + result);
                expect(result).assertTrue();
Y
yang-qibo 已提交
638

Y
yang-qibo 已提交
639 640 641 642 643 644
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01300: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01300---------------------------");
        });
Y
yang-qibo 已提交
645

Y
yang-qibo 已提交
646
        /*
Z
zhangpa2021 已提交
647
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_01400
Y
yang-qibo 已提交
648 649 650 651
     * @tc.name    Call the setcapacity interface to set the capacity of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
652 653 654 655 656
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_01400", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01400: create object successfully.");
Y
yang-qibo 已提交
657

Y
yang-qibo 已提交
658 659 660 661
                var size = 4*G;
                var setResult = data.setCapacity(size);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01400:run setSize " + setResult);
                expect(setResult).assertEqual(false);
Y
yang-qibo 已提交
662

Y
yang-qibo 已提交
663 664 665 666 667 668
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01400: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01400---------------------------");
        });
Z
zhangpa2021 已提交
669

Y
yang-qibo 已提交
670
        /*
Z
zhangpa2021 已提交
671
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_01500
Y
yang-qibo 已提交
672
     * @tc.name    Call the setcapacity interface to set the capacity of messageparcel.
Z
zhangpa2021 已提交
673 674 675 676
     *             The write data capacity is inconsistent with the set value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
677 678 679 680 681
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_01500", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01500: create object successfully.");
Z
zhangpa2021 已提交
682

Y
yang-qibo 已提交
683 684 685 686
                var size = 4;
                var setResult = data.setCapacity(size);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01500:run setSize " + setResult);
                expect(setResult).assertTrue();
Z
zhangpa2021 已提交
687

Y
yang-qibo 已提交
688 689 690 691
                var addData = [1, 2, 3, 4, 5, 6, 7, 8];
                var result = data.writeIntArray(addData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01500:run writeInt is " + result);
                expect(result).assertEqual(false);
Z
zhangpa2021 已提交
692

Y
yang-qibo 已提交
693 694 695 696 697 698 699
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01500: error = " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01500---------------------------");
        });
Z
zhangpa2021 已提交
700

Y
yang-qibo 已提交
701
        /*
Z
zhangpa2021 已提交
702
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_01600
Y
yang-qibo 已提交
703
     * @tc.name    Empty object to obtain the readable byte space, read location,
Z
zhangpa2021 已提交
704 705 706 707
     *             writable byte space and write location information of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
708 709 710 711 712
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_01600", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: create object successfully.");
Z
zhangpa2021 已提交
713

Y
yang-qibo 已提交
714 715 716 717 718 719
                var result1 = data.getWritableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: run getWritableBytes is " + result1);
                expect(result1).assertEqual(0);
                var result2 = data.getReadableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: run getReadableBytes is " + result2);
                expect(result2).assertEqual(0);
Z
zhangpa2021 已提交
720

Y
yang-qibo 已提交
721 722 723
                var result3 = data.getReadPosition();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: run getReadPosition is " + result2);
                expect(result3).assertEqual(0);
Z
zhangpa2021 已提交
724

Y
yang-qibo 已提交
725 726 727
                var result4 = data.getWritePosition();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: run getWritePosition is " + result2);
                expect(result4).assertEqual(0);
Z
zhangpa2021 已提交
728

Y
yang-qibo 已提交
729 730 731 732 733 734
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01600---------------------------");
        });
Z
zhangpa2021 已提交
735

Y
yang-qibo 已提交
736
        /*
Z
zhangpa2021 已提交
737
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_01700
Y
yang-qibo 已提交
738
     * @tc.name    Create an object and write data to obtain the readable byte space, read location,
Z
zhangpa2021 已提交
739 740 741 742
     *             writable byte space and write location information of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
743 744 745 746 747
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_01700", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: create object successfully.");
Z
zhangpa2021 已提交
748

Y
yang-qibo 已提交
749 750 751
                var dataInt = 1;
                var resultInt = data.writeInt(dataInt);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run writeInt is " + resultInt);
Z
zhangpa2021 已提交
752

Y
yang-qibo 已提交
753 754 755
                var dataLong = 2;
                var resultLong = data.writeLong(dataLong);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run writeLong is " + resultLong);
Z
zhangpa2021 已提交
756

Y
yang-qibo 已提交
757 758 759
                var result1 = data.getWritableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run getWritableBytes is " + result1);
                expect(result1).assertEqual(52);
Z
zhangpa2021 已提交
760

Y
yang-qibo 已提交
761 762 763
                var result2 = data.getReadableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run getReadableBytes is " + result2);
                expect(result2).assertEqual(12);
Z
zhangpa2021 已提交
764

Y
yang-qibo 已提交
765 766 767
                var result3 = data.getReadPosition();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run getReadPosition is " + result3);
                expect(result3).assertEqual(0);
Z
zhangpa2021 已提交
768

Y
yang-qibo 已提交
769 770 771
                var result4 = data.getWritePosition();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run getWritePosition is " + result4);
                expect(result4).assertEqual(12);
Z
zhangpa2021 已提交
772

Y
yang-qibo 已提交
773 774 775 776 777 778
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01700---------------------------");
        });
Z
zhangpa2021 已提交
779

Y
yang-qibo 已提交
780
        /*
Z
zhangpa2021 已提交
781
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_01800
Z
zhangpa2021 已提交
782 783 784 785
     * @tc.name    Call rewindread interface to offset the read position to the specified position
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_01800", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                expect(data.getWritableBytes()).assertEqual(0);
                expect(data.getReadableBytes()).assertEqual(0);
                expect(data.getReadPosition()).assertEqual(0);
                expect(data.getWritePosition()).assertEqual(0);

                var dataInt = 1;
                var resultInt = data.writeInt(dataInt);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run writeInt is " + resultInt);
                var dataLong = 2;
                var resultLong = data.writeLong(dataLong);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run writeLong is " + resultLong);

                expect(data.getWritableBytes()).assertEqual(52);
                expect(data.getReadableBytes()).assertEqual(12);
                expect(data.getReadPosition()).assertEqual(0);
                expect(data.getWritePosition()).assertEqual(12);

                var readIntData = data.readInt();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run readInt is " + readIntData);
                expect(readIntData).assertEqual(dataInt);

                var writePosition = 0;
                var writeResult = data.rewindWrite(writePosition);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run rewindWrite is " + writeResult);
                expect(writeResult).assertTrue();

                expect(data.getWritePosition()).assertEqual(0);
                dataInt = 3;
                resultInt = data.writeInt(dataInt);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run writeInt is " + resultInt);

                var readPosition = 0;
                var readResult = data.rewindRead(readPosition);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run rewindWrite is " + readResult);
                expect(readResult).assertTrue();

                readIntData = data.readInt();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run readInt is " + readIntData);
                expect(readIntData).assertEqual(dataInt);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01800---------------------------");
        });
Z
zhangpa2021 已提交
835

Y
yang-qibo 已提交
836
        /*
Z
zhangpa2021 已提交
837
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_01900
Z
zhangpa2021 已提交
838
     * @tc.name    The rewindread interface is called to re offset the read position to the specified position.
Y
yang-qibo 已提交
839
                   The specified position is out of range
Z
zhangpa2021 已提交
840 841 842
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_01900", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: create object successfully.");

                var result1 = data.getWritableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getWritableBytes is " + result1);
                expect(result1 == 0).assertTrue();
                var result2 = data.getReadableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getReadableBytes is " + result2);
                expect(result2 == 0).assertTrue();
                var result3 = data.getReadPosition();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getReadPosition is " + result3);
                expect(result3 == 0).assertTrue();
                var result4 = data.getWritePosition();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getWritePosition is " + result4);
                expect(result4 == 0).assertTrue();

                var dataInt = 1;
                var resultInt = data.writeInt(dataInt);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run writeInt is " + resultInt);
                expect(resultInt).assertTrue();
                var dataLong = 2;
                var resultLong = data.writeLong(dataLong);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run writeLong is " + resultLong);
                expect(resultLong).assertTrue();

                result1 = data.getWritableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getWritableBytes is " + result1);
                expect(result1 == 52).assertTrue();
                result2 = data.getReadableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getReadableBytes is " + result2);
                expect(result2 == 12).assertTrue();
                result3 = data.getReadPosition();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getReadPosition is " + result3);
                expect(result3 == 0).assertTrue();
                result4 = data.getWritePosition();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getWritePosition is " + result4);
                expect(result4 == 12).assertTrue();

                var readPosition = 100;
                var readResult = data.rewindRead(readPosition);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run rewindRead is " + readResult);
                expect(readResult == false).assertTrue();
Z
zhangpa2021 已提交
888

Y
yang-qibo 已提交
889 890 891 892 893 894
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01900---------------------------");
        });
Z
zhangpa2021 已提交
895

Y
yang-qibo 已提交
896
        /*
Z
zhangpa2021 已提交
897
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_02000
Z
zhangpa2021 已提交
898 899 900 901
     * @tc.name    Call rewindwrite and the interface offsets the write position to the specified position
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
902 903 904 905 906
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_02000", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: create object successfully.");
Z
zhangpa2021 已提交
907

Y
yang-qibo 已提交
908 909 910 911
                var dataInt = 1;
                var resultInt = data.writeInt(dataInt);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run writeInt is " + resultInt);
                expect(resultInt).assertTrue();
Z
zhangpa2021 已提交
912

Y
yang-qibo 已提交
913 914 915
                var readIntData = data.readInt();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run readInt is " + readIntData);
                expect(readIntData).assertEqual(dataInt);
Z
zhangpa2021 已提交
916

Y
yang-qibo 已提交
917 918 919 920
                var writePosition = 0;
                var rewindWriteResult = data.rewindWrite(writePosition);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run rewindWrite is" + rewindWriteResult);
                expect(rewindWriteResult).assertTrue();
Z
zhangpa2021 已提交
921

Y
yang-qibo 已提交
922 923 924 925
                dataInt = 3;
                resultInt = data.writeInt(dataInt);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run writeInt is " + resultInt);
                expect(resultInt).assertTrue();
Z
zhangpa2021 已提交
926

Y
yang-qibo 已提交
927 928 929 930
                var readPosition = 0;
                var rewindReadResult = data.rewindRead(readPosition);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run rewindRead is " + rewindReadResult);
                expect(rewindReadResult);
Z
zhangpa2021 已提交
931

Y
yang-qibo 已提交
932 933 934
                readIntData = data.readInt();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run readInt is " + readIntData);
                expect(readIntData).assertEqual(dataInt);
Z
zhangpa2021 已提交
935

Y
yang-qibo 已提交
936 937 938 939 940 941
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02000---------------------------");
        });
Z
zhangpa2021 已提交
942

Y
yang-qibo 已提交
943
        /*
Z
zhangpa2021 已提交
944
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_02100
Z
zhangpa2021 已提交
945
     * @tc.name    Call rewindwrite and the interface offsets the write position to the specified position.
Y
yang-qibo 已提交
946
                   The specified position is out of range
Z
zhangpa2021 已提交
947 948 949
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
950 951 952 953 954
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_02100", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02100: create object successfully.");
Z
zhangpa2021 已提交
955

Y
yang-qibo 已提交
956 957 958 959
                var dataInt = 1;
                var resultInt = data.writeInt(dataInt);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02100: run writeInt result is " + resultInt);
                expect(resultInt).assertTrue();
Z
zhangpa2021 已提交
960

Y
yang-qibo 已提交
961 962 963
                var readIntData = data.readInt();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02100: run readInt is" + readIntData);
                expect(readIntData == dataInt).assertTrue();
Z
zhangpa2021 已提交
964

Y
yang-qibo 已提交
965 966 967 968
                var writePosition = 99;
                var rewindWriteResult = data.rewindWrite(writePosition);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02100: run rewindWrite is " + rewindWriteResult);
                expect(rewindWriteResult).assertEqual(false);
Z
zhangpa2021 已提交
969

Y
yang-qibo 已提交
970 971 972 973 974 975
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02100: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02100---------------------------");
        });
Z
zhangpa2021 已提交
976

Y
yang-qibo 已提交
977
        /*
Z
zhangpa2021 已提交
978
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_02200
Y
yang-qibo 已提交
979
     * @tc.name    Call the writeshortarray interface, write the array to the messageparcel instance,
Z
zhangpa2021 已提交
980 981 982 983
     *             and call readshortarray to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
984 985 986 987 988
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_02200", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02200: create object successfully.");
Z
zhangpa2021 已提交
989

Y
yang-qibo 已提交
990 991 992 993 994
                var wShortArryData = [3, 5, 9];
                var writeShortArrayResult = data.writeShortArray(wShortArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02200: run writeShortArray "
                    + writeShortArrayResult);
                expect(writeShortArrayResult).assertTrue();
Y
yang-qibo 已提交
995

Y
yang-qibo 已提交
996 997 998
                var rShortArryData = data.readShortArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02200: run readShortArray is " + rShortArryData);
                assertArrayElementEqual(rShortArryData,wShortArryData);
Y
yang-qibo 已提交
999

Y
yang-qibo 已提交
1000 1001 1002 1003 1004 1005
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02200: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02200---------------------------");
        });
Z
zhangpa2021 已提交
1006

Y
yang-qibo 已提交
1007
        /*
Z
zhangpa2021 已提交
1008
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_02300
Y
yang-qibo 已提交
1009
     * @tc.name    Call the writeshortarray interface, write the short integer array to the messageparcel instance,
Z
zhangpa2021 已提交
1010 1011 1012 1013
     *             and call readshortarray (datain: number []) to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1014 1015 1016 1017 1018
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_02300", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02300: create object successfully.");
Z
zhangpa2021 已提交
1019

Y
yang-qibo 已提交
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035
                var wShortArryData = [];
                for(let i=0;i<(50*K - 1);i++){
                    wShortArryData[i] = 1;
                }
                var writeShortArrayResult = data.writeShortArray(wShortArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02300: run writeShortArray "
                    + writeShortArrayResult);
                expect(writeShortArrayResult).assertTrue();

                var rShortArryData = [];
                data.readShortArray(rShortArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02300: run readShortArray is " + rShortArryData.length);
                assertArrayElementEqual(rShortArryData,wShortArryData);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02300: error " + error);
Y
yang-qibo 已提交
1036
            }
Y
yang-qibo 已提交
1037 1038
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02300---------------------------");
        });
Z
zhangpa2021 已提交
1039

Y
yang-qibo 已提交
1040
        /*
Z
zhangpa2021 已提交
1041
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_02400
Z
zhangpa2021 已提交
1042 1043 1044 1045
     * @tc.name    Writeshortarray interface, boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1046 1047 1048 1049 1050
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_02400", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02400: create object successfully.");
Z
zhangpa2021 已提交
1051

Y
yang-qibo 已提交
1052 1053 1054 1055
                var wShortArryData = [-32768, 0, 1, 2, 32767];
                var writeShortArrayResult = data.writeShortArray(wShortArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02400: run writeShortArray is " + writeShortArrayResult);
                expect(writeShortArrayResult).assertTrue();
Y
yang-qibo 已提交
1056

Y
yang-qibo 已提交
1057 1058 1059 1060
                var rShortArryData = [];
                data.readShortArray(rShortArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02400: run readShortArray is " + rShortArryData);
                assertArrayElementEqual(rShortArryData,wShortArryData);
Y
yang-qibo 已提交
1061

Y
yang-qibo 已提交
1062 1063 1064 1065 1066 1067
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02400: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02400---------------------------");
        });
Z
zhangpa2021 已提交
1068

Y
yang-qibo 已提交
1069
        /*
Z
zhangpa2021 已提交
1070
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_02500
Z
zhangpa2021 已提交
1071 1072 1073 1074
     * @tc.name    Writeshortarray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_02500", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02500: create object successfully.");

                var wShortArryData = [-32769, 0, 1, 2];
                var writeShortArrayResult = data.writeShortArray(wShortArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02500: run writeShortArray is " + writeShortArrayResult);
                expect(writeShortArrayResult).assertTrue();
                var rShotrArrayData = data.readShortArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02500: run readShortArray is " + rShotrArrayData);
                expect(32767).assertEqual(rShotrArrayData[0]);
                expect(wShortArryData[1]).assertEqual(rShotrArrayData[1]);
                expect(wShortArryData[2]).assertEqual(rShotrArrayData[2]);
                expect(wShortArryData[3]).assertEqual(rShotrArrayData[3]);
1091

Y
yang-qibo 已提交
1092 1093 1094 1095
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02500: error = " + error);
            }
Z
zhangpa2021 已提交
1096

Y
yang-qibo 已提交
1097 1098
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02500---------------------------");
        });
Z
zhangpa2021 已提交
1099

Y
yang-qibo 已提交
1100
        /*
Z
zhangpa2021 已提交
1101
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_02600
Y
yang-qibo 已提交
1102
     * @tc.name    Writeshortarray interface, illegal value validation
Z
zhangpa2021 已提交
1103 1104 1105
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1106 1107 1108 1109 1110
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_02600", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02600: create object successfully.");
Z
zhangpa2021 已提交
1111

Y
yang-qibo 已提交
1112 1113 1114 1115
                var wShortArryData = [0, 1, 2, 32768];
                var writeShortArrayResult = data.writeShortArray(wShortArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02600: run writeShortArray is " + writeShortArrayResult);
                expect(writeShortArrayResult).assertTrue();
Z
zhangpa2021 已提交
1116

Y
yang-qibo 已提交
1117 1118 1119 1120 1121 1122
                var rShotrArrayData = data.readShortArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02600: run readShortArray " + rShotrArrayData);
                expect(wShortArryData[0]).assertEqual(rShotrArrayData[0]);
                expect(wShortArryData[1]).assertEqual(rShotrArrayData[1]);
                expect(wShortArryData[2]).assertEqual(rShotrArrayData[2]);
                expect(-32768).assertEqual(rShotrArrayData[3]);
Z
zhangpa2021 已提交
1123

Y
yang-qibo 已提交
1124 1125 1126 1127 1128 1129
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02600: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02600---------------------------");
        });
Z
zhangpa2021 已提交
1130

Y
yang-qibo 已提交
1131
        /*
Z
zhangpa2021 已提交
1132
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_02700
Y
yang-qibo 已提交
1133
     * @tc.name    Writeshortarray interface, illegal value validation
Z
zhangpa2021 已提交
1134 1135 1136
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1137 1138 1139 1140 1141
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_02700", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02700: create object successfully.");
Z
zhangpa2021 已提交
1142

Y
yang-qibo 已提交
1143 1144 1145 1146 1147 1148 1149
                var wShortArryData = [];
                for (let i = 0; i < 50*K; i++){
                    wShortArryData[i] = 11111;
                }
                var writeShortArrayResult = data.writeShortArray(wShortArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02700: run writeShortArray " + writeShortArrayResult);
                expect(writeShortArrayResult).assertEqual(false);
1150

Y
yang-qibo 已提交
1151 1152 1153 1154 1155 1156 1157
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02700: error = " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02700---------------------------");
        });
Z
zhangpa2021 已提交
1158

Y
yang-qibo 已提交
1159
        /*
Z
zhangpa2021 已提交
1160
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_02800
Y
yang-qibo 已提交
1161 1162
     * @tc.name    Call the writelongarray interface, write the long integer array to the messageparcel instance,
     *             and call readlongarray to read the data
Z
zhangpa2021 已提交
1163 1164 1165
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1166 1167 1168 1169 1170
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_02800", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02800: create object successfully.");
Y
yang-qibo 已提交
1171

Y
yang-qibo 已提交
1172 1173 1174 1175 1176 1177 1178
                var LongArryData = [];
                for (let i = 0;i<(25*K - 1);i++){
                    LongArryData[i] = 11;
                }
                var WriteLongArray = data.writeLongArray(LongArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03200: run writeShortArray  is " + WriteLongArray);
                expect(WriteLongArray).assertTrue();
Z
zhangpa2021 已提交
1179

Y
yang-qibo 已提交
1180 1181 1182
                var rLongArryData = data.readLongArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03200: run readShortArray is " + rLongArryData.length);
                assertArrayElementEqual(LongArryData,rLongArryData);
Z
zhangpa2021 已提交
1183

Y
yang-qibo 已提交
1184 1185 1186 1187 1188 1189
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02800: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02800---------------------------");
        });
Z
zhangpa2021 已提交
1190

Y
yang-qibo 已提交
1191
        /*
Z
zhangpa2021 已提交
1192
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_02900
Y
yang-qibo 已提交
1193
     * @tc.name    Writelongarray interface, boundary value verification
Z
zhangpa2021 已提交
1194 1195 1196
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1197 1198 1199 1200 1201
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_02900", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02900: create object successfully.");
Z
zhangpa2021 已提交
1202

Y
yang-qibo 已提交
1203 1204 1205 1206
                var wLongArryData = [-2147483648, 0, 1, 2, 2147483647];
                var writeLongArrayResult = data.writeLongArray(wLongArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02900: run writeShortArrayis is " + writeLongArrayResult);
                expect(writeLongArrayResult).assertTrue();
Y
yang-qibo 已提交
1207

Y
yang-qibo 已提交
1208 1209 1210
                var rLongArryData = data.readLongArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02900: run readShortArray is " + rLongArryData);
                assertArrayElementEqual(wLongArryData,rLongArryData);
Y
yang-qibo 已提交
1211

Y
yang-qibo 已提交
1212 1213 1214 1215 1216 1217
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02900: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02900---------------------------");
        });
Z
zhangpa2021 已提交
1218

Y
yang-qibo 已提交
1219
        /*
Z
zhangpa2021 已提交
1220
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_03000
Y
yang-qibo 已提交
1221
     * @tc.name    Writelongarray interface, illegal value validation
Z
zhangpa2021 已提交
1222 1223 1224
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1225 1226 1227 1228 1229
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_03000", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03000: create object successfully.");
Z
zhangpa2021 已提交
1230

Y
yang-qibo 已提交
1231 1232 1233 1234
                var errorLongArryData = [-2147483649, 0, 1, 2, 3];
                var erWriteLongArray = data.writeLongArray(errorLongArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03000: run writeShortArrayis is " + erWriteLongArray);
                expect(erWriteLongArray).assertTrue();
Y
yang-qibo 已提交
1235

Y
yang-qibo 已提交
1236 1237 1238
                var erLongArryData = data.readLongArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03000: run readShortArray is " + erLongArryData);
                assertArrayElementEqual(errorLongArryData,erLongArryData);
Y
yang-qibo 已提交
1239

Y
yang-qibo 已提交
1240 1241 1242 1243 1244 1245
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03000: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03000---------------------------");
        });
Z
zhangpa2021 已提交
1246

Y
yang-qibo 已提交
1247
        /*
Z
zhangpa2021 已提交
1248
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_03100
Y
yang-qibo 已提交
1249
     * @tc.name    Writelongarray interface, illegal value validation
Z
zhangpa2021 已提交
1250 1251 1252
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1253 1254 1255 1256 1257
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_03100", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03100: create object successfully.");
Z
zhangpa2021 已提交
1258

Y
yang-qibo 已提交
1259 1260 1261 1262
                var errorLongArryData = [0, 1, 2, 3, 2147483648];
                var erWriteLongArray = data.writeLongArray(errorLongArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03100: run writeShortArrayis is " + erWriteLongArray);
                expect(erWriteLongArray).assertTrue();
Y
yang-qibo 已提交
1263

Y
yang-qibo 已提交
1264 1265 1266
                var erLongArryData = data.readLongArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03100: run readShortArray is " + erLongArryData);
                assertArrayElementEqual(errorLongArryData,erLongArryData);
Y
yang-qibo 已提交
1267

Y
yang-qibo 已提交
1268 1269 1270 1271 1272 1273
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03100: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03100---------------------------");
        });
Z
zhangpa2021 已提交
1274

Y
yang-qibo 已提交
1275
        /*
Z
zhangpa2021 已提交
1276
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_03200
Y
yang-qibo 已提交
1277
     * @tc.name    Writelongarray interface, illegal value validation
Z
zhangpa2021 已提交
1278 1279 1280
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1281 1282 1283 1284 1285
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_03200", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03200: create object successfully.");
Z
zhangpa2021 已提交
1286

Y
yang-qibo 已提交
1287 1288 1289 1290 1291 1292 1293
                var errorLongArryData = [];
                for (let i = 0;i<25*K;i++){
                    errorLongArryData[i] = 11;
                }
                var erWriteLongArray = data.writeLongArray(errorLongArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03200: run writeShortArrayis is " + erWriteLongArray);
                expect(erWriteLongArray).assertEqual(false);
1294

Y
yang-qibo 已提交
1295 1296 1297 1298 1299 1300 1301
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03200: error " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03200---------------------------");
        });
Z
zhangpa2021 已提交
1302

Y
yang-qibo 已提交
1303
        /*
Z
zhangpa2021 已提交
1304
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_03300
Y
yang-qibo 已提交
1305 1306
     * @tc.name    Call the writedoublearray interface, write the array to the messageparcel instance,
     *             and call readdoublearra to read the data
Z
zhangpa2021 已提交
1307 1308 1309
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1310 1311 1312 1313 1314
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_03300", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03300: create object successfully.");
Z
zhangpa2021 已提交
1315

Y
yang-qibo 已提交
1316 1317 1318 1319
                var wDoubleArryData = [1.2, 235.67, 99.76];
                var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03300: run writeShortArrayis is " + writeDoubleArrayResult);
                expect(writeDoubleArrayResult).assertTrue();
Y
yang-qibo 已提交
1320

Y
yang-qibo 已提交
1321 1322 1323
                var rDoubleArryData = data.readDoubleArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03300: run readShortArray is " + rDoubleArryData);
                assertArrayElementEqual(wDoubleArryData,rDoubleArryData);
Y
yang-qibo 已提交
1324

Y
yang-qibo 已提交
1325 1326 1327 1328 1329 1330
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03300: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03300---------------------------");
        });
Z
zhangpa2021 已提交
1331

Y
yang-qibo 已提交
1332
        /*
Z
zhangpa2021 已提交
1333
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_03400
Y
yang-qibo 已提交
1334 1335
     * @tc.name    Call the writedoublearray interface, write the array to the messageparcel instance,
     *             and call readdoublearra (datain: number []) to read the data
Z
zhangpa2021 已提交
1336 1337 1338
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1339 1340 1341 1342 1343
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_03400", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03400: create object successfully.");
Z
zhangpa2021 已提交
1344

Y
yang-qibo 已提交
1345 1346 1347 1348 1349 1350 1351 1352
                var wDoubleArryData = [];
                for(let i = 0;i < (25*K - 1);i++){
                    wDoubleArryData[i] = 11.1;
                }
                var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03400: run writeShortArrayis is "
                    + writeDoubleArrayResult);
                expect(writeDoubleArrayResult).assertTrue();
Y
yang-qibo 已提交
1353

Y
yang-qibo 已提交
1354 1355 1356 1357
                var rDoubleArryData = [];
                data.readDoubleArray(rDoubleArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03400: run readShortArray is " + rDoubleArryData.length);
                assertArrayElementEqual(wDoubleArryData,rDoubleArryData);
Y
yang-qibo 已提交
1358

Y
yang-qibo 已提交
1359 1360 1361 1362 1363 1364
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03400: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03400---------------------------");
        });
Z
zhangpa2021 已提交
1365

Y
yang-qibo 已提交
1366
        /*
Z
zhangpa2021 已提交
1367
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_03500
Y
yang-qibo 已提交
1368
     * @tc.name    Writedoublearray interface, boundary value verification
Z
zhangpa2021 已提交
1369 1370 1371
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1372 1373 1374 1375 1376
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_03500", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03500: create object successfully.");
Z
zhangpa2021 已提交
1377

Y
yang-qibo 已提交
1378 1379 1380 1381
                var wDoubleArryData = [-1235453.2, 235.67, 9987659.76];
                var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03500: run writeShortArrayis is " + writeDoubleArrayResult);
                expect(writeDoubleArrayResult).assertTrue();
Z
zhangpa2021 已提交
1382

Y
yang-qibo 已提交
1383 1384 1385
                var rDoubleArryData = data.readDoubleArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03500: run readShortArray is " + rDoubleArryData);
                assertArrayElementEqual(wDoubleArryData,rDoubleArryData);
Y
yang-qibo 已提交
1386

Y
yang-qibo 已提交
1387 1388 1389 1390 1391 1392
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03500: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03500---------------------------");
        });
Z
zhangpa2021 已提交
1393

Y
yang-qibo 已提交
1394
        /*
Z
zhangpa2021 已提交
1395
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_03600
Y
yang-qibo 已提交
1396
     * @tc.name    Writedoublearray interface, illegal value validation
Z
zhangpa2021 已提交
1397 1398 1399
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1400 1401 1402 1403 1404
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_03600", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03600: create object successfully.");
Z
zhangpa2021 已提交
1405

Y
yang-qibo 已提交
1406 1407 1408 1409
                var DoubleArryData = [-12354883737337373873853.2, 235.67, 99999999999999993737373773987659.76];
                var WriteDoubleArrayResult = data.writeDoubleArray(DoubleArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03600: run writeDoubleArrayis is " + WriteDoubleArrayResult);
                expect(WriteDoubleArrayResult).assertTrue();
Y
yang-qibo 已提交
1410

Y
yang-qibo 已提交
1411 1412 1413 1414 1415 1416
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03600: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03600---------------------------");
        });
Z
zhangpa2021 已提交
1417

Y
yang-qibo 已提交
1418
        /*
Z
zhangpa2021 已提交
1419
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_03700
Y
yang-qibo 已提交
1420
     * @tc.name    Writedoublearray interface, illegal value validation
Z
zhangpa2021 已提交
1421 1422 1423
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1424 1425 1426 1427 1428
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_03700", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03700: create object successfully.");
Z
zhangpa2021 已提交
1429

Y
yang-qibo 已提交
1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440
                var errorDoubleArryData = [];
                for (let i=0;i<25*K;i++){
                    errorDoubleArryData[i] = 11.1;
                }
                var WriteDoubleArrayResult = data.writeDoubleArray(errorDoubleArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03700: run writeDoubleArrayis is " + WriteDoubleArrayResult);
                expect(WriteDoubleArrayResult).assertEqual(false);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03700: error " + error);
                expect(error != null).assertTrue();
Y
yang-qibo 已提交
1441
            }
Y
yang-qibo 已提交
1442 1443
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03700---------------------------");
        });
Z
zhangpa2021 已提交
1444

Y
yang-qibo 已提交
1445
        /*
Z
zhangpa2021 已提交
1446
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_03800
Y
yang-qibo 已提交
1447 1448
     * @tc.name    Call the writeboolean array interface, write the array to the messageparcel instance,
     *             and call readboolean array to read the data
Z
zhangpa2021 已提交
1449 1450 1451
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1452 1453 1454 1455 1456
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_03800", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03800: create object successfully.");
Z
zhangpa2021 已提交
1457

Y
yang-qibo 已提交
1458 1459 1460 1461
                var wBooleanArryData = [true, false, false];
                var writeBooleanArrayResult = data.writeBooleanArray(wBooleanArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03800: run writeShortArrayis is " + writeBooleanArrayResult);
                expect(writeBooleanArrayResult).assertTrue();
Z
zhangpa2021 已提交
1462

Y
yang-qibo 已提交
1463 1464 1465
                var rBooleanArryData = data.readBooleanArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03800: run readShortArray is " + rBooleanArryData);
                assertArrayElementEqual(wBooleanArryData,rBooleanArryData);
Y
yang-qibo 已提交
1466

Y
yang-qibo 已提交
1467 1468 1469 1470 1471 1472
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03800: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03800---------------------------");
        });
Z
zhangpa2021 已提交
1473

Y
yang-qibo 已提交
1474
        /*
Z
zhangpa2021 已提交
1475
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_03900
Y
yang-qibo 已提交
1476 1477
     * @tc.name    Call the writeboolean array interface, write the array to the messageparcel instance,
     *             and call readboolean array (datain: number []) to read the data
Z
zhangpa2021 已提交
1478 1479 1480
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_03900", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03900: create object successfully.");

                var wBooleanArryData = [];
                for (let i=0;i<(50*K - 1);i++){
                    if (i % 2 == 0){
                        wBooleanArryData[i] = false;
                    }else {
                        wBooleanArryData[i] = true;
                    }
Y
yang-qibo 已提交
1494
                }
Y
yang-qibo 已提交
1495 1496 1497
                var writeBooleanArrayResult = data.writeBooleanArray(wBooleanArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03900: run writeShortArrayis is " + writeBooleanArrayResult);
                expect(writeBooleanArrayResult).assertTrue();
Z
zhangpa2021 已提交
1498

Y
yang-qibo 已提交
1499 1500 1501 1502
                var rBooleanArryData = [];
                data.readBooleanArray(rBooleanArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03900: run readShortArray is " + rBooleanArryData.length);
                assertArrayElementEqual(wBooleanArryData,rBooleanArryData);
Y
yang-qibo 已提交
1503

Y
yang-qibo 已提交
1504 1505 1506 1507 1508 1509
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03900: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03900---------------------------");
        });
Z
zhangpa2021 已提交
1510

Y
yang-qibo 已提交
1511
        /*
Z
zhangpa2021 已提交
1512
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_04000
Y
yang-qibo 已提交
1513
     * @tc.name    Writeboolean array interface, illegal value validation
Z
zhangpa2021 已提交
1514 1515 1516
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1517 1518 1519 1520 1521
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_04000", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04000: create object successfully.");
Z
zhangpa2021 已提交
1522

Y
yang-qibo 已提交
1523 1524 1525 1526 1527 1528 1529 1530
                var BooleanArryData = [true, 'abc', false];
                var WriteBooleanArrayResult = data.writeBooleanArray(BooleanArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04000: run writeShortArrayis is " + WriteBooleanArrayResult);
                expect(WriteBooleanArrayResult).assertTrue();
                var rBooleanArryData = data.readBooleanArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04000: run readShortArray is " + rBooleanArryData);
                var newboolean = [true,false,false];
                assertArrayElementEqual(newboolean,rBooleanArryData);
Z
zhangpa2021 已提交
1531

Y
yang-qibo 已提交
1532 1533 1534 1535 1536 1537
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04000: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04000---------------------------");
        });
Z
zhangpa2021 已提交
1538

Y
yang-qibo 已提交
1539
        /*
Z
zhangpa2021 已提交
1540
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_04100
Y
yang-qibo 已提交
1541
     * @tc.name    Writeboolean array interface, illegal value validation
Z
zhangpa2021 已提交
1542 1543 1544
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_04100", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04100: create object successfully.");

                var errorBooleanArryData = [];
                for (let i=0;i<50*K;i++){
                    if (i % 2 == 0){
                        errorBooleanArryData[i] = false;
                    }else {
                        errorBooleanArryData[i] = true;
                    };
                }
                var WriteBooleanArrayResult = data.writeBooleanArray(errorBooleanArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04100: run writeShortArrayis is " + WriteBooleanArrayResult);
                expect(WriteBooleanArrayResult).assertEqual(false);
Y
yang-qibo 已提交
1562

Y
yang-qibo 已提交
1563 1564 1565 1566
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04100: error " + error);
                expect(error != null).assertTrue();
Y
yang-qibo 已提交
1567
            }
Y
yang-qibo 已提交
1568 1569
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04100---------------------------");
        });
Z
zhangpa2021 已提交
1570

Y
yang-qibo 已提交
1571
        /*
Z
zhangpa2021 已提交
1572
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_04200
Y
yang-qibo 已提交
1573 1574
     * @tc.name    Call the writechararray interface, write the array to the messageparcel instance,
     *             and call readchararray to read the data
J
jiyong 已提交
1575 1576 1577
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1578 1579 1580 1581 1582
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_04200", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04200: create object successfully.");
J
jiyong 已提交
1583

Y
yang-qibo 已提交
1584 1585 1586 1587 1588 1589 1590
                var wCharArryData = [];
                for(let i=0;i<(50*K - 1);i++){
                    wCharArryData[i] = 96;
                }
                var writeCharArrayResult = data.writeCharArray(wCharArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04200: run writeShortArrayis is " + writeCharArrayResult);
                expect(writeCharArrayResult).assertTrue();
Y
yang-qibo 已提交
1591

Y
yang-qibo 已提交
1592 1593 1594
                var rCharArryData = data.readCharArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04200: run readShortArray is " + rCharArryData.length);
                assertArrayElementEqual(wCharArryData,rCharArryData);
J
jiyong 已提交
1595

Y
yang-qibo 已提交
1596 1597 1598 1599 1600 1601
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04200: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04200---------------------------");
        });
J
jiyong 已提交
1602

Y
yang-qibo 已提交
1603
        /*
Z
zhangpa2021 已提交
1604
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_04300
Y
yang-qibo 已提交
1605 1606
     * @tc.name    Call the writechararray interface, write the array to the messageparcel instance,
     *             and call readchararray (datain: number []) to read the data
J
jiyong 已提交
1607 1608 1609
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1610 1611 1612 1613 1614
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_04300", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04300: create object successfully.");
J
jiyong 已提交
1615

Y
yang-qibo 已提交
1616 1617 1618 1619 1620 1621 1622
                var wCharArryData = [];
                for(let i=0;i<(50*K - 1);i++){
                    wCharArryData[i] = 96;
                }
                var writeCharArrayResult = data.writeCharArray(wCharArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04300: run writeShortArrayis is " + writeCharArrayResult);
                expect(writeCharArrayResult).assertTrue();
J
jiyong 已提交
1623

Y
yang-qibo 已提交
1624

Y
yang-qibo 已提交
1625 1626 1627 1628
                var rCharArryData = [];
                data.readCharArray(rCharArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04300: run readShortArray is " + rCharArryData.length);
                assertArrayElementEqual(wCharArryData,rCharArryData);
J
jiyong 已提交
1629

Y
yang-qibo 已提交
1630 1631 1632 1633 1634 1635
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04300: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04300---------------------------");
        });
J
jiyong 已提交
1636

Y
yang-qibo 已提交
1637
        /*
Z
zhangpa2021 已提交
1638
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_04400
Y
yang-qibo 已提交
1639
     * @tc.name    Writechararray interface, illegal value validation
J
jiyong 已提交
1640 1641 1642
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1643 1644 1645 1646 1647
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_04400", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04400: create object successfully.");
J
jiyong 已提交
1648

Y
yang-qibo 已提交
1649 1650 1651 1652
                var errorCharArryData = [10, 'asfgdgdtu', 20];
                var WriteCharArrayResult = data.writeCharArray(errorCharArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04400: run writeShortArrayis is " + WriteCharArrayResult);
                expect(WriteCharArrayResult).assertTrue();
J
jiyong 已提交
1653

Y
yang-qibo 已提交
1654 1655 1656 1657
                var rCharArryData = data.readCharArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04400: run readShortArray is " + rCharArryData);
                var xresult = [10,0,20];
                assertArrayElementEqual(xresult,rCharArryData);
J
jiyong 已提交
1658

Y
yang-qibo 已提交
1659 1660 1661 1662 1663 1664
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04400: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04400---------------------------");
        });
J
jiyong 已提交
1665

Y
yang-qibo 已提交
1666
        /*
Z
zhangpa2021 已提交
1667
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_04500
Y
yang-qibo 已提交
1668 1669
     * @tc.name    Call the writestringarray interface, write the array to the messageparcel instance,
     *             and call readstringarray (datain: number []) to read the data
J
jiyong 已提交
1670 1671 1672
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1673 1674 1675 1676 1677
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_04500", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04500: create object successfully.");
Y
yang-qibo 已提交
1678

Y
yang-qibo 已提交
1679 1680 1681 1682
                var wStringArryData = ['abc', 'hello', 'beauty'];
                var writeStringArrayResult = data.writeStringArray(wStringArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04500: run writeShortArrayis is " + writeStringArrayResult);
                expect(writeStringArrayResult).assertTrue();
Y
yang-qibo 已提交
1683

Y
yang-qibo 已提交
1684 1685 1686
                var rStringArryData = data.readStringArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04500: run readShortArray is " + rStringArryData);
                assertArrayElementEqual(wStringArryData,rStringArryData);
Y
yang-qibo 已提交
1687

Y
yang-qibo 已提交
1688 1689 1690 1691 1692 1693
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04500: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04500---------------------------");
        });
Y
yang-qibo 已提交
1694

Y
yang-qibo 已提交
1695
        /*
Z
zhangpa2021 已提交
1696
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_04600
Y
yang-qibo 已提交
1697 1698 1699 1700 1701
     * @tc.name    Call the writestringarray interface, write the array to the messageparcel instance,
     *             and call readstringarray() to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1702 1703 1704 1705 1706
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_04600", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04600: create object successfully.");
Y
yang-qibo 已提交
1707

Y
yang-qibo 已提交
1708 1709 1710 1711
                var wStringArryData = ['abc', 'hello', 'beauty'];
                var writeStringArrayResult = data.writeStringArray(wStringArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04600: run writeShortArrayis is " + writeStringArrayResult);
                expect(writeStringArrayResult).assertTrue();
Y
yang-qibo 已提交
1712 1713


Y
yang-qibo 已提交
1714 1715 1716 1717
                var rStringArryData = [];
                data.readStringArray(rStringArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04600: run readShortArray is " + rStringArryData);
                assertArrayElementEqual(wStringArryData,rStringArryData);
Y
yang-qibo 已提交
1718

Y
yang-qibo 已提交
1719 1720 1721 1722 1723 1724
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04600: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04600---------------------------");
        });
Y
yang-qibo 已提交
1725

Y
yang-qibo 已提交
1726
        /*
Z
zhangpa2021 已提交
1727
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_04700
Y
yang-qibo 已提交
1728 1729 1730 1731
     * @tc.name    Writestringarray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1732 1733 1734 1735 1736
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_04700", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04700: create object successfully.");
Y
yang-qibo 已提交
1737

Y
yang-qibo 已提交
1738 1739 1740 1741
                var errorStringArryData = ['abc', 123, 'beauty'];
                var WriteStringArrayResult = data.writeStringArray(errorStringArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04700: run writeStringArrayis is " + WriteStringArrayResult);
                expect(WriteStringArrayResult).assertEqual(false);
Y
yang-qibo 已提交
1742

Y
yang-qibo 已提交
1743 1744 1745 1746 1747 1748 1749
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04700: error " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04700---------------------------");
        });
Y
yang-qibo 已提交
1750

Y
yang-qibo 已提交
1751
        /*
Z
zhangpa2021 已提交
1752
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_04800
Y
yang-qibo 已提交
1753 1754 1755 1756
     * @tc.name    Writestringarray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1757 1758 1759 1760 1761
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_04800", 0, function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04800: create object successfully.");
Y
yang-qibo 已提交
1762

Y
yang-qibo 已提交
1763 1764 1765 1766 1767 1768 1769
                var errorStringArryData = [];
                for (let i=0;i<(10*K - 1);i++){
                    errorStringArryData[i] = "heddSDF";
                }
                var WriteStringArrayResult = data.writeStringArray(errorStringArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04800: run writeStringArrayis is " + WriteStringArrayResult);
                expect(WriteStringArrayResult).assertTrue();
1770

Y
yang-qibo 已提交
1771 1772 1773 1774 1775 1776 1777 1778 1779
                var errorStringArray = data.readStringArray();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04800: run writeStringArrayis is " + errorStringArray.length);
                assertArrayElementEqual(errorStringArray,errorStringArryData);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04800: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04800---------------------------");
        });
Y
yang-qibo 已提交
1780

Y
yang-qibo 已提交
1781
        /*
Z
zhangpa2021 已提交
1782
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_04900
Y
yang-qibo 已提交
1783 1784 1785 1786 1787
     * @tc.name    Call the writebytearray interface, write the array to the messageparcel instance,
     *             and call readbytearray to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_04900", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var ByteArrayVar = [1, 2, 3, 4, 5];
                var writeShortArrayResult = data.writeByteArray(ByteArrayVar);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: run writeShortArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();

                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
Y
yang-qibo 已提交
1807

Y
yang-qibo 已提交
1808 1809 1810 1811 1812 1813 1814 1815 1816
                    var shortArryDataReply = result.reply.readByteArray();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: run readByteArray is " + shortArryDataReply);
                    assertArrayElementEqual(ByteArrayVar,shortArryDataReply);
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: error " +error);
Y
yang-qibo 已提交
1817
            }
Y
yang-qibo 已提交
1818 1819
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04900---------------------------");
        });
Y
yang-qibo 已提交
1820

Y
yang-qibo 已提交
1821
        /*
Z
zhangpa2021 已提交
1822
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_05000
Y
yang-qibo 已提交
1823 1824 1825 1826 1827
     * @tc.name    Call the writebytearray interface, write the array to the messageparcel instance,
     *             and call readbytearray (datain: number []) to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1828 1829 1830 1831 1832 1833 1834
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_05000", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
Y
yang-qibo 已提交
1835

Y
yang-qibo 已提交
1836 1837 1838 1839
                var ByteArrayVar = [1, 2, 3, 4, 5];
                var writeShortArrayResult = data.writeByteArray(ByteArrayVar);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: run writeShortArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();
Y
yang-qibo 已提交
1840

Y
yang-qibo 已提交
1841 1842 1843 1844 1845 1846
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
1847

Y
yang-qibo 已提交
1848 1849 1850 1851 1852
                    var newArr = new Array(5);
                    result.reply.readByteArray(newArr);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: run readByteArray is " + newArr);
                    assertArrayElementEqual(ByteArrayVar,newArr);
                });
Y
yang-qibo 已提交
1853

Y
yang-qibo 已提交
1854 1855 1856 1857 1858 1859 1860 1861
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: error " +error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05000---------------------------");
        });
Y
yang-qibo 已提交
1862

Y
yang-qibo 已提交
1863
        /*
Z
zhangpa2021 已提交
1864
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_05100
Y
yang-qibo 已提交
1865 1866 1867 1868
     * @tc.name    Writebytearray interface, boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1869 1870 1871 1872 1873 1874 1875
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_05100", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
Y
yang-qibo 已提交
1876

Y
yang-qibo 已提交
1877 1878 1879 1880
                var teArrayVar = [-128, 0, 1, 2, 127];
                var writeShortArrayResult = data.writeByteArray(teArrayVar);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: run writeShortArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();
Y
yang-qibo 已提交
1881

Y
yang-qibo 已提交
1882 1883 1884 1885 1886 1887
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
1888

Y
yang-qibo 已提交
1889 1890 1891 1892 1893
                    var newArr = new Array(5)
                    result.reply.readByteArray(newArr);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: run readByteArray is " + newArr);
                    assertArrayElementEqual(newArr,teArrayVar);
                });
Y
yang-qibo 已提交
1894

Y
yang-qibo 已提交
1895 1896 1897 1898 1899 1900 1901 1902
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: error " +error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05100---------------------------");
        });
Y
yang-qibo 已提交
1903

Y
yang-qibo 已提交
1904
        /*
Z
zhangpa2021 已提交
1905
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_05200
Y
yang-qibo 已提交
1906 1907 1908 1909
     * @tc.name    Writebytearray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_05200", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var teArrayVar = [-128, 0, 1, 2, 128];
                var writeShortArrayResult = data.writeByteArray(teArrayVar);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: run writeShortArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();

                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    var shortArryDataReply = result.reply.readByteArray();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: run readByteArray is " + shortArryDataReply);
                    expect(shortArryDataReply[0] == teArrayVar[0]).assertTrue();
                    expect(shortArryDataReply[1] == teArrayVar[1]).assertTrue();
                    expect(shortArryDataReply[2] == teArrayVar[2]).assertTrue();
                    expect(shortArryDataReply[3] == teArrayVar[3]).assertTrue();
                    expect(shortArryDataReply[4] == -128).assertTrue();
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: error " +error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05200---------------------------");
        });
Y
yang-qibo 已提交
1946

Y
yang-qibo 已提交
1947
        /*
Z
zhangpa2021 已提交
1948
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_05300
Y
yang-qibo 已提交
1949 1950 1951 1952
     * @tc.name    Writebytearray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_05300", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var ByteArrayVar = [-129, 0, 1, 2, 127];
                var writeShortArrayResult = data.writeByteArray(ByteArrayVar);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: run writeShortArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();

                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    var shortArryDataReply = result.reply.readByteArray();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: run readByteArray is " + shortArryDataReply);
                    expect(shortArryDataReply[0] == 127).assertTrue();
                    expect(shortArryDataReply[1] == ByteArrayVar[1]).assertTrue();
                    expect(shortArryDataReply[2] == ByteArrayVar[2]).assertTrue();
                    expect(shortArryDataReply[3] == ByteArrayVar[3]).assertTrue();
                    expect(shortArryDataReply[4] == ByteArrayVar[4]).assertTrue();
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: error " +error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05300---------------------------");
        });
J
jiyong 已提交
1989

Y
yang-qibo 已提交
1990
        /*
Z
zhangpa2021 已提交
1991
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_05400
J
jiyong 已提交
1992 1993 1994 1995 1996
     * @tc.name    Call the writeintarray interface, write the array to the messageparcel instance,
     *             and call readintarray to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1997 1998 1999 2000 2001 2002 2003
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_05400", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2004

Y
yang-qibo 已提交
2005 2006 2007 2008
                var intArryData = [100, 111, 112];
                var writeShortArrayResult = data.writeIntArray(intArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: run writeShortArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();
J
jiyong 已提交
2009

Y
yang-qibo 已提交
2010 2011 2012 2013 2014 2015 2016
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2017

Y
yang-qibo 已提交
2018 2019 2020 2021
                    var shortArryDataReply = result.reply.readIntArray();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: run readByteArray is " + shortArryDataReply);
                    assertArrayElementEqual(intArryData,shortArryDataReply);
                });
J
jiyong 已提交
2022

Y
yang-qibo 已提交
2023 2024 2025 2026 2027 2028 2029 2030
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05400---------------------------");
        });
J
jiyong 已提交
2031

Y
yang-qibo 已提交
2032
        /*
Z
zhangpa2021 已提交
2033
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_05500
J
jiyong 已提交
2034 2035 2036 2037 2038
     * @tc.name    Call the writeintarray interface, write the array to the messageparcel instance,
     *             and call readintarray (datain: number []) to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2039 2040 2041 2042 2043 2044 2045
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_05500", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2046

Y
yang-qibo 已提交
2047 2048 2049 2050
                var intArryData = [100, 111, 112];
                var writeShortArrayResult = data.writeIntArray(intArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: run writeShortArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();
2051

Y
yang-qibo 已提交
2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    var newArr = []
                    result.reply.readIntArray(newArr);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: run readIntArray is " + newArr);
                    assertArrayElementEqual(intArryData,newArr);
                });
2065

Y
yang-qibo 已提交
2066 2067 2068 2069 2070 2071 2072 2073
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05500---------------------------");
        });
J
jiyong 已提交
2074

Y
yang-qibo 已提交
2075
        /*
Z
zhangpa2021 已提交
2076
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_05600
J
jiyong 已提交
2077 2078 2079 2080
     * @tc.name    Writeintarray interface, boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2081 2082 2083 2084 2085 2086 2087
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_05600", 0, async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2088

Y
yang-qibo 已提交
2089 2090 2091 2092
                var intArryData = [-2147483648, 0, 1, 2, 2147483647];
                var writeIntArrayResult = data.writeIntArray(intArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: run writeShortArrayis is " + writeIntArrayResult);
                expect(writeIntArrayResult == true).assertTrue();
J
jiyong 已提交
2093

Y
yang-qibo 已提交
2094 2095 2096 2097 2098 2099 2100
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2101

Y
yang-qibo 已提交
2102 2103 2104 2105
                    var shortArryDataReply = result.reply.readIntArray();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: run readByteArray is " + shortArryDataReply);
                    assertArrayElementEqual(intArryData,shortArryDataReply);
                });
J
jiyong 已提交
2106

Y
yang-qibo 已提交
2107 2108 2109 2110 2111 2112
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05600---------------------------");
        });
J
jiyong 已提交
2113

Y
yang-qibo 已提交
2114
        /*
Z
zhangpa2021 已提交
2115
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_05700
J
jiyong 已提交
2116 2117 2118 2119
     * @tc.name    Writeintarray interface, illegal value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2120 2121 2122 2123 2124 2125 2126
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_05700", 0, async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2127

Y
yang-qibo 已提交
2128 2129 2130 2131
                var intArryData = [-2147483649, 0, 1, 2, 2147483647];
                var writeIntArrayResult = data.writeIntArray(intArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: run writeShortArrayis is " + writeIntArrayResult);
                expect(writeIntArrayResult == true).assertTrue();
2132

Y
yang-qibo 已提交
2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    var shortArryDataReply = result.reply.readIntArray();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: run readByteArray is " + shortArryDataReply);
                    expect(shortArryDataReply[0] == 2147483647).assertTrue();
                    expect(shortArryDataReply[1] == intArryData[1]).assertTrue();
                    expect(shortArryDataReply[2] == intArryData[2]).assertTrue();
                    expect(shortArryDataReply[3] == intArryData[3]).assertTrue();
                    expect(shortArryDataReply[4] == intArryData[4]).assertTrue();
                });
2149

Y
yang-qibo 已提交
2150 2151 2152 2153 2154 2155
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05700---------------------------");
        });
Y
yang-qibo 已提交
2156

Y
yang-qibo 已提交
2157
        /*
Z
zhangpa2021 已提交
2158
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_05800
Y
yang-qibo 已提交
2159 2160 2161 2162
     * @tc.name    Writeintarray interface, illegal value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2163 2164 2165 2166 2167 2168 2169
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_05800", 0, async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
Y
yang-qibo 已提交
2170

Y
yang-qibo 已提交
2171 2172 2173 2174
                var intArryData = [0, 1, 2, 3, 2147483648];
                var writeIntArrayResult = data.writeIntArray(intArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: run writeShortArrayis is " + writeIntArrayResult);
                expect(writeIntArrayResult == true).assertTrue();
2175

Y
yang-qibo 已提交
2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    var shortArryDataReply = result.reply.readIntArray();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: run readByteArray is " + shortArryDataReply);
                    var newintArryData = [0, 1, 2, 3, -2147483648];
                    assertArrayElementEqual(newintArryData,shortArryDataReply);
                });
2189

Y
yang-qibo 已提交
2190 2191 2192 2193 2194 2195
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05800---------------------------");
        });
J
jiyong 已提交
2196

Y
yang-qibo 已提交
2197
        /*
Z
zhangpa2021 已提交
2198
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_05900
J
jiyong 已提交
2199 2200 2201 2202 2203
     * @tc.name    Call the writefloatarray interface, write the array to the messageparcel instance,
     *             and call readfloatarray to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2204 2205 2206 2207 2208 2209 2210
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_05900", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2211

Y
yang-qibo 已提交
2212 2213 2214 2215
                var floatArryData = [1.2, 1.3, 1.4];
                var writeShortArrayResult = data.writeFloatArray(floatArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: run writeFloatArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();
J
jiyong 已提交
2216 2217


Y
yang-qibo 已提交
2218 2219 2220 2221 2222 2223 2224
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2225

Y
yang-qibo 已提交
2226 2227 2228 2229
                    var floatArryDataReply = result.reply.readFloatArray();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: run readFloatArray is " + floatArryDataReply);
                    assertArrayElementEqual(floatArryData,floatArryDataReply);
                });
J
jiyong 已提交
2230

Y
yang-qibo 已提交
2231 2232 2233 2234 2235 2236 2237 2238
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05900---------------------------");
        });
J
jiyong 已提交
2239

Y
yang-qibo 已提交
2240
        /*
Z
zhangpa2021 已提交
2241
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_06000
J
jiyong 已提交
2242 2243 2244 2245 2246
     * @tc.name    Call the writefloatarray interface, write the array to the messageparcel instance,
     *             and call readfloatarray (datain: number []) to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2247 2248 2249 2250 2251 2252 2253
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_06000", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2254

Y
yang-qibo 已提交
2255 2256 2257 2258
                var floatArryData = [1.2, 1.3, 1.4]
                var writeShortArrayResult = data.writeFloatArray(floatArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: run writeFloatArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();
J
jiyong 已提交
2259

Y
yang-qibo 已提交
2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    var newArr = []
                    result.reply.readFloatArray(newArr);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: readFloatArray is " + newArr);
                    assertArrayElementEqual(floatArryData,newArr);
                });
J
jiyong 已提交
2273

Y
yang-qibo 已提交
2274 2275 2276 2277 2278 2279 2280 2281
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: error " +error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06000---------------------------");
        });
2282

Y
yang-qibo 已提交
2283
        /*
Z
zhangpa2021 已提交
2284
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_06100
2285 2286
     * @tc.name    Writefloatarray interface, boundary value verification
     * @tc.desc    Function test
J
jiyong 已提交
2287 2288
     * @tc.level   0
     */
Y
yang-qibo 已提交
2289 2290 2291 2292 2293 2294 2295
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_06100", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2296

Y
yang-qibo 已提交
2297 2298 2299 2300
                var floatArryData = [-3.40E+38, 1.3, 3.40E+38];
                var writeShortArrayResult = data.writeFloatArray(floatArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: run writeFloatArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();
J
jiyong 已提交
2301

Y
yang-qibo 已提交
2302 2303 2304 2305 2306 2307 2308
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
2309

Y
yang-qibo 已提交
2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321
                    var newArr = result.reply.readFloatArray();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: run readFloatArray is " + newArr);
                    assertArrayElementEqual(floatArryData,newArr);
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: error " +error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06100---------------------------");
        });
J
jiyong 已提交
2322

Y
yang-qibo 已提交
2323
        /*
Z
zhangpa2021 已提交
2324
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_06200
J
jiyong 已提交
2325 2326 2327 2328
     * @tc.name    Writefloatarray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2329 2330 2331 2332 2333 2334 2335
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_06200", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2336

Y
yang-qibo 已提交
2337 2338 2339 2340
                var floatArryData = [-4.40E+38, 1.3, 3.40E+38];
                var writeShortArrayResult = data.writeFloatArray(floatArryData);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: run writeFloatArrayis is " + writeShortArrayResult);
                expect(writeShortArrayResult == true).assertTrue();
J
jiyong 已提交
2341

Y
yang-qibo 已提交
2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    var newArr = result.reply.readFloatArray();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: run readFloatArray is " + newArr);
                    expect(newArr[0] == floatArryData[0]).assertTrue();
                    expect(newArr[1] == floatArryData[1]).assertTrue();
                    expect(newArr[2] == floatArryData[2]).assertTrue();
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: error " +error);
J
jiyong 已提交
2361
            }
Y
yang-qibo 已提交
2362 2363
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06200---------------------------");
        });
2364

Y
yang-qibo 已提交
2365
        /*
Z
zhangpa2021 已提交
2366
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_06300
J
jiyong 已提交
2367 2368 2369 2370 2371
     * @tc.name    Call the writeShort interface to write the short integer data to the messageparcel instance,
     *             and call readshort to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2372 2373 2374 2375 2376 2377 2378
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_06300", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2379

Y
yang-qibo 已提交
2380 2381 2382 2383
                var short = 8;
                var writeShor = data.writeShort(short);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: run writeShort success, writeShor is " + writeShor);
                expect(writeShor == true).assertTrue();
J
jiyong 已提交
2384

Y
yang-qibo 已提交
2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_SHORT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    var readShort = result.reply.readShort();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: run readFloatArray is success, readShort is "
                        + readShort);
                    expect(readShort == short).assertTrue();
                });
2398

Y
yang-qibo 已提交
2399 2400 2401 2402 2403 2404 2405 2406
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06300---------------------------");
        });
J
jiyong 已提交
2407

Y
yang-qibo 已提交
2408
        /*
Z
zhangpa2021 已提交
2409
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_06400
J
jiyong 已提交
2410
     * @tc.name    WriteShort interface, boundary value verification
J
jiyong 已提交
2411 2412 2413
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_06400", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06400: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                expect(data.writeShort(-32768) == true).assertTrue();
                expect(data.writeShort(0) == true).assertTrue();
                expect(data.writeShort(1) == true).assertTrue();
                expect(data.writeShort(2) == true).assertTrue();
                expect(data.writeShort(32767) == true).assertTrue();

                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06400: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_SHORT_MULTI, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06400: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    expect(result.reply.readShort() == -32768).assertTrue();
                    expect(result.reply.readShort() == 0).assertTrue();
                    expect(result.reply.readShort() == 1).assertTrue();
                    expect(result.reply.readShort() == 2).assertTrue();
                    expect(result.reply.readShort() == 32767).assertTrue();
                });
J
jiyong 已提交
2441

Y
yang-qibo 已提交
2442 2443 2444 2445 2446
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06400: error " + error);
J
jiyong 已提交
2447
            }
Y
yang-qibo 已提交
2448 2449
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06400---------------------------");
        });
J
jiyong 已提交
2450

Y
yang-qibo 已提交
2451
        /*
Z
zhangpa2021 已提交
2452
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_06500
J
jiyong 已提交
2453
     * @tc.name    WriteShort interface, illegal value verification
J
jiyong 已提交
2454 2455 2456
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2457 2458 2459 2460 2461 2462 2463 2464
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_06500", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06500: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                expect(data.writeShort(32768) == true).assertTrue();
J
jiyong 已提交
2465

Y
yang-qibo 已提交
2466 2467 2468 2469 2470 2471 2472 2473 2474
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06500: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_SHORT_MULTI, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06500: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    expect(result.reply.readShort() == -32768).assertTrue();
                });
2475

Y
yang-qibo 已提交
2476 2477 2478 2479 2480 2481 2482 2483
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06500: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06500---------------------------");
        });
J
jiyong 已提交
2484

Y
yang-qibo 已提交
2485
        /*
Z
zhangpa2021 已提交
2486
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_06600
Y
yang-qibo 已提交
2487 2488
     * @tc.name    Call the writeShort interface to write the short integer data to the messageparcel instance,
     *             and call readshort to read the data
J
jiyong 已提交
2489 2490 2491
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2492 2493 2494 2495 2496 2497 2498
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_06600", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2499

Y
yang-qibo 已提交
2500 2501 2502 2503
                var short = -32769;
                var writeShor = data.writeShort(short);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: run writeShort success, writeShor is " + writeShor);
                expect(writeShor == true).assertTrue();
J
jiyong 已提交
2504

Y
yang-qibo 已提交
2505 2506 2507 2508 2509 2510 2511
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_SHORT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2512

Y
yang-qibo 已提交
2513 2514 2515 2516
                    var readShort = result.reply.readShort();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: run readFloatArray is " + readShort);
                    expect(readShort == 32767).assertTrue();
                });
J
jiyong 已提交
2517

Y
yang-qibo 已提交
2518 2519 2520 2521 2522 2523 2524 2525
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06600---------------------------");
        });
J
jiyong 已提交
2526

Y
yang-qibo 已提交
2527
        /*
Z
zhangpa2021 已提交
2528
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_06700
Y
yang-qibo 已提交
2529 2530
     * @tc.name    Call the writeShort interface to write the short integer data to the messageparcel instance,
     *             and call readshort to read the data
J
jiyong 已提交
2531 2532 2533
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2534 2535 2536 2537 2538 2539 2540
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_06700", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2541

Y
yang-qibo 已提交
2542 2543 2544 2545
                var short = 32768;
                var writeShor = data.writeShort(short);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: run writeShort success, writeShor is " + writeShor);
                expect(writeShor == true).assertTrue();
J
jiyong 已提交
2546

Y
yang-qibo 已提交
2547 2548 2549 2550 2551 2552 2553
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_SHORT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2554

Y
yang-qibo 已提交
2555 2556 2557 2558
                    var readShort = result.reply.readShort();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: run readFloatArray is " + readShort);
                    expect(readShort == -32768).assertTrue();
                });
J
jiyong 已提交
2559

Y
yang-qibo 已提交
2560 2561 2562 2563 2564 2565 2566 2567
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06700---------------------------");
        });
J
jiyong 已提交
2568

Y
yang-qibo 已提交
2569
        /*
Z
zhangpa2021 已提交
2570
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_06800
Y
yang-qibo 已提交
2571 2572
     * @tc.name    Call writelong interface to write long integer data to messageparcel instance
     *             and call readlong to read data
J
jiyong 已提交
2573 2574 2575
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2576 2577 2578 2579 2580 2581 2582
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_06800", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2583

Y
yang-qibo 已提交
2584 2585 2586 2587
                var short = 10000;
                var writelong = data.writeLong(short);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: run writeLong success, writelong is " + writelong);
                expect(writelong == true).assertTrue();
J
jiyong 已提交
2588

Y
yang-qibo 已提交
2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: run sendRequestis is "
                        + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    var readlong = result.reply.readLong();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: run readLong is success, readlong is " + readlong);
                    expect(readlong == short).assertTrue();
                });
2602

Y
yang-qibo 已提交
2603 2604 2605 2606 2607 2608 2609 2610
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06800---------------------------");
        });
2611

Y
yang-qibo 已提交
2612
        /*
Z
zhangpa2021 已提交
2613
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_06900
Y
yang-qibo 已提交
2614
     * @tc.name    Writelong interface, boundary value verification
J
jiyong 已提交
2615 2616 2617
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2618 2619 2620 2621 2622 2623 2624
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_06900", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2625

Y
yang-qibo 已提交
2626 2627 2628 2629
                var short = 2147483647;
                var writelong = data.writeLong(short);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: run writeLong success, writelong is " + writelong);
                expect(writelong == true).assertTrue();
Y
yang-qibo 已提交
2630

Y
yang-qibo 已提交
2631 2632 2633 2634 2635 2636 2637
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: run sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
Y
yang-qibo 已提交
2638

Y
yang-qibo 已提交
2639 2640 2641 2642
                    var readlong = result.reply.readLong();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: run readLong is success, readlong is " + readlong);
                    expect(readlong == short).assertTrue();
                });
Y
yang-qibo 已提交
2643

Y
yang-qibo 已提交
2644 2645 2646 2647 2648 2649 2650
                data.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06900---------------------------");
        });
J
jiyong 已提交
2651

Y
yang-qibo 已提交
2652
        /*
Z
zhangpa2021 已提交
2653
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_07000
Y
yang-qibo 已提交
2654
     * @tc.name    Writelong interface, illegal value verification
J
jiyong 已提交
2655 2656 2657
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2658 2659 2660 2661 2662 2663 2664
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_07000", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
Y
yang-qibo 已提交
2665

Y
yang-qibo 已提交
2666 2667 2668 2669
                var short = 214748364887;
                var writelong = data.writeLong(short);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: run writeLong success, writelong is " + writelong);
                expect(writelong == true).assertTrue();
J
jiyong 已提交
2670

Y
yang-qibo 已提交
2671 2672 2673 2674 2675 2676 2677
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: run sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
Y
yang-qibo 已提交
2678

Y
yang-qibo 已提交
2679 2680 2681 2682
                    var readlong = result.reply.readLong();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: run readLong is success, readlong is " + readlong);
                    expect(readlong == short).assertTrue();
                });
J
jiyong 已提交
2683

Y
yang-qibo 已提交
2684 2685 2686 2687 2688 2689 2690
                data.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07000---------------------------");
        });
J
jiyong 已提交
2691

Y
yang-qibo 已提交
2692
        /*
Z
zhangpa2021 已提交
2693
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_07100
Y
yang-qibo 已提交
2694
     * @tc.name    Writelong interface, illegal value verification
J
jiyong 已提交
2695 2696 2697
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2698 2699 2700 2701 2702 2703 2704
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_07100", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
2705

Y
yang-qibo 已提交
2706 2707 2708 2709
                var short = 2147483649;
                var writelong = data.writeLong(short);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: run writeLong success, writelong is " + writelong);
                expect(writelong == true).assertTrue();
Y
yang-qibo 已提交
2710

Y
yang-qibo 已提交
2711 2712 2713 2714 2715 2716 2717
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: run sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
Y
yang-qibo 已提交
2718

Y
yang-qibo 已提交
2719 2720 2721 2722
                    var readlong = result.reply.readLong();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: run readLong is success, readlong is " + readlong);
                    expect(readlong == short).assertTrue();
                });
J
jiyong 已提交
2723

Y
yang-qibo 已提交
2724 2725 2726 2727 2728 2729 2730
                data.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07100---------------------------");
        });
J
jiyong 已提交
2731

Y
yang-qibo 已提交
2732
        /*
Z
zhangpa2021 已提交
2733
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_07200
Y
yang-qibo 已提交
2734
     * @tc.name    Call the parallel interface to read and write data to the double instance
J
jiyong 已提交
2735 2736 2737
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_07200", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();

                var token = 10.2;
                var result = data.writeDouble(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200:run writeDoubleis is " + result);
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2754
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200: run sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
2755
                    var replyReadResult = reply.readDouble();
Z
zhangpa2021 已提交
2756
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200: run replyReadResult is " + replyReadResult);
Y
yang-qibo 已提交
2757 2758
                    expect(replyReadResult == token).assertTrue();
                });
Y
yang-qibo 已提交
2759 2760 2761 2762 2763 2764
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200:error = " + error);
            }
Y
yang-qibo 已提交
2765

Y
yang-qibo 已提交
2766 2767
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07200---------------------------");
        });
J
jiyong 已提交
2768

Y
yang-qibo 已提交
2769
        /*
Z
zhangpa2021 已提交
2770
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_07300
Y
yang-qibo 已提交
2771
     * @tc.name    Writedouble interface, boundary value verification
J
jiyong 已提交
2772 2773 2774
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_07300", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 1.79E+308;
                var result = data.writeDouble(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300:run writeDoubleis is " + result);
                expect(result == true).assertTrue();

                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300: run sendRequestis is " + result.errCode);
                    var replyReadResult = reply.readDouble();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300: run rreplyReadResult is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
Y
yang-qibo 已提交
2797

Y
yang-qibo 已提交
2798 2799 2800 2801
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300:error = " + error);
Y
yang-qibo 已提交
2802
            }
Y
yang-qibo 已提交
2803 2804
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07300---------------------------");
        });
2805

Y
yang-qibo 已提交
2806
        /*
Z
zhangpa2021 已提交
2807
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_07400
Y
yang-qibo 已提交
2808
     * @tc.name    Writedouble interface, boundary value verification
J
jiyong 已提交
2809 2810 2811
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_07400", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 4.9000000e-32;
                var result = data.writeDouble(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400:run writeDoubleis is " + result);
                expect(result == true).assertTrue();

                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400: run sendRequestis is " + result.errCode);
                    var replyReadResult = reply.readDouble();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400: run replyReadResult is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
Y
yang-qibo 已提交
2834

Y
yang-qibo 已提交
2835 2836 2837 2838
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400:error = " + error);
J
jiyong 已提交
2839
            }
Y
yang-qibo 已提交
2840 2841
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07400---------------------------");
        });
2842

Y
yang-qibo 已提交
2843
        /*
Z
zhangpa2021 已提交
2844
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_07500
Y
yang-qibo 已提交
2845
     * @tc.name    Writedouble interface, illegal value validation
J
jiyong 已提交
2846 2847 2848
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2849 2850 2851 2852 2853
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_07500", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07500: create object successfully.");
Y
yang-qibo 已提交
2854

Y
yang-qibo 已提交
2855 2856 2857
                var token = "1.79E+465312156";
                var result = data.writeDouble(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07500:run writeDoubleis is " + result);
Z
zhangpa2021 已提交
2858

Y
yang-qibo 已提交
2859 2860 2861 2862 2863 2864 2865
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07500:error = " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07500---------------------------");
        });
J
jiyong 已提交
2866

Y
yang-qibo 已提交
2867
        /*
Z
zhangpa2021 已提交
2868
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_07600
Y
yang-qibo 已提交
2869 2870
     * @tc.name    Call the writeboolean interface to write the data to the messageparcel instance,
     *             and call readboolean to read the data
J
jiyong 已提交
2871 2872 2873
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_07600", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = true;
                var result = data.writeBoolean(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600:run writeBooleanis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BOOLEAN, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600: run sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readBoolean();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600: run readBoolean is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07600---------------------------");
        });
J
jiyong 已提交
2903

Y
yang-qibo 已提交
2904
        /*
Z
zhangpa2021 已提交
2905
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_07700
Y
yang-qibo 已提交
2906 2907 2908 2909 2910
     * @tc.name    Call the writeboolean interface to write the data to the messageparcel instance,
     *             and call readboolean to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_07700", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = false;
                var result = data.writeBoolean(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700:run writeBooleanis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BOOLEAN, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700: run sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readBoolean();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700: run readBoolean is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07700---------------------------");
        });
J
jiyong 已提交
2940

Y
yang-qibo 已提交
2941
        /*
Z
zhangpa2021 已提交
2942
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_07800
Y
yang-qibo 已提交
2943
     * @tc.name    Writeboolean interface, illegal value verification
J
jiyong 已提交
2944 2945 2946
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_07800", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07800: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 9;
                var result = data.writeBoolean(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07800:run writeBooleanis is " + result);
                expect(result == false).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07800:error = " + error);
                expect(error != null).assertTrue();
            }
            data.reclaim();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07800---------------------------");
        });
J
jiyong 已提交
2965

Y
yang-qibo 已提交
2966
        /*
Z
zhangpa2021 已提交
2967
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_07900
Y
yang-qibo 已提交
2968
     * @tc.name    Writeboolean interface, illegal value verification
J
jiyong 已提交
2969 2970 2971
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_07900", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07900: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = "aaa";
                var result = data.writeBoolean(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07900:run writeBooleanis is " + result);
                expect(result == false).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07900:error = " + error);
                expect(error != null).assertTrue();
            }
            data.reclaim();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07900---------------------------");
        });
Y
yang-qibo 已提交
2990

Y
yang-qibo 已提交
2991
        /*
Z
zhangpa2021 已提交
2992
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_08000
Y
yang-qibo 已提交
2993 2994 2995 2996 2997
     * @tc.name    Call the writechar interface to write the data to the messageparcel instance,
     *             and call readchar to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_08000", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 65;
                var result = data.writeChar(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000:run writeCharis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000: sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readChar();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000: run readChar is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
J
jiyong 已提交
3019

Y
yang-qibo 已提交
3020 3021 3022 3023 3024 3025 3026 3027
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08000---------------------------");
        });
J
jiyong 已提交
3028

Y
yang-qibo 已提交
3029
        /*
Z
zhangpa2021 已提交
3030
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_08100
Y
yang-qibo 已提交
3031 3032
     * @tc.name    Call the writechar interface to write the data to the messageparcel instance,
     *             and call readchar to read the data
J
jiyong 已提交
3033 3034 3035
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_08100", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 122;
                var result = data.writeChar(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100:run writeCharis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100: sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readChar();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100: run readChar is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
J
jiyong 已提交
3057

Y
yang-qibo 已提交
3058 3059 3060 3061 3062 3063 3064 3065
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08100---------------------------");
        });
J
jiyong 已提交
3066

Y
yang-qibo 已提交
3067
        /*
Z
zhangpa2021 已提交
3068
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_08200
Y
yang-qibo 已提交
3069 3070
     * @tc.name    Call the writechar interface to write the data to the messageparcel instance,
     *             and call readchar to read the data
J
jiyong 已提交
3071 3072 3073
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_08200", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 64;
                var result = data.writeChar(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200:run writeCharis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200: sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readChar();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200: run readChar is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
J
jiyong 已提交
3095

Y
yang-qibo 已提交
3096 3097 3098 3099 3100 3101 3102 3103
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08200---------------------------");
        });
J
jiyong 已提交
3104

Y
yang-qibo 已提交
3105
        /*
Z
zhangpa2021 已提交
3106
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_08300
Y
yang-qibo 已提交
3107 3108
     * @tc.name    Call the writechar interface to write the data to the messageparcel instance,
     *             and call readchar to read the data
J
jiyong 已提交
3109 3110 3111
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_08300", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 123;
                var result = data.writeChar(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300:run writeCharis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300: sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readChar();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300: run readChar is  " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
J
jiyong 已提交
3133

Y
yang-qibo 已提交
3134 3135 3136 3137 3138 3139 3140 3141
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08300---------------------------");
        });
J
jiyong 已提交
3142

Y
yang-qibo 已提交
3143
        /*
Z
zhangpa2021 已提交
3144
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_08400
Y
yang-qibo 已提交
3145 3146
     * @tc.name    Call the writechar interface to write the data to the messageparcel instance,
     *             and call readchar to read the data
J
jiyong 已提交
3147 3148 3149
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_08400", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 65;
                var result = data.writeChar(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400:run writeCharis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400: sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readChar();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400: run readChar is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
J
jiyong 已提交
3171

Y
yang-qibo 已提交
3172 3173 3174 3175 3176 3177 3178 3179
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08400---------------------------");
        });
J
jiyong 已提交
3180

Y
yang-qibo 已提交
3181
        /*
Z
zhangpa2021 已提交
3182
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_08500
Y
yang-qibo 已提交
3183
     * @tc.name    Writechar interface, illegal value verification
J
jiyong 已提交
3184 3185 3186
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_08500", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08500: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 'ades';
                var result = data.writeChar(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08500:run writeCharis is " + result);
                expect(result == false).assertTrue()

            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08500:error = " + error);
                expect(error != null).assertTrue();
            }
            data.reclaim();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08500---------------------------");
        });
J
jiyong 已提交
3206

Y
yang-qibo 已提交
3207
        /*
Z
zhangpa2021 已提交
3208
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_08600
Y
yang-qibo 已提交
3209 3210
     * @tc.name    Call the writestring interface to write the data to the messageparcel instance,
     *             and call readstring() to read the data
J
jiyong 已提交
3211 3212 3213
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_08600", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = '';
                for(var i = 0; i < (40*K - 1); i++){
                    token += 'a';
                };
                var result = data.writeString(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600:run writeStringis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600: sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readString();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600: run readString is " + replyReadResult.length);
                    expect(replyReadResult == token).assertTrue();
                });
J
jiyong 已提交
3238

Y
yang-qibo 已提交
3239 3240 3241 3242 3243 3244 3245 3246
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08600---------------------------");
        });
J
jiyong 已提交
3247

Y
yang-qibo 已提交
3248
        /*
Z
zhangpa2021 已提交
3249
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_08700
Y
yang-qibo 已提交
3250 3251
     * @tc.name    Call the writestring interface to write the data to the messageparcel instance,
     *             and call readstring() to read the data
J
jiyong 已提交
3252 3253 3254
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_08700", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08700: create object successfully.");
                var token = '';
                for(var i = 0; i < 40*K; i++){
                    token += 'a';
                };
                var result = data.writeString(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08700:run writeStringis is " + result);
                expect(result == false).assertTrue();
J
jiyong 已提交
3267

Y
yang-qibo 已提交
3268 3269 3270 3271 3272 3273 3274
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08700:error = " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08700---------------------------");
        });
J
jiyong 已提交
3275

Y
yang-qibo 已提交
3276
        /*
Z
zhangpa2021 已提交
3277
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_08800
Y
yang-qibo 已提交
3278
     * @tc.name    Writestring interface, illegal value verification
J
jiyong 已提交
3279 3280 3281
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_08800", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08800: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 123;
                var result = data.writeString(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08800:run writeStringis is " + result);
                expect(result == false).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08800:error = " + error);
                expect(error != null).assertTrue();
            }
            data.reclaim();
            reply.reclaim();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08800---------------------------");
        });
J
jiyong 已提交
3301

Y
yang-qibo 已提交
3302
        /*
Z
zhangpa2021 已提交
3303
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_08900
Y
yang-qibo 已提交
3304 3305
     * @tc.name    Call the writebyte interface to write data to the messageparcel instance,
     *             and call readbyte to read data
J
jiyong 已提交
3306 3307 3308
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_08900", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 2;
                var result = data.writeByte(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900:run writeByteis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BYTE, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900: sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readByte();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900: run readByte is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
Y
yang-qibo 已提交
3330

Y
yang-qibo 已提交
3331 3332 3333 3334 3335 3336 3337 3338
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08900---------------------------");
        });
J
jiyong 已提交
3339

Y
yang-qibo 已提交
3340
        /*
Z
zhangpa2021 已提交
3341
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_09000
Y
yang-qibo 已提交
3342
     * @tc.name    Writebyte interface, boundary value verification
J
jiyong 已提交
3343 3344 3345
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_09000", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09000: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();

                expect(data.writeByte(-128) == true).assertTrue();
                expect(data.writeByte(0) == true).assertTrue();
                expect(data.writeByte(1) == true).assertTrue();
                expect(data.writeByte(2) == true).assertTrue();
                expect(data.writeByte(127) == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09000: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BYTE_MULTI, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09000: sendRequestis is " + result.errCode);

                    expect(reply.readByte() == -128).assertTrue();
                    expect(reply.readByte() == 0).assertTrue();
                    expect(reply.readByte() == 1).assertTrue();
                    expect(reply.readByte() == 2).assertTrue();
                    expect(reply.readByte() == 127).assertTrue();
                });
Y
yang-qibo 已提交
3372

Y
yang-qibo 已提交
3373 3374 3375 3376 3377
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09000:error = " + error);
Y
yang-qibo 已提交
3378
            }
Y
yang-qibo 已提交
3379 3380
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09000---------------------------");
        });
3381

Y
yang-qibo 已提交
3382
        /*
Z
zhangpa2021 已提交
3383
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_09100
Y
yang-qibo 已提交
3384
     * @tc.name    Writebyte interface, illegal value verification
J
jiyong 已提交
3385 3386 3387
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3388 3389 3390 3391 3392 3393 3394
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_09100", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09100: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
3395

Y
yang-qibo 已提交
3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409
                expect(data.writeByte(-129) == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09100: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BYTE_MULTI, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09100: sendRequestis is " + result.errCode);
                    expect(reply.readByte() == 127).assertTrue();
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09100:error = " + error);
Y
yang-qibo 已提交
3410
            }
Y
yang-qibo 已提交
3411 3412
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09100---------------------------");
        });
J
jiyong 已提交
3413

Y
yang-qibo 已提交
3414
        /*
Z
zhangpa2021 已提交
3415
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_09200
Y
yang-qibo 已提交
3416
     * @tc.name    Writebyte interface, illegal value verification
J
jiyong 已提交
3417 3418 3419
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3420 3421 3422 3423 3424 3425 3426
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_09200", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09200: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
3427

Y
yang-qibo 已提交
3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441
                expect(data.writeByte(128) == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09200: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_BYTE_MULTI, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09200: sendRequestis is " + result.errCode);
                    expect(reply.readByte() == -128).assertTrue();
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09200:error = " + error);
Y
yang-qibo 已提交
3442
            }
Y
yang-qibo 已提交
3443 3444
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09200---------------------------");
        });
J
jiyong 已提交
3445

Y
yang-qibo 已提交
3446
        /*
Z
zhangpa2021 已提交
3447
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_09300
Y
yang-qibo 已提交
3448
     * @tc.name    Writebyte interface, illegal value verification
J
jiyong 已提交
3449 3450 3451
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_09300", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09300: create object successfully.");
                let writeby = data.writeByte("error");
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09300: writeByte is" + writeby);
                expect(writeby).assertEqual(false);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09300:error = " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09300---------------------------");
        });
J
jiyong 已提交
3467

Y
yang-qibo 已提交
3468
        /*
Z
zhangpa2021 已提交
3469
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_09400
Y
yang-qibo 已提交
3470 3471
     * @tc.name    Call the writeint interface to write the data to the messageparcel instance,
     *             and call readint to read the data
J
jiyong 已提交
3472 3473 3474
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_09400", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 2;
                var result = data.writeInt(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400:run writeIntis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400: sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400: run readInt is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
J
jiyong 已提交
3496

Y
yang-qibo 已提交
3497 3498 3499 3500 3501 3502
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400:error = " + error);
            }
Y
yang-qibo 已提交
3503

Y
yang-qibo 已提交
3504 3505
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09400---------------------------");
        });
J
jiyong 已提交
3506

Y
yang-qibo 已提交
3507
        /*
Z
zhangpa2021 已提交
3508
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_09500
Y
yang-qibo 已提交
3509
     * @tc.name    Writeint interface, boundary value verification
J
jiyong 已提交
3510 3511 3512
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3513 3514 3515 3516 3517 3518 3519
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_09500", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09500: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
J
jiyong 已提交
3520

Y
yang-qibo 已提交
3521 3522 3523 3524 3525
                expect(data.writeInt(-2147483648) == true).assertTrue();
                expect(data.writeInt(0) == true).assertTrue();
                expect(data.writeInt(1) == true).assertTrue();
                expect(data.writeInt(2) == true).assertTrue();
                expect(data.writeInt(2147483647) == true).assertTrue();
J
jiyong 已提交
3526

Y
yang-qibo 已提交
3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09500: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT_MULTI, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09500: sendRequestis is " + result.errCode);
                    expect(result.reply.readInt() == -2147483648).assertTrue();
                    expect(result.reply.readInt() == 0).assertTrue();
                    expect(result.reply.readInt() == 1).assertTrue();
                    expect(result.reply.readInt() == 2).assertTrue();
                    expect(result.reply.readInt() == 2147483647).assertTrue();
                });
3539

Y
yang-qibo 已提交
3540 3541 3542 3543 3544 3545
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09500:error = " + error);
            }
Y
yang-qibo 已提交
3546

Y
yang-qibo 已提交
3547 3548
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09500---------------------------");
        });
J
jiyong 已提交
3549

Y
yang-qibo 已提交
3550
        /*
Z
zhangpa2021 已提交
3551
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_09600
Y
yang-qibo 已提交
3552
     * @tc.name    Writeint interface, illegal value verification
J
jiyong 已提交
3553
     * @tc.desc    Function test
3554 3555
     * @tc.level   0
     */
Y
yang-qibo 已提交
3556 3557 3558 3559 3560 3561 3562 3563
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_09600", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09600: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                expect(data.writeInt(2147483648) == true).assertTrue();
J
jiyong 已提交
3564

Y
yang-qibo 已提交
3565 3566 3567 3568 3569 3570 3571 3572
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09600: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT_MULTI, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09600: sendRequestis is " + result.errCode);
                    expect(result.reply.readInt() == -2147483648).assertTrue();
                });
3573

Y
yang-qibo 已提交
3574 3575 3576 3577 3578 3579
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09600:error = " + error);
            }
J
jiyong 已提交
3580

Y
yang-qibo 已提交
3581 3582
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09600---------------------------");
        });
J
jiyong 已提交
3583

Y
yang-qibo 已提交
3584
        /*
Z
zhangpa2021 已提交
3585
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_09700
Y
yang-qibo 已提交
3586
     * @tc.name    Writeint interface, illegal value verification
J
jiyong 已提交
3587 3588 3589
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3590 3591 3592 3593 3594 3595 3596 3597
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_09700", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09700: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                expect(data.writeInt(-2147483649) == true).assertTrue();
J
jiyong 已提交
3598

Y
yang-qibo 已提交
3599 3600 3601 3602 3603 3604 3605 3606
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09700: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT_MULTI, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09700: sendRequestis is " + result.errCode);
                    expect(result.reply.readInt() == 2147483647).assertTrue();
                });
3607

Y
yang-qibo 已提交
3608 3609 3610 3611 3612 3613
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09700:error = " + error);
            }
Y
yang-qibo 已提交
3614

Y
yang-qibo 已提交
3615 3616
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09700---------------------------");
        });
J
jiyong 已提交
3617

Y
yang-qibo 已提交
3618
        /*
Z
zhangpa2021 已提交
3619
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_09800
Y
yang-qibo 已提交
3620 3621
     * @tc.name    Call the writefloat interface to write data to the messageparcel instance,
     *             and call readfloat to read data
J
jiyong 已提交
3622 3623 3624
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_09800", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 2.2;
                var result = data.writeFloat(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800:run writeDoubleis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800: sendRequestis is " + result.errCode);
                    var replyReadResult = result.reply.readFloat();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800: run readFloat is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
J
jiyong 已提交
3646

Y
yang-qibo 已提交
3647 3648 3649 3650 3651 3652 3653 3654
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09800---------------------------");
        });
J
jiyong 已提交
3655

Y
yang-qibo 已提交
3656
        /*
Z
zhangpa2021 已提交
3657
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_09900
Y
yang-qibo 已提交
3658
     * @tc.name    Writefloat interface, boundary value verification
J
jiyong 已提交
3659 3660 3661
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_09900", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 3.4E+38;
                var result = data.writeFloat(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900:run writeFloatis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900: sendRequestis is " + result.errCode);
                    var newReadResult = result.reply.readFloat();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900: readFloat result is " + newReadResult);
                    expect(newReadResult == token).assertTrue();
                });
J
jiyong 已提交
3683

Y
yang-qibo 已提交
3684 3685 3686 3687 3688 3689
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900:error = " + error);
            }
J
jiyong 已提交
3690

Y
yang-qibo 已提交
3691 3692
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09900---------------------------");
        });
J
jiyong 已提交
3693

Y
yang-qibo 已提交
3694
        /*
Z
zhangpa2021 已提交
3695
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_10000
Y
yang-qibo 已提交
3696
     * @tc.name    Writefloat interface, boundary value verification
J
jiyong 已提交
3697 3698 3699
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_10000", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 1.4E-45;
                var result = data.writeFloat(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000:run writeFloatis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000: sendRequestis is " + result.errCode);
                    var newReadResult = result.reply.readFloat();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000: readFloat result is " + newReadResult);
                    expect(newReadResult == token).assertTrue();
                });
J
jiyong 已提交
3721

Y
yang-qibo 已提交
3722 3723 3724 3725 3726 3727
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000:error = " + error);
            }
J
jiyong 已提交
3728

Y
yang-qibo 已提交
3729 3730
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10000---------------------------");
        });
J
jiyong 已提交
3731

Y
yang-qibo 已提交
3732
        /*
Z
zhangpa2021 已提交
3733
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_10100
Y
yang-qibo 已提交
3734
     * @tc.name    Writefloat interface, boundary value verification
J
jiyong 已提交
3735 3736 3737
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_10100", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var token = 4.4E+38;
                var result = data.writeFloat(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100:run writeFloatis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100: sendRequestis is " + result.errCode);
                    var newReadResult = result.reply.readFloat();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100: readFloat result is " + newReadResult);
                    expect(newReadResult == token).assertTrue();
                });
J
jiyong 已提交
3759

Y
yang-qibo 已提交
3760 3761 3762 3763 3764 3765
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100:error = " + error);
            }
J
jiyong 已提交
3766

Y
yang-qibo 已提交
3767 3768
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10100---------------------------");
        });
J
jiyong 已提交
3769

Y
yang-qibo 已提交
3770
        /*
Z
zhangpa2021 已提交
3771
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_10200
Y
yang-qibo 已提交
3772
     * @tc.name    Writefloat interface, illegal value validation
J
jiyong 已提交
3773 3774 3775
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3776 3777 3778 3779 3780
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_10200", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10200: create object successfully.");
Y
yang-qibo 已提交
3781

Y
yang-qibo 已提交
3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792
                var token = 'a';
                var result = data.writeFloat(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10200:run writeFloatis is " + result);
                expect(result == false).assertTrue();
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10200:error = " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10200---------------------------");
        });
J
jiyong 已提交
3793

Y
yang-qibo 已提交
3794
        /*
Z
zhangpa2021 已提交
3795
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_10300
Y
yang-qibo 已提交
3796
     * @tc.name    Test messageparcel to deliver rawdata data
J
jiyong 已提交
3797 3798 3799
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_10300", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10300: create object successfully.");

                var Capacity = data.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10300:run Capacity success, Capacity is " + Capacity);
                expect(Capacity).assertEqual(128*M);

                var rawdata = [1, 2, 3]
                var result = data.writeRawData(rawdata, rawdata.length);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10300:run writeRawDatais is " + result);
                expect(result == true).assertTrue();
                var newReadResult = data.readRawData(rawdata.length)
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10300:run readRawDatais is " + newReadResult);
                assertArrayElementEqual(newReadResult,rawdata);
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10300:error = " + error);
            }
            data.reclaim();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10300---------------------------");
        });
3823

Y
yang-qibo 已提交
3824
        /*
Z
zhangpa2021 已提交
3825
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_10400
Y
yang-qibo 已提交
3826
     * @tc.name    Illegal value passed in from writerawdata interface
J
jiyong 已提交
3827 3828 3829
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_10400", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10400: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var Capacity = data.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10400:run Capacityis is " + Capacity);
                expect(Capacity).assertEqual(128*M);
                var token = [2,1,4,3,129] ;
                var result = data.writeRawData(token, 149000000);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10400:run writeRawDatais is " + result);
                expect(result == false).assertTrue();
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10400:error = " + error);
            }
Y
yang-qibo 已提交
3850

Y
yang-qibo 已提交
3851 3852
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10400---------------------------");
        });
J
jiyong 已提交
3853

Y
yang-qibo 已提交
3854
        /*
Z
zhangpa2021 已提交
3855
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_10500
Y
yang-qibo 已提交
3856
     * @tc.name    Illegal value passed in from writerawdata interface
J
jiyong 已提交
3857 3858 3859
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_10500", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10500---------------------------");
            try{
                let parcel = new rpc.MessageParcel();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500: create object successfully.");
                let reply = new rpc.MessageParcel();
                let option = new rpc.MessageOption();
                let arr = [1, 2, 3, 4, 5];
                expect(parcel.writeInt(arr.length)).assertTrue();
                let isWriteSuccess = parcel.writeRawData(arr, arr.length);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500: parcel write raw data result is : " + isWriteSuccess);
                expect(isWriteSuccess).assertTrue();
                let Capacity = parcel.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500:run Capacity success, Capacity is " + Capacity);
                expect(Capacity).assertEqual(128*M);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let size = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500:run readIntis is " + size);
                    expect(size).assertEqual(arr.length);
                    let reCapacity = parcel.getRawDataCapacity()
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500:run Capacity is " + reCapacity);
                    expect(reCapacity).assertEqual(128*M);
                    let newReadResult = result.reply.readRawData(size);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500:run readRawDatais " + newReadResult);
                    assertArrayElementEqual(newReadResult,arr);
                });
                parcel.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10500---------------------------");
        });
J
jiyong 已提交
3899

Y
yang-qibo 已提交
3900
        /*
Z
zhangpa2021 已提交
3901
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_10600
Y
yang-qibo 已提交
3902 3903 3904 3905
    * @tc.name    Test messageParcel to deliver abnormal RawData data
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_10600", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10600---------------------------");
            try{
                let parcel = new rpc.MessageParcel();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600: create object successfully.");
                let reply = new rpc.MessageParcel();
                let option = new rpc.MessageOption();
                let arr = [1, 2, 3, 4, 5];
                expect(parcel.writeInt(arr.length + 1)).assertTrue();
                let isWriteSuccess = parcel.writeRawData(arr, (arr.length + 1));
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600: parcel write raw data result is : " + isWriteSuccess);
                expect(isWriteSuccess).assertTrue();
                let Capacity = parcel.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600:run Capacity success, Capacity is " + Capacity);
                expect(Capacity).assertEqual(128*M);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600: result is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let size = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600:run readIntis is " + size);
                    expect(size).assertEqual(arr.length + 1);
                    let reCapacity = parcel.getRawDataCapacity()
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600:run Capacity is " + reCapacity);
                    expect(reCapacity).assertEqual(128*M);
                    let newReadResult = result.reply.readRawData(size);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600:run readRawDatais " + newReadResult);
                    expect(arr[0]).assertEqual(newReadResult[0]);
                    expect(arr[1]).assertEqual(newReadResult[1]);
                    expect(arr[2]).assertEqual(newReadResult[2]);
                    expect(arr[3]).assertEqual(newReadResult[3]);
                    expect(arr[4]).assertEqual(newReadResult[4]);
                });
                parcel.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10600---------------------------");
        });
J
jiyong 已提交
3949

Y
yang-qibo 已提交
3950
        /*
Z
zhangpa2021 已提交
3951
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_10700
Y
yang-qibo 已提交
3952 3953 3954 3955
    * @tc.name    Test messageParcel to deliver abnormal RawData data
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_10700", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10700---------------------------");
            try{
                let parcel = new rpc.MessageParcel();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700: create object successfully.");
                let reply = new rpc.MessageParcel();
                let option = new rpc.MessageOption();
                let arr = [1, 2, 3, 4, 5];
                expect(parcel.writeInt(arr.length-1)).assertTrue();
                let isWriteSuccess = parcel.writeRawData(arr, (arr.length - 1));
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700: parcel write raw data result is : " + isWriteSuccess);
                expect(isWriteSuccess).assertTrue();
                let Capacity = parcel.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700:run Capacity success, Capacity is " + Capacity);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700: result is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let size = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700:run readIntis is " + size);
                    expect(size).assertEqual(arr.length - 1);
                    let reCapacity = parcel.getRawDataCapacity()
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700:run Capacity success, Capacity is " + reCapacity);
                    expect(reCapacity).assertEqual(128*M);
                    let newReadResult = result.reply.readRawData(size);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700:run readRawDatais is " + newReadResult);
                    expect(arr[0]).assertEqual(newReadResult[0]);
                    expect(arr[1]).assertEqual(newReadResult[1]);
                    expect(arr[2]).assertEqual(newReadResult[2]);
                    expect(arr[3]).assertEqual(newReadResult[3]);
                });
                parcel.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10700---------------------------");
        });
J
jiyong 已提交
3997

Y
yang-qibo 已提交
3998
        /*
Z
zhangpa2021 已提交
3999
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_10800
Y
yang-qibo 已提交
4000 4001 4002 4003
    * @tc.name    Test messageParcel to deliver out-of-bounds RawData data
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_10800", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10800---------------------------");
            try{
                let parcel = new rpc.MessageParcel();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800: create object successfully.");
                let reply = new rpc.MessageParcel();
                let option = new rpc.MessageOption();
                let arr = [-129, 2, 3, 4, 128];
                expect(parcel.writeInt(arr.length)).assertTrue();
                let isWriteSuccess = parcel.writeRawData(arr, arr.length);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800: parcel write raw data result is : " + isWriteSuccess);
                expect(isWriteSuccess).assertTrue();
                let Capacity = parcel.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800:run Capacity success, Capacity is " + Capacity);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800: result is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let size = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800:run readIntis is " + size);
                    expect(size).assertEqual(arr.length);
                    let reCapacity = parcel.getRawDataCapacity()
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800:run Capacity is " + reCapacity);
                    expect(reCapacity).assertEqual(128*M);
                    let newReadResult = result.reply.readRawData(size);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800:run readRawDatais is " + newReadResult);
                    assertArrayElementEqual(newReadResult,arr);
                });
                parcel.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10800---------------------------");
        });
Y
yang-qibo 已提交
4042

Y
yang-qibo 已提交
4043
        /*
Z
zhangpa2021 已提交
4044
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_10900
Y
yang-qibo 已提交
4045 4046 4047 4048
    * @tc.name    Test messageParcel to deliver illegal RawData data
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_10900", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10900---------------------------");
            try{
                let parcel = new rpc.MessageParcel();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10900: create object successfully.");
                let reply = new rpc.MessageParcel();
                let option = new rpc.MessageOption();
                let arr = ["aaa", 1, 2, 3];
                expect(parcel.writeInt(arr.length)).assertTrue();
                let isWriteSuccess = parcel.writeRawData(arr, arr.length);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10900: parcel write raw data result is : " + isWriteSuccess);
                expect(isWriteSuccess).assertTrue();
                let reCapacity = parcel.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10900:run Capacity success, Capacity is " + reCapacity);
                expect(reCapacity).assertEqual(128*M);
                parcel.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10900:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10900---------------------------");
        });
Y
yang-qibo 已提交
4071

Y
yang-qibo 已提交
4072
        /*
Z
zhangpa2021 已提交
4073
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_11000
Y
yang-qibo 已提交
4074 4075 4076 4077
     * @tc.name    Call the writeremoteobject interface to serialize the remote object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_11000", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11000: create object successfully.");

                let testRemoteObject = new TestRemoteObject("testObject");
                var result = data.writeRemoteObject(testRemoteObject);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11000: result is " + result);
                expect(result == true).assertTrue();
                data.readRemoteObject()
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11000:error = " + error);
            }
            data.reclaim();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11000---------------------------");
        });
4095

Y
yang-qibo 已提交
4096
        /*
Z
zhangpa2021 已提交
4097
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_11100
Y
yang-qibo 已提交
4098 4099 4100 4101
     * @tc.name    Call the writeremoteobject interface to serialize the remote object and pass in the empty object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_11100", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11100: create object successfully.");

                var token = {}
                var result = data.writeRemoteObject(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11100: result is " + result);
                expect(result == false).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11100:error = " + error);
            }
            data.reclaim();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11100---------------------------");
        });
Y
yang-qibo 已提交
4118

Y
yang-qibo 已提交
4119
        /*
Z
zhangpa2021 已提交
4120
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_11200
4121
     * @tc.name    Call the writeSequenceable interface to write the custom serialized
Y
yang-qibo 已提交
4122
     *             object to the messageparcel instance
J
jiyong 已提交
4123 4124 4125
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_11200", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11200: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();

                let sequenceable = new MySequenceable(1, "aaa");
                let result = data.writeSequenceable(sequenceable);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11200: writeSequenceable is " + result);
                expect(result == true).assertTrue();
                let ret = new MySequenceable(0, "");
                let result2 = data.readSequenceable(ret);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11200: readSequenceable is " + result2);
                expect(result2 == true).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11200:error = " + error);
            }
            data.reclaim();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11200---------------------------");
        });
J
jiyong 已提交
4148

Y
yang-qibo 已提交
4149
        /*
Z
zhangpa2021 已提交
4150
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_11300
Y
yang-qibo 已提交
4151 4152
     * @tc.name    After the server finishes processing, write noexception first before writing the result,
     *             and the client calls readexception to judge whether the server is abnormal
J
jiyong 已提交
4153 4154 4155
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4156 4157 4158 4159 4160 4161 4162
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_11300", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
Y
yang-qibo 已提交
4163

Y
yang-qibo 已提交
4164 4165 4166
                data.writeNoException();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300: run writeNoException success");
                expect(data.writeInt(6) == true).assertTrue();
Y
yang-qibo 已提交
4167

Y
yang-qibo 已提交
4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_NOEXCEPTION, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300: sendRequestis is " + result.errCode);
                    result.reply.readException()
                    var replyData = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300: readResult is " + replyData);
                    expect(replyData == 6).assertTrue();
                });
4179

Y
yang-qibo 已提交
4180 4181 4182 4183 4184 4185 4186 4187
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11300---------------------------");
        });
J
jiyong 已提交
4188

Y
yang-qibo 已提交
4189
        /*
Z
zhangpa2021 已提交
4190
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_11400
Y
yang-qibo 已提交
4191 4192
     * @tc.name    If the data on the server is abnormal, the client calls readexception
     *             to judge whether the server is abnormal
J
jiyong 已提交
4193 4194 4195
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4196 4197 4198 4199 4200 4201 4202
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_11400", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11400---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
Y
yang-qibo 已提交
4203

Y
yang-qibo 已提交
4204 4205 4206
                data.writeNoException();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400: run writeNoException success");
                expect(data.writeInt(1232222223444) == true).assertTrue();
Z
zhangpa2021 已提交
4207

Y
yang-qibo 已提交
4208 4209 4210 4211 4212 4213 4214 4215 4216 4217
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_NOEXCEPTION, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400: sendRequestis is " + result.errCode);
                    result.reply.readException()
                    var replyData = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400: readResult is " + replyData);
                });
4218

Y
yang-qibo 已提交
4219 4220 4221 4222 4223 4224 4225 4226
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11400---------------------------");
        });
J
jiyong 已提交
4227

Y
yang-qibo 已提交
4228
        /*
Z
zhangpa2021 已提交
4229
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_11500
Y
yang-qibo 已提交
4230
     * @tc.name    Serializable object marshaling and unmarshalling test
J
jiyong 已提交
4231 4232 4233
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_11500", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var sequenceable = new MySequenceable(1, "aaa");
                var result = data.writeSequenceable(sequenceable);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500: writeSequenceable is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLE, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500: sendRequestis is " + result.errCode);
                    var s = new MySequenceable(null,null)
                    var resultReply = result.reply.readSequenceable(s);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500: run readSequenceable is " + resultReply);
                    expect(resultReply == true).assertTrue();
                    expect(s.str == sequenceable.str).assertTrue();
                    expect(s.num == sequenceable.num).assertTrue();
                });
Y
yang-qibo 已提交
4258

Y
yang-qibo 已提交
4259 4260 4261 4262 4263 4264
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500:error = " + error);
            }
Z
zhangpa2021 已提交
4265

Y
yang-qibo 已提交
4266 4267
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11500---------------------------");
        });
Y
yang-qibo 已提交
4268

Y
yang-qibo 已提交
4269
        /*
Z
zhangpa2021 已提交
4270
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_11600
Y
yang-qibo 已提交
4271 4272 4273 4274
     * @tc.name    Non serializable object marshaling test
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_11600", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var sequenceable = new MySequenceable(1, "aaa");
                var result = data.writeSequenceable(sequenceable);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600: writeSequenceable is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLE, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600: sendRequestis is " + result.errCode);
                    var s = new MySequenceable(null,null)
                    var replyReadResult = reply.readSequenceable(s);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600: run readSequenceable is " + replyReadResult);
                    expect(replyReadResult == true).assertTrue();
                    expect(s.str == sequenceable.str).assertTrue();
                    expect(s.num == sequenceable.num).assertTrue();
                });
Y
yang-qibo 已提交
4299

Y
yang-qibo 已提交
4300 4301 4302 4303 4304 4305 4306 4307
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11600---------------------------");
        });
Y
yang-qibo 已提交
4308

Y
yang-qibo 已提交
4309
        /*
Z
zhangpa2021 已提交
4310
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_11700
Y
yang-qibo 已提交
4311 4312 4313 4314
     * @tc.name    The server did not send a serializable object, and the client was ungrouped
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_11700", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var sequenceable = 10;
                var result = data.writeInt(sequenceable);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700 writeInt is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700: sendRequestis is " + result.errCode);
                    var s = new MySequenceable(0,null)
                    var replyReadResult = result.reply.readSequenceable(s);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700: run readSequenceable is" + replyReadResult);
                });
Y
yang-qibo 已提交
4336

Y
yang-qibo 已提交
4337 4338 4339 4340 4341 4342
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700:error = " + error);
            }
Y
yang-qibo 已提交
4343

Y
yang-qibo 已提交
4344 4345
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11700---------------------------");
        });
Y
yang-qibo 已提交
4346

Y
yang-qibo 已提交
4347
        /*
Z
zhangpa2021 已提交
4348
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_11800
4349 4350
     * @tc.name    Call the writeSequenceable interface to write the custom serialized object to the
     *             messageparcel instance, and call readSequenceable to read the data
Y
yang-qibo 已提交
4351 4352 4353
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_11800", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11800: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var sequenceable = new MySequenceable(2, "abc");
                var result = data.writeSequenceable(sequenceable);
                console.info("RpcClient: writeSequenceable is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11800: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLE, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11800: sendRequestis is " + result.errCode);
                    var s = new MySequenceable(null,null)
                    var replyReadResult = result.reply.readSequenceable(s);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11800: run readSequenceable is" + replyReadResult);
                    expect(s.str == sequenceable.str).assertTrue();
                    expect(s.num == sequenceable.num).assertTrue();
                });
Y
yang-qibo 已提交
4377

Y
yang-qibo 已提交
4378 4379 4380 4381 4382 4383
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11800:error = " + error);
            }
Y
yang-qibo 已提交
4384

Y
yang-qibo 已提交
4385 4386
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11800---------------------------");
        });
Y
yang-qibo 已提交
4387

Y
yang-qibo 已提交
4388
        /*
Z
zhangpa2021 已提交
4389
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_11900
4390 4391
     * @tc.name    Call the writeSequenceablearray interface to write the custom serialized object to the
     *             messageparcel instance, and call readSequenceablearray to read the data
Y
yang-qibo 已提交
4392 4393 4394
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_11900", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11900---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var sequenceable = [new MySequenceable(1, "aaa"),
                    new MySequenceable(2, "bbb"), new MySequenceable(3, "ccc")];
                var result = data.writeSequenceableArray(sequenceable);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900: writeSequenceableArray is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900: gIRemoteObject is undefined");
Y
yang-qibo 已提交
4410
                }
Y
yang-qibo 已提交
4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421
                await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLEARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900: sendRequestis is " + result.errCode);
                    var s = [new MySequenceable(null, null), new MySequenceable(null, null),
                        new MySequenceable(null, null)];
                    result.reply.readSequenceableArray(s);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900: run readSequenceableArray is" + s);
                    for (let i = 0; i < s.length; i++) {
                        expect(s[i].str).assertEqual(sequenceable[i].str)
                        expect(s[i].num).assertEqual(sequenceable[i].num)
                    }
                });
Y
yang-qibo 已提交
4422

Y
yang-qibo 已提交
4423 4424 4425 4426 4427 4428
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900:error = " + error);
            }
Y
yang-qibo 已提交
4429

Y
yang-qibo 已提交
4430 4431
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11900---------------------------");
        });
Y
yang-qibo 已提交
4432

Y
yang-qibo 已提交
4433
        /*
Z
zhangpa2021 已提交
4434
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_12000
4435 4436
     * @tc.name    Call the writeSequenceablearray interface to write the custom serialized object to the
     *             messageparcel instance, and call readSequenceablearray to read the data
Y
yang-qibo 已提交
4437 4438 4439
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_12000", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12000---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                var sequenceable = [new MySequenceable(4, "abc"),
                    new MySequenceable(5, "bcd"), new MySequenceable(6, "cef")];
                var result = data.writeSequenceableArray(sequenceable);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000: writeSequenceable is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000: gIRemoteObject is undefined");
Y
yang-qibo 已提交
4455
                }
Y
yang-qibo 已提交
4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466
                await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLEARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000: sendRequestis is " + result.errCode);
                    var s = [new MySequenceable(null, null),
                        new MySequenceable(null, null), new MySequenceable(null, null)]
                    result.reply.readSequenceableArray(s);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000: run readSequenceableArray is" +s);
                    for (let i = 0; i < s.length; i++) {
                        expect(s[i].str).assertEqual(sequenceable[i].str)
                        expect(s[i].num).assertEqual(sequenceable[i].num)
                    }
                });
Y
yang-qibo 已提交
4467

Y
yang-qibo 已提交
4468 4469 4470 4471 4472 4473
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000:error = " + error);
            }
Y
yang-qibo 已提交
4474

Y
yang-qibo 已提交
4475 4476
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12000---------------------------");
        });
Y
yang-qibo 已提交
4477

Y
yang-qibo 已提交
4478
        /*
Z
zhangpa2021 已提交
4479
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_12100
4480
     * @tc.name    Call the writeSequenceablearray interface to write the custom
Y
yang-qibo 已提交
4481 4482 4483 4484
     *             serialized object to the messageparcel instance
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_12100", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12100---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12100: create object successfully.");
                var sequenceable = 1;
                var result = data.writeSequenceableArray(sequenceable);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12100: writeSequenceable is " + result);
                expect(result == false).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12100:error = " + error);
                expect(error != null).assertTrue();
            }
            data.reclaim();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12100---------------------------");
        });
Y
yang-qibo 已提交
4501

Y
yang-qibo 已提交
4502
        /*
Z
zhangpa2021 已提交
4503
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_12200
Y
yang-qibo 已提交
4504 4505 4506 4507 4508
     * @tc.name    Call the writeremoteobjectarray interface to write the object array to the messageparcel
     *             instance, and call readremoteobjectarray to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_12200", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12200---------------------------");
            try{
                let count = 0
                function checkResult(num, str) {
                    expect(num).assertEqual(123)
                    expect(str).assertEqual("rpcListenerTest")
                    count++;
                    console.info("check result done, count: " + count)
                    if (count == 3) {
                        done()
                    }
4521
                }
Y
yang-qibo 已提交
4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12200: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();

                expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue()
                var listeners = [new TestListener("rpcListener", checkResult),
                    new TestListener("rpcListener2", checkResult),
                    new TestListener("rpcListener3", checkResult)];
                var result = data.writeRemoteObjectArray(listeners);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12200: writeRemoteObjectArray is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12200: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12200: sendRequestis is " + result.errCode);
                    expect(result.errCode).assertEqual(0);
                    expect(result.code).assertEqual(CODE_WRITE_REMOTEOBJECTARRAY);
                    expect(result.data).assertEqual(data);
                    expect(result.reply).assertEqual(reply);
                });
4545

Y
yang-qibo 已提交
4546 4547 4548 4549 4550 4551
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12200:error = " + error);
            }
4552

Y
yang-qibo 已提交
4553 4554
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12200---------------------------");
        });
Y
yang-qibo 已提交
4555

Y
yang-qibo 已提交
4556
        /*
Z
zhangpa2021 已提交
4557
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_12300
Y
yang-qibo 已提交
4558 4559 4560 4561 4562
     * @tc.name    Call the writeremoteobjectarray interface to write the object array to the messageparcel instance,
     *             and call readremoteobjectarray (objects: iremoteobject []) to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_12300", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12300---------------------------");
            try{
                let count = 0
                function checkResult(num, str) {
                    expect(num).assertEqual(123)
                    expect(str).assertEqual("rpcListenerTest")
                    count++;
                    console.info("check result done, count: " + count)
                    if (count == 3) {
                        done()
                    }
4575
                }
Y
yang-qibo 已提交
4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12300: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue()
                var listeners = [new TestListener("rpcListener", checkResult),
                    new TestListener("rpcListener2", checkResult),
                    new TestListener("rpcListener3", checkResult)];
                var result = data.writeRemoteObjectArray(listeners);
                console.info("RpcClient: writeRemoteObjectArray is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12300: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12300: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                });
4595

Y
yang-qibo 已提交
4596 4597 4598 4599 4600 4601 4602 4603
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12300:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12300---------------------------");
        });
Y
yang-qibo 已提交
4604

Y
yang-qibo 已提交
4605
        /*
Z
zhangpa2021 已提交
4606
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_12400
Y
yang-qibo 已提交
4607 4608 4609 4610
     * @tc.name    Test messageparcel delivery file descriptor object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_12400", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12400---------------------------");
            let context = FA.getContext()
            await context.getFilesDir()
                .then(async function(path) {
                    expect(path != null).assertTrue()
                    let basePath = path;
                    let filePath = basePath + "/test1.txt";
                    let fd = fileio.openSync(filePath, 0o2| 0o100 | 0o2000, 0o666);
                    expect(fd >= 0).assertTrue()
                    let str = "HELLO RPC"
                    let bytesWr = fileio.writeSync(fd, str);
                    let option = new rpc.MessageOption()
                    let data = rpc.MessageParcel.create()
                    let reply = rpc.MessageParcel.create()
                    let result = data.containFileDescriptors()
                    let writeInt = data.writeInt(bytesWr)
                    expect(writeInt == true).assertTrue()
                    let writeFileDescriptor = data.writeFileDescriptor(fd)
                    expect(writeFileDescriptor == true).assertTrue()
                    let result1 = data.containFileDescriptors()
                    expect(data.containFileDescriptors()).assertTrue()
                    await gIRemoteObject.sendRequest(CODE_FILESDIR, data, reply, option)
                        .then(function(result) {
                            expect(result.errCode).assertEqual(0)
                            let buf = new ArrayBuffer(str.length * 2);
                            let bytesRd = fileio.readSync(fd, buf, {position:0,});
                            let fdResult = reply.readFileDescriptor()
                            let content = String.fromCharCode.apply(null, new Uint8Array(buf));
                            expect(content).assertEqual(str + str)
                            let dupFd = rpc.MessageParcel.dupFileDescriptor(fd);
                            let buf2 = new ArrayBuffer(str.length * 2);
                            let byteRd2 = fileio.readSync(dupFd, buf2, {position:0,});
                            let content2 = String.fromCharCode.apply(null, new Uint8Array(buf2));
                            console.info("dupFd bytes read: " + byteRd2 + ", content2: " + content2);
                            expect(content2).assertEqual(str + str)
                            rpc.MessageParcel.closeFileDescriptor(fd);
                            rpc.MessageParcel.closeFileDescriptor(dupFd);
                        })
                    try {
                        console.info("after close fd, write again")
                        fileio.writeSync(fd, str)
                        expect(0).assertEqual(1)
                    } catch(e) {
                        console.error("got exception: " + e)
                    }
                })
            done()
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12400---------------------------");
        });
Y
yang-qibo 已提交
4661

Y
yang-qibo 已提交
4662
        /*
Z
zhangpa2021 已提交
4663
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_12500
Y
yang-qibo 已提交
4664 4665 4666 4667
     * @tc.name    Test messageparcel to deliver the reply message received in promise across processes
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_12500", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12500: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                expect(data.writeByte(2)).assertTrue()
                expect(data.writeShort(3)).assertTrue()
                expect(data.writeInt(4)).assertTrue()
                expect(data.writeLong(5)).assertTrue()
                expect(data.writeFloat(1.2)).assertTrue()
                expect(data.writeDouble(10.2)).assertTrue()
                expect(data.writeBoolean(true)).assertTrue()
                expect(data.writeChar(5)).assertTrue()
                expect(data.writeString("HelloWorld")).assertTrue()
                expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()

                await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701
                    console.info("sendRequest done, error code: " + result.errCode)
                    expect(result.errCode).assertEqual(0)
                    expect(result.reply.readByte()).assertEqual(2)
                    expect(result.reply.readShort()).assertEqual(3)
                    expect(result.reply.readInt()).assertEqual(4)
                    expect(result.reply.readLong()).assertEqual(5)
                    expect(result.reply.readFloat()).assertEqual(1.2)
                    expect(result.reply.readDouble()).assertEqual(10.2)
                    expect(result.reply.readBoolean()).assertTrue()
                    expect(result.reply.readChar()).assertEqual(5)
                    expect(result.reply.readString()).assertEqual("HelloWorld")
                    let s = new MySequenceable(null, null)
                    expect(result.reply.readSequenceable(s)).assertTrue()
                    expect(s.num).assertEqual(1)
                    expect(s.str).assertEqual("aaa")
Y
yang-qibo 已提交
4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12500:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12500---------------------------");
        });

        /*
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_12600
     * @tc.name    Test the cross process delivery of messageparcel and receive the reply message
     *             in the callback function
     * @tc.desc    Function test
     * @tc.level   0
     */
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_12600", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12600---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12600: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();

                expect(data.writeByte(2)).assertTrue()
                expect(data.writeShort(3)).assertTrue()
                expect(data.writeInt(4)).assertTrue()
                expect(data.writeLong(5)).assertTrue()
                expect(data.writeFloat(1.2)).assertTrue()
                expect(data.writeDouble(10.2)).assertTrue()
                expect(data.writeBoolean(true)).assertTrue()
                expect(data.writeChar(5)).assertTrue()
                expect(data.writeString("HelloWorld")).assertTrue()
                expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()

                function sendRequestCallback(result) {
                    try{
                        console.info("sendRequest Callback")
                        console.info("sendRequest done, error code: " + result.errCode)
                        expect(result.errCode).assertEqual(0)
                        expect(result.reply.readByte()).assertEqual(2)
                        expect(result.reply.readShort()).assertEqual(3)
                        expect(result.reply.readInt()).assertEqual(4)
                        expect(result.reply.readLong()).assertEqual(5)
                        expect(result.reply.readFloat()).assertEqual(1.2)
                        expect(result.reply.readDouble()).assertEqual(10.2)
                        expect(result.reply.readBoolean()).assertTrue()
                        expect(result.reply.readChar()).assertEqual(5)
                        expect(result.reply.readString()).assertEqual("HelloWorld")
                        let s = new MySequenceable(null, null)
                        expect(result.reply.readSequenceable(s)).assertTrue()
                        expect(s.num).assertEqual(1)
                        expect(s.str).assertEqual("aaa")
                    } finally {
                        result.data.reclaim();
                        result.reply.reclaim();
                        console.info("test done")
                        done()
                    }
Z
zhangpa2021 已提交
4762 4763
                }

Y
yang-qibo 已提交
4764 4765 4766 4767 4768 4769 4770 4771
                console.info("start send request")
                await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option, sendRequestCallback)

            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12600:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12600---------------------------");
        });
Y
yang-qibo 已提交
4772

Y
yang-qibo 已提交
4773
        /*
Z
zhangpa2021 已提交
4774
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_12700
Y
yang-qibo 已提交
4775 4776 4777 4778 4779
     * @tc.name    Test the cross process transmission of messageparcel.
     *             After receiving the reply message in promise, read various types of arrays in order
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_12700", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12700: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                expect(data.writeByteArray([1, 2, 3])).assertTrue();
                expect(data.writeShortArray([4, 5, 6])).assertTrue()
                expect(data.writeIntArray([7, 8, 9])).assertTrue()
                expect(data.writeLongArray([10, 11, 12])).assertTrue()
                expect(data.writeFloatArray([1.1, 1.2, 1.3])).assertTrue()
                expect(data.writeDoubleArray([2.1, 2.2, 2.3])).assertTrue()
                expect(data.writeBooleanArray([true, true, false])).assertTrue()
                expect(data.writeCharArray([10, 20, 30])).assertTrue()
                expect(data.writeStringArray(['abc', 'seggg'])).assertTrue()
                let a = [new MySequenceable(1, "aaa"), new MySequenceable(2, "bbb"),
                    new MySequenceable(3, "ccc")]
                expect(data.writeSequenceableArray(a)).assertTrue()
                gIRemoteObject.sendRequest(CODE_ALL_ARRAY_TYPE, data, reply, option,(err, result) => {
                    expect(result.errCode).assertEqual(0)
                    assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3])
                    assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6])
                    assertArrayElementEqual(result.reply.readIntArray(), [7, 8, 9])
                    assertArrayElementEqual(result.reply.readLongArray(), [10, 11, 12])
                    assertArrayElementEqual(result.reply.readFloatArray(), [1.1, 1.2, 1.3])
                    assertArrayElementEqual(result.reply.readDoubleArray(), [2.1, 2.2, 2.3])
                    assertArrayElementEqual(result.reply.readBooleanArray(), [true, true, false])
                    assertArrayElementEqual(result.reply.readCharArray(), [10, 20, 30])
                    assertArrayElementEqual(result.reply.readStringArray(), ['abc', 'seggg'])
                    let b = [new MySequenceable(null, null), new MySequenceable(null, null),
                        new MySequenceable(null, null)]
                    result.reply.readSequenceableArray(b)
                    for (let i = 0; i < b.length; i++) {
                        expect(b[i].str).assertEqual(a[i].str)
                        expect(b[i].num).assertEqual(a[i].num)
                    }
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12700:error = " + error);
            }
            sleep(2000)
Y
yang-qibo 已提交
4825 4826
            data.reclaim();
            reply.reclaim();
Y
yang-qibo 已提交
4827 4828
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12700---------------------------");
        });
Y
yang-qibo 已提交
4829

Y
yang-qibo 已提交
4830
        /*
Z
zhangpa2021 已提交
4831
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_12800
Y
yang-qibo 已提交
4832 4833 4834 4835 4836 4837
     * @tc.name    Test messageparcel cross process delivery. After receiving the reply message in promise,
     *             the client constructs an empty array in sequence and reads the data from the reply message
     *             into the corresponding array
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_12800", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12800---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12800: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                expect(data.writeByteArray([1, 2, 3])).assertTrue();
                expect(data.writeShortArray([4, 5, 6])).assertTrue()
                expect(data.writeIntArray([7, 8, 9])).assertTrue()
                expect(data.writeLongArray([10, 11, 12])).assertTrue()
                expect(data.writeFloatArray([1.1, 1.2, 1.3])).assertTrue()
                expect(data.writeDoubleArray([2.1, 2.2, 2.3])).assertTrue()
                expect(data.writeBooleanArray([true, true, false])).assertTrue()
                expect(data.writeCharArray([10, 20, 30])).assertTrue()
                expect(data.writeStringArray(['abc', 'seggg'])).assertTrue()
                let a = [new MySequenceable(1, "aaa"), new MySequenceable(2, "bbb"),
                    new MySequenceable(3, "ccc")]
                expect(data.writeSequenceableArray(a)).assertTrue()
                gIRemoteObject.sendRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => {
                    expect(result.errCode).assertEqual(0)
                    assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3])
                    assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6])
                    assertArrayElementEqual(result.reply.readIntArray(), [7, 8, 9])
                    assertArrayElementEqual(result.reply.readLongArray(), [10, 11, 12])
                    assertArrayElementEqual(result.reply.readFloatArray(), [1.1, 1.2, 1.3])
                    assertArrayElementEqual(result.reply.readDoubleArray(), [2.1, 2.2, 2.3])
                    assertArrayElementEqual(result.reply.readBooleanArray(), [true, true, false])
                    assertArrayElementEqual(result.reply.readCharArray(), [10, 20, 30])
                    assertArrayElementEqual(result.reply.readStringArray(), ['abc', 'seggg'])
                    let b = [new MySequenceable(null, null), new MySequenceable(null, null),
                        new MySequenceable(null, null)]
                    result.reply.readSequenceableArray(b)
                    for (let i = 0; i < b.length; i++) {
                        expect(b[i].str).assertEqual(a[i].str)
                        expect(b[i].num).assertEqual(a[i].num)
                    }
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12800:error = " + error);
            }
            sleep(2000)
Y
yang-qibo 已提交
4883 4884
            data.reclaim();
            reply.reclaim();
Y
yang-qibo 已提交
4885 4886
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12800---------------------------");
        });
Y
yang-qibo 已提交
4887

Y
yang-qibo 已提交
4888
        /*
Z
zhangpa2021 已提交
4889
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_12900
Y
yang-qibo 已提交
4890 4891 4892 4893
     * @tc.name    Test messageparcel to pass an object of type iremoteobject across processes
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_12900", 0, async function(done) {
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12900---------------------------");
            function checkResult(num, str) {
                expect(num).assertEqual(123)
                expect(str).assertEqual("rpcListenerTest")
                done()
            }
            try{
                let option = new rpc.MessageOption()
                let data = rpc.MessageParcel.create()
                let reply = rpc.MessageParcel.create()

                let listener = new TestListener("rpcListener", checkResult)
                let result = data.writeRemoteObject(listener)
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12900 result is:" + result)
                expect(result == true).assertTrue()
                expect(data.writeInt(123)).assertTrue()
                expect(data.writeString("rpcListenerTest")).assertTrue()
                await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECT, data, reply, option)
                    .then((result)=> {
                        console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12900 sendRequest done, error code: " + result.errCode)
                        expect(result.errCode).assertEqual(0)
                        result.reply.readException()
                    })
Y
yang-qibo 已提交
4918 4919 4920
                data.reclaim()
                reply.reclaim()
                console.info("test done")
Y
yang-qibo 已提交
4921 4922 4923
            } catch(error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12900: error = " + error);
            }
Z
zhangpa2021 已提交
4924
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12900---------------------------");
Y
yang-qibo 已提交
4925
        })
Y
yang-qibo 已提交
4926 4927


Y
yang-qibo 已提交
4928
        /*
Z
zhangpa2021 已提交
4929
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_13000
Y
yang-qibo 已提交
4930 4931 4932 4933
     * @tc.name    Test messageparcel to pass an array of iremoteobject objects across processes
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4934 4935
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_13000", 0, async function(done) {
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13000---------------------------");
Y
yang-qibo 已提交
4936

Y
yang-qibo 已提交
4937 4938 4939 4940 4941 4942 4943 4944 4945
            let count = 0;
            function checkResult(num, str) {
                expect(num).assertEqual(123)
                expect(str).assertEqual("rpcListenerTest")
                count++
                console.info("check result done, count: " + count)
                if (count == 3) {
                    done()
                }
Y
yang-qibo 已提交
4946
            }
Y
yang-qibo 已提交
4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964
            try{
                let option = new rpc.MessageOption()
                let data = rpc.MessageParcel.create()
                let reply = rpc.MessageParcel.create()
                let listeners = [new TestListener("rpcListener", checkResult),
                    new TestListener("rpcListener2", checkResult),
                    new TestListener("rpcListener3", checkResult)]
                let result = data.writeRemoteObjectArray(listeners)
                expect(result == true).assertTrue()
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13000 result is:" + result)
                expect(data.writeInt(123)).assertTrue()
                expect(data.writeString("rpcListenerTest")).assertTrue()
                await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY_1, data, reply, option)
                    .then((result)=> {
                        console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13000 sendRequest done, error code: " + result.errCode)
                        expect(result.errCode).assertEqual(0)
                        result.reply.readException()
                    })
Y
yang-qibo 已提交
4965 4966 4967 4968

                data.reclaim()
                reply.reclaim()
                console.info("test done")
Y
yang-qibo 已提交
4969 4970
            } catch(error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13000: error = " + error);
Y
yang-qibo 已提交
4971
            }
Y
yang-qibo 已提交
4972 4973
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13000---------------------------");
        })
Y
yang-qibo 已提交
4974

Y
yang-qibo 已提交
4975
        /*
Z
zhangpa2021 已提交
4976
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_13100
Y
yang-qibo 已提交
4977 4978 4979 4980 4981
     * @tc.name    Test messageparcel to pass the array of iremoteobject objects across processes. The server
     *             constructs an empty array in onremoterequest and reads it from messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_13100", 0, async function(done) {
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13100---------------------------");
            let count = 0;
            function checkResult(num, str) {
                expect(num).assertEqual(123)
                expect(str).assertEqual("rpcListenerTest")
                count++
                console.info("check result done, count: " + count)
                if (count == 3) {
                    done()
                }
Y
yang-qibo 已提交
4993 4994
            }

Y
yang-qibo 已提交
4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013
            try{
                let option = new rpc.MessageOption()
                let data = rpc.MessageParcel.create()
                let reply = rpc.MessageParcel.create()
                let listeners = [new TestListener("rpcListener", checkResult),
                    new TestListener("rpcListener2", checkResult),
                    new TestListener("rpcListener3", checkResult)]
                let result = data.writeRemoteObjectArray(listeners)
                expect(result == true).assertTrue()
                data.readRemoteObjectArray()
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13100 result is:" + result)
                expect(data.writeInt(123)).assertTrue()
                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)
                        expect(result.errCode).assertEqual(0)
                        result.reply.readException()
                    })
Z
zhangpa2021 已提交
5014

Y
yang-qibo 已提交
5015 5016 5017
                data.reclaim()
                reply.reclaim()
                console.info("test done")
Y
yang-qibo 已提交
5018 5019
            } catch(error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13100: error = " + error);
Y
yang-qibo 已提交
5020
            }
Y
yang-qibo 已提交
5021 5022
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13100---------------------------");
        })
Y
yang-qibo 已提交
5023

Y
yang-qibo 已提交
5024
        /*
Z
zhangpa2021 已提交
5025
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_13200
Y
yang-qibo 已提交
5026 5027 5028 5029
     * @tc.name    Invoke the rewindRead interface, write the POS, and read the offset value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_13200", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13200---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200: create object successfully");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                data.writeInt(12);
                data.writeString("parcel");
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let number1 = result.reply.readInt();
                    expect(number1).assertEqual(12);
                    expect(result.reply.rewindRead(0)).assertTrue();
                    let number2 = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200:run readIntis is " + number1 + ";" + number2);
                    expect(number2).assertEqual(12);

                    let reString = result.reply.readString();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200:run readStringis is " + reString);
                    expect(reString).assertEqual("");
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13200---------------------------");
        });
Y
yang-qibo 已提交
5064

Y
yang-qibo 已提交
5065
        /*
Z
zhangpa2021 已提交
5066
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_13300
Y
yang-qibo 已提交
5067 5068 5069 5070
     * @tc.name    Invoke the rewindRead interface, write the POS, and read the offset value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_13300", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13300---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13300: create object successfully");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                data.writeInt(12);
                data.writeString("parcel");
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13300: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13300: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let number1 = result.reply.readInt();
                    expect(result.reply.rewindRead(1)).assertTrue();
                    let number2 = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13300:run readIntis is " + number1 + ";" + number2);
                    expect(number1).assertEqual(12);
                    expect(number2).assertEqual(0);
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13300:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13300---------------------------");
        });
Y
yang-qibo 已提交
5101

Y
yang-qibo 已提交
5102
        /*
Z
zhangpa2021 已提交
5103
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_13400
Y
yang-qibo 已提交
5104 5105 5106 5107
     * @tc.name    Invoke the rewindWrite interface, write the POS, and read the offset value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_13400", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11800---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13400: create object successfully");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                data.writeInt(4);
                data.rewindWrite(0);
                data.writeInt(5);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13400: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13400: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let number = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13400:run readIntis is " + number);
                    expect(number).assertEqual(5);
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13400:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13400---------------------------");
        });
Y
yang-qibo 已提交
5136

Y
yang-qibo 已提交
5137
        /*
Z
zhangpa2021 已提交
5138
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_13500
Y
yang-qibo 已提交
5139 5140 5141 5142
     * @tc.name    Invoke the rewindWrite interface, write the POS, and read the offset value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_13500", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13500---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13500: create object successfully");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                data.writeInt(4);
                data.rewindWrite(1);
                data.writeInt(5);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13500: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13500: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let number = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13500:run readIntis is " + number);
                    expect(number != 5).assertTrue();
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13500:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13500---------------------------");
        });
Y
yang-qibo 已提交
5171

Y
yang-qibo 已提交
5172
        /*
Z
zhangpa2021 已提交
5173
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_13600
Y
yang-qibo 已提交
5174 5175 5176 5177 5178
     * @tc.name    setCapacity Sets the storage capacity of the MessageParcel instance. The getCapacity
                   obtains the current MessageParcel capacity
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_13600", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13600---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600: create object successfully.");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                expect(data.getCapacity()).assertEqual(0);
                let setMePaCapacity = data.setCapacity(100);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600:run setCapacityis is " + setMePaCapacity);
                expect(setMePaCapacity).assertTrue();
                expect(data.writeString("constant")).assertTrue();
                expect(data.getCapacity()).assertEqual(100);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600: sendRequestis is " + result.errCode);
                    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(result.reply.readString()).assertEqual("constant");
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13600---------------------------");
        });
Y
yang-qibo 已提交
5211

Y
yang-qibo 已提交
5212
        /*
Z
zhangpa2021 已提交
5213
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_13700
Y
yang-qibo 已提交
5214 5215 5216 5217 5218
     * @tc.name    setCapacity Sets the storage capacity of the MessageParcel instance. The getCapacity
                   obtains the current MessageParcel capacity
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_13700", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13700---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13700: create object successfully.");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                expect(data.writeString("constant")).assertTrue();
                expect(data.setCapacity(100)).assertTrue();
                expect(data.getCapacity()).assertEqual(100);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13700: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13700: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    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);
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13700:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13700---------------------------");
        });
Y
yang-qibo 已提交
5249

Y
yang-qibo 已提交
5250
        /*
Z
zhangpa2021 已提交
5251
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_13800
Y
yang-qibo 已提交
5252 5253 5254 5255
     * @tc.name    SetCapacity Tests the storage capacity threshold of the MessageParcel instance
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5256 5257 5258 5259 5260
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_13800", 0, async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13800---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800: create object successfully.");
Y
yang-qibo 已提交
5261

Y
yang-qibo 已提交
5262 5263
                let getCapacitydata0 = data.getCapacity();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run getCapacityis is " + getCapacitydata0);
Y
yang-qibo 已提交
5264

Y
yang-qibo 已提交
5265 5266 5267 5268 5269
                expect(data.writeString("constant")).assertTrue();
                let getSizedata = data.getSize();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run getSizeis is " + getSizedata);
                let getCapacitydata = data.getCapacity();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run getCapacityis is " + getCapacitydata);
Y
yang-qibo 已提交
5270

Y
yang-qibo 已提交
5271 5272 5273 5274 5275
                let setCapacitydata1 = data.setCapacity(getSizedata + 1);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run setCapacityis is " + setCapacitydata1);
                expect(setCapacitydata1).assertTrue();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run getCapacityis is " + data.getCapacity());
                expect(data.getCapacity()).assertEqual((getSizedata + 1));
Y
yang-qibo 已提交
5276

Y
yang-qibo 已提交
5277 5278 5279 5280 5281
                let setCapacitydata2 = data.setCapacity(getSizedata);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run setCapacityis is " + setCapacitydata2);
                expect(setCapacitydata2).assertEqual(false);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run getCapacityis is " + data.getCapacity());
                expect(data.getCapacity()).assertEqual((getSizedata + 1));
Y
yang-qibo 已提交
5282

Y
yang-qibo 已提交
5283 5284 5285 5286 5287 5288
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13800---------------------------");
        });
Y
yang-qibo 已提交
5289

Y
yang-qibo 已提交
5290
        /*
Z
zhangpa2021 已提交
5291
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_13900
Y
yang-qibo 已提交
5292 5293 5294 5295
    * @tc.name    SetCapacity Tests the storage capacity threshold of the MessageParcel instance
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_13900", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13900---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                expect(data.writeString("constant")).assertTrue();
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13900: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13900: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    let getSizeresult = result.reply.getSize();
                    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);
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13900:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13900---------------------------");
        });
Y
yang-qibo 已提交
5324

Y
yang-qibo 已提交
5325
        /*
Z
zhangpa2021 已提交
5326
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_14000
Y
yang-qibo 已提交
5327 5328 5329 5330
    * @tc.name    SetCapacity Tests the storage capacity threshold of the MessageParcel instance
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_14000", 0, async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14000---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000: create object successfully.");
                let getSizedata = data.getSize();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:run setCapacityis is " + getSizedata);
                expect(getSizedata).assertEqual(0);

                let setMeCapacity = data.setCapacity(M);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:run setCapacityis is " + setMeCapacity);
                expect(setMeCapacity).assertTrue();
                let getCapacitydata = data.getCapacity();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:run getCapacityis is " + getCapacitydata);
                expect(getCapacitydata).assertEqual(M);

                let setMeCapacity1 = data.setCapacity(4*G);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:run setCapacityis is " + setMeCapacity1);
                expect(setMeCapacity1).assertEqual(false);
                let getCapacitydata1 = data.getCapacity();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:run getCapacityis is " + getCapacitydata1);
Y
yang-qibo 已提交
5352

Y
yang-qibo 已提交
5353 5354 5355 5356 5357 5358
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14000---------------------------");
        });
Y
yang-qibo 已提交
5359

Y
yang-qibo 已提交
5360
        /*
Z
zhangpa2021 已提交
5361
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_14100
Y
yang-qibo 已提交
5362 5363 5364 5365 5366
     * @tc.name    setCapacity Sets the storage capacity of the MessageParcel instance to decrease by one.
                   The getCapacity obtains the current MessageParcel capacity
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_14100", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14100---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100: create object successfully.");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                expect(data.getSize()).assertEqual(0);
                let setSizedata = data.setSize(0);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100:run setSizeis is " + setSizedata);
                expect(setSizedata).assertTrue();
                expect(data.writeString("constant")).assertTrue();
                let getSizedata = data.getSize();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100:run getSizeis is " + getSizedata);
                expect(getSizedata).assertEqual(("constant".length * 2) + 8);

                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    let getSizeresult = result.reply.getSize();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100:run getSizeis is " + getSizeresult);
                    expect(getSizeresult).assertEqual(("constant".length * 2) + 8);

                    expect(result.reply.readString()).assertEqual("constant");
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14100---------------------------");
        });
Y
yang-qibo 已提交
5404

Y
yang-qibo 已提交
5405
        /*
Z
zhangpa2021 已提交
5406
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_14200
Y
yang-qibo 已提交
5407 5408 5409 5410 5411
     * @tc.name    setSize Sets the size of the data contained in the MessageParcel instance. The getSize command
                    reads the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_14200", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14200---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200: create object successfully.");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                expect(data.writeString("constant")).assertTrue();
                expect(data.getSize()).assertEqual(("constant".length * 2) + 8);
                expect(data.setSize(0)).assertTrue();

                let getSizedata = data.getSize();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200:run setSizeis is " + getSizedata);
                expect(getSizedata).assertEqual(0);

                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();

                    let getSizeresult = result.reply.getSize();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200:run getSizeis is " + getSizeresult);
                    expect(getSizeresult).assertEqual( 8);
                    let writeresult = result.reply.readString();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200:run readStringis is " + writeresult);
                    expect(writeresult).assertEqual("");
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14200---------------------------");
        });
Y
yang-qibo 已提交
5449

Y
yang-qibo 已提交
5450
        /*
Z
zhangpa2021 已提交
5451
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_14300
Y
yang-qibo 已提交
5452 5453 5454 5455 5456
     * @tc.name    SetSize: Increases the value of the data contained in the MessageParcel instance by 1,
                    Write setSize
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5457 5458 5459 5460 5461 5462 5463 5464
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_14300", 0, async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14300---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14300: create object successfully.");
                expect(data.getSize()).assertEqual(0);
                expect(data.writeString("constant")).assertTrue();
                expect(data.getSize()).assertEqual(("constant".length * 2) + 8);
Y
yang-qibo 已提交
5465

Y
yang-qibo 已提交
5466 5467
                let getCapacitydata = data.getCapacity();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14300:run getCapacityis is " + getCapacitydata);
Y
yang-qibo 已提交
5468

Y
yang-qibo 已提交
5469 5470 5471
                let setSizedata1 = data.setSize(getCapacitydata);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14300:run setSizeis is " + setSizedata1);
                expect(setSizedata1).assertTrue();
Y
yang-qibo 已提交
5472

Y
yang-qibo 已提交
5473
                expect(data.getSize()).assertEqual(getCapacitydata);
Y
yang-qibo 已提交
5474

Y
yang-qibo 已提交
5475 5476 5477
                let setSizedata2 = data.setSize(getCapacitydata + 1);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14300:run setSizeis is " + setSizedata2);
                expect(setSizedata2).assertEqual(false);
Y
yang-qibo 已提交
5478

Y
yang-qibo 已提交
5479 5480 5481 5482 5483 5484
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14300:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14300---------------------------");
        });
Y
yang-qibo 已提交
5485

Y
yang-qibo 已提交
5486
        /*
Z
zhangpa2021 已提交
5487
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_14400
Y
yang-qibo 已提交
5488 5489 5490 5491 5492
     * @tc.name    SetSize: Increases the value of the data contained in the MessageParcel instance by 1,
                    Write the setSize boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_14400", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14400---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400: create object successfully.");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                expect(data.writeString("constant")).assertTrue();
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
Y
yang-qibo 已提交
5507

Y
yang-qibo 已提交
5508 5509
                    expect(result.reply.readString()).assertEqual("constant");
                    expect(result.reply.getSize()).assertEqual(("constant".length * 2) + 8);
Y
yang-qibo 已提交
5510

Y
yang-qibo 已提交
5511 5512
                    let getCapacityresult = result.reply.getCapacity();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400:run getCapacityis is " + getCapacityresult);
Y
yang-qibo 已提交
5513

Y
yang-qibo 已提交
5514 5515 5516 5517
                    let setSizeresult1 = result.reply.setSize(getCapacityresult);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400:run setSizeis is " + setSizeresult1);
                    expect(setSizeresult1).assertTrue();
                    expect(result.reply.getSize()).assertEqual(getCapacityresult);
Y
yang-qibo 已提交
5518

Y
yang-qibo 已提交
5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530
                    let setSizeresult2 = result.reply.setSize(getCapacityresult + 1);
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400:run setSizeis is " + setSizeresult2);
                    expect(setSizeresult2).assertEqual(false);
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14400---------------------------");
        });
Y
yang-qibo 已提交
5531

Y
yang-qibo 已提交
5532
        /*
Z
zhangpa2021 已提交
5533
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_14500
Y
yang-qibo 已提交
5534 5535 5536 5537
     * @tc.name    Validate the setSize boundary value in the MessageParcel instance
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5538 5539 5540 5541 5542
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_14500", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14500---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500: create object successfully.");
Y
yang-qibo 已提交
5543

Y
yang-qibo 已提交
5544 5545 5546
                let getCapacitydata = data.getCapacity();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500:run getCapacityis is " + getCapacitydata);
                expect(getCapacitydata).assertEqual(0);
Y
yang-qibo 已提交
5547

Y
yang-qibo 已提交
5548 5549 5550 5551 5552 5553
                let setSizedata1 = data.setSize(4*G);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500:run setSizeis is " + setSizedata1);
                expect(setSizedata1).assertTrue();
                let getSizedata1 = data.getSize();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500:run getCapacityis is " + getSizedata1);
                expect(getSizedata1).assertEqual(0);
Y
yang-qibo 已提交
5554

Y
yang-qibo 已提交
5555 5556 5557 5558 5559 5560 5561 5562 5563 5564
                let setSizedata = data.setSize(4*G - 1);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500:run setSizeis is " + setSizedata);
                expect(setSizedata).assertEqual(false);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14500---------------------------");
        });
Y
yang-qibo 已提交
5565

Y
yang-qibo 已提交
5566
        /*
Z
zhangpa2021 已提交
5567
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_14600
Y
yang-qibo 已提交
5568 5569 5570 5571
     * @tc.name    Verify that setSize is out of bounds in a MessageParcel instance
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5572 5573 5574 5575 5576
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_14600", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14600---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14600: create object successfully.");
Y
yang-qibo 已提交
5577

Y
yang-qibo 已提交
5578 5579 5580 5581
                let setSizedata = data.setSize(0);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14600:run setCapacityis is " + setSizedata);
                expect(setSizedata).assertTrue();
                expect(data.getSize()).assertEqual(0);
Y
yang-qibo 已提交
5582

Y
yang-qibo 已提交
5583 5584 5585 5586
                let setSizedata1 = data.setSize(2*4*G);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14600:run setCapacityis is " + setSizedata1);
                expect(setSizedata1).assertTrue();
                expect(data.getSize()).assertEqual(0);
Y
yang-qibo 已提交
5587

Y
yang-qibo 已提交
5588 5589 5590 5591 5592 5593 5594 5595 5596 5597
                let setSizedata2 = data.setSize(2*G);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14600:run setCapacityis is " + setSizedata2);
                expect(setSizedata2).assertEqual(false);
                data.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14600:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14600---------------------------");
        });
Y
yang-qibo 已提交
5598

Y
yang-qibo 已提交
5599
        /*
Z
zhangpa2021 已提交
5600
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_14700
Y
yang-qibo 已提交
5601 5602
     * @tc.name    Obtaining the Writable and Readable Byte Spaces of MessageParcel
     * @tc.desc    Function test
5603 5604
     * @tc.level   0
     */
Y
yang-qibo 已提交
5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_14700", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14700---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700: create object successfully.");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                let getwbyte1 = data.getWritableBytes();
                data.writeInt(10);
                let getwbyte2 = data.getWritableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700:result getWritePosition is getWritableBytes is "
                    + getwbyte1 + ";" + getwbyte2);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let getrbyte1 = result.reply.getReadableBytes();
                    let readint = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700:result readInt is " + readint);
                    let getrbyte2 = result.reply.getReadableBytes();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700:result getReadPosition is getReadableBytes is"
                        + getrbyte1 + ";" + getrbyte2);
                    expect(readint).assertEqual(10);
                    expect(getrbyte2).assertEqual(0);
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14700---------------------------");
        });
Y
yang-qibo 已提交
5640

Y
yang-qibo 已提交
5641
        /*
Z
zhangpa2021 已提交
5642
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_14800
Y
yang-qibo 已提交
5643 5644 5645 5646
     * @tc.name    Obtains the writeable and readable byte space and read position of the MessageParcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_14800", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14800---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800: create object successfully.");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                data.writeInt(10);
                let getwPos = data.getWritePosition();
                let getwbyte = data.getWritableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800:result getWritePosition is "
                    + getwPos + "getWritableBytes is " + getwbyte);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let getrbyte = result.reply.getReadableBytes();
                    let readint = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800:result readInt is " + readint);
                    let getrPos = result.reply.getReadPosition();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800:result getReadPosition is "
                        + getrPos + "getReadableBytes is" + getrbyte);
                    expect(readint).assertEqual(10);
                    expect(getrPos).assertEqual(getwPos);
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14800---------------------------");
        });
Y
yang-qibo 已提交
5682

Y
yang-qibo 已提交
5683
        /*
Z
zhangpa2021 已提交
5684
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_14900
Y
yang-qibo 已提交
5685 5686 5687 5688
    * @tc.name    Obtains the writeable and readable byte space and read position of the MessageParcel
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_14900", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14900---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900: create object successfully.");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                data.writeInt(10);
                let getwPos = data.getWritePosition();
                let getwbyte = data.getWritableBytes();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900:result getWritePosition is "
                    + getwPos + "getWritableBytes is " + getwbyte);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let readint = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900:result readInt is " + readint);
                    let getrPos = result.reply.getReadPosition();
                    let getrbyte = result.reply.getReadableBytes();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900:result getReadPosition is "
                        + getrPos + "getReadableBytes is" + getrbyte);
                    expect(readint).assertEqual(10);

                    let getrPos1 = result.reply.getReadPosition();
                    expect(getrPos1).assertEqual(getwPos);
                    let getrbyte1 = result.reply.getReadableBytes();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900:result getReadPosition is "
                        + getrPos1 + "getReadableBytes is" + getrbyte1);
                    expect(getrbyte1).assertEqual(0);
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14900---------------------------");
        });
Y
yang-qibo 已提交
5730

Y
yang-qibo 已提交
5731
        /*
Z
zhangpa2021 已提交
5732
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_15000
Y
yang-qibo 已提交
5733 5734 5735 5736
     * @tc.name    Test fixed MessageParcel space size to pass rawData data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_15000", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15000---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                let rawdata = [1, 2, 3];
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                expect(data.writeInt(rawdata.length)).assertTrue();
                let result = data.writeRawData(rawdata, rawdata.length);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15000:run writeRawDatais is " + result);
                expect(result).assertTrue();
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15000: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, data, reply, option).then((result) => {
                    expect(result.errCode == 0).assertTrue();
                    let size = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15000:run readIntis is " + size);
                    var newReadResult = result.reply.readRawData(size)
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15000:run readRawDatais is "
                        + newReadResult.length);
                    expect(newReadResult != rawdata).assertTrue();
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15000:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15000---------------------------");
        });
Y
yang-qibo 已提交
5768

Y
yang-qibo 已提交
5769
        /*
Z
zhangpa2021 已提交
5770
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_15100
Y
yang-qibo 已提交
5771 5772 5773 5774
     * @tc.name    Obtains the write and read positions of the MessageParcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_15100", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15100---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100: create object successfully.");
                let option = new rpc.MessageOption();
                let reply = rpc.MessageParcel.create();
                let getwPos1 = data.getWritePosition();
                expect(data.writeInt(10)).assertTrue();
                let getwPos2 = data.getWritePosition();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100:result getWritePosition is "
                    + getwPos1 + ";" + getwPos2);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let getrPos1 = result.reply.getReadPosition();
                    let readint = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100:result readInt is " + readint);
                    let getrPos2 = result.reply.getReadPosition();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100:result getReadPosition is "
                        + getrPos1 + ";" + getrPos2);
                    expect(getwPos1).assertEqual(getrPos1);
                    expect(getwPos2).assertEqual(getrPos2);
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100:error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15100---------------------------");
        });
Y
yang-qibo 已提交
5810 5811


Y
yang-qibo 已提交
5812
        /*
Z
zhangpa2021 已提交
5813
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_15200
Y
yang-qibo 已提交
5814 5815 5816 5817
     * @tc.name    Test messageparcel delivery file descriptor object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_15200", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15200---------------------------");
            try{
                let testab = new TestProxy(gIRemoteObject).asObject();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15200: run TestProxy success" + testab);
                expect(testab != null).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15200:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15200---------------------------");
        });
Y
yang-qibo 已提交
5829

Y
yang-qibo 已提交
5830
        /*
Z
zhangpa2021 已提交
5831
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_15300
Y
yang-qibo 已提交
5832 5833 5834 5835
     * @tc.name    Test messageparcel delivery file descriptor object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_15300", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15300---------------------------");
            try{
                let testRemoteObject = new TestRemoteObject("testObject");
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15300: TestRemoteObject is" + testRemoteObject);
                let testab = testRemoteObject.asObject();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15300: asObject is" + testab);
                expect(testab != null).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15300:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15300---------------------------");
        });
Y
yang-qibo 已提交
5849

Y
yang-qibo 已提交
5850
        /*
Z
zhangpa2021 已提交
5851
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_15400
Y
yang-qibo 已提交
5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887
     * @tc.name    MessageParcel sendMessageRequest API test
     * @tc.desc    Function test
     * @tc.level   0
     */
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_15400", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15400---------------------------");
            try{
                let data = rpc.MessageSequence.create();
                let Capacity = data.getRawDataCapacity()
                let rawdata = [1, 2, 3];
                let option = new rpc.MessageOption();
                let reply = rpc.MessageSequence.create();
                data.writeInt(rawdata.length);
                data.writeRawData(rawdata, rawdata.length);
                if (gIRemoteObject == undefined){
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15400: gIRemoteObject undefined");
                }
                await gIRemoteObject.sendMessageRequest(CODE_WRITE_RAWDATA, data, reply, option).then((result) => {
                    expect(result.errCode == 0).assertTrue();
                    let size = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15400:run readInt is " + size);
                    var newReadResult = result.reply.readRawData(size)
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15400:run readRawData is "
                        + newReadResult.length);
                    expect(newReadResult != rawdata).assertTrue();
                });
                data.reclaim();
                reply.reclaim();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15400 : error = " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15400---------------------------");
        });

        /*
Z
zhangpa2021 已提交
5888
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_15500
5889
    * @tc.name    Invoke the writestring interface to write data to the messageparcel instance SendRequest Asynchronous
5890
    *               Authentication onRemoteMessageRequest Server Processing
5891 5892 5893
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
5894 5895 5896 5897 5898 5899 5900
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_15500", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15500---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
5901
                var token = 'onRemoteMessageRequest invoking';
Y
yang-qibo 已提交
5902 5903 5904 5905 5906 5907 5908
                var result = data.writeString(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500:run writeStringis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: gIRemoteObject is undefined");
                }
5909
                await gIRemoteObject.sendRequest(CODE_ONREMOTEMESSAGEREQUEST, data, reply, option).then((result) => {
Y
yang-qibo 已提交
5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922
                    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);
                    expect(replyReadResult).assertEqual(token);
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15500---------------------------");
        });
5923

Y
yang-qibo 已提交
5924
        /*
Z
zhangpa2021 已提交
5925
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_15600
Y
yang-qibo 已提交
5926
    * @tc.name    Invoke the writestring interface to write data to the messageparcel instance sendMessageRequest Asynchronous
5927
    *               Authentication onRemoteMessageRequest Server Processing
5928 5929 5930
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
5931 5932 5933 5934 5935 5936 5937
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_15600", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15600---------------------------");
            try{
                var data = rpc.MessageSequence.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600: create object successfully.");
                var reply = rpc.MessageSequence.create();
                var option = new rpc.MessageOption();
5938
                var token = 'onRemoteMessageRequest invoking';
Y
yang-qibo 已提交
5939 5940 5941 5942 5943 5944
                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");
                }
5945
                await gIRemoteObject.sendMessageRequest(CODE_ONREMOTEMESSAGEREQUEST, data, reply, option).then((result) => {
Y
yang-qibo 已提交
5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958
                    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);
                    expect(replyReadResult).assertEqual(token);
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15600---------------------------");
        });
5959

Y
yang-qibo 已提交
5960
        /*
Z
zhangpa2021 已提交
5961
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_15700
5962
    * @tc.name    Invoke the writestring interface to write data to the messageparcel instance. SendRequest asynchronously
5963
    *               verifies the priority processing levels of onRemoteMessageRequest and onRemoteRequest
5964 5965 5966
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
5967 5968 5969 5970 5971 5972 5973
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_15700", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15700---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
5974
                var token = "onRemoteRequest or onRemoteMessageRequest invoking";
Y
yang-qibo 已提交
5975 5976 5977 5978 5979 5980 5981
                var result = data.writeString(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700:run writeStringis is " + result);
                expect(result == true).assertTrue();
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700: gIRemoteObject is undefined");
                }
5982
                await gIRemoteObject.sendRequest(CODE_ONREMOTEMESSAGE_OR_ONREMOTE, data, reply, option).then((result) => {
Y
yang-qibo 已提交
5983 5984 5985
                    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);
5986
                    expect(replyReadResult).assertEqual("onRemoteMessageRequest invoking");
Y
yang-qibo 已提交
5987 5988 5989 5990 5991 5992 5993 5994 5995
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15700---------------------------");
        });
5996

Y
yang-qibo 已提交
5997
        /*
Z
zhangpa2021 已提交
5998
    * @tc.number  SUB_Softbus_IPC_Compatibility_MessageParcel_15800
Y
yang-qibo 已提交
5999
    * @tc.name   Invoke the writestring interface to write data to the messageparcel instance. sendMessageRequest asynchronously verifies
6000
    *               the priority processing levels of onRemoteMessageRequest and onRemoteRequest
6001 6002 6003
    * @tc.desc    Function test
    * @tc.level   0
    */
Y
yang-qibo 已提交
6004 6005 6006 6007 6008 6009 6010
        it("SUB_Softbus_IPC_Compatibility_MessageParcel_15800", 0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15800---------------------------");
            try{
                var data = rpc.MessageSequence.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800: create object successfully.");
                var reply = rpc.MessageSequence.create();
                var option = new rpc.MessageOption();
6011
                var token = 'onRemoteRequest or onRemoteMessageRequest invoking';
Y
yang-qibo 已提交
6012 6013 6014 6015 6016
                data.writeString(token);
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800: gIRemoteObject is undefined");
                }
6017
                await gIRemoteObject.sendMessageRequest(CODE_ONREMOTEMESSAGE_OR_ONREMOTE, data, reply, option).then((result) => {
Y
yang-qibo 已提交
6018 6019 6020
                    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);
6021
                    expect(replyReadResult).assertEqual("onRemoteMessageRequest invoking");
Y
yang-qibo 已提交
6022 6023 6024 6025 6026 6027 6028 6029 6030 6031
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15800---------------------------");
        });

Z
zhangpa2021 已提交
6032

Y
yang-qibo 已提交
6033
        /*
Z
zhangpa2021 已提交
6034
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_00100
Y
yang-qibo 已提交
6035 6036 6037 6038
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055
        it("SUB_Softbus_IPC_Compatibility_MessageOption_00100",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00100---------------------------");
            try{
                let option = new rpc.MessageOption();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00100: create object successfully.");
                let time = option.getWaitTime();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00100: run getWaitTime success, time is " + time);
                expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);
                option.setWaitTime(16);
                let time2 = option.getWaitTime();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00100: run getWaitTime success, time is " + time2);
                expect(time2).assertEqual(16);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00100: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00100---------------------------");
        })
Y
yang-qibo 已提交
6056

Y
yang-qibo 已提交
6057
        /*
Z
zhangpa2021 已提交
6058
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_00200
Y
yang-qibo 已提交
6059 6060 6061 6062
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6063 6064 6065 6066 6067 6068 6069 6070
        it("SUB_Softbus_IPC_Compatibility_MessageOption_00200",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00200---------------------------");
            try{
                let option = new rpc.MessageOption();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00200: create object successfully.");
                let time = option.getWaitTime();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00200: run getWaitTime success, time is " + time);
                expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);
Y
yang-qibo 已提交
6071

Y
yang-qibo 已提交
6072 6073 6074 6075
                option.setWaitTime(0);
                let time2 = option.getWaitTime();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00200: run getWaitTime success, time is " + time2);
                expect(time2).assertEqual(rpc.MessageOption.TF_WAIT_TIME);
Y
yang-qibo 已提交
6076

Y
yang-qibo 已提交
6077 6078 6079 6080
                option.setWaitTime(60);
                let time3 = option.getWaitTime();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00200: run getWaitTime success, time is " + time3);
                expect(time3).assertEqual(60);
Y
yang-qibo 已提交
6081

Y
yang-qibo 已提交
6082 6083 6084 6085 6086
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00200: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00200---------------------------");
        })
Y
yang-qibo 已提交
6087

Y
yang-qibo 已提交
6088
        /*
Z
zhangpa2021 已提交
6089
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_00300
Y
yang-qibo 已提交
6090 6091 6092 6093
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6094 6095 6096 6097 6098 6099 6100 6101
        it("SUB_Softbus_IPC_Compatibility_MessageOption_00300",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00300---------------------------");
            try{
                let option = new rpc.MessageOption();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00300: create object successfully.");
                let time = option.getWaitTime();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00300: run getWaitTime success, time is " + time);
                expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);
Y
yang-qibo 已提交
6102

Y
yang-qibo 已提交
6103 6104 6105 6106 6107 6108 6109 6110 6111
                option.setWaitTime(-1);
                let time2 = option.getWaitTime();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00300: run getWaitTime success, time is " + time2);
                expect(time2).assertEqual(rpc.MessageOption.TF_WAIT_TIME);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00300: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00300---------------------------");
        })
Y
yang-qibo 已提交
6112

Y
yang-qibo 已提交
6113
        /*
Z
zhangpa2021 已提交
6114
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_00400
Y
yang-qibo 已提交
6115 6116 6117 6118
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6119 6120 6121 6122 6123 6124 6125 6126
        it("SUB_Softbus_IPC_Compatibility_MessageOption_00400",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00400---------------------------");
            try{
                let option = new rpc.MessageOption();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00400: create object successfully.");
                let time = option.getWaitTime();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00400: run getWaitTime success, time is " + time);
                expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);
Y
yang-qibo 已提交
6127

Y
yang-qibo 已提交
6128 6129 6130 6131 6132 6133 6134 6135 6136
                option.setWaitTime(61);
                let time2 = option.getWaitTime();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00400: run getWaitTime success, time is " + time2);
                expect(time2).assertEqual(61);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00400: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00400---------------------------");
        })
Y
yang-qibo 已提交
6137

Y
yang-qibo 已提交
6138
        /*
Z
zhangpa2021 已提交
6139
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_00500
Y
yang-qibo 已提交
6140 6141 6142 6143
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6144 6145 6146 6147 6148 6149 6150 6151
        it("SUB_Softbus_IPC_Compatibility_MessageOption_00500",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00500---------------------------");
            try{
                let option = new rpc.MessageOption();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00500: create object successfully.");
                let flog = option.getFlags();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00500: run getFlags success, flog is " + flog);
                expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);
Y
yang-qibo 已提交
6152

Y
yang-qibo 已提交
6153 6154 6155 6156 6157 6158 6159 6160 6161 6162
                option.setFlags(1)
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00500: run setFlags success");
                let flog2 = option.getFlags();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00500: run getFlags success, flog2 is " + flog2);
                expect(flog2).assertEqual(rpc.MessageOption.TF_ASYNC);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00500: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00500---------------------------");
        })
Y
yang-qibo 已提交
6163

Y
yang-qibo 已提交
6164
        /*
Z
zhangpa2021 已提交
6165
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_00600
Y
yang-qibo 已提交
6166 6167 6168 6169
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194
        it("SUB_Softbus_IPC_Compatibility_MessageOption_00600",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00600---------------------------");
            try{
                let option = new rpc.MessageOption();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: create object successfully.");
                let flog = option.getFlags();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: run getFlags success, flog is " + flog);
                expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);

                option.setFlags(1);
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: run setFlags success");
                let flog2 = option.getFlags();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: run getFlags success, flog2 is " + flog2);
                expect(flog2).assertEqual(rpc.MessageOption.TF_ASYNC);

                option.setFlags(0)
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: run setFlags success");
                let flog3 = option.getFlags();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: run getFlags success, flog2 is " + flog3);
                expect(flog2).assertEqual(rpc.MessageOption.TF_ASYNC);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00600---------------------------");
        })
J
jiyong 已提交
6195

Y
yang-qibo 已提交
6196
        /*
Z
zhangpa2021 已提交
6197
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_00700
Y
yang-qibo 已提交
6198
     * @tc.name    Basic method of testing messageoption
J
jiyong 已提交
6199 6200 6201
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6202 6203 6204 6205 6206 6207 6208 6209
        it("SUB_Softbus_IPC_Compatibility_MessageOption_00700",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00700---------------------------");
            try{
                let option = new rpc.MessageOption();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00700: create object successfully.");
                let flog = option.getFlags();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00700: run getFlags success, flog is " + flog);
                expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);
Z
zhangpa2021 已提交
6210

Y
yang-qibo 已提交
6211 6212 6213 6214 6215 6216 6217 6218 6219
                option.setFlags(-1);
                let flog2 = option.getFlags();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00700: run getFlags success, flog2 is " + flog2);
                expect(flog2).assertEqual(-1);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00700: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00700---------------------------");
        })
J
jiyong 已提交
6220

Y
yang-qibo 已提交
6221
        /*
Z
zhangpa2021 已提交
6222
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_00800
J
jiyong 已提交
6223 6224 6225 6226
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6227 6228 6229 6230 6231 6232 6233 6234
        it("SUB_Softbus_IPC_Compatibility_MessageOption_00800",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00800---------------------------");
            try{
                let option = new rpc.MessageOption();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00800: create object successfully.");
                let flog = option.getFlags();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00800: run getFlags success, flog is " + flog);
                expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);
J
jiyong 已提交
6235

Y
yang-qibo 已提交
6236 6237 6238 6239 6240 6241 6242 6243 6244
                option.setFlags(3);
                let flog2 = option.getFlags();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00800: run getFlags success, flog2 is " + flog2);
                expect(flog2).assertEqual(3);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00800: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00800---------------------------");
        })
J
jiyong 已提交
6245

Y
yang-qibo 已提交
6246
        /*
Z
zhangpa2021 已提交
6247
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_00900
Y
yang-qibo 已提交
6248 6249 6250 6251
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6252 6253 6254 6255
        it("SUB_Softbus_IPC_Compatibility_MessageOption_00900",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00900---------------------------");
            try{
                expect(rpc.MessageOption.TF_SYNC).assertEqual(0);
J
jiyong 已提交
6256

Y
yang-qibo 已提交
6257
                expect(rpc.MessageOption.TF_ASYNC).assertEqual(1);
Y
yang-qibo 已提交
6258

Y
yang-qibo 已提交
6259
                expect(rpc.MessageOption.TF_WAIT_TIME).assertEqual(4);
Y
yang-qibo 已提交
6260

Y
yang-qibo 已提交
6261 6262 6263 6264 6265 6266
                expect(rpc.MessageOption.TF_ACCEPT_FDS).assertEqual(0x10);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00900: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00900---------------------------");
        })
J
jiyong 已提交
6267

Y
yang-qibo 已提交
6268
        /*
Z
zhangpa2021 已提交
6269
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_01000
Y
yang-qibo 已提交
6270
     * @tc.name    Basic method of testing messageoption
J
jiyong 已提交
6271 6272 6273
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6274 6275 6276
        it("SUB_Softbus_IPC_Compatibility_MessageOption_01000",0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_01000---------------------------");
            try{
6277

Y
yang-qibo 已提交
6278 6279 6280 6281 6282 6283 6284 6285 6286 6287
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                option.setWaitTime(20);
                option.setFlags(0);
                var token = "option";
                var result = data.writeString(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000:run writeStringis is " + result);
                expect(result).assertTrue();
6288 6289
                expect(option.getFlags()).assertEqual(0);
                expect(option.getWaitTime()).assertEqual(20);
6290

Y
yang-qibo 已提交
6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000: sendRequestis is " + result.errCode);

                    var replyReadResult = result.reply.readString();
                    console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000: run readString is " + replyReadResult);
                    expect(replyReadResult).assertEqual(token);
                    expect(option.getFlags()).assertEqual(0);
                    expect(option.getWaitTime()).assertEqual(20);

                });
                data.reclaim();
                reply.reclaim();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000: error " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_01000---------------------------");
        })
J
jiyong 已提交
6313

Y
yang-qibo 已提交
6314
        /*
Z
zhangpa2021 已提交
6315
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_01100
Y
yang-qibo 已提交
6316
     * @tc.name    Basic method of testing messageoption
Z
zhangpa2021 已提交
6317 6318 6319
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332
        it("SUB_Softbus_IPC_Compatibility_MessageOption_01100",0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_01100---------------------------");
            try{

                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                option.setFlags(1);
                var token = "option";
                var result = data.writeString(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100:run writeStringis is " + result);
                expect(result).assertTrue();
Y
yang-qibo 已提交
6333
                expect(option.getFlags()).assertEqual(1);
Y
yang-qibo 已提交
6334 6335 6336 6337 6338 6339 6340 6341 6342 6343
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    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(option.getFlags()).assertEqual(1);
Z
zhangpa2021 已提交
6344

Y
yang-qibo 已提交
6345 6346 6347 6348 6349 6350 6351 6352 6353
                });
                data.reclaim();
                reply.reclaim();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100: error " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_01100---------------------------");
        })
Z
zhangpa2021 已提交
6354

Y
yang-qibo 已提交
6355
        /*
Z
zhangpa2021 已提交
6356
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_01200
Y
yang-qibo 已提交
6357 6358 6359 6360
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373
        it("SUB_Softbus_IPC_Compatibility_MessageOption_01200",0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_01200---------------------------");
            try{

                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                option.setFlags(3);
                var token = "option";
                var result = data.writeString(token);
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200:run writeStringis is " + result);
                expect(result).assertTrue();
Y
yang-qibo 已提交
6374
                expect(option.getFlags()).assertEqual(3);
Y
yang-qibo 已提交
6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    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(option.getFlags()).assertEqual(3);
                });
                data.reclaim();
                reply.reclaim();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200: error " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_01200---------------------------");
        })
Z
zhangpa2021 已提交
6394

Y
yang-qibo 已提交
6395
        /*
Z
zhangpa2021 已提交
6396
     * @tc.number  SUB_Softbus_IPC_Compatibility_MessageOption_01300
Y
yang-qibo 已提交
6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411
     * @tc.name    MessageOption sendMessageRequest test
     * @tc.desc    Function test
     * @tc.level   0
     */
        it("SUB_Softbus_IPC_Compatibility_MessageOption_01300",0, async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_01300---------------------------");
            try{

                var data = rpc.MessageSequence.create();
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300: create object successfully.");
                var reply = rpc.MessageSequence.create();
                var option = new rpc.MessageOption();
                option.setFlags(1);
                var token = "option";
                data.writeString(token);
Z
zhangpa2021 已提交
6412
                expect(option.getFlags()).assertEqual(1);
Y
yang-qibo 已提交
6413 6414 6415 6416 6417 6418 6419 6420 6421 6422
                if (gIRemoteObject == undefined)
                {
                    console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300: gIRemoteObject is undefined");
                }
                await gIRemoteObject.sendMessageRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                    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(option.getFlags()).assertEqual(1);
Z
zhangpa2021 已提交
6423

Y
yang-qibo 已提交
6424 6425 6426 6427 6428 6429 6430 6431 6432
                });
                data.reclaim();
                reply.reclaim();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300: error " + error);
            }
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_01300---------------------------");
        })
Z
zhangpa2021 已提交
6433

Y
yang-qibo 已提交
6434
        /*
Z
zhangpa2021 已提交
6435
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_00100
J
jiyong 已提交
6436 6437 6438 6439
     * @tc.name    Exception parameter validation of the created anonymous shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6440 6441 6442 6443 6444
        it("SUB_Softbus_IPC_Compatibility_Ashmem_00100",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00100---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", -1)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00100: ashmem " + ashmem);
J
jiyong 已提交
6445

Y
yang-qibo 已提交
6446 6447 6448 6449 6450 6451 6452
                let ashmem2 = rpc.Ashmem.createAshmem(null, K)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00100: ashmem2 " + ashmem2);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00100: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00100---------------------------");
        })
J
jiyong 已提交
6453

Y
yang-qibo 已提交
6454
        /*
Z
zhangpa2021 已提交
6455
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_00200
J
jiyong 已提交
6456 6457 6458 6459
     * @tc.name    Call the getashmemsize interface to get the size of the shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474
        it("SUB_Softbus_IPC_Compatibility_Ashmem_00200",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00200---------------------------");
            try{
                var mapSize = 2*G - 1;
                var jsash = "";
                for (let i = 0;i < (256 - 1);i++){
                    jsash += "a";
                }
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00200: run  createAshmem success" + jsash.length);
                let ashmem = rpc.Ashmem.createAshmem(jsash, mapSize)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00200: run  createAshmem success" + ashmem);
                expect(ashmem != null).assertTrue();
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00200: error " + error);
Y
yang-qibo 已提交
6475
            }
Y
yang-qibo 已提交
6476 6477
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00200---------------------------");
        })
J
jiyong 已提交
6478

Y
yang-qibo 已提交
6479
        /*
Z
zhangpa2021 已提交
6480
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_00300
Y
yang-qibo 已提交
6481 6482 6483 6484
     * @tc.name    Call the getashmemsize interface to get the size of the shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499
        it("SUB_Softbus_IPC_Compatibility_Ashmem_00300",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00300---------------------------");
            try{
                let mapSize = 2*G - 1;
                let jsash = '';
                for (let i = 0;i < 256;i++){
                    jsash += 'a';
                }
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00300: run  createAshmem success" + jsash.length);
                let ashmem = rpc.Ashmem.createAshmem(jsash, mapSize)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00300: run  createAshmem success" + ashmem);
                ashmem.closeAshmem();
            }catch(error){
                expect(error != null).assertTrue();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00300: error " + error);
Y
yang-qibo 已提交
6500
            }
Y
yang-qibo 已提交
6501 6502
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00300---------------------------");
        })
J
jiyong 已提交
6503

Y
yang-qibo 已提交
6504
        /*
Z
zhangpa2021 已提交
6505
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_00400
J
jiyong 已提交
6506 6507 6508 6509
     * @tc.name    Call the getashmemsize interface to get the size of the shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524
        it("SUB_Softbus_IPC_Compatibility_Ashmem_00400",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00400---------------------------");
            try{
                let mapSize = 2*G - 1;
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00400: run  createAshmem success" + ashmem);
                let size = ashmem.getAshmemSize()
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00400: run getAshmemSize success, size is " + size);
                expect(size).assertEqual(mapSize);
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00400: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00400---------------------------");
        })
J
jiyong 已提交
6525

Y
yang-qibo 已提交
6526
        /*
Z
zhangpa2021 已提交
6527
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_00500
Y
yang-qibo 已提交
6528 6529 6530 6531
     * @tc.name    Call the getashmemsize interface to get the size of the shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547
        it("SUB_Softbus_IPC_Compatibility_Ashmem_00500",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00500---------------------------");
            try{
                let mapSize = 2*G;
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest ", mapSize)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00500: run  createAshmem success " + ashmem);
                let size = ashmem.getAshmemSize()
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00500: run getAshmemSize success, size is " + size);
                expect(size).assertEqual(mapSize);
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00500: error " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00500---------------------------");
        })
J
jiyong 已提交
6548

Y
yang-qibo 已提交
6549
        /*
Z
zhangpa2021 已提交
6550
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_00600
J
jiyong 已提交
6551 6552 6553 6554
     * @tc.name    Writeashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570
        it("SUB_Softbus_IPC_Compatibility_Ashmem_00600",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00600---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00600: ashmem " + ashmem);
                ashmem.closeAshmem()
                var data = rpc.MessageParcel.create();
                let writeAshmem = data.writeAshmem(ashmem);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00600: run writeAshmem success, writeAshmem is " + writeAshmem);
                expect(writeAshmem).assertEqual(false);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00600: error " + error);
            }
            data.reclaim();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00600---------------------------");
        })
J
jiyong 已提交
6571

Y
yang-qibo 已提交
6572
        /*
Z
zhangpa2021 已提交
6573
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_00700
J
jiyong 已提交
6574 6575 6576 6577
     * @tc.name    Readfromashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594
        it("SUB_Softbus_IPC_Compatibility_Ashmem_00700",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00700---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00700: ashmem " + ashmem);
                ashmem.unmapAshmem()
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00700: run unmapAshmem success");
                let bytes = [1, 2, 3, 4, 5];
                let ret = ashmem.readFromAshmem(bytes.length, 0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00700: run readFromAshmem result is " + ret);
                expect(ret==null).assertTrue();
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00700: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00700---------------------------");
        })
J
jiyong 已提交
6595

Y
yang-qibo 已提交
6596
        /*
Z
zhangpa2021 已提交
6597
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_00800
J
jiyong 已提交
6598 6599 6600 6601
     * @tc.name    Mapashmem interface creates shared file mappings
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615
        it("SUB_Softbus_IPC_Compatibility_Ashmem_00800",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00800---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00800: ashmem " + ashmem);
                let result = ashmem.mapAshmem(rpc.Ashmem.PROT_READ);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00800: run mapAshmemis is " + result);
                expect(result).assertTrue();
                ashmem.closeAshmem()
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00800: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00800---------------------------");
        })
J
jiyong 已提交
6616

Y
yang-qibo 已提交
6617
        /*
Z
zhangpa2021 已提交
6618
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_00900
J
jiyong 已提交
6619 6620 6621 6622
     * @tc.name    Mapashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637
        it("SUB_Softbus_IPC_Compatibility_Ashmem_00900",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00900---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", (2*G - 1))
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00900: ashmem " + ashmem);
                let result = ashmem.mapAshmem(999);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00900: run mapAshmemis is " + result);
                expect(result).assertEqual(false);
                ashmem.closeAshmem()
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00900: error " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00900---------------------------");
        })
J
jiyong 已提交
6638

Y
yang-qibo 已提交
6639
        /*
Z
zhangpa2021 已提交
6640
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_01000
J
jiyong 已提交
6641 6642 6643 6644
     * @tc.name    Mapreadandwriteashmem interface creates a shared file map with the protection level of read-write
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657
        it("SUB_Softbus_IPC_Compatibility_Ashmem_01000",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01000---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01000: ashmem " + ashmem);
                let result = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01000: run mapAshmemis is " + result);
                ashmem.closeAshmem()
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01000: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01000---------------------------");
        })
J
jiyong 已提交
6658

Y
yang-qibo 已提交
6659
        /*
Z
zhangpa2021 已提交
6660
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_01100
J
jiyong 已提交
6661 6662 6663 6664
     * @tc.name    Mapreadandwriteashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6665 6666 6667 6668 6669 6670 6671 6672
        it("SUB_Softbus_IPC_Compatibility_Ashmem_01100",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01100---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01100: ashmem " + ashmem);
                let result = ashmem.mapAshmem(rpc.Ashmem.PROT_READ);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01100: run mapAshmemis is " + result);
                expect(result).assertTrue();
J
jiyong 已提交
6673

Y
yang-qibo 已提交
6674 6675
                ashmem.unmapAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01100: run unmapAshmem success");
Z
zhangpa2021 已提交
6676

Y
yang-qibo 已提交
6677 6678 6679 6680 6681 6682 6683 6684 6685
                let result2 = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01100: run mapReadAndWriteAshmemis2 is " + result2);
                expect(result2).assertTrue();
                ashmem.closeAshmem()
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01100: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01100---------------------------");
        })
J
jiyong 已提交
6686

Y
yang-qibo 已提交
6687
        /*
Z
zhangpa2021 已提交
6688
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_01200
J
jiyong 已提交
6689 6690 6691 6692
     * @tc.name    Mapreadonlyashmem interface creates a shared file map with the protection level of read-write
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706
        it("SUB_Softbus_IPC_Compatibility_Ashmem_01200",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01200---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01200: ashmem " + ashmem);
                let result = ashmem.mapReadOnlyAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01200: run mapReadAndWriteAshmemis is " + result);
                expect(result).assertTrue();
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01200: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01200---------------------------");
        })
J
jiyong 已提交
6707

Y
yang-qibo 已提交
6708
        /*
Z
zhangpa2021 已提交
6709
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_01300
J
jiyong 已提交
6710 6711 6712 6713
     * @tc.name    Mapreadonlyashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6714 6715 6716 6717 6718
        it("SUB_Softbus_IPC_Compatibility_Ashmem_01300",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01300---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01300: ashmem " + ashmem);
J
jiyong 已提交
6719

Y
yang-qibo 已提交
6720 6721 6722
                let result = ashmem.mapAshmem(rpc.Ashmem.PROT_WRITE);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01300: run mapAshmemis is " + result);
                expect(result).assertTrue();
J
jiyong 已提交
6723

Y
yang-qibo 已提交
6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734
                ashmem.unmapAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01300: run unmapAshmem success");
                ashmem.closeAshmem()
                let result2 = ashmem.mapReadOnlyAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01300: run mapReadAndWriteAshmemis2 is " + result2);
                expect(result2).assertEqual(false);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01300: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01300---------------------------");
        })
J
jiyong 已提交
6735

Y
yang-qibo 已提交
6736
        /*
Z
zhangpa2021 已提交
6737
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_01400
J
jiyong 已提交
6738 6739 6740 6741
     * @tc.name    Mapreadonlyashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770
        it("SUB_Softbus_IPC_Compatibility_Ashmem_01400",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01400---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
                let resultwrite = ashmem.setProtection(rpc.Ashmem.PROT_WRITE)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: run setProtectioniswrite is " + resultwrite);
                expect(resultwrite).assertTrue();
                let resultread = ashmem.setProtection(rpc.Ashmem.PROT_READ)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: run setProtectionisread is " + resultread);
                expect(resultread).assertEqual(false);

                let resultreadAndwrite = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: run setProtection success, mapReadAndWriteAshmem is "
                    + resultreadAndwrite);
                expect(resultreadAndwrite ).assertEqual(false);

                let resultnone = ashmem.setProtection(rpc.Ashmem.PROT_NONE)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: run setProtectionisnone is " + resultnone);
                expect(resultnone).assertTrue();

                let resultread2 = ashmem.setProtection(rpc.Ashmem.PROT_READ)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: run setProtectionisread2 is " + resultread2);
                expect(resultread2).assertEqual(false);
                ashmem.closeAshmem()
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01400---------------------------");
        })
J
jiyong 已提交
6771

Y
yang-qibo 已提交
6772
        /*
Z
zhangpa2021 已提交
6773
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_01500
Y
yang-qibo 已提交
6774 6775 6776 6777
     * @tc.name    Setprotection exception input parameter verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791
        it("SUB_Softbus_IPC_Compatibility_Ashmem_01500",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01500---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01500: ashmem " + ashmem);
                let result = ashmem.setProtection(3);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01500: run setProtectionis is " + result);
                expect(result).assertTrue();
                ashmem.closeAshmem()
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01500: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01500---------------------------");
        })
Y
yang-qibo 已提交
6792

Y
yang-qibo 已提交
6793
        /*
Z
zhangpa2021 已提交
6794
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_01600
Y
yang-qibo 已提交
6795 6796 6797
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
6798
     */
Y
yang-qibo 已提交
6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819
        it("SUB_Softbus_IPC_Compatibility_Ashmem_01600",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01600---------------------------");
            try{
                let mapSize = 4096
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01600: ashmem " + ashmem);

                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01600: run mapReadAndWriteAshmemis2 is "
                    + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [1, 2, 3, 4, 5];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01600: run writeToAshmemis is " + result);
                expect(result).assertTrue();
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01600: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01600---------------------------");
        })
Y
yang-qibo 已提交
6820

Y
yang-qibo 已提交
6821
        /*
Z
zhangpa2021 已提交
6822
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_01700
Y
yang-qibo 已提交
6823 6824 6825 6826
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850
        it("SUB_Softbus_IPC_Compatibility_Ashmem_01700",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01700---------------------------");
            try{
                let mapSize = 4096
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01700: ashmem " + ashmem);

                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01700: run mapReadAndWriteAshmemis2 is "
                    + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [-2147483648,2147483647];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01700: run writeToAshmemis is " + result);
                expect(result).assertTrue();
                let reresult = ashmem.readFromAshmem(bytes.length,0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01700: run readFromAshmemis is " + reresult);
                assertArrayElementEqual(reresult,bytes);
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01700: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01700---------------------------");
        })
Y
yang-qibo 已提交
6851

Y
yang-qibo 已提交
6852
        /*
Z
zhangpa2021 已提交
6853
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_01800
Y
yang-qibo 已提交
6854 6855 6856 6857
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882
        it("SUB_Softbus_IPC_Compatibility_Ashmem_01800",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01800---------------------------");
            try{
                let mapSize = 4096
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01800: ashmem " + ashmem);

                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01800: run mapReadAndWriteAshmemis2 is "
                    + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [-2147483649,2147483647];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01800: run writeToAshmemis is " + result);
                expect(result).assertTrue();
                let readresult = ashmem.readFromAshmem(bytes.length,0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01800: run readFromAshmemis is " + readresult);
                expect(readresult[0]).assertEqual(2147483647);
                expect(readresult[1]).assertEqual(bytes[1]);
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01800: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01800---------------------------");
        })
6883

Y
yang-qibo 已提交
6884
        /*
Z
zhangpa2021 已提交
6885
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_01900
Y
yang-qibo 已提交
6886 6887 6888 6889
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914
        it("SUB_Softbus_IPC_Compatibility_Ashmem_01900",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01900---------------------------");
            try{
                let mapSize = 4096
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01900: ashmem " + ashmem);

                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01900: run mapReadAndWriteAshmemis2 is "
                    + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [-2147483648,2147483648];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01900: run writeToAshmemis is " + result);
                expect(result).assertTrue();
                let reresult = ashmem.readFromAshmem(bytes.length,0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01900: run readFromAshmemis is " + reresult);
                expect(reresult[0]).assertEqual(bytes[0]);
                expect(reresult[1]).assertEqual(-2147483648);
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01900: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01900---------------------------");
        })
J
jiyong 已提交
6915

Y
yang-qibo 已提交
6916
        /*
Z
zhangpa2021 已提交
6917
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_02000
Y
yang-qibo 已提交
6918
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
J
jiyong 已提交
6919 6920 6921
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941
        it("SUB_Softbus_IPC_Compatibility_Ashmem_02000",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02000---------------------------");
            try{
                let mapSize = 2*M;
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02000: ashmem " + ashmem);

                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02000: run mapReadAndWriteAshmemis2 is " + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [0,1];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 2147483647);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02000: run writeToAshmemis is " + result);
                expect(result).assertEqual(false);
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02000: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02000---------------------------");
        })
J
jiyong 已提交
6942

Y
yang-qibo 已提交
6943
        /*
Z
zhangpa2021 已提交
6944
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_02100
J
jiyong 已提交
6945 6946 6947 6948
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970
        it("SUB_Softbus_IPC_Compatibility_Ashmem_02100",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02100---------------------------");
            try{
                let mapSize = 2*M;
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02100: ashmem " + ashmem);

                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02100: run mapReadAndWriteAshmemis2 is " + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [0,1];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 2147483648);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02100: run writeToAshmemis is " + result);
                expect(result).assertTrue();
                let readresult1 = ashmem.readFromAshmem(bytes.length,0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02100: run readFromAshmemis is " + readresult1);
                assertArrayElementEqual(readresult1,bytes);
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02100: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02100---------------------------");
        })
J
jiyong 已提交
6971

Y
yang-qibo 已提交
6972
        /*
Z
zhangpa2021 已提交
6973
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_02200
J
jiyong 已提交
6974 6975 6976 6977
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003
        it("SUB_Softbus_IPC_Compatibility_Ashmem_02200",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02200---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: ashmem " + ashmem);

                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: run mapReadAndWriteAshmemis2 is "
                    + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [1, 2, 3, 4, 5];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: run writeToAshmemis is " +result);
                expect(result).assertTrue();
                let resultread = ashmem.setProtection(rpc.Ashmem.PROT_READ);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: run setProtectionisread is " + resultread);
                expect(resultread).assertTrue()
                let result2 = ashmem.writeToAshmem(bytes, bytes.length, 0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: run writeToAshmemis is2 " + result2);
                expect(result2).assertEqual(false)
                ashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: error " +error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02200---------------------------");
        })
J
jiyong 已提交
7004

Y
yang-qibo 已提交
7005
        /*
Z
zhangpa2021 已提交
7006
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_02300
J
jiyong 已提交
7007 7008 7009 7010
     * @tc.name    Writetoashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030
        it("SUB_Softbus_IPC_Compatibility_Ashmem_02300",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02300---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02300: ashmem " + ashmem);
                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02300: run mapReadAndWriteAshmemis2 is "
                    + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [1, 2, 3, 4, 5];
                let size = bytes.length + 10;
                let result = ashmem.writeToAshmem(bytes, 3, 0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02300: run writeToAshmemis is " + result);
                expect(result).assertTrue();
                ashmem.closeAshmem()
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02300: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02300---------------------------");
        })
J
jiyong 已提交
7031

Y
yang-qibo 已提交
7032
        /*
Z
zhangpa2021 已提交
7033
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_02400
J
jiyong 已提交
7034 7035 7036 7037
     * @tc.name    Read data from the shared file associated with readfromashmem
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060
        it("SUB_Softbus_IPC_Compatibility_Ashmem_02400",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02400---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02400: ashmem " + ashmem);

                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02400: run mapReadAndWriteAshmemis2 is "
                    + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [1, 2, 3, 4, 5];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02400: run writeToAshmemis is " + result);
                expect(result).assertTrue();
                var resultRead = ashmem.readFromAshmem(bytes.length, 0);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02400: run readFromAshmemis is " + resultRead);
                assertArrayElementEqual(resultRead,bytes);
                ashmem.closeAshmem()
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02400: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02400---------------------------");
        })
J
jiyong 已提交
7061

Y
yang-qibo 已提交
7062
        /*
Z
zhangpa2021 已提交
7063
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_02500
J
jiyong 已提交
7064 7065 7066 7067
     * @tc.name    Readfromashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092
        it("SUB_Softbus_IPC_Compatibility_Ashmem_02500",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02500---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02500: ashmem " + ashmem);
                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02500: run mapReadAndWriteAshmemis2 is "
                    + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [1, 2, 3, 4, 5];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 1);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02500: run writeToAshmemis is " + result);
                expect(result).assertTrue()

                let result2 = ashmem.readFromAshmem(bytes.length, 3);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02500: run readFromAshmemis2 is " + result2);
                expect(bytes[2]).assertEqual(result2[0]);
                expect(bytes[3]).assertEqual(result2[1]);
                expect(bytes[4]).assertEqual(result2[2]);
                ashmem.closeAshmem()
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02500: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02500---------------------------");
        })
J
jiyong 已提交
7093

Y
yang-qibo 已提交
7094
        /*
Z
zhangpa2021 已提交
7095
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_02600
J
jiyong 已提交
7096 7097 7098 7099
     * @tc.name    Createashmemfromexisting copies the ashmem object description and creates a new object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127
        it("SUB_Softbus_IPC_Compatibility_Ashmem_02600",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02600---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600: ashmem " + ashmem);
                let resultWriteAndRead = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600:  run mapReadAndWriteAshmem result " + resultWriteAndRead);
                expect(resultWriteAndRead).assertTrue();
                let bytes = [1, 2, 3];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 1);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600: run writeToAshmemis " + result);
                expect(result).assertTrue()
                let newashmem = rpc.Ashmem.createAshmemFromExisting(ashmem);
                let resultWriteAndRead2 = newashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600:  run mapReadAndWriteAshmem result " + resultWriteAndRead2);
                expect(resultWriteAndRead2).assertTrue();

                let result2 = newashmem.readFromAshmem(bytes.length, 1);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600: run readFromAshmemis2 is " + result2);
                expect(result).assertTrue();
                assertArrayElementEqual(result2,bytes);
                ashmem.closeAshmem();
                newashmem.closeAshmem();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02600---------------------------");
        })
J
jiyong 已提交
7128

Y
yang-qibo 已提交
7129
        /*
Z
zhangpa2021 已提交
7130
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_02700
J
jiyong 已提交
7131 7132 7133 7134 7135
     * @tc.name    Create a shared memory object and call writeashmem to write the shared anonymous
      object into the messageparcel object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163
        it("SUB_Softbus_IPC_Compatibility_Ashmem_02700",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02700---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
                let data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: ashmem " + ashmem);
                let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: run mapReadAndWriteAshmem result is " + resultMapRAndW);
                expect(resultMapRAndW).assertTrue();
                let bytes = [1, 2, 3];
                let result = ashmem.writeToAshmem(bytes, bytes.length, 1);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: run writeToAshmemis is " + result);
                expect(result).assertTrue()
                let result2 = data.writeAshmem(ashmem)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: run writeAshmemis is " + result2);
                expect(result2).assertTrue();
                let retReadAshmem = data.readAshmem();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: run readAshmem is " + retReadAshmem);
                let retBytes = retReadAshmem.readFromAshmem(bytes.length, 1);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: run readFromAshmem result is " + retBytes);

                ashmem.closeAshmem();
                data.reclaim();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: error " +error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02700---------------------------");
        })
J
jiyong 已提交
7164

Y
yang-qibo 已提交
7165
        /*
Z
zhangpa2021 已提交
7166
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_02800
J
jiyong 已提交
7167 7168 7169 7170 7171
     * @tc.name    Create a non shared memory object and call writeashmem to write the messageparcel object
      object into the messageparcel object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187
        it("SUB_Softbus_IPC_Compatibility_Ashmem_02800",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02800---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                let data2 = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02800: create MessageParcel object success");
                let result = data.writeAshmem(data2);
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02800: run writeAshmemis is " + result);
                data.reclaim();
                data2.reclaim();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02800: error " + error);
                expect(error != null).assertTrue();
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02800---------------------------");
        })
J
jiyong 已提交
7188

Y
yang-qibo 已提交
7189
        /*
Z
zhangpa2021 已提交
7190
     * @tc.number  SUB_Softbus_IPC_Compatibility_Ashmem_02900
Y
yang-qibo 已提交
7191 7192
     * @tc.name    Create a non shared memory object and call writeashmem to write the messageparcel object
      object into the messageparcel object
Z
zhangpa2021 已提交
7193 7194 7195
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7196 7197 7198 7199
        it("SUB_Softbus_IPC_Compatibility_Ashmem_02900",0,function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02900---------------------------");
            try{
                let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
Z
zhangpa2021 已提交
7200

Y
yang-qibo 已提交
7201 7202 7203
                let resultwrite = ashmem.setProtection(rpc.Ashmem.PROT_EXEC)
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02900: run setProtectioniswrite is " + resultwrite);
                expect(resultwrite).assertTrue();
Z
zhangpa2021 已提交
7204

Y
yang-qibo 已提交
7205 7206 7207 7208 7209 7210
                ashmem.closeAshmem()
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02900: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02900---------------------------");
        })
Z
zhangpa2021 已提交
7211

Y
yang-qibo 已提交
7212
        /*
Z
zhangpa2021 已提交
7213
     * @tc.number  SUB_Softbus_IPC_Compatibility_IRemoteObject_00100
J
jiyong 已提交
7214 7215 7216 7217
     * @tc.name    Call sendrequestresult interface to send data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238
        it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00100",0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00100---------------------------");
            try{
                let data = rpc.MessageParcel.create();
                let reply = rpc.MessageParcel.create();
                let option = new rpc.MessageOption();
                let sequenceable = new MySequenceable(1, "aaa");
                let result = data.writeSequenceable(sequenceable);
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00100: run writeSequenceableis is " + result);

                await gIRemoteObject.sendRequest(CODE_WRITESEQUENCEABLE, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00100: sendRequestis is " + result.errCode);
                    expect(result.errCode == 0).assertTrue();
                    let ret = new MySequenceable(0, "");
                    var shortArryDataReply = result.reply.readSequenceable(ret);
                    console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00100: run readSequenceable is "
                        + shortArryDataReply);
                    expect(shortArryDataReply == true).assertTrue()
                    expect(ret.num).assertEqual(1)
                    expect(ret.str).assertEqual("aaa")
                });
J
jiyong 已提交
7239

Y
yang-qibo 已提交
7240 7241 7242 7243 7244 7245 7246 7247
                data.reclaim();
                reply.reclaim();
                done();
            }catch(error){
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00100: error " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00100---------------------------");
        })
7248

Y
yang-qibo 已提交
7249
        /*
Z
zhangpa2021 已提交
7250
     * @tc.number  SUB_Softbus_IPC_Compatibility_IRemoteObject_00200
J
jiyong 已提交
7251 7252 7253 7254 7255
     * @tc.name    Test that messageparcel passes through the same process, and the client
     *             receives the reply message in promise
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275
        it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00200", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00200---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00200: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                expect(data.writeByte(1)).assertTrue()
                expect(data.writeShort(2)).assertTrue()
                expect(data.writeInt(3)).assertTrue()
                expect(data.writeLong(10000)).assertTrue()
                expect(data.writeFloat(1.2)).assertTrue()
                expect(data.writeDouble(10.2)).assertTrue()
                expect(data.writeBoolean(true)).assertTrue()
                expect(data.writeChar(5)).assertTrue()
                expect(data.writeString("HelloWorld")).assertTrue()
                expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()

                await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00200: sendRequest done, error code: " + result.errCode);
Z
zhangpa2021 已提交
7276
                    expect(result.errCode).assertEqual(0)
Y
yang-qibo 已提交
7277 7278 7279 7280
                    expect(result.reply.readByte()).assertEqual(1)
                    expect(result.reply.readShort()).assertEqual(2)
                    expect(result.reply.readInt()).assertEqual(3)
                    expect(result.reply.readLong()).assertEqual(10000)
Z
zhangpa2021 已提交
7281 7282 7283 7284 7285
                    expect(result.reply.readFloat()).assertEqual(1.2)
                    expect(result.reply.readDouble()).assertEqual(10.2)
                    expect(result.reply.readBoolean()).assertTrue()
                    expect(result.reply.readChar()).assertEqual(5)
                    expect(result.reply.readString()).assertEqual("HelloWorld")
Y
yang-qibo 已提交
7286
                    let s = new MySequenceable(0, '')
Z
zhangpa2021 已提交
7287 7288 7289
                    expect(result.reply.readSequenceable(s)).assertTrue()
                    expect(s.num).assertEqual(1)
                    expect(s.str).assertEqual("aaa")
Y
yang-qibo 已提交
7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350
                });
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00200:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00200---------------------------");
            done();
        });

        /*
     * @tc.number  SUB_Softbus_IPC_Compatibility_IRemoteObject_00300
     * @tc.name    Test that messageparcel passes through the same process, and the client
     *             receives the reply message in the callback function
     * @tc.desc    Function test
     * @tc.level   0
     */
        it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00300", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00300---------------------------");
            try{
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00300: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();

                expect(data.writeByte(2)).assertTrue()
                expect(data.writeShort(3)).assertTrue()
                expect(data.writeInt(4)).assertTrue()
                expect(data.writeLong(5)).assertTrue()
                expect(data.writeFloat(1.2)).assertTrue()
                expect(data.writeDouble(10.2)).assertTrue()
                expect(data.writeBoolean(true)).assertTrue()
                expect(data.writeChar(5)).assertTrue()
                expect(data.writeString("HelloWorld")).assertTrue()
                expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()

                function sendRequestCallback(result) {
                    try{
                        console.info("sendRequest Callback")
                        console.info("sendRequest done, error code: " + result.errCode)
                        expect(result.errCode).assertEqual(0)
                        expect(result.reply.readByte()).assertEqual(2)
                        expect(result.reply.readShort()).assertEqual(3)
                        expect(result.reply.readInt()).assertEqual(4)
                        expect(result.reply.readLong()).assertEqual(5)
                        expect(result.reply.readFloat()).assertEqual(1.2)
                        expect(result.reply.readDouble()).assertEqual(10.2)
                        expect(result.reply.readBoolean()).assertTrue()
                        expect(result.reply.readChar()).assertEqual(5)
                        expect(result.reply.readString()).assertEqual("HelloWorld")
                        let s = new MySequenceable(null, null)
                        expect(result.reply.readSequenceable(s)).assertTrue()
                        expect(s.num).assertEqual(1)
                        expect(s.str).assertEqual("aaa")
                    } finally {
                        result.data.reclaim();
                        result.reply.reclaim();
                        console.info("test done")
                        done()
                    }
Z
zhangpa2021 已提交
7351 7352
                }

Y
yang-qibo 已提交
7353 7354 7355 7356 7357 7358 7359 7360
                console.info("start send request")
                await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option, sendRequestCallback)

            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00300:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00300---------------------------");
        });
7361

Y
yang-qibo 已提交
7362
        /*
Z
zhangpa2021 已提交
7363
     * @tc.number  SUB_Softbus_IPC_Compatibility_IRemoteObject_00400
J
jiyong 已提交
7364 7365 7366 7367
     * @tc.name    Iremoteobject, register death notification verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7368 7369 7370 7371 7372 7373 7374
        it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00400", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00400---------------------------");
            try{
                let object = new TestAbilityStub("Test1")
                var resultAdd1 = object.addDeathRecipient(null, 0)
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00400:run addDeathRecipient first result is" + resultAdd1);
                expect(resultAdd1 == false).assertTrue();
J
jiyong 已提交
7375

Y
yang-qibo 已提交
7376 7377 7378
                var resultRemove1 = object.removeDeathRecipient(null, 0)
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00400:run removeDeathRecipient1 result is" + resultRemove1);
                expect(resultRemove1 == false).assertTrue();
J
jiyong 已提交
7379

Y
yang-qibo 已提交
7380 7381 7382 7383 7384 7385 7386 7387
                let isDead = object.isObjectDead()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00400:run  isDead result is " + isDead);
                expect(isDead == false).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00400:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00400---------------------------");
        });
J
jiyong 已提交
7388

Y
yang-qibo 已提交
7389
        /*
Z
zhangpa2021 已提交
7390
     * @tc.number  SUB_Softbus_IPC_Compatibility_IRemoteObject_00500
J
jiyong 已提交
7391 7392 7393 7394 7395
     * @tc.name    Do not get the server agent, do not create a remoteobject instance, and directly getcallingpid,
     *             getcallingpid, getcallingdeviceid, getlocaldeviceid
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7396 7397 7398 7399 7400 7401
        it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00500---------------------------");
            try{
                let callingPid = rpc.IPCSkeleton.getCallingPid()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500: run getCallingPid success, callingPid " + callingPid);
                expect(callingPid != null).assertTrue();
J
jiyong 已提交
7402

Y
yang-qibo 已提交
7403 7404 7405
                let callingUid = rpc.IPCSkeleton.getCallingUid()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500: run getCallingPid success, callingPid " + callingUid);
                expect(callingUid != null).assertTrue();
J
jiyong 已提交
7406

Y
yang-qibo 已提交
7407 7408 7409 7410
                let callingDeviceID = rpc.IPCSkeleton.getCallingDeviceID()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500: run getCallingDeviceID success, callingDeviceID is "
                    + callingDeviceID);
                expect(callingDeviceID == "").assertTrue();
J
jiyong 已提交
7411

Y
yang-qibo 已提交
7412 7413 7414 7415 7416 7417 7418 7419 7420
                let localDeviceID = rpc.IPCSkeleton.getLocalDeviceID()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500: run getLocalDeviceID success, localDeviceID is "
                    + localDeviceID);
                expect(localDeviceID == "").assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00500---------------------------");
        });
J
jiyong 已提交
7421

Y
yang-qibo 已提交
7422
        /*
Z
zhangpa2021 已提交
7423
     * @tc.number  SUB_Softbus_IPC_Compatibility_IRemoteObject_00600
J
jiyong 已提交
7424 7425 7426 7427
     * @tc.name    Querylocalinterface searches for objects based on descriptors
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7428 7429 7430 7431 7432
        it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00600---------------------------");
            try{
                let object = new TestAbilityStub("Test1");
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run TestAbilityStub success");
J
jiyong 已提交
7433

Y
yang-qibo 已提交
7434 7435 7436
                let result = object.isObjectDead()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run isObjectDeadis is " + result);
                expect(result == false).assertTrue()
J
jiyong 已提交
7437

Y
yang-qibo 已提交
7438 7439
                let callingPid = object.getCallingPid()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run getCallingPid success,callingPid " + callingPid);
J
jiyong 已提交
7440

Y
yang-qibo 已提交
7441 7442
                let callingUid = object.getCallingUid()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run getCallingPid success,callingPid " + callingUid);
J
jiyong 已提交
7443

Y
yang-qibo 已提交
7444 7445
                object.attachLocalInterface(object, "Test1")
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run attachLocalInterface success");
J
jiyong 已提交
7446

Y
yang-qibo 已提交
7447 7448 7449 7450 7451 7452 7453
                let res = object.queryLocalInterface("Test1")
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run queryLocalInterface success, res2 is " + res);
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00600---------------------------");
        });
J
jiyong 已提交
7454

Y
yang-qibo 已提交
7455
        /*
Z
zhangpa2021 已提交
7456
     * @tc.number  SUB_Softbus_IPC_Compatibility_IRemoteObject_00700
J
jiyong 已提交
7457 7458 7459 7460
     * @tc.name    Getinterfacedescriptor to get the interface description
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7461 7462 7463 7464
        it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00700---------------------------");
            try{
                let object = new TestAbilityStub("Test1223");
J
jiyong 已提交
7465

Y
yang-qibo 已提交
7466 7467 7468
                let result = object.isObjectDead()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700: run isObjectDeadis is " + result);
                expect(result == false).assertTrue()
J
jiyong 已提交
7469

Y
yang-qibo 已提交
7470 7471
                let callingPid = object.getCallingPid()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700: run getCallingPid success,callingPid " + callingPid);
J
jiyong 已提交
7472

Y
yang-qibo 已提交
7473 7474
                let callingUid = object.getCallingUid()
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700: run getCallingPid success,callingPid " + callingUid);
J
jiyong 已提交
7475

Y
yang-qibo 已提交
7476 7477
                object.attachLocalInterface(object, "test1")
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700: run attachLocalInterface success");
J
jiyong 已提交
7478

Y
yang-qibo 已提交
7479 7480 7481 7482
                let result2 = object.getInterfaceDescriptor();
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700: run getInterfaceDescriptoris2 is "
                    + result2);
                expect(result2 != null).assertTrue();
J
jiyong 已提交
7483

Y
yang-qibo 已提交
7484 7485 7486 7487 7488
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00700---------------------------");
        });
J
jiyong 已提交
7489

Y
yang-qibo 已提交
7490
        /*
Z
zhangpa2021 已提交
7491
     * @tc.number  SUB_Softbus_IPC_Compatibility_IRemoteObject_00800
Z
zhangpa2021 已提交
7492 7493 7494 7495 7496
     * @tc.name    Test that messageparcel passes through the same process, and the client
     *             receives the reply message in the callback function
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578
        it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00800", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00800---------------------------");
            try{
                let object = new TestAbilityStub("TestAbilityStub")
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00800: create object successfully.");
                var reply = rpc.MessageParcel.create();
                var option = new rpc.MessageOption();
                expect(data.writeInterfaceToken("TestAbilityStub")).assertTrue()
                expect(data.writeByte(2)).assertTrue()
                expect(data.writeShort(3)).assertTrue()
                expect(data.writeInt(4)).assertTrue()
                expect(data.writeLong(5)).assertTrue()
                expect(data.writeFloat(1.2)).assertTrue()
                expect(data.writeDouble(10.2)).assertTrue()
                expect(data.writeBoolean(true)).assertTrue()
                expect(data.writeChar(5)).assertTrue()
                expect(data.writeString("HelloWorld")).assertTrue()
                expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()

                function sendRequestCallback(result) {
                    try{
                        console.info("sendRequest Callback")
                        console.info("sendRequest done, error code: " + result.errCode)
                        expect(result.errCode).assertEqual(0)
                        result.reply.readException()
                        expect(result.reply.readByte()).assertEqual(2)
                        expect(result.reply.readShort()).assertEqual(3)
                        expect(result.reply.readInt()).assertEqual(4)
                        expect(result.reply.readLong()).assertEqual(5)
                        expect(result.reply.readFloat()).assertEqual(1.2)
                        expect(result.reply.readDouble()).assertEqual(10.2)
                        expect(result.reply.readBoolean()).assertTrue()
                        expect(result.reply.readChar()).assertEqual(5)
                        expect(result.reply.readString()).assertEqual("HelloWorld")
                        let s = new MySequenceable(null, null)
                        expect(result.reply.readSequenceable(s)).assertTrue()
                        expect(s.num).assertEqual(1)
                        expect(s.str).assertEqual("aaa")
                    } finally {
                        result.data.reclaim();
                        result.reply.reclaim();
                        console.info("test done")
                        done()
                    }
                }

                console.info("start send request")
                object.sendRequest(CODE_SAME_PROCESS, data, reply, option, sendRequestCallback)

            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00800:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00800---------------------------");
        });

        /*
     * @tc.number  SUB_Softbus_IPC_Compatibility_IRemoteObject_00900
     * @tc.name    IRemoteObject sendMessageRequest API Test
     * @tc.desc    Function test
     * @tc.level   0
     */
        it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00900---------------------------");
            try{
                var data = rpc.MessageSequence.create();
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900: create object successfully.");
                var reply = rpc.MessageSequence.create();
                var option = new rpc.MessageOption();
                data.writeByte(1)
                data.writeShort(2)
                data.writeInt(3)
                data.writeLong(10000)
                data.writeFloat(1.2)
                data.writeDouble(10.2)
                data.writeBoolean(true)
                data.writeChar(96)
                data.writeString("HelloWorld")
                data.writeSequenceable(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)
Z
zhangpa2021 已提交
7579
                    expect(result.errCode).assertEqual(0)
Y
yang-qibo 已提交
7580 7581 7582 7583
                    expect(result.reply.readByte()).assertEqual(1)
                    expect(result.reply.readShort()).assertEqual(2)
                    expect(result.reply.readInt()).assertEqual(3)
                    expect(result.reply.readLong()).assertEqual(10000)
Z
zhangpa2021 已提交
7584 7585 7586
                    expect(result.reply.readFloat()).assertEqual(1.2)
                    expect(result.reply.readDouble()).assertEqual(10.2)
                    expect(result.reply.readBoolean()).assertTrue()
Y
yang-qibo 已提交
7587
                    expect(result.reply.readChar()).assertEqual(96)
Z
zhangpa2021 已提交
7588
                    expect(result.reply.readString()).assertEqual("HelloWorld")
Y
yang-qibo 已提交
7589
                    let s = new MySequenceable(0, '')
Z
zhangpa2021 已提交
7590 7591 7592
                    expect(result.reply.readSequenceable(s)).assertTrue()
                    expect(s.num).assertEqual(1)
                    expect(s.str).assertEqual("aaa")
Y
yang-qibo 已提交
7593 7594 7595
                });
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900:error = " + error);
Z
zhangpa2021 已提交
7596
            }
Y
yang-qibo 已提交
7597 7598 7599 7600 7601
            data.reclaim();
            reply.reclaim();
            done();
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00900---------------------------");
        });
Z
zhangpa2021 已提交
7602 7603


Y
yang-qibo 已提交
7604
        /*
Z
zhangpa2021 已提交
7605
     * @tc.number  SUB_Softbus_IPC_Compatibility_RemoteProxy_00100
J
jiyong 已提交
7606 7607 7608 7609
     * @tc.name    Call adddeathrecipient to register the death notification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7610 7611 7612 7613 7614 7615 7616 7617 7618 7619
        it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00100", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00100---------------------------");
            try{
                let recipient = new MyDeathRecipient(gIRemoteObject, null)
                var resultAdd1 = gIRemoteObject.addDeathRecipient(recipient, 0)
                expect(resultAdd1 == true).assertTrue();
                var resultAdd2 = gIRemoteObject.addDeathRecipient(recipient, 0)
                expect(resultAdd2 == true).assertTrue();
                var resultRemove1 = gIRemoteObject.removeDeathRecipient(recipient, 0)
                expect(resultRemove1 == true).assertTrue();
J
jiyong 已提交
7620

Y
yang-qibo 已提交
7621 7622
                var resultRemove2 = gIRemoteObject.removeDeathRecipient(recipient, 0)
                expect(resultRemove2 == true).assertTrue();
J
jiyong 已提交
7623

Y
yang-qibo 已提交
7624 7625 7626 7627 7628 7629 7630
                var resultRemove3 = gIRemoteObject.removeDeathRecipient(recipient, 0)
                expect(resultRemove3 == false).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00100:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00100---------------------------");
        });
Y
yang-qibo 已提交
7631

Y
yang-qibo 已提交
7632
        /*
Z
zhangpa2021 已提交
7633
     * @tc.number  SUB_Softbus_IPC_Compatibility_RemoteProxy_00200
Y
yang-qibo 已提交
7634 7635 7636 7637
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650
        it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00200", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00200---------------------------");
            try{
                let recipient = new MyDeathRecipient(gIRemoteObject, null);
                var resultAdd = gIRemoteObject.addDeathRecipient(recipient, -(2*G));
                expect(resultAdd).assertTrue();
                var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, -(2*G));
                expect(resultRemove).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00200:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00200---------------------------");
        });
Y
yang-qibo 已提交
7651

Y
yang-qibo 已提交
7652
        /*
Z
zhangpa2021 已提交
7653
     * @tc.number  SUB_Softbus_IPC_Compatibility_RemoteProxy_00300
Y
yang-qibo 已提交
7654 7655 7656 7657
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670
        it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00300", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00300---------------------------");
            try{
                let recipient = new MyDeathRecipient(gIRemoteObject, null);
                var resultAdd = gIRemoteObject.addDeathRecipient(recipient, (2*G - 1));
                expect(resultAdd).assertTrue();
                var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, (2*G - 1));
                expect(resultRemove).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00300:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00300---------------------------");
        });
Y
yang-qibo 已提交
7671

Y
yang-qibo 已提交
7672
        /*
Z
zhangpa2021 已提交
7673
     * @tc.number  SUB_Softbus_IPC_Compatibility_RemoteProxy_00400
Y
yang-qibo 已提交
7674 7675 7676 7677
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692
        it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00400", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00400---------------------------");
            try{
                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();
                var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, 2*G);
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00400:run removeDeathRecipient1 is " + resultRemove);
                expect(resultRemove).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00400:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00400---------------------------");
        });
Y
yang-qibo 已提交
7693

Y
yang-qibo 已提交
7694
        /*
Z
zhangpa2021 已提交
7695
     * @tc.number  sendfile/trans_file_func_test.cppRemoteProxy_00500
Y
yang-qibo 已提交
7696 7697 7698 7699
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714
        it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00500", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00500---------------------------");
            try{
                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();
                var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, -(2*G + 1));
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00500:run removeDeathRecipient1 is " + resultRemove);
                expect(resultRemove).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00500:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00500---------------------------");
        });
J
jiyong 已提交
7715

Y
yang-qibo 已提交
7716
        /*
Z
zhangpa2021 已提交
7717
     * @tc.number  SUB_Softbus_IPC_Compatibility_RemoteProxy_00600
J
jiyong 已提交
7718 7719 7720 7721
     * @tc.name    Call isobjectdead to check whether the object is dead
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7722 7723 7724 7725 7726 7727 7728
        it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00600---------------------------");
            try{
                let recipient = new MyDeathRecipient(gIRemoteObject, null)
                var isDead = gIRemoteObject.isObjectDead();
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600: run isObjectDead result is " + isDead);
                expect(isDead == false).assertTrue();
Y
yang-qibo 已提交
7729

Y
yang-qibo 已提交
7730 7731 7732
                var resultAdd1 = gIRemoteObject.addDeathRecipient(recipient, 0)
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run addDeathRecipient first result is " + resultAdd1);
                expect(resultAdd1 == true).assertTrue();
J
jiyong 已提交
7733

Y
yang-qibo 已提交
7734 7735 7736
                var isDead1 = gIRemoteObject.isObjectDead();
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600: run isObjectDead result is " + isDead1);
                expect(isDead1 == false).assertTrue();
J
jiyong 已提交
7737

Y
yang-qibo 已提交
7738 7739 7740
                var resultRemove1 = gIRemoteObject.removeDeathRecipient(recipient, 0)
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run removeDeathRecipient result is " + resultRemove1);
                expect(resultRemove1 == true).assertTrue();
Y
yang-qibo 已提交
7741

Y
yang-qibo 已提交
7742 7743 7744
                var resultAdd2 = gIRemoteObject.addDeathRecipient(recipient, 0)
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run addDeathRecipient second result is " + resultAdd2);
                expect(resultAdd2 == true).assertTrue();
J
jiyong 已提交
7745

Y
yang-qibo 已提交
7746 7747 7748
                var resultRemove2 = gIRemoteObject.removeDeathRecipient(recipient, 0)
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run removeDeathRecipient1 result is " + resultRemove2);
                expect(resultRemove2 == true).assertTrue();
Y
yang-qibo 已提交
7749

Y
yang-qibo 已提交
7750 7751 7752
                var resultRemove3 = gIRemoteObject.removeDeathRecipient(recipient, 0)
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run removeDeathRecipient3 result is " + resultRemove3);
                expect(resultRemove3 == false).assertTrue();
J
jiyong 已提交
7753

Y
yang-qibo 已提交
7754 7755 7756 7757 7758 7759 7760 7761
                var isDead2 = gIRemoteObject.isObjectDead();
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600: run isObjectDead2 result is " + isDead2);
                expect(isDead2 == false).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00600---------------------------");
        });
J
jiyong 已提交
7762

Y
yang-qibo 已提交
7763
        /*
Z
zhangpa2021 已提交
7764
     * @tc.number  SUB_Softbus_IPC_Compatibility_RemoteProxy_00700
J
jiyong 已提交
7765 7766 7767 7768
     * @tc.name    Getinterfacedescriptor to get the object interface description
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7769 7770 7771 7772
        it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00700", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00700---------------------------");
            try{
                let object = new TestAbilityStub("Test0300");
J
jiyong 已提交
7773

Y
yang-qibo 已提交
7774 7775 7776 7777 7778 7779 7780 7781
                let result = object.getInterfaceDescriptor()
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00700: run getInterfaceDescriptor result is " + result);
                expect(result).assertEqual("Test0300");
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00700:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00700---------------------------");
        });
J
jiyong 已提交
7782

Y
yang-qibo 已提交
7783
        /*
Z
zhangpa2021 已提交
7784
     * @tc.number  SUB_Softbus_IPC_Compatibility_RemoteProxy_00800
J
jiyong 已提交
7785 7786 7787 7788
     * @tc.name    Querylocalinterface searches for objects based on descriptors
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809
        it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00800---------------------------");
            try{
                let object = new TestAbilityStub("Test0400");

                let result = object.isObjectDead();
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800: run getInterfaceDescriptor is " + result);
                expect(result).assertEqual(false);
                object.attachLocalInterface(object, "Test2");
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800: run attachLocalInterface success");
                let res2 = object.queryLocalInterface('Test2');
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800: run queryLocalInterface success, res2 is " + res2);
                let resultDescrip = object.getInterfaceDescriptor()
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800: run getInterfaceDescriptor success resultDescrip is "
                    + resultDescrip);
                expect(resultDescrip != null).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00800---------------------------");
        });
J
jiyong 已提交
7810

Y
yang-qibo 已提交
7811
        /*
Z
zhangpa2021 已提交
7812
     * @tc.number  SUB_Softbus_IPC_Compatibility_RemoteProxy_00900
J
jiyong 已提交
7813 7814 7815 7816
     * @tc.name    Transaction constant validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829
        it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00900", 0, async function(){
            console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00900 is starting-------------")
            try {
                expect(rpc.RemoteProxy.PING_TRANSACTION).assertEqual(1599098439);
                expect(rpc.RemoteProxy.DUMP_TRANSACTION).assertEqual(1598311760);
                expect(rpc.RemoteProxy.INTERFACE_TRANSACTION).assertEqual(1598968902);
                expect(rpc.RemoteProxy.MIN_TRANSACTION_ID).assertEqual(0x1);
                expect(rpc.RemoteProxy.MAX_TRANSACTION_ID).assertEqual(0x00FFFFFF);
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00900 error is" + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00900---------------------------");
        })
Y
yang-qibo 已提交
7830

Y
yang-qibo 已提交
7831
        /*
Z
zhangpa2021 已提交
7832
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100
Y
yang-qibo 已提交
7833 7834 7835 7836
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100", 0, async function() {
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100---------------------------");
            try {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100")
                let remoteObject = new TestRemoteObject("aaa");
                let ret = rpc.IPCSkeleton.flushCommands(remoteObject);
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100 RpcServer: flushCommands result: " + ret);
                expect(ret != null).assertTrue();
            }
            catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100 error is :" + error)
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100---------------------------");
        })
J
jiyong 已提交
7851

Y
yang-qibo 已提交
7852
        /*
Z
zhangpa2021 已提交
7853
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200
J
jiyong 已提交
7854 7855 7856 7857
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200", 0, async function() {
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200---------------------------");
            try {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200 testcase")
                let remoteObject = {};
                let ret = rpc.IPCSkeleton.flushCommands(remoteObject);
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200 RpcServer: flushCommands result: " + ret);
                expect(ret != null).assertTrue();
            }
            catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200 error is :" + error)
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200---------------------------");
        })
Y
yang-qibo 已提交
7872

Y
yang-qibo 已提交
7873
        /*
Z
zhangpa2021 已提交
7874
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300
Y
yang-qibo 已提交
7875 7876 7877 7878
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300", 0, async function() {
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300---------------------------");
            try {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300 testcase")
                let samgr = rpc.IPCSkeleton.getContextObject();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300 getContextObject result: " + samgr);
                expect(samgr != null).assertTrue();
                let geinde = samgr.getInterfaceDescriptor();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300 getInterfaceDescriptor result: " + geinde);
                expect(geinde).assertEqual("");
            }
            catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300 error is :" + error)
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300---------------------------");
        })
Y
yang-qibo 已提交
7895

Y
yang-qibo 已提交
7896
        /*
Z
zhangpa2021 已提交
7897
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400
Y
yang-qibo 已提交
7898 7899 7900 7901
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400", 0, async function() {
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400---------------------------");
            try {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400 testcase")
                let getCallingPid = rpc.IPCSkeleton.getCallingPid();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400 getCallingPid result: " + getCallingPid);
                expect(getCallingPid != null).assertTrue();
                let getCallingUid = rpc.IPCSkeleton.getCallingUid();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400 getCallingUid result: " + getCallingUid);
                expect(getCallingUid != null).assertTrue();
            }
            catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400 error is :" + error)
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400---------------------------");
        })
Y
yang-qibo 已提交
7918

Y
yang-qibo 已提交
7919
        /*
Z
zhangpa2021 已提交
7920
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500
Y
yang-qibo 已提交
7921 7922 7923 7924
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500", 0, async function() {
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500---------------------------");
            try {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500 testcase")
                let getCallingPid = rpc.IPCSkeleton.getLocalDeviceID();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500 getCallingPid result: " + getCallingPid);
                expect(getCallingPid != null).assertTrue();
                let getCallingUid = rpc.IPCSkeleton.getCallingDeviceID();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500 getCallingUid result: " + getCallingUid);
                expect(getCallingUid != null).assertTrue();
            }
            catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500 error is :" + error)
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500---------------------------");
        })
J
jiyong 已提交
7941

Y
yang-qibo 已提交
7942
        /*
Z
zhangpa2021 已提交
7943
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600
J
jiyong 已提交
7944 7945 7946 7947 7948
     * @tc.name    Do not get the server agent, do not create a remoteobject instance, and directly getcallingpid,
     *             getcallingpid, getcallingdeviceid, getlocaldeviceid
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7949 7950 7951 7952 7953 7954
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600", 0, async function() {
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600---------------------------");
            try{
                let getCallingPid = rpc.IPCSkeleton.getCallingPid();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: run  getCallingPid result is :" + getCallingPid);
                expect(getCallingPid != null).assertTrue();
Z
zhangpa2021 已提交
7955

Y
yang-qibo 已提交
7956 7957 7958
                let getCallingUid = rpc.IPCSkeleton.getCallingUid();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: run getCallingUid result is :" + getCallingUid);
                expect(getCallingUid != null).assertTrue();
Z
zhangpa2021 已提交
7959

Y
yang-qibo 已提交
7960 7961 7962
                let getCallingToKenId = rpc.IPCSkeleton.getCallingTokenId();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: run getCallingToKenId result is :" + getCallingToKenId);
                expect(getCallingToKenId != null).assertTrue();
Z
zhangpa2021 已提交
7963

Y
yang-qibo 已提交
7964 7965 7966
                let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: run getLocalDeviceID result is :" + getLocalDeviceID);
                expect(getLocalDeviceID != null).assertTrue();
Z
zhangpa2021 已提交
7967

Y
yang-qibo 已提交
7968 7969 7970 7971 7972 7973 7974 7975
                let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: run getCallingDeviceID result is :" + getCallingDeviceID);
                expect(getCallingDeviceID != null).assertTrue();
            } catch (error){
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600---------------------------");
        })
J
jiyong 已提交
7976

Y
yang-qibo 已提交
7977
        /*
Z
zhangpa2021 已提交
7978
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700
Y
yang-qibo 已提交
7979 7980 7981 7982
     * @tc.name    Basic method of testing ipcskeleton
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700---------------------------");
            try{
                expect(rpc.IPCSkeleton.getContextObject().getInterfaceDescriptor()).assertEqual("");
                let callingPid = rpc.IPCSkeleton.getCallingPid();
                let callingUid = rpc.IPCSkeleton.getCallingUid();
                let option = new rpc.MessageOption();
                let data = rpc.MessageParcel.create();
                let reply = rpc.MessageParcel.create();
                expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700: callingPid: " + callingPid
                    + ", callingUid: " + callingUid);
                expect(callingUid != null).assertTrue();
                expect(callingPid != null).assertTrue();
                await gIRemoteObject.sendRequest(CODE_IPCSKELETON, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700: sendRequest done, error code: " + result.errCode)
                    expect(result.errCode).assertEqual(0);
                    result.reply.readException();
                    let rescallingPid = result.reply.readInt();
                    let rescallingUid = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700:" + rescallingPid +" ;"+ rescallingUid);
                    expect(rescallingPid).assertEqual(callingPid);
                    expect(rescallingUid).assertEqual(callingUid);
                })
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700---------------------------");
        });
Y
yang-qibo 已提交
8015

Y
yang-qibo 已提交
8016
        /*
Z
zhangpa2021 已提交
8017
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800
Y
yang-qibo 已提交
8018 8019 8020 8021
     * @tc.name    Basic method of testing ipcskeleton
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800---------------------------");
            try{
                let callingPid = rpc.IPCSkeleton.getCallingPid();
                let callingUid = rpc.IPCSkeleton.getCallingUid();
                let option = new rpc.MessageOption();
                let data = rpc.MessageParcel.create();
                let reply = rpc.MessageParcel.create();
                expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800: callingPid: " + callingPid
                    + ", callingUid: " + callingUid);
                await gIRemoteObject.sendRequest(CODE_IPCSKELETON_INT, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800: sendRequest done, error code: " + result.errCode)
                    expect(result.errCode).assertEqual(0);
                    result.reply.readException();
                    let rescallingPid = result.reply.readInt();
                    let rescallingUid = result.reply.readInt();
                    let restcallingPid = result.reply.readInt();
                    let restcallingUid = result.reply.readInt();
                    let resicallingPid = result.reply.readInt();
                    let resicallingUid = result.reply.readInt();
                    let resflushCommands = result.reply.readInt();

                    console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800:" + resicallingUid +" ;"+ resflushCommands);
                    expect(rescallingPid).assertEqual(callingPid);
                    expect(rescallingUid).assertEqual(callingUid);
                    expect(restcallingPid).assertEqual(callingPid);
                    expect(restcallingUid).assertEqual(callingUid);
                    expect(resicallingPid).assertEqual(callingPid);
                    expect(resicallingUid).assertEqual(callingUid);
                    expect(resflushCommands).assertEqual(101);
                })
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800---------------------------");
        });
Y
yang-qibo 已提交
8062

Y
yang-qibo 已提交
8063
        /*
Z
zhangpa2021 已提交
8064
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900
Y
yang-qibo 已提交
8065 8066 8067 8068
     * @tc.name    SetCallingIdentity Interface flags input parameter boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900---------------------------");
            try{
                let id = "";
                let ret = rpc.IPCSkeleton.setCallingIdentity(id);
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900: setCallingIdentity is: " + ret);
                expect(ret).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900---------------------------");
        });
Y
yang-qibo 已提交
8081

Y
yang-qibo 已提交
8082
        /*
Z
zhangpa2021 已提交
8083
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000
Y
yang-qibo 已提交
8084 8085 8086 8087
     * @tc.name    SetCallingIdentity Interface flags input parameter boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000---------------------------");
            try{
                let id = 0;
                let ret = rpc.IPCSkeleton.setCallingIdentity(id);
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000: setCallingIdentity is: " + ret);
                expect(ret).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000---------------------------");
        });
Y
yang-qibo 已提交
8100

Y
yang-qibo 已提交
8101
        /*
Z
zhangpa2021 已提交
8102
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100
Y
yang-qibo 已提交
8103 8104 8105 8106
     * @tc.name    SetCallingIdentity Interface flags input parameter boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
8107 8108 8109 8110 8111 8112 8113 8114
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100", 0,async function(){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100---------------------------");
            try{
                let id = "";
                for (let i = 0; i < (40*K - 1); i++){
                    id += "a";
                }
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100: id length is: " + id.length);
Y
yang-qibo 已提交
8115

Y
yang-qibo 已提交
8116 8117 8118 8119 8120 8121 8122 8123
                let ret = rpc.IPCSkeleton.setCallingIdentity(id);
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100: setCallingIdentity is: " + ret);
                expect(ret).assertTrue();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100---------------------------");
        });
8124

Y
yang-qibo 已提交
8125
        /*
Z
zhangpa2021 已提交
8126
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200
J
jiyong 已提交
8127 8128 8129 8130
     * @tc.name    Basic method of testing ipcskeleton
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200---------------------------");
            try{
                let object = rpc.IPCSkeleton.getContextObject();
                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();
                let id = rpc.IPCSkeleton.resetCallingIdentity();
                let ret = rpc.IPCSkeleton.setCallingIdentity(id);
                expect(object.getInterfaceDescriptor()).assertEqual("");
                expect(callingDeviceID).assertEqual("");
                expect(localDeviceID).assertEqual("");
                expect(isLocalCalling).assertTrue();
                expect(id).assertEqual("");
                expect(ret).assertTrue();
                expect(rpc.IPCSkeleton.flushCommands(gIRemoteObject)).assertEqual(0);
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200: callingPid: " + callingPid
                    + ", callingUid: " + callingUid
                    + ", callingDeviceID: " + callingDeviceID + ", localDeviceID: " + localDeviceID
                    + ", isLocalCalling: " + isLocalCalling);
                let option = new rpc.MessageOption();
                let data = rpc.MessageParcel.create();
                let reply = rpc.MessageParcel.create();
                expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue();
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200: start send request");
                await gIRemoteObject.sendRequest(CODE_IPCSKELETON, data, reply, option).then(function(result) {
                    console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200: sendRequest done, error code: " + result.errCode)
                    expect(result.errCode).assertEqual(0);
                    result.reply.readException();
                    expect(result.reply.readInt()).assertEqual(callingPid);
                    expect(result.reply.readInt()).assertEqual(callingUid);
                    expect(result.reply.readString()).assertEqual("");
                    expect(result.reply.readString()).assertEqual("");
                    expect(result.reply.readBoolean()).assertTrue();
                    expect(result.reply.readInt()).assertEqual(callingPid);
                    expect(result.reply.readInt()).assertEqual(callingUid);
                    expect(result.reply.readInt()).assertEqual(callingPid);
                    expect(result.reply.readInt()).assertEqual(callingUid);
                    expect(result.reply.readInt()).assertEqual(101);
J
jiyong 已提交
8172
                })
Y
yang-qibo 已提交
8173 8174 8175 8176 8177 8178 8179 8180
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200---------------------------");
        });
J
jiyong 已提交
8181

Y
yang-qibo 已提交
8182
        /*
Z
zhangpa2021 已提交
8183
     * @tc.number  SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300
Y
yang-qibo 已提交
8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219
     * @tc.name    IPCSkeleton sendMessageRequest API test
     * @tc.desc    Function test
     * @tc.level   0
     */
        it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300", 0,async function(done){
            console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300---------------------------");
            try{
                expect(rpc.IPCSkeleton.getContextObject().getInterfaceDescriptor()).assertEqual("");
                let callingPid = rpc.IPCSkeleton.getCallingPid();
                let callingUid = rpc.IPCSkeleton.getCallingUid();
                let option = new rpc.MessageOption();
                let data = rpc.MessageSequence.create();
                let reply = rpc.MessageSequence.create();
                data.writeInterfaceToken("rpcTestAbility")
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300 callingPid: " + callingPid
                    + ", callingUid: " + callingUid);
                expect(callingUid != null).assertTrue();
                expect(callingPid != null).assertTrue();
                await gIRemoteObject.sendMessageRequest(CODE_IPCSKELETON, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300 sendRequest done, error code: " + result.errCode)
                    expect(result.errCode).assertEqual(0);
                    result.reply.readException();
                    let rescallingPid = result.reply.readInt();
                    let rescallingUid = result.reply.readInt();
                    console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300" + rescallingPid +" ;"+ rescallingUid);
                    expect(rescallingPid).assertEqual(callingPid);
                    expect(rescallingUid).assertEqual(callingUid);
                })
                data.reclaim();
                reply.reclaim();
                done();
            } catch (error) {
                console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300:error = " + error);
            }
            console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300---------------------------");
        });
8220

Y
yang-qibo 已提交
8221 8222
        console.info("-----------------------SUB_Softbus_IPC_Compatibility_MessageParce_Test is end-----------------------");
    });
Z
zhangpa2021 已提交
8223
}