RpcClientJsunit.test.js 380.8 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 22 23

var gIRemoteObject = undefined;

Y
yang-qibo 已提交
24
describe('ActsRpcClientJsTest', function(){
Z
zhangpa2021 已提交
25
    console.info("-----------------------SUB_Softbus_IPC_MessageParce_Test is starting-----------------------");
J
jiyong 已提交
26

Z
zhangpa2021 已提交
27 28 29 30 31 32 33 34 35 36 37 38
    beforeEach(async function (){
        console.info('beforeEach called');
    });

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

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

Y
yang-qibo 已提交
39 40 41
    const K = 1024;
    const M = 1024*1024;
    const G = 1024*1024*1024;
J
jiyong 已提交
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
    const CODE_WRITE_BYTEARRAY = 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;
Y
yang-qibo 已提交
62
    const CODE_IPCSKELETON_INT = 22;
J
jiyong 已提交
63
    const CODE_WRITESEQUENCEABLE = 23
J
jiyong 已提交
64 65 66 67 68 69
    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;
Z
zhangpa2021 已提交
70 71
    const CODE_WRITE_REMOTEOBJECTARRAY_1 = 30;
    const CODE_WRITE_REMOTEOBJECTARRAY_2 = 31;
J
jiyong 已提交
72 73 74 75 76 77 78 79

    function connectAbility() {
        let want = {
            "bundleName":"ohos.rpc.test.server",
            "abilityName": "ohos.rpc.test.server.ServiceAbility",
        };
        let connect = {
            onConnect:function (elementName, remoteProxy) {
Z
zhangpa2021 已提交
80
                console.info('RpcClient: onConnect called, instance of proxy: '
J
jiyong 已提交
81
                             + (remoteProxy instanceof rpc.RemoteProxy))
J
jiyong 已提交
82 83 84 85
                gIRemoteObject = remoteProxy

            },
            onDisconnect:function (elementName) {
Z
zhangpa2021 已提交
86
                console.info("RpcClient: onDisconnect")
J
jiyong 已提交
87 88
            },
            onFailed:function () {
Z
zhangpa2021 已提交
89
                console.info("RpcClient: onFailed")
J
jiyong 已提交
90 91 92 93 94
                gIRemoteObject = null
            }
        };
        FA.connectAbility(want, connect)
        return new Promise((resolve, reject) =>{
Z
zhangpa2021 已提交
95
            console.info("start connect local ability, wait 5 seconds")
J
jiyong 已提交
96
            setTimeout(()=>{
Z
zhangpa2021 已提交
97
                console.info("resolve proxy: " + gIRemoteObject)
J
jiyong 已提交
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
                resolve(gIRemoteObject)
            }, 5000)
        })
    }

    function sleep(numberMillis)
    {
        var now = new Date();
        var exitTime = now.getTime() + numberMillis;
        while (true) {
            now = new Date();
            if (now.getTime() > exitTime)
            return;
        }
    }

    class TestRemoteObject extends rpc.RemoteObject {
        constructor(descriptor) {
            super(descriptor);
        }
Y
yang-qibo 已提交
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
        asObject(){
            return this;
        }
    }

    class TestProxy {
        remote = rpc.RemoteObject;
        constructor(remote) {
            this.remote = remote;
            console.info("test remote")
        }
        asObject() {
            console.info("server remote")
            return this.remote;
        }
J
jiyong 已提交
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
    }

    class MyDeathRecipient {
        constructor(gIRemoteObject, done) {
            this.gIRemoteObject = gIRemoteObject
            this.done = done
        }

        onRemoteDied() {
            console.info("server died")
            expect(this.proxy.removeDeathRecipient(this, 0)).assertTrue()
            let _done = this.done
            setTimeout(function() {
                _done()
            }, 1000)
        }
    }

    class TestAbilityStub extends rpc.RemoteObject {
        constructor(descriptor) {
            super(descriptor)
        }
Z
zhangpa2021 已提交
155 156 157 158 159 160 161 162 163 164 165 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 199 200 201 202 203 204 205 206 207 208 209 210

        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)
                return false
            }
            switch (code) {
                case 1:
                {
                    let tmp1 = data.readByte()
                    let tmp2 = data.readByte()
                    let tmp3 = data.readShort()
                    let tmp4 = data.readShort()
                    let tmp5 = data.readInt()
                    let tmp6 = data.readInt()
                    let tmp7 = data.readLong()
                    let tmp8 = data.readLong()
                    let tmp9 = data.readFloat()
                    let tmp10 = data.readFloat()
                    let tmp11 = data.readDouble()
                    let tmp12 = data.readDouble()
                    let tmp13 = data.readBoolean()
                    let tmp14 = data.readBoolean()
                    let tmp15 = data.readChar()
                    let tmp16 = data.readString()
                    let s = new MySequenceable(null, null)
                    data.readSequenceable(s)
                    reply.writeNoException()
                    reply.writeByte(tmp1)
                    reply.writeByte(tmp2)
                    reply.writeShort(tmp3)
                    reply.writeShort(tmp4)
                    reply.writeInt(tmp5)
                    reply.writeInt(tmp6)
                    reply.writeLong(tmp7)
                    reply.writeLong(tmp8)
                    reply.writeFloat(tmp9)
                    reply.writeFloat(tmp10)
                    reply.writeDouble(tmp11)
                    reply.writeDouble(tmp12)
                    reply.writeBoolean(tmp13)
                    reply.writeBoolean(tmp14)
                    reply.writeChar(tmp15)
                    reply.writeString(tmp16)
                    reply.writeSequenceable(s)
                    return true
                }
                default:
                {
                    console.error("default case, code: " + code)
                    return false
                }
            }
        }
J
jiyong 已提交
211 212
    }

Z
zhangpa2021 已提交
213

J
jiyong 已提交
214 215 216 217 218 219 220 221
    class TestListener extends rpc.RemoteObject {
        constructor(descriptor, checkResult) {
            super(descriptor);
            this.checkResult = checkResult
        }
        onRemoteRequest(code, data, reply, option) {
            let result = false
            if (code  == 1) {
Z
zhangpa2021 已提交
222
                console.info("onRemoteRequest called, descriptor: " + this.getInterfaceDescriptor())
J
jiyong 已提交
223 224
                result = true
            } else {
Z
zhangpa2021 已提交
225
                console.info("unknown code: " + code)
J
jiyong 已提交
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
            }
            let _checkResult = this.checkResult
            let _num = data.readInt()
            let _str = data.readString()
            setTimeout(function(){
                _checkResult(_num, _str)
            }, 2*1000);
            return result
        }
    }

    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;
        }
    }

    class Stub extends rpc.RemoteObject {
        onRemoteRequest(code, data, reply, option) {
            let callerPid = rpc.IPCSkeleton.getCallingPid();
Z
zhangpa2021 已提交
257
            console.info("RpcServer: getCallingPid result: " + callerPid);
J
jiyong 已提交
258
            let callerUid = rpc.IPCSkeleton.getCallingUid();
Z
zhangpa2021 已提交
259
            console.info("RpcServer: getCallingUid result: " + callerUid);
J
jiyong 已提交
260
            let callerDeviceID  = rpc.IPCSkeleton.getCallingDeviceID();
Z
zhangpa2021 已提交
261
            console.info("RpcServer: getCallingUid result: " + callerDeviceID );
J
jiyong 已提交
262
            let localDeviceID = rpc.IPCSkeleton.getLocalDeviceID();
Z
zhangpa2021 已提交
263
            console.info("RpcServer: localDeviceID is: " + localDeviceID);
J
jiyong 已提交
264 265 266 267
            return true;
        }
    }

J
jiyong 已提交
268 269 270 271 272 273 274
    function assertArrayElementEqual(actual, expected) {
        expect(actual.length).assertEqual(expected.length)
        for (let i = 0; i < actual.length; i++) {
            expect(actual[i]).assertEqual(expected[i])
        }
    }

J
jiyong 已提交
275 276 277
    beforeAll(async function (done) {
        console.info('beforeAll called')
        await connectAbility().then((remote) => {
Z
zhangpa2021 已提交
278
            console.info("got remote proxy: " + remote)
J
jiyong 已提交
279
        }).catch((err) => {
Z
zhangpa2021 已提交
280
            console.info("got exception: " + err)
J
jiyong 已提交
281 282
        })
        done()
Z
zhangpa2021 已提交
283
        console.info("beforeAll done")
J
jiyong 已提交
284 285
    })

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

Y
yang-qibo 已提交
298 299 300 301
            var token = "hello ruan zong xian";
            var result = data.writeInterfaceToken(token);
            console.info("SUB_Softbus_IPC_MessageParcel_00100:run writeInterfaceToken result is " + result);
            expect(result).assertTrue();
Z
zhangpa2021 已提交
302

Y
yang-qibo 已提交
303 304 305
            var resultToken = data.readInterfaceToken();
            console.info("SUB_Softbus_IPC_MessageParcel_00100:run readInterfaceToken result is " + resultToken);
            expect(resultToken).assertEqual(token);
Z
zhangpa2021 已提交
306

Y
yang-qibo 已提交
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_00100:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00100---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_00200
     * @tc.name    Call the writeinterfacetoken interface, write the interface descriptor, and read interfacetoken
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_00200", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00200---------------------------");
        try{
            for (let i = 0; i<5; i++){
                var data = rpc.MessageParcel.create();
                console.info("SUB_Softbus_IPC_MessageParcel_00200: create object successfully.");

                var token = "hello ruan zong xian";
                var result = data.writeInterfaceToken(token);
                console.info("SUB_Softbus_IPC_MessageParcel_00200:run writeInterfaceToken result is " + result);
                expect(result).assertTrue();

                var resultToken = data.readInterfaceToken();
                console.info("SUB_Softbus_IPC_MessageParcel_00200:run readInterfaceToken result is " + resultToken);
                expect(resultToken).assertEqual(token);

                data.reclaim();
            }
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_00200:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00200---------------------------");
Z
zhangpa2021 已提交
342 343 344
    });

    /*
Y
yang-qibo 已提交
345
     * @tc.number  SUB_Softbus_IPC_MessageParcel_00300
Z
zhangpa2021 已提交
346
     * @tc.name    Call the writeinterfacetoken interface to write a non string interface descriptor
Y
yang-qibo 已提交
347
                   and read interfacetoken
Z
zhangpa2021 已提交
348 349 350
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
    it("SUB_Softbus_IPC_MessageParcel_00300", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00300---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_00300: create object successfully.");

            var token = "";
            for(let i = 0; i < (40*K -1); i++){
                token += 'a';
            };
            var result = data.writeInterfaceToken(token);
            console.info("SUB_Softbus_IPC_MessageParcel_00300:run writeInterfaceToken is" + result);
            expect(result).assertTrue();

            var resultToken = data.readInterfaceToken();
            console.info("SUB_Softbus_IPC_MessageParcel_00300:run readInterfaceToken is " + resultToken.length);
            expect(resultToken).assertEqual(token);
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_00300: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00300---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_00400
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_00400", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00400---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_00400: create object successfully.");

            var token = "";
            for(let i = 0; i < 40*K; i++){
                token += 'a';
            };
            var result = data.writeInterfaceToken(token);
            console.info("SUB_Softbus_IPC_MessageParcel_00400:run writeInterfaceToken is " + result);
            expect(result).assertEqual(false);
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_00400: error = " + error);
            expect(error != null).assertTrue();
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00400---------------------------");
    });
Z
zhangpa2021 已提交
402

Y
yang-qibo 已提交
403 404 405 406 407 408 409 410 411 412 413 414
    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_00500
     * @tc.name    Call the writeinterfacetoken interface to write a non string interface descriptor
                   and read interfacetoken
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_00500", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00500---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_00500: create object successfully.");
Z
zhangpa2021 已提交
415

Y
yang-qibo 已提交
416 417 418 419 420 421 422 423 424 425
            var token = 123;
            var result = data.writeInterfaceToken(token);
            console.info("SUB_Softbus_IPC_MessageParcel_00500:run writeInterfaceToken is " + result);
            expect(result).assertEqual(false);
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_00500: error = " + error);
            expect(error != null).assertTrue();
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00500---------------------------");
Z
zhangpa2021 已提交
426 427 428
    });

    /*
Y
yang-qibo 已提交
429
     * @tc.number  SUB_Softbus_IPC_MessageParcel_00600
Z
zhangpa2021 已提交
430 431 432 433
     * @tc.name    The data size of the messageparcel obtained by calling the getSize interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
434 435 436 437 438
    it("SUB_Softbus_IPC_MessageParcel_00600", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00600---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_00600: create object successfully.");
Z
zhangpa2021 已提交
439

Y
yang-qibo 已提交
440 441 442
            var size = data.getSize();
            console.info("SUB_Softbus_IPC_MessageParcel_00600:run getSize is " + size);
            expect(size).assertEqual(0);
Z
zhangpa2021 已提交
443

Y
yang-qibo 已提交
444 445 446 447
            var addData = 1;
            var result = data.writeInt(addData);
            console.info("SUB_Softbus_IPC_MessageParcel_00600:run writeInt is " + result);
            expect(result).assertTrue();
Z
zhangpa2021 已提交
448

Y
yang-qibo 已提交
449 450 451
            size = data.getSize();
            console.info("SUB_Softbus_IPC_MessageParcel_00600:run getSize is " + size);
            expect(size).assertEqual(4);
Z
zhangpa2021 已提交
452

Y
yang-qibo 已提交
453 454 455 456 457
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_00600: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00600---------------------------");
Z
zhangpa2021 已提交
458 459 460
    });

    /*
Y
yang-qibo 已提交
461
     * @tc.number  SUB_Softbus_IPC_MessageParcel_00700
Z
zhangpa2021 已提交
462 463 464 465
     * @tc.name    The capacity of the messageparcel obtained by calling the getcapacity interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
466 467 468 469 470
    it("SUB_Softbus_IPC_MessageParcel_00700", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00700---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_00700: create object successfully.");
Z
zhangpa2021 已提交
471

Y
yang-qibo 已提交
472 473 474
            var size = data.getCapacity();
            console.info("SUB_Softbus_IPC_MessageParcel_00700:run getCapacity is " + size);
            expect(size).assertEqual(0);
Z
zhangpa2021 已提交
475

Y
yang-qibo 已提交
476 477 478 479
            var addData = 1;
            var result = data.writeInt(addData);
            console.info("SUB_Softbus_IPC_MessageParcel_00700:run writeInt is " + result);
            expect(result).assertTrue();
Z
zhangpa2021 已提交
480

Y
yang-qibo 已提交
481 482 483
            size = data.getCapacity();
            console.info("SUB_Softbus_IPC_MessageParcel_00700:run getCapacity is " + size);
            expect(size).assertEqual(64);
Z
zhangpa2021 已提交
484

Y
yang-qibo 已提交
485 486 487 488 489
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_00700: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00700---------------------------");
Z
zhangpa2021 已提交
490 491 492
    });

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

Y
yang-qibo 已提交
504 505 506 507
            var addData = 1;
            var result = data.writeInt(addData);
            console.info("SUB_Softbus_IPC_MessageParcel_00800:run writeInt is " + result);
            expect(result).assertTrue();
Z
zhangpa2021 已提交
508

Y
yang-qibo 已提交
509 510 511 512
            var size = 6;
            var setResult = data.setSize(size);
            console.info("SUB_Softbus_IPC_MessageParcel_00800:run setSize " + setResult);
            expect(setResult).assertTrue();
Z
zhangpa2021 已提交
513

Y
yang-qibo 已提交
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_00800: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00800---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_00900
     * @tc.name    Call the SetSize interface to set the data size of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_00900", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00900---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_00900: create object successfully.");

            var addData = 1;
            var result = data.writeInt(addData);
            console.info("SUB_Softbus_IPC_MessageParcel_00900:run writeInt is " + result);
            expect(result).assertTrue();

            var size = 4*G;
            var setResult = data.setSize(size);
            console.info("SUB_Softbus_IPC_MessageParcel_00900:run setSize " + setResult);
            expect(setResult).assertTrue();

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

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_01000
     * @tc.name    Call the SetSize interface to set the data size of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_01000", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01000---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_01000: create object successfully.");

            var addData = 1;
            var result = data.writeInt(addData);
            console.info("SUB_Softbus_IPC_MessageParcel_01000:run writeInt is " + result);
            expect(result).assertTrue();

            var size = 4*G - 4;
            var setResult = data.setSize(size);
            console.info("SUB_Softbus_IPC_MessageParcel_01000:run setSize " + setResult);
            expect(setResult).assertEqual(false);
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_01000: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01000---------------------------");
Z
zhangpa2021 已提交
576 577 578
    });

    /*
Y
yang-qibo 已提交
579
     * @tc.number  SUB_Softbus_IPC_MessageParcel_01100
Z
zhangpa2021 已提交
580
     * @tc.name    Call the SetSize interface to set the data size of messageparcel. The write data size
Y
yang-qibo 已提交
581
                   does not match the set value
Z
zhangpa2021 已提交
582 583 584
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
585 586 587 588 589
    it("SUB_Softbus_IPC_MessageParcel_01100", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01100---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_01100: create object successfully.");
Z
zhangpa2021 已提交
590

Y
yang-qibo 已提交
591 592 593 594
            var capacity = 64;
            var setResult = data.setCapacity(capacity);
            console.info("SUB_Softbus_IPC_MessageParcel_01100:run setCapacity " + setResult);
            expect(setResult).assertTrue();
Z
zhangpa2021 已提交
595

Y
yang-qibo 已提交
596 597 598 599
            var size = 4;
            setResult = data.setSize(size);
            console.info("SUB_Softbus_IPC_MessageParcel_01100:run setSize " + setResult);
            expect(setResult).assertTrue();
Z
zhangpa2021 已提交
600

Y
yang-qibo 已提交
601 602 603 604
            var addData = 2;
            var result = data.writeLong(addData);
            console.info("SUB_Softbus_IPC_MessageParcel_01100:run writeInt is " + result);
            expect(result).assertTrue();
Z
zhangpa2021 已提交
605

Y
yang-qibo 已提交
606 607 608 609 610
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_01100: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01100---------------------------");
Z
zhangpa2021 已提交
611 612 613
    });

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

Y
yang-qibo 已提交
625 626 627 628
            var size = 64;
            var setResult = data.setCapacity(size);
            console.info("SUB_Softbus_IPC_MessageParcel_01200:run setSize " + setResult);
            expect(setResult).assertTrue();
Z
zhangpa2021 已提交
629

Y
yang-qibo 已提交
630 631 632 633
            var addData = 1;
            var result = data.writeInt(addData);
            console.info("SUB_Softbus_IPC_MessageParcel_01200:run writeInt is " + result);
            expect(result).assertTrue();
Z
zhangpa2021 已提交
634

Y
yang-qibo 已提交
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_01200: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01200---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_01300
     * @tc.name    Call the setcapacity interface to set the capacity of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_01300", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01300---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_01300: create object successfully.");

            var size = 4*G - 4;
            var setResult = data.setCapacity(size);
            console.info("SUB_Softbus_IPC_MessageParcel_01300:run setSize " + setResult);
            expect(setResult).assertTrue();

            var addData = 1;
            var result = data.writeInt(addData);
            console.info("SUB_Softbus_IPC_MessageParcel_01300:run writeInt is " + result);
            expect(result).assertTrue();

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

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_01400
     * @tc.name    Call the setcapacity interface to set the capacity of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_01400", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01400---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_01400: create object successfully.");

            var size = 4*G;
            var setResult = data.setCapacity(size);
            console.info("SUB_Softbus_IPC_MessageParcel_01400:run setSize " + setResult);
            expect(setResult).assertEqual(false);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_01400: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01400---------------------------");
Z
zhangpa2021 已提交
693 694 695
    });

    /*
Y
yang-qibo 已提交
696 697
     * @tc.number  SUB_Softbus_IPC_MessageParcel_01500
     * @tc.name    Call the setcapacity interface to set the capacity of messageparcel.
Z
zhangpa2021 已提交
698 699 700 701
     *             The write data capacity is inconsistent with the set value
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
702 703 704 705 706
    it("SUB_Softbus_IPC_MessageParcel_01500", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01500---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_01500: create object successfully.");
Z
zhangpa2021 已提交
707

Y
yang-qibo 已提交
708 709 710 711
            var size = 4;
            var setResult = data.setCapacity(size);
            console.info("SUB_Softbus_IPC_MessageParcel_01500:run setSize " + setResult);
            expect(setResult).assertTrue();
Z
zhangpa2021 已提交
712

Y
yang-qibo 已提交
713 714 715 716
            var addData = [1, 2, 3, 4, 5, 6, 7, 8];
            var result = data.writeIntArray(addData);
            console.info("SUB_Softbus_IPC_MessageParcel_01500:run writeInt is " + result);
            expect(result).assertEqual(false);
Z
zhangpa2021 已提交
717

Y
yang-qibo 已提交
718 719 720 721 722 723
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_01500: error = " + error);
            expect(error != null).assertTrue();
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01500---------------------------");
Z
zhangpa2021 已提交
724 725 726
    });

    /*
Y
yang-qibo 已提交
727 728
     * @tc.number  SUB_Softbus_IPC_MessageParcel_01600
     * @tc.name    Empty object to obtain the readable byte space, read location,
Z
zhangpa2021 已提交
729 730 731 732
     *             writable byte space and write location information of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
733 734 735 736 737
    it("SUB_Softbus_IPC_MessageParcel_01600", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01600---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_01600: create object successfully.");
Z
zhangpa2021 已提交
738

Y
yang-qibo 已提交
739 740 741 742 743 744
            var result1 = data.getWritableBytes();
            console.info("SUB_Softbus_IPC_MessageParcel_01600: run getWritableBytes is " + result1);
            expect(result1).assertEqual(0);
            var result2 = data.getReadableBytes();
            console.info("SUB_Softbus_IPC_MessageParcel_01600: run getReadableBytes is " + result2);
            expect(result2).assertEqual(0);
Z
zhangpa2021 已提交
745

Y
yang-qibo 已提交
746 747 748
            var result3 = data.getReadPosition();
            console.info("SUB_Softbus_IPC_MessageParcel_01600: run getReadPosition is " + result2);
            expect(result3).assertEqual(0);
Z
zhangpa2021 已提交
749

Y
yang-qibo 已提交
750 751 752
            var result4 = data.getWritePosition();
            console.info("SUB_Softbus_IPC_MessageParcel_01600: run getWritePosition is " + result2);
            expect(result4).assertEqual(0);
Z
zhangpa2021 已提交
753

Y
yang-qibo 已提交
754 755 756 757 758
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_01600: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01600---------------------------");
Z
zhangpa2021 已提交
759 760 761
    });

    /*
Y
yang-qibo 已提交
762 763
     * @tc.number  SUB_Softbus_IPC_MessageParcel_01700
     * @tc.name    Create an object and write data to obtain the readable byte space, read location,
Z
zhangpa2021 已提交
764 765 766 767
     *             writable byte space and write location information of messageparcel
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
768 769 770 771 772
    it("SUB_Softbus_IPC_MessageParcel_01700", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01700---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_01700: create object successfully.");
Z
zhangpa2021 已提交
773

Y
yang-qibo 已提交
774 775 776
            var dataInt = 1;
            var resultInt = data.writeInt(dataInt);
            console.info("SUB_Softbus_IPC_MessageParcel_01700: run writeInt is " + resultInt);
Z
zhangpa2021 已提交
777

Y
yang-qibo 已提交
778 779 780
            var dataLong = 2;
            var resultLong = data.writeLong(dataLong);
            console.info("SUB_Softbus_IPC_MessageParcel_01700: run writeLong is " + resultLong);
Z
zhangpa2021 已提交
781

Y
yang-qibo 已提交
782 783 784
            var result1 = data.getWritableBytes();
            console.info("SUB_Softbus_IPC_MessageParcel_01700: run getWritableBytes is " + result1);
            expect(result1).assertEqual(52);
Z
zhangpa2021 已提交
785

Y
yang-qibo 已提交
786 787 788
            var result2 = data.getReadableBytes();
            console.info("SUB_Softbus_IPC_MessageParcel_01700: run getReadableBytes is " + result2);
            expect(result2).assertEqual(12);
Z
zhangpa2021 已提交
789

Y
yang-qibo 已提交
790 791 792
            var result3 = data.getReadPosition();
            console.info("SUB_Softbus_IPC_MessageParcel_01700: run getReadPosition is " + result3);
            expect(result3).assertEqual(0);
Z
zhangpa2021 已提交
793

Y
yang-qibo 已提交
794 795 796
            var result4 = data.getWritePosition();
            console.info("SUB_Softbus_IPC_MessageParcel_01700: run getWritePosition is " + result4);
            expect(result4).assertEqual(12);
Z
zhangpa2021 已提交
797

Y
yang-qibo 已提交
798 799 800 801 802
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_01700: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01700---------------------------");
Z
zhangpa2021 已提交
803 804 805
    });

    /*
Y
yang-qibo 已提交
806
     * @tc.number  SUB_Softbus_IPC_MessageParcel_01800
Z
zhangpa2021 已提交
807 808 809 810
     * @tc.name    Call rewindread interface to offset the read position to the specified position
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
    it("SUB_Softbus_IPC_MessageParcel_01800", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_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_MessageParcel_01800: run writeInt is " + resultInt);
            var dataLong = 2;
            var resultLong = data.writeLong(dataLong);
            console.info("SUB_Softbus_IPC_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_MessageParcel_01800: run readInt is " + readIntData);
            expect(readIntData).assertEqual(dataInt);

            var writePosition = 0;
            var writeResult = data.rewindWrite(writePosition);
            console.info("SUB_Softbus_IPC_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_MessageParcel_01800: run writeInt is " + resultInt);

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

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

    /*
Y
yang-qibo 已提交
862
     * @tc.number  SUB_Softbus_IPC_MessageParcel_01900
Z
zhangpa2021 已提交
863
     * @tc.name    The rewindread interface is called to re offset the read position to the specified position.
Y
yang-qibo 已提交
864
                   The specified position is out of range
Z
zhangpa2021 已提交
865 866 867
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912
    it("SUB_Softbus_IPC_MessageParcel_01900", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01900---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_01900: create object successfully.");

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

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

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

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

Y
yang-qibo 已提交
914 915 916 917 918
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_01900: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01900---------------------------");
Z
zhangpa2021 已提交
919 920 921
    });

    /*
Y
yang-qibo 已提交
922
     * @tc.number  SUB_Softbus_IPC_MessageParcel_02000
Z
zhangpa2021 已提交
923 924 925 926
     * @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 已提交
927 928 929 930 931
    it("SUB_Softbus_IPC_MessageParcel_02000", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02000---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_02000: create object successfully.");
Z
zhangpa2021 已提交
932

Y
yang-qibo 已提交
933 934 935 936
            var dataInt = 1;
            var resultInt = data.writeInt(dataInt);
            console.info("SUB_Softbus_IPC_MessageParcel_02000: run writeInt is " + resultInt);
            expect(resultInt).assertTrue();
Z
zhangpa2021 已提交
937

Y
yang-qibo 已提交
938 939 940
            var readIntData = data.readInt();
            console.info("SUB_Softbus_IPC_MessageParcel_02000: run readInt is " + readIntData);
            expect(readIntData).assertEqual(dataInt);
Z
zhangpa2021 已提交
941

Y
yang-qibo 已提交
942 943 944 945
            var writePosition = 0;
            var rewindWriteResult = data.rewindWrite(writePosition);
            console.info("SUB_Softbus_IPC_MessageParcel_02000: run rewindWrite is" + rewindWriteResult);
            expect(rewindWriteResult).assertTrue();
Z
zhangpa2021 已提交
946

Y
yang-qibo 已提交
947 948 949 950
            dataInt = 3;
            resultInt = data.writeInt(dataInt);
            console.info("SUB_Softbus_IPC_MessageParcel_02000: run writeInt is " + resultInt);
            expect(resultInt).assertTrue();
Z
zhangpa2021 已提交
951

Y
yang-qibo 已提交
952 953 954 955
            var readPosition = 0;
            var rewindReadResult = data.rewindRead(readPosition);
            console.info("SUB_Softbus_IPC_MessageParcel_02000: run rewindRead is " + rewindReadResult);
            expect(rewindReadResult);
Z
zhangpa2021 已提交
956

Y
yang-qibo 已提交
957 958 959
            readIntData = data.readInt();
            console.info("SUB_Softbus_IPC_MessageParcel_02000: run readInt is " + readIntData);
            expect(readIntData).assertEqual(dataInt);
Z
zhangpa2021 已提交
960

Y
yang-qibo 已提交
961 962 963 964 965
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_02000: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02000---------------------------");
Z
zhangpa2021 已提交
966 967 968
    });

    /*
Y
yang-qibo 已提交
969
     * @tc.number  SUB_Softbus_IPC_MessageParcel_02100
Z
zhangpa2021 已提交
970
     * @tc.name    Call rewindwrite and the interface offsets the write position to the specified position.
Y
yang-qibo 已提交
971
                   The specified position is out of range
Z
zhangpa2021 已提交
972 973 974
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
975 976 977 978 979
    it("SUB_Softbus_IPC_MessageParcel_02100", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02100---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_02100: create object successfully.");
Z
zhangpa2021 已提交
980

Y
yang-qibo 已提交
981 982 983 984
            var dataInt = 1;
            var resultInt = data.writeInt(dataInt);
            console.info("SUB_Softbus_IPC_MessageParcel_02100: run writeInt result is " + resultInt);
            expect(resultInt).assertTrue();
Z
zhangpa2021 已提交
985

Y
yang-qibo 已提交
986 987 988
            var readIntData = data.readInt();
            console.info("SUB_Softbus_IPC_MessageParcel_02100: run readInt is" + readIntData);
            expect(readIntData == dataInt).assertTrue();
Z
zhangpa2021 已提交
989

Y
yang-qibo 已提交
990 991 992 993
            var writePosition = 99;
            var rewindWriteResult = data.rewindWrite(writePosition);
            console.info("SUB_Softbus_IPC_MessageParcel_02100: run rewindWrite is " + rewindWriteResult);
            expect(rewindWriteResult).assertEqual(false);
Z
zhangpa2021 已提交
994

Y
yang-qibo 已提交
995 996 997 998 999
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_02100: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02100---------------------------");
Z
zhangpa2021 已提交
1000 1001 1002
    });

    /*
Y
yang-qibo 已提交
1003 1004
     * @tc.number  SUB_Softbus_IPC_MessageParcel_02200
     * @tc.name    Call the writeshortarray interface, write the array to the messageparcel instance,
Z
zhangpa2021 已提交
1005 1006 1007 1008
     *             and call readshortarray to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1009 1010 1011 1012 1013
    it("SUB_Softbus_IPC_MessageParcel_02200", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02200---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_02200: create object successfully.");
Z
zhangpa2021 已提交
1014

Y
yang-qibo 已提交
1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029
            var wShortArryData = [3, 5, 9];
            var writeShortArrayResult = data.writeShortArray(wShortArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_02200: run writeShortArray "
                + writeShortArrayResult);
            expect(writeShortArrayResult).assertTrue();

            var rShortArryData = data.readShortArray();
            console.info("SUB_Softbus_IPC_MessageParcel_02200: run readShortArray is " + rShortArryData);
            assertArrayElementEqual(rShortArryData,wShortArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_02200: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02200---------------------------");
Z
zhangpa2021 已提交
1030 1031 1032
    });

    /*
Y
yang-qibo 已提交
1033 1034
     * @tc.number  SUB_Softbus_IPC_MessageParcel_02300
     * @tc.name    Call the writeshortarray interface, write the short integer array to the messageparcel instance,
Z
zhangpa2021 已提交
1035 1036 1037 1038
     *             and call readshortarray (datain: number []) to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1039 1040 1041 1042 1043
    it("SUB_Softbus_IPC_MessageParcel_02300", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02300---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_02300: create object successfully.");
Z
zhangpa2021 已提交
1044

Y
yang-qibo 已提交
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062
            var wShortArryData = [];
            for(let i=0;i<(50*K - 1);i++){
                wShortArryData[i] = 1;
            }
            var writeShortArrayResult = data.writeShortArray(wShortArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_02300: run writeShortArray "
                + writeShortArrayResult);
            expect(writeShortArrayResult).assertTrue();

            var rShortArryData = [];
            data.readShortArray(rShortArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_02300: run readShortArray is " + rShortArryData.length);
            assertArrayElementEqual(rShortArryData,wShortArryData);
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_02300: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02300---------------------------");
Z
zhangpa2021 已提交
1063 1064 1065
    });

    /*
Y
yang-qibo 已提交
1066
     * @tc.number  SUB_Softbus_IPC_MessageParcel_02400
Z
zhangpa2021 已提交
1067 1068 1069 1070
     * @tc.name    Writeshortarray interface, boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1071 1072 1073 1074 1075
    it("SUB_Softbus_IPC_MessageParcel_02400", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02400---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_02400: create object successfully.");
Z
zhangpa2021 已提交
1076

Y
yang-qibo 已提交
1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091
            var wShortArryData = [-32768, 0, 1, 2, 32767];
            var writeShortArrayResult = data.writeShortArray(wShortArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_02400: run writeShortArray is " + writeShortArrayResult);
            expect(writeShortArrayResult).assertTrue();

            var rShortArryData = [];
            data.readShortArray(rShortArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_02400: run readShortArray is " + rShortArryData);
            assertArrayElementEqual(rShortArryData,wShortArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_02400: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02400---------------------------");
Z
zhangpa2021 已提交
1092 1093 1094
    });

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

            var wShortArryData = [-32769, 0, 1, 2];
            var writeShortArrayResult = data.writeShortArray(wShortArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_02500: run writeShortArray is " + writeShortArrayResult);
            expect(writeShortArrayResult).assertTrue();
            var rShotrArrayData = data.readShortArray();
            console.info("SUB_Softbus_IPC_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]);
Z
zhangpa2021 已提交
1116

Y
yang-qibo 已提交
1117 1118 1119 1120
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_02500: error = " + error);
        }
Z
zhangpa2021 已提交
1121

Y
yang-qibo 已提交
1122
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02500---------------------------");
Z
zhangpa2021 已提交
1123 1124 1125
    });

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

Y
yang-qibo 已提交
1137 1138 1139 1140
            var wShortArryData = [0, 1, 2, 32768];
            var writeShortArrayResult = data.writeShortArray(wShortArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_02600: run writeShortArray is " + writeShortArrayResult);
            expect(writeShortArrayResult).assertTrue();
Z
zhangpa2021 已提交
1141

Y
yang-qibo 已提交
1142 1143 1144 1145 1146 1147
            var rShotrArrayData = data.readShortArray();
            console.info("SUB_Softbus_IPC_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 已提交
1148

Y
yang-qibo 已提交
1149 1150 1151 1152 1153
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_02600: error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02600---------------------------");
Z
zhangpa2021 已提交
1154 1155 1156
    });

    /*
Y
yang-qibo 已提交
1157 1158
     * @tc.number  SUB_Softbus_IPC_MessageParcel_02700
     * @tc.name    Writeshortarray interface, illegal value validation
Z
zhangpa2021 已提交
1159 1160 1161
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1162 1163 1164 1165 1166
    it("SUB_Softbus_IPC_MessageParcel_02700", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02700---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_02700: create object successfully.");
Z
zhangpa2021 已提交
1167

Y
yang-qibo 已提交
1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181
            var wShortArryData = [];
            for (let i = 0; i < 50*K; i++){
                wShortArryData[i] = 11111;
            }
            var writeShortArrayResult = data.writeShortArray(wShortArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_02700: run writeShortArray " + writeShortArrayResult);
            expect(writeShortArrayResult).assertEqual(false);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_02700: error = " + error);
            expect(error != null).assertTrue();
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02700---------------------------");
Z
zhangpa2021 已提交
1182 1183 1184
    });

    /*
Y
yang-qibo 已提交
1185 1186 1187
     * @tc.number  SUB_Softbus_IPC_MessageParcel_02800
     * @tc.name    Call the writelongarray interface, write the long integer array to the messageparcel instance,
     *             and call readlongarray to read the data
Z
zhangpa2021 已提交
1188 1189 1190
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203
    it("SUB_Softbus_IPC_MessageParcel_02800", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02800---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_02800: create object successfully.");

            var LongArryData = [];
            for (let i = 0;i<(25*K - 1);i++){
                LongArryData[i] = 11;
            }
            var WriteLongArray = data.writeLongArray(LongArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03200: run writeShortArray  is " + WriteLongArray);
            expect(WriteLongArray).assertTrue();
Z
zhangpa2021 已提交
1204

Y
yang-qibo 已提交
1205 1206 1207
            var rLongArryData = data.readLongArray();
            console.info("SUB_Softbus_IPC_MessageParcel_03200: run readShortArray is " + rLongArryData.length);
            assertArrayElementEqual(LongArryData,rLongArryData);
Z
zhangpa2021 已提交
1208

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

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

Y
yang-qibo 已提交
1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241
            var wLongArryData = [-2147483648, 0, 1, 2, 2147483647];
            var writeLongArrayResult = data.writeLongArray(wLongArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_02900: run writeShortArrayis is " + writeLongArrayResult);
            expect(writeLongArrayResult).assertTrue();

            var rLongArryData = data.readLongArray();
            console.info("SUB_Softbus_IPC_MessageParcel_02900: run readShortArray is " + rLongArryData);
            assertArrayElementEqual(wLongArryData,rLongArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_02900: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02900---------------------------");
Z
zhangpa2021 已提交
1242 1243 1244
    });

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

Y
yang-qibo 已提交
1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269
            var errorLongArryData = [-2147483649, 0, 1, 2, 3];
            var erWriteLongArray = data.writeLongArray(errorLongArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03000: run writeShortArrayis is " + erWriteLongArray);
            expect(erWriteLongArray).assertTrue();

            var erLongArryData = data.readLongArray();
            console.info("SUB_Softbus_IPC_MessageParcel_03000: run readShortArray is " + erLongArryData);
            assertArrayElementEqual(errorLongArryData,erLongArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_03000: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03000---------------------------");
Z
zhangpa2021 已提交
1270 1271 1272
    });

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

Y
yang-qibo 已提交
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297
            var errorLongArryData = [0, 1, 2, 3, 2147483648];
            var erWriteLongArray = data.writeLongArray(errorLongArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03100: run writeShortArrayis is " + erWriteLongArray);
            expect(erWriteLongArray).assertTrue();

            var erLongArryData = data.readLongArray();
            console.info("SUB_Softbus_IPC_MessageParcel_03100: run readShortArray is " + erLongArryData);
            assertArrayElementEqual(errorLongArryData,erLongArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_03100: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03100---------------------------");
Z
zhangpa2021 已提交
1298 1299 1300
    });

    /*
Y
yang-qibo 已提交
1301 1302
     * @tc.number  SUB_Softbus_IPC_MessageParcel_03200
     * @tc.name    Writelongarray interface, illegal value validation
Z
zhangpa2021 已提交
1303 1304 1305
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1306 1307 1308 1309 1310
    it("SUB_Softbus_IPC_MessageParcel_03200", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03200---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_03200: create object successfully.");
Z
zhangpa2021 已提交
1311

Y
yang-qibo 已提交
1312 1313 1314 1315 1316 1317 1318
            var errorLongArryData = [];
            for (let i = 0;i<25*K;i++){
                errorLongArryData[i] = 11;
            }
            var erWriteLongArray = data.writeLongArray(errorLongArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03200: run writeShortArrayis is " + erWriteLongArray);
            expect(erWriteLongArray).assertEqual(false);
Z
zhangpa2021 已提交
1319

Y
yang-qibo 已提交
1320 1321 1322 1323 1324 1325
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_03200: error " + error);
            expect(error != null).assertTrue();
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03200---------------------------");
Z
zhangpa2021 已提交
1326 1327 1328
    });

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

Y
yang-qibo 已提交
1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354
            var wDoubleArryData = [1.2, 235.67, 99.76];
            var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03300: run writeShortArrayis is " + writeDoubleArrayResult);
            expect(writeDoubleArrayResult).assertTrue();

            var rDoubleArryData = data.readDoubleArray();
            console.info("SUB_Softbus_IPC_MessageParcel_03300: run readShortArray is " + rDoubleArryData);
            assertArrayElementEqual(wDoubleArryData,rDoubleArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_03300: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03300---------------------------");
Z
zhangpa2021 已提交
1355 1356 1357
    });

    /*
Y
yang-qibo 已提交
1358 1359 1360
     * @tc.number  SUB_Softbus_IPC_MessageParcel_03400
     * @tc.name    Call the writedoublearray interface, write the array to the messageparcel instance,
     *             and call readdoublearra (datain: number []) to read the data
Z
zhangpa2021 已提交
1361 1362 1363
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1364 1365 1366 1367 1368
    it("SUB_Softbus_IPC_MessageParcel_03400", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03400---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_03400: create object successfully.");
Z
zhangpa2021 已提交
1369

Y
yang-qibo 已提交
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388
            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_MessageParcel_03400: run writeShortArrayis is "
                + writeDoubleArrayResult);
            expect(writeDoubleArrayResult).assertTrue();

            var rDoubleArryData = [];
            data.readDoubleArray(rDoubleArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03400: run readShortArray is " + rDoubleArryData.length);
            assertArrayElementEqual(wDoubleArryData,rDoubleArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_03400: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03400---------------------------");
Z
zhangpa2021 已提交
1389 1390 1391
    });

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

Y
yang-qibo 已提交
1403 1404 1405 1406
            var wDoubleArryData = [-1235453.2, 235.67, 9987659.76];
            var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03500: run writeShortArrayis is " + writeDoubleArrayResult);
            expect(writeDoubleArrayResult).assertTrue();
Z
zhangpa2021 已提交
1407

Y
yang-qibo 已提交
1408 1409 1410 1411 1412 1413 1414 1415 1416
            var rDoubleArryData = data.readDoubleArray();
            console.info("SUB_Softbus_IPC_MessageParcel_03500: run readShortArray is " + rDoubleArryData);
            assertArrayElementEqual(wDoubleArryData,rDoubleArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_03500: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03500---------------------------");
Z
zhangpa2021 已提交
1417 1418 1419
    });

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

Y
yang-qibo 已提交
1431 1432 1433 1434 1435 1436 1437 1438 1439 1440
            var DoubleArryData = [-12354883737337373873853.2, 235.67, 99999999999999993737373773987659.76];
            var WriteDoubleArrayResult = data.writeDoubleArray(DoubleArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03600: run writeDoubleArrayis is " + WriteDoubleArrayResult);
            expect(WriteDoubleArrayResult).assertTrue();

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_03600: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03600---------------------------");
Z
zhangpa2021 已提交
1441 1442 1443
    });

    /*
Y
yang-qibo 已提交
1444 1445
     * @tc.number  SUB_Softbus_IPC_MessageParcel_03700
     * @tc.name    Writedoublearray interface, illegal value validation
Z
zhangpa2021 已提交
1446 1447 1448
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1449 1450 1451 1452 1453
    it("SUB_Softbus_IPC_MessageParcel_03700", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03700---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_03700: create object successfully.");
Z
zhangpa2021 已提交
1454

Y
yang-qibo 已提交
1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467
            var errorDoubleArryData = [];
            for (let i=0;i<25*K;i++){
                errorDoubleArryData[i] = 11.1;
            }
            var WriteDoubleArrayResult = data.writeDoubleArray(errorDoubleArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03700: run writeDoubleArrayis is " + WriteDoubleArrayResult);
            expect(WriteDoubleArrayResult).assertEqual(false);
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_03700: error " + error);
            expect(error != null).assertTrue();
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03700---------------------------");
Z
zhangpa2021 已提交
1468 1469 1470
    });

    /*
Y
yang-qibo 已提交
1471 1472 1473
     * @tc.number  SUB_Softbus_IPC_MessageParcel_03800
     * @tc.name    Call the writeboolean array interface, write the array to the messageparcel instance,
     *             and call readboolean array to read the data
Z
zhangpa2021 已提交
1474 1475 1476
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1477 1478 1479 1480 1481
    it("SUB_Softbus_IPC_MessageParcel_03800", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03800---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_03800: create object successfully.");
Z
zhangpa2021 已提交
1482

Y
yang-qibo 已提交
1483 1484 1485 1486
            var wBooleanArryData = [true, false, false];
            var writeBooleanArrayResult = data.writeBooleanArray(wBooleanArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03800: run writeShortArrayis is " + writeBooleanArrayResult);
            expect(writeBooleanArrayResult).assertTrue();
Z
zhangpa2021 已提交
1487

Y
yang-qibo 已提交
1488 1489 1490 1491 1492 1493 1494 1495 1496
            var rBooleanArryData = data.readBooleanArray();
            console.info("SUB_Softbus_IPC_MessageParcel_03800: run readShortArray is " + rBooleanArryData);
            assertArrayElementEqual(wBooleanArryData,rBooleanArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_03800: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03800---------------------------");
Z
zhangpa2021 已提交
1497 1498 1499
    });

    /*
Y
yang-qibo 已提交
1500 1501 1502
     * @tc.number  SUB_Softbus_IPC_MessageParcel_03900
     * @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 已提交
1503 1504 1505
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522
    it("SUB_Softbus_IPC_MessageParcel_03900", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03900---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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;
                }
            }
            var writeBooleanArrayResult = data.writeBooleanArray(wBooleanArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03900: run writeShortArrayis is " + writeBooleanArrayResult);
            expect(writeBooleanArrayResult).assertTrue();
Z
zhangpa2021 已提交
1523

Y
yang-qibo 已提交
1524 1525 1526 1527 1528 1529 1530 1531 1532 1533
            var rBooleanArryData = [];
            data.readBooleanArray(rBooleanArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_03900: run readShortArray is " + rBooleanArryData.length);
            assertArrayElementEqual(wBooleanArryData,rBooleanArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_03900: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03900---------------------------");
Z
zhangpa2021 已提交
1534 1535 1536
    });

    /*
Y
yang-qibo 已提交
1537 1538
     * @tc.number  SUB_Softbus_IPC_MessageParcel_04000
     * @tc.name    Writeboolean array interface, illegal value validation
Z
zhangpa2021 已提交
1539 1540 1541
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1542 1543 1544 1545 1546
    it("SUB_Softbus_IPC_MessageParcel_04000", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04000---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_04000: create object successfully.");
Z
zhangpa2021 已提交
1547

Y
yang-qibo 已提交
1548 1549 1550 1551 1552 1553 1554 1555
            var BooleanArryData = [true, 'abc', false];
            var WriteBooleanArrayResult = data.writeBooleanArray(BooleanArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_04000: run writeShortArrayis is " + WriteBooleanArrayResult);
            expect(WriteBooleanArrayResult).assertTrue();
            var rBooleanArryData = data.readBooleanArray();
            console.info("SUB_Softbus_IPC_MessageParcel_04000: run readShortArray is " + rBooleanArryData);
            var newboolean = [true,false,false];
            assertArrayElementEqual(newboolean,rBooleanArryData);
Z
zhangpa2021 已提交
1556

Y
yang-qibo 已提交
1557 1558 1559 1560 1561
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_04000: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04000---------------------------");
Z
zhangpa2021 已提交
1562 1563 1564
    });

    /*
Y
yang-qibo 已提交
1565 1566
     * @tc.number  SUB_Softbus_IPC_MessageParcel_04100
     * @tc.name    Writeboolean array interface, illegal value validation
Z
zhangpa2021 已提交
1567 1568 1569
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586
    it("SUB_Softbus_IPC_MessageParcel_04100", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04100---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_04100: run writeShortArrayis is " + WriteBooleanArrayResult);
            expect(WriteBooleanArrayResult).assertEqual(false);
Z
zhangpa2021 已提交
1587

Y
yang-qibo 已提交
1588 1589 1590 1591 1592 1593
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_04100: error " + error);
            expect(error != null).assertTrue();
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04100---------------------------");
Z
zhangpa2021 已提交
1594 1595
    });

J
jiyong 已提交
1596
    /*
Y
yang-qibo 已提交
1597 1598 1599
     * @tc.number  SUB_Softbus_IPC_MessageParcel_04200
     * @tc.name    Call the writechararray interface, write the array to the messageparcel instance,
     *             and call readchararray to read the data
J
jiyong 已提交
1600 1601 1602
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1603 1604
    it("SUB_Softbus_IPC_MessageParcel_04200", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04200---------------------------");
J
jiyong 已提交
1605 1606
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
1607
            console.info("SUB_Softbus_IPC_MessageParcel_04200: create object successfully.");
J
jiyong 已提交
1608

Y
yang-qibo 已提交
1609 1610 1611
            var wCharArryData = [];
            for(let i=0;i<(50*K - 1);i++){
                wCharArryData[i] = 96;
J
jiyong 已提交
1612
            }
Y
yang-qibo 已提交
1613 1614 1615 1616 1617 1618 1619
            var writeCharArrayResult = data.writeCharArray(wCharArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_04200: run writeShortArrayis is " + writeCharArrayResult);
            expect(writeCharArrayResult).assertTrue();

            var rCharArryData = data.readCharArray();
            console.info("SUB_Softbus_IPC_MessageParcel_04200: run readShortArray is " + rCharArryData.length);
            assertArrayElementEqual(wCharArryData,rCharArryData);
J
jiyong 已提交
1620 1621 1622

            data.reclaim();
        } catch (error) {
Y
yang-qibo 已提交
1623
            console.info("SUB_Softbus_IPC_MessageParcel_04200: error " + error);
J
jiyong 已提交
1624
        }
Y
yang-qibo 已提交
1625
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04200---------------------------");
J
jiyong 已提交
1626 1627 1628
    });

    /*
Y
yang-qibo 已提交
1629 1630 1631
     * @tc.number  SUB_Softbus_IPC_MessageParcel_04300
     * @tc.name    Call the writechararray interface, write the array to the messageparcel instance,
     *             and call readchararray (datain: number []) to read the data
J
jiyong 已提交
1632 1633 1634
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1635 1636
    it("SUB_Softbus_IPC_MessageParcel_04300", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04300---------------------------");
J
jiyong 已提交
1637 1638
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
1639
            console.info("SUB_Softbus_IPC_MessageParcel_04300: create object successfully.");
J
jiyong 已提交
1640

Y
yang-qibo 已提交
1641 1642 1643
            var wCharArryData = [];
            for(let i=0;i<(50*K - 1);i++){
                wCharArryData[i] = 96;
J
jiyong 已提交
1644
            }
Y
yang-qibo 已提交
1645 1646 1647
            var writeCharArrayResult = data.writeCharArray(wCharArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_04300: run writeShortArrayis is " + writeCharArrayResult);
            expect(writeCharArrayResult).assertTrue();
J
jiyong 已提交
1648

Y
yang-qibo 已提交
1649 1650 1651 1652 1653

            var rCharArryData = [];
            data.readCharArray(rCharArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_04300: run readShortArray is " + rCharArryData.length);
            assertArrayElementEqual(wCharArryData,rCharArryData);
J
jiyong 已提交
1654 1655 1656

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

    /*
Y
yang-qibo 已提交
1663 1664
     * @tc.number  SUB_Softbus_IPC_MessageParcel_04400
     * @tc.name    Writechararray interface, illegal value validation
J
jiyong 已提交
1665 1666 1667
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1668 1669
    it("SUB_Softbus_IPC_MessageParcel_04400", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04400---------------------------");
J
jiyong 已提交
1670 1671
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
1672
            console.info("SUB_Softbus_IPC_MessageParcel_04400: create object successfully.");
J
jiyong 已提交
1673

Y
yang-qibo 已提交
1674 1675 1676 1677
            var errorCharArryData = [10, 'asfgdgdtu', 20];
            var WriteCharArrayResult = data.writeCharArray(errorCharArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_04400: run writeShortArrayis is " + WriteCharArrayResult);
            expect(WriteCharArrayResult).assertTrue();
J
jiyong 已提交
1678

Y
yang-qibo 已提交
1679 1680 1681 1682
            var rCharArryData = data.readCharArray();
            console.info("SUB_Softbus_IPC_MessageParcel_04400: run readShortArray is " + rCharArryData);
            var xresult = [10,0,20];
            assertArrayElementEqual(xresult,rCharArryData);
J
jiyong 已提交
1683 1684 1685

            data.reclaim();
        } catch (error) {
Y
yang-qibo 已提交
1686
            console.info("SUB_Softbus_IPC_MessageParcel_04400: error " + error);
J
jiyong 已提交
1687
        }
Y
yang-qibo 已提交
1688
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04400---------------------------");
J
jiyong 已提交
1689 1690 1691
    });

    /*
Y
yang-qibo 已提交
1692 1693 1694
     * @tc.number  SUB_Softbus_IPC_MessageParcel_04500
     * @tc.name    Call the writestringarray interface, write the array to the messageparcel instance,
     *             and call readstringarray (datain: number []) to read the data
J
jiyong 已提交
1695 1696 1697
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
1698 1699
    it("SUB_Softbus_IPC_MessageParcel_04500", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04500---------------------------");
J
jiyong 已提交
1700 1701
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 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 1946 1947 1948 1949 1950 1951 1952 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
            console.info("SUB_Softbus_IPC_MessageParcel_04500: create object successfully.");

            var wStringArryData = ['abc', 'hello', 'beauty'];
            var writeStringArrayResult = data.writeStringArray(wStringArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_04500: run writeShortArrayis is " + writeStringArrayResult);
            expect(writeStringArrayResult).assertTrue();

            var rStringArryData = data.readStringArray();
            console.info("SUB_Softbus_IPC_MessageParcel_04500: run readShortArray is " + rStringArryData);
            assertArrayElementEqual(wStringArryData,rStringArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_04500: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04500---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_04600
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_04600", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04600---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_04600: create object successfully.");

            var wStringArryData = ['abc', 'hello', 'beauty'];
            var writeStringArrayResult = data.writeStringArray(wStringArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_04600: run writeShortArrayis is " + writeStringArrayResult);
            expect(writeStringArrayResult).assertTrue();


            var rStringArryData = [];
            data.readStringArray(rStringArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_04600: run readShortArray is " + rStringArryData);
            assertArrayElementEqual(wStringArryData,rStringArryData);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_04600: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04600---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_04700
     * @tc.name    Writestringarray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_04700", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04700---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_04700: create object successfully.");

            var errorStringArryData = ['abc', 123, 'beauty'];
            var WriteStringArrayResult = data.writeStringArray(errorStringArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_04700: run writeStringArrayis is " + WriteStringArrayResult);
            expect(WriteStringArrayResult).assertEqual(false);

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_04700: error " + error);
            expect(error != null).assertTrue();
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04700---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_04800
     * @tc.name    Writestringarray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_04800", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04800---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_04800: create object successfully.");

            var errorStringArryData = [];
            for (let i=0;i<(10*K - 1);i++){
                errorStringArryData[i] = "heddSDF";
            }
            var WriteStringArrayResult = data.writeStringArray(errorStringArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_04800: run writeStringArrayis is " + WriteStringArrayResult);
            expect(WriteStringArrayResult).assertTrue();

            var errorStringArray = data.readStringArray();
            console.info("SUB_Softbus_IPC_MessageParcel_04800: run writeStringArrayis is " + errorStringArray.length);
            assertArrayElementEqual(errorStringArray,errorStringArryData);
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_04800: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04800---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_04900
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_04900", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04900---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_04900: run writeShortArrayis is " + writeShortArrayResult);
            expect(writeShortArrayResult == true).assertTrue();

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

                var shortArryDataReply = result.reply.readByteArray();
                console.info("SUB_Softbus_IPC_MessageParcel_04900: run readByteArray is " + shortArryDataReply);
                assertArrayElementEqual(ByteArrayVar,shortArryDataReply);
            });
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_04900: error " +error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04900---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_05000
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_05000", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05000---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_05000: 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_MessageParcel_05000: run writeShortArrayis is " + writeShortArrayResult);
            expect(writeShortArrayResult == true).assertTrue();

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

                var newArr = new Array(5);
                result.reply.readByteArray(newArr);
                console.info("SUB_Softbus_IPC_MessageParcel_05000: run readByteArray is " + newArr);
                assertArrayElementEqual(ByteArrayVar,newArr);
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_05000: error " +error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05000---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_05100
     * @tc.name    Writebytearray interface, boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_05100", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05100---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_05100: create object successfully.");
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

            var teArrayVar = [-128, 0, 1, 2, 127];
            var writeShortArrayResult = data.writeByteArray(teArrayVar);
            console.info("SUB_Softbus_IPC_MessageParcel_05100: run writeShortArrayis is " + writeShortArrayResult);
            expect(writeShortArrayResult == true).assertTrue();

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

                var newArr = new Array(5)
                result.reply.readByteArray(newArr);
                console.info("SUB_Softbus_IPC_MessageParcel_05100: run readByteArray is " + newArr);
                assertArrayElementEqual(newArr,teArrayVar);
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_05100: error " +error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05100---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_05200
     * @tc.name    Writebytearray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_05200", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05200---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_05200: run writeShortArrayis is " + writeShortArrayResult);
            expect(writeShortArrayResult == true).assertTrue();

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

                var shortArryDataReply = result.reply.readByteArray();
                console.info("SUB_Softbus_IPC_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_MessageParcel_05200: error " +error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05200---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_05300
     * @tc.name    Writebytearray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_05300", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05300---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_05300: create object successfully.");
J
jiyong 已提交
1983 1984
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
1985
            var ByteArrayVar = [-129, 0, 1, 2, 127];
J
jiyong 已提交
1986
            var writeShortArrayResult = data.writeByteArray(ByteArrayVar);
Y
yang-qibo 已提交
1987
            console.info("SUB_Softbus_IPC_MessageParcel_05300: run writeShortArrayis is " + writeShortArrayResult);
J
jiyong 已提交
1988 1989 1990 1991
            expect(writeShortArrayResult == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
1992
                console.info("SUB_Softbus_IPC_MessageParcel_05300: gIRemoteObject undefined");
J
jiyong 已提交
1993
            }
Y
yang-qibo 已提交
1994 1995
            await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_05300: sendRequestis is " + result.errCode);
J
jiyong 已提交
1996 1997 1998
                expect(result.errCode == 0).assertTrue();

                var shortArryDataReply = result.reply.readByteArray();
Y
yang-qibo 已提交
1999
                console.info("SUB_Softbus_IPC_MessageParcel_05300: run readByteArray is " + shortArryDataReply);
J
jiyong 已提交
2000 2001 2002 2003 2004 2005
                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();
            });
J
jiyong 已提交
2006
            data.reclaim();
J
jiyong 已提交
2007 2008
            reply.reclaim();
            done();
J
jiyong 已提交
2009
        } catch (error) {
Y
yang-qibo 已提交
2010
            console.info("SUB_Softbus_IPC_MessageParcel_05300: error " +error);
J
jiyong 已提交
2011
        }
Y
yang-qibo 已提交
2012
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05300---------------------------");
J
jiyong 已提交
2013 2014 2015
    });

    /*
Y
yang-qibo 已提交
2016
     * @tc.number  SUB_Softbus_IPC_MessageParcel_05400
J
jiyong 已提交
2017 2018 2019 2020 2021
     * @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 已提交
2022 2023
    it("SUB_Softbus_IPC_MessageParcel_05400", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05400---------------------------");
J
jiyong 已提交
2024 2025
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2026
            console.info("SUB_Softbus_IPC_MessageParcel_05400: create object successfully.");
J
jiyong 已提交
2027 2028 2029 2030 2031
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

            var intArryData = [100, 111, 112];
            var writeShortArrayResult = data.writeIntArray(intArryData);
Y
yang-qibo 已提交
2032
            console.info("SUB_Softbus_IPC_MessageParcel_05400: run writeShortArrayis is " + writeShortArrayResult);
J
jiyong 已提交
2033 2034 2035 2036
            expect(writeShortArrayResult == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2037
                console.info("SUB_Softbus_IPC_MessageParcel_05400: gIRemoteObject undefined");
J
jiyong 已提交
2038 2039
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2040
                console.info("SUB_Softbus_IPC_MessageParcel_05400: sendRequestis is " + result.errCode);
J
jiyong 已提交
2041 2042
                expect(result.errCode == 0).assertTrue();

J
jiyong 已提交
2043
                var shortArryDataReply = result.reply.readIntArray();
Y
yang-qibo 已提交
2044 2045
                console.info("SUB_Softbus_IPC_MessageParcel_05400: run readByteArray is " + shortArryDataReply);
                assertArrayElementEqual(intArryData,shortArryDataReply);
J
jiyong 已提交
2046 2047 2048 2049 2050 2051
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
2052
            console.info("SUB_Softbus_IPC_MessageParcel_05400: error " + error);
J
jiyong 已提交
2053
        }
Y
yang-qibo 已提交
2054
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05400---------------------------");
J
jiyong 已提交
2055 2056 2057
    });

    /*
Y
yang-qibo 已提交
2058
     * @tc.number  SUB_Softbus_IPC_MessageParcel_05500
J
jiyong 已提交
2059 2060 2061 2062 2063
     * @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 已提交
2064 2065
    it("SUB_Softbus_IPC_MessageParcel_05500", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05500---------------------------");
J
jiyong 已提交
2066 2067
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2068
            console.info("SUB_Softbus_IPC_MessageParcel_05500: create object successfully.");
J
jiyong 已提交
2069 2070 2071 2072 2073
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

            var intArryData = [100, 111, 112];
            var writeShortArrayResult = data.writeIntArray(intArryData);
Y
yang-qibo 已提交
2074
            console.info("SUB_Softbus_IPC_MessageParcel_05500: run writeShortArrayis is " + writeShortArrayResult);
J
jiyong 已提交
2075 2076 2077 2078
            expect(writeShortArrayResult == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2079
                console.info("SUB_Softbus_IPC_MessageParcel_05500: gIRemoteObject undefined");
J
jiyong 已提交
2080 2081
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2082
                console.info("SUB_Softbus_IPC_MessageParcel_05500: sendRequestis is " + result.errCode);
J
jiyong 已提交
2083
                expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2084 2085 2086

                var newArr = []
                result.reply.readIntArray(newArr);
Y
yang-qibo 已提交
2087 2088
                console.info("SUB_Softbus_IPC_MessageParcel_05500: run readIntArray is success, intArryDataReply is " + newArr);
                assertArrayElementEqual(intArryData,newArr);
J
jiyong 已提交
2089 2090 2091 2092 2093 2094
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
2095
            console.info("SUB_Softbus_IPC_MessageParcel_05500: error " + error);
J
jiyong 已提交
2096
        }
Y
yang-qibo 已提交
2097
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05500---------------------------");
J
jiyong 已提交
2098 2099 2100
    });

    /*
Y
yang-qibo 已提交
2101
     * @tc.number  SUB_Softbus_IPC_MessageParcel_05600
J
jiyong 已提交
2102 2103 2104 2105
     * @tc.name    Writeintarray interface, boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2106 2107
    it("SUB_Softbus_IPC_MessageParcel_05600", 0, async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05600---------------------------");
J
jiyong 已提交
2108 2109
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2110
            console.info("SUB_Softbus_IPC_MessageParcel_05600: create object successfully.");
J
jiyong 已提交
2111 2112
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
2113 2114

            var intArryData = [-2147483648, 0, 1, 2, 2147483647];
J
jiyong 已提交
2115
            var writeIntArrayResult = data.writeIntArray(intArryData);
Y
yang-qibo 已提交
2116
            console.info("SUB_Softbus_IPC_MessageParcel_05600: run writeShortArrayis is " + writeIntArrayResult);
J
jiyong 已提交
2117
            expect(writeIntArrayResult == true).assertTrue();
J
jiyong 已提交
2118

J
jiyong 已提交
2119 2120
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2121
                console.info("SUB_Softbus_IPC_MessageParcel_05600: gIRemoteObject undefined");
J
jiyong 已提交
2122 2123
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2124
                console.info("SUB_Softbus_IPC_MessageParcel_05600: sendRequestis is " + result.errCode);
J
jiyong 已提交
2125 2126 2127
                expect(result.errCode == 0).assertTrue();

                var shortArryDataReply = result.reply.readIntArray();
Y
yang-qibo 已提交
2128 2129
                console.info("SUB_Softbus_IPC_MessageParcel_05600: run readByteArray is " + shortArryDataReply);
                assertArrayElementEqual(intArryData,shortArryDataReply);
J
jiyong 已提交
2130
            });
J
jiyong 已提交
2131 2132 2133

            data.reclaim();
        } catch (error) {
Y
yang-qibo 已提交
2134
            console.info("SUB_Softbus_IPC_MessageParcel_05600: error " + error);
J
jiyong 已提交
2135
        }
Y
yang-qibo 已提交
2136
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05600---------------------------");
J
jiyong 已提交
2137 2138 2139
    });

    /*
Y
yang-qibo 已提交
2140
     * @tc.number  SUB_Softbus_IPC_MessageParcel_05700
J
jiyong 已提交
2141 2142 2143 2144
     * @tc.name    Writeintarray interface, illegal value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2145 2146
    it("SUB_Softbus_IPC_MessageParcel_05700", 0, async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05700---------------------------");
J
jiyong 已提交
2147 2148
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2149
            console.info("SUB_Softbus_IPC_MessageParcel_05700: create object successfully.");
J
jiyong 已提交
2150 2151
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
2152 2153

            var intArryData = [-2147483649, 0, 1, 2, 2147483647];
J
jiyong 已提交
2154
            var writeIntArrayResult = data.writeIntArray(intArryData);
Y
yang-qibo 已提交
2155
            console.info("SUB_Softbus_IPC_MessageParcel_05700: run writeShortArrayis is " + writeIntArrayResult);
J
jiyong 已提交
2156
            expect(writeIntArrayResult == true).assertTrue();
J
jiyong 已提交
2157

J
jiyong 已提交
2158 2159
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2160
                console.info("SUB_Softbus_IPC_MessageParcel_05700: gIRemoteObject undefined");
J
jiyong 已提交
2161 2162
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2163
                console.info("SUB_Softbus_IPC_MessageParcel_05700: sendRequestis is " + result.errCode);
J
jiyong 已提交
2164 2165 2166
                expect(result.errCode == 0).assertTrue();

                var shortArryDataReply = result.reply.readIntArray();
Y
yang-qibo 已提交
2167
                console.info("SUB_Softbus_IPC_MessageParcel_05700: run readByteArray is " + shortArryDataReply);
J
jiyong 已提交
2168 2169 2170 2171 2172 2173
                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();
            });
J
jiyong 已提交
2174 2175 2176

            data.reclaim();
        } catch (error) {
Y
yang-qibo 已提交
2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217
            console.info("SUB_Softbus_IPC_MessageParcel_05700: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05700---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_05800
     * @tc.name    Writeintarray interface, illegal value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_05800", 0, async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05800---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_05800: create object successfully.");
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

            var intArryData = [0, 1, 2, 3, 2147483648];
            var writeIntArrayResult = data.writeIntArray(intArryData);
            console.info("SUB_Softbus_IPC_MessageParcel_05800: run writeShortArrayis is " + writeIntArrayResult);
            expect(writeIntArrayResult == true).assertTrue();

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

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

            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_05800: error " + error);
J
jiyong 已提交
2218
        }
Y
yang-qibo 已提交
2219
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05800---------------------------");
J
jiyong 已提交
2220 2221 2222
    });

    /*
Y
yang-qibo 已提交
2223
     * @tc.number  SUB_Softbus_IPC_MessageParcel_05900
J
jiyong 已提交
2224 2225 2226 2227 2228
     * @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 已提交
2229 2230
    it("SUB_Softbus_IPC_MessageParcel_05900", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05900---------------------------");
J
jiyong 已提交
2231 2232
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2233
            console.info("SUB_Softbus_IPC_MessageParcel_05900: create object successfully.");
J
jiyong 已提交
2234 2235 2236 2237 2238
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

            var floatArryData = [1.2, 1.3, 1.4];
            var writeShortArrayResult = data.writeFloatArray(floatArryData);
Y
yang-qibo 已提交
2239
            console.info("SUB_Softbus_IPC_MessageParcel_05900: run writeFloatArrayis is " + writeShortArrayResult);
J
jiyong 已提交
2240 2241 2242 2243 2244
            expect(writeShortArrayResult == true).assertTrue();


            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2245
                console.info("SUB_Softbus_IPC_MessageParcel_05900: gIRemoteObject undefined");
J
jiyong 已提交
2246 2247
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2248
                console.info("SUB_Softbus_IPC_MessageParcel_05900: sendRequestis is " + result.errCode);
J
jiyong 已提交
2249 2250 2251
                expect(result.errCode == 0).assertTrue();

                var floatArryDataReply = result.reply.readFloatArray();
Y
yang-qibo 已提交
2252 2253
                console.info("SUB_Softbus_IPC_MessageParcel_05900: run readFloatArray success, floatArryDataReply " + floatArryDataReply);
                assertArrayElementEqual(floatArryData,floatArryDataReply);
J
jiyong 已提交
2254 2255 2256 2257 2258 2259
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
2260
            console.info("SUB_Softbus_IPC_MessageParcel_05900: error " + error);
J
jiyong 已提交
2261
        }
Y
yang-qibo 已提交
2262
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05900---------------------------");
J
jiyong 已提交
2263 2264 2265
    });

    /*
Y
yang-qibo 已提交
2266
     * @tc.number  SUB_Softbus_IPC_MessageParcel_06000
J
jiyong 已提交
2267 2268 2269 2270 2271
     * @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 已提交
2272 2273
    it("SUB_Softbus_IPC_MessageParcel_06000", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06000---------------------------");
J
jiyong 已提交
2274 2275
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2276
            console.info("SUB_Softbus_IPC_MessageParcel_06000: create object successfully.");
J
jiyong 已提交
2277 2278 2279 2280 2281
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

            var floatArryData = [1.2, 1.3, 1.4]
            var writeShortArrayResult = data.writeFloatArray(floatArryData);
Y
yang-qibo 已提交
2282
            console.info("SUB_Softbus_IPC_MessageParcel_06000: run writeFloatArrayis is " + writeShortArrayResult);
J
jiyong 已提交
2283 2284 2285 2286
            expect(writeShortArrayResult == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2287
                console.info("SUB_Softbus_IPC_MessageParcel_06000: gIRemoteObject undefined");
J
jiyong 已提交
2288 2289
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2290
                console.info("SUB_Softbus_IPC_MessageParcel_06000: sendRequestis is " + result.errCode);
J
jiyong 已提交
2291 2292 2293 2294
                expect(result.errCode == 0).assertTrue();

                var newArr = []
                result.reply.readFloatArray(newArr);
Y
yang-qibo 已提交
2295 2296
                console.info("SUB_Softbus_IPC_MessageParcel_06000: readFloatArray is success, floatArryDataReply is " + newArr);
                assertArrayElementEqual(floatArryData,newArr);
J
jiyong 已提交
2297 2298 2299 2300 2301 2302
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
2303
            console.info("SUB_Softbus_IPC_MessageParcel_06000: error " +error);
J
jiyong 已提交
2304
        }
Y
yang-qibo 已提交
2305
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06000---------------------------");
J
jiyong 已提交
2306 2307 2308
    });

    /*
Y
yang-qibo 已提交
2309
     * @tc.number  SUB_Softbus_IPC_MessageParcel_06100
J
jiyong 已提交
2310 2311 2312 2313
     * @tc.name    Writefloatarray interface, boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2314 2315
    it("SUB_Softbus_IPC_MessageParcel_06100", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06100---------------------------");
J
jiyong 已提交
2316 2317
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2318
            console.info("SUB_Softbus_IPC_MessageParcel_06100: create object successfully.");
J
jiyong 已提交
2319 2320 2321 2322 2323
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

            var floatArryData = [-3.40E+38, 1.3, 3.40E+38];
            var writeShortArrayResult = data.writeFloatArray(floatArryData);
Y
yang-qibo 已提交
2324
            console.info("SUB_Softbus_IPC_MessageParcel_06100: run writeFloatArrayis is " + writeShortArrayResult);
J
jiyong 已提交
2325 2326
            expect(writeShortArrayResult == true).assertTrue();

J
jiyong 已提交
2327 2328
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2329
                console.info("SUB_Softbus_IPC_MessageParcel_06100: gIRemoteObject undefined");
J
jiyong 已提交
2330 2331
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2332
                console.info("SUB_Softbus_IPC_MessageParcel_06100: sendRequestis is " + result.errCode);
J
jiyong 已提交
2333
                expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2334

J
jiyong 已提交
2335
                var newArr = result.reply.readFloatArray();
Y
yang-qibo 已提交
2336 2337
                console.info("SUB_Softbus_IPC_MessageParcel_06100: run readFloatArray is success, floatArryDataReply is " + newArr);
                assertArrayElementEqual(floatArryData,newArr);
J
jiyong 已提交
2338
            });
J
jiyong 已提交
2339 2340 2341 2342
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
2343
            console.info("SUB_Softbus_IPC_MessageParcel_06100: error " +error);
J
jiyong 已提交
2344
        }
Y
yang-qibo 已提交
2345
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06100---------------------------");
J
jiyong 已提交
2346 2347 2348
    });

    /*
Y
yang-qibo 已提交
2349
     * @tc.number  SUB_Softbus_IPC_MessageParcel_06200
J
jiyong 已提交
2350 2351 2352 2353
     * @tc.name    Writefloatarray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2354 2355
    it("SUB_Softbus_IPC_MessageParcel_06200", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06200---------------------------");
J
jiyong 已提交
2356 2357
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2358
            console.info("SUB_Softbus_IPC_MessageParcel_06200: create object successfully.");
J
jiyong 已提交
2359 2360
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
2361 2362 2363

            var floatArryData = [-4.40E+38, 1.3, 3.40E+38];
            var writeShortArrayResult = data.writeFloatArray(floatArryData);
Y
yang-qibo 已提交
2364
            console.info("SUB_Softbus_IPC_MessageParcel_06200: run writeFloatArrayis is " + writeShortArrayResult);
J
jiyong 已提交
2365 2366 2367 2368
            expect(writeShortArrayResult == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2369
                console.info("SUB_Softbus_IPC_MessageParcel_06200: gIRemoteObject undefined");
J
jiyong 已提交
2370 2371
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2372
                console.info("SUB_Softbus_IPC_MessageParcel_06200: sendRequestis is " + result.errCode);
J
jiyong 已提交
2373
                expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2374

J
jiyong 已提交
2375
                var newArr = result.reply.readFloatArray();
Y
yang-qibo 已提交
2376
                console.info("SUB_Softbus_IPC_MessageParcel_06200: run readFloatArray is success, floatArryDataReply is " + newArr);
J
jiyong 已提交
2377 2378 2379 2380
                expect(newArr[0] == floatArryData[0]).assertTrue();
                expect(newArr[1] == floatArryData[1]).assertTrue();
                expect(newArr[2] == floatArryData[2]).assertTrue();
            });
J
jiyong 已提交
2381
            data.reclaim();
J
jiyong 已提交
2382 2383
            reply.reclaim();
            done();
J
jiyong 已提交
2384
        } catch (error) {
Y
yang-qibo 已提交
2385
            console.info("SUB_Softbus_IPC_MessageParcel_06200: error " +error);
J
jiyong 已提交
2386
        }
Y
yang-qibo 已提交
2387
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06200---------------------------");
J
jiyong 已提交
2388 2389 2390
    });

    /*
Y
yang-qibo 已提交
2391
     * @tc.number  SUB_Softbus_IPC_MessageParcel_06300
J
jiyong 已提交
2392 2393 2394 2395 2396
     * @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 已提交
2397 2398
    it("SUB_Softbus_IPC_MessageParcel_06300", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06300---------------------------");
J
jiyong 已提交
2399 2400
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2401
            console.info("SUB_Softbus_IPC_MessageParcel_06300: create object successfully.");
J
jiyong 已提交
2402 2403 2404 2405 2406
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

            var short = 8;
            var writeShor = data.writeShort(short);
Y
yang-qibo 已提交
2407
            console.info("SUB_Softbus_IPC_MessageParcel_06300: run writeShort success, writeShor is " + writeShor);
J
jiyong 已提交
2408 2409 2410 2411
            expect(writeShor == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2412
                console.info("SUB_Softbus_IPC_MessageParcel_06300: gIRemoteObject undefined");
J
jiyong 已提交
2413 2414
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SHORT, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2415
                console.info("SUB_Softbus_IPC_MessageParcel_06300: sendRequestis is " + result.errCode);
J
jiyong 已提交
2416 2417 2418
                expect(result.errCode == 0).assertTrue();

                var readShort = result.reply.readShort();
Y
yang-qibo 已提交
2419
                console.info("SUB_Softbus_IPC_MessageParcel_06300: run readFloatArray is success, readShort is "
J
jiyong 已提交
2420 2421 2422 2423 2424 2425 2426 2427
                + readShort);
                expect(readShort == short).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
2428
            console.info("SUB_Softbus_IPC_MessageParcel_06300: error " + error);
J
jiyong 已提交
2429
        }
Y
yang-qibo 已提交
2430
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06300---------------------------");
J
jiyong 已提交
2431 2432 2433
    });

    /*
Y
yang-qibo 已提交
2434
     * @tc.number  SUB_Softbus_IPC_MessageParcel_06400
J
jiyong 已提交
2435
     * @tc.name    WriteShort interface, boundary value verification
J
jiyong 已提交
2436 2437 2438
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2439 2440
    it("SUB_Softbus_IPC_MessageParcel_06400", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06400---------------------------");
J
jiyong 已提交
2441 2442
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2443
            console.info("SUB_Softbus_IPC_MessageParcel_06400: create object successfully.");
J
jiyong 已提交
2444 2445 2446 2447 2448 2449 2450
            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();
J
jiyong 已提交
2451

J
jiyong 已提交
2452 2453
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2454
                console.info("SUB_Softbus_IPC_MessageParcel_06400: gIRemoteObject undefined");
J
jiyong 已提交
2455 2456
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SHORT_MULTI, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2457
                console.info("SUB_Softbus_IPC_MessageParcel_06400: sendRequestis is " + result.errCode);
J
jiyong 已提交
2458 2459 2460 2461 2462 2463 2464 2465
                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 已提交
2466 2467

            data.reclaim();
J
jiyong 已提交
2468
            reply.reclaim();
J
jiyong 已提交
2469 2470
            done();
        } catch (error) {
Y
yang-qibo 已提交
2471
            console.info("SUB_Softbus_IPC_MessageParcel_06400: error " + error);
J
jiyong 已提交
2472
        }
Y
yang-qibo 已提交
2473
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06400---------------------------");
J
jiyong 已提交
2474 2475 2476
    });

    /*
Y
yang-qibo 已提交
2477
     * @tc.number  SUB_Softbus_IPC_MessageParcel_06500
J
jiyong 已提交
2478
     * @tc.name    WriteShort interface, illegal value verification
J
jiyong 已提交
2479 2480 2481
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2482 2483
    it("SUB_Softbus_IPC_MessageParcel_06500", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06500---------------------------");
J
jiyong 已提交
2484 2485
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2486
            console.info("SUB_Softbus_IPC_MessageParcel_06500: create object successfully.");
J
jiyong 已提交
2487 2488 2489
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            expect(data.writeShort(32768) == true).assertTrue();
J
jiyong 已提交
2490

J
jiyong 已提交
2491 2492
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2493
                console.info("SUB_Softbus_IPC_MessageParcel_06500: gIRemoteObject undefined");
J
jiyong 已提交
2494 2495
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SHORT_MULTI, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2496
                console.info("SUB_Softbus_IPC_MessageParcel_06500: sendRequestis is " + result.errCode);
J
jiyong 已提交
2497 2498 2499
                expect(result.errCode == 0).assertTrue();
                expect(result.reply.readShort() == -32768).assertTrue();
            });
J
jiyong 已提交
2500 2501

            data.reclaim();
J
jiyong 已提交
2502 2503
            reply.reclaim();
            done();
J
jiyong 已提交
2504
        } catch (error) {
Y
yang-qibo 已提交
2505
            console.info("SUB_Softbus_IPC_MessageParcel_06500: error " + error);
J
jiyong 已提交
2506
        }
Y
yang-qibo 已提交
2507
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06500---------------------------");
J
jiyong 已提交
2508 2509 2510
    });

    /*
Y
yang-qibo 已提交
2511 2512 2513
     * @tc.number  SUB_Softbus_IPC_MessageParcel_06600
     * @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 已提交
2514 2515 2516
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2517 2518
    it("SUB_Softbus_IPC_MessageParcel_06600", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06600---------------------------");
J
jiyong 已提交
2519 2520
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2521
            console.info("SUB_Softbus_IPC_MessageParcel_06600: create object successfully.");
J
jiyong 已提交
2522 2523
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
2524

Y
yang-qibo 已提交
2525 2526 2527 2528
            var short = -32769;
            var writeShor = data.writeShort(short);
            console.info("SUB_Softbus_IPC_MessageParcel_06600: run writeShort success, writeShor is " + writeShor);
            expect(writeShor == true).assertTrue();
J
jiyong 已提交
2529

J
jiyong 已提交
2530 2531
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2532
                console.info("SUB_Softbus_IPC_MessageParcel_06600: gIRemoteObject undefined");
J
jiyong 已提交
2533
            }
Y
yang-qibo 已提交
2534 2535
            await gIRemoteObject.sendRequest(CODE_WRITE_SHORT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_06600: sendRequestis is " + result.errCode);
J
jiyong 已提交
2536 2537
                expect(result.errCode == 0).assertTrue();

Y
yang-qibo 已提交
2538 2539 2540
                var readShort = result.reply.readShort();
                console.info("SUB_Softbus_IPC_MessageParcel_06600: run readFloatArray is success, readShort is " + readShort);
                expect(readShort == 32767).assertTrue();
J
jiyong 已提交
2541
            });
J
jiyong 已提交
2542 2543

            data.reclaim();
J
jiyong 已提交
2544 2545
            reply.reclaim();
            done();
J
jiyong 已提交
2546
        } catch (error) {
Y
yang-qibo 已提交
2547
            console.info("SUB_Softbus_IPC_MessageParcel_06600: error " + error);
J
jiyong 已提交
2548
        }
Y
yang-qibo 已提交
2549
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06600---------------------------");
J
jiyong 已提交
2550 2551 2552
    });

    /*
Y
yang-qibo 已提交
2553 2554 2555
     * @tc.number  SUB_Softbus_IPC_MessageParcel_06700
     * @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 已提交
2556 2557 2558
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2559 2560
    it("SUB_Softbus_IPC_MessageParcel_06700", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06700---------------------------");
J
jiyong 已提交
2561 2562
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2563
            console.info("SUB_Softbus_IPC_MessageParcel_06700: create object successfully.");
J
jiyong 已提交
2564 2565
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
2566

Y
yang-qibo 已提交
2567 2568 2569 2570
            var short = 32768;
            var writeShor = data.writeShort(short);
            console.info("SUB_Softbus_IPC_MessageParcel_06700: run writeShort success, writeShor is " + writeShor);
            expect(writeShor == true).assertTrue();
J
jiyong 已提交
2571

J
jiyong 已提交
2572 2573
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2574
                console.info("SUB_Softbus_IPC_MessageParcel_06700: gIRemoteObject undefined");
J
jiyong 已提交
2575
            }
Y
yang-qibo 已提交
2576 2577
            await gIRemoteObject.sendRequest(CODE_WRITE_SHORT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_06700: sendRequestis is " + result.errCode);
J
jiyong 已提交
2578 2579
                expect(result.errCode == 0).assertTrue();

Y
yang-qibo 已提交
2580 2581 2582
                var readShort = result.reply.readShort();
                console.info("SUB_Softbus_IPC_MessageParcel_06700: run readFloatArray is success, readShort is " + readShort);
                expect(readShort == -32768).assertTrue();
J
jiyong 已提交
2583
            });
J
jiyong 已提交
2584 2585

            data.reclaim();
Y
yang-qibo 已提交
2586
            reply.reclaim();
J
jiyong 已提交
2587 2588
            done();
        } catch (error) {
Y
yang-qibo 已提交
2589
            console.info("SUB_Softbus_IPC_MessageParcel_06700: error " + error);
J
jiyong 已提交
2590
        }
Y
yang-qibo 已提交
2591
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06700---------------------------");
J
jiyong 已提交
2592 2593 2594
    });

    /*
Y
yang-qibo 已提交
2595 2596 2597
     * @tc.number  SUB_Softbus_IPC_MessageParcel_06800
     * @tc.name    Call writelong interface to write long integer data to messageparcel instance
     *             and call readlong to read data
J
jiyong 已提交
2598 2599 2600
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2601 2602
    it("SUB_Softbus_IPC_MessageParcel_06800", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06800---------------------------");
J
jiyong 已提交
2603 2604
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2605
            console.info("SUB_Softbus_IPC_MessageParcel_06800: create object successfully.");
J
jiyong 已提交
2606 2607
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
2608

Y
yang-qibo 已提交
2609
            var short = 10000;
J
jiyong 已提交
2610
            var writelong = data.writeLong(short);
Y
yang-qibo 已提交
2611
            console.info("SUB_Softbus_IPC_MessageParcel_06800: run writeLong success, writelong is " + writelong);
J
jiyong 已提交
2612 2613
            expect(writelong == true).assertTrue();

J
jiyong 已提交
2614 2615
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2616
                console.info("SUB_Softbus_IPC_MessageParcel_06800: gIRemoteObject undefined");
J
jiyong 已提交
2617 2618
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => {
Y
yang-qibo 已提交
2619 2620
                console.info("SUB_Softbus_IPC_MessageParcel_06800: run sendRequestis is "
                             + result.errCode);
J
jiyong 已提交
2621 2622 2623
                expect(result.errCode == 0).assertTrue();

                var readlong = result.reply.readLong();
Y
yang-qibo 已提交
2624
                console.info("SUB_Softbus_IPC_MessageParcel_06800: run readLong is success, readlong is " + readlong);
J
jiyong 已提交
2625 2626
                expect(readlong == short).assertTrue();
            });
J
jiyong 已提交
2627 2628

            data.reclaim();
Y
yang-qibo 已提交
2629
            reply.reclaim();
J
jiyong 已提交
2630
            done();
J
jiyong 已提交
2631
        } catch (error) {
Y
yang-qibo 已提交
2632
            console.info("SUB_Softbus_IPC_MessageParcel_06800: error " + error);
J
jiyong 已提交
2633
        }
Y
yang-qibo 已提交
2634
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06800---------------------------");
J
jiyong 已提交
2635 2636 2637
    });

    /*
Y
yang-qibo 已提交
2638 2639
     * @tc.number  SUB_Softbus_IPC_MessageParcel_06900
     * @tc.name    Writelong interface, boundary value verification
J
jiyong 已提交
2640 2641 2642
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2643 2644
    it("SUB_Softbus_IPC_MessageParcel_06900", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06900---------------------------");
J
jiyong 已提交
2645 2646
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2647
            console.info("SUB_Softbus_IPC_MessageParcel_06900: create object successfully.");
J
jiyong 已提交
2648 2649
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
2650

Y
yang-qibo 已提交
2651 2652 2653 2654 2655
            var short = 2147483647;
            var writelong = data.writeLong(short);
            console.info("SUB_Softbus_IPC_MessageParcel_06900: run writeLong success, writelong is " + writelong);
            expect(writelong == true).assertTrue();

J
jiyong 已提交
2656 2657
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2658
                console.info("SUB_Softbus_IPC_MessageParcel_06900: gIRemoteObject undefined");
J
jiyong 已提交
2659
            }
Y
yang-qibo 已提交
2660 2661 2662 2663 2664 2665 2666 2667 2668
            await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_06900: run sendRequestis is " + result.errCode);
                expect(result.errCode == 0).assertTrue();

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

J
jiyong 已提交
2669 2670 2671
            data.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
2672
            console.info("SUB_Softbus_IPC_MessageParcel_06900: error " + error);
J
jiyong 已提交
2673
        }
Y
yang-qibo 已提交
2674
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06900---------------------------");
J
jiyong 已提交
2675 2676 2677
    });

    /*
Y
yang-qibo 已提交
2678 2679
     * @tc.number  SUB_Softbus_IPC_MessageParcel_07000
     * @tc.name    Writelong interface, illegal value verification
J
jiyong 已提交
2680 2681 2682
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2683 2684
    it("SUB_Softbus_IPC_MessageParcel_07000", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07000---------------------------");
J
jiyong 已提交
2685 2686
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2687
            console.info("SUB_Softbus_IPC_MessageParcel_07000: create object successfully.");
J
jiyong 已提交
2688 2689
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
2690 2691 2692 2693 2694

            var short = 214748364887;
            var writelong = data.writeLong(short);
            console.info("SUB_Softbus_IPC_MessageParcel_07000: run writeLong success, writelong is " + writelong);
            expect(writelong == true).assertTrue();
J
jiyong 已提交
2695 2696 2697

            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2698
                console.info("SUB_Softbus_IPC_MessageParcel_07000: gIRemoteObject undefined");
J
jiyong 已提交
2699
            }
Y
yang-qibo 已提交
2700 2701 2702 2703 2704 2705 2706
            await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_07000: run sendRequestis is " + result.errCode);
                expect(result.errCode == 0).assertTrue();

                var readlong = result.reply.readLong();
                console.info("SUB_Softbus_IPC_MessageParcel_07000: run readLong is success, readlong is " + readlong);
                expect(readlong == short).assertTrue();
J
jiyong 已提交
2707
            });
J
jiyong 已提交
2708 2709

            data.reclaim();
Y
yang-qibo 已提交
2710
            done();
J
jiyong 已提交
2711
        } catch (error) {
Y
yang-qibo 已提交
2712
            console.info("SUB_Softbus_IPC_MessageParcel_07000: error " + error);
J
jiyong 已提交
2713
        }
Y
yang-qibo 已提交
2714
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07000---------------------------");
J
jiyong 已提交
2715 2716 2717
    });

    /*
Y
yang-qibo 已提交
2718 2719
     * @tc.number  SUB_Softbus_IPC_MessageParcel_07100
     * @tc.name    Writelong interface, illegal value verification
J
jiyong 已提交
2720 2721 2722
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2723 2724
    it("SUB_Softbus_IPC_MessageParcel_07100", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07100---------------------------");
J
jiyong 已提交
2725 2726
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2727 2728 2729
            console.info("SUB_Softbus_IPC_MessageParcel_07100: create object successfully.");
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
2730

Y
yang-qibo 已提交
2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747
            var short = 2147483649;
            var writelong = data.writeLong(short);
            console.info("SUB_Softbus_IPC_MessageParcel_07100: run writeLong success, writelong is " + writelong);
            expect(writelong == true).assertTrue();

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

                var readlong = result.reply.readLong();
                console.info("SUB_Softbus_IPC_MessageParcel_07100: run readLong is success, readlong is " + readlong);
                expect(readlong == short).assertTrue();
            });
J
jiyong 已提交
2748

J
jiyong 已提交
2749
            data.reclaim();
Y
yang-qibo 已提交
2750
            done();
J
jiyong 已提交
2751
        } catch (error) {
Y
yang-qibo 已提交
2752
            console.info("SUB_Softbus_IPC_MessageParcel_07100: error " + error);
J
jiyong 已提交
2753
        }
Y
yang-qibo 已提交
2754
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07100---------------------------");
J
jiyong 已提交
2755 2756 2757
    });

    /*
Y
yang-qibo 已提交
2758 2759
     * @tc.number  SUB_Softbus_IPC_MessageParcel_07200
     * @tc.name    Call the parallel interface to read and write data to the double instance
J
jiyong 已提交
2760 2761 2762
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2763 2764
    it("SUB_Softbus_IPC_MessageParcel_07200", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07200---------------------------");
J
jiyong 已提交
2765 2766
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2767
            console.info("SUB_Softbus_IPC_MessageParcel_07200: create object successfully.");
J
jiyong 已提交
2768 2769
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
2770 2771 2772 2773

            var token = 10.2;
            var result = data.writeDouble(token);
            console.info("SUB_Softbus_IPC_MessageParcel_07200:run writeDoubleis is " + result);
J
jiyong 已提交
2774 2775
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2776
                console.info("SUB_Softbus_IPC_MessageParcel_07200: gIRemoteObject is undefined");
J
jiyong 已提交
2777
            }
Y
yang-qibo 已提交
2778 2779 2780 2781 2782 2783
            await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => {
                    console.info("SUB_Softbus_IPC_MessageParcel_07200: run sendRequestis is " + result.errCode);
                    var replyReadResult = reply.readDouble();
                    console.info("SUB_Softbus_IPC_MessageParcel_07200: run replyReadResult is " + replyReadResult);
                    expect(replyReadResult == token).assertTrue();
                });
J
jiyong 已提交
2784 2785 2786 2787
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
2788
            console.info("SUB_Softbus_IPC_MessageParcel_07200:error = " + error);
J
jiyong 已提交
2789
        }
Y
yang-qibo 已提交
2790 2791

        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07200---------------------------");
J
jiyong 已提交
2792 2793 2794
    });

    /*
Y
yang-qibo 已提交
2795 2796
     * @tc.number  SUB_Softbus_IPC_MessageParcel_07300
     * @tc.name    Writedouble interface, boundary value verification
J
jiyong 已提交
2797 2798 2799
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2800 2801
    it("SUB_Softbus_IPC_MessageParcel_07300", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07300---------------------------");
J
jiyong 已提交
2802 2803
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2804
            console.info("SUB_Softbus_IPC_MessageParcel_07300: create object successfully.");
J
jiyong 已提交
2805 2806
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824
            var token = 1.79E+308;
            var result = data.writeDouble(token);
            console.info("SUB_Softbus_IPC_MessageParcel_07300:run writeDoubleis is " + result);
            expect(result == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_07300: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_07300: run sendRequestis is " + result.errCode);
                var replyReadResult = reply.readDouble();
                console.info("SUB_Softbus_IPC_MessageParcel_07300: run rreplyReadResult is " + replyReadResult);
                expect(replyReadResult == token).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
J
jiyong 已提交
2825
        } catch (error) {
Y
yang-qibo 已提交
2826
            console.info("SUB_Softbus_IPC_MessageParcel_07300:error = " + error);
J
jiyong 已提交
2827
        }
Y
yang-qibo 已提交
2828
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07300---------------------------");
J
jiyong 已提交
2829 2830 2831
    });

    /*
Y
yang-qibo 已提交
2832 2833
     * @tc.number  SUB_Softbus_IPC_MessageParcel_07400
     * @tc.name    Writedouble interface, boundary value verification
J
jiyong 已提交
2834 2835 2836
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2837 2838
    it("SUB_Softbus_IPC_MessageParcel_07400", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07400---------------------------");
J
jiyong 已提交
2839 2840
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2841
            console.info("SUB_Softbus_IPC_MessageParcel_07400: create object successfully.");
J
jiyong 已提交
2842 2843
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
2844 2845 2846
            var token = 4.9000000e-32;
            var result = data.writeDouble(token);
            console.info("SUB_Softbus_IPC_MessageParcel_07400:run writeDoubleis is " + result);
J
jiyong 已提交
2847
            expect(result == true).assertTrue();
Y
yang-qibo 已提交
2848

J
jiyong 已提交
2849 2850
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
2851
                console.info("SUB_Softbus_IPC_MessageParcel_07400: gIRemoteObject is undefined");
J
jiyong 已提交
2852
            }
Y
yang-qibo 已提交
2853 2854 2855 2856
            await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_07400: run sendRequestis is " + result.errCode);
                var replyReadResult = reply.readDouble();
                console.info("SUB_Softbus_IPC_MessageParcel_07400: run replyReadResult is " + replyReadResult);
J
jiyong 已提交
2857 2858
                expect(replyReadResult == token).assertTrue();
            });
J
jiyong 已提交
2859 2860

            data.reclaim();
J
jiyong 已提交
2861
            reply.reclaim();
J
jiyong 已提交
2862
        } catch (error) {
Y
yang-qibo 已提交
2863
            console.info("SUB_Softbus_IPC_MessageParcel_07400:error = " + error);
J
jiyong 已提交
2864
        }
Y
yang-qibo 已提交
2865
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07400---------------------------");
J
jiyong 已提交
2866 2867 2868
    });

    /*
Y
yang-qibo 已提交
2869 2870
     * @tc.number  SUB_Softbus_IPC_MessageParcel_07500
     * @tc.name    Writedouble interface, illegal value validation
J
jiyong 已提交
2871 2872 2873
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2874 2875
    it("SUB_Softbus_IPC_MessageParcel_07500", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07500---------------------------");
J
jiyong 已提交
2876 2877
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
2878 2879 2880 2881 2882
            console.info("SUB_Softbus_IPC_MessageParcel_07500: create object successfully.");

            var token = "1.79E+465312156";
            var result = data.writeDouble(token);
            console.info("SUB_Softbus_IPC_MessageParcel_07500:run writeDoubleis is " + result);
Z
zhangpa2021 已提交
2883

Y
yang-qibo 已提交
2884
            data.reclaim();
J
jiyong 已提交
2885
        } catch (error) {
Y
yang-qibo 已提交
2886 2887
            console.info("SUB_Softbus_IPC_MessageParcel_07500:error = " + error);
            expect(error != null).assertTrue();
J
jiyong 已提交
2888
        }
Y
yang-qibo 已提交
2889
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07500---------------------------");
J
jiyong 已提交
2890 2891 2892
    });

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

Y
yang-qibo 已提交
2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956
    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_07700
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_07700", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07700---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_07700:run writeBooleanis is " + result);
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_07700: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_BOOLEAN, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_07700: run sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readBoolean();
                console.info("SUB_Softbus_IPC_MessageParcel_07700: run readBoolean is " + replyReadResult);
                expect(replyReadResult == token).assertTrue();
            });
J
jiyong 已提交
2957 2958 2959 2960
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
2961
            console.info("SUB_Softbus_IPC_MessageParcel_07700:error = " + error);
J
jiyong 已提交
2962
        }
Y
yang-qibo 已提交
2963
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07700---------------------------");
J
jiyong 已提交
2964 2965 2966
    });

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

    /*
Y
yang-qibo 已提交
2992 2993
     * @tc.number  SUB_Softbus_IPC_MessageParcel_07900
     * @tc.name    Writeboolean interface, illegal value verification
J
jiyong 已提交
2994 2995 2996
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
2997 2998
    it("SUB_Softbus_IPC_MessageParcel_07900", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07900---------------------------");
J
jiyong 已提交
2999 3000
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3001
            console.info("SUB_Softbus_IPC_MessageParcel_07900: create object successfully.");
J
jiyong 已提交
3002 3003
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032
            var token = "aaa";
            var result = data.writeBoolean(token);
            console.info("SUB_Softbus_IPC_MessageParcel_07900:run writeBooleanis is " + result);
            expect(result == false).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_07900:error = " + error);
            expect(error != null).assertTrue();
        }
        data.reclaim();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07900---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_08000
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_08000", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08000---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_08000:run writeCharis is " + result);
J
jiyong 已提交
3033 3034 3035
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3036
                console.info("SUB_Softbus_IPC_MessageParcel_08000: gIRemoteObject is undefined");
J
jiyong 已提交
3037
            }
Y
yang-qibo 已提交
3038 3039 3040 3041
            await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_08000: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readChar();
                console.info("SUB_Softbus_IPC_MessageParcel_08000: run readChar is " + replyReadResult);
J
jiyong 已提交
3042 3043 3044 3045 3046 3047 3048
                expect(replyReadResult == token).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3049
            console.info("SUB_Softbus_IPC_MessageParcel_08000:error = " + error);
J
jiyong 已提交
3050
        }
Y
yang-qibo 已提交
3051
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08000---------------------------");
J
jiyong 已提交
3052 3053 3054
    });

    /*
Y
yang-qibo 已提交
3055 3056 3057
     * @tc.number  SUB_Softbus_IPC_MessageParcel_08100
     * @tc.name    Call the writechar interface to write the data to the messageparcel instance,
     *             and call readchar to read the data
J
jiyong 已提交
3058 3059 3060
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3061 3062
    it("SUB_Softbus_IPC_MessageParcel_08100", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08100---------------------------");
J
jiyong 已提交
3063 3064
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3065
            console.info("SUB_Softbus_IPC_MessageParcel_08100: create object successfully.");
J
jiyong 已提交
3066 3067
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3068 3069 3070 3071
            var token = 122;
            var result = data.writeChar(token);
            console.info("SUB_Softbus_IPC_MessageParcel_08100:run writeCharis is " + result);
            expect(result == true).assertTrue();
J
jiyong 已提交
3072 3073
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3074
                console.info("SUB_Softbus_IPC_MessageParcel_08100: gIRemoteObject is undefined");
J
jiyong 已提交
3075
            }
Y
yang-qibo 已提交
3076 3077 3078 3079 3080
            await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_08100: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readChar();
                console.info("SUB_Softbus_IPC_MessageParcel_08100: run readChar is " + replyReadResult);
                expect(replyReadResult == token).assertTrue();
J
jiyong 已提交
3081 3082 3083 3084 3085 3086
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3087
            console.info("SUB_Softbus_IPC_MessageParcel_08100:error = " + error);
J
jiyong 已提交
3088
        }
Y
yang-qibo 已提交
3089
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08100---------------------------");
J
jiyong 已提交
3090 3091 3092
    });

    /*
Y
yang-qibo 已提交
3093 3094 3095
     * @tc.number  SUB_Softbus_IPC_MessageParcel_08200
     * @tc.name    Call the writechar interface to write the data to the messageparcel instance,
     *             and call readchar to read the data
J
jiyong 已提交
3096 3097 3098
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3099 3100
    it("SUB_Softbus_IPC_MessageParcel_08200", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08200---------------------------");
J
jiyong 已提交
3101 3102
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3103
            console.info("SUB_Softbus_IPC_MessageParcel_08200: create object successfully.");
J
jiyong 已提交
3104 3105
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3106 3107 3108 3109
            var token = 64;
            var result = data.writeChar(token);
            console.info("SUB_Softbus_IPC_MessageParcel_08200:run writeCharis is " + result);
            expect(result == true).assertTrue();
J
jiyong 已提交
3110 3111
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3112
                console.info("SUB_Softbus_IPC_MessageParcel_08200: gIRemoteObject is undefined");
J
jiyong 已提交
3113
            }
Y
yang-qibo 已提交
3114 3115 3116 3117 3118
            await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_08200: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readChar();
                console.info("SUB_Softbus_IPC_MessageParcel_08200: run readChar is " + replyReadResult);
                expect(replyReadResult == token).assertTrue();
J
jiyong 已提交
3119 3120
            });

J
jiyong 已提交
3121
            data.reclaim();
J
jiyong 已提交
3122 3123
            reply.reclaim();
            done();
J
jiyong 已提交
3124
        } catch (error) {
Y
yang-qibo 已提交
3125
            console.info("SUB_Softbus_IPC_MessageParcel_08200:error = " + error);
J
jiyong 已提交
3126
        }
Y
yang-qibo 已提交
3127
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08200---------------------------");
J
jiyong 已提交
3128 3129 3130
    });

    /*
Y
yang-qibo 已提交
3131 3132 3133
     * @tc.number  SUB_Softbus_IPC_MessageParcel_08300
     * @tc.name    Call the writechar interface to write the data to the messageparcel instance,
     *             and call readchar to read the data
J
jiyong 已提交
3134 3135 3136
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3137 3138
    it("SUB_Softbus_IPC_MessageParcel_08300", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08300---------------------------");
J
jiyong 已提交
3139 3140
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3141
            console.info("SUB_Softbus_IPC_MessageParcel_08300: create object successfully.");
J
jiyong 已提交
3142 3143
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3144 3145 3146
            var token = 123;
            var result = data.writeChar(token);
            console.info("SUB_Softbus_IPC_MessageParcel_08300:run writeCharis is " + result);
J
jiyong 已提交
3147 3148 3149
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3150
                console.info("SUB_Softbus_IPC_MessageParcel_08300: gIRemoteObject is undefined");
J
jiyong 已提交
3151
            }
Y
yang-qibo 已提交
3152 3153 3154 3155
            await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_08300: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readChar();
                console.info("SUB_Softbus_IPC_MessageParcel_08300: run readChar is  " + replyReadResult);
J
jiyong 已提交
3156 3157 3158 3159 3160 3161 3162
                expect(replyReadResult == token).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3163
            console.info("SUB_Softbus_IPC_MessageParcel_08300:error = " + error);
J
jiyong 已提交
3164
        }
Y
yang-qibo 已提交
3165
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08300---------------------------");
J
jiyong 已提交
3166 3167 3168
    });

    /*
Y
yang-qibo 已提交
3169 3170 3171
     * @tc.number  SUB_Softbus_IPC_MessageParcel_08400
     * @tc.name    Call the writechar interface to write the data to the messageparcel instance,
     *             and call readchar to read the data
J
jiyong 已提交
3172 3173 3174
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3175 3176
    it("SUB_Softbus_IPC_MessageParcel_08400", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08400---------------------------");
J
jiyong 已提交
3177 3178
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3179
            console.info("SUB_Softbus_IPC_MessageParcel_08400: create object successfully.");
J
jiyong 已提交
3180 3181
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3182 3183 3184 3185
            var token = 65;
            var result = data.writeChar(token);
            console.info("SUB_Softbus_IPC_MessageParcel_08400:run writeCharis is " + result);
            expect(result == true).assertTrue();
J
jiyong 已提交
3186 3187
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3188
                console.info("SUB_Softbus_IPC_MessageParcel_08400: gIRemoteObject is undefined");
J
jiyong 已提交
3189
            }
Y
yang-qibo 已提交
3190 3191 3192 3193 3194
            await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_08400: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readChar();
                console.info("SUB_Softbus_IPC_MessageParcel_08400: run readChar is " + replyReadResult);
                expect(replyReadResult == token).assertTrue();
J
jiyong 已提交
3195 3196 3197 3198 3199 3200
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3201
            console.info("SUB_Softbus_IPC_MessageParcel_08400:error = " + error);
J
jiyong 已提交
3202
        }
Y
yang-qibo 已提交
3203
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08400---------------------------");
J
jiyong 已提交
3204 3205 3206
    });

    /*
Y
yang-qibo 已提交
3207 3208
     * @tc.number  SUB_Softbus_IPC_MessageParcel_08500
     * @tc.name    Writechar interface, illegal value verification
J
jiyong 已提交
3209 3210 3211
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3212 3213
    it("SUB_Softbus_IPC_MessageParcel_08500", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08500---------------------------");
J
jiyong 已提交
3214 3215
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3216
            console.info("SUB_Softbus_IPC_MessageParcel_08500: create object successfully.");
J
jiyong 已提交
3217 3218
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3219 3220 3221 3222
            var token = 'ades';
            var result = data.writeChar(token);
            console.info("SUB_Softbus_IPC_MessageParcel_08500:run writeCharis is " + result);
            expect(result == false).assertTrue()
J
jiyong 已提交
3223

J
jiyong 已提交
3224
        } catch (error) {
Y
yang-qibo 已提交
3225 3226
            console.info("SUB_Softbus_IPC_MessageParcel_08500:error = " + error);
            expect(error != null).assertTrue();
J
jiyong 已提交
3227
        }
Y
yang-qibo 已提交
3228 3229
        data.reclaim();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08500---------------------------");
J
jiyong 已提交
3230 3231 3232
    });

    /*
Y
yang-qibo 已提交
3233 3234 3235
     * @tc.number  SUB_Softbus_IPC_MessageParcel_08600
     * @tc.name    Call the writestring interface to write the data to the messageparcel instance,
     *             and call readstring() to read the data
J
jiyong 已提交
3236 3237 3238
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3239 3240
    it("SUB_Softbus_IPC_MessageParcel_08600", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08600---------------------------");
J
jiyong 已提交
3241 3242
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3243
            console.info("SUB_Softbus_IPC_MessageParcel_08600: create object successfully.");
J
jiyong 已提交
3244 3245
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3246 3247 3248 3249 3250 3251
            var token = '';
            for(var i = 0; i < (40*K - 1); i++){
                token += 'a';
            };
            var result = data.writeString(token);
            console.info("SUB_Softbus_IPC_MessageParcel_08600:run writeStringis is " + result);
J
jiyong 已提交
3252 3253 3254
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3255
                console.info("SUB_Softbus_IPC_MessageParcel_08600: gIRemoteObject is undefined");
J
jiyong 已提交
3256
            }
Y
yang-qibo 已提交
3257 3258 3259 3260
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_08600: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readString();
                console.info("SUB_Softbus_IPC_MessageParcel_08600: run readString is " + replyReadResult.length);
J
jiyong 已提交
3261 3262 3263 3264 3265 3266 3267
                expect(replyReadResult == token).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3268
            console.info("SUB_Softbus_IPC_MessageParcel_08600:error = " + error);
J
jiyong 已提交
3269
        }
Y
yang-qibo 已提交
3270
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08600---------------------------");
J
jiyong 已提交
3271 3272 3273
    });

    /*
Y
yang-qibo 已提交
3274 3275 3276
     * @tc.number  SUB_Softbus_IPC_MessageParcel_08700
     * @tc.name    Call the writestring interface to write the data to the messageparcel instance,
     *             and call readstring() to read the data
J
jiyong 已提交
3277 3278 3279
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3280 3281
    it("SUB_Softbus_IPC_MessageParcel_08700", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08700---------------------------");
J
jiyong 已提交
3282 3283
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3284 3285 3286 3287 3288 3289 3290 3291
            console.info("SUB_Softbus_IPC_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_MessageParcel_08700:run writeStringis is " + result);
            expect(result == false).assertTrue();
J
jiyong 已提交
3292 3293 3294

            data.reclaim();
        } catch (error) {
Y
yang-qibo 已提交
3295 3296
            console.info("SUB_Softbus_IPC_MessageParcel_08700:error = " + error);
            expect(error != null).assertTrue();
J
jiyong 已提交
3297
        }
Y
yang-qibo 已提交
3298
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08700---------------------------");
J
jiyong 已提交
3299 3300 3301
    });

    /*
Y
yang-qibo 已提交
3302 3303
     * @tc.number  SUB_Softbus_IPC_MessageParcel_08800
     * @tc.name    Writestring interface, illegal value verification
J
jiyong 已提交
3304 3305 3306
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3307 3308
    it("SUB_Softbus_IPC_MessageParcel_08800", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08800---------------------------");
J
jiyong 已提交
3309 3310
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3311 3312 3313 3314 3315 3316
            console.info("SUB_Softbus_IPC_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_MessageParcel_08800:run writeStringis is " + result);
J
jiyong 已提交
3317
            expect(result == false).assertTrue();
J
jiyong 已提交
3318
        } catch (error) {
Y
yang-qibo 已提交
3319 3320
            console.info("SUB_Softbus_IPC_MessageParcel_08800:error = " + error);
            expect(error != null).assertTrue();
J
jiyong 已提交
3321
        }
Y
yang-qibo 已提交
3322 3323 3324
        data.reclaim();
        reply.reclaim();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08800---------------------------");
J
jiyong 已提交
3325 3326 3327
    });

    /*
Y
yang-qibo 已提交
3328 3329 3330
     * @tc.number  SUB_Softbus_IPC_MessageParcel_08900
     * @tc.name    Call the writebyte interface to write data to the messageparcel instance,
     *             and call readbyte to read data
J
jiyong 已提交
3331 3332 3333
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3334 3335
    it("SUB_Softbus_IPC_MessageParcel_08900", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08900---------------------------");
J
jiyong 已提交
3336 3337
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3338 3339 3340 3341 3342 3343
            console.info("SUB_Softbus_IPC_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_MessageParcel_08900:run writeByteis is " + result);
J
jiyong 已提交
3344
            expect(result == true).assertTrue();
Y
yang-qibo 已提交
3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_08900: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_BYTE, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_08900: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readByte();
                console.info("SUB_Softbus_IPC_MessageParcel_08900: run readByte is " + replyReadResult);
                expect(replyReadResult == token).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
J
jiyong 已提交
3359
        } catch (error) {
Y
yang-qibo 已提交
3360
            console.info("SUB_Softbus_IPC_MessageParcel_08900:error = " + error);
J
jiyong 已提交
3361
        }
Y
yang-qibo 已提交
3362
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08900---------------------------");
J
jiyong 已提交
3363 3364 3365
    });

    /*
Y
yang-qibo 已提交
3366 3367
     * @tc.number  SUB_Softbus_IPC_MessageParcel_09000
     * @tc.name    Writebyte interface, boundary value verification
J
jiyong 已提交
3368 3369 3370
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3371 3372
    it("SUB_Softbus_IPC_MessageParcel_09000", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09000---------------------------");
J
jiyong 已提交
3373 3374
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3375
            console.info("SUB_Softbus_IPC_MessageParcel_09000: create object successfully.");
J
jiyong 已提交
3376 3377
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397

            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_MessageParcel_09000: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_BYTE_MULTI, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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();
            });

J
jiyong 已提交
3398 3399 3400 3401
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3402
            console.info("SUB_Softbus_IPC_MessageParcel_09000:error = " + error);
J
jiyong 已提交
3403
        }
Y
yang-qibo 已提交
3404
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09000---------------------------");
J
jiyong 已提交
3405 3406 3407
    });

    /*
Y
yang-qibo 已提交
3408 3409
     * @tc.number  SUB_Softbus_IPC_MessageParcel_09100
     * @tc.name    Writebyte interface, illegal value verification
J
jiyong 已提交
3410 3411 3412
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3413 3414
    it("SUB_Softbus_IPC_MessageParcel_09100", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09100---------------------------");
J
jiyong 已提交
3415 3416
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3417 3418 3419
            console.info("SUB_Softbus_IPC_MessageParcel_09100: create object successfully.");
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
3420

Y
yang-qibo 已提交
3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432
            expect(data.writeByte(-129) == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_09100: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_BYTE_MULTI, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_09100: sendRequestis is " + result.errCode);
                expect(reply.readByte() == 127).assertTrue();
            });
            data.reclaim();
            reply.reclaim();
            done();
J
jiyong 已提交
3433
        } catch (error) {
Y
yang-qibo 已提交
3434
            console.info("SUB_Softbus_IPC_MessageParcel_09100:error = " + error);
J
jiyong 已提交
3435
        }
Y
yang-qibo 已提交
3436
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09100---------------------------");
J
jiyong 已提交
3437 3438 3439
    });

    /*
Y
yang-qibo 已提交
3440 3441
     * @tc.number  SUB_Softbus_IPC_MessageParcel_09200
     * @tc.name    Writebyte interface, illegal value verification
J
jiyong 已提交
3442 3443 3444
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3445 3446
    it("SUB_Softbus_IPC_MessageParcel_09200", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09200---------------------------");
J
jiyong 已提交
3447 3448
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3449 3450 3451
            console.info("SUB_Softbus_IPC_MessageParcel_09200: create object successfully.");
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
3452

Y
yang-qibo 已提交
3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464
            expect(data.writeByte(128) == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_09200: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_BYTE_MULTI, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_09200: sendRequestis is " + result.errCode);
                expect(reply.readByte() == -128).assertTrue();
            });
            data.reclaim();
            reply.reclaim();
            done();
J
jiyong 已提交
3465
        } catch (error) {
Y
yang-qibo 已提交
3466
            console.info("SUB_Softbus_IPC_MessageParcel_09200:error = " + error);
J
jiyong 已提交
3467
        }
Y
yang-qibo 已提交
3468
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09200---------------------------");
J
jiyong 已提交
3469 3470 3471
    });

    /*
Y
yang-qibo 已提交
3472 3473
     * @tc.number  SUB_Softbus_IPC_MessageParcel_09300
     * @tc.name    Writebyte interface, illegal value verification
J
jiyong 已提交
3474 3475 3476
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3477 3478
    it("SUB_Softbus_IPC_MessageParcel_09300", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09300---------------------------");
J
jiyong 已提交
3479 3480
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3481 3482 3483 3484 3485
            console.info("SUB_Softbus_IPC_MessageParcel_09300: create object successfully.");
            let writeby = data.writeByte("error");
            console.info("SUB_Softbus_IPC_MessageParcel_09300: writeByte is" + writeby);
            expect(writeby).assertEqual(false);
            data.reclaim();
J
jiyong 已提交
3486
        } catch (error) {
Y
yang-qibo 已提交
3487 3488
            console.info("SUB_Softbus_IPC_MessageParcel_09300:error = " + error);
            expect(error != null).assertTrue();
J
jiyong 已提交
3489
        }
Y
yang-qibo 已提交
3490
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09300---------------------------");
J
jiyong 已提交
3491 3492 3493
    });

    /*
Y
yang-qibo 已提交
3494 3495 3496
     * @tc.number  SUB_Softbus_IPC_MessageParcel_09400
     * @tc.name    Call the writeint interface to write the data to the messageparcel instance,
     *             and call readint to read the data
J
jiyong 已提交
3497 3498 3499
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3500 3501
    it("SUB_Softbus_IPC_MessageParcel_09400", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09400---------------------------");
J
jiyong 已提交
3502 3503
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3504
            console.info("SUB_Softbus_IPC_MessageParcel_09400: create object successfully.");
J
jiyong 已提交
3505 3506
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3507 3508 3509 3510
            var token = 2;
            var result = data.writeInt(token);
            console.info("SUB_Softbus_IPC_MessageParcel_09400:run writeIntis is " + result);
            expect(result == true).assertTrue();
J
jiyong 已提交
3511 3512
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3513
                console.info("SUB_Softbus_IPC_MessageParcel_09400: gIRemoteObject is undefined");
J
jiyong 已提交
3514
            }
Y
yang-qibo 已提交
3515 3516 3517 3518 3519
            await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_09400: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_09400: run readInt is " + replyReadResult);
                expect(replyReadResult == token).assertTrue();
J
jiyong 已提交
3520 3521 3522 3523 3524 3525
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3526
            console.info("SUB_Softbus_IPC_MessageParcel_09400:error = " + error);
J
jiyong 已提交
3527
        }
Y
yang-qibo 已提交
3528 3529

        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09400---------------------------");
J
jiyong 已提交
3530 3531 3532
    });

    /*
Y
yang-qibo 已提交
3533 3534
     * @tc.number  SUB_Softbus_IPC_MessageParcel_09500
     * @tc.name    Writeint interface, boundary value verification
J
jiyong 已提交
3535 3536 3537
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3538 3539
    it("SUB_Softbus_IPC_MessageParcel_09500", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09500---------------------------");
J
jiyong 已提交
3540 3541
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3542
            console.info("SUB_Softbus_IPC_MessageParcel_09500: create object successfully.");
J
jiyong 已提交
3543 3544 3545
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

Y
yang-qibo 已提交
3546 3547 3548 3549 3550
            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 已提交
3551 3552 3553

            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3554
                console.info("SUB_Softbus_IPC_MessageParcel_09500: gIRemoteObject is undefined");
J
jiyong 已提交
3555
            }
Y
yang-qibo 已提交
3556 3557 3558 3559 3560 3561 3562
            await gIRemoteObject.sendRequest(CODE_WRITE_INT_MULTI, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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();
J
jiyong 已提交
3563 3564 3565 3566 3567 3568
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3569
            console.info("SUB_Softbus_IPC_MessageParcel_09500:error = " + error);
J
jiyong 已提交
3570
        }
Y
yang-qibo 已提交
3571 3572

        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09500---------------------------");
J
jiyong 已提交
3573 3574 3575
    });

    /*
Y
yang-qibo 已提交
3576 3577
     * @tc.number  SUB_Softbus_IPC_MessageParcel_09600
     * @tc.name    Writeint interface, illegal value verification
J
jiyong 已提交
3578 3579 3580
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3581 3582
    it("SUB_Softbus_IPC_MessageParcel_09600", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09600---------------------------");
J
jiyong 已提交
3583 3584
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3585
            console.info("SUB_Softbus_IPC_MessageParcel_09600: create object successfully.");
J
jiyong 已提交
3586 3587
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3588 3589
            expect(data.writeInt(2147483648) == true).assertTrue();

J
jiyong 已提交
3590 3591
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3592
                console.info("SUB_Softbus_IPC_MessageParcel_09600: gIRemoteObject is undefined");
J
jiyong 已提交
3593
            }
Y
yang-qibo 已提交
3594 3595 3596
            await gIRemoteObject.sendRequest(CODE_WRITE_INT_MULTI, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_09600: sendRequestis is " + result.errCode);
                expect(result.reply.readInt() == -2147483648).assertTrue();
J
jiyong 已提交
3597 3598 3599 3600 3601 3602
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3603
            console.info("SUB_Softbus_IPC_MessageParcel_09600:error = " + error);
J
jiyong 已提交
3604 3605
        }

Y
yang-qibo 已提交
3606
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09600---------------------------");
J
jiyong 已提交
3607 3608 3609
    });

    /*
Y
yang-qibo 已提交
3610 3611
     * @tc.number  SUB_Softbus_IPC_MessageParcel_09700
     * @tc.name    Writeint interface, illegal value verification
J
jiyong 已提交
3612 3613 3614
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3615 3616
    it("SUB_Softbus_IPC_MessageParcel_09700", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09700---------------------------");
J
jiyong 已提交
3617 3618
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3619
            console.info("SUB_Softbus_IPC_MessageParcel_09700: create object successfully.");
J
jiyong 已提交
3620 3621
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3622 3623
            expect(data.writeInt(-2147483649) == true).assertTrue();

J
jiyong 已提交
3624 3625
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3626
                console.info("SUB_Softbus_IPC_MessageParcel_09700: gIRemoteObject is undefined");
J
jiyong 已提交
3627
            }
Y
yang-qibo 已提交
3628 3629 3630
            await gIRemoteObject.sendRequest(CODE_WRITE_INT_MULTI, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_09700: sendRequestis is " + result.errCode);
                expect(result.reply.readInt() == 2147483647).assertTrue();
J
jiyong 已提交
3631 3632 3633 3634 3635 3636
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3637
            console.info("SUB_Softbus_IPC_MessageParcel_09700:error = " + error);
J
jiyong 已提交
3638
        }
Y
yang-qibo 已提交
3639 3640

        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09700---------------------------");
J
jiyong 已提交
3641 3642 3643
    });

    /*
Y
yang-qibo 已提交
3644 3645 3646
     * @tc.number  SUB_Softbus_IPC_MessageParcel_09800
     * @tc.name    Call the writefloat interface to write data to the messageparcel instance,
     *             and call readfloat to read data
J
jiyong 已提交
3647 3648 3649
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3650 3651
    it("SUB_Softbus_IPC_MessageParcel_09800", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09800---------------------------");
J
jiyong 已提交
3652 3653
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3654
            console.info("SUB_Softbus_IPC_MessageParcel_09800: create object successfully.");
J
jiyong 已提交
3655 3656
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3657 3658 3659
            var token = 2.2;
            var result = data.writeFloat(token);
            console.info("SUB_Softbus_IPC_MessageParcel_09800:run writeDoubleis is " + result);
J
jiyong 已提交
3660 3661 3662
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3663
                console.info("SUB_Softbus_IPC_MessageParcel_09800: gIRemoteObject is undefined");
J
jiyong 已提交
3664
            }
Y
yang-qibo 已提交
3665 3666 3667 3668 3669
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_09800: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readFloat();
                console.info("SUB_Softbus_IPC_MessageParcel_09800: run readFloat is " + replyReadResult);
                expect(replyReadResult == token).assertTrue();
J
jiyong 已提交
3670 3671 3672 3673 3674 3675
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3676
            console.info("SUB_Softbus_IPC_MessageParcel_09800:error = " + error);
J
jiyong 已提交
3677
        }
Y
yang-qibo 已提交
3678
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09800---------------------------");
J
jiyong 已提交
3679 3680 3681
    });

    /*
Y
yang-qibo 已提交
3682 3683
     * @tc.number  SUB_Softbus_IPC_MessageParcel_09900
     * @tc.name    Writefloat interface, boundary value verification
J
jiyong 已提交
3684 3685 3686
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3687 3688
    it("SUB_Softbus_IPC_MessageParcel_09900", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09900---------------------------");
J
jiyong 已提交
3689 3690
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3691
            console.info("SUB_Softbus_IPC_MessageParcel_09900: create object successfully.");
J
jiyong 已提交
3692 3693
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3694 3695 3696
            var token = 3.4E+38;
            var result = data.writeFloat(token);
            console.info("SUB_Softbus_IPC_MessageParcel_09900:run writeFloatis is " + result);
J
jiyong 已提交
3697 3698 3699
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3700
                console.info("SUB_Softbus_IPC_MessageParcel_09900: gIRemoteObject is undefined");
J
jiyong 已提交
3701
            }
Y
yang-qibo 已提交
3702 3703 3704 3705 3706
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_09900: sendRequestis is " + result.errCode);
                var newReadResult = result.reply.readFloat();
                console.info("SUB_Softbus_IPC_MessageParcel_09900: readFloat result is " + newReadResult);
                expect(newReadResult == token).assertTrue();
J
jiyong 已提交
3707 3708 3709 3710 3711 3712
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3713
            console.info("SUB_Softbus_IPC_MessageParcel_09900:error = " + error);
J
jiyong 已提交
3714 3715
        }

Y
yang-qibo 已提交
3716
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09900---------------------------");
J
jiyong 已提交
3717 3718 3719
    });

    /*
Y
yang-qibo 已提交
3720 3721
     * @tc.number  SUB_Softbus_IPC_MessageParcel_10000
     * @tc.name    Writefloat interface, boundary value verification
J
jiyong 已提交
3722 3723 3724
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3725 3726
    it("SUB_Softbus_IPC_MessageParcel_10000", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10000---------------------------");
J
jiyong 已提交
3727 3728
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3729
            console.info("SUB_Softbus_IPC_MessageParcel_10000: create object successfully.");
J
jiyong 已提交
3730 3731
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3732 3733 3734
            var token = 1.4E-45;
            var result = data.writeFloat(token);
            console.info("SUB_Softbus_IPC_MessageParcel_10000:run writeFloatis is " + result);
J
jiyong 已提交
3735 3736 3737
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3738
                console.info("SUB_Softbus_IPC_MessageParcel_10000: gIRemoteObject is undefined");
J
jiyong 已提交
3739
            }
Y
yang-qibo 已提交
3740 3741 3742 3743 3744
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_10000: sendRequestis is " + result.errCode);
                var newReadResult = result.reply.readFloat();
                console.info("SUB_Softbus_IPC_MessageParcel_10000: readFloat result is " + newReadResult);
                expect(newReadResult == token).assertTrue();
J
jiyong 已提交
3745 3746 3747 3748 3749 3750
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3751
            console.info("SUB_Softbus_IPC_MessageParcel_10000:error = " + error);
J
jiyong 已提交
3752 3753
        }

Y
yang-qibo 已提交
3754
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10000---------------------------");
J
jiyong 已提交
3755 3756 3757
    });

    /*
Y
yang-qibo 已提交
3758 3759
     * @tc.number  SUB_Softbus_IPC_MessageParcel_10100
     * @tc.name    Writefloat interface, boundary value verification
J
jiyong 已提交
3760 3761 3762
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3763 3764
    it("SUB_Softbus_IPC_MessageParcel_10100", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10100---------------------------");
J
jiyong 已提交
3765 3766
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3767
            console.info("SUB_Softbus_IPC_MessageParcel_10100: create object successfully.");
J
jiyong 已提交
3768 3769
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3770 3771 3772
            var token = 4.4E+38;
            var result = data.writeFloat(token);
            console.info("SUB_Softbus_IPC_MessageParcel_10100:run writeFloatis is " + result);
J
jiyong 已提交
3773 3774 3775
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Y
yang-qibo 已提交
3776
                console.info("SUB_Softbus_IPC_MessageParcel_10100: gIRemoteObject is undefined");
J
jiyong 已提交
3777
            }
Y
yang-qibo 已提交
3778 3779 3780 3781 3782
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_10100: sendRequestis is " + result.errCode);
                var newReadResult = result.reply.readFloat();
                console.info("SUB_Softbus_IPC_MessageParcel_10100: readFloat result is " + newReadResult);
                expect(newReadResult == token).assertTrue();
J
jiyong 已提交
3783 3784 3785 3786 3787 3788
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3789
            console.info("SUB_Softbus_IPC_MessageParcel_10100:error = " + error);
J
jiyong 已提交
3790 3791
        }

Y
yang-qibo 已提交
3792
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10100---------------------------");
J
jiyong 已提交
3793 3794 3795
    });

    /*
Y
yang-qibo 已提交
3796 3797
     * @tc.number  SUB_Softbus_IPC_MessageParcel_10200
     * @tc.name    Writefloat interface, illegal value validation
J
jiyong 已提交
3798 3799 3800
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3801 3802
    it("SUB_Softbus_IPC_MessageParcel_10200", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10200---------------------------");
J
jiyong 已提交
3803 3804
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3805 3806 3807 3808 3809
            console.info("SUB_Softbus_IPC_MessageParcel_10200: create object successfully.");

            var token = 'a';
            var result = data.writeFloat(token);
            console.info("SUB_Softbus_IPC_MessageParcel_10200:run writeFloatis is " + result);
J
jiyong 已提交
3810
            expect(result == false).assertTrue();
Y
yang-qibo 已提交
3811
            data.reclaim();
J
jiyong 已提交
3812
        } catch (error) {
Y
yang-qibo 已提交
3813 3814
            console.info("SUB_Softbus_IPC_MessageParcel_10200:error = " + error);
            expect(error != null).assertTrue();
J
jiyong 已提交
3815
        }
Y
yang-qibo 已提交
3816
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10200---------------------------");
J
jiyong 已提交
3817 3818 3819
    });

    /*
Y
yang-qibo 已提交
3820 3821
     * @tc.number  SUB_Softbus_IPC_MessageParcel_10300
     * @tc.name    Test messageparcel to deliver rawdata data
J
jiyong 已提交
3822 3823 3824
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3825 3826
    it("SUB_Softbus_IPC_MessageParcel_10300", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10300---------------------------");
J
jiyong 已提交
3827 3828
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3829
            console.info("SUB_Softbus_IPC_MessageParcel_10300: create object successfully.");
J
jiyong 已提交
3830

Y
yang-qibo 已提交
3831 3832 3833
            var Capacity = data.getRawDataCapacity()
            console.info("SUB_Softbus_IPC_MessageParcel_10300:run Capacity success, Capacity is " + Capacity);
            expect(Capacity).assertEqual(128*M);
J
jiyong 已提交
3834

Y
yang-qibo 已提交
3835 3836 3837 3838 3839 3840 3841
            var rawdata = [1, 2, 3]
            var result = data.writeRawData(rawdata, rawdata.length);
            console.info("SUB_Softbus_IPC_MessageParcel_10300:run writeRawDatais is " + result);
            expect(result == true).assertTrue();
            var newReadResult = data.readRawData(rawdata.length)
            console.info("SUB_Softbus_IPC_MessageParcel_10300:run readRawDatais is " + newReadResult);
            assertArrayElementEqual(newReadResult,rawdata);
J
jiyong 已提交
3842
        } catch (error) {
Y
yang-qibo 已提交
3843
            console.info("SUB_Softbus_IPC_MessageParcel_10300:error = " + error);
J
jiyong 已提交
3844
        }
Y
yang-qibo 已提交
3845 3846
        data.reclaim();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10300---------------------------");
J
jiyong 已提交
3847 3848 3849
    });

    /*
Y
yang-qibo 已提交
3850 3851
     * @tc.number  SUB_Softbus_IPC_MessageParcel_10400
     * @tc.name    Illegal value passed in from writerawdata interface
J
jiyong 已提交
3852 3853 3854
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3855 3856
    it("SUB_Softbus_IPC_MessageParcel_10400", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10400---------------------------");
J
jiyong 已提交
3857 3858
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
3859
            console.info("SUB_Softbus_IPC_MessageParcel_10400: create object successfully.");
J
jiyong 已提交
3860 3861
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
3862 3863 3864 3865 3866 3867 3868
            var Capacity = data.getRawDataCapacity()
            console.info("SUB_Softbus_IPC_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_MessageParcel_10400:run writeRawDatais is " + result);
            expect(result == false).assertTrue();
J
jiyong 已提交
3869 3870 3871 3872
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
3873
            console.info("SUB_Softbus_IPC_MessageParcel_10400:error = " + error);
J
jiyong 已提交
3874
        }
Y
yang-qibo 已提交
3875 3876

        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10400---------------------------");
J
jiyong 已提交
3877 3878 3879
    });

    /*
Y
yang-qibo 已提交
3880 3881
     * @tc.number  SUB_Softbus_IPC_MessageParcel_10500
     * @tc.name    Illegal value passed in from writerawdata interface
J
jiyong 已提交
3882 3883 3884
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922
    it("SUB_Softbus_IPC_MessageParcel_10500", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10500---------------------------");
        try{
            let parcel = new rpc.MessageParcel();
            console.info("SUB_Softbus_IPC_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_MessageParcel_10500: parcel write raw data result is : " + isWriteSuccess);
            expect(isWriteSuccess).assertTrue();
            let Capacity = parcel.getRawDataCapacity()
            console.info("SUB_Softbus_IPC_MessageParcel_10500:run Capacity success, Capacity is " + Capacity);
            expect(Capacity).assertEqual(128*M);
            if (gIRemoteObject == undefined){
                console.info("SUB_Softbus_IPC_MessageParcel_10500: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_10500: sendRequestis is " + result.errCode);
                expect(result.errCode == 0).assertTrue();
                let size = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_10500:run readIntis is " + size);
                expect(size).assertEqual(arr.length);
                let reCapacity = parcel.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_MessageParcel_10500:run Capacity is " + reCapacity);
                expect(reCapacity).assertEqual(128*M);
                let newReadResult = result.reply.readRawData(size);
                console.info("SUB_Softbus_IPC_MessageParcel_10500:run readRawDatais " + newReadResult);
                assertArrayElementEqual(newReadResult,arr);
            });
            parcel.reclaim();
            reply.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_10500:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10500---------------------------");
J
jiyong 已提交
3923 3924 3925
    });

    /*
Y
yang-qibo 已提交
3926 3927 3928 3929 3930 3931 3932
    * @tc.number  SUB_Softbus_IPC_MessageParcel_10600
    * @tc.name    Test messageParcel to deliver abnormal RawData data
    * @tc.desc    Function test
    * @tc.level   0
    */
    it("SUB_Softbus_IPC_MessageParcel_10600", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10600---------------------------");
J
jiyong 已提交
3933
        try{
Y
yang-qibo 已提交
3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973
            let parcel = new rpc.MessageParcel();
            console.info("SUB_Softbus_IPC_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_MessageParcel_10600: parcel write raw data result is : " + isWriteSuccess);
            expect(isWriteSuccess).assertTrue();
            let Capacity = parcel.getRawDataCapacity()
            console.info("SUB_Softbus_IPC_MessageParcel_10600:run Capacity success, Capacity is " + Capacity);
            expect(Capacity).assertEqual(128*M);
            if (gIRemoteObject == undefined){
                console.info("SUB_Softbus_IPC_MessageParcel_10600: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_10600: result is " + result.errCode);
                expect(result.errCode == 0).assertTrue();
                let size = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_10600:run readIntis is " + size);
                expect(size).assertEqual(arr.length + 1);
                let reCapacity = parcel.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_MessageParcel_10600:run Capacity is " + reCapacity);
                expect(reCapacity).assertEqual(128*M);
                let newReadResult = result.reply.readRawData(size);
                console.info("SUB_Softbus_IPC_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_MessageParcel_10600:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10600---------------------------");
    });
J
jiyong 已提交
3974

Y
yang-qibo 已提交
3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012
    /*
    * @tc.number  SUB_Softbus_IPC_MessageParcel_10700
    * @tc.name    Test messageParcel to deliver abnormal RawData data
    * @tc.desc    Function test
    * @tc.level   0
    */
    it("SUB_Softbus_IPC_MessageParcel_10700", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10700---------------------------");
        try{
            let parcel = new rpc.MessageParcel();
            console.info("SUB_Softbus_IPC_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_MessageParcel_10700: parcel write raw data result is : " + isWriteSuccess);
            expect(isWriteSuccess).assertTrue();
            let Capacity = parcel.getRawDataCapacity()
            console.info("SUB_Softbus_IPC_MessageParcel_10700:run Capacity success, Capacity is " + Capacity);
            if (gIRemoteObject == undefined){
                console.info("SUB_Softbus_IPC_MessageParcel_10700: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_10700: result is " + result.errCode);
                expect(result.errCode == 0).assertTrue();
                let size = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_10700:run readIntis is " + size);
                expect(size).assertEqual(arr.length - 1);
                let reCapacity = parcel.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_MessageParcel_10700:run Capacity success, Capacity is " + reCapacity);
                expect(reCapacity).assertEqual(128*M);
                let newReadResult = result.reply.readRawData(size);
                console.info("SUB_Softbus_IPC_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]);
J
jiyong 已提交
4013
            });
Y
yang-qibo 已提交
4014
            parcel.reclaim();
J
jiyong 已提交
4015 4016
            reply.reclaim();
        } catch (error) {
Y
yang-qibo 已提交
4017
            console.info("SUB_Softbus_IPC_MessageParcel_10700:error = " + error);
J
jiyong 已提交
4018
        }
Y
yang-qibo 已提交
4019 4020
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10700---------------------------");
J
jiyong 已提交
4021 4022 4023
    });

    /*
Y
yang-qibo 已提交
4024 4025 4026 4027 4028 4029 4030
    * @tc.number  SUB_Softbus_IPC_MessageParcel_10800
    * @tc.name    Test messageParcel to deliver out-of-bounds RawData data
    * @tc.desc    Function test
    * @tc.level   0
    */
    it("SUB_Softbus_IPC_MessageParcel_10800", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10800---------------------------");
J
jiyong 已提交
4031
        try{
Y
yang-qibo 已提交
4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057
            let parcel = new rpc.MessageParcel();
            console.info("SUB_Softbus_IPC_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_MessageParcel_10800: parcel write raw data result is : " + isWriteSuccess);
            expect(isWriteSuccess).assertTrue();
            let Capacity = parcel.getRawDataCapacity()
            console.info("SUB_Softbus_IPC_MessageParcel_10800:run Capacity success, Capacity is " + Capacity);
            if (gIRemoteObject == undefined){
                console.info("SUB_Softbus_IPC_MessageParcel_10800: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_10800: result is " + result.errCode);
                expect(result.errCode == 0).assertTrue();
                let size = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_10800:run readIntis is " + size);
                expect(size).assertEqual(arr.length);
                let reCapacity = parcel.getRawDataCapacity()
                console.info("SUB_Softbus_IPC_MessageParcel_10800:run Capacity is " + reCapacity);
                expect(reCapacity).assertEqual(128*M);
                let newReadResult = result.reply.readRawData(size);
                console.info("SUB_Softbus_IPC_MessageParcel_10800:run readRawDatais is " + newReadResult);
                assertArrayElementEqual(newReadResult,arr);
J
jiyong 已提交
4058
            });
Y
yang-qibo 已提交
4059
            parcel.reclaim();
J
jiyong 已提交
4060 4061
            reply.reclaim();
        } catch (error) {
Y
yang-qibo 已提交
4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115
            console.info("SUB_Softbus_IPC_MessageParcel_10800:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10800---------------------------");
    });

    /*
    * @tc.number  SUB_Softbus_IPC_MessageParcel_10900
    * @tc.name    Test messageParcel to deliver illegal RawData data
    * @tc.desc    Function test
    * @tc.level   0
    */
    it("SUB_Softbus_IPC_MessageParcel_10900", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10900---------------------------");
        try{
            let parcel = new rpc.MessageParcel();
            console.info("SUB_Softbus_IPC_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_MessageParcel_10900: parcel write raw data result is : " + isWriteSuccess);
            expect(isWriteSuccess).assertTrue();
            let reCapacity = parcel.getRawDataCapacity()
            console.info("SUB_Softbus_IPC_MessageParcel_10900:run Capacity success, Capacity is " + reCapacity);
            expect(reCapacity).assertEqual(128*M);
            parcel.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_10900:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10900---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_11000
     * @tc.name    Call the writeremoteobject interface to serialize the remote object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_11000", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11000---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_11000: create object successfully.");

            let testRemoteObject = new TestRemoteObject("testObject");
            var result = data.writeRemoteObject(testRemoteObject);
            console.info("SUB_Softbus_IPC_MessageParcel_11000: result is " + result);
            expect(result == true).assertTrue();
            data.readRemoteObject()
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_11000:error = " + error);
J
jiyong 已提交
4116 4117
        }
        data.reclaim();
Y
yang-qibo 已提交
4118
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11000---------------------------");
J
jiyong 已提交
4119 4120 4121
    });

    /*
Y
yang-qibo 已提交
4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147
     * @tc.number  SUB_Softbus_IPC_MessageParcel_11100
     * @tc.name    Call the writeremoteobject interface to serialize the remote object and pass in the empty object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_11100", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11100---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_11100: create object successfully.");

            var token = {}
            var result = data.writeRemoteObject(token);
            console.info("SUB_Softbus_IPC_MessageParcel_11100: result is " + result);
            expect(result == false).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_11100:error = " + error);
        }
        data.reclaim();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11100---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_11200
     * @tc.name    Call the writesequenceable interface to write the custom serialized
     *             object to the messageparcel instance
J
jiyong 已提交
4148 4149 4150
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4151 4152
    it("SUB_Softbus_IPC_MessageParcel_11200", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11200---------------------------");
J
jiyong 已提交
4153 4154
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
4155
            console.info("SUB_Softbus_IPC_MessageParcel_11200: create object successfully.");
J
jiyong 已提交
4156 4157
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
4158 4159 4160 4161 4162 4163 4164 4165 4166

            let sequenceable = new MySequenceable(1, "aaa");
            let result = data.writeSequenceable(sequenceable);
            console.info("SUB_Softbus_IPC_MessageParcel_11200: writeSequenceable is " + result);
            expect(result == true).assertTrue();
            let ret = new MySequenceable(0, "");
            let result2 = data.readSequenceable(ret);
            console.info("SUB_Softbus_IPC_MessageParcel_11200: readSequenceable is " + result2);
            expect(result2 == true).assertTrue();
J
jiyong 已提交
4167
        } catch (error) {
Y
yang-qibo 已提交
4168
            console.info("SUB_Softbus_IPC_MessageParcel_11200:error = " + error);
J
jiyong 已提交
4169 4170
        }
        data.reclaim();
Y
yang-qibo 已提交
4171
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11200---------------------------");
J
jiyong 已提交
4172 4173 4174
    });

    /*
Y
yang-qibo 已提交
4175 4176 4177
     * @tc.number  SUB_Softbus_IPC_MessageParcel_11300
     * @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 已提交
4178 4179 4180
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4181 4182
    it("SUB_Softbus_IPC_MessageParcel_11300", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11300---------------------------");
J
jiyong 已提交
4183 4184
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
4185
            console.info("SUB_Softbus_IPC_MessageParcel_11300: create object successfully.");
J
jiyong 已提交
4186 4187
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202

            data.writeNoException();
            console.info("SUB_Softbus_IPC_MessageParcel_11300: run writeNoException success");
            expect(data.writeInt(6) == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_11300: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_NOEXCEPTION, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_11300: sendRequestis is " + result.errCode);
                result.reply.readException()
                var replyData = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_11300: readResult is " + replyData);
                expect(replyData == 6).assertTrue();
J
jiyong 已提交
4203
            });
Y
yang-qibo 已提交
4204

J
jiyong 已提交
4205 4206 4207 4208
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
4209
            console.info("SUB_Softbus_IPC_MessageParcel_11300:error = " + error);
J
jiyong 已提交
4210
        }
Y
yang-qibo 已提交
4211
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11300---------------------------");
J
jiyong 已提交
4212 4213 4214
    });

    /*
Y
yang-qibo 已提交
4215 4216 4217
     * @tc.number  SUB_Softbus_IPC_MessageParcel_11400
     * @tc.name    If the data on the server is abnormal, the client calls readexception
     *             to judge whether the server is abnormal
J
jiyong 已提交
4218 4219 4220
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4221 4222 4223 4224 4225 4226 4227
    it("SUB_Softbus_IPC_MessageParcel_11400", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11400---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_11400: create object successfully.");
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
4228

Y
yang-qibo 已提交
4229 4230 4231 4232 4233 4234 4235 4236 4237 4238
            data.writeNoException();
            console.info("SUB_Softbus_IPC_MessageParcel_11400: run writeNoException success");
            expect(data.writeInt(1232222223444) == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_11400: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_NOEXCEPTION, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_11400: sendRequestis is " + result.errCode);
J
jiyong 已提交
4239
                result.reply.readException()
Y
yang-qibo 已提交
4240 4241 4242
                var replyData = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_11400: readResult is " + replyData);
            });
Z
zhangpa2021 已提交
4243

Y
yang-qibo 已提交
4244 4245 4246 4247 4248
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_11400:error = " + error);
Z
zhangpa2021 已提交
4249
        }
Y
yang-qibo 已提交
4250 4251
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11400---------------------------");
    });
J
jiyong 已提交
4252 4253

    /*
Y
yang-qibo 已提交
4254 4255
     * @tc.number  SUB_Softbus_IPC_MessageParcel_11500
     * @tc.name    Serializable object marshaling and unmarshalling test
J
jiyong 已提交
4256 4257 4258
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272
    it("SUB_Softbus_IPC_MessageParcel_11500", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11500---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_11500: writeSequenceable is " + result);
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_11500: gIRemoteObject is undefined");
J
jiyong 已提交
4273
            }
Y
yang-qibo 已提交
4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288
            await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLE, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_11500: sendRequestis is " + result.errCode);
                var s = new MySequenceable(null,null)
                var resultReply = result.reply.readSequenceable(s);
                console.info("SUB_Softbus_IPC_MessageParcel_11500: run readSequenceable is " + resultReply);
                expect(resultReply == true).assertTrue();
                expect(s.str == sequenceable.str).assertTrue();
                expect(s.num == sequenceable.num).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_11500:error = " + error);
Z
zhangpa2021 已提交
4289 4290
        }

Y
yang-qibo 已提交
4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11500---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_11600
     * @tc.name    Non serializable object marshaling test
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_11600", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11600---------------------------");
Z
zhangpa2021 已提交
4302
        try{
Y
yang-qibo 已提交
4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 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 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 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 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 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 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 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 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_11600: writeSequenceable is " + result);
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_11600: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLE, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_11600: sendRequestis is " + result.errCode);
                var s = new MySequenceable(null,null)
                var replyReadResult = reply.readSequenceable(s);
                console.info("SUB_Softbus_IPC_MessageParcel_11600: run readSequenceable is " + replyReadResult);
                expect(replyReadResult == true).assertTrue();
                expect(s.str == sequenceable.str).assertTrue();
                expect(s.num == sequenceable.num).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_11600:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11600---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_11700
     * @tc.name    The server did not send a serializable object, and the client was ungrouped
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_11700", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11700---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_11700 writeInt is " + result);
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_11700: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_11700: sendRequestis is " + result.errCode);
                var s = new MySequenceable(0,null)
                var replyReadResult = result.reply.readSequenceable(s);
                console.info("SUB_Softbus_IPC_MessageParcel_11700: run readSequenceable is" + replyReadResult);
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_11700:error = " + error);
        }

        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11700---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_11800
     * @tc.name    Call the writesequenceable interface to write the custom serialized object to the
     *             messageparcel instance, and call readsequenceable to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_11800", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11800---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_11800: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLE, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_11800: sendRequestis is " + result.errCode);
                var s = new MySequenceable(null,null)
                var replyReadResult = result.reply.readSequenceable(s);
                console.info("SUB_Softbus_IPC_MessageParcel_11800: run readSequenceable is" + replyReadResult);
                expect(s.str == sequenceable.str).assertTrue();
                expect(s.num == sequenceable.num).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_11800:error = " + error);
        }

        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11800---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_11900
     * @tc.name    Call the writesequenceablearray interface to write the custom serialized object to the
     *             messageparcel instance, and call readsequenceablearray to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_11900", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11900---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_11900: writeSequenceableArray is " + result);
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_11900: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLEARRAY, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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_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)
                }
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_11900:error = " + error);
        }

        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11900---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_12000
     * @tc.name    Call the writesequenceablearray interface to write the custom serialized object to the
     *             messageparcel instance, and call readsequenceablearray to read the data
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_12000", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12000---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_12000: writeSequenceable is " + result);
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_12000: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLEARRAY, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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_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)
                }
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_12000:error = " + error);
        }

        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12000---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_12100
     * @tc.name    Call the writesequenceablearray interface to write the custom
     *             serialized object to the messageparcel instance
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_12100", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12100---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_12100: create object successfully.");
            var sequenceable = 1;
            var result = data.writeSequenceableArray(sequenceable);
            console.info("SUB_Softbus_IPC_MessageParcel_12100: writeSequenceable is " + result);
            expect(result == false).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_12100:error = " + error);
            expect(error != null).assertTrue();
        }
        data.reclaim();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12100---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_12200
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_12200", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_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()
                }
            }
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_12200: writeRemoteObjectArray is " + result);
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageParcel_12200: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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);
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_12200:error = " + error);
        }

        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12200---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_12300
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_12300", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_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()
                }
            }
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_12300: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_12300: sendRequestis is " + result.errCode);
                expect(result.errCode == 0).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_12300:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12300---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_12400
     * @tc.name    Test messageparcel delivery file descriptor object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_12400", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_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_MessageParcel_12400---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_12500
     * @tc.name    Test messageparcel to deliver the reply message received in promise across processes
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_12500", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12500---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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) => {
                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")
            });
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_12500:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12500---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_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_MessageParcel_12600", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12600---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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()

            gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option,(err, result) => {
                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")
            });
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_12600:error = " + error);
        }
        sleep(2000)
        data.reclaim();
        reply.reclaim();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12600---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_12700
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_12700", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12700---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_12700:error = " + error);
        }
        sleep(2000)
        data.reclaim();
        reply.reclaim();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12700---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_12800
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_12800", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12800---------------------------");
        try{
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_12800:error = " + error);
        }
        sleep(2000)
        data.reclaim();
        reply.reclaim();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12800---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_12900
     * @tc.name    Test messageparcel to pass an object of type iremoteobject across processes
     * @tc.desc    Function test
     * @tc.level   0
     */
    it('SUB_Softbus_IPC_MessageParcel_12900', 0, async function(done) {
        console.info("---------------------start SUB_Softbus_IPC_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_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_MessageParcel_12900 sendRequest done, error code: " + result.errCode)
                expect(result.errCode).assertEqual(0)
                result.reply.readException()
            })
                data.reclaim()
                reply.reclaim()
                console.info("test done")
    } catch(error) {
            console.info("SUB_Softbus_IPC_MessageParcel_12900: error = " + error);
        }
            console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12900---------------------------");
    })


    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_13000
     * @tc.name    Test messageparcel to pass an array of iremoteobject objects across processes
     * @tc.desc    Function test
     * @tc.level   0
     */
    it('SUB_Softbus_IPC_MessageParcel_13000', 0, async function(done) {
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13000---------------------------");

        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()
            }
        }
        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)
J
jiyong 已提交
4973
            expect(result == true).assertTrue()
Y
yang-qibo 已提交
4974
            console.info("SUB_Softbus_IPC_MessageParcel_13000 result is:" + result)
J
jiyong 已提交
4975 4976
            expect(data.writeInt(123)).assertTrue()
            expect(data.writeString("rpcListenerTest")).assertTrue()
Z
zhangpa2021 已提交
4977
            await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY_1, data, reply, option)
Y
yang-qibo 已提交
4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026
            .then((result)=> {
                console.info("SUB_Softbus_IPC_MessageParcel_13000 sendRequest done, error code: " + result.errCode)
                expect(result.errCode).assertEqual(0)
                result.reply.readException()
            })

                data.reclaim()
                reply.reclaim()
                console.info("test done")
        } catch(error) {
            console.info("SUB_Softbus_IPC_MessageParcel_13000: error = " + error);
            }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13000---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_13100
     * @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
     */
    it('SUB_Softbus_IPC_MessageParcel_13100', 0, async function(done) {
        console.info("---------------------start SUB_Softbus_IPC_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()
            }
        }

        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_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)
Z
zhangpa2021 已提交
5027 5028
            .then((result)=> {
                console.info("sendRequest done, error code: " + result.errCode)
Z
zhangpa2021 已提交
5029
                expect(result.errCode).assertEqual(0)
Z
zhangpa2021 已提交
5030
                result.reply.readException()
Z
zhangpa2021 已提交
5031
            })
Z
zhangpa2021 已提交
5032

Y
yang-qibo 已提交
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 5064 5065 5066 5067 5068 5069 5070 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 5101 5102 5103 5104 5105 5106 5107 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 5136 5137 5138 5139 5140 5141 5142 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 5171 5172 5173 5174 5175 5176 5177 5178 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 5211 5212 5213 5214 5215 5216 5217 5218 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 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 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 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 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 5404 5405 5406 5407 5408 5409 5410 5411 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 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 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 5640 5641 5642 5643 5644 5645 5646 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 5682 5683 5684 5685 5686 5687 5688 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 5730 5731 5732 5733 5734 5735 5736 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 5768 5769 5770 5771 5772 5773 5774 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 5810
                data.reclaim()
                reply.reclaim()
                console.info("test done")
        } catch(error) {
            console.info("SUB_Softbus_IPC_MessageParcel_13100: error = " + error);
            }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13100---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_13200
     * @tc.name    Invoke the rewindRead interface, write the POS, and read the offset value
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_13200", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13200---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_13200: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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_MessageParcel_13200:run readIntis is " + number1 + ";" + number2);
                expect(number2).assertEqual(12);

                let reString = result.reply.readString();
                console.info("SUB_Softbus_IPC_MessageParcel_13200:run readStringis is " + reString);
                expect(reString).assertEqual("");
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_13200:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13200---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_13300
     * @tc.name    Invoke the rewindRead interface, write the POS, and read the offset value
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_13300", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13300---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_13300: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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_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_MessageParcel_13300:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13300---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_13400
     * @tc.name    Invoke the rewindWrite interface, write the POS, and read the offset value
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_13400", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11800---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_13400: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_13400: sendRequestis is " + result.errCode);
                expect(result.errCode == 0).assertTrue();
                let number = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_13400:run readIntis is " + number);
                expect(number).assertEqual(5);
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_13400:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13400---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_13500
     * @tc.name    Invoke the rewindWrite interface, write the POS, and read the offset value
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_13500", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13500---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_13500: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_13500: sendRequestis is " + result.errCode);
                expect(result.errCode == 0).assertTrue();
                let number = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_13500:run readIntis is " + number);
                expect(number != 5).assertTrue();
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_13500:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13500---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_13600
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_13600", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13600---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_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_MessageParcel_13600: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_13600: sendRequestis is " + result.errCode);
                expect(result.errCode == 0).assertTrue();
                let getMePaCapacity = result.reply.getCapacity();
                console.info("SUB_Softbus_IPC_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_MessageParcel_13600:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13600---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_13700
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_13700", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13700---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_13700: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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_MessageParcel_13700:run getCapacityis is " + getMeCa);
                expect(getMeCa).assertEqual(("constant".length * 2) + 8);
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_13700:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13700---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_13800
     * @tc.name    SetCapacity Tests the storage capacity threshold of the MessageParcel instance
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_13800", 0, async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13800---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_13800: create object successfully.");

            let getCapacitydata0 = data.getCapacity();
            console.info("SUB_Softbus_IPC_MessageParcel_13800:run getCapacityis is " + getCapacitydata0);

            expect(data.writeString("constant")).assertTrue();
            let getSizedata = data.getSize();
            console.info("SUB_Softbus_IPC_MessageParcel_13800:run getSizeis is " + getSizedata);
            let getCapacitydata = data.getCapacity();
            console.info("SUB_Softbus_IPC_MessageParcel_13800:run getCapacityis is " + getCapacitydata);

            let setCapacitydata1 = data.setCapacity(getSizedata + 1);
            console.info("SUB_Softbus_IPC_MessageParcel_13800:run setCapacityis is " + setCapacitydata1);
            expect(setCapacitydata1).assertTrue();
            console.info("SUB_Softbus_IPC_MessageParcel_13800:run getCapacityis is " + data.getCapacity());
            expect(data.getCapacity()).assertEqual((getSizedata + 1));

            let setCapacitydata2 = data.setCapacity(getSizedata);
            console.info("SUB_Softbus_IPC_MessageParcel_13800:run setCapacityis is " + setCapacitydata2);
            expect(setCapacitydata2).assertEqual(false);
            console.info("SUB_Softbus_IPC_MessageParcel_13800:run getCapacityis is " + data.getCapacity());
            expect(data.getCapacity()).assertEqual((getSizedata + 1));

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

    /*
    * @tc.number  SUB_Softbus_IPC_MessageParcel_13900
    * @tc.name    SetCapacity Tests the storage capacity threshold of the MessageParcel instance
    * @tc.desc    Function test
    * @tc.level   0
    */
    it("SUB_Softbus_IPC_MessageParcel_13900", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_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_MessageParcel_13900: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_13900: sendRequestis is " + result.errCode);
                expect(result.errCode == 0).assertTrue();

                let getSizeresult = result.reply.getSize();
                console.info("SUB_Softbus_IPC_MessageParcel_13900:run getSizeis is " + getSizeresult);
                let setCapacityresult = result.reply.getCapacity();
                console.info("SUB_Softbus_IPC_MessageParcel_13900:run getCapacityis is " + setCapacityresult);
                expect(setCapacityresult).assertEqual(("constant".length * 2) + 8);
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_13900:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13900---------------------------");
    });

    /*
    * @tc.number  SUB_Softbus_IPC_MessageParcel_14000
    * @tc.name    SetCapacity Tests the storage capacity threshold of the MessageParcel instance
    * @tc.desc    Function test
    * @tc.level   0
    */
    it("SUB_Softbus_IPC_MessageParcel_14000", 0, async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14000---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_14000: create object successfully.");
            let getSizedata = data.getSize();
            console.info("SUB_Softbus_IPC_MessageParcel_14000:run setCapacityis is " + getSizedata);
            expect(getSizedata).assertEqual(0);

            let setMeCapacity = data.setCapacity(4*G - 1);
            console.info("SUB_Softbus_IPC_MessageParcel_14000:run setCapacityis is " + setMeCapacity);
            expect(setMeCapacity).assertTrue();
            let getCapacitydata = data.getCapacity();
            console.info("SUB_Softbus_IPC_MessageParcel_14000:run getCapacityis is " + getCapacitydata);
            expect(getCapacitydata).assertEqual(4*G - 1);

            let setMeCapacity1 = data.setCapacity(4*G);
            console.info("SUB_Softbus_IPC_MessageParcel_14000:run setCapacityis is " + setMeCapacity1);
            expect(setMeCapacity1).assertEqual(false);
            let getCapacitydata1 = data.getCapacity();
            console.info("SUB_Softbus_IPC_MessageParcel_14000:run getCapacityis is " + getCapacitydata1);

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

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_14100
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_14100", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14100---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_14100:run setSizeis is " + setSizedata);
            expect(setSizedata).assertTrue();
            expect(data.writeString("constant")).assertTrue();
            let getSizedata = data.getSize();
            console.info("SUB_Softbus_IPC_MessageParcel_14100:run getSizeis is " + getSizedata);
            expect(getSizedata).assertEqual(("constant".length * 2) + 8);

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

                let getSizeresult = result.reply.getSize();
                console.info("SUB_Softbus_IPC_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_MessageParcel_14100:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14100---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_14200
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_14200", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14200---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_14200:run setSizeis is " + getSizedata);
            expect(getSizedata).assertEqual(0);

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

                let getSizeresult = result.reply.getSize();
                console.info("SUB_Softbus_IPC_MessageParcel_14200:run getSizeis is " + getSizeresult);
                expect(getSizeresult).assertEqual( 8);
                let writeresult = result.reply.readString();
                console.info("SUB_Softbus_IPC_MessageParcel_14200:run readStringis is " + writeresult);
                expect(writeresult).assertEqual("");
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_14200:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14200---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_14300
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_14300", 0, async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14300---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_14300: create object successfully.");
            expect(data.getSize()).assertEqual(0);
            expect(data.writeString("constant")).assertTrue();
            expect(data.getSize()).assertEqual(("constant".length * 2) + 8);

            let getCapacitydata = data.getCapacity();
            console.info("SUB_Softbus_IPC_MessageParcel_14300:run getCapacityis is " + getCapacitydata);

            let setSizedata1 = data.setSize(getCapacitydata);
            console.info("SUB_Softbus_IPC_MessageParcel_14300:run setSizeis is " + setSizedata1);
            expect(setSizedata1).assertTrue();

            expect(data.getSize()).assertEqual(getCapacitydata);

            let setSizedata2 = data.setSize(getCapacitydata + 1);
            console.info("SUB_Softbus_IPC_MessageParcel_14300:run setSizeis is " + setSizedata2);
            expect(setSizedata2).assertEqual(false);

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

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_14400
     * @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
     */
    it("SUB_Softbus_IPC_MessageParcel_14400", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14400---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_14400: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_14400: sendRequestis is " + result.errCode);
                expect(result.errCode == 0).assertTrue();

                expect(result.reply.readString()).assertEqual("constant");
                expect(result.reply.getSize()).assertEqual(("constant".length * 2) + 8);

                let getCapacityresult = result.reply.getCapacity();
                console.info("SUB_Softbus_IPC_MessageParcel_14400:run getCapacityis is " + getCapacityresult);

                let setSizeresult1 = result.reply.setSize(getCapacityresult);
                console.info("SUB_Softbus_IPC_MessageParcel_14400:run setSizeis is " + setSizeresult1);
                expect(setSizeresult1).assertTrue();
                expect(result.reply.getSize()).assertEqual(getCapacityresult);

                let setSizeresult2 = result.reply.setSize(getCapacityresult + 1);
                console.info("SUB_Softbus_IPC_MessageParcel_14400:run setSizeis is " + setSizeresult2);
                expect(setSizeresult2).assertEqual(false);
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_14400:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14400---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_14500
     * @tc.name    Validate the setSize boundary value in the MessageParcel instance
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_14500", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14500---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_14500: create object successfully.");

            let getCapacitydata = data.getCapacity();
            console.info("SUB_Softbus_IPC_MessageParcel_14500:run getCapacityis is " + getCapacitydata);
            expect(getCapacitydata).assertEqual(0);

            let setSizedata1 = data.setSize(4*G);
            console.info("SUB_Softbus_IPC_MessageParcel_14500:run setSizeis is " + setSizedata1);
            expect(setSizedata1).assertTrue();
            let getSizedata1 = data.getSize();
            console.info("SUB_Softbus_IPC_MessageParcel_14500:run getCapacityis is " + getSizedata1);
            expect(getSizedata1).assertEqual(0);

            let setSizedata = data.setSize(4*G - 1);
            console.info("SUB_Softbus_IPC_MessageParcel_14500:run setSizeis is " + setSizedata);
            expect(setSizedata).assertEqual(false);
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_14500:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14500---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_14600
     * @tc.name    Verify that setSize is out of bounds in a MessageParcel instance
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_14600", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14600---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_MessageParcel_14600: create object successfully.");

            let setSizedata = data.setSize(0);
            console.info("SUB_Softbus_IPC_MessageParcel_14600:run setCapacityis is " + setSizedata);
            expect(setSizedata).assertTrue();
            expect(data.getSize()).assertEqual(0);

            let setSizedata1 = data.setSize(2*4*G);
            console.info("SUB_Softbus_IPC_MessageParcel_14600:run setCapacityis is " + setSizedata1);
            expect(setSizedata1).assertTrue();
            expect(data.getSize()).assertEqual(0);

            let setSizedata2 = data.setSize(2*G);
            console.info("SUB_Softbus_IPC_MessageParcel_14600:run setCapacityis is " + setSizedata2);
            expect(setSizedata2).assertEqual(false);
            data.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_14600:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14600---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_14700
     * @tc.name    Obtaining the Writable and Readable Byte Spaces of MessageParcel
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_14700", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14700---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_14700:result getWritePosition is getWritableBytes is "
                + getwbyte1 + ";" + getwbyte2);
            if (gIRemoteObject == undefined){
                console.info("SUB_Softbus_IPC_MessageParcel_14700: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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_MessageParcel_14700:result readInt is " + readint);
                let getrbyte2 = result.reply.getReadableBytes();
                console.info("SUB_Softbus_IPC_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_MessageParcel_14700:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14700---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_14800
     * @tc.name    Obtains the writeable and readable byte space and read position of the MessageParcel
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_14800", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14800---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_14800:result getWritePosition is "
                + getwPos + "getWritableBytes is " + getwbyte);
            if (gIRemoteObject == undefined){
                console.info("SUB_Softbus_IPC_MessageParcel_14800: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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_MessageParcel_14800:result readInt is " + readint);
                let getrPos = result.reply.getReadPosition();
                console.info("SUB_Softbus_IPC_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_MessageParcel_14800:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14800---------------------------");
    });

    /*
    * @tc.number  SUB_Softbus_IPC_MessageParcel_14900
    * @tc.name    Obtains the writeable and readable byte space and read position of the MessageParcel
    * @tc.desc    Function test
    * @tc.level   0
    */
    it("SUB_Softbus_IPC_MessageParcel_14900", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14900---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_14900:result getWritePosition is "
                + getwPos + "getWritableBytes is " + getwbyte);
            if (gIRemoteObject == undefined){
                console.info("SUB_Softbus_IPC_MessageParcel_14900: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_14900: sendRequestis is " + result.errCode);
                expect(result.errCode == 0).assertTrue();
                let readint = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_14900:result readInt is " + readint);
                let getrPos = result.reply.getReadPosition();
                let getrbyte = result.reply.getReadableBytes();
                console.info("SUB_Softbus_IPC_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_MessageParcel_14900:result getReadPosition is "
                    + getrPos1 + "getReadableBytes is" + getrbyte1);
                expect(getrbyte1).assertEqual(0);
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_14900:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14900---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_15000
     * @tc.name    Test fixed MessageParcel space size to pass rawData data
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_15000", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_15000---------------------------");
        try{
            let maxsize = 1024;
            let data = rpc.MessageParcel.create();
            let Capacity = data.getRawDataCapacity()
            console.info("SUB_Softbus_IPC_MessageParcel_15000:run Capacity success, Capacity is " + Capacity);
            let rawdata = [1, 2, 3];
            let option = new rpc.MessageOption();
            let reply = rpc.MessageParcel.create();
            expect(data.writeInt(maxsize)).assertTrue();
            let result = data.writeRawData(rawdata, maxsize);
            console.info("SUB_Softbus_IPC_MessageParcel_15000:run writeRawDatais is " + result);
            expect(result).assertTrue();
            if (gIRemoteObject == undefined){
                console.info("SUB_Softbus_IPC_MessageParcel_15000: gIRemoteObject undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageParcel_15000: result is " + result.errCode);
                expect(result.errCode == 0).assertTrue();
                let size = result.reply.readInt();
                console.info("SUB_Softbus_IPC_MessageParcel_15000:run readIntis is " + size);
                var newReadResult = result.reply.readRawData(size)
                console.info("SUB_Softbus_IPC_MessageParcel_15000:run readRawDatais is "
                    + newReadResult.length);
                expect(newReadResult != rawdata).assertTrue();
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_15000:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_15000---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_15100
     * @tc.name    Obtains the write and read positions of the MessageParcel
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_15100", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_15100---------------------------");
        try{
            let data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageParcel_15100:result getWritePosition is "
                + getwPos1 + ";" + getwPos2);
            if (gIRemoteObject == undefined){
                console.info("SUB_Softbus_IPC_MessageParcel_15100: gIRemoteObject undefined");
Z
zhangpa2021 已提交
5811
            }
Y
yang-qibo 已提交
5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 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 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032
            await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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_MessageParcel_15100:result readInt is " + readint);
                let getrPos2 = result.reply.getReadPosition();
                console.info("SUB_Softbus_IPC_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_MessageParcel_15100:error = " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_15100---------------------------");
    });


    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_15200
     * @tc.name    Test messageparcel delivery file descriptor object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_15200", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_15200---------------------------");
        try{
            let testab = new TestProxy(gIRemoteObject).asObject();
            console.info("SUB_Softbus_IPC_MessageParcel_15200: run TestProxy success" + testab);
            expect(testab != null).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_15200:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_15200---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageParcel_15300
     * @tc.name    Test messageparcel delivery file descriptor object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageParcel_15300", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageParcel_15300---------------------------");
        try{
            let testRemoteObject = new TestRemoteObject("testObject");
            console.info("SUB_Softbus_IPC_MessageParcel_15300: TestRemoteObject is" + testRemoteObject);
            let testab = testRemoteObject.asObject();
            console.info("SUB_Softbus_IPC_MessageParcel_15300: asObject is" + testab);
            expect(testab != null).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_MessageParcel_15300:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageParcel_15300---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_MessageOption_00100
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageOption_00100",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_00100---------------------------");
        try{
            let option = new rpc.MessageOption();
            console.info("SUB_Softbus_IPC_MessageOption_00100: create object successfully.");
            let time = option.getWaitTime();
            console.info("SUB_Softbus_IPC_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_MessageOption_00100: run getWaitTime success, time is " + time2);
            expect(time2).assertEqual(16);
        }catch(error){
            console.info("SUB_Softbus_IPC_MessageOption_00100: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageOption_00100---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_MessageOption_00200
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageOption_00200",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_00200---------------------------");
        try{
            let option = new rpc.MessageOption();
            console.info("SUB_Softbus_IPC_MessageOption_00200: create object successfully.");
            let time = option.getWaitTime();
            console.info("SUB_Softbus_IPC_MessageOption_00200: run getWaitTime success, time is " + time);
            expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);

            option.setWaitTime(0);
            let time2 = option.getWaitTime();
            console.info("SUB_Softbus_IPC_MessageOption_00200: run getWaitTime success, time is " + time2);
            expect(time2).assertEqual(rpc.MessageOption.TF_WAIT_TIME);

            option.setWaitTime(60);
            let time3 = option.getWaitTime();
            console.info("SUB_Softbus_IPC_MessageOption_00200: run getWaitTime success, time is " + time3);
            expect(time3).assertEqual(60);

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

    /*
     * @tc.number  SUB_Softbus_IPC_MessageOption_00300
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageOption_00300",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_00300---------------------------");
        try{
            let option = new rpc.MessageOption();
            console.info("SUB_Softbus_IPC_MessageOption_00300: create object successfully.");
            let time = option.getWaitTime();
            console.info("SUB_Softbus_IPC_MessageOption_00300: run getWaitTime success, time is " + time);
            expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);

            option.setWaitTime(-1);
            let time2 = option.getWaitTime();
            console.info("SUB_Softbus_IPC_MessageOption_00300: run getWaitTime success, time is " + time2);
            expect(time2).assertEqual(rpc.MessageOption.TF_WAIT_TIME);
        }catch(error){
            console.info("SUB_Softbus_IPC_MessageOption_00300: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageOption_00300---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_MessageOption_00400
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageOption_00400",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_00400---------------------------");
        try{
            let option = new rpc.MessageOption();
            console.info("SUB_Softbus_IPC_MessageOption_00400: create object successfully.");
            let time = option.getWaitTime();
            console.info("SUB_Softbus_IPC_MessageOption_00400: run getWaitTime success, time is " + time);
            expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);

            option.setWaitTime(61);
            let time2 = option.getWaitTime();
            console.info("SUB_Softbus_IPC_MessageOption_00400: run getWaitTime success, time is " + time2);
            expect(time2).assertEqual(61);
        }catch(error){
            console.info("SUB_Softbus_IPC_MessageOption_00400: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageOption_00400---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_MessageOption_00500
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageOption_00500",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_00500---------------------------");
        try{
            let option = new rpc.MessageOption();
            console.info("SUB_Softbus_IPC_MessageOption_00500: create object successfully.");
            let flog = option.getFlags();
            console.info("SUB_Softbus_IPC_MessageOption_00500: run getFlags success, flog is " + flog);
            expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);

            option.setFlags(1)
            console.info("SUB_Softbus_IPC_MessageOption_00500: run setFlags success");
            let flog2 = option.getFlags();
            console.info("SUB_Softbus_IPC_MessageOption_00500: run getFlags success, flog2 is " + flog2);
            expect(flog2).assertEqual(rpc.MessageOption.TF_ASYNC);
        }catch(error){
            console.info("SUB_Softbus_IPC_MessageOption_00500: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageOption_00500---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_MessageOption_00600
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageOption_00600",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_00600---------------------------");
        try{
            let option = new rpc.MessageOption();
            console.info("SUB_Softbus_IPC_MessageOption_00600: create object successfully.");
            let flog = option.getFlags();
            console.info("SUB_Softbus_IPC_MessageOption_00600: run getFlags success, flog is " + flog);
            expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);

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

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

    /*
Y
yang-qibo 已提交
6036 6037
     * @tc.number  SUB_Softbus_IPC_MessageOption_00700
     * @tc.name    Basic method of testing messageoption
J
jiyong 已提交
6038 6039 6040
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6041 6042
    it("SUB_Softbus_IPC_MessageOption_00700",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_00700---------------------------");
Z
zhangpa2021 已提交
6043
        try{
Y
yang-qibo 已提交
6044 6045 6046 6047 6048
            let option = new rpc.MessageOption();
            console.info("SUB_Softbus_IPC_MessageOption_00700: create object successfully.");
            let flog = option.getFlags();
            console.info("SUB_Softbus_IPC_MessageOption_00700: run getFlags success, flog is " + flog);
            expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);
Z
zhangpa2021 已提交
6049

Y
yang-qibo 已提交
6050 6051 6052 6053 6054 6055 6056 6057
            option.setFlags(-1);
            let flog2 = option.getFlags();
            console.info("SUB_Softbus_IPC_MessageOption_00700: run getFlags success, flog2 is " + flog2);
            expect(flog2).assertEqual(-1);
        }catch(error){
            console.info("SUB_Softbus_IPC_MessageOption_00700: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageOption_00700---------------------------");
J
jiyong 已提交
6058 6059 6060
    })

    /*
Y
yang-qibo 已提交
6061
     * @tc.number  SUB_Softbus_IPC_MessageOption_00800
J
jiyong 已提交
6062 6063 6064 6065
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6066 6067
    it("SUB_Softbus_IPC_MessageOption_00800",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_00800---------------------------");
J
jiyong 已提交
6068 6069
        try{
            let option = new rpc.MessageOption();
Y
yang-qibo 已提交
6070
            console.info("SUB_Softbus_IPC_MessageOption_00800: create object successfully.");
J
jiyong 已提交
6071
            let flog = option.getFlags();
Y
yang-qibo 已提交
6072 6073
            console.info("SUB_Softbus_IPC_MessageOption_00800: run getFlags success, flog is " + flog);
            expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);
J
jiyong 已提交
6074

Y
yang-qibo 已提交
6075
            option.setFlags(3);
J
jiyong 已提交
6076
            let flog2 = option.getFlags();
Y
yang-qibo 已提交
6077 6078 6079 6080 6081 6082 6083
            console.info("SUB_Softbus_IPC_MessageOption_00800: run getFlags success, flog2 is " + flog2);
            expect(flog2).assertEqual(3);
        }catch(error){
            console.info("SUB_Softbus_IPC_MessageOption_00800: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_MessageOption_00800---------------------------");
    })
J
jiyong 已提交
6084

Y
yang-qibo 已提交
6085 6086 6087 6088 6089 6090 6091 6092 6093 6094
    /*
     * @tc.number  SUB_Softbus_IPC_MessageOption_00900
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageOption_00900",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_00900---------------------------");
        try{
            expect(rpc.MessageOption.TF_SYNC).assertEqual(0);
J
jiyong 已提交
6095

Y
yang-qibo 已提交
6096 6097 6098 6099 6100
            expect(rpc.MessageOption.TF_ASYNC).assertEqual(1);

            expect(rpc.MessageOption.TF_WAIT_TIME).assertEqual(4);

            expect(rpc.MessageOption.TF_ACCEPT_FDS).assertEqual(0x10);
J
jiyong 已提交
6101
        }catch(error){
Y
yang-qibo 已提交
6102
            console.info("SUB_Softbus_IPC_MessageOption_00900: error " + error);
J
jiyong 已提交
6103
        }
Y
yang-qibo 已提交
6104
        console.info("---------------------end SUB_Softbus_IPC_MessageOption_00900---------------------------");
J
jiyong 已提交
6105 6106 6107
    })

    /*
Y
yang-qibo 已提交
6108 6109
     * @tc.number  SUB_Softbus_IPC_MessageOption_01000
     * @tc.name    Basic method of testing messageoption
J
jiyong 已提交
6110 6111 6112
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6113 6114
    it("SUB_Softbus_IPC_MessageOption_01000",0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_01000---------------------------");
J
jiyong 已提交
6115 6116
        try{

Y
yang-qibo 已提交
6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageOption_01000:run writeStringis is " + result);
            expect(result).assertTrue();
            expect(option.getFlags()).assertEqual(0);
            expect(option.getWaitTime()).assertEqual(20);
J
jiyong 已提交
6129

Y
yang-qibo 已提交
6130 6131 6132 6133 6134 6135
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageOption_01000: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageOption_01000: sendRequestis is " + result.errCode);
J
jiyong 已提交
6136

Y
yang-qibo 已提交
6137 6138 6139 6140 6141 6142 6143 6144 6145
                var replyReadResult = result.reply.readString();
                console.info("SUB_Softbus_IPC_MessageOption_01000: run readString is " + replyReadResult);
                expect(replyReadResult).assertEqual(token);
                expect(option.getFlags()).assertEqual(0);
                expect(option.getWaitTime()).assertEqual(20);

            });
            data.reclaim();
            reply.reclaim();
J
jiyong 已提交
6146
        }catch(error){
Y
yang-qibo 已提交
6147
            console.info("SUB_Softbus_IPC_MessageOption_01000: error " + error);
J
jiyong 已提交
6148
        }
Y
yang-qibo 已提交
6149 6150
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageOption_01000---------------------------");
J
jiyong 已提交
6151 6152
    })

Z
zhangpa2021 已提交
6153
    /*
Y
yang-qibo 已提交
6154 6155
     * @tc.number  SUB_Softbus_IPC_MessageOption_01100
     * @tc.name    Basic method of testing messageoption
Z
zhangpa2021 已提交
6156 6157 6158
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6159 6160
    it("SUB_Softbus_IPC_MessageOption_01100",0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_01100---------------------------");
Z
zhangpa2021 已提交
6161 6162
        try{

Y
yang-qibo 已提交
6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageOption_01100:run writeStringis is " + result);
            expect(result).assertTrue();
            expect(option.getFlags()).assertEqual(1);
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageOption_01100: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageOption_01100: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readString();
                console.info("SUB_Softbus_IPC_MessageOption_01100: run readString is success,result is " + replyReadResult);
                expect(replyReadResult).assertEqual("");
                expect(option.getFlags()).assertEqual(1);
Z
zhangpa2021 已提交
6183

Y
yang-qibo 已提交
6184 6185 6186 6187 6188 6189 6190 6191 6192
            });
            data.reclaim();
            reply.reclaim();
        }catch(error){
            console.info("SUB_Softbus_IPC_MessageOption_01100: error " + error);
        }
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageOption_01100---------------------------");
    })
Z
zhangpa2021 已提交
6193

Y
yang-qibo 已提交
6194 6195 6196 6197 6198 6199 6200 6201 6202
    /*
     * @tc.number  SUB_Softbus_IPC_MessageOption_01200
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_MessageOption_01200",0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_MessageOption_01200---------------------------");
        try{
Z
zhangpa2021 已提交
6203

Y
yang-qibo 已提交
6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_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_MessageOption_01200:run writeStringis is " + result);
            expect(result).assertTrue();
            expect(option.getFlags()).assertEqual(3);
            if (gIRemoteObject == undefined)
            {
                console.info("SUB_Softbus_IPC_MessageOption_01200: gIRemoteObject is undefined");
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_MessageOption_01200: sendRequestis is " + result.errCode);
                var replyReadResult = result.reply.readString();
                console.info("SUB_Softbus_IPC_MessageOption_01200: run readString is success,result is " + replyReadResult);
                expect(replyReadResult).assertEqual("");
                expect(option.getFlags()).assertEqual(3);
            });
            data.reclaim();
            reply.reclaim();
Z
zhangpa2021 已提交
6227
        }catch(error){
Y
yang-qibo 已提交
6228
            console.info("SUB_Softbus_IPC_MessageOption_01200: error " + error);
Z
zhangpa2021 已提交
6229
        }
Y
yang-qibo 已提交
6230 6231
        done();
        console.info("---------------------end SUB_Softbus_IPC_MessageOption_01200---------------------------");
Z
zhangpa2021 已提交
6232 6233
    })

J
jiyong 已提交
6234
    /*
Y
yang-qibo 已提交
6235
     * @tc.number  SUB_Softbus_IPC_Ashmem_00100
J
jiyong 已提交
6236 6237 6238 6239
     * @tc.name    Exception parameter validation of the created anonymous shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6240 6241
    it("SUB_Softbus_IPC_Ashmem_00100",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_00100---------------------------");
J
jiyong 已提交
6242 6243
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", -1)
Y
yang-qibo 已提交
6244
            console.info("SUB_Softbus_IPC_Ashmem_00100: ashmem " + ashmem);
J
jiyong 已提交
6245

Y
yang-qibo 已提交
6246 6247
            let ashmem2 = rpc.Ashmem.createAshmem(null, K)
            console.info("SUB_Softbus_IPC_Ashmem_00100: ashmem2 " + ashmem2);
J
jiyong 已提交
6248
        }catch(error){
Y
yang-qibo 已提交
6249
            console.info("SUB_Softbus_IPC_Ashmem_00100: error " + error);
J
jiyong 已提交
6250
        }
Y
yang-qibo 已提交
6251
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_00100---------------------------");
J
jiyong 已提交
6252 6253 6254
    })

    /*
Y
yang-qibo 已提交
6255
     * @tc.number  SUB_Softbus_IPC_Ashmem_00200
J
jiyong 已提交
6256 6257 6258 6259
     * @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 已提交
6260 6261
    it("SUB_Softbus_IPC_Ashmem_00200",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_00200---------------------------");
J
jiyong 已提交
6262
        try{
Y
yang-qibo 已提交
6263 6264 6265 6266 6267 6268 6269 6270 6271
            var mapSize = 2*G - 1;
            var jsash = "";
            for (let i = 0;i < (256 - 1);i++){
                jsash += "a";
            }
            console.info("SUB_Softbus_IPC_Ashmem_00200: run  createAshmem success" + jsash.length);
            let ashmem = rpc.Ashmem.createAshmem(jsash, mapSize)
            console.info("SUB_Softbus_IPC_Ashmem_00200: run  createAshmem success" + ashmem);
            expect(ashmem != null).assertTrue();
Z
zhangpa2021 已提交
6272
            ashmem.closeAshmem();
Y
yang-qibo 已提交
6273 6274 6275 6276 6277
        }catch(error){
            console.info("SUB_Softbus_IPC_Ashmem_00200: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_00200---------------------------");
    })
J
jiyong 已提交
6278

Y
yang-qibo 已提交
6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296
    /*
     * @tc.number  SUB_Softbus_IPC_Ashmem_00300
     * @tc.name    Call the getashmemsize interface to get the size of the shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_Ashmem_00300",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_00300---------------------------");
        try{
            let mapSize = 2*G - 1;
            let jsash = '';
            for (let i = 0;i < 256;i++){
                jsash += 'a';
            }
            console.info("SUB_Softbus_IPC_Ashmem_00300: run  createAshmem success" + jsash.length);
            let ashmem = rpc.Ashmem.createAshmem(jsash, mapSize)
            console.info("SUB_Softbus_IPC_Ashmem_00300: run  createAshmem success" + ashmem);
            ashmem.closeAshmem();
J
jiyong 已提交
6297
        }catch(error){
Y
yang-qibo 已提交
6298 6299
            expect(error != null).assertTrue();
            console.info("SUB_Softbus_IPC_Ashmem_00300: error " + error);
J
jiyong 已提交
6300
        }
Y
yang-qibo 已提交
6301
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_00300---------------------------");
J
jiyong 已提交
6302 6303 6304
    })

    /*
Y
yang-qibo 已提交
6305
     * @tc.number  SUB_Softbus_IPC_Ashmem_00400
J
jiyong 已提交
6306 6307 6308 6309
     * @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 已提交
6310 6311
    it("SUB_Softbus_IPC_Ashmem_00400",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_00400---------------------------");
J
jiyong 已提交
6312
        try{
Y
yang-qibo 已提交
6313
            let mapSize = 2*G - 1;
J
jiyong 已提交
6314
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
Y
yang-qibo 已提交
6315
            console.info("SUB_Softbus_IPC_Ashmem_00400: run  createAshmem success" + ashmem);
J
jiyong 已提交
6316
            let size = ashmem.getAshmemSize()
Y
yang-qibo 已提交
6317 6318 6319 6320 6321 6322 6323 6324
            console.info("SUB_Softbus_IPC_Ashmem_00400: run getAshmemSize success, size is " + size);
            expect(size).assertEqual(mapSize);
            ashmem.closeAshmem();
        }catch(error){
            console.info("SUB_Softbus_IPC_Ashmem_00400: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_00400---------------------------");
    })
J
jiyong 已提交
6325

Y
yang-qibo 已提交
6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340
    /*
     * @tc.number  SUB_Softbus_IPC_Ashmem_00500
     * @tc.name    Call the getashmemsize interface to get the size of the shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_Ashmem_00500",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_00500---------------------------");
        try{
            let mapSize = 2*G;
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest ", mapSize)
            console.info("SUB_Softbus_IPC_Ashmem_00500: run  createAshmem success " + ashmem);
            let size = ashmem.getAshmemSize()
            console.info("SUB_Softbus_IPC_Ashmem_00500: run getAshmemSize success, size is " + size);
            expect(size).assertEqual(mapSize);
J
jiyong 已提交
6341 6342
            ashmem.closeAshmem();
        }catch(error){
Y
yang-qibo 已提交
6343 6344
            console.info("SUB_Softbus_IPC_Ashmem_00500: error " + error);
            expect(error != null).assertTrue();
J
jiyong 已提交
6345
        }
Y
yang-qibo 已提交
6346
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_00500---------------------------");
J
jiyong 已提交
6347 6348 6349
    })

    /*
Y
yang-qibo 已提交
6350
     * @tc.number  SUB_Softbus_IPC_Ashmem_00600
J
jiyong 已提交
6351 6352 6353 6354
     * @tc.name    Writeashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6355 6356
    it("SUB_Softbus_IPC_Ashmem_00600",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_00600---------------------------");
J
jiyong 已提交
6357 6358
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Y
yang-qibo 已提交
6359
            console.info("SUB_Softbus_IPC_Ashmem_00600: ashmem " + ashmem);
J
jiyong 已提交
6360 6361 6362
            ashmem.closeAshmem()
            var data = rpc.MessageParcel.create();
            let writeAshmem = data.writeAshmem(ashmem);
Y
yang-qibo 已提交
6363 6364
            console.info("SUB_Softbus_IPC_Ashmem_00600: run writeAshmem success, writeAshmem is " + writeAshmem);
            expect(writeAshmem).assertEqual(false);
J
jiyong 已提交
6365
        }catch(error){
Y
yang-qibo 已提交
6366
            console.info("SUB_Softbus_IPC_Ashmem_00600: error " + error);
J
jiyong 已提交
6367
        }
Y
yang-qibo 已提交
6368 6369
        data.reclaim();
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_00600---------------------------");
J
jiyong 已提交
6370 6371 6372
    })

    /*
Y
yang-qibo 已提交
6373
     * @tc.number  SUB_Softbus_IPC_Ashmem_00700
J
jiyong 已提交
6374 6375 6376 6377
     * @tc.name    Readfromashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6378 6379
    it("SUB_Softbus_IPC_Ashmem_00700",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_00700---------------------------");
J
jiyong 已提交
6380 6381
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Y
yang-qibo 已提交
6382
            console.info("SUB_Softbus_IPC_Ashmem_00700: ashmem " + ashmem);
J
jiyong 已提交
6383
            ashmem.unmapAshmem()
Y
yang-qibo 已提交
6384 6385
            console.info("SUB_Softbus_IPC_Ashmem_00700: run unmapAshmem success");
            let bytes = [1, 2, 3, 4, 5];
J
jiyong 已提交
6386
            let ret = ashmem.readFromAshmem(bytes.length, 0);
Y
yang-qibo 已提交
6387
            console.info("SUB_Softbus_IPC_Ashmem_00700: run readFromAshmem result is " + ret);
J
jiyong 已提交
6388 6389 6390
            expect(ret==null).assertTrue();
            ashmem.closeAshmem();
        }catch(error){
Y
yang-qibo 已提交
6391
            console.info("SUB_Softbus_IPC_Ashmem_00700: error " + error);
J
jiyong 已提交
6392
        }
Y
yang-qibo 已提交
6393
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_00700---------------------------");
J
jiyong 已提交
6394 6395 6396
    })

    /*
Y
yang-qibo 已提交
6397
     * @tc.number  SUB_Softbus_IPC_Ashmem_00800
J
jiyong 已提交
6398 6399 6400 6401
     * @tc.name    Mapashmem interface creates shared file mappings
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6402 6403
    it("SUB_Softbus_IPC_Ashmem_00800",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_00800---------------------------");
J
jiyong 已提交
6404 6405
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Y
yang-qibo 已提交
6406
            console.info("SUB_Softbus_IPC_Ashmem_00800: ashmem " + ashmem);
J
jiyong 已提交
6407
            let result = ashmem.mapAshmem(rpc.Ashmem.PROT_READ);
Y
yang-qibo 已提交
6408 6409
            console.info("SUB_Softbus_IPC_Ashmem_00800: run mapAshmemis is " + result);
            expect(result).assertTrue();
J
jiyong 已提交
6410 6411
            ashmem.closeAshmem()
        }catch(error){
Y
yang-qibo 已提交
6412
            console.info("SUB_Softbus_IPC_Ashmem_00800: error " + error);
J
jiyong 已提交
6413
        }
Y
yang-qibo 已提交
6414
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_00800---------------------------");
J
jiyong 已提交
6415 6416 6417
    })

    /*
Y
yang-qibo 已提交
6418
     * @tc.number  SUB_Softbus_IPC_Ashmem_00900
J
jiyong 已提交
6419 6420 6421 6422
     * @tc.name    Mapashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6423 6424
    it("SUB_Softbus_IPC_Ashmem_00900",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_00900---------------------------");
J
jiyong 已提交
6425
        try{
Y
yang-qibo 已提交
6426 6427
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", (2*G - 1))
            console.info("SUB_Softbus_IPC_Ashmem_00900: ashmem " + ashmem);
J
jiyong 已提交
6428
            let result = ashmem.mapAshmem(999);
Y
yang-qibo 已提交
6429 6430
            console.info("SUB_Softbus_IPC_Ashmem_00900: run mapAshmemis is " + result);
            expect(result).assertEqual(false);
J
jiyong 已提交
6431 6432
            ashmem.closeAshmem()
        }catch(error){
Y
yang-qibo 已提交
6433 6434
            console.info("SUB_Softbus_IPC_Ashmem_00900: error " + error);
            expect(error != null).assertTrue();
J
jiyong 已提交
6435
        }
Y
yang-qibo 已提交
6436
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_00900---------------------------");
J
jiyong 已提交
6437 6438 6439
    })

    /*
Y
yang-qibo 已提交
6440
     * @tc.number  SUB_Softbus_IPC_Ashmem_01000
J
jiyong 已提交
6441 6442 6443 6444
     * @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 已提交
6445 6446
    it("SUB_Softbus_IPC_Ashmem_01000",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_01000---------------------------");
J
jiyong 已提交
6447
        try{
Y
yang-qibo 已提交
6448 6449
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K)
            console.info("SUB_Softbus_IPC_Ashmem_01000: ashmem " + ashmem);
J
jiyong 已提交
6450
            let result = ashmem.mapReadAndWriteAshmem();
Y
yang-qibo 已提交
6451
            console.info("SUB_Softbus_IPC_Ashmem_01000: run mapAshmemis is " + result);
J
jiyong 已提交
6452 6453
            ashmem.closeAshmem()
        }catch(error){
Y
yang-qibo 已提交
6454
            console.info("SUB_Softbus_IPC_Ashmem_01000: error " + error);
J
jiyong 已提交
6455
        }
Y
yang-qibo 已提交
6456
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_01000---------------------------");
J
jiyong 已提交
6457 6458 6459
    })

    /*
Y
yang-qibo 已提交
6460
     * @tc.number  SUB_Softbus_IPC_Ashmem_01100
J
jiyong 已提交
6461 6462 6463 6464
     * @tc.name    Mapreadandwriteashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6465 6466
    it("SUB_Softbus_IPC_Ashmem_01100",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_01100---------------------------");
J
jiyong 已提交
6467 6468
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Y
yang-qibo 已提交
6469
            console.info("SUB_Softbus_IPC_Ashmem_01100: ashmem " + ashmem);
J
jiyong 已提交
6470
            let result = ashmem.mapAshmem(rpc.Ashmem.PROT_READ);
Y
yang-qibo 已提交
6471 6472
            console.info("SUB_Softbus_IPC_Ashmem_01100: run mapAshmemis is " + result);
            expect(result).assertTrue();
J
jiyong 已提交
6473

Y
yang-qibo 已提交
6474 6475
            ashmem.unmapAshmem();
            console.info("SUB_Softbus_IPC_Ashmem_01100: run unmapAshmem success");
Z
zhangpa2021 已提交
6476

Y
yang-qibo 已提交
6477 6478 6479 6480
            let result2 = ashmem.mapReadAndWriteAshmem();
            console.info("SUB_Softbus_IPC_Ashmem_01100: run mapReadAndWriteAshmemis2 is " + result2);
            expect(result2).assertTrue();
            ashmem.closeAshmem()
J
jiyong 已提交
6481
        }catch(error){
Y
yang-qibo 已提交
6482
            console.info("SUB_Softbus_IPC_Ashmem_01100: error " + error);
J
jiyong 已提交
6483
        }
Y
yang-qibo 已提交
6484
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_01100---------------------------");
J
jiyong 已提交
6485 6486 6487
    })

    /*
Y
yang-qibo 已提交
6488
     * @tc.number  SUB_Softbus_IPC_Ashmem_01200
J
jiyong 已提交
6489 6490 6491 6492
     * @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 已提交
6493 6494
    it("SUB_Softbus_IPC_Ashmem_01200",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_01200---------------------------");
J
jiyong 已提交
6495 6496
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Y
yang-qibo 已提交
6497
            console.info("SUB_Softbus_IPC_Ashmem_01200: ashmem " + ashmem);
J
jiyong 已提交
6498
            let result = ashmem.mapReadOnlyAshmem();
Y
yang-qibo 已提交
6499 6500
            console.info("SUB_Softbus_IPC_Ashmem_01200: run mapReadAndWriteAshmemis is " + result);
            expect(result).assertTrue();
J
jiyong 已提交
6501 6502
            ashmem.closeAshmem();
        }catch(error){
Y
yang-qibo 已提交
6503
            console.info("SUB_Softbus_IPC_Ashmem_01200: error " + error);
J
jiyong 已提交
6504
        }
Y
yang-qibo 已提交
6505
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_01200---------------------------");
J
jiyong 已提交
6506 6507 6508
    })

    /*
Y
yang-qibo 已提交
6509
     * @tc.number  SUB_Softbus_IPC_Ashmem_01300
J
jiyong 已提交
6510 6511 6512 6513
     * @tc.name    Mapreadonlyashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6514 6515
    it("SUB_Softbus_IPC_Ashmem_01300",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_01300---------------------------");
J
jiyong 已提交
6516
        try{
Y
yang-qibo 已提交
6517 6518
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K)
            console.info("SUB_Softbus_IPC_Ashmem_01300: ashmem " + ashmem);
J
jiyong 已提交
6519 6520

            let result = ashmem.mapAshmem(rpc.Ashmem.PROT_WRITE);
Y
yang-qibo 已提交
6521 6522
            console.info("SUB_Softbus_IPC_Ashmem_01300: run mapAshmemis is " + result);
            expect(result).assertTrue();
J
jiyong 已提交
6523 6524

            ashmem.unmapAshmem();
Y
yang-qibo 已提交
6525
            console.info("SUB_Softbus_IPC_Ashmem_01300: run unmapAshmem success");
Z
zhangpa2021 已提交
6526
            ashmem.closeAshmem()
J
jiyong 已提交
6527
            let result2 = ashmem.mapReadOnlyAshmem();
Y
yang-qibo 已提交
6528 6529
            console.info("SUB_Softbus_IPC_Ashmem_01300: run mapReadAndWriteAshmemis2 is " + result2);
            expect(result2).assertEqual(false);
J
jiyong 已提交
6530
        }catch(error){
Y
yang-qibo 已提交
6531
            console.info("SUB_Softbus_IPC_Ashmem_01300: error " + error);
J
jiyong 已提交
6532
        }
Y
yang-qibo 已提交
6533
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_01300---------------------------");
J
jiyong 已提交
6534 6535 6536
    })

    /*
Y
yang-qibo 已提交
6537
     * @tc.number  SUB_Softbus_IPC_Ashmem_01400
J
jiyong 已提交
6538 6539 6540 6541
     * @tc.name    Mapreadonlyashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6542 6543
    it("SUB_Softbus_IPC_Ashmem_01400",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_01400---------------------------");
J
jiyong 已提交
6544
        try{
Y
yang-qibo 已提交
6545
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
J
jiyong 已提交
6546
            let resultwrite = ashmem.setProtection(rpc.Ashmem.PROT_WRITE)
Y
yang-qibo 已提交
6547 6548
            console.info("SUB_Softbus_IPC_Ashmem_01400: run setProtectioniswrite is " + resultwrite);
            expect(resultwrite).assertTrue();
J
jiyong 已提交
6549
            let resultread = ashmem.setProtection(rpc.Ashmem.PROT_READ)
Y
yang-qibo 已提交
6550 6551
            console.info("SUB_Softbus_IPC_Ashmem_01400: run setProtectionisread is " + resultread);
            expect(resultread).assertEqual(false);
J
jiyong 已提交
6552 6553

            let resultreadAndwrite = ashmem.mapReadAndWriteAshmem();
Y
yang-qibo 已提交
6554 6555 6556
            console.info("SUB_Softbus_IPC_Ashmem_01400: run setProtection success, mapReadAndWriteAshmem is "
                + resultreadAndwrite);
            expect(resultreadAndwrite ).assertEqual(false);
J
jiyong 已提交
6557 6558

            let resultnone = ashmem.setProtection(rpc.Ashmem.PROT_NONE)
Y
yang-qibo 已提交
6559 6560
            console.info("SUB_Softbus_IPC_Ashmem_01400: run setProtectionisnone is " + resultnone);
            expect(resultnone).assertTrue();
J
jiyong 已提交
6561 6562

            let resultread2 = ashmem.setProtection(rpc.Ashmem.PROT_READ)
Y
yang-qibo 已提交
6563 6564 6565 6566 6567 6568 6569 6570
            console.info("SUB_Softbus_IPC_Ashmem_01400: run setProtectionisread2 is " + resultread2);
            expect(resultread2).assertEqual(false);
            ashmem.closeAshmem()
        }catch(error){
            console.info("SUB_Softbus_IPC_Ashmem_01400: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_01400---------------------------");
    })
J
jiyong 已提交
6571

Y
yang-qibo 已提交
6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585
    /*
     * @tc.number  SUB_Softbus_IPC_Ashmem_01500
     * @tc.name    Setprotection exception input parameter verification
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_Ashmem_01500",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_01500---------------------------");
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
            console.info("SUB_Softbus_IPC_Ashmem_01500: ashmem " + ashmem);
            let result = ashmem.setProtection(3);
            console.info("SUB_Softbus_IPC_Ashmem_01500: run setProtectionis is " + result);
            expect(result).assertTrue();
J
jiyong 已提交
6586 6587
            ashmem.closeAshmem()
        }catch(error){
Y
yang-qibo 已提交
6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711
            console.info("SUB_Softbus_IPC_Ashmem_01500: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_01500---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_Ashmem_01600
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_Ashmem_01600",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_01600---------------------------");
        try{
            let mapSize = 4096
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
            console.info("SUB_Softbus_IPC_Ashmem_01600: ashmem " + ashmem);

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
            console.info("SUB_Softbus_IPC_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_Ashmem_01600: run writeToAshmemis is " + result);
            expect(result).assertTrue();
            ashmem.closeAshmem();
        }catch(error){
            console.info("SUB_Softbus_IPC_Ashmem_01600: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_01600---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_Ashmem_01700
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_Ashmem_01700",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_01700---------------------------");
        try{
            let mapSize = 4096
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
            console.info("SUB_Softbus_IPC_Ashmem_01700: ashmem " + ashmem);

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
            console.info("SUB_Softbus_IPC_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_Ashmem_01700: run writeToAshmemis is " + result);
            expect(result).assertTrue();
            let reresult = ashmem.readFromAshmem(bytes.length,0);
            console.info("SUB_Softbus_IPC_Ashmem_01700: run readFromAshmemis is " + reresult);
            assertArrayElementEqual(reresult,bytes);
            ashmem.closeAshmem();
        }catch(error){
            console.info("SUB_Softbus_IPC_Ashmem_01700: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_01700---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_Ashmem_01800
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_Ashmem_01800",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_01800---------------------------");
        try{
            let mapSize = 4096
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
            console.info("SUB_Softbus_IPC_Ashmem_01800: ashmem " + ashmem);

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
            console.info("SUB_Softbus_IPC_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_Ashmem_01800: run writeToAshmemis is " + result);
            expect(result).assertTrue();
            let readresult = ashmem.readFromAshmem(bytes.length,0);
            console.info("SUB_Softbus_IPC_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_Ashmem_01800: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_01800---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_Ashmem_01900
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_Ashmem_01900",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_01900---------------------------");
        try{
            let mapSize = 4096
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
            console.info("SUB_Softbus_IPC_Ashmem_01900: ashmem " + ashmem);

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
            console.info("SUB_Softbus_IPC_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_Ashmem_01900: run writeToAshmemis is " + result);
            expect(result).assertTrue();
            let reresult = ashmem.readFromAshmem(bytes.length,0);
            console.info("SUB_Softbus_IPC_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_Ashmem_01900: error " + error);
J
jiyong 已提交
6712
        }
Y
yang-qibo 已提交
6713
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_01900---------------------------");
J
jiyong 已提交
6714 6715 6716
    })

    /*
Y
yang-qibo 已提交
6717 6718
     * @tc.number  SUB_Softbus_IPC_Ashmem_02000
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
J
jiyong 已提交
6719 6720 6721
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6722 6723
    it("SUB_Softbus_IPC_Ashmem_02000",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_02000---------------------------");
J
jiyong 已提交
6724
        try{
Y
yang-qibo 已提交
6725 6726 6727
            let mapSize = 2*G - 1;
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
            console.info("SUB_Softbus_IPC_Ashmem_02000: ashmem " + ashmem);
J
jiyong 已提交
6728

Y
yang-qibo 已提交
6729 6730 6731 6732 6733 6734 6735 6736
            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
            console.info("SUB_Softbus_IPC_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_Ashmem_02000: run writeToAshmemis is " + result);
            expect(result).assertEqual(false);
            ashmem.closeAshmem();
J
jiyong 已提交
6737
        }catch(error){
Y
yang-qibo 已提交
6738
            console.info("SUB_Softbus_IPC_Ashmem_02000: error " + error);
J
jiyong 已提交
6739
        }
Y
yang-qibo 已提交
6740
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_02000---------------------------");
J
jiyong 已提交
6741 6742 6743
    })

    /*
Y
yang-qibo 已提交
6744
     * @tc.number  SUB_Softbus_IPC_Ashmem_02100
J
jiyong 已提交
6745 6746 6747 6748
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6749 6750
    it("SUB_Softbus_IPC_Ashmem_02100",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_02100---------------------------");
J
jiyong 已提交
6751
        try{
Y
yang-qibo 已提交
6752
            let mapSize = 2*G - 1;
J
jiyong 已提交
6753
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
Y
yang-qibo 已提交
6754
            console.info("SUB_Softbus_IPC_Ashmem_02100: ashmem " + ashmem);
J
jiyong 已提交
6755 6756

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Y
yang-qibo 已提交
6757 6758 6759 6760 6761 6762 6763 6764 6765
            console.info("SUB_Softbus_IPC_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_Ashmem_02100: run writeToAshmemis is " + result);
            expect(result).assertTrue();
            let readresult1 = ashmem.readFromAshmem(bytes.length,0);
            console.info("SUB_Softbus_IPC_Ashmem_02100: run readFromAshmemis is " + readresult1);
            assertArrayElementEqual(readresult1,bytes);
J
jiyong 已提交
6766
        }catch(error){
Y
yang-qibo 已提交
6767
            console.info("SUB_Softbus_IPC_Ashmem_02100: error " + error);
J
jiyong 已提交
6768
        }
Y
yang-qibo 已提交
6769
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_02100---------------------------");
J
jiyong 已提交
6770 6771 6772
    })

    /*
Y
yang-qibo 已提交
6773
     * @tc.number  SUB_Softbus_IPC_Ashmem_02200
J
jiyong 已提交
6774 6775 6776 6777
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6778 6779
    it("SUB_Softbus_IPC_Ashmem_02200",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_02200---------------------------");
J
jiyong 已提交
6780 6781
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Y
yang-qibo 已提交
6782
            console.info("SUB_Softbus_IPC_Ashmem_02200: ashmem " + ashmem);
J
jiyong 已提交
6783 6784

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Y
yang-qibo 已提交
6785 6786 6787 6788
            console.info("SUB_Softbus_IPC_Ashmem_02200: run mapReadAndWriteAshmemis2 is "
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3, 4, 5];
J
jiyong 已提交
6789
            let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
Y
yang-qibo 已提交
6790 6791
            console.info("SUB_Softbus_IPC_Ashmem_02200: run writeToAshmemis is " +result);
            expect(result).assertTrue();
J
jiyong 已提交
6792
            let resultread = ashmem.setProtection(rpc.Ashmem.PROT_READ);
Y
yang-qibo 已提交
6793 6794
            console.info("SUB_Softbus_IPC_Ashmem_02200: run setProtectionisread is " + resultread);
            expect(resultread).assertTrue()
J
jiyong 已提交
6795
            let result2 = ashmem.writeToAshmem(bytes, bytes.length, 0);
Y
yang-qibo 已提交
6796 6797
            console.info("SUB_Softbus_IPC_Ashmem_02200: run writeToAshmemis is2 " + result2);
            expect(result2).assertEqual(false)
J
jiyong 已提交
6798 6799
            ashmem.closeAshmem();
        }catch(error){
Y
yang-qibo 已提交
6800
            console.info("SUB_Softbus_IPC_Ashmem_02200: error " +error);
J
jiyong 已提交
6801
        }
Y
yang-qibo 已提交
6802
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_02200---------------------------");
J
jiyong 已提交
6803 6804 6805
    })

    /*
Y
yang-qibo 已提交
6806
     * @tc.number  SUB_Softbus_IPC_Ashmem_02300
J
jiyong 已提交
6807 6808 6809 6810
     * @tc.name    Writetoashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6811 6812
    it("SUB_Softbus_IPC_Ashmem_02300",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_02300---------------------------");
J
jiyong 已提交
6813 6814
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096);
Y
yang-qibo 已提交
6815
            console.info("SUB_Softbus_IPC_Ashmem_02300: ashmem " + ashmem);
J
jiyong 已提交
6816
            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Y
yang-qibo 已提交
6817 6818 6819 6820
            console.info("SUB_Softbus_IPC_Ashmem_02300: run mapReadAndWriteAshmemis2 is "
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3, 4, 5];
J
jiyong 已提交
6821 6822
            let size = bytes.length + 10;
            let result = ashmem.writeToAshmem(bytes, 3, 0);
Y
yang-qibo 已提交
6823 6824
            console.info("SUB_Softbus_IPC_Ashmem_02300: run writeToAshmemis is " + result);
            expect(result).assertTrue();
J
jiyong 已提交
6825 6826
            ashmem.closeAshmem()
        }catch(error){
Y
yang-qibo 已提交
6827
            console.info("SUB_Softbus_IPC_Ashmem_02300: error " + error);
J
jiyong 已提交
6828
        }
Y
yang-qibo 已提交
6829
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_02300---------------------------");
J
jiyong 已提交
6830 6831 6832
    })

    /*
Y
yang-qibo 已提交
6833
     * @tc.number  SUB_Softbus_IPC_Ashmem_02400
J
jiyong 已提交
6834 6835 6836 6837
     * @tc.name    Read data from the shared file associated with readfromashmem
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6838 6839
    it("SUB_Softbus_IPC_Ashmem_02400",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_02400---------------------------");
J
jiyong 已提交
6840 6841
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Y
yang-qibo 已提交
6842
            console.info("SUB_Softbus_IPC_Ashmem_02400: ashmem " + ashmem);
J
jiyong 已提交
6843 6844

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Y
yang-qibo 已提交
6845 6846 6847 6848
            console.info("SUB_Softbus_IPC_Ashmem_02400: run mapReadAndWriteAshmemis2 is "
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3, 4, 5];
J
jiyong 已提交
6849
            let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
Y
yang-qibo 已提交
6850 6851
            console.info("SUB_Softbus_IPC_Ashmem_02400: run writeToAshmemis is " + result);
            expect(result).assertTrue();
J
jiyong 已提交
6852
            var resultRead = ashmem.readFromAshmem(bytes.length, 0);
Y
yang-qibo 已提交
6853 6854
            console.info("SUB_Softbus_IPC_Ashmem_02400: run readFromAshmemis is " + resultRead);
            assertArrayElementEqual(resultRead,bytes);
J
jiyong 已提交
6855 6856
            ashmem.closeAshmem()
        }catch(error){
Y
yang-qibo 已提交
6857
            console.info("SUB_Softbus_IPC_Ashmem_02400: error " + error);
J
jiyong 已提交
6858
        }
Y
yang-qibo 已提交
6859
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_02400---------------------------");
J
jiyong 已提交
6860 6861 6862
    })

    /*
Y
yang-qibo 已提交
6863
     * @tc.number  SUB_Softbus_IPC_Ashmem_02500
J
jiyong 已提交
6864 6865 6866 6867
     * @tc.name    Readfromashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6868 6869
    it("SUB_Softbus_IPC_Ashmem_02500",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_02500---------------------------");
J
jiyong 已提交
6870 6871
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096);
Y
yang-qibo 已提交
6872
            console.info("SUB_Softbus_IPC_Ashmem_02500: ashmem " + ashmem);
J
jiyong 已提交
6873
            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Y
yang-qibo 已提交
6874 6875 6876 6877
            console.info("SUB_Softbus_IPC_Ashmem_02500: run mapReadAndWriteAshmemis2 is "
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3, 4, 5];
J
jiyong 已提交
6878
            let result = ashmem.writeToAshmem(bytes, bytes.length, 1);
Y
yang-qibo 已提交
6879 6880
            console.info("SUB_Softbus_IPC_Ashmem_02500: run writeToAshmemis is " + result);
            expect(result).assertTrue()
J
jiyong 已提交
6881 6882

            let result2 = ashmem.readFromAshmem(bytes.length, 3);
Y
yang-qibo 已提交
6883 6884 6885 6886
            console.info("SUB_Softbus_IPC_Ashmem_02500: run readFromAshmemis2 is " + result2);
            expect(bytes[2]).assertEqual(result2[0]);
            expect(bytes[3]).assertEqual(result2[1]);
            expect(bytes[4]).assertEqual(result2[2]);
J
jiyong 已提交
6887 6888
            ashmem.closeAshmem()
        }catch(error){
Y
yang-qibo 已提交
6889
            console.info("SUB_Softbus_IPC_Ashmem_02500: error " + error);
J
jiyong 已提交
6890
        }
Y
yang-qibo 已提交
6891
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_02500---------------------------");
J
jiyong 已提交
6892 6893 6894
    })

    /*
Y
yang-qibo 已提交
6895
     * @tc.number  SUB_Softbus_IPC_Ashmem_02600
J
jiyong 已提交
6896 6897 6898 6899
     * @tc.name    Createashmemfromexisting copies the ashmem object description and creates a new object
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6900 6901
    it("SUB_Softbus_IPC_Ashmem_02600",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_02600---------------------------");
J
jiyong 已提交
6902 6903
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Y
yang-qibo 已提交
6904
            console.info("SUB_Softbus_IPC_Ashmem_02600: ashmem " + ashmem);
J
jiyong 已提交
6905
            let resultWriteAndRead = ashmem.mapReadAndWriteAshmem();
Y
yang-qibo 已提交
6906 6907 6908
            console.info("SUB_Softbus_IPC_Ashmem_02600:  run mapReadAndWriteAshmem result " + resultWriteAndRead);
            expect(resultWriteAndRead).assertTrue();
            let bytes = [1, 2, 3];
J
jiyong 已提交
6909
            let result = ashmem.writeToAshmem(bytes, bytes.length, 1);
Y
yang-qibo 已提交
6910 6911
            console.info("SUB_Softbus_IPC_Ashmem_02600: run writeToAshmemis " + result);
            expect(result).assertTrue()
J
jiyong 已提交
6912 6913
            let newashmem = rpc.Ashmem.createAshmemFromExisting(ashmem);
            let resultWriteAndRead2 = newashmem.mapReadAndWriteAshmem();
Y
yang-qibo 已提交
6914 6915
            console.info("SUB_Softbus_IPC_Ashmem_02600:  run mapReadAndWriteAshmem result " + resultWriteAndRead2);
            expect(resultWriteAndRead2).assertTrue();
J
jiyong 已提交
6916 6917

            let result2 = newashmem.readFromAshmem(bytes.length, 1);
Y
yang-qibo 已提交
6918 6919 6920
            console.info("SUB_Softbus_IPC_Ashmem_02600: run readFromAshmemis2 is " + result2);
            expect(result).assertTrue();
            assertArrayElementEqual(result2,bytes);
J
jiyong 已提交
6921 6922 6923
            ashmem.closeAshmem();
            newashmem.closeAshmem();
        }catch(error){
Y
yang-qibo 已提交
6924
            console.info("SUB_Softbus_IPC_Ashmem_02600: error " + error);
J
jiyong 已提交
6925
        }
Y
yang-qibo 已提交
6926
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_02600---------------------------");
J
jiyong 已提交
6927 6928 6929
    })

    /*
Y
yang-qibo 已提交
6930
     * @tc.number  SUB_Softbus_IPC_Ashmem_02700
J
jiyong 已提交
6931 6932 6933 6934 6935
     * @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 已提交
6936 6937
    it("SUB_Softbus_IPC_Ashmem_02700",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_02700---------------------------");
J
jiyong 已提交
6938
        try{
Y
yang-qibo 已提交
6939
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
J
jiyong 已提交
6940
            let data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
6941
            console.info("SUB_Softbus_IPC_Ashmem_02700: ashmem " + ashmem);
J
jiyong 已提交
6942
            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Y
yang-qibo 已提交
6943 6944 6945
            console.info("SUB_Softbus_IPC_Ashmem_02700: run mapReadAndWriteAshmem result is " + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3];
J
jiyong 已提交
6946
            let result = ashmem.writeToAshmem(bytes, bytes.length, 1);
Y
yang-qibo 已提交
6947 6948
            console.info("SUB_Softbus_IPC_Ashmem_02700: run writeToAshmemis is " + result);
            expect(result).assertTrue()
J
jiyong 已提交
6949
            let result2 = data.writeAshmem(ashmem)
Y
yang-qibo 已提交
6950 6951
            console.info("SUB_Softbus_IPC_Ashmem_02700: run writeAshmemis is " + result2);
            expect(result2).assertTrue();
J
jiyong 已提交
6952
            let retReadAshmem = data.readAshmem();
Y
yang-qibo 已提交
6953
            console.info("SUB_Softbus_IPC_Ashmem_02700: run readAshmem is " + retReadAshmem);
J
jiyong 已提交
6954
            let retBytes = retReadAshmem.readFromAshmem(bytes.length, 1);
Y
yang-qibo 已提交
6955
            console.info("SUB_Softbus_IPC_Ashmem_02700: run readFromAshmem result is " + retBytes);
J
jiyong 已提交
6956

Y
yang-qibo 已提交
6957 6958
            ashmem.closeAshmem();
            data.reclaim();
J
jiyong 已提交
6959
        }catch(error){
Y
yang-qibo 已提交
6960
            console.info("SUB_Softbus_IPC_Ashmem_02700: error " +error);
J
jiyong 已提交
6961
        }
Y
yang-qibo 已提交
6962
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_02700---------------------------");
J
jiyong 已提交
6963 6964 6965
    })

    /*
Y
yang-qibo 已提交
6966
     * @tc.number  SUB_Softbus_IPC_Ashmem_02800
J
jiyong 已提交
6967 6968 6969 6970 6971
     * @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 已提交
6972 6973
    it("SUB_Softbus_IPC_Ashmem_02800",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_02800---------------------------");
J
jiyong 已提交
6974
        try{
Y
yang-qibo 已提交
6975 6976 6977 6978 6979 6980 6981
            let data = rpc.MessageParcel.create();
            let data2 = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_Ashmem_02800: create MessageParcel object success");
            let result = data.writeAshmem(data2);
            console.info("SUB_Softbus_IPC_Ashmem_02800: run writeAshmemis is " + result);
            data.reclaim();
            data2.reclaim();
J
jiyong 已提交
6982
        }catch(error){
Y
yang-qibo 已提交
6983 6984
            console.info("SUB_Softbus_IPC_Ashmem_02800: error " + error);
            expect(error != null).assertTrue();
J
jiyong 已提交
6985
        }
Y
yang-qibo 已提交
6986
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_02800---------------------------");
J
jiyong 已提交
6987 6988
    })

Y
yang-qibo 已提交
6989 6990 6991 6992
    /*
     * @tc.number  SUB_Softbus_IPC_Ashmem_02900
     * @tc.name    Create a non shared memory object and call writeashmem to write the messageparcel object
      object into the messageparcel object
Z
zhangpa2021 已提交
6993 6994 6995
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
6996 6997 6998 6999
    it("SUB_Softbus_IPC_Ashmem_02900",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Ashmem_02900---------------------------");
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
Z
zhangpa2021 已提交
7000

Y
yang-qibo 已提交
7001 7002 7003
            let resultwrite = ashmem.setProtection(rpc.Ashmem.PROT_EXEC)
            console.info("SUB_Softbus_IPC_Ashmem_02900: run setProtectioniswrite is " + resultwrite);
            expect(resultwrite).assertTrue();
Z
zhangpa2021 已提交
7004

Y
yang-qibo 已提交
7005 7006 7007 7008 7009 7010
            ashmem.closeAshmem()
        }catch(error){
            console.info("SUB_Softbus_IPC_Ashmem_02900: error " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_Ashmem_02900---------------------------");
    })
Z
zhangpa2021 已提交
7011

J
jiyong 已提交
7012
    /*
Y
yang-qibo 已提交
7013
     * @tc.number  SUB_Softbus_IPC_IRemoteObject_00100
J
jiyong 已提交
7014 7015 7016 7017
     * @tc.name    Call sendrequestresult interface to send data
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7018 7019
    it("SUB_Softbus_IPC_IRemoteObject_00100",0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00100---------------------------");
J
jiyong 已提交
7020 7021 7022 7023 7024 7025
        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);
Y
yang-qibo 已提交
7026
            console.info("SUB_Softbus_IPC_IRemoteObject_00100: run writeSequenceableis is " + result);
J
jiyong 已提交
7027 7028

            await gIRemoteObject.sendRequest(CODE_WRITESEQUENCEABLE, data, reply, option).then((result) => {
Y
yang-qibo 已提交
7029
                console.info("SUB_Softbus_IPC_IRemoteObject_00100: sendRequestis is " + result.errCode);
J
jiyong 已提交
7030 7031 7032
                expect(result.errCode == 0).assertTrue();
                let ret = new MySequenceable(0, "");
                var shortArryDataReply = result.reply.readSequenceable(ret);
Y
yang-qibo 已提交
7033
                console.info("SUB_Softbus_IPC_IRemoteObject_00100: run readSequenceable is "
J
jiyong 已提交
7034 7035 7036 7037 7038 7039 7040 7041 7042 7043
                             + shortArryDataReply);
                expect(shortArryDataReply == true).assertTrue()
                expect(ret.num).assertEqual(1)
                expect(ret.str).assertEqual("aaa")
            });

            data.reclaim();
            reply.reclaim();
            done();
        }catch(error){
Y
yang-qibo 已提交
7044
            console.info("SUB_Softbus_IPC_IRemoteObject_00100: error " + error);
J
jiyong 已提交
7045
        }
Y
yang-qibo 已提交
7046
        console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00100---------------------------");
J
jiyong 已提交
7047 7048 7049
    })

    /*
Y
yang-qibo 已提交
7050
     * @tc.number  SUB_Softbus_IPC_IRemoteObject_00200
J
jiyong 已提交
7051 7052 7053 7054 7055
     * @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 已提交
7056 7057
    it("SUB_Softbus_IPC_IRemoteObject_00200", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00200---------------------------");
J
jiyong 已提交
7058 7059
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
7060
            console.info("SUB_Softbus_IPC_IRemoteObject_00200: create object successfully.");
J
jiyong 已提交
7061 7062 7063 7064 7065 7066 7067 7068 7069
            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()
Z
zhangpa2021 已提交
7070
            expect(data.writeChar(5)).assertTrue()
J
jiyong 已提交
7071 7072 7073 7074
            expect(data.writeString("HelloWorld")).assertTrue()
            expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()

            await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option).then((result) => {
Y
yang-qibo 已提交
7075
                console.info("SUB_Softbus_IPC_IRemoteObject_00200: sendRequest done, error code: " + result.errCode);
J
jiyong 已提交
7076 7077 7078 7079 7080 7081 7082 7083
                expect(result.errCode).assertEqual(0)
                expect(result.reply.readByte()).assertEqual(1)
                expect(result.reply.readShort()).assertEqual(2)
                expect(result.reply.readInt()).assertEqual(3)
                expect(result.reply.readLong()).assertEqual(10000)
                expect(result.reply.readFloat()).assertEqual(1.2)
                expect(result.reply.readDouble()).assertEqual(10.2)
                expect(result.reply.readBoolean()).assertTrue()
Z
zhangpa2021 已提交
7084
                expect(result.reply.readChar()).assertEqual(5)
J
jiyong 已提交
7085 7086 7087 7088 7089 7090 7091 7092 7093 7094
                expect(result.reply.readString()).assertEqual("HelloWorld")
                let s = new MySequenceable(0, '')
                expect(result.reply.readSequenceable(s)).assertTrue()
                expect(s.num).assertEqual(1)
                expect(s.str).assertEqual("aaa")
            });
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
7095
            console.info("SUB_Softbus_IPC_IRemoteObject_00200:error = " + error);
J
jiyong 已提交
7096
        }
Y
yang-qibo 已提交
7097
        console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00200---------------------------");
J
jiyong 已提交
7098 7099 7100 7101
        done();
    });

    /*
Y
yang-qibo 已提交
7102
     * @tc.number  SUB_Softbus_IPC_IRemoteObject_00300
J
jiyong 已提交
7103 7104 7105 7106 7107
     * @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 已提交
7108 7109
    it("SUB_Softbus_IPC_IRemoteObject_00300", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00300---------------------------");
J
jiyong 已提交
7110 7111
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
7112
            console.info("SUB_Softbus_IPC_IRemoteObject_00300: create object successfully.");
J
jiyong 已提交
7113 7114 7115 7116 7117 7118 7119 7120 7121 7122
            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()
Z
zhangpa2021 已提交
7123
            expect(data.writeChar(10)).assertTrue()
J
jiyong 已提交
7124 7125 7126 7127 7128
            expect(data.writeString("HelloWorld")).assertTrue()
            expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()

            const CODE_IREMOTEOBJECT_0200 = 21;
            await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option, (err, result) => {
Y
yang-qibo 已提交
7129
                console.info("SUB_Softbus_IPC_IRemoteObject_00300:sendRequest done, error code: " + result.errCode)
J
jiyong 已提交
7130 7131 7132 7133 7134 7135 7136 7137
                expect(result.errCode).assertEqual(0)
                expect(result.reply.readByte()).assertEqual(1)
                expect(result.reply.readShort()).assertEqual(2)
                expect(result.reply.readInt()).assertEqual(3)
                expect(result.reply.readLong()).assertEqual(10000)
                expect(result.reply.readFloat()).assertEqual(1.2)
                expect(result.reply.readDouble()).assertEqual(10.2)
                expect(result.reply.readBoolean()).assertTrue()
Z
zhangpa2021 已提交
7138
                expect(result.reply.readChar()).assertEqual(10)
J
jiyong 已提交
7139 7140 7141 7142 7143 7144 7145 7146 7147 7148
                expect(result.reply.readString()).assertEqual("HelloWorld")
                let s = new MySequenceable(0, '')
                expect(result.reply.readSequenceable(s)).assertTrue()
                expect(s.num).assertEqual(1)
                expect(s.str).assertEqual("aaa")
            });
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
7149
            console.info("SUB_Softbus_IPC_IRemoteObject_00300:error = " + error);
J
jiyong 已提交
7150
        }
Y
yang-qibo 已提交
7151
        console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00300---------------------------");
J
jiyong 已提交
7152 7153 7154
    });

    /*
Y
yang-qibo 已提交
7155
     * @tc.number  SUB_Softbus_IPC_IRemoteObject_00400
J
jiyong 已提交
7156 7157 7158 7159
     * @tc.name    Iremoteobject, register death notification verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7160 7161
    it("SUB_Softbus_IPC_IRemoteObject_00400", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00400---------------------------");
J
jiyong 已提交
7162
        try{
Z
zhangpa2021 已提交
7163 7164
            let object = new TestAbilityStub("Test1")
            var resultAdd1 = object.addDeathRecipient(null, 0)
Y
yang-qibo 已提交
7165
            console.info("SUB_Softbus_IPC_IRemoteObject_00400:run addDeathRecipient first result is" + resultAdd1);
Z
zhangpa2021 已提交
7166
            expect(resultAdd1 == false).assertTrue();
J
jiyong 已提交
7167

Z
zhangpa2021 已提交
7168
            var resultRemove1 = object.removeDeathRecipient(null, 0)
Y
yang-qibo 已提交
7169
            console.info("SUB_Softbus_IPC_IRemoteObject_00400:run removeDeathRecipient1 result is" + resultRemove1);
Z
zhangpa2021 已提交
7170
            expect(resultRemove1 == false).assertTrue();
J
jiyong 已提交
7171

Z
zhangpa2021 已提交
7172
            let isDead = object.isObjectDead()
Y
yang-qibo 已提交
7173
            console.info("SUB_Softbus_IPC_IRemoteObject_00400:run  isDead result is " + isDead);
Z
zhangpa2021 已提交
7174
            expect(isDead == false).assertTrue();
J
jiyong 已提交
7175
        } catch (error) {
Y
yang-qibo 已提交
7176
            console.info("SUB_Softbus_IPC_IRemoteObject_00400:error = " + error);
J
jiyong 已提交
7177
        }
Y
yang-qibo 已提交
7178
        console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00400---------------------------");
J
jiyong 已提交
7179 7180 7181
    });

    /*
Y
yang-qibo 已提交
7182
     * @tc.number  SUB_Softbus_IPC_IRemoteObject_00500
J
jiyong 已提交
7183 7184 7185 7186 7187
     * @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 已提交
7188 7189
    it("SUB_Softbus_IPC_IRemoteObject_00500", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00500---------------------------");
J
jiyong 已提交
7190 7191
        try{
            let callingPid = rpc.IPCSkeleton.getCallingPid()
Y
yang-qibo 已提交
7192 7193
            console.info("SUB_Softbus_IPC_IRemoteObject_00500: run getCallingPid success, callingPid " + callingPid);
            expect(callingPid != null).assertTrue();
J
jiyong 已提交
7194 7195

            let callingUid = rpc.IPCSkeleton.getCallingUid()
Y
yang-qibo 已提交
7196 7197
            console.info("SUB_Softbus_IPC_IRemoteObject_00500: run getCallingPid success, callingPid " + callingUid);
            expect(callingUid != null).assertTrue();
J
jiyong 已提交
7198 7199

            let callingDeviceID = rpc.IPCSkeleton.getCallingDeviceID()
Y
yang-qibo 已提交
7200
            console.info("SUB_Softbus_IPC_IRemoteObject_00500: run getCallingDeviceID success, callingDeviceID is "
J
jiyong 已提交
7201 7202 7203 7204
                         + callingDeviceID);
            expect(callingDeviceID == "").assertTrue();

            let localDeviceID = rpc.IPCSkeleton.getLocalDeviceID()
Y
yang-qibo 已提交
7205
            console.info("SUB_Softbus_IPC_IRemoteObject_00500: run getLocalDeviceID success, localDeviceID is "
J
jiyong 已提交
7206 7207 7208
            + localDeviceID);
            expect(localDeviceID == "").assertTrue();
        } catch (error) {
Y
yang-qibo 已提交
7209
            console.info("SUB_Softbus_IPC_IRemoteObject_00500:error = " + error);
J
jiyong 已提交
7210
        }
Y
yang-qibo 已提交
7211
        console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00500---------------------------");
J
jiyong 已提交
7212 7213 7214
    });

    /*
Y
yang-qibo 已提交
7215
     * @tc.number  SUB_Softbus_IPC_IRemoteObject_00600
J
jiyong 已提交
7216 7217 7218 7219
     * @tc.name    Querylocalinterface searches for objects based on descriptors
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7220 7221
    it("SUB_Softbus_IPC_IRemoteObject_00600", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00600---------------------------");
J
jiyong 已提交
7222 7223
        try{
            let object = new TestAbilityStub("Test1");
Y
yang-qibo 已提交
7224
            console.info("SUB_Softbus_IPC_IRemoteObject_00600: run TestAbilityStub success");
J
jiyong 已提交
7225 7226

            let result = object.isObjectDead()
Y
yang-qibo 已提交
7227
            console.info("SUB_Softbus_IPC_IRemoteObject_00600: run isObjectDeadis is " + result);
J
jiyong 已提交
7228 7229 7230
            expect(result == false).assertTrue()

            let callingPid = object.getCallingPid()
Y
yang-qibo 已提交
7231
            console.info("SUB_Softbus_IPC_IRemoteObject_00600: run getCallingPid success,callingPid " + callingPid);
J
jiyong 已提交
7232 7233

            let callingUid = object.getCallingUid()
Y
yang-qibo 已提交
7234
            console.info("SUB_Softbus_IPC_IRemoteObject_00600: run getCallingPid success,callingPid " + callingUid);
J
jiyong 已提交
7235 7236

            object.attachLocalInterface(object, "Test1")
Y
yang-qibo 已提交
7237
            console.info("SUB_Softbus_IPC_IRemoteObject_00600: run attachLocalInterface success");
J
jiyong 已提交
7238 7239

            let res = object.queryLocalInterface("Test1")
Y
yang-qibo 已提交
7240
            console.info("SUB_Softbus_IPC_IRemoteObject_00600: run queryLocalInterface success, res2 is " + res);
J
jiyong 已提交
7241
        } catch (error) {
Y
yang-qibo 已提交
7242
            console.info("SUB_Softbus_IPC_IRemoteObject_00600:error = " + error);
J
jiyong 已提交
7243
        }
Y
yang-qibo 已提交
7244
        console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00600---------------------------");
J
jiyong 已提交
7245 7246 7247
    });

    /*
Y
yang-qibo 已提交
7248
     * @tc.number  SUB_Softbus_IPC_IRemoteObject_00700
J
jiyong 已提交
7249 7250 7251 7252
     * @tc.name    Getinterfacedescriptor to get the interface description
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7253 7254
    it("SUB_Softbus_IPC_IRemoteObject_00700", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00700---------------------------");
J
jiyong 已提交
7255 7256 7257 7258
        try{
            let object = new TestAbilityStub("Test1223");

            let result = object.isObjectDead()
Y
yang-qibo 已提交
7259
            console.info("SUB_Softbus_IPC_IRemoteObject_00700: run isObjectDeadis is " + result);
J
jiyong 已提交
7260 7261 7262
            expect(result == false).assertTrue()

            let callingPid = object.getCallingPid()
Y
yang-qibo 已提交
7263
            console.info("SUB_Softbus_IPC_IRemoteObject_00700: run getCallingPid success,callingPid " + callingPid);
J
jiyong 已提交
7264 7265

            let callingUid = object.getCallingUid()
Y
yang-qibo 已提交
7266
            console.info("SUB_Softbus_IPC_IRemoteObject_00700: run getCallingPid success,callingPid " + callingUid);
J
jiyong 已提交
7267 7268

            object.attachLocalInterface(object, "test1")
Y
yang-qibo 已提交
7269
            console.info("SUB_Softbus_IPC_IRemoteObject_00700: run attachLocalInterface success");
J
jiyong 已提交
7270 7271

            let result2 = object.getInterfaceDescriptor();
Y
yang-qibo 已提交
7272
            console.info("SUB_Softbus_IPC_IRemoteObject_00700: run getInterfaceDescriptoris2 is "
J
jiyong 已提交
7273 7274 7275 7276
                         + result2);
            expect(result2 == "test1").assertTrue();

        } catch (error) {
Y
yang-qibo 已提交
7277
            console.info("SUB_Softbus_IPC_IRemoteObject_00700:error = " + error);
J
jiyong 已提交
7278
        }
Y
yang-qibo 已提交
7279
        console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00700---------------------------");
J
jiyong 已提交
7280 7281 7282
    });

    /*
Y
yang-qibo 已提交
7283
     * @tc.number  SUB_Softbus_IPC_RemoteProxy_00100
J
jiyong 已提交
7284 7285 7286 7287
     * @tc.name    Call adddeathrecipient to register the death notification
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7288 7289
    it("SUB_Softbus_IPC_RemoteProxy_00100", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00100---------------------------");
J
jiyong 已提交
7290 7291 7292
        try{
            let recipient = new MyDeathRecipient(gIRemoteObject, null)
            var resultAdd1 = gIRemoteObject.addDeathRecipient(recipient, 0)
Y
yang-qibo 已提交
7293
            console.info("SUB_Softbus_IPC_RemoteProxy_00100:run addDeathRecipient first is " + resultAdd1);
J
jiyong 已提交
7294 7295 7296
            expect(resultAdd1 == true).assertTrue();

            var resultAdd2 = gIRemoteObject.addDeathRecipient(recipient, 0)
Y
yang-qibo 已提交
7297
            console.info("SUB_Softbus_IPC_RemoteProxy_00100:run addDeathRecipient second is " + resultAdd2);
J
jiyong 已提交
7298 7299 7300
            expect(resultAdd2 == true).assertTrue();

            var resultRemove1 = gIRemoteObject.removeDeathRecipient(recipient, 0)
Y
yang-qibo 已提交
7301
            console.info("SUB_Softbus_IPC_RemoteProxy_00100:run removeDeathRecipient1 is " + resultRemove1);
J
jiyong 已提交
7302 7303 7304
            expect(resultRemove1 == true).assertTrue();

            var resultRemove2 = gIRemoteObject.removeDeathRecipient(recipient, 0)
Y
yang-qibo 已提交
7305
            console.info("SUB_Softbus_IPC_RemoteProxy_00100:run  removeDeathRecipient2 is " + resultRemove2);
J
jiyong 已提交
7306 7307 7308
            expect(resultRemove2 == true).assertTrue();

            var resultRemove3 = gIRemoteObject.removeDeathRecipient(recipient, 0)
Y
yang-qibo 已提交
7309
            console.info("SUB_Softbus_IPC_RemoteProxy_00100:run  removeDeathRecipient3 is " + resultRemove3);
J
jiyong 已提交
7310 7311
            expect(resultRemove3 == false).assertTrue();
        } catch (error) {
Y
yang-qibo 已提交
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 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400
            console.info("SUB_Softbus_IPC_RemoteProxy_00100:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00100---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_RemoteProxy_00200
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_RemoteProxy_00200", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00200---------------------------");
        try{
            let recipient = new MyDeathRecipient(gIRemoteObject, null);
            var resultAdd = gIRemoteObject.addDeathRecipient(recipient, -(2*G));
            console.info("SUB_Softbus_IPC_RemoteProxy_00200:run addDeathRecipient first is " + resultAdd);
            expect(resultAdd).assertTrue();
            var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, -(2*G));
            console.info("SUB_Softbus_IPC_RemoteProxy_00200:run removeDeathRecipient1 is " + resultRemove);
            expect(resultRemove).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_RemoteProxy_00200:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00200---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_RemoteProxy_00300
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_RemoteProxy_00300", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00300---------------------------");
        try{
            let recipient = new MyDeathRecipient(gIRemoteObject, null);
            var resultAdd = gIRemoteObject.addDeathRecipient(recipient, (2*G - 1));
            console.info("SUB_Softbus_IPC_RemoteProxy_00300:run addDeathRecipient first is " + resultAdd);
            expect(resultAdd).assertTrue();
            var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, (2*G - 1));
            console.info("SUB_Softbus_IPC_RemoteProxy_00300:run removeDeathRecipient1 is " + resultRemove);
            expect(resultRemove).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_RemoteProxy_00300:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00300---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_RemoteProxy_00400
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_RemoteProxy_00400", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00400---------------------------");
        try{
            let recipient = new MyDeathRecipient(gIRemoteObject, null);
            var resultAdd = gIRemoteObject.addDeathRecipient(recipient, 2*G);
            console.info("SUB_Softbus_IPC_RemoteProxy_00400:run addDeathRecipient first is " + resultAdd);
            expect(resultAdd).assertTrue();
            var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, 2*G);
            console.info("SUB_Softbus_IPC_RemoteProxy_00400:run removeDeathRecipient1 is " + resultRemove);
            expect(resultRemove).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_RemoteProxy_00400:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00400---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_RemoteProxy_00500
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_RemoteProxy_00500", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00500---------------------------");
        try{
            let recipient = new MyDeathRecipient(gIRemoteObject, null);
            var resultAdd = gIRemoteObject.addDeathRecipient(recipient, -(2*G + 1));
            console.info("SUB_Softbus_IPC_RemoteProxy_00500:run addDeathRecipient first is " + resultAdd);
            expect(resultAdd).assertTrue();
            var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, -(2*G + 1));
            console.info("SUB_Softbus_IPC_RemoteProxy_00500:run removeDeathRecipient1 is " + resultRemove);
            expect(resultRemove).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_RemoteProxy_00500:error = " + error);
J
jiyong 已提交
7401
        }
Y
yang-qibo 已提交
7402
        console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00500---------------------------");
J
jiyong 已提交
7403 7404 7405
    });

    /*
Y
yang-qibo 已提交
7406
     * @tc.number  SUB_Softbus_IPC_RemoteProxy_00600
J
jiyong 已提交
7407 7408 7409 7410
     * @tc.name    Call isobjectdead to check whether the object is dead
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7411 7412
    it("SUB_Softbus_IPC_RemoteProxy_00600", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00600---------------------------");
J
jiyong 已提交
7413
        try{
Z
zhangpa2021 已提交
7414
            let recipient = new MyDeathRecipient(gIRemoteObject, null)
Y
yang-qibo 已提交
7415 7416 7417 7418
            var isDead = gIRemoteObject.isObjectDead();
            console.info("SUB_Softbus_IPC_RemoteProxy_00600: run isObjectDead result is " + isDead);
            expect(isDead == false).assertTrue();

Z
zhangpa2021 已提交
7419
            var resultAdd1 = gIRemoteObject.addDeathRecipient(recipient, 0)
Y
yang-qibo 已提交
7420
            console.info("SUB_Softbus_IPC_RemoteProxy_00600:run addDeathRecipient first result is " + resultAdd1);
J
jiyong 已提交
7421 7422
            expect(resultAdd1 == true).assertTrue();

Z
zhangpa2021 已提交
7423
            var isDead1 = gIRemoteObject.isObjectDead();
Y
yang-qibo 已提交
7424
            console.info("SUB_Softbus_IPC_RemoteProxy_00600: run isObjectDead result is " + isDead1);
Z
zhangpa2021 已提交
7425
            expect(isDead1 == false).assertTrue();
J
jiyong 已提交
7426

Y
yang-qibo 已提交
7427 7428 7429 7430
            var resultRemove1 = gIRemoteObject.removeDeathRecipient(recipient, 0)
            console.info("SUB_Softbus_IPC_RemoteProxy_00600:run removeDeathRecipient result is " + resultRemove1);
            expect(resultRemove1 == true).assertTrue();

Z
zhangpa2021 已提交
7431
            var resultAdd2 = gIRemoteObject.addDeathRecipient(recipient, 0)
Y
yang-qibo 已提交
7432
            console.info("SUB_Softbus_IPC_RemoteProxy_00600:run addDeathRecipient second result is " + resultAdd2);
J
jiyong 已提交
7433 7434
            expect(resultAdd2 == true).assertTrue();

Y
yang-qibo 已提交
7435 7436 7437 7438 7439 7440 7441
            var resultRemove2 = gIRemoteObject.removeDeathRecipient(recipient, 0)
            console.info("SUB_Softbus_IPC_RemoteProxy_00600:run removeDeathRecipient1 result is " + resultRemove2);
            expect(resultRemove2 == true).assertTrue();

            var resultRemove3 = gIRemoteObject.removeDeathRecipient(recipient, 0)
            console.info("SUB_Softbus_IPC_RemoteProxy_00600:run removeDeathRecipient3 result is " + resultRemove3);
            expect(resultRemove3 == false).assertTrue();
J
jiyong 已提交
7442

Z
zhangpa2021 已提交
7443
            var isDead2 = gIRemoteObject.isObjectDead();
Y
yang-qibo 已提交
7444 7445
            console.info("SUB_Softbus_IPC_RemoteProxy_00600: run isObjectDead2 result is " + isDead2);
            expect(isDead2 == false).assertTrue();
J
jiyong 已提交
7446
        } catch (error) {
Y
yang-qibo 已提交
7447
            console.info("SUB_Softbus_IPC_RemoteProxy_00600:error = " + error);
J
jiyong 已提交
7448
        }
Y
yang-qibo 已提交
7449
        console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00600---------------------------");
J
jiyong 已提交
7450 7451 7452
    });

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

            let result = object.getInterfaceDescriptor()
Y
yang-qibo 已提交
7464 7465
            console.info("SUB_Softbus_IPC_RemoteProxy_00700: run getInterfaceDescriptor result is " + result);
            expect(result).assertEqual("Test0300");
J
jiyong 已提交
7466
        } catch (error) {
Y
yang-qibo 已提交
7467
            console.info("SUB_Softbus_IPC_RemoteProxy_00700:error = " + error);
J
jiyong 已提交
7468
        }
Y
yang-qibo 已提交
7469
        console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00700---------------------------");
J
jiyong 已提交
7470 7471 7472
    });

    /*
Y
yang-qibo 已提交
7473
     * @tc.number  SUB_Softbus_IPC_RemoteProxy_00800
J
jiyong 已提交
7474 7475 7476 7477
     * @tc.name    Querylocalinterface searches for objects based on descriptors
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7478 7479
    it("SUB_Softbus_IPC_RemoteProxy_00800", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00800---------------------------");
J
jiyong 已提交
7480 7481 7482
        try{
            let object = new TestAbilityStub("Test0400");

Y
yang-qibo 已提交
7483 7484 7485 7486 7487
            let result = object.isObjectDead();
            console.info("SUB_Softbus_IPC_RemoteProxy_00800: run getInterfaceDescriptor is " + result);
            expect(result).assertEqual(false);
            object.attachLocalInterface(object, "Test2");
            console.info("SUB_Softbus_IPC_RemoteProxy_00800: run attachLocalInterface success");
J
jiyong 已提交
7488
            let res2 = object.queryLocalInterface('Test2');
Y
yang-qibo 已提交
7489
            console.info("SUB_Softbus_IPC_RemoteProxy_00800: run queryLocalInterface success, res2 is " + res2);
J
jiyong 已提交
7490
            let resultDescrip = object.getInterfaceDescriptor()
Y
yang-qibo 已提交
7491 7492 7493
            console.info("SUB_Softbus_IPC_RemoteProxy_00800: run getInterfaceDescriptor success resultDescrip is "
                + resultDescrip);
            expect(resultDescrip).assertEqual("Test2");
J
jiyong 已提交
7494
        } catch (error) {
Y
yang-qibo 已提交
7495
            console.info("SUB_Softbus_IPC_RemoteProxy_00800:error = " + error);
J
jiyong 已提交
7496
        }
Y
yang-qibo 已提交
7497
        console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00800---------------------------");
J
jiyong 已提交
7498 7499 7500
    });

    /*
Y
yang-qibo 已提交
7501
     * @tc.number  SUB_Softbus_IPC_RemoteProxy_00900
J
jiyong 已提交
7502 7503 7504 7505
     * @tc.name    Transaction constant validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527
    it("SUB_Softbus_IPC_RemoteProxy_00900", 0, async function(){
        console.info("SUB_Softbus_IPC_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_RemoteProxy_00900 error is" + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00900---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_00100
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
    it('SUB_Softbus_IPC_IPCSkeleton_00100', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00100---------------------------");
J
jiyong 已提交
7528
        try {
Y
yang-qibo 已提交
7529 7530 7531 7532 7533 7534 7535 7536 7537 7538
            console.info("SUB_Softbus_IPC_IPCSkeleton_00100")
            let remoteObject = new TestRemoteObject("aaa");
            let ret = rpc.IPCSkeleton.flushCommands(remoteObject);
            console.info("SUB_Softbus_IPC_IPCSkeleton_00100 RpcServer: flushCommands result: " + ret);
            expect(ret != null).assertTrue();
        }
        catch (error) {
            console.info("SUB_Softbus_IPC_IPCSkeleton_00100 error is :" + error)
        }
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00100---------------------------");
J
jiyong 已提交
7539 7540 7541
    })

    /*
Y
yang-qibo 已提交
7542
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_00200
J
jiyong 已提交
7543 7544 7545 7546
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7547 7548
    it('SUB_Softbus_IPC_IPCSkeleton_00200', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00200---------------------------");
J
jiyong 已提交
7549
        try {
Y
yang-qibo 已提交
7550
            console.info("SUB_Softbus_IPC_IPCSkeleton_00200 testcase")
J
jiyong 已提交
7551 7552
            let remoteObject = {};
            let ret = rpc.IPCSkeleton.flushCommands(remoteObject);
Y
yang-qibo 已提交
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 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623
            console.info("SUB_Softbus_IPC_IPCSkeleton_00200 RpcServer: flushCommands result: " + ret);
            expect(ret != null).assertTrue();
        }
        catch (error) {
            console.info("SUB_Softbus_IPC_IPCSkeleton_00200 error is :" + error)
        }
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00200---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_00300
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
    it('SUB_Softbus_IPC_IPCSkeleton_00300', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00300---------------------------");
        try {
            console.info("SUB_Softbus_IPC_IPCSkeleton_00300 testcase")
            let samgr = rpc.IPCSkeleton.getContextObject();
            console.info("SUB_Softbus_IPC_IPCSkeleton_00300 getContextObject result: " + samgr);
            expect(samgr != null).assertTrue();
            let geinde = samgr.getInterfaceDescriptor();
            console.info("SUB_Softbus_IPC_IPCSkeleton_00300 getInterfaceDescriptor result: " + geinde);
            expect(geinde).assertEqual("");
        }
        catch (error) {
            console.info("SUB_Softbus_IPC_IPCSkeleton_00300 error is :" + error)
        }
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00300---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_00400
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
    it('SUB_Softbus_IPC_IPCSkeleton_00400', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00400---------------------------");
        try {
            console.info("SUB_Softbus_IPC_IPCSkeleton_00400 testcase")
            let getCallingPid = rpc.IPCSkeleton.getCallingPid();
            console.info("SUB_Softbus_IPC_IPCSkeleton_00400 getCallingPid result: " + getCallingPid);
            expect(getCallingPid != null).assertTrue();
            let getCallingUid = rpc.IPCSkeleton.getCallingUid();
            console.info("SUB_Softbus_IPC_IPCSkeleton_00400 getCallingUid result: " + getCallingUid);
            expect(getCallingUid != null).assertTrue();
        }
        catch (error) {
            console.info("SUB_Softbus_IPC_IPCSkeleton_00400 error is :" + error)
        }
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00400---------------------------");
    })

    /*
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_00500
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
    it('SUB_Softbus_IPC_IPCSkeleton_00500', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00500---------------------------");
        try {
            console.info("SUB_Softbus_IPC_IPCSkeleton_00500 testcase")
            let getCallingPid = rpc.IPCSkeleton.getLocalDeviceID();
            console.info("SUB_Softbus_IPC_IPCSkeleton_00500 getCallingPid result: " + getCallingPid);
            expect(getCallingPid != null).assertTrue();
            let getCallingUid = rpc.IPCSkeleton.getCallingDeviceID();
            console.info("SUB_Softbus_IPC_IPCSkeleton_00500 getCallingUid result: " + getCallingUid);
            expect(getCallingUid != null).assertTrue();
J
jiyong 已提交
7624 7625
        }
        catch (error) {
Y
yang-qibo 已提交
7626
            console.info("SUB_Softbus_IPC_IPCSkeleton_00500 error is :" + error)
J
jiyong 已提交
7627
        }
Y
yang-qibo 已提交
7628
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00500---------------------------");
J
jiyong 已提交
7629 7630 7631
    })

    /*
Y
yang-qibo 已提交
7632
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_00600
J
jiyong 已提交
7633 7634 7635 7636 7637
     * @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 已提交
7638 7639
    it('SUB_Softbus_IPC_IPCSkeleton_00600', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00600---------------------------");
J
jiyong 已提交
7640 7641
        try{
            let getCallingPid = rpc.IPCSkeleton.getCallingPid();
Y
yang-qibo 已提交
7642 7643
            console.info("SUB_Softbus_IPC_IPCSkeleton_00600: run  getCallingPid result is :" + getCallingPid);
            expect(getCallingPid != null).assertTrue();
Z
zhangpa2021 已提交
7644

J
jiyong 已提交
7645
            let getCallingUid = rpc.IPCSkeleton.getCallingUid();
Y
yang-qibo 已提交
7646 7647
            console.info("SUB_Softbus_IPC_IPCSkeleton_00600: run getCallingUid result is :" + getCallingUid);
            expect(getCallingUid != null).assertTrue();
Z
zhangpa2021 已提交
7648

Y
yang-qibo 已提交
7649 7650 7651
            let getCallingToKenId = rpc.IPCSkeleton.getCallingTokenId();
            console.info("SUB_Softbus_IPC_IPCSkeleton_00600: run getCallingToKenId result is :" + getCallingToKenId);
            expect(getCallingToKenId != null).assertTrue();
Z
zhangpa2021 已提交
7652

J
jiyong 已提交
7653
            let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID();
Y
yang-qibo 已提交
7654 7655
            console.info("SUB_Softbus_IPC_IPCSkeleton_00600: run getLocalDeviceID result is :" + getLocalDeviceID);
            expect(getLocalDeviceID != null).assertTrue();
Z
zhangpa2021 已提交
7656

J
jiyong 已提交
7657
            let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID();
Y
yang-qibo 已提交
7658 7659
            console.info("SUB_Softbus_IPC_IPCSkeleton_00600: run getCallingDeviceID result is :" + getCallingDeviceID);
            expect(getCallingDeviceID != null).assertTrue();
J
jiyong 已提交
7660
        } catch (error){
Y
yang-qibo 已提交
7661
            console.info("SUB_Softbus_IPC_IPCSkeleton_00600: error = " + error);
J
jiyong 已提交
7662
        }
Y
yang-qibo 已提交
7663
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00600---------------------------");
J
jiyong 已提交
7664 7665 7666
    })

    /*
Y
yang-qibo 已提交
7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_00700
     * @tc.name    Basic method of testing ipcskeleton
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_IPCSkeleton_00700", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_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_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_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_IPCSkeleton_00700:" + rescallingPid +" ;"+ rescallingUid);
                expect(rescallingPid).assertEqual(callingPid);
                expect(rescallingUid).assertEqual(callingUid);
            })
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_IPCSkeleton_00700:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00700---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_00800
     * @tc.name    Basic method of testing ipcskeleton
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_IPCSkeleton_00800", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_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_IPCSkeleton_00800: callingPid: " + callingPid
                + ", callingUid: " + callingUid);
            await gIRemoteObject.sendRequest(CODE_IPCSKELETON_INT, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_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_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_IPCSkeleton_00800:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00800---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_00900
     * @tc.name    SetCallingIdentity Interface flags input parameter boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_IPCSkeleton_00900", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00900---------------------------");
        try{
            let id = "";
            let ret = rpc.IPCSkeleton.setCallingIdentity(id);
            console.info("SUB_Softbus_IPC_IPCSkeleton_00900: setCallingIdentity is: " + ret);
            expect(ret).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_IPCSkeleton_00900:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00900---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_01000
     * @tc.name    SetCallingIdentity Interface flags input parameter boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_IPCSkeleton_01000", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_01000---------------------------");
        try{
            let id = 0;
            let ret = rpc.IPCSkeleton.setCallingIdentity(id);
            console.info("SUB_Softbus_IPC_IPCSkeleton_01000: setCallingIdentity is: " + ret);
            expect(ret).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_IPCSkeleton_01000:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_01000---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_01100
     * @tc.name    SetCallingIdentity Interface flags input parameter boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
    it("SUB_Softbus_IPC_IPCSkeleton_01100", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_01100---------------------------");
        try{
            let id = "";
            for (let i = 0; i < (40*K - 1); i++){
                id += "a";
            }
            console.info("SUB_Softbus_IPC_IPCSkeleton_01100: id length is: " + id.length);

            let ret = rpc.IPCSkeleton.setCallingIdentity(id);
            console.info("SUB_Softbus_IPC_IPCSkeleton_01100: setCallingIdentity is: " + ret);
            expect(ret).assertTrue();
        } catch (error) {
            console.info("SUB_Softbus_IPC_IPCSkeleton_01100:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_01100---------------------------");
    });

    /*
     * @tc.number  SUB_Softbus_IPC_IPCSkeleton_01200
J
jiyong 已提交
7816 7817 7818 7819
     * @tc.name    Basic method of testing ipcskeleton
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7820 7821
    it("SUB_Softbus_IPC_IPCSkeleton_01200", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_01200---------------------------");
J
jiyong 已提交
7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837
        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);
Y
yang-qibo 已提交
7838 7839
            console.info("SUB_Softbus_IPC_IPCSkeleton_01200: callingPid: " + callingPid
                + ", callingUid: " + callingUid
J
jiyong 已提交
7840 7841 7842 7843 7844 7845
                         + ", 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();
Y
yang-qibo 已提交
7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860
            console.info("SUB_Softbus_IPC_IPCSkeleton_01200: start send request");
            await gIRemoteObject.sendRequest(CODE_IPCSKELETON, data, reply, option).then(function(result) {
                console.info("SUB_Softbus_IPC_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 已提交
7861 7862 7863 7864 7865
                })
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Y
yang-qibo 已提交
7866
            console.info("SUB_Softbus_IPC_IPCSkeleton_01200:error = " + error);
J
jiyong 已提交
7867
        }
Y
yang-qibo 已提交
7868
        console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_01200---------------------------");
J
jiyong 已提交
7869 7870
    });

Z
zhangpa2021 已提交
7871
    console.info("-----------------------SUB_Softbus_IPC_MessageParce_Test is end-----------------------");
J
jiyong 已提交
7872
});
Z
zhangpa2021 已提交
7873
}