RelationalStoreBackupRestoreCallbackJsunit.test.js 19.5 KB
Newer Older
L
liangzhenyu123 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (C) 2022 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
Y
yanglifeng1217 已提交
16 17
import data_Rdb from '@ohos.data.relationalStore'
import ability_featureAbility from '@ohos.ability.featureAbility'
L
liangzhenyu123 已提交
18 19
import fileio from '@ohos.fileio'

Y
yanglifeng1217 已提交
20
const TAG = "[RelationalStore_JSKITS_TEST]"
L
liangzhenyu123 已提交
21
const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS backupTest (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, "
Y
yanglifeng1217 已提交
22
+ "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"
L
liangzhenyu123 已提交
23 24
const DATABASE_DIR = "/data/storage/el2/database/entry/rdb/"
var RdbStore
Y
yanglifeng1217 已提交
25
var context = ability_featureAbility.getContext()
L
liangzhenyu123 已提交
26 27
const STORE_CONFIG = {
    name: "BackupResotreTest.db",
Y
yanglifeng1217 已提交
28
    securityLevel: data_Rdb.SecurityLevel.S1
L
liangzhenyu123 已提交
29 30 31 32
}
const DATABASE_BACKUP_NAME = "Backup.db"

async function CreatRdbStore(context, STORE_CONFIG) {
Y
yanglifeng1217 已提交
33
    let RdbStore = await data_Rdb.getRdbStore(context, STORE_CONFIG)
L
liangzhenyu123 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
    await RdbStore.executeSql(CREATE_TABLE_TEST, null)
    let u8 = new Uint8Array([1, 2, 3])
    {
        const valueBucket = {
            "name": "zhangsan",
            "age": 18,
            "salary": 100.5,
            "blobType": u8,
        }
        await RdbStore.insert("backupTest", valueBucket)
    }
    {
        const valueBucket = {
            "name": "lisi",
            "age": 28,
            "salary": 100.5,
            "blobType": u8,
        }
        await RdbStore.insert("backupTest", valueBucket)
    }
    {
        const valueBucket = {
            "name": "wangwu",
            "age": 38,
            "salary": 90.0,
            "blobType": u8,
        }
        await RdbStore.insert("backupTest", valueBucket)
    }
    return RdbStore
}

function BackupCallbackTest(backupName) {
    try {
        RdbStore.backup(backupName, (err, data) => {
            if(err != null){
                console.info(TAG + "Backup error: " + err)
                expect(true).assertTrue()
            }else{
                expect(false).assertTrue();
            }
        })
    } catch(errInfo){
        console.info(TAG + "BackupCallbackTest error: " + errInfo)
        expect(true).assertTrue()
    }

    RdbStore = null
}

function ReStoreCallbackTest(restoreName) {
    try {
        RdbStore.restore(restoreName, (err, data) => {
            if(err != null){
                console.info(TAG + "Restore error: " + err)
                expect(true).assertTrue()
            }else{
                expect(false).assertTrue();
            }
        })
    } catch(errInfo) {
        console.info(TAG + "ReStoreCallbackTest error: " + errInfo)
        expect(true).assertTrue()
    }

    RdbStore = null
}

Y
yanglifeng1217 已提交
102 103
export default function relationalStoreBackupRestoreCallbackTest() {
    describe('relationalStoreBackupRestoreCallbackTest', function () {
Y
yanglifeng1217 已提交
104 105


L
liangzhenyu123 已提交
106 107 108
        beforeAll(async function () {
            console.info(TAG + 'beforeAll')
        })
Y
yanglifeng1217 已提交
109

L
liangzhenyu123 已提交
110 111 112 113
        beforeEach(async function () {
            console.info(TAG + 'beforeEach')
            RdbStore = await CreatRdbStore(context, STORE_CONFIG)
        })
Y
yanglifeng1217 已提交
114

L
liangzhenyu123 已提交
115 116
        afterEach(async function () {
            console.info(TAG + 'afterEach')
Y
yanglifeng1217 已提交
117 118 119
            await data_Rdb.deleteRdbStore(context, STORE_CONFIG.name)
            await data_Rdb.deleteRdbStore(context, DATABASE_BACKUP_NAME)
            await data_Rdb.deleteRdbStore(context, "BackupTest003.db")
L
liangzhenyu123 已提交
120
        })
Y
yanglifeng1217 已提交
121

L
liangzhenyu123 已提交
122 123 124
        afterAll(async function () {
            console.info(TAG + 'afterAll')
        })
Y
yanglifeng1217 已提交
125

L
liangzhenyu123 已提交
126
        console.info(TAG + "*************Unit Test Begin*************")
Y
yanglifeng1217 已提交
127

L
liangzhenyu123 已提交
128
        /**
Y
yanglifeng1217 已提交
129 130 131
         * @tc.name RelationalStore Backup Restore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_0100
         * @tc.desc RelationalStore backup and restore function test
L
liangzhenyu123 已提交
132 133 134
         */
        it('RdbBackupRestoreCallbackTest_0100', 0, async function (done) {
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0100 start *************")
Y
yanglifeng1217 已提交
135

Y
yanglifeng1217 已提交
136
            // RelationalStore backup function test
L
liangzhenyu123 已提交
137
            await RdbStore.backup(DATABASE_BACKUP_NAME,async (err, data) => {
Y
yanglifeng1217 已提交
138 139
                if (err != null) {
                    console.info(TAG + 'backup err ttt:  ' + err)
L
liangzhenyu123 已提交
140 141 142 143 144 145 146 147 148
                    expect(false).assertTrue()
                }else{
                    try {
                        fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
                        fileio.accessSync(DATABASE_DIR + STORE_CONFIG.name)
                    } catch (err) {
                        expect(false).assertTrue()
                    }
                }
Y
yanglifeng1217 已提交
149

Y
yanglifeng1217 已提交
150 151
                // RelationalStore before restored, delete data
                let deleteData = new data_Rdb.RdbPredicates("backupTest")
L
liangzhenyu123 已提交
152 153 154 155 156 157 158 159 160 161
                deleteData.equalTo("name", "zhangsan")
                RdbStore.delete(deleteData).then(()=> {
                    RdbStore.restore(DATABASE_BACKUP_NAME, async (err, data) => {
                        if(err != null){
                            expect(false).assertTrue()
                        }else{
                            try {
                                fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
                                expect(false).assertTrue()
                            } catch (err) {
Y
yanglifeng1217 已提交
162
                                console.info(TAG + " restore1 done ")
L
liangzhenyu123 已提交
163
                            }
Y
yanglifeng1217 已提交
164

L
liangzhenyu123 已提交
165 166 167 168 169
                            try {
                                fileio.accessSync(DATABASE_DIR + STORE_CONFIG.name)
                            } catch (err) {
                                expect(false).assertTrue()
                            }
Y
yanglifeng1217 已提交
170
                            let predicates = new data_Rdb.RdbPredicates("backupTest")
L
liangzhenyu123 已提交
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
                            predicates.equalTo("name", "zhangsan")
                            let resultSet = await RdbStore.query(predicates)
                            try {
                                console.info(TAG + "After restore resultSet query done")
                                expect(true).assertEqual(resultSet.goToFirstRow())
                                const id = resultSet.getLong(resultSet.getColumnIndex("id"))
                                const name = resultSet.getString(resultSet.getColumnIndex("name"))
                                const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType"))
                                expect(1).assertEqual(id)
                                expect("zhangsan").assertEqual(name)
                                expect(1).assertEqual(blobType[0])
                            } catch (err) {
                                console.info(TAG + 'RdbBackupRestoreTest_0010 accessSync err4:  ' + err)
                                expect(false).assertTrue()
                            }
                            resultSet = null
                            RdbStore = null
                        }
                        done()
                        console.info(TAG + "************* RdbBackupRestoreCallbackTest_0100 end *************")
                    })
Y
yanglifeng1217 已提交
192
                })
L
liangzhenyu123 已提交
193 194
            })
        })
Y
yanglifeng1217 已提交
195

L
liangzhenyu123 已提交
196
        /**
Y
yanglifeng1217 已提交
197 198 199
         * @tc.name RelationalStore Backup test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_0200
         * @tc.desc RelationalStore backup function test
L
liangzhenyu123 已提交
200 201 202
         */
        it('RdbBackupRestoreCallbackTest_0200', 0, function (done) {
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0200 start *************")
Y
yanglifeng1217 已提交
203
            // RelationalStore backup function test, backup file name empty
L
liangzhenyu123 已提交
204
            BackupCallbackTest("")
Y
yanglifeng1217 已提交
205

Y
yanglifeng1217 已提交
206
            // RelationalStore backup function test, backup file name already exists
L
liangzhenyu123 已提交
207
            BackupCallbackTest(STORE_CONFIG.name)
Y
yanglifeng1217 已提交
208

L
liangzhenyu123 已提交
209 210 211
            done()
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0200 end *************")
        })
Y
yanglifeng1217 已提交
212

L
liangzhenyu123 已提交
213
        /**
Y
yanglifeng1217 已提交
214 215 216
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreTest_0300
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
217 218 219 220 221
         */
        it('RdbBackupRestoreCallbackTest_0300', 0, async function (done) {
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0300 start *************")
            let backupName = "BackupTest003.db"
            await RdbStore.backup(backupName)
Y
yanglifeng1217 已提交
222

Y
yanglifeng1217 已提交
223
            // RelationalStore restore function test, backup file name empty
L
liangzhenyu123 已提交
224
            ReStoreCallbackTest("")
Y
yanglifeng1217 已提交
225

Y
yanglifeng1217 已提交
226
            // RelationalStore restore function test, backup file is specified to database name
L
liangzhenyu123 已提交
227
            ReStoreCallbackTest(STORE_CONFIG.name)
Y
yanglifeng1217 已提交
228

L
liangzhenyu123 已提交
229 230 231
            done()
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0300 end *************")
        })
Y
yanglifeng1217 已提交
232

L
liangzhenyu123 已提交
233
        /**
Y
yanglifeng1217 已提交
234 235 236
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_0400
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
237 238 239 240
         */
        it('RdbBackupRestoreCallbackTest_0400', 0, async function (done) {
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0400 start *************")
            let dbName = "notExistName.db"
Y
yanglifeng1217 已提交
241

Y
yanglifeng1217 已提交
242
            // RelationalStore restore function test, backup file does not exists
L
liangzhenyu123 已提交
243 244 245 246 247 248
            try {
                fileio.accessSync(DATABASE_DIR + dbName)
                expect(false).assertTrue()
            } catch {
                ReStoreCallbackTest(dbName)
            }
Y
yanglifeng1217 已提交
249

L
liangzhenyu123 已提交
250 251 252
            done()
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0400 end *************")
        })
Y
yanglifeng1217 已提交
253

L
liangzhenyu123 已提交
254
        /**
Y
yanglifeng1217 已提交
255 256 257
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_0500
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
258
         */
Y
yanglifeng1217 已提交
259
        it('RdbBackupRestoreCallbackTest_0500', 0, async function (done) {
L
liangzhenyu123 已提交
260
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0500 start *************")
Y
yanglifeng1217 已提交
261 262

            // RDB restore function test, backup file
L
liangzhenyu123 已提交
263 264
            RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
                if(err != null){
L
liangzhenyu123 已提交
265
                    expect(false).assertTrue()
L
liangzhenyu123 已提交
266 267 268 269 270 271 272
                }else{
                    try{
                        console.info(TAG + 'Backup database success')
                        fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
                    }catch(err){
                        expect(false).assertTrue();
                    }
Y
yanglifeng1217 已提交
273
                    data_Rdb .deleteRdbStore(context, DATABASE_BACKUP_NAME).then(() => {
L
liangzhenyu123 已提交
274 275 276
                        try{
                            fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
                        }catch(err){
Y
yanglifeng1217 已提交
277
                            console.info(TAG + 'RdbBackupRestoreCallbackTest_0500 deleteRdbStore done')
L
liangzhenyu123 已提交
278 279 280
                        }
                        RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
                            if(err != null){
L
liangzhenyu123 已提交
281
                                console.info(`${TAG} Backup database second failed, error: message: ${err.message}`)
L
liangzhenyu123 已提交
282 283
                            }else{
                                try{
L
liangzhenyu123 已提交
284
                                    console.info(TAG + 'Backup database second success')
L
liangzhenyu123 已提交
285 286 287 288
                                    fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
                                }catch(err){
                                    expect(false).assertTrue();
                                }
Y
yanglifeng1217 已提交
289 290
                                done();
                                console.info(TAG + "************* RdbBackupRestoreCallbackTest_0500 end *************")
L
liangzhenyu123 已提交
291 292 293
                            }
                        })
                    })
L
liangzhenyu123 已提交
294 295 296
                }
            })
        })
Y
yanglifeng1217 已提交
297

L
liangzhenyu123 已提交
298
        /**
Y
yanglifeng1217 已提交
299 300 301
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_0600
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
302
         */
Y
yanglifeng1217 已提交
303
         it('RdbBackupRestoreCallbackTest_0600', 0, async function (done) {
L
liangzhenyu123 已提交
304
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0600 start *************")
Y
yanglifeng1217 已提交
305

L
liangzhenyu123 已提交
306 307
            // Backup file is specified to database name
            RdbStore.backup(STORE_CONFIG.name, (err, data) => {
Y
yanglifeng1217 已提交
308 309
                expect(err != null).assertTrue()
                console.info(TAG + "RdbBackupRestoreCallbackTest_0600 backup1 done")
L
liangzhenyu123 已提交
310

Y
yanglifeng1217 已提交
311 312 313 314 315 316
                RdbStore.backup(STORE_CONFIG.name, (err, data) => {
                    expect(err != null).assertTrue()
                    console.info(TAG + "RdbBackupRestoreCallbackTest_0600 backup2 done")
                    done();
                    console.info(TAG + "************* RdbBackupRestoreCallbackTest_0600 end *************")
                })
L
liangzhenyu123 已提交
317 318
            })
        })
Y
yanglifeng1217 已提交
319

L
liangzhenyu123 已提交
320
        /**
Y
yanglifeng1217 已提交
321 322 323
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_0700
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
324
         */
Y
yanglifeng1217 已提交
325
        it('RdbBackupRestoreCallbackTest_0700', 0, async function (done) {
L
liangzhenyu123 已提交
326
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 start *************")
L
liangzhenyu123 已提交
327
            let DATABASE_BACKUP_TEST_NAME = "BackupTest.db"
Y
yanglifeng1217 已提交
328 329
            RdbStore.backup(DATABASE_BACKUP_TEST_NAME, async (err, data) => {
                if (err != null) {
L
liangzhenyu123 已提交
330
                    expect(false).assertTrue()
Y
yanglifeng1217 已提交
331 332
                } else {
                    console.info(TAG + "RdbBackupRestoreCallbackTest_0700 backup done")
L
liangzhenyu123 已提交
333
                }
Y
yanglifeng1217 已提交
334 335 336 337 338 339 340 341 342 343 344 345
                data_Rdb.deleteRdbStore(context, DATABASE_BACKUP_TEST_NAME, () => {
                    try {
                        fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_TEST_NAME)
                    } catch (err) {
                        console.info(TAG + "RdbBackupRestoreCallbackTest_0700 deleteRdbStore done")
                    }
                    RdbStore.restore(DATABASE_BACKUP_TEST_NAME, (err, data) => {
                        expect(err != null).assertTrue()
                        console.info(TAG + "RdbBackupRestoreCallbackTest_0700 restore err " + err.code)
                        done();
                    })
                })
L
liangzhenyu123 已提交
346 347 348
            })
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 end *************")
        })
Y
yanglifeng1217 已提交
349

L
liangzhenyu123 已提交
350
        /**
Y
yanglifeng1217 已提交
351 352 353
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_0800
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
354 355
         */
        it('RdbBackupRestoreCallbackTest_0800', 0, async function (done) {
Y
yanglifeng1217 已提交
356 357 358 359
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0800 start *************")
            BackupCallbackTest()
            done();
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0800 end *************")
L
liangzhenyu123 已提交
360
        })
Y
yanglifeng1217 已提交
361

L
liangzhenyu123 已提交
362
        /**
Y
yanglifeng1217 已提交
363 364 365
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_0900
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
366
         */
Y
yanglifeng1217 已提交
367
        it('RdbBackupRestoreCallbackTest_0900', 0, async function (done) {
L
liangzhenyu123 已提交
368 369 370 371 372
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0900 start *************")
            BackupCallbackTest([DATABASE_BACKUP_NAME])
            done();
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_0900 end *************")
        })
Y
yanglifeng1217 已提交
373

L
liangzhenyu123 已提交
374
        /**
Y
yanglifeng1217 已提交
375 376 377
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_1000
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
378
         */
Y
yanglifeng1217 已提交
379
        it('RdbBackupRestoreCallbackTest_1000', 0, async function (done) {
L
liangzhenyu123 已提交
380 381 382 383 384
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_1000 start *************")
            RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
                if(err != null){
                    expect(false).assertTrue()
                }
Y
yanglifeng1217 已提交
385 386
                ReStoreCallbackTest([DATABASE_BACKUP_NAME])
                done();
L
liangzhenyu123 已提交
387 388 389 390
            })
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_1000 end *************")
        })
        /**
Y
yanglifeng1217 已提交
391 392 393
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_1100
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
394
         */
Y
yanglifeng1217 已提交
395
        it('RdbBackupRestoreCallbackTest_1100', 0, async function (done) {
L
liangzhenyu123 已提交
396 397 398 399 400
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_1100 start *************")
            RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
                if(err != null){
                    expect(false).assertTrue()
                }
Y
yanglifeng1217 已提交
401 402
                ReStoreCallbackTest()
                done();
L
liangzhenyu123 已提交
403 404 405 406 407
            })
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_1100 end *************")
        })

        /**
Y
yanglifeng1217 已提交
408 409 410
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_1200
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
411
         */
Y
yanglifeng1217 已提交
412
        it('RdbBackupRestoreCallbackTest_1200', 0, async function (done) {
L
liangzhenyu123 已提交
413 414 415 416 417
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_1200 start *************")
            RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
                if(err != null){
                    expect(false).assertTrue()
                }
Y
yanglifeng1217 已提交
418 419
                BackupCallbackTest(DATABASE_BACKUP_NAME)
                done();
L
liangzhenyu123 已提交
420 421 422 423 424
            })
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_1200 end *************")
        })

        /**
Y
yanglifeng1217 已提交
425 426 427
         * @tc.name RelationalStore BackupRestore test
         * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_1300
         * @tc.desc RelationalStore restore function test
L
liangzhenyu123 已提交
428
         */
Y
yanglifeng1217 已提交
429
        it('RdbBackupRestoreCallbackTest_1300', 0, async function (done) {
L
liangzhenyu123 已提交
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_1300 start *************")
            RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
                if(err != null){
                    expect(false).assertTrue()
                }else{
                    RdbStore.restore(DATABASE_BACKUP_NAME, (err, data) => {
                        if(err != null){
                            expect(false).assertTrue()
                        }else{
                            ReStoreCallbackTest(DATABASE_BACKUP_NAME)
                        }
                    })
                }
            })
            done();
            console.info(TAG + "************* RdbBackupRestoreCallbackTest_1300 end *************")
        })
        console.info(TAG + "*************Unit Test End*************")
    })
}