RpcClientJsunit.test.js 414.0 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_Compatility_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
    const CODE_WRITE_BYTEARRAY = 1;
Z
zhangpa2021 已提交
43
    const CODE_SAME_PROCESS = 1;
J
jiyong 已提交
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
    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 已提交
63
    const CODE_IPCSKELETON_INT = 22;
J
jiyong 已提交
64
    const CODE_WRITESEQUENCEABLE = 23
J
jiyong 已提交
65 66 67 68 69 70
    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 已提交
71 72
    const CODE_WRITE_REMOTEOBJECTARRAY_1 = 30;
    const CODE_WRITE_REMOTEOBJECTARRAY_2 = 31;
J
jiyong 已提交
73 74 75 76 77 78 79 80

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

            },
            onDisconnect:function (elementName) {
Z
zhangpa2021 已提交
87
                console.info("RpcClient: onDisconnect")
J
jiyong 已提交
88 89
            },
            onFailed:function () {
Z
zhangpa2021 已提交
90
                console.info("RpcClient: onFailed")
J
jiyong 已提交
91 92 93 94 95
                gIRemoteObject = null
            }
        };
        FA.connectAbility(want, connect)
        return new Promise((resolve, reject) =>{
Z
zhangpa2021 已提交
96
            console.info("start connect local ability, wait 5 seconds")
J
jiyong 已提交
97
            setTimeout(()=>{
Z
zhangpa2021 已提交
98
                console.info("resolve proxy: " + gIRemoteObject)
J
jiyong 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
                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 已提交
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
        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 已提交
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
    }

    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 已提交
156 157 158 159 160 161 162 163 164 165 166 167

        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()
Z
zhangpa2021 已提交
168 169 170 171 172 173 174 175
                    let tmp2 = data.readShort()
                    let tmp3 = data.readInt()
                    let tmp4 = data.readLong()
                    let tmp5 = data.readFloat()
                    let tmp6 = data.readDouble()
                    let tmp7 = data.readBoolean()
                    let tmp8 = data.readChar()
                    let tmp9 = data.readString()
Z
zhangpa2021 已提交
176 177 178 179
                    let s = new MySequenceable(null, null)
                    data.readSequenceable(s)
                    reply.writeNoException()
                    reply.writeByte(tmp1)
Z
zhangpa2021 已提交
180 181 182 183 184 185 186 187
                    reply.writeShort(tmp2)
                    reply.writeInt(tmp3)
                    reply.writeLong(tmp4)
                    reply.writeFloat(tmp5)
                    reply.writeDouble(tmp6)
                    reply.writeBoolean(tmp7)
                    reply.writeChar(tmp8)
                    reply.writeString(tmp9)
Z
zhangpa2021 已提交
188 189 190 191 192 193 194 195 196 197
                    reply.writeSequenceable(s)
                    return true
                }
                default:
                {
                    console.error("default case, code: " + code)
                    return false
                }
            }
        }
J
jiyong 已提交
198 199
    }

Z
zhangpa2021 已提交
200

J
jiyong 已提交
201 202 203 204 205 206 207 208
    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 已提交
209
                console.info("onRemoteRequest called, descriptor: " + this.getInterfaceDescriptor())
J
jiyong 已提交
210 211
                result = true
            } else {
Z
zhangpa2021 已提交
212
                console.info("unknown code: " + code)
J
jiyong 已提交
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
            }
            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;
        }
    }

J
jiyong 已提交
241 242 243 244 245 246 247
    function assertArrayElementEqual(actual, expected) {
        expect(actual.length).assertEqual(expected.length)
        for (let i = 0; i < actual.length; i++) {
            expect(actual[i]).assertEqual(expected[i])
        }
    }

J
jiyong 已提交
248 249 250
    beforeAll(async function (done) {
        console.info('beforeAll called')
        await connectAbility().then((remote) => {
Z
zhangpa2021 已提交
251
            console.info("got remote proxy: " + remote)
J
jiyong 已提交
252
        }).catch((err) => {
Z
zhangpa2021 已提交
253
            console.info("got exception: " + err)
J
jiyong 已提交
254 255
        })
        done()
Z
zhangpa2021 已提交
256
        console.info("beforeAll done")
J
jiyong 已提交
257 258
    })

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

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

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

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

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

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

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

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

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

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

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

    /*
Z
zhangpa2021 已提交
349
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_00400
Y
yang-qibo 已提交
350 351 352 353 354
     * @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
     */
Z
zhangpa2021 已提交
355 356
    it("SUB_Softbus_IPC_Compatility_MessageParcel_00400", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_00400---------------------------");
Y
yang-qibo 已提交
357 358
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
359
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_00400: create object successfully.");
Y
yang-qibo 已提交
360 361 362 363 364 365

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /*
Z
zhangpa2021 已提交
779
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_01800
Z
zhangpa2021 已提交
780 781 782 783
     * @tc.name    Call rewindread interface to offset the read position to the specified position
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
784 785
    it("SUB_Softbus_IPC_Compatility_MessageParcel_01800", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_01800---------------------------");
Y
yang-qibo 已提交
786 787 788 789 790 791 792 793 794
        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);
Z
zhangpa2021 已提交
795
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01800: run writeInt is " + resultInt);
Y
yang-qibo 已提交
796 797
            var dataLong = 2;
            var resultLong = data.writeLong(dataLong);
Z
zhangpa2021 已提交
798
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01800: run writeLong is " + resultLong);
Y
yang-qibo 已提交
799 800 801 802 803 804 805

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

            var readIntData = data.readInt();
Z
zhangpa2021 已提交
806
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01800: run readInt is " + readIntData);
Y
yang-qibo 已提交
807 808 809 810
            expect(readIntData).assertEqual(dataInt);

            var writePosition = 0;
            var writeResult = data.rewindWrite(writePosition);
Z
zhangpa2021 已提交
811
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01800: run rewindWrite is " + writeResult);
Y
yang-qibo 已提交
812 813 814 815 816
            expect(writeResult).assertTrue();

            expect(data.getWritePosition()).assertEqual(0);
            dataInt = 3;
            resultInt = data.writeInt(dataInt);
Z
zhangpa2021 已提交
817
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01800: run writeInt is " + resultInt);
Y
yang-qibo 已提交
818 819 820

            var readPosition = 0;
            var readResult = data.rewindRead(readPosition);
Z
zhangpa2021 已提交
821
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01800: run rewindWrite is " + readResult);
Y
yang-qibo 已提交
822 823 824
            expect(readResult).assertTrue();

            readIntData = data.readInt();
Z
zhangpa2021 已提交
825
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01800: run readInt is " + readIntData);
Y
yang-qibo 已提交
826 827 828
            expect(readIntData).assertEqual(dataInt);
            data.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
829
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01800: error = " + error);
Y
yang-qibo 已提交
830
        }
Z
zhangpa2021 已提交
831
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_01800---------------------------");
Z
zhangpa2021 已提交
832 833 834
    });

    /*
Z
zhangpa2021 已提交
835
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_01900
Z
zhangpa2021 已提交
836
     * @tc.name    The rewindread interface is called to re offset the read position to the specified position.
Y
yang-qibo 已提交
837
                   The specified position is out of range
Z
zhangpa2021 已提交
838 839 840
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
841 842
    it("SUB_Softbus_IPC_Compatility_MessageParcel_01900", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_01900---------------------------");
Y
yang-qibo 已提交
843 844
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
845
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: create object successfully.");
Y
yang-qibo 已提交
846 847

            var result1 = data.getWritableBytes();
Z
zhangpa2021 已提交
848
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run getWritableBytes is " + result1);
Y
yang-qibo 已提交
849 850
            expect(result1 == 0).assertTrue();
            var result2 = data.getReadableBytes();
Z
zhangpa2021 已提交
851
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run getReadableBytes is " + result2);
Y
yang-qibo 已提交
852 853
            expect(result2 == 0).assertTrue();
            var result3 = data.getReadPosition();
Z
zhangpa2021 已提交
854
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run getReadPosition is " + result3);
Y
yang-qibo 已提交
855 856
            expect(result3 == 0).assertTrue();
            var result4 = data.getWritePosition();
Z
zhangpa2021 已提交
857
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run getWritePosition is " + result4);
Y
yang-qibo 已提交
858 859 860 861
            expect(result4 == 0).assertTrue();

            var dataInt = 1;
            var resultInt = data.writeInt(dataInt);
Z
zhangpa2021 已提交
862
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run writeInt is " + resultInt);
Y
yang-qibo 已提交
863 864 865
            expect(resultInt).assertTrue();
            var dataLong = 2;
            var resultLong = data.writeLong(dataLong);
Z
zhangpa2021 已提交
866
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run writeLong is " + resultLong);
Y
yang-qibo 已提交
867 868 869
            expect(resultLong).assertTrue();

            result1 = data.getWritableBytes();
Z
zhangpa2021 已提交
870
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run getWritableBytes is " + result1);
Y
yang-qibo 已提交
871 872
            expect(result1 == 52).assertTrue();
            result2 = data.getReadableBytes();
Z
zhangpa2021 已提交
873
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run getReadableBytes is " + result2);
Y
yang-qibo 已提交
874 875
            expect(result2 == 12).assertTrue();
            result3 = data.getReadPosition();
Z
zhangpa2021 已提交
876
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run getReadPosition is " + result3);
Y
yang-qibo 已提交
877 878
            expect(result3 == 0).assertTrue();
            result4 = data.getWritePosition();
Z
zhangpa2021 已提交
879
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run getWritePosition is " + result4);
Y
yang-qibo 已提交
880 881 882 883
            expect(result4 == 12).assertTrue();

            var readPosition = 100;
            var readResult = data.rewindRead(readPosition);
Z
zhangpa2021 已提交
884
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_01900: run rewindRead is " + readResult);
Y
yang-qibo 已提交
885
            expect(readResult == false).assertTrue();
Z
zhangpa2021 已提交
886

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Y
yang-qibo 已提交
1018 1019 1020 1021 1022
            var wShortArryData = [];
            for(let i=0;i<(50*K - 1);i++){
                wShortArryData[i] = 1;
            }
            var writeShortArrayResult = data.writeShortArray(wShortArryData);
Z
zhangpa2021 已提交
1023
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_02300: run writeShortArray "
Y
yang-qibo 已提交
1024 1025 1026 1027 1028
                + writeShortArrayResult);
            expect(writeShortArrayResult).assertTrue();

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

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

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

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

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

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

            var wShortArryData = [-32769, 0, 1, 2];
            var writeShortArrayResult = data.writeShortArray(wShortArryData);
Z
zhangpa2021 已提交
1081
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_02500: run writeShortArray is " + writeShortArrayResult);
Y
yang-qibo 已提交
1082 1083
            expect(writeShortArrayResult).assertTrue();
            var rShotrArrayData = data.readShortArray();
Z
zhangpa2021 已提交
1084
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_02500: run readShortArray is " + rShotrArrayData);
Y
yang-qibo 已提交
1085 1086 1087 1088
            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 已提交
1089

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

Z
zhangpa2021 已提交
1095
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_02500---------------------------");
Z
zhangpa2021 已提交
1096 1097 1098
    });

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

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

Y
yang-qibo 已提交
1115
            var rShotrArrayData = data.readShortArray();
Z
zhangpa2021 已提交
1116
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_02600: run readShortArray " + rShotrArrayData);
Y
yang-qibo 已提交
1117 1118 1119 1120
            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 已提交
1121

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /*
Z
zhangpa2021 已提交
1473
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_03900
Y
yang-qibo 已提交
1474 1475
     * @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 已提交
1476 1477 1478
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
1479 1480
    it("SUB_Softbus_IPC_Compatility_MessageParcel_03900", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_03900---------------------------");
Y
yang-qibo 已提交
1481 1482
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
1483
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_03900: create object successfully.");
Y
yang-qibo 已提交
1484 1485 1486 1487 1488 1489 1490 1491 1492 1493

            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);
Z
zhangpa2021 已提交
1494
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_03900: run writeShortArrayis is " + writeBooleanArrayResult);
Y
yang-qibo 已提交
1495
            expect(writeBooleanArrayResult).assertTrue();
Z
zhangpa2021 已提交
1496

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

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

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

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

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

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

            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);
Z
zhangpa2021 已提交
1558
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_04100: run writeShortArrayis is " + WriteBooleanArrayResult);
Y
yang-qibo 已提交
1559
            expect(WriteBooleanArrayResult).assertEqual(false);
Z
zhangpa2021 已提交
1560

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

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

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

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

            data.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
1596
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_04200: error " + error);
J
jiyong 已提交
1597
        }
Z
zhangpa2021 已提交
1598
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_04200---------------------------");
J
jiyong 已提交
1599 1600 1601
    });

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

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

Y
yang-qibo 已提交
1622 1623 1624

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

            data.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
1630
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_04300: error " + error);
J
jiyong 已提交
1631
        }
Z
zhangpa2021 已提交
1632
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_04300---------------------------");
J
jiyong 已提交
1633 1634 1635
    });

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

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

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

            data.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
1659
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_04400: error " + error);
J
jiyong 已提交
1660
        }
Z
zhangpa2021 已提交
1661
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_04400---------------------------");
J
jiyong 已提交
1662 1663 1664
    });

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

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

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

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

    /*
Z
zhangpa2021 已提交
1694
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_04600
Y
yang-qibo 已提交
1695 1696 1697 1698 1699
     * @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
     */
Z
zhangpa2021 已提交
1700 1701
    it("SUB_Softbus_IPC_Compatility_MessageParcel_04600", 0, function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_04600---------------------------");
Y
yang-qibo 已提交
1702 1703
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
1704
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_04600: create object successfully.");
Y
yang-qibo 已提交
1705 1706 1707

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


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

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

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

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

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

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

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

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

    /*
Z
zhangpa2021 已提交
1780
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_04900
Y
yang-qibo 已提交
1781 1782 1783 1784 1785
     * @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
     */
Z
zhangpa2021 已提交
1786 1787
    it("SUB_Softbus_IPC_Compatility_MessageParcel_04900", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_04900---------------------------");
Y
yang-qibo 已提交
1788 1789
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
1790
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_04900: create object successfully.");
Y
yang-qibo 已提交
1791 1792 1793 1794
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            var ByteArrayVar = [1, 2, 3, 4, 5];
            var writeShortArrayResult = data.writeByteArray(ByteArrayVar);
Z
zhangpa2021 已提交
1795
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_04900: run writeShortArrayis is " + writeShortArrayResult);
Y
yang-qibo 已提交
1796 1797 1798 1799
            expect(writeShortArrayResult == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
1800
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_04900: gIRemoteObject undefined");
Y
yang-qibo 已提交
1801 1802
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
1803
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_04900: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
1804 1805 1806
                expect(result.errCode == 0).assertTrue();

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

    /*
Z
zhangpa2021 已提交
1820
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_05000
Y
yang-qibo 已提交
1821 1822 1823 1824 1825
     * @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
     */
Z
zhangpa2021 已提交
1826 1827
    it("SUB_Softbus_IPC_Compatility_MessageParcel_05000", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_05000---------------------------");
Y
yang-qibo 已提交
1828 1829
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
1830
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05000: create object successfully.");
Y
yang-qibo 已提交
1831 1832 1833 1834 1835
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

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

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

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

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

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

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

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

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

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

    /*
Z
zhangpa2021 已提交
1903
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_05200
Y
yang-qibo 已提交
1904 1905 1906 1907
     * @tc.name    Writebytearray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
1908 1909
    it("SUB_Softbus_IPC_Compatility_MessageParcel_05200", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_05200---------------------------");
Y
yang-qibo 已提交
1910 1911
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
1912
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05200: create object successfully.");
Y
yang-qibo 已提交
1913 1914 1915 1916
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            var teArrayVar = [-128, 0, 1, 2, 128];
            var writeShortArrayResult = data.writeByteArray(teArrayVar);
Z
zhangpa2021 已提交
1917
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05200: run writeShortArrayis is " + writeShortArrayResult);
Y
yang-qibo 已提交
1918 1919 1920 1921
            expect(writeShortArrayResult == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
1922
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05200: gIRemoteObject undefined");
Y
yang-qibo 已提交
1923 1924
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
1925
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05200: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
1926 1927 1928
                expect(result.errCode == 0).assertTrue();

                var shortArryDataReply = result.reply.readByteArray();
Z
zhangpa2021 已提交
1929
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05200: run readByteArray is " + shortArryDataReply);
Y
yang-qibo 已提交
1930 1931 1932 1933 1934 1935 1936 1937 1938 1939
                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) {
Z
zhangpa2021 已提交
1940
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05200: error " +error);
Y
yang-qibo 已提交
1941
        }
Z
zhangpa2021 已提交
1942
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_05200---------------------------");
Y
yang-qibo 已提交
1943 1944 1945
    });

    /*
Z
zhangpa2021 已提交
1946
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_05300
Y
yang-qibo 已提交
1947 1948 1949 1950
     * @tc.name    Writebytearray interface, illegal value validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
1951 1952
    it("SUB_Softbus_IPC_Compatility_MessageParcel_05300", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_05300---------------------------");
Y
yang-qibo 已提交
1953 1954
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
1955
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05300: create object successfully.");
J
jiyong 已提交
1956 1957
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
1958
            var ByteArrayVar = [-129, 0, 1, 2, 127];
J
jiyong 已提交
1959
            var writeShortArrayResult = data.writeByteArray(ByteArrayVar);
Z
zhangpa2021 已提交
1960
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05300: run writeShortArrayis is " + writeShortArrayResult);
J
jiyong 已提交
1961 1962 1963 1964
            expect(writeShortArrayResult == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
1965
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05300: gIRemoteObject undefined");
J
jiyong 已提交
1966
            }
Y
yang-qibo 已提交
1967
            await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
1968
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05300: sendRequestis is " + result.errCode);
J
jiyong 已提交
1969 1970 1971
                expect(result.errCode == 0).assertTrue();

                var shortArryDataReply = result.reply.readByteArray();
Z
zhangpa2021 已提交
1972
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05300: run readByteArray is " + shortArryDataReply);
J
jiyong 已提交
1973 1974 1975 1976 1977 1978
                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 已提交
1979
            data.reclaim();
J
jiyong 已提交
1980 1981
            reply.reclaim();
            done();
J
jiyong 已提交
1982
        } catch (error) {
Z
zhangpa2021 已提交
1983
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05300: error " +error);
J
jiyong 已提交
1984
        }
Z
zhangpa2021 已提交
1985
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_05300---------------------------");
J
jiyong 已提交
1986 1987 1988
    });

    /*
Z
zhangpa2021 已提交
1989
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_05400
J
jiyong 已提交
1990 1991 1992 1993 1994
     * @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
     */
Z
zhangpa2021 已提交
1995 1996
    it("SUB_Softbus_IPC_Compatility_MessageParcel_05400", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_05400---------------------------");
J
jiyong 已提交
1997 1998
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
1999
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05400: create object successfully.");
J
jiyong 已提交
2000 2001 2002 2003 2004
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

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

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

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
2025
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05400: error " + error);
J
jiyong 已提交
2026
        }
Z
zhangpa2021 已提交
2027
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_05400---------------------------");
J
jiyong 已提交
2028 2029 2030
    });

    /*
Z
zhangpa2021 已提交
2031
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_05500
J
jiyong 已提交
2032 2033 2034 2035 2036
     * @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
     */
Z
zhangpa2021 已提交
2037 2038
    it("SUB_Softbus_IPC_Compatility_MessageParcel_05500", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_05500---------------------------");
J
jiyong 已提交
2039 2040
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
2041
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05500: create object successfully.");
J
jiyong 已提交
2042 2043 2044 2045 2046
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

            var intArryData = [100, 111, 112];
            var writeShortArrayResult = data.writeIntArray(intArryData);
Z
zhangpa2021 已提交
2047
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05500: run writeShortArrayis is " + writeShortArrayResult);
J
jiyong 已提交
2048 2049 2050 2051
            expect(writeShortArrayResult == true).assertTrue();

            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2052
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05500: gIRemoteObject undefined");
J
jiyong 已提交
2053 2054
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2055
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05500: sendRequestis is " + result.errCode);
J
jiyong 已提交
2056
                expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2057 2058 2059

                var newArr = []
                result.reply.readIntArray(newArr);
Z
zhangpa2021 已提交
2060
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05500: run readIntArray is " + newArr);
Y
yang-qibo 已提交
2061
                assertArrayElementEqual(intArryData,newArr);
J
jiyong 已提交
2062 2063 2064 2065 2066 2067
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
2068
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05500: error " + error);
J
jiyong 已提交
2069
        }
Z
zhangpa2021 已提交
2070
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_05500---------------------------");
J
jiyong 已提交
2071 2072 2073
    });

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

            var intArryData = [-2147483648, 0, 1, 2, 2147483647];
J
jiyong 已提交
2088
            var writeIntArrayResult = data.writeIntArray(intArryData);
Z
zhangpa2021 已提交
2089
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05600: run writeShortArrayis is " + writeIntArrayResult);
J
jiyong 已提交
2090
            expect(writeIntArrayResult == true).assertTrue();
J
jiyong 已提交
2091

J
jiyong 已提交
2092 2093
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2094
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05600: gIRemoteObject undefined");
J
jiyong 已提交
2095 2096
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2097
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05600: sendRequestis is " + result.errCode);
J
jiyong 已提交
2098 2099 2100
                expect(result.errCode == 0).assertTrue();

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

            data.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
2107
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05600: error " + error);
J
jiyong 已提交
2108
        }
Z
zhangpa2021 已提交
2109
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_05600---------------------------");
J
jiyong 已提交
2110 2111 2112
    });

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

            var intArryData = [-2147483649, 0, 1, 2, 2147483647];
J
jiyong 已提交
2127
            var writeIntArrayResult = data.writeIntArray(intArryData);
Z
zhangpa2021 已提交
2128
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05700: run writeShortArrayis is " + writeIntArrayResult);
J
jiyong 已提交
2129
            expect(writeIntArrayResult == true).assertTrue();
J
jiyong 已提交
2130

J
jiyong 已提交
2131 2132
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2133
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05700: gIRemoteObject undefined");
J
jiyong 已提交
2134 2135
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2136
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05700: sendRequestis is " + result.errCode);
J
jiyong 已提交
2137 2138 2139
                expect(result.errCode == 0).assertTrue();

                var shortArryDataReply = result.reply.readIntArray();
Z
zhangpa2021 已提交
2140
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05700: run readByteArray is " + shortArryDataReply);
J
jiyong 已提交
2141 2142 2143 2144 2145 2146
                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 已提交
2147 2148 2149

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

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

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

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

                var shortArryDataReply = result.reply.readIntArray();
Z
zhangpa2021 已提交
2183
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05800: run readByteArray is " + shortArryDataReply);
Y
yang-qibo 已提交
2184 2185 2186 2187 2188 2189
                var newintArryData = [0, 1, 2, 3, -2147483648];
                assertArrayElementEqual(newintArryData,shortArryDataReply);
            });

            data.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
2190
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05800: error " + error);
J
jiyong 已提交
2191
        }
Z
zhangpa2021 已提交
2192
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_05800---------------------------");
J
jiyong 已提交
2193 2194 2195
    });

    /*
Z
zhangpa2021 已提交
2196
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_05900
J
jiyong 已提交
2197 2198 2199 2200 2201
     * @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
     */
Z
zhangpa2021 已提交
2202 2203
    it("SUB_Softbus_IPC_Compatility_MessageParcel_05900", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_05900---------------------------");
J
jiyong 已提交
2204 2205
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
2206
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05900: create object successfully.");
J
jiyong 已提交
2207 2208 2209 2210 2211
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

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


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

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
2233
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_05900: error " + error);
J
jiyong 已提交
2234
        }
Z
zhangpa2021 已提交
2235
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_05900---------------------------");
J
jiyong 已提交
2236 2237 2238
    });

    /*
Z
zhangpa2021 已提交
2239
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_06000
J
jiyong 已提交
2240 2241 2242 2243 2244
     * @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
     */
Z
zhangpa2021 已提交
2245 2246
    it("SUB_Softbus_IPC_Compatility_MessageParcel_06000", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_06000---------------------------");
J
jiyong 已提交
2247 2248
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
2249
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06000: create object successfully.");
J
jiyong 已提交
2250 2251 2252 2253 2254
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

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

            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2260
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06000: gIRemoteObject undefined");
J
jiyong 已提交
2261 2262
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2263
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06000: sendRequestis is " + result.errCode);
J
jiyong 已提交
2264 2265 2266 2267
                expect(result.errCode == 0).assertTrue();

                var newArr = []
                result.reply.readFloatArray(newArr);
Z
zhangpa2021 已提交
2268
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06000: readFloatArray is " + newArr);
Y
yang-qibo 已提交
2269
                assertArrayElementEqual(floatArryData,newArr);
J
jiyong 已提交
2270 2271 2272 2273 2274 2275
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
2276
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06000: error " +error);
J
jiyong 已提交
2277
        }
Z
zhangpa2021 已提交
2278
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_06000---------------------------");
J
jiyong 已提交
2279 2280 2281
    });

    /*
Z
zhangpa2021 已提交
2282
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_06100
J
jiyong 已提交
2283 2284 2285 2286
     * @tc.name    Writefloatarray interface, boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
2287 2288
    it("SUB_Softbus_IPC_Compatility_MessageParcel_06100", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_06100---------------------------");
J
jiyong 已提交
2289 2290
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
2291
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06100: create object successfully.");
J
jiyong 已提交
2292 2293 2294 2295 2296
            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);
Z
zhangpa2021 已提交
2297
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06100: run writeFloatArrayis is " + writeShortArrayResult);
J
jiyong 已提交
2298 2299
            expect(writeShortArrayResult == true).assertTrue();

J
jiyong 已提交
2300 2301
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2302
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06100: gIRemoteObject undefined");
J
jiyong 已提交
2303 2304
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2305
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06100: sendRequestis is " + result.errCode);
J
jiyong 已提交
2306
                expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2307

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

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

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

            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2342
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06200: gIRemoteObject undefined");
J
jiyong 已提交
2343 2344
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2345
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06200: sendRequestis is " + result.errCode);
J
jiyong 已提交
2346
                expect(result.errCode == 0).assertTrue();
J
jiyong 已提交
2347

J
jiyong 已提交
2348
                var newArr = result.reply.readFloatArray();
Z
zhangpa2021 已提交
2349
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06200: run readFloatArray is " + newArr);
J
jiyong 已提交
2350 2351 2352 2353
                expect(newArr[0] == floatArryData[0]).assertTrue();
                expect(newArr[1] == floatArryData[1]).assertTrue();
                expect(newArr[2] == floatArryData[2]).assertTrue();
            });
J
jiyong 已提交
2354
            data.reclaim();
J
jiyong 已提交
2355 2356
            reply.reclaim();
            done();
J
jiyong 已提交
2357
        } catch (error) {
Z
zhangpa2021 已提交
2358
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06200: error " +error);
J
jiyong 已提交
2359
        }
Z
zhangpa2021 已提交
2360
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_06200---------------------------");
J
jiyong 已提交
2361 2362 2363
    });

    /*
Z
zhangpa2021 已提交
2364
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_06300
J
jiyong 已提交
2365 2366 2367 2368 2369
     * @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
     */
Z
zhangpa2021 已提交
2370 2371
    it("SUB_Softbus_IPC_Compatility_MessageParcel_06300", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_06300---------------------------");
J
jiyong 已提交
2372 2373
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
2374
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06300: create object successfully.");
J
jiyong 已提交
2375 2376 2377 2378 2379
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

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

            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2385
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06300: gIRemoteObject undefined");
J
jiyong 已提交
2386 2387
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SHORT, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2388
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06300: sendRequestis is " + result.errCode);
J
jiyong 已提交
2389 2390 2391
                expect(result.errCode == 0).assertTrue();

                var readShort = result.reply.readShort();
Z
zhangpa2021 已提交
2392
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06300: run readFloatArray is success, readShort is "
J
jiyong 已提交
2393 2394 2395 2396 2397 2398 2399 2400
                + readShort);
                expect(readShort == short).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
2401
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06300: error " + error);
J
jiyong 已提交
2402
        }
Z
zhangpa2021 已提交
2403
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_06300---------------------------");
J
jiyong 已提交
2404 2405 2406
    });

    /*
Z
zhangpa2021 已提交
2407
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_06400
J
jiyong 已提交
2408
     * @tc.name    WriteShort interface, boundary value verification
J
jiyong 已提交
2409 2410 2411
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
2412 2413
    it("SUB_Softbus_IPC_Compatility_MessageParcel_06400", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_06400---------------------------");
J
jiyong 已提交
2414 2415
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
2416
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06400: create object successfully.");
J
jiyong 已提交
2417 2418 2419 2420 2421 2422 2423
            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 已提交
2424

J
jiyong 已提交
2425 2426
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2427
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06400: gIRemoteObject undefined");
J
jiyong 已提交
2428 2429
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SHORT_MULTI, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2430
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06400: sendRequestis is " + result.errCode);
J
jiyong 已提交
2431 2432 2433 2434 2435 2436 2437 2438
                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 已提交
2439 2440

            data.reclaim();
J
jiyong 已提交
2441
            reply.reclaim();
J
jiyong 已提交
2442 2443
            done();
        } catch (error) {
Z
zhangpa2021 已提交
2444
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06400: error " + error);
J
jiyong 已提交
2445
        }
Z
zhangpa2021 已提交
2446
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_06400---------------------------");
J
jiyong 已提交
2447 2448 2449
    });

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

J
jiyong 已提交
2464 2465
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2466
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06500: gIRemoteObject undefined");
J
jiyong 已提交
2467 2468
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SHORT_MULTI, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2469
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06500: sendRequestis is " + result.errCode);
J
jiyong 已提交
2470 2471 2472
                expect(result.errCode == 0).assertTrue();
                expect(result.reply.readShort() == -32768).assertTrue();
            });
J
jiyong 已提交
2473 2474

            data.reclaim();
J
jiyong 已提交
2475 2476
            reply.reclaim();
            done();
J
jiyong 已提交
2477
        } catch (error) {
Z
zhangpa2021 已提交
2478
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06500: error " + error);
J
jiyong 已提交
2479
        }
Z
zhangpa2021 已提交
2480
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_06500---------------------------");
J
jiyong 已提交
2481 2482 2483
    });

    /*
Z
zhangpa2021 已提交
2484
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_06600
Y
yang-qibo 已提交
2485 2486
     * @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 已提交
2487 2488 2489
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
2490 2491
    it("SUB_Softbus_IPC_Compatility_MessageParcel_06600", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_06600---------------------------");
J
jiyong 已提交
2492 2493
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
2494
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06600: create object successfully.");
J
jiyong 已提交
2495 2496
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
2497

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

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

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

            data.reclaim();
J
jiyong 已提交
2517 2518
            reply.reclaim();
            done();
J
jiyong 已提交
2519
        } catch (error) {
Z
zhangpa2021 已提交
2520
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06600: error " + error);
J
jiyong 已提交
2521
        }
Z
zhangpa2021 已提交
2522
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_06600---------------------------");
J
jiyong 已提交
2523 2524 2525
    });

    /*
Z
zhangpa2021 已提交
2526
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_06700
Y
yang-qibo 已提交
2527 2528
     * @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 已提交
2529 2530 2531
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
2532 2533
    it("SUB_Softbus_IPC_Compatility_MessageParcel_06700", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_06700---------------------------");
J
jiyong 已提交
2534 2535
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
2536
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06700: create object successfully.");
J
jiyong 已提交
2537 2538
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
J
jiyong 已提交
2539

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

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

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

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

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

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

J
jiyong 已提交
2587 2588
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2589
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06800: gIRemoteObject undefined");
J
jiyong 已提交
2590 2591
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2592
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06800: run sendRequestis is "
Y
yang-qibo 已提交
2593
                             + result.errCode);
J
jiyong 已提交
2594 2595 2596
                expect(result.errCode == 0).assertTrue();

                var readlong = result.reply.readLong();
Z
zhangpa2021 已提交
2597
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06800: run readLong is success, readlong is " + readlong);
J
jiyong 已提交
2598 2599
                expect(readlong == short).assertTrue();
            });
J
jiyong 已提交
2600 2601

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

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

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

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

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

J
jiyong 已提交
2642 2643 2644
            data.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
2645
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_06900: error " + error);
J
jiyong 已提交
2646
        }
Z
zhangpa2021 已提交
2647
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_06900---------------------------");
J
jiyong 已提交
2648 2649 2650
    });

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

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

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

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

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

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

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

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

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

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

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

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

Z
zhangpa2021 已提交
2764
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_07200---------------------------");
J
jiyong 已提交
2765 2766 2767
    });

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

            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2787
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07300: gIRemoteObject is undefined");
Y
yang-qibo 已提交
2788 2789
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2790
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07300: run sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
2791
                var replyReadResult = reply.readDouble();
Z
zhangpa2021 已提交
2792
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07300: run rreplyReadResult is " + replyReadResult);
Y
yang-qibo 已提交
2793 2794 2795 2796 2797
                expect(replyReadResult == token).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
J
jiyong 已提交
2798
        } catch (error) {
Z
zhangpa2021 已提交
2799
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07300:error = " + error);
J
jiyong 已提交
2800
        }
Z
zhangpa2021 已提交
2801
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_07300---------------------------");
J
jiyong 已提交
2802 2803 2804
    });

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

J
jiyong 已提交
2822 2823
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2824
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07400: gIRemoteObject is undefined");
J
jiyong 已提交
2825
            }
Y
yang-qibo 已提交
2826
            await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2827
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07400: run sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
2828
                var replyReadResult = reply.readDouble();
Z
zhangpa2021 已提交
2829
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07400: run replyReadResult is " + replyReadResult);
J
jiyong 已提交
2830 2831
                expect(replyReadResult == token).assertTrue();
            });
J
jiyong 已提交
2832 2833

            data.reclaim();
J
jiyong 已提交
2834
            reply.reclaim();
J
jiyong 已提交
2835
        } catch (error) {
Z
zhangpa2021 已提交
2836
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07400:error = " + error);
J
jiyong 已提交
2837
        }
Z
zhangpa2021 已提交
2838
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_07400---------------------------");
J
jiyong 已提交
2839 2840 2841
    });

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

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

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

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

Y
yang-qibo 已提交
2902
    /*
Z
zhangpa2021 已提交
2903
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_07700
Y
yang-qibo 已提交
2904 2905 2906 2907 2908
     * @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
     */
Z
zhangpa2021 已提交
2909 2910
    it("SUB_Softbus_IPC_Compatility_MessageParcel_07700", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_07700---------------------------");
Y
yang-qibo 已提交
2911 2912
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
2913
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07700: create object successfully.");
Y
yang-qibo 已提交
2914 2915 2916 2917
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            var token = false;
            var result = data.writeBoolean(token);
Z
zhangpa2021 已提交
2918
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07700:run writeBooleanis is " + result);
Y
yang-qibo 已提交
2919 2920 2921
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
2922
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07700: gIRemoteObject is undefined");
Y
yang-qibo 已提交
2923 2924
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_BOOLEAN, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
2925
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07700: run sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
2926
                var replyReadResult = result.reply.readBoolean();
Z
zhangpa2021 已提交
2927
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07700: run readBoolean is " + replyReadResult);
Y
yang-qibo 已提交
2928 2929
                expect(replyReadResult == token).assertTrue();
            });
J
jiyong 已提交
2930 2931 2932 2933
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
2934
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_07700:error = " + error);
J
jiyong 已提交
2935
        }
Z
zhangpa2021 已提交
2936
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_07700---------------------------");
J
jiyong 已提交
2937 2938 2939
    });

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

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

    /*
Z
zhangpa2021 已提交
2990
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_08000
Y
yang-qibo 已提交
2991 2992 2993 2994 2995
     * @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
     */
Z
zhangpa2021 已提交
2996 2997
    it("SUB_Softbus_IPC_Compatility_MessageParcel_08000", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_08000---------------------------");
Y
yang-qibo 已提交
2998 2999
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
3000
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08000: create object successfully.");
Y
yang-qibo 已提交
3001 3002 3003 3004
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            var token = 65;
            var result = data.writeChar(token);
Z
zhangpa2021 已提交
3005
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08000:run writeCharis is " + result);
J
jiyong 已提交
3006 3007 3008
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
3009
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08000: gIRemoteObject is undefined");
J
jiyong 已提交
3010
            }
Y
yang-qibo 已提交
3011
            await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
3012
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08000: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
3013
                var replyReadResult = result.reply.readChar();
Z
zhangpa2021 已提交
3014
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08000: run readChar is " + replyReadResult);
J
jiyong 已提交
3015 3016 3017 3018 3019 3020 3021
                expect(replyReadResult == token).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3022
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08000:error = " + error);
J
jiyong 已提交
3023
        }
Z
zhangpa2021 已提交
3024
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_08000---------------------------");
J
jiyong 已提交
3025 3026 3027
    });

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3060
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08100:error = " + error);
J
jiyong 已提交
3061
        }
Z
zhangpa2021 已提交
3062
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_08100---------------------------");
J
jiyong 已提交
3063 3064 3065
    });

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

J
jiyong 已提交
3094
            data.reclaim();
J
jiyong 已提交
3095 3096
            reply.reclaim();
            done();
J
jiyong 已提交
3097
        } catch (error) {
Z
zhangpa2021 已提交
3098
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08200:error = " + error);
J
jiyong 已提交
3099
        }
Z
zhangpa2021 已提交
3100
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_08200---------------------------");
J
jiyong 已提交
3101 3102 3103
    });

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3136
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08300:error = " + error);
J
jiyong 已提交
3137
        }
Z
zhangpa2021 已提交
3138
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_08300---------------------------");
J
jiyong 已提交
3139 3140 3141
    });

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3174
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08400:error = " + error);
J
jiyong 已提交
3175
        }
Z
zhangpa2021 已提交
3176
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_08400---------------------------");
J
jiyong 已提交
3177 3178 3179
    });

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

J
jiyong 已提交
3197
        } catch (error) {
Z
zhangpa2021 已提交
3198
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08500:error = " + error);
Y
yang-qibo 已提交
3199
            expect(error != null).assertTrue();
J
jiyong 已提交
3200
        }
Y
yang-qibo 已提交
3201
        data.reclaim();
Z
zhangpa2021 已提交
3202
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_08500---------------------------");
J
jiyong 已提交
3203 3204 3205
    });

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3241
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08600:error = " + error);
J
jiyong 已提交
3242
        }
Z
zhangpa2021 已提交
3243
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_08600---------------------------");
J
jiyong 已提交
3244 3245 3246
    });

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

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

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

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

            data.reclaim();
            reply.reclaim();
            done();
J
jiyong 已提交
3332
        } catch (error) {
Z
zhangpa2021 已提交
3333
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_08900:error = " + error);
J
jiyong 已提交
3334
        }
Z
zhangpa2021 已提交
3335
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_08900---------------------------");
J
jiyong 已提交
3336 3337 3338
    });

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

            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)
            {
Z
zhangpa2021 已提交
3359
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09000: gIRemoteObject is undefined");
Y
yang-qibo 已提交
3360 3361
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_BYTE_MULTI, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
3362
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09000: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
3363 3364 3365 3366 3367 3368 3369 3370

                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 已提交
3371 3372 3373 3374
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3375
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09000:error = " + error);
J
jiyong 已提交
3376
        }
Z
zhangpa2021 已提交
3377
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_09000---------------------------");
J
jiyong 已提交
3378 3379 3380
    });

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

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

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

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

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

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3499
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09400:error = " + error);
J
jiyong 已提交
3500
        }
Y
yang-qibo 已提交
3501

Z
zhangpa2021 已提交
3502
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_09400---------------------------");
J
jiyong 已提交
3503 3504 3505
    });

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

Y
yang-qibo 已提交
3519 3520 3521 3522 3523
            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 已提交
3524 3525 3526

            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
3527
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09500: gIRemoteObject is undefined");
J
jiyong 已提交
3528
            }
Y
yang-qibo 已提交
3529
            await gIRemoteObject.sendRequest(CODE_WRITE_INT_MULTI, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
3530
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09500: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
3531 3532 3533 3534 3535
                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 已提交
3536 3537 3538 3539 3540 3541
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3542
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09500:error = " + error);
J
jiyong 已提交
3543
        }
Y
yang-qibo 已提交
3544

Z
zhangpa2021 已提交
3545
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_09500---------------------------");
J
jiyong 已提交
3546 3547 3548
    });

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

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3576
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09600:error = " + error);
J
jiyong 已提交
3577 3578
        }

Z
zhangpa2021 已提交
3579
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_09600---------------------------");
J
jiyong 已提交
3580 3581 3582
    });

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

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3610
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09700:error = " + error);
J
jiyong 已提交
3611
        }
Y
yang-qibo 已提交
3612

Z
zhangpa2021 已提交
3613
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_09700---------------------------");
J
jiyong 已提交
3614 3615 3616
    });

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3649
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09800:error = " + error);
J
jiyong 已提交
3650
        }
Z
zhangpa2021 已提交
3651
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_09800---------------------------");
J
jiyong 已提交
3652 3653 3654
    });

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3686
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_09900:error = " + error);
J
jiyong 已提交
3687 3688
        }

Z
zhangpa2021 已提交
3689
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_09900---------------------------");
J
jiyong 已提交
3690 3691 3692
    });

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3724
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_10000:error = " + error);
J
jiyong 已提交
3725 3726
        }

Z
zhangpa2021 已提交
3727
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_10000---------------------------");
J
jiyong 已提交
3728 3729 3730
    });

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
3762
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_10100:error = " + error);
J
jiyong 已提交
3763 3764
        }

Z
zhangpa2021 已提交
3765
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_10100---------------------------");
J
jiyong 已提交
3766 3767 3768
    });

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

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

    /*
Z
zhangpa2021 已提交
3793
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_10300
Y
yang-qibo 已提交
3794
     * @tc.name    Test messageparcel to deliver rawdata data
J
jiyong 已提交
3795 3796 3797
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
3798 3799
    it("SUB_Softbus_IPC_Compatility_MessageParcel_10300", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_10300---------------------------");
J
jiyong 已提交
3800 3801
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
3802
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_10300: create object successfully.");
J
jiyong 已提交
3803

Y
yang-qibo 已提交
3804
            var Capacity = data.getRawDataCapacity()
Z
zhangpa2021 已提交
3805
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_10300:run Capacity success, Capacity is " + Capacity);
Y
yang-qibo 已提交
3806
            expect(Capacity).assertEqual(128*M);
J
jiyong 已提交
3807

Y
yang-qibo 已提交
3808 3809
            var rawdata = [1, 2, 3]
            var result = data.writeRawData(rawdata, rawdata.length);
Z
zhangpa2021 已提交
3810
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_10300:run writeRawDatais is " + result);
Y
yang-qibo 已提交
3811 3812
            expect(result == true).assertTrue();
            var newReadResult = data.readRawData(rawdata.length)
Z
zhangpa2021 已提交
3813
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_10300:run readRawDatais is " + newReadResult);
Y
yang-qibo 已提交
3814
            assertArrayElementEqual(newReadResult,rawdata);
J
jiyong 已提交
3815
        } catch (error) {
Z
zhangpa2021 已提交
3816
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_10300:error = " + error);
J
jiyong 已提交
3817
        }
Y
yang-qibo 已提交
3818
        data.reclaim();
Z
zhangpa2021 已提交
3819
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_10300---------------------------");
J
jiyong 已提交
3820 3821 3822
    });

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

Z
zhangpa2021 已提交
3849
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_10400---------------------------");
J
jiyong 已提交
3850 3851 3852
    });

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

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

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

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

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

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

            let testRemoteObject = new TestRemoteObject("testObject");
            var result = data.writeRemoteObject(testRemoteObject);
Z
zhangpa2021 已提交
4084
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11000: result is " + result);
Y
yang-qibo 已提交
4085 4086 4087
            expect(result == true).assertTrue();
            data.readRemoteObject()
        } catch (error) {
Z
zhangpa2021 已提交
4088
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11000:error = " + error);
J
jiyong 已提交
4089 4090
        }
        data.reclaim();
Z
zhangpa2021 已提交
4091
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_11000---------------------------");
J
jiyong 已提交
4092 4093 4094
    });

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

            var token = {}
            var result = data.writeRemoteObject(token);
Z
zhangpa2021 已提交
4108
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11100: result is " + result);
Y
yang-qibo 已提交
4109 4110
            expect(result == false).assertTrue();
        } catch (error) {
Z
zhangpa2021 已提交
4111
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11100:error = " + error);
Y
yang-qibo 已提交
4112 4113
        }
        data.reclaim();
Z
zhangpa2021 已提交
4114
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_11100---------------------------");
Y
yang-qibo 已提交
4115 4116 4117
    });

    /*
Z
zhangpa2021 已提交
4118
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_11200
Y
yang-qibo 已提交
4119 4120
     * @tc.name    Call the writesequenceable interface to write the custom serialized
     *             object to the messageparcel instance
J
jiyong 已提交
4121 4122 4123
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
4124 4125
    it("SUB_Softbus_IPC_Compatility_MessageParcel_11200", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_11200---------------------------");
J
jiyong 已提交
4126 4127
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
4128
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11200: create object successfully.");
J
jiyong 已提交
4129 4130
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
4131 4132 4133

            let sequenceable = new MySequenceable(1, "aaa");
            let result = data.writeSequenceable(sequenceable);
Z
zhangpa2021 已提交
4134
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11200: writeSequenceable is " + result);
Y
yang-qibo 已提交
4135 4136 4137
            expect(result == true).assertTrue();
            let ret = new MySequenceable(0, "");
            let result2 = data.readSequenceable(ret);
Z
zhangpa2021 已提交
4138
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11200: readSequenceable is " + result2);
Y
yang-qibo 已提交
4139
            expect(result2 == true).assertTrue();
J
jiyong 已提交
4140
        } catch (error) {
Z
zhangpa2021 已提交
4141
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11200:error = " + error);
J
jiyong 已提交
4142 4143
        }
        data.reclaim();
Z
zhangpa2021 已提交
4144
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_11200---------------------------");
J
jiyong 已提交
4145 4146 4147
    });

    /*
Z
zhangpa2021 已提交
4148
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_11300
Y
yang-qibo 已提交
4149 4150
     * @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 已提交
4151 4152 4153
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
4154 4155
    it("SUB_Softbus_IPC_Compatility_MessageParcel_11300", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_11300---------------------------");
J
jiyong 已提交
4156 4157
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
4158
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11300: create object successfully.");
J
jiyong 已提交
4159 4160
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Y
yang-qibo 已提交
4161 4162

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

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

J
jiyong 已提交
4178 4179 4180 4181
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
4182
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11300:error = " + error);
J
jiyong 已提交
4183
        }
Z
zhangpa2021 已提交
4184
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_11300---------------------------");
J
jiyong 已提交
4185 4186 4187
    });

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

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

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

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

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
4261
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11500:error = " + error);
Z
zhangpa2021 已提交
4262 4263
        }

Z
zhangpa2021 已提交
4264
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_11500---------------------------");
Y
yang-qibo 已提交
4265 4266 4267
    });

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

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

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

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
4339
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11700:error = " + error);
Y
yang-qibo 已提交
4340 4341
        }

Z
zhangpa2021 已提交
4342
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_11700---------------------------");
Y
yang-qibo 已提交
4343 4344 4345
    });

    /*
Z
zhangpa2021 已提交
4346
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_11800
Y
yang-qibo 已提交
4347 4348 4349 4350 4351
     * @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
     */
Z
zhangpa2021 已提交
4352 4353
    it("SUB_Softbus_IPC_Compatility_MessageParcel_11800", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_11800---------------------------");
Y
yang-qibo 已提交
4354 4355
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
4356
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11800: create object successfully.");
Y
yang-qibo 已提交
4357 4358 4359 4360 4361 4362 4363 4364
            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)
            {
Z
zhangpa2021 已提交
4365
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11800: gIRemoteObject is undefined");
Y
yang-qibo 已提交
4366 4367
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLE, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
4368
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11800: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
4369 4370
                var s = new MySequenceable(null,null)
                var replyReadResult = result.reply.readSequenceable(s);
Z
zhangpa2021 已提交
4371
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11800: run readSequenceable is" + replyReadResult);
Y
yang-qibo 已提交
4372 4373 4374 4375 4376 4377 4378 4379
                expect(s.str == sequenceable.str).assertTrue();
                expect(s.num == sequenceable.num).assertTrue();
            });

            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
4380
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11800:error = " + error);
Y
yang-qibo 已提交
4381 4382
        }

Z
zhangpa2021 已提交
4383
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_11800---------------------------");
Y
yang-qibo 已提交
4384 4385 4386
    });

    /*
Z
zhangpa2021 已提交
4387
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_11900
Y
yang-qibo 已提交
4388 4389 4390 4391 4392
     * @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
     */
Z
zhangpa2021 已提交
4393 4394
    it("SUB_Softbus_IPC_Compatility_MessageParcel_11900", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_11900---------------------------");
Y
yang-qibo 已提交
4395 4396
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
4397
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11900: create object successfully.");
Y
yang-qibo 已提交
4398 4399 4400 4401 4402
            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);
Z
zhangpa2021 已提交
4403
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11900: writeSequenceableArray is " + result);
Y
yang-qibo 已提交
4404 4405 4406
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
4407
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11900: gIRemoteObject is undefined");
Y
yang-qibo 已提交
4408 4409
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLEARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
4410
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11900: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
4411 4412 4413
                var s = [new MySequenceable(null, null), new MySequenceable(null, null),
                         new MySequenceable(null, null)];
                result.reply.readSequenceableArray(s);
Z
zhangpa2021 已提交
4414
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11900: run readSequenceableArray is" + s);
Y
yang-qibo 已提交
4415 4416 4417 4418 4419 4420 4421 4422 4423 4424
                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) {
Z
zhangpa2021 已提交
4425
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_11900:error = " + error);
Y
yang-qibo 已提交
4426 4427
        }

Z
zhangpa2021 已提交
4428
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_11900---------------------------");
Y
yang-qibo 已提交
4429 4430 4431
    });

    /*
Z
zhangpa2021 已提交
4432
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_12000
Y
yang-qibo 已提交
4433 4434 4435 4436 4437
     * @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
     */
Z
zhangpa2021 已提交
4438 4439
    it("SUB_Softbus_IPC_Compatility_MessageParcel_12000", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_12000---------------------------");
Y
yang-qibo 已提交
4440 4441
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
4442
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12000: create object successfully.");
Y
yang-qibo 已提交
4443 4444 4445 4446 4447
            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);
Z
zhangpa2021 已提交
4448
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12000: writeSequenceable is " + result);
Y
yang-qibo 已提交
4449 4450 4451
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
4452
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12000: gIRemoteObject is undefined");
Y
yang-qibo 已提交
4453 4454
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLEARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
4455
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12000: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
4456 4457 4458
                var s = [new MySequenceable(null, null),
                         new MySequenceable(null, null), new MySequenceable(null, null)]
                result.reply.readSequenceableArray(s);
Z
zhangpa2021 已提交
4459
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12000: run readSequenceableArray is" +s);
Y
yang-qibo 已提交
4460 4461 4462 4463 4464 4465 4466 4467 4468 4469
                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) {
Z
zhangpa2021 已提交
4470
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12000:error = " + error);
Y
yang-qibo 已提交
4471 4472
        }

Z
zhangpa2021 已提交
4473
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_12000---------------------------");
Y
yang-qibo 已提交
4474 4475 4476
    });

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

    /*
Z
zhangpa2021 已提交
4501
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_12200
Y
yang-qibo 已提交
4502 4503 4504 4505 4506
     * @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
     */
Z
zhangpa2021 已提交
4507 4508
    it("SUB_Softbus_IPC_Compatility_MessageParcel_12200", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_12200---------------------------");
Y
yang-qibo 已提交
4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520
        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();
Z
zhangpa2021 已提交
4521
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12200: create object successfully.");
Y
yang-qibo 已提交
4522 4523 4524 4525 4526 4527 4528 4529
            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);
Z
zhangpa2021 已提交
4530
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12200: writeRemoteObjectArray is " + result);
Y
yang-qibo 已提交
4531 4532 4533
            expect(result == true).assertTrue();
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
4534
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12200: gIRemoteObject is undefined");
Y
yang-qibo 已提交
4535 4536
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
4537
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12200: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
4538 4539 4540 4541 4542 4543 4544 4545 4546 4547
                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) {
Z
zhangpa2021 已提交
4548
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12200:error = " + error);
Y
yang-qibo 已提交
4549 4550
        }

Z
zhangpa2021 已提交
4551
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_12200---------------------------");
Y
yang-qibo 已提交
4552 4553 4554
    });

    /*
Z
zhangpa2021 已提交
4555
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_12300
Y
yang-qibo 已提交
4556 4557 4558 4559 4560
     * @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
     */
Z
zhangpa2021 已提交
4561 4562
    it("SUB_Softbus_IPC_Compatility_MessageParcel_12300", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_12300---------------------------");
Y
yang-qibo 已提交
4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574
        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();
Z
zhangpa2021 已提交
4575
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12300: create object successfully.");
Y
yang-qibo 已提交
4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586
            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)
            {
Z
zhangpa2021 已提交
4587
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12300: gIRemoteObject is undefined");
Y
yang-qibo 已提交
4588 4589
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
4590
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12300: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
4591 4592 4593 4594 4595 4596 4597
                expect(result.errCode == 0).assertTrue();
            });

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

    /*
Z
zhangpa2021 已提交
4604
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_12400
Y
yang-qibo 已提交
4605 4606 4607 4608
     * @tc.name    Test messageparcel delivery file descriptor object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
4609 4610
    it("SUB_Softbus_IPC_Compatility_MessageParcel_12400", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_12400---------------------------");
Y
yang-qibo 已提交
4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656
        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()
Z
zhangpa2021 已提交
4657
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_12400---------------------------");
Y
yang-qibo 已提交
4658 4659 4660
    });

    /*
Z
zhangpa2021 已提交
4661
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_12500
Y
yang-qibo 已提交
4662 4663 4664 4665
     * @tc.name    Test messageparcel to deliver the reply message received in promise across processes
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
4666 4667
    it("SUB_Softbus_IPC_Compatility_MessageParcel_12500", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_12500---------------------------");
Y
yang-qibo 已提交
4668 4669
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
4670
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12500: create object successfully.");
Y
yang-qibo 已提交
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
            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) {
Z
zhangpa2021 已提交
4705
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12500:error = " + error);
Y
yang-qibo 已提交
4706
        }
Z
zhangpa2021 已提交
4707
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_12500---------------------------");
Y
yang-qibo 已提交
4708 4709 4710
    });

    /*
Z
zhangpa2021 已提交
4711
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_12600
Y
yang-qibo 已提交
4712 4713 4714 4715 4716
     * @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
     */
Z
zhangpa2021 已提交
4717 4718
    it("SUB_Softbus_IPC_Compatility_MessageParcel_12600", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_12600---------------------------");
Y
yang-qibo 已提交
4719 4720
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
4721
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12600: create object successfully.");
Y
yang-qibo 已提交
4722 4723
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
Z
zhangpa2021 已提交
4724

Y
yang-qibo 已提交
4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735
            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()

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

           console.info("start send request")
           await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option, sendRequestCallback) 
                
Y
yang-qibo 已提交
4765
        } catch (error) {
Z
zhangpa2021 已提交
4766
         console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12600:error = " + error);
Y
yang-qibo 已提交
4767
        }
Z
zhangpa2021 已提交
4768
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_12600---------------------------");
Y
yang-qibo 已提交
4769 4770 4771
    });

    /*
Z
zhangpa2021 已提交
4772
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_12700
Y
yang-qibo 已提交
4773 4774 4775 4776 4777
     * @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
     */
Z
zhangpa2021 已提交
4778 4779
    it("SUB_Softbus_IPC_Compatility_MessageParcel_12700", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_12700---------------------------");
Y
yang-qibo 已提交
4780 4781
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
4782
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12700: create object successfully.");
Y
yang-qibo 已提交
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
            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) {
Z
zhangpa2021 已提交
4820
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12700:error = " + error);
Y
yang-qibo 已提交
4821 4822 4823 4824
        }
        sleep(2000)
        data.reclaim();
        reply.reclaim();
Z
zhangpa2021 已提交
4825
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_12700---------------------------");
Y
yang-qibo 已提交
4826 4827 4828
    });

    /*
Z
zhangpa2021 已提交
4829
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_12800
Y
yang-qibo 已提交
4830 4831 4832 4833 4834 4835
     * @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
     */
Z
zhangpa2021 已提交
4836 4837
    it("SUB_Softbus_IPC_Compatility_MessageParcel_12800", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_12800---------------------------");
Y
yang-qibo 已提交
4838 4839
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
4840
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12800: create object successfully.");
Y
yang-qibo 已提交
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
            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) {
Z
zhangpa2021 已提交
4878
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12800:error = " + error);
Y
yang-qibo 已提交
4879 4880 4881 4882
        }
        sleep(2000)
        data.reclaim();
        reply.reclaim();
Z
zhangpa2021 已提交
4883
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_12800---------------------------");
Y
yang-qibo 已提交
4884 4885 4886
    });

    /*
Z
zhangpa2021 已提交
4887
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_12900
Y
yang-qibo 已提交
4888 4889 4890 4891
     * @tc.name    Test messageparcel to pass an object of type iremoteobject across processes
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
4892 4893
    it('SUB_Softbus_IPC_Compatility_MessageParcel_12900', 0, async function(done) {
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_12900---------------------------");
Y
yang-qibo 已提交
4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905
        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)
Z
zhangpa2021 已提交
4906
        console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12900 result is:" + result)
Y
yang-qibo 已提交
4907 4908 4909 4910 4911
        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)=> {
Z
zhangpa2021 已提交
4912
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12900 sendRequest done, error code: " + result.errCode)
Y
yang-qibo 已提交
4913 4914 4915 4916 4917 4918 4919
                expect(result.errCode).assertEqual(0)
                result.reply.readException()
            })
                data.reclaim()
                reply.reclaim()
                console.info("test done")
    } catch(error) {
Z
zhangpa2021 已提交
4920
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_12900: error = " + error);
Y
yang-qibo 已提交
4921
        }
Z
zhangpa2021 已提交
4922
            console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_12900---------------------------");
Y
yang-qibo 已提交
4923 4924 4925 4926
    })


    /*
Z
zhangpa2021 已提交
4927
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_13000
Y
yang-qibo 已提交
4928 4929 4930 4931
     * @tc.name    Test messageparcel to pass an array of iremoteobject objects across processes
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
4932 4933
    it('SUB_Softbus_IPC_Compatility_MessageParcel_13000', 0, async function(done) {
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_13000---------------------------");
Y
yang-qibo 已提交
4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952

        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 已提交
4953
            expect(result == true).assertTrue()
Z
zhangpa2021 已提交
4954
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13000 result is:" + result)
J
jiyong 已提交
4955 4956
            expect(data.writeInt(123)).assertTrue()
            expect(data.writeString("rpcListenerTest")).assertTrue()
Z
zhangpa2021 已提交
4957
            await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY_1, data, reply, option)
Y
yang-qibo 已提交
4958
            .then((result)=> {
Z
zhangpa2021 已提交
4959
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13000 sendRequest done, error code: " + result.errCode)
Y
yang-qibo 已提交
4960 4961 4962 4963 4964 4965 4966 4967
                expect(result.errCode).assertEqual(0)
                result.reply.readException()
            })

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

    /*
Z
zhangpa2021 已提交
4974
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_13100
Y
yang-qibo 已提交
4975 4976 4977 4978 4979
     * @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
     */
Z
zhangpa2021 已提交
4980 4981
    it('SUB_Softbus_IPC_Compatility_MessageParcel_13100', 0, async function(done) {
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_13100---------------------------");
Y
yang-qibo 已提交
4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002
        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()
Z
zhangpa2021 已提交
5003
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13100 result is:" + result)
Y
yang-qibo 已提交
5004 5005 5006
            expect(data.writeInt(123)).assertTrue()
            expect(data.writeString("rpcListenerTest")).assertTrue()
            await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY_2, data, reply, option)
Z
zhangpa2021 已提交
5007 5008
            .then((result)=> {
                console.info("sendRequest done, error code: " + result.errCode)
Z
zhangpa2021 已提交
5009
                expect(result.errCode).assertEqual(0)
Z
zhangpa2021 已提交
5010
                result.reply.readException()
Z
zhangpa2021 已提交
5011
            })
Z
zhangpa2021 已提交
5012

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

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

                let reString = result.reply.readString();
Z
zhangpa2021 已提交
5051
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13200:run readStringis is " + reString);
Y
yang-qibo 已提交
5052 5053 5054 5055 5056
                expect(reString).assertEqual("");
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
5057
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13200:error = " + error);
Y
yang-qibo 已提交
5058 5059
        }
        done();
Z
zhangpa2021 已提交
5060
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_13200---------------------------");
Y
yang-qibo 已提交
5061 5062 5063
    });

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

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

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

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

    /*
Z
zhangpa2021 已提交
5211
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_13700
Y
yang-qibo 已提交
5212 5213 5214 5215 5216
     * @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
     */
Z
zhangpa2021 已提交
5217 5218
    it("SUB_Softbus_IPC_Compatility_MessageParcel_13700", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_13700---------------------------");
Y
yang-qibo 已提交
5219 5220
        try{
            let data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
5221
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13700: create object successfully.");
Y
yang-qibo 已提交
5222 5223 5224 5225 5226 5227
            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){
Z
zhangpa2021 已提交
5228
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13700: gIRemoteObject undefined");
Y
yang-qibo 已提交
5229 5230
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
5231
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13700: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
5232 5233 5234 5235
                expect(result.errCode == 0).assertTrue();

                expect(result.reply.readString()).assertEqual("constant");
                let getMeCa = result.reply.getCapacity();
Z
zhangpa2021 已提交
5236
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13700:run getCapacityis is " + getMeCa);
Y
yang-qibo 已提交
5237 5238 5239 5240 5241
                expect(getMeCa).assertEqual(("constant".length * 2) + 8);
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
5242
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13700:error = " + error);
Y
yang-qibo 已提交
5243 5244
        }
        done();
Z
zhangpa2021 已提交
5245
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_13700---------------------------");
Y
yang-qibo 已提交
5246 5247 5248
    });

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

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

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

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

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

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

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

                let getSizeresult = result.reply.getSize();
Z
zhangpa2021 已提交
5309
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13900:run getSizeis is " + getSizeresult);
Y
yang-qibo 已提交
5310
                let setCapacityresult = result.reply.getCapacity();
Z
zhangpa2021 已提交
5311
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13900:run getCapacityis is " + setCapacityresult);
Y
yang-qibo 已提交
5312 5313 5314 5315 5316
                expect(setCapacityresult).assertEqual(("constant".length * 2) + 8);
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
5317
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_13900:error = " + error);
Y
yang-qibo 已提交
5318 5319
        }
        done();
Z
zhangpa2021 已提交
5320
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_13900---------------------------");
Y
yang-qibo 已提交
5321 5322 5323
    });

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

Y
yang-qibo 已提交
5338
            let setMeCapacity = data.setCapacity(M);
Z
zhangpa2021 已提交
5339
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14000:run setCapacityis is " + setMeCapacity);
Y
yang-qibo 已提交
5340 5341
            expect(setMeCapacity).assertTrue();
            let getCapacitydata = data.getCapacity();
Z
zhangpa2021 已提交
5342
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14000:run getCapacityis is " + getCapacitydata);
Y
yang-qibo 已提交
5343
            expect(getCapacitydata).assertEqual(M);
Y
yang-qibo 已提交
5344 5345

            let setMeCapacity1 = data.setCapacity(4*G);
Z
zhangpa2021 已提交
5346
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14000:run setCapacityis is " + setMeCapacity1);
Y
yang-qibo 已提交
5347 5348
            expect(setMeCapacity1).assertEqual(false);
            let getCapacitydata1 = data.getCapacity();
Z
zhangpa2021 已提交
5349
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14000:run getCapacityis is " + getCapacitydata1);
Y
yang-qibo 已提交
5350 5351 5352

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

    /*
Z
zhangpa2021 已提交
5359
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_14100
Y
yang-qibo 已提交
5360 5361 5362 5363 5364
     * @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
     */
Z
zhangpa2021 已提交
5365 5366
    it("SUB_Softbus_IPC_Compatility_MessageParcel_14100", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_14100---------------------------");
Y
yang-qibo 已提交
5367 5368
        try{
            let data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
5369
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14100: create object successfully.");
Y
yang-qibo 已提交
5370 5371 5372 5373
            let option = new rpc.MessageOption();
            let reply = rpc.MessageParcel.create();
            expect(data.getSize()).assertEqual(0);
            let setSizedata = data.setSize(0);
Z
zhangpa2021 已提交
5374
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14100:run setSizeis is " + setSizedata);
Y
yang-qibo 已提交
5375 5376 5377
            expect(setSizedata).assertTrue();
            expect(data.writeString("constant")).assertTrue();
            let getSizedata = data.getSize();
Z
zhangpa2021 已提交
5378
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14100:run getSizeis is " + getSizedata);
Y
yang-qibo 已提交
5379 5380 5381
            expect(getSizedata).assertEqual(("constant".length * 2) + 8);

            if (gIRemoteObject == undefined){
Z
zhangpa2021 已提交
5382
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14100: gIRemoteObject undefined");
Y
yang-qibo 已提交
5383 5384
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
5385
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14100: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
5386 5387 5388
                expect(result.errCode == 0).assertTrue();

                let getSizeresult = result.reply.getSize();
Z
zhangpa2021 已提交
5389
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14100:run getSizeis is " + getSizeresult);
Y
yang-qibo 已提交
5390 5391 5392 5393 5394 5395 5396
                expect(getSizeresult).assertEqual(("constant".length * 2) + 8);

                expect(result.reply.readString()).assertEqual("constant");
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
5397
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14100:error = " + error);
Y
yang-qibo 已提交
5398 5399
        }
        done();
Z
zhangpa2021 已提交
5400
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_14100---------------------------");
Y
yang-qibo 已提交
5401 5402 5403
    });

    /*
Z
zhangpa2021 已提交
5404
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_14200
Y
yang-qibo 已提交
5405 5406 5407 5408 5409
     * @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
     */
Z
zhangpa2021 已提交
5410 5411
    it("SUB_Softbus_IPC_Compatility_MessageParcel_14200", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_14200---------------------------");
Y
yang-qibo 已提交
5412 5413
        try{
            let data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
5414
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14200: create object successfully.");
Y
yang-qibo 已提交
5415 5416 5417 5418 5419 5420 5421
            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();
Z
zhangpa2021 已提交
5422
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14200:run setSizeis is " + getSizedata);
Y
yang-qibo 已提交
5423 5424 5425
            expect(getSizedata).assertEqual(0);

            if (gIRemoteObject == undefined){
Z
zhangpa2021 已提交
5426
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14200: gIRemoteObject undefined");
Y
yang-qibo 已提交
5427 5428
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
5429
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14200: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
5430 5431 5432
                expect(result.errCode == 0).assertTrue();

                let getSizeresult = result.reply.getSize();
Z
zhangpa2021 已提交
5433
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14200:run getSizeis is " + getSizeresult);
Y
yang-qibo 已提交
5434 5435
                expect(getSizeresult).assertEqual( 8);
                let writeresult = result.reply.readString();
Z
zhangpa2021 已提交
5436
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14200:run readStringis is " + writeresult);
Y
yang-qibo 已提交
5437 5438 5439 5440 5441
                expect(writeresult).assertEqual("");
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
5442
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14200:error = " + error);
Y
yang-qibo 已提交
5443 5444
        }
        done();
Z
zhangpa2021 已提交
5445
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_14200---------------------------");
Y
yang-qibo 已提交
5446 5447 5448
    });

    /*
Z
zhangpa2021 已提交
5449
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_14300
Y
yang-qibo 已提交
5450 5451 5452 5453 5454
     * @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
     */
Z
zhangpa2021 已提交
5455 5456
    it("SUB_Softbus_IPC_Compatility_MessageParcel_14300", 0, async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_14300---------------------------");
Y
yang-qibo 已提交
5457 5458
        try{
            let data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
5459
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14300: create object successfully.");
Y
yang-qibo 已提交
5460 5461 5462 5463 5464
            expect(data.getSize()).assertEqual(0);
            expect(data.writeString("constant")).assertTrue();
            expect(data.getSize()).assertEqual(("constant".length * 2) + 8);

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

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

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

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

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

    /*
Z
zhangpa2021 已提交
5485
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_14400
Y
yang-qibo 已提交
5486 5487 5488 5489 5490
     * @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
     */
Z
zhangpa2021 已提交
5491 5492
    it("SUB_Softbus_IPC_Compatility_MessageParcel_14400", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_14400---------------------------");
Y
yang-qibo 已提交
5493 5494
        try{
            let data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
5495
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14400: create object successfully.");
Y
yang-qibo 已提交
5496 5497 5498 5499
            let option = new rpc.MessageOption();
            let reply = rpc.MessageParcel.create();
            expect(data.writeString("constant")).assertTrue();
            if (gIRemoteObject == undefined){
Z
zhangpa2021 已提交
5500
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14400: gIRemoteObject undefined");
Y
yang-qibo 已提交
5501 5502
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
5503
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14400: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
5504 5505 5506 5507 5508 5509
                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();
Z
zhangpa2021 已提交
5510
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14400:run getCapacityis is " + getCapacityresult);
Y
yang-qibo 已提交
5511 5512

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

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

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

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

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

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

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

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

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

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

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

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

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

                let getrPos1 = result.reply.getReadPosition();
                expect(getrPos1).assertEqual(getwPos);
                let getrbyte1 = result.reply.getReadableBytes();
Z
zhangpa2021 已提交
5716
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14900:result getReadPosition is "
Y
yang-qibo 已提交
5717 5718 5719 5720 5721 5722
                    + getrPos1 + "getReadableBytes is" + getrbyte1);
                expect(getrbyte1).assertEqual(0);
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
5723
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_14900:error = " + error);
Y
yang-qibo 已提交
5724 5725
        }
        done();
Z
zhangpa2021 已提交
5726
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_14900---------------------------");
Y
yang-qibo 已提交
5727 5728 5729
    });

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

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


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

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

Z
zhangpa2021 已提交
5852
     /*
Z
zhangpa2021 已提交
5853
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageParcel_15400
Z
zhangpa2021 已提交
5854 5855 5856 5857
     * @tc.name    MessageParcel sendRequestAsync API test
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
5858 5859
     it("SUB_Softbus_IPC_Compatility_MessageParcel_15400", 0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageParcel_15400---------------------------");
Z
zhangpa2021 已提交
5860 5861 5862 5863
        try{
            let maxsize = 1024;
            let data = rpc.MessageParcel.create();
            let Capacity = data.getRawDataCapacity()
Z
zhangpa2021 已提交
5864
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_15400:run Capacity success, Capacity is " + Capacity);
Z
zhangpa2021 已提交
5865 5866 5867 5868 5869
            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);
Z
zhangpa2021 已提交
5870
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_15400:run writeRawData is " + result);
Z
zhangpa2021 已提交
5871 5872
            expect(result).assertTrue();
            if (gIRemoteObject == undefined){
Z
zhangpa2021 已提交
5873
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_15400: gIRemoteObject undefined");
Z
zhangpa2021 已提交
5874 5875
            }
            await gIRemoteObject.sendRequestAsync(CODE_WRITE_RAWDATA, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
5876
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_15400: sendRequestAsync is " + result.errCode);
Z
zhangpa2021 已提交
5877 5878
                expect(result.errCode == 0).assertTrue();
                let size = result.reply.readInt();
Z
zhangpa2021 已提交
5879
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_15400:run readInt is " + size);
Z
zhangpa2021 已提交
5880
                var newReadResult = result.reply.readRawData(size)
Z
zhangpa2021 已提交
5881
                console.info("SUB_Softbus_IPC_Compatility_MessageParcel_15400:run readRawData is "
Z
zhangpa2021 已提交
5882 5883 5884 5885 5886 5887
                    + newReadResult.length);
                expect(newReadResult != rawdata).assertTrue();
            });
            data.reclaim();
            reply.reclaim();
        } catch (error) {
Z
zhangpa2021 已提交
5888
            console.info("SUB_Softbus_IPC_Compatility_MessageParcel_15400 : error = " + error);
Z
zhangpa2021 已提交
5889 5890
        }
        done();
Z
zhangpa2021 已提交
5891
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageParcel_15400---------------------------");
Z
zhangpa2021 已提交
5892 5893
    });

Y
yang-qibo 已提交
5894
    /*
Z
zhangpa2021 已提交
5895
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_00100
Y
yang-qibo 已提交
5896 5897 5898 5899
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
5900 5901
    it("SUB_Softbus_IPC_Compatility_MessageOption_00100",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_00100---------------------------");
Y
yang-qibo 已提交
5902 5903
        try{
            let option = new rpc.MessageOption();
Z
zhangpa2021 已提交
5904
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00100: create object successfully.");
Y
yang-qibo 已提交
5905
            let time = option.getWaitTime();
Z
zhangpa2021 已提交
5906
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00100: run getWaitTime success, time is " + time);
Y
yang-qibo 已提交
5907 5908 5909
            expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);
            option.setWaitTime(16);
            let time2 = option.getWaitTime();
Z
zhangpa2021 已提交
5910
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00100: run getWaitTime success, time is " + time2);
Y
yang-qibo 已提交
5911 5912
            expect(time2).assertEqual(16);
        }catch(error){
Z
zhangpa2021 已提交
5913
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00100: error " + error);
Y
yang-qibo 已提交
5914
        }
Z
zhangpa2021 已提交
5915
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_00100---------------------------");
Y
yang-qibo 已提交
5916 5917 5918
    })

    /*
Z
zhangpa2021 已提交
5919
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_00200
Y
yang-qibo 已提交
5920 5921 5922 5923
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
5924 5925
    it("SUB_Softbus_IPC_Compatility_MessageOption_00200",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_00200---------------------------");
Y
yang-qibo 已提交
5926 5927
        try{
            let option = new rpc.MessageOption();
Z
zhangpa2021 已提交
5928
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00200: create object successfully.");
Y
yang-qibo 已提交
5929
            let time = option.getWaitTime();
Z
zhangpa2021 已提交
5930
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00200: run getWaitTime success, time is " + time);
Y
yang-qibo 已提交
5931 5932 5933 5934
            expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);

            option.setWaitTime(0);
            let time2 = option.getWaitTime();
Z
zhangpa2021 已提交
5935
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00200: run getWaitTime success, time is " + time2);
Y
yang-qibo 已提交
5936 5937 5938 5939
            expect(time2).assertEqual(rpc.MessageOption.TF_WAIT_TIME);

            option.setWaitTime(60);
            let time3 = option.getWaitTime();
Z
zhangpa2021 已提交
5940
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00200: run getWaitTime success, time is " + time3);
Y
yang-qibo 已提交
5941 5942 5943
            expect(time3).assertEqual(60);

        }catch(error){
Z
zhangpa2021 已提交
5944
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00200: error " + error);
Y
yang-qibo 已提交
5945
        }
Z
zhangpa2021 已提交
5946
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_00200---------------------------");
Y
yang-qibo 已提交
5947 5948 5949
    })

    /*
Z
zhangpa2021 已提交
5950
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_00300
Y
yang-qibo 已提交
5951 5952 5953 5954
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
5955 5956
    it("SUB_Softbus_IPC_Compatility_MessageOption_00300",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_00300---------------------------");
Y
yang-qibo 已提交
5957 5958
        try{
            let option = new rpc.MessageOption();
Z
zhangpa2021 已提交
5959
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00300: create object successfully.");
Y
yang-qibo 已提交
5960
            let time = option.getWaitTime();
Z
zhangpa2021 已提交
5961
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00300: run getWaitTime success, time is " + time);
Y
yang-qibo 已提交
5962 5963 5964 5965
            expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);

            option.setWaitTime(-1);
            let time2 = option.getWaitTime();
Z
zhangpa2021 已提交
5966
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00300: run getWaitTime success, time is " + time2);
Y
yang-qibo 已提交
5967 5968
            expect(time2).assertEqual(rpc.MessageOption.TF_WAIT_TIME);
        }catch(error){
Z
zhangpa2021 已提交
5969
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00300: error " + error);
Y
yang-qibo 已提交
5970
        }
Z
zhangpa2021 已提交
5971
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_00300---------------------------");
Y
yang-qibo 已提交
5972 5973 5974
    })

    /*
Z
zhangpa2021 已提交
5975
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_00400
Y
yang-qibo 已提交
5976 5977 5978 5979
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
5980 5981
    it("SUB_Softbus_IPC_Compatility_MessageOption_00400",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_00400---------------------------");
Y
yang-qibo 已提交
5982 5983
        try{
            let option = new rpc.MessageOption();
Z
zhangpa2021 已提交
5984
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00400: create object successfully.");
Y
yang-qibo 已提交
5985
            let time = option.getWaitTime();
Z
zhangpa2021 已提交
5986
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00400: run getWaitTime success, time is " + time);
Y
yang-qibo 已提交
5987 5988 5989 5990
            expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME);

            option.setWaitTime(61);
            let time2 = option.getWaitTime();
Z
zhangpa2021 已提交
5991
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00400: run getWaitTime success, time is " + time2);
Y
yang-qibo 已提交
5992 5993
            expect(time2).assertEqual(61);
        }catch(error){
Z
zhangpa2021 已提交
5994
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00400: error " + error);
Y
yang-qibo 已提交
5995
        }
Z
zhangpa2021 已提交
5996
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_00400---------------------------");
Y
yang-qibo 已提交
5997 5998 5999
    })

    /*
Z
zhangpa2021 已提交
6000
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_00500
Y
yang-qibo 已提交
6001 6002 6003 6004
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6005 6006
    it("SUB_Softbus_IPC_Compatility_MessageOption_00500",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_00500---------------------------");
Y
yang-qibo 已提交
6007 6008
        try{
            let option = new rpc.MessageOption();
Z
zhangpa2021 已提交
6009
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00500: create object successfully.");
Y
yang-qibo 已提交
6010
            let flog = option.getFlags();
Z
zhangpa2021 已提交
6011
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00500: run getFlags success, flog is " + flog);
Y
yang-qibo 已提交
6012 6013 6014
            expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);

            option.setFlags(1)
Z
zhangpa2021 已提交
6015
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00500: run setFlags success");
Y
yang-qibo 已提交
6016
            let flog2 = option.getFlags();
Z
zhangpa2021 已提交
6017
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00500: run getFlags success, flog2 is " + flog2);
Y
yang-qibo 已提交
6018 6019
            expect(flog2).assertEqual(rpc.MessageOption.TF_ASYNC);
        }catch(error){
Z
zhangpa2021 已提交
6020
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00500: error " + error);
Y
yang-qibo 已提交
6021
        }
Z
zhangpa2021 已提交
6022
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_00500---------------------------");
Y
yang-qibo 已提交
6023 6024 6025
    })

    /*
Z
zhangpa2021 已提交
6026
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_00600
Y
yang-qibo 已提交
6027 6028 6029 6030
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6031 6032
    it("SUB_Softbus_IPC_Compatility_MessageOption_00600",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_00600---------------------------");
Y
yang-qibo 已提交
6033 6034
        try{
            let option = new rpc.MessageOption();
Z
zhangpa2021 已提交
6035
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00600: create object successfully.");
Y
yang-qibo 已提交
6036
            let flog = option.getFlags();
Z
zhangpa2021 已提交
6037
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00600: run getFlags success, flog is " + flog);
Y
yang-qibo 已提交
6038 6039 6040
            expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);

            option.setFlags(1);
Z
zhangpa2021 已提交
6041
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00600: run setFlags success");
Y
yang-qibo 已提交
6042
            let flog2 = option.getFlags();
Z
zhangpa2021 已提交
6043
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00600: run getFlags success, flog2 is " + flog2);
Y
yang-qibo 已提交
6044 6045 6046
            expect(flog2).assertEqual(rpc.MessageOption.TF_ASYNC);

            option.setFlags(0)
Z
zhangpa2021 已提交
6047
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00600: run setFlags success");
Y
yang-qibo 已提交
6048
            let flog3 = option.getFlags();
Z
zhangpa2021 已提交
6049
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00600: run getFlags success, flog2 is " + flog3);
Y
yang-qibo 已提交
6050 6051
            expect(flog2).assertEqual(rpc.MessageOption.TF_ASYNC);
        }catch(error){
Z
zhangpa2021 已提交
6052
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00600: error " + error);
Y
yang-qibo 已提交
6053
        }
Z
zhangpa2021 已提交
6054
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_00600---------------------------");
J
jiyong 已提交
6055 6056 6057
    })

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

Y
yang-qibo 已提交
6072 6073
            option.setFlags(-1);
            let flog2 = option.getFlags();
Z
zhangpa2021 已提交
6074
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00700: run getFlags success, flog2 is " + flog2);
Y
yang-qibo 已提交
6075 6076
            expect(flog2).assertEqual(-1);
        }catch(error){
Z
zhangpa2021 已提交
6077
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00700: error " + error);
Y
yang-qibo 已提交
6078
        }
Z
zhangpa2021 已提交
6079
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_00700---------------------------");
J
jiyong 已提交
6080 6081 6082
    })

    /*
Z
zhangpa2021 已提交
6083
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_00800
J
jiyong 已提交
6084 6085 6086 6087
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6088 6089
    it("SUB_Softbus_IPC_Compatility_MessageOption_00800",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_00800---------------------------");
J
jiyong 已提交
6090 6091
        try{
            let option = new rpc.MessageOption();
Z
zhangpa2021 已提交
6092
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00800: create object successfully.");
J
jiyong 已提交
6093
            let flog = option.getFlags();
Z
zhangpa2021 已提交
6094
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00800: run getFlags success, flog is " + flog);
Y
yang-qibo 已提交
6095
            expect(flog).assertEqual(rpc.MessageOption.TF_SYNC);
J
jiyong 已提交
6096

Y
yang-qibo 已提交
6097
            option.setFlags(3);
J
jiyong 已提交
6098
            let flog2 = option.getFlags();
Z
zhangpa2021 已提交
6099
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00800: run getFlags success, flog2 is " + flog2);
Y
yang-qibo 已提交
6100 6101
            expect(flog2).assertEqual(3);
        }catch(error){
Z
zhangpa2021 已提交
6102
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00800: error " + error);
Y
yang-qibo 已提交
6103
        }
Z
zhangpa2021 已提交
6104
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_00800---------------------------");
Y
yang-qibo 已提交
6105
    })
J
jiyong 已提交
6106

Y
yang-qibo 已提交
6107
    /*
Z
zhangpa2021 已提交
6108
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_00900
Y
yang-qibo 已提交
6109 6110 6111 6112
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6113 6114
    it("SUB_Softbus_IPC_Compatility_MessageOption_00900",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_00900---------------------------");
Y
yang-qibo 已提交
6115 6116
        try{
            expect(rpc.MessageOption.TF_SYNC).assertEqual(0);
J
jiyong 已提交
6117

Y
yang-qibo 已提交
6118 6119 6120 6121 6122
            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 已提交
6123
        }catch(error){
Z
zhangpa2021 已提交
6124
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_00900: error " + error);
J
jiyong 已提交
6125
        }
Z
zhangpa2021 已提交
6126
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_00900---------------------------");
J
jiyong 已提交
6127 6128 6129
    })

    /*
Z
zhangpa2021 已提交
6130
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_01000
Y
yang-qibo 已提交
6131
     * @tc.name    Basic method of testing messageoption
J
jiyong 已提交
6132 6133 6134
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6135 6136
    it("SUB_Softbus_IPC_Compatility_MessageOption_01000",0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_01000---------------------------");
J
jiyong 已提交
6137 6138
        try{

Y
yang-qibo 已提交
6139
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
6140
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01000: create object successfully.");
Y
yang-qibo 已提交
6141 6142 6143 6144 6145 6146
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            option.setWaitTime(20);
            option.setFlags(0);
            var token = "option";
            var result = data.writeString(token);
Z
zhangpa2021 已提交
6147
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01000:run writeStringis is " + result);
Y
yang-qibo 已提交
6148 6149 6150
            expect(result).assertTrue();
            expect(option.getFlags()).assertEqual(0);
            expect(option.getWaitTime()).assertEqual(20);
J
jiyong 已提交
6151

Y
yang-qibo 已提交
6152 6153
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
6154
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01000: gIRemoteObject is undefined");
Y
yang-qibo 已提交
6155 6156
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
6157
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01000: sendRequestis is " + result.errCode);
J
jiyong 已提交
6158

Y
yang-qibo 已提交
6159
                var replyReadResult = result.reply.readString();
Z
zhangpa2021 已提交
6160
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01000: run readString is " + replyReadResult);
Y
yang-qibo 已提交
6161 6162 6163 6164 6165 6166 6167
                expect(replyReadResult).assertEqual(token);
                expect(option.getFlags()).assertEqual(0);
                expect(option.getWaitTime()).assertEqual(20);

            });
            data.reclaim();
            reply.reclaim();
J
jiyong 已提交
6168
        }catch(error){
Z
zhangpa2021 已提交
6169
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01000: error " + error);
J
jiyong 已提交
6170
        }
Y
yang-qibo 已提交
6171
        done();
Z
zhangpa2021 已提交
6172
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_01000---------------------------");
J
jiyong 已提交
6173 6174
    })

Z
zhangpa2021 已提交
6175
    /*
Z
zhangpa2021 已提交
6176
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_01100
Y
yang-qibo 已提交
6177
     * @tc.name    Basic method of testing messageoption
Z
zhangpa2021 已提交
6178 6179 6180
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6181 6182
    it("SUB_Softbus_IPC_Compatility_MessageOption_01100",0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_01100---------------------------");
Z
zhangpa2021 已提交
6183 6184
        try{

Y
yang-qibo 已提交
6185
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
6186
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01100: create object successfully.");
Y
yang-qibo 已提交
6187 6188 6189 6190 6191
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            option.setFlags(1);
            var token = "option";
            var result = data.writeString(token);
Z
zhangpa2021 已提交
6192
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01100:run writeStringis is " + result);
Y
yang-qibo 已提交
6193 6194 6195 6196
            expect(result).assertTrue();
            expect(option.getFlags()).assertEqual(1);
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
6197
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01100: gIRemoteObject is undefined");
Y
yang-qibo 已提交
6198 6199
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
6200
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01100: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
6201
                var replyReadResult = result.reply.readString();
Z
zhangpa2021 已提交
6202
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01100: run readString is " + replyReadResult);
Y
yang-qibo 已提交
6203 6204
                expect(replyReadResult).assertEqual("");
                expect(option.getFlags()).assertEqual(1);
Z
zhangpa2021 已提交
6205

Y
yang-qibo 已提交
6206 6207 6208 6209
            });
            data.reclaim();
            reply.reclaim();
        }catch(error){
Z
zhangpa2021 已提交
6210
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01100: error " + error);
Y
yang-qibo 已提交
6211 6212
        }
        done();
Z
zhangpa2021 已提交
6213
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_01100---------------------------");
Y
yang-qibo 已提交
6214
    })
Z
zhangpa2021 已提交
6215

Y
yang-qibo 已提交
6216
    /*
Z
zhangpa2021 已提交
6217
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_01200
Y
yang-qibo 已提交
6218 6219 6220 6221
     * @tc.name    Basic method of testing messageoption
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6222 6223
    it("SUB_Softbus_IPC_Compatility_MessageOption_01200",0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_01200---------------------------");
Y
yang-qibo 已提交
6224
        try{
Z
zhangpa2021 已提交
6225

Y
yang-qibo 已提交
6226
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
6227
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01200: create object successfully.");
Y
yang-qibo 已提交
6228 6229 6230 6231 6232
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            option.setFlags(3);
            var token = "option";
            var result = data.writeString(token);
Z
zhangpa2021 已提交
6233
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01200:run writeStringis is " + result);
Y
yang-qibo 已提交
6234 6235 6236 6237
            expect(result).assertTrue();
            expect(option.getFlags()).assertEqual(3);
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
6238
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01200: gIRemoteObject is undefined");
Y
yang-qibo 已提交
6239 6240
            }
            await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
6241
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01200: sendRequestis is " + result.errCode);
Y
yang-qibo 已提交
6242
                var replyReadResult = result.reply.readString();
Z
zhangpa2021 已提交
6243
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01200: run readString is " + replyReadResult);
Y
yang-qibo 已提交
6244 6245 6246 6247 6248
                expect(replyReadResult).assertEqual("");
                expect(option.getFlags()).assertEqual(3);
            });
            data.reclaim();
            reply.reclaim();
Z
zhangpa2021 已提交
6249
        }catch(error){
Z
zhangpa2021 已提交
6250
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01200: error " + error);
Z
zhangpa2021 已提交
6251
        }
Y
yang-qibo 已提交
6252
        done();
Z
zhangpa2021 已提交
6253
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_01200---------------------------");
Z
zhangpa2021 已提交
6254 6255
    })

Z
zhangpa2021 已提交
6256
    /*
Z
zhangpa2021 已提交
6257
     * @tc.number  SUB_Softbus_IPC_Compatility_MessageOption_01300
Z
zhangpa2021 已提交
6258 6259 6260 6261
     * @tc.name    MessageOption sendRequestAsync test
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6262 6263
    it("SUB_Softbus_IPC_Compatility_MessageOption_01300",0, async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_MessageOption_01300---------------------------");
Z
zhangpa2021 已提交
6264 6265 6266
        try{

            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
6267
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01300: create object successfully.");
Z
zhangpa2021 已提交
6268 6269 6270 6271 6272
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            option.setFlags(1);
            var token = "option";
            var result = data.writeString(token);
Z
zhangpa2021 已提交
6273
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01300:run writeString is " + result);
Z
zhangpa2021 已提交
6274 6275 6276 6277
            expect(result).assertTrue();
            expect(option.getFlags()).assertEqual(1);
            if (gIRemoteObject == undefined)
            {
Z
zhangpa2021 已提交
6278
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01300: gIRemoteObject is undefined");
Z
zhangpa2021 已提交
6279 6280
            }
            await gIRemoteObject.sendRequestAsync(CODE_WRITE_STRING, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
6281
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01300: sendRequestAsync is " + result.errCode);
Z
zhangpa2021 已提交
6282
                var replyReadResult = result.reply.readString();
Z
zhangpa2021 已提交
6283
                console.info("SUB_Softbus_IPC_Compatility_MessageOption_01300: run readString is " + replyReadResult);
Z
zhangpa2021 已提交
6284 6285 6286 6287 6288 6289 6290
                expect(replyReadResult).assertEqual("");
                expect(option.getFlags()).assertEqual(1);

            });
            data.reclaim();
            reply.reclaim();
        }catch(error){
Z
zhangpa2021 已提交
6291
            console.info("SUB_Softbus_IPC_Compatility_MessageOption_01300: error " + error);
Z
zhangpa2021 已提交
6292 6293
        }
        done();
Z
zhangpa2021 已提交
6294
        console.info("---------------------end SUB_Softbus_IPC_Compatility_MessageOption_01300---------------------------");
Z
zhangpa2021 已提交
6295 6296
    })

J
jiyong 已提交
6297
    /*
Z
zhangpa2021 已提交
6298
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_00100
J
jiyong 已提交
6299 6300 6301 6302
     * @tc.name    Exception parameter validation of the created anonymous shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6303 6304
    it("SUB_Softbus_IPC_Compatility_Ashmem_00100",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_00100---------------------------");
J
jiyong 已提交
6305 6306
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", -1)
Z
zhangpa2021 已提交
6307
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00100: ashmem " + ashmem);
J
jiyong 已提交
6308

Y
yang-qibo 已提交
6309
            let ashmem2 = rpc.Ashmem.createAshmem(null, K)
Z
zhangpa2021 已提交
6310
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00100: ashmem2 " + ashmem2);
J
jiyong 已提交
6311
        }catch(error){
Z
zhangpa2021 已提交
6312
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00100: error " + error);
J
jiyong 已提交
6313
        }
Z
zhangpa2021 已提交
6314
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_00100---------------------------");
J
jiyong 已提交
6315 6316 6317
    })

    /*
Z
zhangpa2021 已提交
6318
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_00200
J
jiyong 已提交
6319 6320 6321 6322
     * @tc.name    Call the getashmemsize interface to get the size of the shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6323 6324
    it("SUB_Softbus_IPC_Compatility_Ashmem_00200",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_00200---------------------------");
J
jiyong 已提交
6325
        try{
Y
yang-qibo 已提交
6326 6327 6328 6329 6330
            var mapSize = 2*G - 1;
            var jsash = "";
            for (let i = 0;i < (256 - 1);i++){
                jsash += "a";
            }
Z
zhangpa2021 已提交
6331
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00200: run  createAshmem success" + jsash.length);
Y
yang-qibo 已提交
6332
            let ashmem = rpc.Ashmem.createAshmem(jsash, mapSize)
Z
zhangpa2021 已提交
6333
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00200: run  createAshmem success" + ashmem);
Y
yang-qibo 已提交
6334
            expect(ashmem != null).assertTrue();
Z
zhangpa2021 已提交
6335
            ashmem.closeAshmem();
Y
yang-qibo 已提交
6336
        }catch(error){
Z
zhangpa2021 已提交
6337
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00200: error " + error);
Y
yang-qibo 已提交
6338
        }
Z
zhangpa2021 已提交
6339
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_00200---------------------------");
Y
yang-qibo 已提交
6340
    })
J
jiyong 已提交
6341

Y
yang-qibo 已提交
6342
    /*
Z
zhangpa2021 已提交
6343
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_00300
Y
yang-qibo 已提交
6344 6345 6346 6347
     * @tc.name    Call the getashmemsize interface to get the size of the shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6348 6349
    it("SUB_Softbus_IPC_Compatility_Ashmem_00300",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_00300---------------------------");
Y
yang-qibo 已提交
6350 6351 6352 6353 6354 6355
        try{
            let mapSize = 2*G - 1;
            let jsash = '';
            for (let i = 0;i < 256;i++){
                jsash += 'a';
            }
Z
zhangpa2021 已提交
6356
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00300: run  createAshmem success" + jsash.length);
Y
yang-qibo 已提交
6357
            let ashmem = rpc.Ashmem.createAshmem(jsash, mapSize)
Z
zhangpa2021 已提交
6358
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00300: run  createAshmem success" + ashmem);
Y
yang-qibo 已提交
6359
            ashmem.closeAshmem();
J
jiyong 已提交
6360
        }catch(error){
Y
yang-qibo 已提交
6361
            expect(error != null).assertTrue();
Z
zhangpa2021 已提交
6362
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00300: error " + error);
J
jiyong 已提交
6363
        }
Z
zhangpa2021 已提交
6364
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_00300---------------------------");
J
jiyong 已提交
6365 6366 6367
    })

    /*
Z
zhangpa2021 已提交
6368
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_00400
J
jiyong 已提交
6369 6370 6371 6372
     * @tc.name    Call the getashmemsize interface to get the size of the shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6373 6374
    it("SUB_Softbus_IPC_Compatility_Ashmem_00400",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_00400---------------------------");
J
jiyong 已提交
6375
        try{
Y
yang-qibo 已提交
6376
            let mapSize = 2*G - 1;
J
jiyong 已提交
6377
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
Z
zhangpa2021 已提交
6378
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00400: run  createAshmem success" + ashmem);
J
jiyong 已提交
6379
            let size = ashmem.getAshmemSize()
Z
zhangpa2021 已提交
6380
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00400: run getAshmemSize success, size is " + size);
Y
yang-qibo 已提交
6381 6382 6383
            expect(size).assertEqual(mapSize);
            ashmem.closeAshmem();
        }catch(error){
Z
zhangpa2021 已提交
6384
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00400: error " + error);
Y
yang-qibo 已提交
6385
        }
Z
zhangpa2021 已提交
6386
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_00400---------------------------");
Y
yang-qibo 已提交
6387
    })
J
jiyong 已提交
6388

Y
yang-qibo 已提交
6389
    /*
Z
zhangpa2021 已提交
6390
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_00500
Y
yang-qibo 已提交
6391 6392 6393 6394
     * @tc.name    Call the getashmemsize interface to get the size of the shared memory object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6395 6396
    it("SUB_Softbus_IPC_Compatility_Ashmem_00500",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_00500---------------------------");
Y
yang-qibo 已提交
6397 6398 6399
        try{
            let mapSize = 2*G;
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest ", mapSize)
Z
zhangpa2021 已提交
6400
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00500: run  createAshmem success " + ashmem);
Y
yang-qibo 已提交
6401
            let size = ashmem.getAshmemSize()
Z
zhangpa2021 已提交
6402
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00500: run getAshmemSize success, size is " + size);
Y
yang-qibo 已提交
6403
            expect(size).assertEqual(mapSize);
J
jiyong 已提交
6404 6405
            ashmem.closeAshmem();
        }catch(error){
Z
zhangpa2021 已提交
6406
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00500: error " + error);
Y
yang-qibo 已提交
6407
            expect(error != null).assertTrue();
J
jiyong 已提交
6408
        }
Z
zhangpa2021 已提交
6409
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_00500---------------------------");
J
jiyong 已提交
6410 6411 6412
    })

    /*
Z
zhangpa2021 已提交
6413
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_00600
J
jiyong 已提交
6414 6415 6416 6417
     * @tc.name    Writeashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6418 6419
    it("SUB_Softbus_IPC_Compatility_Ashmem_00600",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_00600---------------------------");
J
jiyong 已提交
6420 6421
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Z
zhangpa2021 已提交
6422
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00600: ashmem " + ashmem);
J
jiyong 已提交
6423 6424 6425
            ashmem.closeAshmem()
            var data = rpc.MessageParcel.create();
            let writeAshmem = data.writeAshmem(ashmem);
Z
zhangpa2021 已提交
6426
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00600: run writeAshmem success, writeAshmem is " + writeAshmem);
Y
yang-qibo 已提交
6427
            expect(writeAshmem).assertEqual(false);
J
jiyong 已提交
6428
        }catch(error){
Z
zhangpa2021 已提交
6429
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00600: error " + error);
J
jiyong 已提交
6430
        }
Y
yang-qibo 已提交
6431
        data.reclaim();
Z
zhangpa2021 已提交
6432
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_00600---------------------------");
J
jiyong 已提交
6433 6434 6435
    })

    /*
Z
zhangpa2021 已提交
6436
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_00700
J
jiyong 已提交
6437 6438 6439 6440
     * @tc.name    Readfromashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6441 6442
    it("SUB_Softbus_IPC_Compatility_Ashmem_00700",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_00700---------------------------");
J
jiyong 已提交
6443 6444
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Z
zhangpa2021 已提交
6445
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00700: ashmem " + ashmem);
J
jiyong 已提交
6446
            ashmem.unmapAshmem()
Z
zhangpa2021 已提交
6447
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00700: run unmapAshmem success");
Y
yang-qibo 已提交
6448
            let bytes = [1, 2, 3, 4, 5];
J
jiyong 已提交
6449
            let ret = ashmem.readFromAshmem(bytes.length, 0);
Z
zhangpa2021 已提交
6450
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00700: run readFromAshmem result is " + ret);
J
jiyong 已提交
6451 6452 6453
            expect(ret==null).assertTrue();
            ashmem.closeAshmem();
        }catch(error){
Z
zhangpa2021 已提交
6454
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00700: error " + error);
J
jiyong 已提交
6455
        }
Z
zhangpa2021 已提交
6456
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_00700---------------------------");
J
jiyong 已提交
6457 6458 6459
    })

    /*
Z
zhangpa2021 已提交
6460
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_00800
J
jiyong 已提交
6461 6462 6463 6464
     * @tc.name    Mapashmem interface creates shared file mappings
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6465 6466
    it("SUB_Softbus_IPC_Compatility_Ashmem_00800",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_00800---------------------------");
J
jiyong 已提交
6467 6468
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Z
zhangpa2021 已提交
6469
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00800: ashmem " + ashmem);
J
jiyong 已提交
6470
            let result = ashmem.mapAshmem(rpc.Ashmem.PROT_READ);
Z
zhangpa2021 已提交
6471
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00800: run mapAshmemis is " + result);
Y
yang-qibo 已提交
6472
            expect(result).assertTrue();
J
jiyong 已提交
6473 6474
            ashmem.closeAshmem()
        }catch(error){
Z
zhangpa2021 已提交
6475
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00800: error " + error);
J
jiyong 已提交
6476
        }
Z
zhangpa2021 已提交
6477
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_00800---------------------------");
J
jiyong 已提交
6478 6479 6480
    })

    /*
Z
zhangpa2021 已提交
6481
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_00900
J
jiyong 已提交
6482 6483 6484 6485
     * @tc.name    Mapashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6486 6487
    it("SUB_Softbus_IPC_Compatility_Ashmem_00900",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_00900---------------------------");
J
jiyong 已提交
6488
        try{
Y
yang-qibo 已提交
6489
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", (2*G - 1))
Z
zhangpa2021 已提交
6490
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00900: ashmem " + ashmem);
J
jiyong 已提交
6491
            let result = ashmem.mapAshmem(999);
Z
zhangpa2021 已提交
6492
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00900: run mapAshmemis is " + result);
Y
yang-qibo 已提交
6493
            expect(result).assertEqual(false);
J
jiyong 已提交
6494 6495
            ashmem.closeAshmem()
        }catch(error){
Z
zhangpa2021 已提交
6496
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_00900: error " + error);
Y
yang-qibo 已提交
6497
            expect(error != null).assertTrue();
J
jiyong 已提交
6498
        }
Z
zhangpa2021 已提交
6499
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_00900---------------------------");
J
jiyong 已提交
6500 6501 6502
    })

    /*
Z
zhangpa2021 已提交
6503
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_01000
J
jiyong 已提交
6504 6505 6506 6507
     * @tc.name    Mapreadandwriteashmem interface creates a shared file map with the protection level of read-write
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6508 6509
    it("SUB_Softbus_IPC_Compatility_Ashmem_01000",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_01000---------------------------");
J
jiyong 已提交
6510
        try{
Y
yang-qibo 已提交
6511
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K)
Z
zhangpa2021 已提交
6512
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01000: ashmem " + ashmem);
J
jiyong 已提交
6513
            let result = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6514
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01000: run mapAshmemis is " + result);
J
jiyong 已提交
6515 6516
            ashmem.closeAshmem()
        }catch(error){
Z
zhangpa2021 已提交
6517
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01000: error " + error);
J
jiyong 已提交
6518
        }
Z
zhangpa2021 已提交
6519
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_01000---------------------------");
J
jiyong 已提交
6520 6521 6522
    })

    /*
Z
zhangpa2021 已提交
6523
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_01100
J
jiyong 已提交
6524 6525 6526 6527
     * @tc.name    Mapreadandwriteashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6528 6529
    it("SUB_Softbus_IPC_Compatility_Ashmem_01100",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_01100---------------------------");
J
jiyong 已提交
6530 6531
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Z
zhangpa2021 已提交
6532
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01100: ashmem " + ashmem);
J
jiyong 已提交
6533
            let result = ashmem.mapAshmem(rpc.Ashmem.PROT_READ);
Z
zhangpa2021 已提交
6534
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01100: run mapAshmemis is " + result);
Y
yang-qibo 已提交
6535
            expect(result).assertTrue();
J
jiyong 已提交
6536

Y
yang-qibo 已提交
6537
            ashmem.unmapAshmem();
Z
zhangpa2021 已提交
6538
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01100: run unmapAshmem success");
Z
zhangpa2021 已提交
6539

Y
yang-qibo 已提交
6540
            let result2 = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6541
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01100: run mapReadAndWriteAshmemis2 is " + result2);
Y
yang-qibo 已提交
6542 6543
            expect(result2).assertTrue();
            ashmem.closeAshmem()
J
jiyong 已提交
6544
        }catch(error){
Z
zhangpa2021 已提交
6545
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01100: error " + error);
J
jiyong 已提交
6546
        }
Z
zhangpa2021 已提交
6547
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_01100---------------------------");
J
jiyong 已提交
6548 6549 6550
    })

    /*
Z
zhangpa2021 已提交
6551
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_01200
J
jiyong 已提交
6552 6553 6554 6555
     * @tc.name    Mapreadonlyashmem interface creates a shared file map with the protection level of read-write
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6556 6557
    it("SUB_Softbus_IPC_Compatility_Ashmem_01200",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_01200---------------------------");
J
jiyong 已提交
6558 6559
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Z
zhangpa2021 已提交
6560
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01200: ashmem " + ashmem);
J
jiyong 已提交
6561
            let result = ashmem.mapReadOnlyAshmem();
Z
zhangpa2021 已提交
6562
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01200: run mapReadAndWriteAshmemis is " + result);
Y
yang-qibo 已提交
6563
            expect(result).assertTrue();
J
jiyong 已提交
6564 6565
            ashmem.closeAshmem();
        }catch(error){
Z
zhangpa2021 已提交
6566
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01200: error " + error);
J
jiyong 已提交
6567
        }
Z
zhangpa2021 已提交
6568
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_01200---------------------------");
J
jiyong 已提交
6569 6570 6571
    })

    /*
Z
zhangpa2021 已提交
6572
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_01300
J
jiyong 已提交
6573 6574 6575 6576
     * @tc.name    Mapreadonlyashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6577 6578
    it("SUB_Softbus_IPC_Compatility_Ashmem_01300",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_01300---------------------------");
J
jiyong 已提交
6579
        try{
Y
yang-qibo 已提交
6580
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K)
Z
zhangpa2021 已提交
6581
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01300: ashmem " + ashmem);
J
jiyong 已提交
6582 6583

            let result = ashmem.mapAshmem(rpc.Ashmem.PROT_WRITE);
Z
zhangpa2021 已提交
6584
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01300: run mapAshmemis is " + result);
Y
yang-qibo 已提交
6585
            expect(result).assertTrue();
J
jiyong 已提交
6586 6587

            ashmem.unmapAshmem();
Z
zhangpa2021 已提交
6588
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01300: run unmapAshmem success");
Z
zhangpa2021 已提交
6589
            ashmem.closeAshmem()
J
jiyong 已提交
6590
            let result2 = ashmem.mapReadOnlyAshmem();
Z
zhangpa2021 已提交
6591
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01300: run mapReadAndWriteAshmemis2 is " + result2);
Y
yang-qibo 已提交
6592
            expect(result2).assertEqual(false);
J
jiyong 已提交
6593
        }catch(error){
Z
zhangpa2021 已提交
6594
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01300: error " + error);
J
jiyong 已提交
6595
        }
Z
zhangpa2021 已提交
6596
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_01300---------------------------");
J
jiyong 已提交
6597 6598 6599
    })

    /*
Z
zhangpa2021 已提交
6600
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_01400
J
jiyong 已提交
6601 6602 6603 6604
     * @tc.name    Mapreadonlyashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6605 6606
    it("SUB_Softbus_IPC_Compatility_Ashmem_01400",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_01400---------------------------");
J
jiyong 已提交
6607
        try{
Y
yang-qibo 已提交
6608
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
J
jiyong 已提交
6609
            let resultwrite = ashmem.setProtection(rpc.Ashmem.PROT_WRITE)
Z
zhangpa2021 已提交
6610
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01400: run setProtectioniswrite is " + resultwrite);
Y
yang-qibo 已提交
6611
            expect(resultwrite).assertTrue();
J
jiyong 已提交
6612
            let resultread = ashmem.setProtection(rpc.Ashmem.PROT_READ)
Z
zhangpa2021 已提交
6613
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01400: run setProtectionisread is " + resultread);
Y
yang-qibo 已提交
6614
            expect(resultread).assertEqual(false);
J
jiyong 已提交
6615 6616

            let resultreadAndwrite = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6617
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01400: run setProtection success, mapReadAndWriteAshmem is "
Y
yang-qibo 已提交
6618 6619
                + resultreadAndwrite);
            expect(resultreadAndwrite ).assertEqual(false);
J
jiyong 已提交
6620 6621

            let resultnone = ashmem.setProtection(rpc.Ashmem.PROT_NONE)
Z
zhangpa2021 已提交
6622
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01400: run setProtectionisnone is " + resultnone);
Y
yang-qibo 已提交
6623
            expect(resultnone).assertTrue();
J
jiyong 已提交
6624 6625

            let resultread2 = ashmem.setProtection(rpc.Ashmem.PROT_READ)
Z
zhangpa2021 已提交
6626
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01400: run setProtectionisread2 is " + resultread2);
Y
yang-qibo 已提交
6627 6628 6629
            expect(resultread2).assertEqual(false);
            ashmem.closeAshmem()
        }catch(error){
Z
zhangpa2021 已提交
6630
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01400: error " + error);
Y
yang-qibo 已提交
6631
        }
Z
zhangpa2021 已提交
6632
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_01400---------------------------");
Y
yang-qibo 已提交
6633
    })
J
jiyong 已提交
6634

Y
yang-qibo 已提交
6635
    /*
Z
zhangpa2021 已提交
6636
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_01500
Y
yang-qibo 已提交
6637 6638 6639 6640
     * @tc.name    Setprotection exception input parameter verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6641 6642
    it("SUB_Softbus_IPC_Compatility_Ashmem_01500",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_01500---------------------------");
Y
yang-qibo 已提交
6643 6644
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
Z
zhangpa2021 已提交
6645
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01500: ashmem " + ashmem);
Y
yang-qibo 已提交
6646
            let result = ashmem.setProtection(3);
Z
zhangpa2021 已提交
6647
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01500: run setProtectionis is " + result);
Y
yang-qibo 已提交
6648
            expect(result).assertTrue();
J
jiyong 已提交
6649 6650
            ashmem.closeAshmem()
        }catch(error){
Z
zhangpa2021 已提交
6651
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01500: error " + error);
Y
yang-qibo 已提交
6652
        }
Z
zhangpa2021 已提交
6653
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_01500---------------------------");
Y
yang-qibo 已提交
6654 6655 6656
    })

    /*
Z
zhangpa2021 已提交
6657
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_01600
Y
yang-qibo 已提交
6658 6659 6660 6661
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6662 6663
    it("SUB_Softbus_IPC_Compatility_Ashmem_01600",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_01600---------------------------");
Y
yang-qibo 已提交
6664 6665 6666
        try{
            let mapSize = 4096
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
Z
zhangpa2021 已提交
6667
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01600: ashmem " + ashmem);
Y
yang-qibo 已提交
6668 6669

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6670
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01600: run mapReadAndWriteAshmemis2 is "
Y
yang-qibo 已提交
6671 6672 6673 6674
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3, 4, 5];
            let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
Z
zhangpa2021 已提交
6675
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01600: run writeToAshmemis is " + result);
Y
yang-qibo 已提交
6676 6677 6678
            expect(result).assertTrue();
            ashmem.closeAshmem();
        }catch(error){
Z
zhangpa2021 已提交
6679
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01600: error " + error);
Y
yang-qibo 已提交
6680
        }
Z
zhangpa2021 已提交
6681
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_01600---------------------------");
Y
yang-qibo 已提交
6682 6683 6684
    })

    /*
Z
zhangpa2021 已提交
6685
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_01700
Y
yang-qibo 已提交
6686 6687 6688 6689
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6690 6691
    it("SUB_Softbus_IPC_Compatility_Ashmem_01700",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_01700---------------------------");
Y
yang-qibo 已提交
6692 6693 6694
        try{
            let mapSize = 4096
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
Z
zhangpa2021 已提交
6695
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01700: ashmem " + ashmem);
Y
yang-qibo 已提交
6696 6697

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6698
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01700: run mapReadAndWriteAshmemis2 is "
Y
yang-qibo 已提交
6699 6700 6701 6702
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [-2147483648,2147483647];
            let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
Z
zhangpa2021 已提交
6703
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01700: run writeToAshmemis is " + result);
Y
yang-qibo 已提交
6704 6705
            expect(result).assertTrue();
            let reresult = ashmem.readFromAshmem(bytes.length,0);
Z
zhangpa2021 已提交
6706
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01700: run readFromAshmemis is " + reresult);
Y
yang-qibo 已提交
6707 6708 6709
            assertArrayElementEqual(reresult,bytes);
            ashmem.closeAshmem();
        }catch(error){
Z
zhangpa2021 已提交
6710
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01700: error " + error);
Y
yang-qibo 已提交
6711
        }
Z
zhangpa2021 已提交
6712
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_01700---------------------------");
Y
yang-qibo 已提交
6713 6714 6715
    })

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

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6729
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01800: run mapReadAndWriteAshmemis2 is "
Y
yang-qibo 已提交
6730 6731 6732 6733
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [-2147483649,2147483647];
            let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
Z
zhangpa2021 已提交
6734
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01800: run writeToAshmemis is " + result);
Y
yang-qibo 已提交
6735 6736
            expect(result).assertTrue();
            let readresult = ashmem.readFromAshmem(bytes.length,0);
Z
zhangpa2021 已提交
6737
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01800: run readFromAshmemis is " + readresult);
Y
yang-qibo 已提交
6738 6739 6740 6741
            expect(readresult[0]).assertEqual(2147483647);
            expect(readresult[1]).assertEqual(bytes[1]);
            ashmem.closeAshmem();
        }catch(error){
Z
zhangpa2021 已提交
6742
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01800: error " + error);
Y
yang-qibo 已提交
6743
        }
Z
zhangpa2021 已提交
6744
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_01800---------------------------");
Y
yang-qibo 已提交
6745 6746 6747
    })

    /*
Z
zhangpa2021 已提交
6748
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_01900
Y
yang-qibo 已提交
6749 6750 6751 6752
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6753 6754
    it("SUB_Softbus_IPC_Compatility_Ashmem_01900",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_01900---------------------------");
Y
yang-qibo 已提交
6755 6756 6757
        try{
            let mapSize = 4096
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
Z
zhangpa2021 已提交
6758
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01900: ashmem " + ashmem);
Y
yang-qibo 已提交
6759 6760

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6761
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01900: run mapReadAndWriteAshmemis2 is "
Y
yang-qibo 已提交
6762 6763 6764 6765
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [-2147483648,2147483648];
            let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
Z
zhangpa2021 已提交
6766
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01900: run writeToAshmemis is " + result);
Y
yang-qibo 已提交
6767 6768
            expect(result).assertTrue();
            let reresult = ashmem.readFromAshmem(bytes.length,0);
Z
zhangpa2021 已提交
6769
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01900: run readFromAshmemis is " + reresult);
Y
yang-qibo 已提交
6770 6771 6772 6773
            expect(reresult[0]).assertEqual(bytes[0]);
            expect(reresult[1]).assertEqual(-2147483648);
            ashmem.closeAshmem();
        }catch(error){
Z
zhangpa2021 已提交
6774
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_01900: error " + error);
J
jiyong 已提交
6775
        }
Z
zhangpa2021 已提交
6776
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_01900---------------------------");
J
jiyong 已提交
6777 6778 6779
    })

    /*
Z
zhangpa2021 已提交
6780
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_02000
Y
yang-qibo 已提交
6781
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
J
jiyong 已提交
6782 6783 6784
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6785 6786
    it("SUB_Softbus_IPC_Compatility_Ashmem_02000",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_02000---------------------------");
J
jiyong 已提交
6787
        try{
Y
yang-qibo 已提交
6788
            let mapSize = 2*M;
Y
yang-qibo 已提交
6789
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
Z
zhangpa2021 已提交
6790
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02000: ashmem " + ashmem);
J
jiyong 已提交
6791

Y
yang-qibo 已提交
6792
            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6793
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02000: run mapReadAndWriteAshmemis2 is " + resultMapRAndW);
Y
yang-qibo 已提交
6794 6795 6796
            expect(resultMapRAndW).assertTrue();
            let bytes = [0,1];
            let result = ashmem.writeToAshmem(bytes, bytes.length, 2147483647);
Z
zhangpa2021 已提交
6797
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02000: run writeToAshmemis is " + result);
Y
yang-qibo 已提交
6798 6799
            expect(result).assertEqual(false);
            ashmem.closeAshmem();
J
jiyong 已提交
6800
        }catch(error){
Z
zhangpa2021 已提交
6801
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02000: error " + error);
J
jiyong 已提交
6802
        }
Z
zhangpa2021 已提交
6803
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_02000---------------------------");
J
jiyong 已提交
6804 6805 6806
    })

    /*
Z
zhangpa2021 已提交
6807
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_02100
J
jiyong 已提交
6808 6809 6810 6811
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6812 6813
    it("SUB_Softbus_IPC_Compatility_Ashmem_02100",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_02100---------------------------");
J
jiyong 已提交
6814
        try{
Y
yang-qibo 已提交
6815
            let mapSize = 2*M;
J
jiyong 已提交
6816
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize)
Z
zhangpa2021 已提交
6817
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02100: ashmem " + ashmem);
J
jiyong 已提交
6818 6819

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6820
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02100: run mapReadAndWriteAshmemis2 is " + resultMapRAndW);
Y
yang-qibo 已提交
6821 6822 6823
            expect(resultMapRAndW).assertTrue();
            let bytes = [0,1];
            let result = ashmem.writeToAshmem(bytes, bytes.length, 2147483648);
Z
zhangpa2021 已提交
6824
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02100: run writeToAshmemis is " + result);
Y
yang-qibo 已提交
6825 6826
            expect(result).assertTrue();
            let readresult1 = ashmem.readFromAshmem(bytes.length,0);
Z
zhangpa2021 已提交
6827
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02100: run readFromAshmemis is " + readresult1);
Y
yang-qibo 已提交
6828
            assertArrayElementEqual(readresult1,bytes);
J
jiyong 已提交
6829
        }catch(error){
Z
zhangpa2021 已提交
6830
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02100: error " + error);
J
jiyong 已提交
6831
        }
Z
zhangpa2021 已提交
6832
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_02100---------------------------");
J
jiyong 已提交
6833 6834 6835
    })

    /*
Z
zhangpa2021 已提交
6836
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_02200
J
jiyong 已提交
6837 6838 6839 6840
     * @tc.name    The writetoashmem interface writes the shared file associated with the object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6841 6842
    it("SUB_Softbus_IPC_Compatility_Ashmem_02200",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_02200---------------------------");
J
jiyong 已提交
6843 6844
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Z
zhangpa2021 已提交
6845
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02200: ashmem " + ashmem);
J
jiyong 已提交
6846 6847

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6848
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02200: run mapReadAndWriteAshmemis2 is "
Y
yang-qibo 已提交
6849 6850 6851
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3, 4, 5];
J
jiyong 已提交
6852
            let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
Z
zhangpa2021 已提交
6853
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02200: run writeToAshmemis is " +result);
Y
yang-qibo 已提交
6854
            expect(result).assertTrue();
J
jiyong 已提交
6855
            let resultread = ashmem.setProtection(rpc.Ashmem.PROT_READ);
Z
zhangpa2021 已提交
6856
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02200: run setProtectionisread is " + resultread);
Y
yang-qibo 已提交
6857
            expect(resultread).assertTrue()
J
jiyong 已提交
6858
            let result2 = ashmem.writeToAshmem(bytes, bytes.length, 0);
Z
zhangpa2021 已提交
6859
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02200: run writeToAshmemis is2 " + result2);
Y
yang-qibo 已提交
6860
            expect(result2).assertEqual(false)
J
jiyong 已提交
6861 6862
            ashmem.closeAshmem();
        }catch(error){
Z
zhangpa2021 已提交
6863
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02200: error " +error);
J
jiyong 已提交
6864
        }
Z
zhangpa2021 已提交
6865
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_02200---------------------------");
J
jiyong 已提交
6866 6867 6868
    })

    /*
Z
zhangpa2021 已提交
6869
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_02300
J
jiyong 已提交
6870 6871 6872 6873
     * @tc.name    Writetoashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6874 6875
    it("SUB_Softbus_IPC_Compatility_Ashmem_02300",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_02300---------------------------");
J
jiyong 已提交
6876 6877
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096);
Z
zhangpa2021 已提交
6878
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02300: ashmem " + ashmem);
J
jiyong 已提交
6879
            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6880
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02300: run mapReadAndWriteAshmemis2 is "
Y
yang-qibo 已提交
6881 6882 6883
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3, 4, 5];
J
jiyong 已提交
6884 6885
            let size = bytes.length + 10;
            let result = ashmem.writeToAshmem(bytes, 3, 0);
Z
zhangpa2021 已提交
6886
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02300: run writeToAshmemis is " + result);
Y
yang-qibo 已提交
6887
            expect(result).assertTrue();
J
jiyong 已提交
6888 6889
            ashmem.closeAshmem()
        }catch(error){
Z
zhangpa2021 已提交
6890
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02300: error " + error);
J
jiyong 已提交
6891
        }
Z
zhangpa2021 已提交
6892
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_02300---------------------------");
J
jiyong 已提交
6893 6894 6895
    })

    /*
Z
zhangpa2021 已提交
6896
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_02400
J
jiyong 已提交
6897 6898 6899 6900
     * @tc.name    Read data from the shared file associated with readfromashmem
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6901 6902
    it("SUB_Softbus_IPC_Compatility_Ashmem_02400",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_02400---------------------------");
J
jiyong 已提交
6903 6904
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Z
zhangpa2021 已提交
6905
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02400: ashmem " + ashmem);
J
jiyong 已提交
6906 6907

            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6908
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02400: run mapReadAndWriteAshmemis2 is "
Y
yang-qibo 已提交
6909 6910 6911
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3, 4, 5];
J
jiyong 已提交
6912
            let result = ashmem.writeToAshmem(bytes, bytes.length, 0);
Z
zhangpa2021 已提交
6913
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02400: run writeToAshmemis is " + result);
Y
yang-qibo 已提交
6914
            expect(result).assertTrue();
J
jiyong 已提交
6915
            var resultRead = ashmem.readFromAshmem(bytes.length, 0);
Z
zhangpa2021 已提交
6916
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02400: run readFromAshmemis is " + resultRead);
Y
yang-qibo 已提交
6917
            assertArrayElementEqual(resultRead,bytes);
J
jiyong 已提交
6918 6919
            ashmem.closeAshmem()
        }catch(error){
Z
zhangpa2021 已提交
6920
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02400: error " + error);
J
jiyong 已提交
6921
        }
Z
zhangpa2021 已提交
6922
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_02400---------------------------");
J
jiyong 已提交
6923 6924 6925
    })

    /*
Z
zhangpa2021 已提交
6926
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_02500
J
jiyong 已提交
6927 6928 6929 6930
     * @tc.name    Readfromashmem exception validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6931 6932
    it("SUB_Softbus_IPC_Compatility_Ashmem_02500",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_02500---------------------------");
J
jiyong 已提交
6933 6934
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096);
Z
zhangpa2021 已提交
6935
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02500: ashmem " + ashmem);
J
jiyong 已提交
6936
            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6937
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02500: run mapReadAndWriteAshmemis2 is "
Y
yang-qibo 已提交
6938 6939 6940
                + resultMapRAndW);
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3, 4, 5];
J
jiyong 已提交
6941
            let result = ashmem.writeToAshmem(bytes, bytes.length, 1);
Z
zhangpa2021 已提交
6942
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02500: run writeToAshmemis is " + result);
Y
yang-qibo 已提交
6943
            expect(result).assertTrue()
J
jiyong 已提交
6944 6945

            let result2 = ashmem.readFromAshmem(bytes.length, 3);
Z
zhangpa2021 已提交
6946
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02500: run readFromAshmemis2 is " + result2);
Y
yang-qibo 已提交
6947 6948 6949
            expect(bytes[2]).assertEqual(result2[0]);
            expect(bytes[3]).assertEqual(result2[1]);
            expect(bytes[4]).assertEqual(result2[2]);
J
jiyong 已提交
6950 6951
            ashmem.closeAshmem()
        }catch(error){
Z
zhangpa2021 已提交
6952
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02500: error " + error);
J
jiyong 已提交
6953
        }
Z
zhangpa2021 已提交
6954
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_02500---------------------------");
J
jiyong 已提交
6955 6956 6957
    })

    /*
Z
zhangpa2021 已提交
6958
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_02600
J
jiyong 已提交
6959 6960 6961 6962
     * @tc.name    Createashmemfromexisting copies the ashmem object description and creates a new object
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
6963 6964
    it("SUB_Softbus_IPC_Compatility_Ashmem_02600",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_02600---------------------------");
J
jiyong 已提交
6965 6966
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096)
Z
zhangpa2021 已提交
6967
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02600: ashmem " + ashmem);
J
jiyong 已提交
6968
            let resultWriteAndRead = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6969
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02600:  run mapReadAndWriteAshmem result " + resultWriteAndRead);
Y
yang-qibo 已提交
6970 6971
            expect(resultWriteAndRead).assertTrue();
            let bytes = [1, 2, 3];
J
jiyong 已提交
6972
            let result = ashmem.writeToAshmem(bytes, bytes.length, 1);
Z
zhangpa2021 已提交
6973
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02600: run writeToAshmemis " + result);
Y
yang-qibo 已提交
6974
            expect(result).assertTrue()
J
jiyong 已提交
6975 6976
            let newashmem = rpc.Ashmem.createAshmemFromExisting(ashmem);
            let resultWriteAndRead2 = newashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
6977
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02600:  run mapReadAndWriteAshmem result " + resultWriteAndRead2);
Y
yang-qibo 已提交
6978
            expect(resultWriteAndRead2).assertTrue();
J
jiyong 已提交
6979 6980

            let result2 = newashmem.readFromAshmem(bytes.length, 1);
Z
zhangpa2021 已提交
6981
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02600: run readFromAshmemis2 is " + result2);
Y
yang-qibo 已提交
6982 6983
            expect(result).assertTrue();
            assertArrayElementEqual(result2,bytes);
J
jiyong 已提交
6984 6985 6986
            ashmem.closeAshmem();
            newashmem.closeAshmem();
        }catch(error){
Z
zhangpa2021 已提交
6987
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02600: error " + error);
J
jiyong 已提交
6988
        }
Z
zhangpa2021 已提交
6989
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_02600---------------------------");
J
jiyong 已提交
6990 6991 6992
    })

    /*
Z
zhangpa2021 已提交
6993
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_02700
J
jiyong 已提交
6994 6995 6996 6997 6998
     * @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
     */
Z
zhangpa2021 已提交
6999 7000
    it("SUB_Softbus_IPC_Compatility_Ashmem_02700",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_02700---------------------------");
J
jiyong 已提交
7001
        try{
Y
yang-qibo 已提交
7002
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
J
jiyong 已提交
7003
            let data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
7004
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02700: ashmem " + ashmem);
J
jiyong 已提交
7005
            let resultMapRAndW = ashmem.mapReadAndWriteAshmem();
Z
zhangpa2021 已提交
7006
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02700: run mapReadAndWriteAshmem result is " + resultMapRAndW);
Y
yang-qibo 已提交
7007 7008
            expect(resultMapRAndW).assertTrue();
            let bytes = [1, 2, 3];
J
jiyong 已提交
7009
            let result = ashmem.writeToAshmem(bytes, bytes.length, 1);
Z
zhangpa2021 已提交
7010
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02700: run writeToAshmemis is " + result);
Y
yang-qibo 已提交
7011
            expect(result).assertTrue()
J
jiyong 已提交
7012
            let result2 = data.writeAshmem(ashmem)
Z
zhangpa2021 已提交
7013
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02700: run writeAshmemis is " + result2);
Y
yang-qibo 已提交
7014
            expect(result2).assertTrue();
J
jiyong 已提交
7015
            let retReadAshmem = data.readAshmem();
Z
zhangpa2021 已提交
7016
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02700: run readAshmem is " + retReadAshmem);
J
jiyong 已提交
7017
            let retBytes = retReadAshmem.readFromAshmem(bytes.length, 1);
Z
zhangpa2021 已提交
7018
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02700: run readFromAshmem result is " + retBytes);
J
jiyong 已提交
7019

Y
yang-qibo 已提交
7020 7021
            ashmem.closeAshmem();
            data.reclaim();
J
jiyong 已提交
7022
        }catch(error){
Z
zhangpa2021 已提交
7023
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02700: error " +error);
J
jiyong 已提交
7024
        }
Z
zhangpa2021 已提交
7025
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_02700---------------------------");
J
jiyong 已提交
7026 7027 7028
    })

    /*
Z
zhangpa2021 已提交
7029
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_02800
J
jiyong 已提交
7030 7031 7032 7033 7034
     * @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
     */
Z
zhangpa2021 已提交
7035 7036
    it("SUB_Softbus_IPC_Compatility_Ashmem_02800",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_02800---------------------------");
J
jiyong 已提交
7037
        try{
Y
yang-qibo 已提交
7038 7039
            let data = rpc.MessageParcel.create();
            let data2 = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
7040
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02800: create MessageParcel object success");
Y
yang-qibo 已提交
7041
            let result = data.writeAshmem(data2);
Z
zhangpa2021 已提交
7042
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02800: run writeAshmemis is " + result);
Y
yang-qibo 已提交
7043 7044
            data.reclaim();
            data2.reclaim();
J
jiyong 已提交
7045
        }catch(error){
Z
zhangpa2021 已提交
7046
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02800: error " + error);
Y
yang-qibo 已提交
7047
            expect(error != null).assertTrue();
J
jiyong 已提交
7048
        }
Z
zhangpa2021 已提交
7049
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_02800---------------------------");
J
jiyong 已提交
7050 7051
    })

Y
yang-qibo 已提交
7052
    /*
Z
zhangpa2021 已提交
7053
     * @tc.number  SUB_Softbus_IPC_Compatility_Ashmem_02900
Y
yang-qibo 已提交
7054 7055
     * @tc.name    Create a non shared memory object and call writeashmem to write the messageparcel object
      object into the messageparcel object
Z
zhangpa2021 已提交
7056 7057 7058
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7059 7060
    it("SUB_Softbus_IPC_Compatility_Ashmem_02900",0,function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_Ashmem_02900---------------------------");
Y
yang-qibo 已提交
7061 7062
        try{
            let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K);
Z
zhangpa2021 已提交
7063

Y
yang-qibo 已提交
7064
            let resultwrite = ashmem.setProtection(rpc.Ashmem.PROT_EXEC)
Z
zhangpa2021 已提交
7065
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02900: run setProtectioniswrite is " + resultwrite);
Y
yang-qibo 已提交
7066
            expect(resultwrite).assertTrue();
Z
zhangpa2021 已提交
7067

Y
yang-qibo 已提交
7068 7069
            ashmem.closeAshmem()
        }catch(error){
Z
zhangpa2021 已提交
7070
            console.info("SUB_Softbus_IPC_Compatility_Ashmem_02900: error " + error);
Y
yang-qibo 已提交
7071
        }
Z
zhangpa2021 已提交
7072
        console.info("---------------------end SUB_Softbus_IPC_Compatility_Ashmem_02900---------------------------");
Y
yang-qibo 已提交
7073
    })
Z
zhangpa2021 已提交
7074

J
jiyong 已提交
7075
    /*
Z
zhangpa2021 已提交
7076
     * @tc.number  SUB_Softbus_IPC_Compatility_IRemoteObject_00100
J
jiyong 已提交
7077 7078 7079 7080
     * @tc.name    Call sendrequestresult interface to send data
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7081 7082
    it("SUB_Softbus_IPC_Compatility_IRemoteObject_00100",0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IRemoteObject_00100---------------------------");
J
jiyong 已提交
7083 7084 7085 7086 7087 7088
        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);
Z
zhangpa2021 已提交
7089
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00100: run writeSequenceableis is " + result);
J
jiyong 已提交
7090 7091

            await gIRemoteObject.sendRequest(CODE_WRITESEQUENCEABLE, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
7092
                console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00100: sendRequestis is " + result.errCode);
J
jiyong 已提交
7093 7094 7095
                expect(result.errCode == 0).assertTrue();
                let ret = new MySequenceable(0, "");
                var shortArryDataReply = result.reply.readSequenceable(ret);
Z
zhangpa2021 已提交
7096
                console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00100: run readSequenceable is "
J
jiyong 已提交
7097 7098 7099 7100 7101 7102 7103 7104 7105 7106
                             + shortArryDataReply);
                expect(shortArryDataReply == true).assertTrue()
                expect(ret.num).assertEqual(1)
                expect(ret.str).assertEqual("aaa")
            });

            data.reclaim();
            reply.reclaim();
            done();
        }catch(error){
Z
zhangpa2021 已提交
7107
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00100: error " + error);
J
jiyong 已提交
7108
        }
Z
zhangpa2021 已提交
7109
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IRemoteObject_00100---------------------------");
J
jiyong 已提交
7110 7111 7112
    })

    /*
Z
zhangpa2021 已提交
7113
     * @tc.number  SUB_Softbus_IPC_Compatility_IRemoteObject_00200
J
jiyong 已提交
7114 7115 7116 7117 7118
     * @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
     */
Z
zhangpa2021 已提交
7119 7120
    it("SUB_Softbus_IPC_Compatility_IRemoteObject_00200", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IRemoteObject_00200---------------------------");
J
jiyong 已提交
7121 7122
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
7123
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00200: create object successfully.");
J
jiyong 已提交
7124 7125 7126 7127 7128 7129 7130 7131 7132
            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 已提交
7133
            expect(data.writeChar(5)).assertTrue()
J
jiyong 已提交
7134 7135 7136 7137
            expect(data.writeString("HelloWorld")).assertTrue()
            expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()

            await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
7138
                console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00200: sendRequest done, error code: " + result.errCode);
J
jiyong 已提交
7139 7140 7141 7142 7143 7144 7145 7146
                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 已提交
7147
                expect(result.reply.readChar()).assertEqual(5)
J
jiyong 已提交
7148 7149 7150 7151 7152 7153 7154 7155 7156 7157
                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) {
Z
zhangpa2021 已提交
7158
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00200:error = " + error);
J
jiyong 已提交
7159
        }
Z
zhangpa2021 已提交
7160
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IRemoteObject_00200---------------------------");
J
jiyong 已提交
7161 7162 7163 7164
        done();
    });

    /*
Z
zhangpa2021 已提交
7165
     * @tc.number  SUB_Softbus_IPC_Compatility_IRemoteObject_00300
J
jiyong 已提交
7166 7167 7168 7169 7170
     * @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
     */
Z
zhangpa2021 已提交
7171 7172
    it("SUB_Softbus_IPC_Compatility_IRemoteObject_00300", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IRemoteObject_00300---------------------------");
J
jiyong 已提交
7173 7174
        try{
            var data = rpc.MessageParcel.create();
Z
zhangpa2021 已提交
7175
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00300: create object successfully.");
J
jiyong 已提交
7176 7177 7178
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();

Z
zhangpa2021 已提交
7179 7180 7181 7182
            expect(data.writeByte(2)).assertTrue()
            expect(data.writeShort(3)).assertTrue()
            expect(data.writeInt(4)).assertTrue()
            expect(data.writeLong(5)).assertTrue()
J
jiyong 已提交
7183 7184 7185
            expect(data.writeFloat(1.2)).assertTrue()
            expect(data.writeDouble(10.2)).assertTrue()
            expect(data.writeBoolean(true)).assertTrue()
Z
zhangpa2021 已提交
7186
            expect(data.writeChar(5)).assertTrue()
J
jiyong 已提交
7187 7188 7189
            expect(data.writeString("HelloWorld")).assertTrue()
            expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()

Z
zhangpa2021 已提交
7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218
            function sendRequestCallback(result) {
                try{
                    console.info("sendRequest Callback")
                    console.info("sendRequest done, error code: " + result.errCode)
                    expect(result.errCode).assertEqual(0)
                    expect(result.reply.readByte()).assertEqual(2)
                    expect(result.reply.readShort()).assertEqual(3)
                    expect(result.reply.readInt()).assertEqual(4)
                    expect(result.reply.readLong()).assertEqual(5)
                    expect(result.reply.readFloat()).assertEqual(1.2)
                    expect(result.reply.readDouble()).assertEqual(10.2)
                    expect(result.reply.readBoolean()).assertTrue()
                    expect(result.reply.readChar()).assertEqual(5)
                    expect(result.reply.readString()).assertEqual("HelloWorld")
                    let s = new MySequenceable(null, null)
                    expect(result.reply.readSequenceable(s)).assertTrue()
                    expect(s.num).assertEqual(1)
                    expect(s.str).assertEqual("aaa")
                } finally {
                    result.data.reclaim();
                    result.reply.reclaim();
                    console.info("test done")
                    done()
                }
           }

           console.info("start send request")
           await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option, sendRequestCallback) 
                
J
jiyong 已提交
7219
        } catch (error) {
Z
zhangpa2021 已提交
7220
         console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00300:error = " + error);
J
jiyong 已提交
7221
        }
Z
zhangpa2021 已提交
7222
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IRemoteObject_00300---------------------------");
J
jiyong 已提交
7223 7224 7225
    });

    /*
Z
zhangpa2021 已提交
7226
     * @tc.number  SUB_Softbus_IPC_Compatility_IRemoteObject_00400
J
jiyong 已提交
7227 7228 7229 7230
     * @tc.name    Iremoteobject, register death notification verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7231 7232
    it("SUB_Softbus_IPC_Compatility_IRemoteObject_00400", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IRemoteObject_00400---------------------------");
J
jiyong 已提交
7233
        try{
Z
zhangpa2021 已提交
7234 7235
            let object = new TestAbilityStub("Test1")
            var resultAdd1 = object.addDeathRecipient(null, 0)
Z
zhangpa2021 已提交
7236
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00400:run addDeathRecipient first result is" + resultAdd1);
Z
zhangpa2021 已提交
7237
            expect(resultAdd1 == false).assertTrue();
J
jiyong 已提交
7238

Z
zhangpa2021 已提交
7239
            var resultRemove1 = object.removeDeathRecipient(null, 0)
Z
zhangpa2021 已提交
7240
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00400:run removeDeathRecipient1 result is" + resultRemove1);
Z
zhangpa2021 已提交
7241
            expect(resultRemove1 == false).assertTrue();
J
jiyong 已提交
7242

Z
zhangpa2021 已提交
7243
            let isDead = object.isObjectDead()
Z
zhangpa2021 已提交
7244
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00400:run  isDead result is " + isDead);
Z
zhangpa2021 已提交
7245
            expect(isDead == false).assertTrue();
J
jiyong 已提交
7246
        } catch (error) {
Z
zhangpa2021 已提交
7247
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00400:error = " + error);
J
jiyong 已提交
7248
        }
Z
zhangpa2021 已提交
7249
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IRemoteObject_00400---------------------------");
J
jiyong 已提交
7250 7251 7252
    });

    /*
Z
zhangpa2021 已提交
7253
     * @tc.number  SUB_Softbus_IPC_Compatility_IRemoteObject_00500
J
jiyong 已提交
7254 7255 7256 7257 7258
     * @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
     */
Z
zhangpa2021 已提交
7259 7260
    it("SUB_Softbus_IPC_Compatility_IRemoteObject_00500", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IRemoteObject_00500---------------------------");
J
jiyong 已提交
7261 7262
        try{
            let callingPid = rpc.IPCSkeleton.getCallingPid()
Z
zhangpa2021 已提交
7263
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00500: run getCallingPid success, callingPid " + callingPid);
Y
yang-qibo 已提交
7264
            expect(callingPid != null).assertTrue();
J
jiyong 已提交
7265 7266

            let callingUid = rpc.IPCSkeleton.getCallingUid()
Z
zhangpa2021 已提交
7267
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00500: run getCallingPid success, callingPid " + callingUid);
Y
yang-qibo 已提交
7268
            expect(callingUid != null).assertTrue();
J
jiyong 已提交
7269 7270

            let callingDeviceID = rpc.IPCSkeleton.getCallingDeviceID()
Z
zhangpa2021 已提交
7271
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00500: run getCallingDeviceID success, callingDeviceID is "
J
jiyong 已提交
7272 7273 7274 7275
                         + callingDeviceID);
            expect(callingDeviceID == "").assertTrue();

            let localDeviceID = rpc.IPCSkeleton.getLocalDeviceID()
Z
zhangpa2021 已提交
7276
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00500: run getLocalDeviceID success, localDeviceID is "
J
jiyong 已提交
7277 7278 7279
            + localDeviceID);
            expect(localDeviceID == "").assertTrue();
        } catch (error) {
Z
zhangpa2021 已提交
7280
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00500:error = " + error);
J
jiyong 已提交
7281
        }
Z
zhangpa2021 已提交
7282
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IRemoteObject_00500---------------------------");
J
jiyong 已提交
7283 7284 7285
    });

    /*
Z
zhangpa2021 已提交
7286
     * @tc.number  SUB_Softbus_IPC_Compatility_IRemoteObject_00600
J
jiyong 已提交
7287 7288 7289 7290
     * @tc.name    Querylocalinterface searches for objects based on descriptors
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7291 7292
    it("SUB_Softbus_IPC_Compatility_IRemoteObject_00600", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IRemoteObject_00600---------------------------");
J
jiyong 已提交
7293 7294
        try{
            let object = new TestAbilityStub("Test1");
Z
zhangpa2021 已提交
7295
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00600: run TestAbilityStub success");
J
jiyong 已提交
7296 7297

            let result = object.isObjectDead()
Z
zhangpa2021 已提交
7298
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00600: run isObjectDeadis is " + result);
J
jiyong 已提交
7299 7300 7301
            expect(result == false).assertTrue()

            let callingPid = object.getCallingPid()
Z
zhangpa2021 已提交
7302
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00600: run getCallingPid success,callingPid " + callingPid);
J
jiyong 已提交
7303 7304

            let callingUid = object.getCallingUid()
Z
zhangpa2021 已提交
7305
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00600: run getCallingPid success,callingPid " + callingUid);
J
jiyong 已提交
7306 7307

            object.attachLocalInterface(object, "Test1")
Z
zhangpa2021 已提交
7308
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00600: run attachLocalInterface success");
J
jiyong 已提交
7309 7310

            let res = object.queryLocalInterface("Test1")
Z
zhangpa2021 已提交
7311
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00600: run queryLocalInterface success, res2 is " + res);
J
jiyong 已提交
7312
        } catch (error) {
Z
zhangpa2021 已提交
7313
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00600:error = " + error);
J
jiyong 已提交
7314
        }
Z
zhangpa2021 已提交
7315
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IRemoteObject_00600---------------------------");
J
jiyong 已提交
7316 7317 7318
    });

    /*
Z
zhangpa2021 已提交
7319
     * @tc.number  SUB_Softbus_IPC_Compatility_IRemoteObject_00700
J
jiyong 已提交
7320 7321 7322 7323
     * @tc.name    Getinterfacedescriptor to get the interface description
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7324 7325
    it("SUB_Softbus_IPC_Compatility_IRemoteObject_00700", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IRemoteObject_00700---------------------------");
J
jiyong 已提交
7326 7327 7328 7329
        try{
            let object = new TestAbilityStub("Test1223");

            let result = object.isObjectDead()
Z
zhangpa2021 已提交
7330
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00700: run isObjectDeadis is " + result);
J
jiyong 已提交
7331 7332 7333
            expect(result == false).assertTrue()

            let callingPid = object.getCallingPid()
Z
zhangpa2021 已提交
7334
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00700: run getCallingPid success,callingPid " + callingPid);
J
jiyong 已提交
7335 7336

            let callingUid = object.getCallingUid()
Z
zhangpa2021 已提交
7337
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00700: run getCallingPid success,callingPid " + callingUid);
J
jiyong 已提交
7338 7339

            object.attachLocalInterface(object, "test1")
Z
zhangpa2021 已提交
7340
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00700: run attachLocalInterface success");
J
jiyong 已提交
7341 7342

            let result2 = object.getInterfaceDescriptor();
Z
zhangpa2021 已提交
7343
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00700: run getInterfaceDescriptoris2 is "
J
jiyong 已提交
7344 7345 7346 7347
                         + result2);
            expect(result2 == "test1").assertTrue();

        } catch (error) {
Z
zhangpa2021 已提交
7348
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00700:error = " + error);
J
jiyong 已提交
7349
        }
Z
zhangpa2021 已提交
7350
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IRemoteObject_00700---------------------------");
J
jiyong 已提交
7351 7352
    });

Z
zhangpa2021 已提交
7353
    /*
Z
zhangpa2021 已提交
7354
     * @tc.number  SUB_Softbus_IPC_Compatility_IRemoteObject_00800
Z
zhangpa2021 已提交
7355 7356 7357 7358 7359
     * @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
     */
Z
zhangpa2021 已提交
7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378
    it("SUB_Softbus_IPC_Compatility_IRemoteObject_00800", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IRemoteObject_00800---------------------------");
        try{
            let object = new TestAbilityStub("TestAbilityStub") 
            var data = rpc.MessageParcel.create();
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00800: create object successfully.");
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            expect(data.writeInterfaceToken("TestAbilityStub")).assertTrue()
            expect(data.writeByte(2)).assertTrue()
            expect(data.writeShort(3)).assertTrue()
            expect(data.writeInt(4)).assertTrue()
            expect(data.writeLong(5)).assertTrue()
            expect(data.writeFloat(1.2)).assertTrue()
            expect(data.writeDouble(10.2)).assertTrue()
            expect(data.writeBoolean(true)).assertTrue()
            expect(data.writeChar(5)).assertTrue()
            expect(data.writeString("HelloWorld")).assertTrue()
            expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()
Z
zhangpa2021 已提交
7379
    
Z
zhangpa2021 已提交
7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405
            function sendRequestCallback(result) {
                try{
                    console.info("sendRequest Callback")
                    console.info("sendRequest done, error code: " + result.errCode)
                    expect(result.errCode).assertEqual(0)
                    result.reply.readException()
                    expect(result.reply.readByte()).assertEqual(2)
                    expect(result.reply.readShort()).assertEqual(3)
                    expect(result.reply.readInt()).assertEqual(4)
                    expect(result.reply.readLong()).assertEqual(5)
                    expect(result.reply.readFloat()).assertEqual(1.2)
                    expect(result.reply.readDouble()).assertEqual(10.2)
                    expect(result.reply.readBoolean()).assertTrue()
                    expect(result.reply.readChar()).assertEqual(5)
                    expect(result.reply.readString()).assertEqual("HelloWorld")
                    let s = new MySequenceable(null, null)
                    expect(result.reply.readSequenceable(s)).assertTrue()
                    expect(s.num).assertEqual(1)
                    expect(s.str).assertEqual("aaa")
                } finally {
                    result.data.reclaim();
                    result.reply.reclaim();
                    console.info("test done")
                    done()
                }
            }
Z
zhangpa2021 已提交
7406
    
Z
zhangpa2021 已提交
7407 7408
            console.info("start send request")
            object.sendRequest(CODE_SAME_PROCESS, data, reply, option, sendRequestCallback) 
Z
zhangpa2021 已提交
7409
                    
Z
zhangpa2021 已提交
7410 7411 7412 7413 7414
        } catch (error) {
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00800:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IRemoteObject_00800---------------------------");
    });
Z
zhangpa2021 已提交
7415

Z
zhangpa2021 已提交
7416
    /*
Y
yang-qibo 已提交
7417
     * @tc.number  SUB_Softbus_IPC_Compatility_IRemoteObject_00900
Z
zhangpa2021 已提交
7418 7419 7420 7421
     * @tc.name    IRemoteObject sendRequestAsync API Test
     * @tc.desc    Function test
     * @tc.level   0
     */
Y
yang-qibo 已提交
7422 7423
    it("SUB_Softbus_IPC_Compatility_IRemoteObject_00900", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IRemoteObject_00900---------------------------");
Z
zhangpa2021 已提交
7424 7425
        try{
            var data = rpc.MessageParcel.create();
Y
yang-qibo 已提交
7426
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00900: create object successfully.");
Z
zhangpa2021 已提交
7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440
            var reply = rpc.MessageParcel.create();
            var option = new rpc.MessageOption();
            expect(data.writeByte(1)).assertTrue()
            expect(data.writeShort(2)).assertTrue()
            expect(data.writeInt(3)).assertTrue()
            expect(data.writeLong(10000)).assertTrue()
            expect(data.writeFloat(1.2)).assertTrue()
            expect(data.writeDouble(10.2)).assertTrue()
            expect(data.writeBoolean(true)).assertTrue()
            expect(data.writeChar(96)).assertTrue()
            expect(data.writeString("HelloWorld")).assertTrue()
            expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue()

            await gIRemoteObject.sendRequestAsync(CODE_ALL_TYPE, data, reply, option, (err, result) => {
Y
yang-qibo 已提交
7441
                console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00900:sendRequest done, error code: " + result.errCode)
Z
zhangpa2021 已提交
7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457
                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()
                expect(result.reply.readChar()).assertEqual(96)
                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")
            });
        } catch (error) {
Y
yang-qibo 已提交
7458
            console.info("SUB_Softbus_IPC_Compatility_IRemoteObject_00900:error = " + error);
Z
zhangpa2021 已提交
7459 7460 7461 7462
        }
        data.reclaim();
        reply.reclaim();
        done();
Y
yang-qibo 已提交
7463
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IRemoteObject_00900---------------------------");
Z
zhangpa2021 已提交
7464 7465 7466
    });


J
jiyong 已提交
7467
    /*
Z
zhangpa2021 已提交
7468
     * @tc.number  SUB_Softbus_IPC_Compatility_RemoteProxy_00100
J
jiyong 已提交
7469 7470 7471 7472
     * @tc.name    Call adddeathrecipient to register the death notification
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7473 7474
    it("SUB_Softbus_IPC_Compatility_RemoteProxy_00100", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_RemoteProxy_00100---------------------------");
J
jiyong 已提交
7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489
        try{
            let recipient = new MyDeathRecipient(gIRemoteObject, null)
            var resultAdd1 = gIRemoteObject.addDeathRecipient(recipient, 0)
            expect(resultAdd1 == true).assertTrue();
            var resultAdd2 = gIRemoteObject.addDeathRecipient(recipient, 0)
            expect(resultAdd2 == true).assertTrue();
            var resultRemove1 = gIRemoteObject.removeDeathRecipient(recipient, 0)
            expect(resultRemove1 == true).assertTrue();

            var resultRemove2 = gIRemoteObject.removeDeathRecipient(recipient, 0)
            expect(resultRemove2 == true).assertTrue();

            var resultRemove3 = gIRemoteObject.removeDeathRecipient(recipient, 0)
            expect(resultRemove3 == false).assertTrue();
        } catch (error) {
Z
zhangpa2021 已提交
7490
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00100:error = " + error);
Y
yang-qibo 已提交
7491
        }
Z
zhangpa2021 已提交
7492
        console.info("---------------------end SUB_Softbus_IPC_Compatility_RemoteProxy_00100---------------------------");
Y
yang-qibo 已提交
7493 7494 7495
    });

    /*
Z
zhangpa2021 已提交
7496
     * @tc.number  SUB_Softbus_IPC_Compatility_RemoteProxy_00200
Y
yang-qibo 已提交
7497 7498 7499 7500
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7501 7502
    it("SUB_Softbus_IPC_Compatility_RemoteProxy_00200", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_RemoteProxy_00200---------------------------");
Y
yang-qibo 已提交
7503 7504 7505 7506 7507 7508 7509
        try{
            let recipient = new MyDeathRecipient(gIRemoteObject, null);
            var resultAdd = gIRemoteObject.addDeathRecipient(recipient, -(2*G));
            expect(resultAdd).assertTrue();
            var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, -(2*G));
            expect(resultRemove).assertTrue();
        } catch (error) {
Z
zhangpa2021 已提交
7510
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00200:error = " + error);
Y
yang-qibo 已提交
7511
        }
Z
zhangpa2021 已提交
7512
        console.info("---------------------end SUB_Softbus_IPC_Compatility_RemoteProxy_00200---------------------------");
Y
yang-qibo 已提交
7513 7514 7515
    });

    /*
Z
zhangpa2021 已提交
7516
     * @tc.number  SUB_Softbus_IPC_Compatility_RemoteProxy_00300
Y
yang-qibo 已提交
7517 7518 7519 7520
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7521 7522
    it("SUB_Softbus_IPC_Compatility_RemoteProxy_00300", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_RemoteProxy_00300---------------------------");
Y
yang-qibo 已提交
7523 7524 7525 7526 7527 7528 7529
        try{
            let recipient = new MyDeathRecipient(gIRemoteObject, null);
            var resultAdd = gIRemoteObject.addDeathRecipient(recipient, (2*G - 1));
            expect(resultAdd).assertTrue();
            var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, (2*G - 1));
            expect(resultRemove).assertTrue();
        } catch (error) {
Z
zhangpa2021 已提交
7530
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00300:error = " + error);
Y
yang-qibo 已提交
7531
        }
Z
zhangpa2021 已提交
7532
        console.info("---------------------end SUB_Softbus_IPC_Compatility_RemoteProxy_00300---------------------------");
Y
yang-qibo 已提交
7533 7534 7535
    });

    /*
Z
zhangpa2021 已提交
7536
     * @tc.number  SUB_Softbus_IPC_Compatility_RemoteProxy_00400
Y
yang-qibo 已提交
7537 7538 7539 7540
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7541 7542
    it("SUB_Softbus_IPC_Compatility_RemoteProxy_00400", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_RemoteProxy_00400---------------------------");
Y
yang-qibo 已提交
7543 7544 7545
        try{
            let recipient = new MyDeathRecipient(gIRemoteObject, null);
            var resultAdd = gIRemoteObject.addDeathRecipient(recipient, 2*G);
Z
zhangpa2021 已提交
7546
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00400:run addDeathRecipient first is " + resultAdd);
Y
yang-qibo 已提交
7547 7548
            expect(resultAdd).assertTrue();
            var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, 2*G);
Z
zhangpa2021 已提交
7549
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00400:run removeDeathRecipient1 is " + resultRemove);
Y
yang-qibo 已提交
7550 7551
            expect(resultRemove).assertTrue();
        } catch (error) {
Z
zhangpa2021 已提交
7552
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00400:error = " + error);
Y
yang-qibo 已提交
7553
        }
Z
zhangpa2021 已提交
7554
        console.info("---------------------end SUB_Softbus_IPC_Compatility_RemoteProxy_00400---------------------------");
Y
yang-qibo 已提交
7555 7556 7557
    });

    /*
Z
zhangpa2021 已提交
7558
     * @tc.number  sendfile/trans_file_func_test.cppRemoteProxy_00500
Y
yang-qibo 已提交
7559 7560 7561 7562
     * @tc.name    AddDeathRecipient Validates the interface flags input parameter boundary value
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7563 7564
    it("SUB_Softbus_IPC_Compatility_RemoteProxy_00500", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_RemoteProxy_00500---------------------------");
Y
yang-qibo 已提交
7565 7566 7567
        try{
            let recipient = new MyDeathRecipient(gIRemoteObject, null);
            var resultAdd = gIRemoteObject.addDeathRecipient(recipient, -(2*G + 1));
Z
zhangpa2021 已提交
7568
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00500:run addDeathRecipient first is " + resultAdd);
Y
yang-qibo 已提交
7569 7570
            expect(resultAdd).assertTrue();
            var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, -(2*G + 1));
Z
zhangpa2021 已提交
7571
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00500:run removeDeathRecipient1 is " + resultRemove);
Y
yang-qibo 已提交
7572 7573
            expect(resultRemove).assertTrue();
        } catch (error) {
Z
zhangpa2021 已提交
7574
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00500:error = " + error);
J
jiyong 已提交
7575
        }
Z
zhangpa2021 已提交
7576
        console.info("---------------------end SUB_Softbus_IPC_Compatility_RemoteProxy_00500---------------------------");
J
jiyong 已提交
7577 7578 7579
    });

    /*
Z
zhangpa2021 已提交
7580
     * @tc.number  SUB_Softbus_IPC_Compatility_RemoteProxy_00600
J
jiyong 已提交
7581 7582 7583 7584
     * @tc.name    Call isobjectdead to check whether the object is dead
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7585 7586
    it("SUB_Softbus_IPC_Compatility_RemoteProxy_00600", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_RemoteProxy_00600---------------------------");
J
jiyong 已提交
7587
        try{
Z
zhangpa2021 已提交
7588
            let recipient = new MyDeathRecipient(gIRemoteObject, null)
Y
yang-qibo 已提交
7589
            var isDead = gIRemoteObject.isObjectDead();
Z
zhangpa2021 已提交
7590
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00600: run isObjectDead result is " + isDead);
Y
yang-qibo 已提交
7591 7592
            expect(isDead == false).assertTrue();

Z
zhangpa2021 已提交
7593
            var resultAdd1 = gIRemoteObject.addDeathRecipient(recipient, 0)
Z
zhangpa2021 已提交
7594
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00600:run addDeathRecipient first result is " + resultAdd1);
J
jiyong 已提交
7595 7596
            expect(resultAdd1 == true).assertTrue();

Z
zhangpa2021 已提交
7597
            var isDead1 = gIRemoteObject.isObjectDead();
Z
zhangpa2021 已提交
7598
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00600: run isObjectDead result is " + isDead1);
Z
zhangpa2021 已提交
7599
            expect(isDead1 == false).assertTrue();
J
jiyong 已提交
7600

Y
yang-qibo 已提交
7601
            var resultRemove1 = gIRemoteObject.removeDeathRecipient(recipient, 0)
Z
zhangpa2021 已提交
7602
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00600:run removeDeathRecipient result is " + resultRemove1);
Y
yang-qibo 已提交
7603 7604
            expect(resultRemove1 == true).assertTrue();

Z
zhangpa2021 已提交
7605
            var resultAdd2 = gIRemoteObject.addDeathRecipient(recipient, 0)
Z
zhangpa2021 已提交
7606
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00600:run addDeathRecipient second result is " + resultAdd2);
J
jiyong 已提交
7607 7608
            expect(resultAdd2 == true).assertTrue();

Y
yang-qibo 已提交
7609
            var resultRemove2 = gIRemoteObject.removeDeathRecipient(recipient, 0)
Z
zhangpa2021 已提交
7610
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00600:run removeDeathRecipient1 result is " + resultRemove2);
Y
yang-qibo 已提交
7611 7612 7613
            expect(resultRemove2 == true).assertTrue();

            var resultRemove3 = gIRemoteObject.removeDeathRecipient(recipient, 0)
Z
zhangpa2021 已提交
7614
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00600:run removeDeathRecipient3 result is " + resultRemove3);
Y
yang-qibo 已提交
7615
            expect(resultRemove3 == false).assertTrue();
J
jiyong 已提交
7616

Z
zhangpa2021 已提交
7617
            var isDead2 = gIRemoteObject.isObjectDead();
Z
zhangpa2021 已提交
7618
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00600: run isObjectDead2 result is " + isDead2);
Y
yang-qibo 已提交
7619
            expect(isDead2 == false).assertTrue();
J
jiyong 已提交
7620
        } catch (error) {
Z
zhangpa2021 已提交
7621
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00600:error = " + error);
J
jiyong 已提交
7622
        }
Z
zhangpa2021 已提交
7623
        console.info("---------------------end SUB_Softbus_IPC_Compatility_RemoteProxy_00600---------------------------");
J
jiyong 已提交
7624 7625 7626
    });

    /*
Z
zhangpa2021 已提交
7627
     * @tc.number  SUB_Softbus_IPC_Compatility_RemoteProxy_00700
J
jiyong 已提交
7628 7629 7630 7631
     * @tc.name    Getinterfacedescriptor to get the object interface description
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7632 7633
    it("SUB_Softbus_IPC_Compatility_RemoteProxy_00700", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_RemoteProxy_00700---------------------------");
J
jiyong 已提交
7634 7635 7636 7637
        try{
            let object = new TestAbilityStub("Test0300");

            let result = object.getInterfaceDescriptor()
Z
zhangpa2021 已提交
7638
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00700: run getInterfaceDescriptor result is " + result);
Y
yang-qibo 已提交
7639
            expect(result).assertEqual("Test0300");
J
jiyong 已提交
7640
        } catch (error) {
Z
zhangpa2021 已提交
7641
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00700:error = " + error);
J
jiyong 已提交
7642
        }
Z
zhangpa2021 已提交
7643
        console.info("---------------------end SUB_Softbus_IPC_Compatility_RemoteProxy_00700---------------------------");
J
jiyong 已提交
7644 7645 7646
    });

    /*
Z
zhangpa2021 已提交
7647
     * @tc.number  SUB_Softbus_IPC_Compatility_RemoteProxy_00800
J
jiyong 已提交
7648 7649 7650 7651
     * @tc.name    Querylocalinterface searches for objects based on descriptors
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7652 7653
    it("SUB_Softbus_IPC_Compatility_RemoteProxy_00800", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_RemoteProxy_00800---------------------------");
J
jiyong 已提交
7654 7655 7656
        try{
            let object = new TestAbilityStub("Test0400");

Y
yang-qibo 已提交
7657
            let result = object.isObjectDead();
Z
zhangpa2021 已提交
7658
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00800: run getInterfaceDescriptor is " + result);
Y
yang-qibo 已提交
7659 7660
            expect(result).assertEqual(false);
            object.attachLocalInterface(object, "Test2");
Z
zhangpa2021 已提交
7661
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00800: run attachLocalInterface success");
J
jiyong 已提交
7662
            let res2 = object.queryLocalInterface('Test2');
Z
zhangpa2021 已提交
7663
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00800: run queryLocalInterface success, res2 is " + res2);
J
jiyong 已提交
7664
            let resultDescrip = object.getInterfaceDescriptor()
Z
zhangpa2021 已提交
7665
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00800: run getInterfaceDescriptor success resultDescrip is "
Y
yang-qibo 已提交
7666 7667
                + resultDescrip);
            expect(resultDescrip).assertEqual("Test2");
J
jiyong 已提交
7668
        } catch (error) {
Z
zhangpa2021 已提交
7669
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00800:error = " + error);
J
jiyong 已提交
7670
        }
Z
zhangpa2021 已提交
7671
        console.info("---------------------end SUB_Softbus_IPC_Compatility_RemoteProxy_00800---------------------------");
J
jiyong 已提交
7672 7673 7674
    });

    /*
Z
zhangpa2021 已提交
7675
     * @tc.number  SUB_Softbus_IPC_Compatility_RemoteProxy_00900
J
jiyong 已提交
7676 7677 7678 7679
     * @tc.name    Transaction constant validation
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7680 7681
    it("SUB_Softbus_IPC_Compatility_RemoteProxy_00900", 0, async function(){
        console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00900 is starting-------------")
Y
yang-qibo 已提交
7682 7683 7684 7685 7686 7687 7688
        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) {
Z
zhangpa2021 已提交
7689
            console.info("SUB_Softbus_IPC_Compatility_RemoteProxy_00900 error is" + error);
Y
yang-qibo 已提交
7690
        }
Z
zhangpa2021 已提交
7691
        console.info("---------------------end SUB_Softbus_IPC_Compatility_RemoteProxy_00900---------------------------");
Y
yang-qibo 已提交
7692 7693 7694
    })

    /*
Z
zhangpa2021 已提交
7695
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_00100
Y
yang-qibo 已提交
7696 7697 7698 7699
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7700 7701
    it('SUB_Softbus_IPC_Compatility_IPCSkeleton_00100', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_00100---------------------------");
J
jiyong 已提交
7702
        try {
Z
zhangpa2021 已提交
7703
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00100")
Y
yang-qibo 已提交
7704 7705
            let remoteObject = new TestRemoteObject("aaa");
            let ret = rpc.IPCSkeleton.flushCommands(remoteObject);
Z
zhangpa2021 已提交
7706
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00100 RpcServer: flushCommands result: " + ret);
Y
yang-qibo 已提交
7707 7708 7709
            expect(ret != null).assertTrue();
        }
        catch (error) {
Z
zhangpa2021 已提交
7710
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00100 error is :" + error)
Y
yang-qibo 已提交
7711
        }
Z
zhangpa2021 已提交
7712
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_00100---------------------------");
J
jiyong 已提交
7713 7714 7715
    })

    /*
Z
zhangpa2021 已提交
7716
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_00200
J
jiyong 已提交
7717 7718 7719 7720
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7721 7722
    it('SUB_Softbus_IPC_Compatility_IPCSkeleton_00200', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_00200---------------------------");
J
jiyong 已提交
7723
        try {
Z
zhangpa2021 已提交
7724
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00200 testcase")
J
jiyong 已提交
7725 7726
            let remoteObject = {};
            let ret = rpc.IPCSkeleton.flushCommands(remoteObject);
Z
zhangpa2021 已提交
7727
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00200 RpcServer: flushCommands result: " + ret);
Y
yang-qibo 已提交
7728 7729 7730
            expect(ret != null).assertTrue();
        }
        catch (error) {
Z
zhangpa2021 已提交
7731
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00200 error is :" + error)
Y
yang-qibo 已提交
7732
        }
Z
zhangpa2021 已提交
7733
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_00200---------------------------");
Y
yang-qibo 已提交
7734 7735 7736
    })

    /*
Z
zhangpa2021 已提交
7737
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_00300
Y
yang-qibo 已提交
7738 7739 7740 7741
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7742 7743
    it('SUB_Softbus_IPC_Compatility_IPCSkeleton_00300', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_00300---------------------------");
Y
yang-qibo 已提交
7744
        try {
Z
zhangpa2021 已提交
7745
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00300 testcase")
Y
yang-qibo 已提交
7746
            let samgr = rpc.IPCSkeleton.getContextObject();
Z
zhangpa2021 已提交
7747
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00300 getContextObject result: " + samgr);
Y
yang-qibo 已提交
7748 7749
            expect(samgr != null).assertTrue();
            let geinde = samgr.getInterfaceDescriptor();
Z
zhangpa2021 已提交
7750
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00300 getInterfaceDescriptor result: " + geinde);
Y
yang-qibo 已提交
7751 7752 7753
            expect(geinde).assertEqual("");
        }
        catch (error) {
Z
zhangpa2021 已提交
7754
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00300 error is :" + error)
Y
yang-qibo 已提交
7755
        }
Z
zhangpa2021 已提交
7756
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_00300---------------------------");
Y
yang-qibo 已提交
7757 7758 7759
    })

    /*
Z
zhangpa2021 已提交
7760
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_00400
Y
yang-qibo 已提交
7761 7762 7763 7764
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7765 7766
    it('SUB_Softbus_IPC_Compatility_IPCSkeleton_00400', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_00400---------------------------");
Y
yang-qibo 已提交
7767
        try {
Z
zhangpa2021 已提交
7768
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00400 testcase")
Y
yang-qibo 已提交
7769
            let getCallingPid = rpc.IPCSkeleton.getCallingPid();
Z
zhangpa2021 已提交
7770
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00400 getCallingPid result: " + getCallingPid);
Y
yang-qibo 已提交
7771 7772
            expect(getCallingPid != null).assertTrue();
            let getCallingUid = rpc.IPCSkeleton.getCallingUid();
Z
zhangpa2021 已提交
7773
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00400 getCallingUid result: " + getCallingUid);
Y
yang-qibo 已提交
7774 7775 7776
            expect(getCallingUid != null).assertTrue();
        }
        catch (error) {
Z
zhangpa2021 已提交
7777
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00400 error is :" + error)
Y
yang-qibo 已提交
7778
        }
Z
zhangpa2021 已提交
7779
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_00400---------------------------");
Y
yang-qibo 已提交
7780 7781 7782
    })

    /*
Z
zhangpa2021 已提交
7783
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_00500
Y
yang-qibo 已提交
7784 7785 7786 7787
     * @tc.name    Create an empty object and verify the function of the flushcommands interface
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7788 7789
    it('SUB_Softbus_IPC_Compatility_IPCSkeleton_00500', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_00500---------------------------");
Y
yang-qibo 已提交
7790
        try {
Z
zhangpa2021 已提交
7791
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00500 testcase")
Y
yang-qibo 已提交
7792
            let getCallingPid = rpc.IPCSkeleton.getLocalDeviceID();
Z
zhangpa2021 已提交
7793
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00500 getCallingPid result: " + getCallingPid);
Y
yang-qibo 已提交
7794 7795
            expect(getCallingPid != null).assertTrue();
            let getCallingUid = rpc.IPCSkeleton.getCallingDeviceID();
Z
zhangpa2021 已提交
7796
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00500 getCallingUid result: " + getCallingUid);
Y
yang-qibo 已提交
7797
            expect(getCallingUid != null).assertTrue();
J
jiyong 已提交
7798 7799
        }
        catch (error) {
Z
zhangpa2021 已提交
7800
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00500 error is :" + error)
J
jiyong 已提交
7801
        }
Z
zhangpa2021 已提交
7802
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_00500---------------------------");
J
jiyong 已提交
7803 7804 7805
    })

    /*
Z
zhangpa2021 已提交
7806
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_00600
J
jiyong 已提交
7807 7808 7809 7810 7811
     * @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
     */
Z
zhangpa2021 已提交
7812 7813
    it('SUB_Softbus_IPC_Compatility_IPCSkeleton_00600', 0, async function() {
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_00600---------------------------");
J
jiyong 已提交
7814 7815
        try{
            let getCallingPid = rpc.IPCSkeleton.getCallingPid();
Z
zhangpa2021 已提交
7816
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00600: run  getCallingPid result is :" + getCallingPid);
Y
yang-qibo 已提交
7817
            expect(getCallingPid != null).assertTrue();
Z
zhangpa2021 已提交
7818

J
jiyong 已提交
7819
            let getCallingUid = rpc.IPCSkeleton.getCallingUid();
Z
zhangpa2021 已提交
7820
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00600: run getCallingUid result is :" + getCallingUid);
Y
yang-qibo 已提交
7821
            expect(getCallingUid != null).assertTrue();
Z
zhangpa2021 已提交
7822

Y
yang-qibo 已提交
7823
            let getCallingToKenId = rpc.IPCSkeleton.getCallingTokenId();
Z
zhangpa2021 已提交
7824
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00600: run getCallingToKenId result is :" + getCallingToKenId);
Y
yang-qibo 已提交
7825
            expect(getCallingToKenId != null).assertTrue();
Z
zhangpa2021 已提交
7826

J
jiyong 已提交
7827
            let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID();
Z
zhangpa2021 已提交
7828
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00600: run getLocalDeviceID result is :" + getLocalDeviceID);
Y
yang-qibo 已提交
7829
            expect(getLocalDeviceID != null).assertTrue();
Z
zhangpa2021 已提交
7830

J
jiyong 已提交
7831
            let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID();
Z
zhangpa2021 已提交
7832
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00600: run getCallingDeviceID result is :" + getCallingDeviceID);
Y
yang-qibo 已提交
7833
            expect(getCallingDeviceID != null).assertTrue();
J
jiyong 已提交
7834
        } catch (error){
Z
zhangpa2021 已提交
7835
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00600: error = " + error);
J
jiyong 已提交
7836
        }
Z
zhangpa2021 已提交
7837
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_00600---------------------------");
J
jiyong 已提交
7838 7839 7840
    })

    /*
Z
zhangpa2021 已提交
7841
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_00700
Y
yang-qibo 已提交
7842 7843 7844 7845
     * @tc.name    Basic method of testing ipcskeleton
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7846 7847
    it("SUB_Softbus_IPC_Compatility_IPCSkeleton_00700", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_00700---------------------------");
Y
yang-qibo 已提交
7848 7849 7850 7851 7852 7853 7854 7855
        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();
Z
zhangpa2021 已提交
7856
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00700: callingPid: " + callingPid
Y
yang-qibo 已提交
7857 7858 7859 7860
                + ", callingUid: " + callingUid);
            expect(callingUid != null).assertTrue();
            expect(callingPid != null).assertTrue();
            await gIRemoteObject.sendRequest(CODE_IPCSKELETON, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
7861
                console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00700: sendRequest done, error code: " + result.errCode)
Y
yang-qibo 已提交
7862 7863 7864 7865
                expect(result.errCode).assertEqual(0);
                result.reply.readException();
                let rescallingPid = result.reply.readInt();
                let rescallingUid = result.reply.readInt();
Z
zhangpa2021 已提交
7866
                console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00700:" + rescallingPid +" ;"+ rescallingUid);
Y
yang-qibo 已提交
7867 7868 7869 7870 7871 7872 7873
                expect(rescallingPid).assertEqual(callingPid);
                expect(rescallingUid).assertEqual(callingUid);
            })
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
7874
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00700:error = " + error);
Y
yang-qibo 已提交
7875
        }
Z
zhangpa2021 已提交
7876
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_00700---------------------------");
Y
yang-qibo 已提交
7877 7878 7879
    });

    /*
Z
zhangpa2021 已提交
7880
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_00800
Y
yang-qibo 已提交
7881 7882 7883 7884
     * @tc.name    Basic method of testing ipcskeleton
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7885 7886
    it("SUB_Softbus_IPC_Compatility_IPCSkeleton_00800", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_00800---------------------------");
Y
yang-qibo 已提交
7887 7888 7889 7890 7891 7892 7893
        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();
Z
zhangpa2021 已提交
7894
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00800: callingPid: " + callingPid
Y
yang-qibo 已提交
7895 7896
                + ", callingUid: " + callingUid);
            await gIRemoteObject.sendRequest(CODE_IPCSKELETON_INT, data, reply, option).then((result) => {
Z
zhangpa2021 已提交
7897
                console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00800: sendRequest done, error code: " + result.errCode)
Y
yang-qibo 已提交
7898 7899 7900 7901 7902 7903 7904 7905 7906 7907
                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();

Z
zhangpa2021 已提交
7908
                console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00800:" + resicallingUid +" ;"+ resflushCommands);
Y
yang-qibo 已提交
7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920
                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) {
Z
zhangpa2021 已提交
7921
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00800:error = " + error);
Y
yang-qibo 已提交
7922
        }
Z
zhangpa2021 已提交
7923
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_00800---------------------------");
Y
yang-qibo 已提交
7924 7925 7926
    });

    /*
Z
zhangpa2021 已提交
7927
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_00900
Y
yang-qibo 已提交
7928 7929 7930 7931
     * @tc.name    SetCallingIdentity Interface flags input parameter boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7932 7933
    it("SUB_Softbus_IPC_Compatility_IPCSkeleton_00900", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_00900---------------------------");
Y
yang-qibo 已提交
7934 7935 7936
        try{
            let id = "";
            let ret = rpc.IPCSkeleton.setCallingIdentity(id);
Z
zhangpa2021 已提交
7937
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00900: setCallingIdentity is: " + ret);
Y
yang-qibo 已提交
7938 7939
            expect(ret).assertTrue();
        } catch (error) {
Z
zhangpa2021 已提交
7940
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_00900:error = " + error);
Y
yang-qibo 已提交
7941
        }
Z
zhangpa2021 已提交
7942
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_00900---------------------------");
Y
yang-qibo 已提交
7943 7944 7945
    });

    /*
Z
zhangpa2021 已提交
7946
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_01000
Y
yang-qibo 已提交
7947 7948 7949 7950
     * @tc.name    SetCallingIdentity Interface flags input parameter boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7951 7952
    it("SUB_Softbus_IPC_Compatility_IPCSkeleton_01000", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_01000---------------------------");
Y
yang-qibo 已提交
7953 7954 7955
        try{
            let id = 0;
            let ret = rpc.IPCSkeleton.setCallingIdentity(id);
Z
zhangpa2021 已提交
7956
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01000: setCallingIdentity is: " + ret);
Y
yang-qibo 已提交
7957 7958
            expect(ret).assertTrue();
        } catch (error) {
Z
zhangpa2021 已提交
7959
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01000:error = " + error);
Y
yang-qibo 已提交
7960
        }
Z
zhangpa2021 已提交
7961
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_01000---------------------------");
Y
yang-qibo 已提交
7962 7963 7964
    });

    /*
Z
zhangpa2021 已提交
7965
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_01100
Y
yang-qibo 已提交
7966 7967 7968 7969
     * @tc.name    SetCallingIdentity Interface flags input parameter boundary value verification
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7970 7971
    it("SUB_Softbus_IPC_Compatility_IPCSkeleton_01100", 0,async function(){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_01100---------------------------");
Y
yang-qibo 已提交
7972 7973 7974 7975 7976
        try{
            let id = "";
            for (let i = 0; i < (40*K - 1); i++){
                id += "a";
            }
Z
zhangpa2021 已提交
7977
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01100: id length is: " + id.length);
Y
yang-qibo 已提交
7978 7979

            let ret = rpc.IPCSkeleton.setCallingIdentity(id);
Z
zhangpa2021 已提交
7980
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01100: setCallingIdentity is: " + ret);
Y
yang-qibo 已提交
7981 7982
            expect(ret).assertTrue();
        } catch (error) {
Z
zhangpa2021 已提交
7983
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01100:error = " + error);
Y
yang-qibo 已提交
7984
        }
Z
zhangpa2021 已提交
7985
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_01100---------------------------");
Y
yang-qibo 已提交
7986 7987 7988
    });

    /*
Z
zhangpa2021 已提交
7989
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_01200
J
jiyong 已提交
7990 7991 7992 7993
     * @tc.name    Basic method of testing ipcskeleton
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
7994 7995
    it("SUB_Softbus_IPC_Compatility_IPCSkeleton_01200", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_01200---------------------------");
J
jiyong 已提交
7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011
        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);
Z
zhangpa2021 已提交
8012
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01200: callingPid: " + callingPid
Y
yang-qibo 已提交
8013
                + ", callingUid: " + callingUid
J
jiyong 已提交
8014 8015 8016 8017 8018 8019
                         + ", 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();
Z
zhangpa2021 已提交
8020
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01200: start send request");
Y
yang-qibo 已提交
8021
            await gIRemoteObject.sendRequest(CODE_IPCSKELETON, data, reply, option).then(function(result) {
Z
zhangpa2021 已提交
8022
                console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01200: sendRequest done, error code: " + result.errCode)
Y
yang-qibo 已提交
8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034
                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 已提交
8035 8036 8037 8038 8039
                })
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
Z
zhangpa2021 已提交
8040
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01200:error = " + error);
J
jiyong 已提交
8041
        }
Z
zhangpa2021 已提交
8042
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_01200---------------------------");
J
jiyong 已提交
8043 8044
    });

Z
zhangpa2021 已提交
8045
    /*
Z
zhangpa2021 已提交
8046
     * @tc.number  SUB_Softbus_IPC_Compatility_IPCSkeleton_01300
Z
zhangpa2021 已提交
8047 8048 8049 8050
     * @tc.name    IPCSkeleton sendRequestAsync API test
     * @tc.desc    Function test
     * @tc.level   0
     */
Z
zhangpa2021 已提交
8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082
    it("SUB_Softbus_IPC_Compatility_IPCSkeleton_01300", 0,async function(done){
        console.info("---------------------start SUB_Softbus_IPC_Compatility_IPCSkeleton_01300---------------------------");
        try{
            expect(rpc.IPCSkeleton.getContextObject().getInterfaceDescriptor()).assertEqual("");
            let callingPid = rpc.IPCSkeleton.getCallingPid();
            let callingUid = rpc.IPCSkeleton.getCallingUid();
            let option = new rpc.MessageOption();
            let data = rpc.MessageParcel.create();
            let reply = rpc.MessageParcel.create();
            expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue();
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01300 callingPid: " + callingPid
                + ", callingUid: " + callingUid);
            expect(callingUid != null).assertTrue();
            expect(callingPid != null).assertTrue();
            await gIRemoteObject.sendRequestAsync(CODE_IPCSKELETON, data, reply, option).then((result) => {
                console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01300 sendRequest done, error code: " + result.errCode)
                expect(result.errCode).assertEqual(0);
                result.reply.readException();
                let rescallingPid = result.reply.readInt();
                 let rescallingUid = result.reply.readInt();
                console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01300" + rescallingPid +" ;"+ rescallingUid);
                 expect(rescallingPid).assertEqual(callingPid);
                expect(rescallingUid).assertEqual(callingUid);
            })
            data.reclaim();
            reply.reclaim();
            done();
        } catch (error) {
            console.info("SUB_Softbus_IPC_Compatility_IPCSkeleton_01300:error = " + error);
        }
        console.info("---------------------end SUB_Softbus_IPC_Compatility_IPCSkeleton_01300---------------------------");
    });
Z
zhangpa2021 已提交
8083

Z
zhangpa2021 已提交
8084
    console.info("-----------------------SUB_Softbus_IPC_Compatility_MessageParce_Test is end-----------------------");
J
jiyong 已提交
8085
});
Z
zhangpa2021 已提交
8086
}