未验证 提交 3fb8cd9d 编写于 作者: O openharmony_ci 提交者: Gitee

!7731 【Distributeddatamgr】【monthly_20221018】monthly_20221018用例修改,优化执行时序

Merge pull request !7731 from yanglifeng/monthly_20221018
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import rdbStoreBackupRestoreCallbackTest from './RdbstoreBackupRestoreCallbackJsunit.test.js'
import rdbStoreBackupRestoreWithFAContextTest from './RdbstoreBackupRestoreWithFAContextJsunit.test.js'
import rdbStoreDeleteTest from './RdbstoreDeleteJsunit.test.js' import rdbStoreDeleteTest from './RdbstoreDeleteJsunit.test.js'
import rdbStoreDistributedTest from './RdbStoreDistributedJsunit.test.js' import rdbStoreDistributedTest from './RdbStoreDistributedJsunit.test.js'
import rdbstoreInsertTest from './RdbstoreInsertJsunit.test.js' import rdbstoreInsertTest from './RdbstoreInsertJsunit.test.js'
...@@ -27,9 +26,9 @@ import rdbStoreUpdateTest from './RdbstoreUpdateJsunit.test.js' ...@@ -27,9 +26,9 @@ import rdbStoreUpdateTest from './RdbstoreUpdateJsunit.test.js'
import rdbstoreQueryTest from './RdbstoreQuery.test.js' import rdbstoreQueryTest from './RdbstoreQuery.test.js'
import rdbStoreEncryptionTest from './RdbstoreEncryptionJsunit.test.js' import rdbStoreEncryptionTest from './RdbstoreEncryptionJsunit.test.js'
import rdbStorePredicatesComplexFiledTest from './RdbstorePredicatesComplexFiledJsunit.test.js' import rdbStorePredicatesComplexFiledTest from './RdbstorePredicatesComplexFiledJsunit.test.js'
import rdbStoreBackupRestoreWithFAContextTest from './RdbstoreBackupRestoreWithFAContextJsunit.test.js'
import rdbStoreBackupRestoreCallbackTest from './RdbstoreBackupRestoreCallbackJsunit.test.js'
export default function testsuite() { export default function testsuite() {
rdbStoreBackupRestoreCallbackTest()
rdbStoreBackupRestoreWithFAContextTest()
rdbStoreDeleteTest() rdbStoreDeleteTest()
rdbStoreDistributedTest() rdbStoreDistributedTest()
rdbstoreInsertTest() rdbstoreInsertTest()
...@@ -43,4 +42,6 @@ export default function testsuite() { ...@@ -43,4 +42,6 @@ export default function testsuite() {
rdbstoreQueryTest() rdbstoreQueryTest()
rdbStoreEncryptionTest() rdbStoreEncryptionTest()
rdbStorePredicatesComplexFiledTest() rdbStorePredicatesComplexFiledTest()
rdbStoreBackupRestoreWithFAContextTest()
rdbStoreBackupRestoreCallbackTest()
} }
...@@ -146,7 +146,6 @@ export default function rdbStoreBackupRestoreCallbackTest() { ...@@ -146,7 +146,6 @@ export default function rdbStoreBackupRestoreCallbackTest() {
} }
} }
// RDB before restored, delete data // RDB before restored, delete data
let deleteData = new dataRdb.RdbPredicates("backupTest") let deleteData = new dataRdb.RdbPredicates("backupTest")
deleteData.equalTo("name", "zhangsan") deleteData.equalTo("name", "zhangsan")
...@@ -159,7 +158,7 @@ export default function rdbStoreBackupRestoreCallbackTest() { ...@@ -159,7 +158,7 @@ export default function rdbStoreBackupRestoreCallbackTest() {
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
expect(false).assertTrue() expect(false).assertTrue()
} catch (err) { } catch (err) {
expect(true).assertTrue() console.info(TAG + "rdb restore1 done")
} }
try { try {
...@@ -275,14 +274,10 @@ export default function rdbStoreBackupRestoreCallbackTest() { ...@@ -275,14 +274,10 @@ export default function rdbStoreBackupRestoreCallbackTest() {
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
}catch(err){ }catch(err){
console.info(TAG + 'error2 ' + err) console.info(TAG + 'error2 ' + err)
expect(true).assertTrue();
} }
RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => { RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
if(err != null){ if(err != null){
console.info(`${TAG} Backup database second failed, error: message: ${err.message}`) console.info(`${TAG} Backup database second failed`)
expect(true).assertTrue()
done();
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0500 end *************")
}else{ }else{
try{ try{
console.info(TAG + 'Backup database second success') console.info(TAG + 'Backup database second success')
...@@ -291,12 +286,12 @@ export default function rdbStoreBackupRestoreCallbackTest() { ...@@ -291,12 +286,12 @@ export default function rdbStoreBackupRestoreCallbackTest() {
expect(false).assertTrue(); expect(false).assertTrue();
} }
} }
done();
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0500 end *************")
}) })
}) })
} }
}) })
}) })
/** /**
...@@ -309,23 +304,17 @@ export default function rdbStoreBackupRestoreCallbackTest() { ...@@ -309,23 +304,17 @@ export default function rdbStoreBackupRestoreCallbackTest() {
// Backup file is specified to database name // Backup file is specified to database name
RdbStore.backup(STORE_CONFIG.name, (err, data) => { RdbStore.backup(STORE_CONFIG.name, (err, data) => {
if(err != null){ expect(err != null).assertTrue()
expect(true).assertTrue() console.info(TAG + "RdbBackupRestoreCallbackTest_0600 backup1 done")
}else{
expect(false).assertTrue()
}
})
RdbStore.backup(STORE_CONFIG.name, (err, data) => { RdbStore.backup(STORE_CONFIG.name, (err, data) => {
if(err != null){ expect(err != null).assertTrue()
expect(true).assertTrue() console.info(TAG + "RdbBackupRestoreCallbackTest_0600 backup2 done")
}else{
expect(false).assertTrue()
}
})
done(); done();
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0600 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_0600 end *************")
}) })
})
})
/** /**
* @tc.name RDB BackupRestore test * @tc.name RDB BackupRestore test
...@@ -335,27 +324,23 @@ export default function rdbStoreBackupRestoreCallbackTest() { ...@@ -335,27 +324,23 @@ export default function rdbStoreBackupRestoreCallbackTest() {
it('RdbBackupRestoreCallbackTest_0700', 0, async function (done) { it('RdbBackupRestoreCallbackTest_0700', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 start *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 start *************")
let DATABASE_BACKUP_TEST_NAME = "BackupTest.db" let DATABASE_BACKUP_TEST_NAME = "BackupTest.db"
RdbStore.backup(DATABASE_BACKUP_TEST_NAME, (err, data) => { RdbStore.backup(DATABASE_BACKUP_TEST_NAME, async (err, data) => {
if(err != null){ expect(err == null).assertTrue()
expect(false).assertTrue() console.info(TAG + "RdbBackupRestoreCallbackTest_0700 backup done")
}else{
expect(true).assertTrue() dataRdb.deleteRdbStore(context, DATABASE_BACKUP_TEST_NAME, () => {
} try {
})
await dataRdb.deleteRdbStore(context, DATABASE_BACKUP_TEST_NAME).then(() => {
try{
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_TEST_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_TEST_NAME)
}catch(err){ } catch (err) {
expect(true).assertTrue(); console.info(TAG + "RdbBackupRestoreCallbackTest_0700 deleteRdbStore done")
} }
})
RdbStore.restore(DATABASE_BACKUP_TEST_NAME, (err, data) => { RdbStore.restore(DATABASE_BACKUP_TEST_NAME, (err, data) => {
if(err != null){ expect(err != null).assertTrue()
expect(true).assertTrue() console.info(TAG + "RdbBackupRestoreCallbackTest_0700 restore done")
}
})
done(); done();
})
})
})
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 end *************")
}) })
...@@ -394,9 +379,11 @@ export default function rdbStoreBackupRestoreCallbackTest() { ...@@ -394,9 +379,11 @@ export default function rdbStoreBackupRestoreCallbackTest() {
if(err != null){ if(err != null){
expect(false).assertTrue() expect(false).assertTrue()
} }
})
ReStoreCallbackTest([DATABASE_BACKUP_NAME]) ReStoreCallbackTest([DATABASE_BACKUP_NAME])
done(); done();
})
console.info(TAG + "************* RdbBackupRestoreCallbackTest_1000 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_1000 end *************")
}) })
...@@ -411,9 +398,11 @@ export default function rdbStoreBackupRestoreCallbackTest() { ...@@ -411,9 +398,11 @@ export default function rdbStoreBackupRestoreCallbackTest() {
if(err != null){ if(err != null){
expect(false).assertTrue() expect(false).assertTrue()
} }
})
ReStoreCallbackTest() ReStoreCallbackTest()
done(); done();
})
console.info(TAG + "************* RdbBackupRestoreCallbackTest_1100 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_1100 end *************")
}) })
...@@ -428,9 +417,10 @@ export default function rdbStoreBackupRestoreCallbackTest() { ...@@ -428,9 +417,10 @@ export default function rdbStoreBackupRestoreCallbackTest() {
if(err != null){ if(err != null){
expect(false).assertTrue() expect(false).assertTrue()
} }
})
BackupCallbackTest(DATABASE_BACKUP_NAME) BackupCallbackTest(DATABASE_BACKUP_NAME)
done(); done();
})
console.info(TAG + "************* RdbBackupRestoreCallbackTest_1200 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_1200 end *************")
}) })
...@@ -453,10 +443,11 @@ export default function rdbStoreBackupRestoreCallbackTest() { ...@@ -453,10 +443,11 @@ export default function rdbStoreBackupRestoreCallbackTest() {
} }
}) })
} }
})
done(); done();
console.info(TAG + "************* RdbBackupRestoreCallbackTest_1300 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_1300 end *************")
}) })
})
console.info(TAG + "*************Unit Test End*************") console.info(TAG + "*************Unit Test End*************")
}) })
} }
\ No newline at end of file
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import dataRdb from '@ohos.data.rdb' import dataRdb from '@ohos.data.rdb'
import abilityFeatureAbility from '@ohos.ability.featureAbility' import abilityFeatureAbility from '@ohos.ability.featureAbility'
import fileio from '@ohos.fileio' import fileio from '@ohos.fileio'
const TAG = "[RDB_JSKITS_TEST]" const TAG = "[RDB_JSKITS_TEST]"
const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)" + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"
const DATABASE_DIR = "/data/storage/el2/database/entry/rdb/" const DATABASE_DIR = "/data/storage/el2/database/entry/rdb/"
var RdbStore var RdbStore
var context var context
...@@ -72,7 +72,7 @@ async function BackupTest(backupName) { ...@@ -72,7 +72,7 @@ async function BackupTest(backupName) {
expect(true).assertTrue() expect(true).assertTrue()
}) })
await promiseRestore await promiseRestore
} catch(errInfo){ } catch (errInfo) {
console.info(TAG + "BackupTest error: " + errInfo) console.info(TAG + "BackupTest error: " + errInfo)
expect(true).assertTrue() expect(true).assertTrue()
} }
...@@ -90,7 +90,7 @@ async function ReStoreTest(restoreName) { ...@@ -90,7 +90,7 @@ async function ReStoreTest(restoreName) {
expect(true).assertTrue() expect(true).assertTrue()
}) })
await promiseRestore await promiseRestore
} catch(errInfo) { } catch (errInfo) {
console.info(TAG + "ReStoreTest error: " + errInfo) console.info(TAG + "ReStoreTest error: " + errInfo)
expect(true).assertTrue() expect(true).assertTrue()
} }
...@@ -99,7 +99,7 @@ async function ReStoreTest(restoreName) { ...@@ -99,7 +99,7 @@ async function ReStoreTest(restoreName) {
} }
export default function rdbStoreBackupRestorePromiseTest() { export default function rdbStoreBackupRestorePromiseTest() {
describe('rdbStoreBackupRestorePromiseTest', function () { describe('rdbStoreBackupRestorePromiseTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
}) })
...@@ -132,7 +132,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -132,7 +132,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
console.info(TAG + "************* RdbBackupRestoreTest_0010 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0010 start *************")
// RDB backup function test // RDB backup function test
RdbStore.backup(DATABASE_BACKUP_NAME).then(async() => { await RdbStore.backup(DATABASE_BACKUP_NAME)
try { try {
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
fileio.accessSync(DATABASE_DIR + STORE_CONFIG.name) fileio.accessSync(DATABASE_DIR + STORE_CONFIG.name)
...@@ -146,13 +146,12 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -146,13 +146,12 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
await RdbStore.delete(deleteData) await RdbStore.delete(deleteData)
// RDB restore function test // RDB restore function test
RdbStore.restore(DATABASE_BACKUP_NAME).then(async () => { await RdbStore.restore(DATABASE_BACKUP_NAME)
try { try {
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
expect(false).assertTrue() expect(false).assertTrue()
} catch (err) { } catch (err) {
console.info("RdbBackupRestoreTest_0010 restore success") console.info("RdbBackupRestoreTest_0010 restore success")
expect(true).assertTrue()
} }
try { try {
...@@ -164,7 +163,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -164,7 +163,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
// RDB after restored, data query test // RDB after restored, data query test
let predicates = new dataRdb.RdbPredicates("test") let predicates = new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "zhangsan") predicates.equalTo("name", "zhangsan")
RdbStore.query(predicates).then((resultSet)=>{ let resultSet = await RdbStore.query(predicates)
try { try {
console.info(TAG + "After restore resultSet query done") console.info(TAG + "After restore resultSet query done")
resultSet.goToFirstRow(); resultSet.goToFirstRow();
...@@ -183,24 +182,13 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -183,24 +182,13 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
console.info(TAG + 'RdbBackupRestoreTest_0010 accessSync err4: ' + err) console.info(TAG + 'RdbBackupRestoreTest_0010 accessSync err4: ' + err)
expect(false).assertTrue() expect(false).assertTrue()
} }
resultSet = null resultSet.close()
RdbStore = null RdbStore = null
done() done()
console.info(TAG + "************* RdbBackupRestoreTest_0010 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0010 end *************")
}) })
}).catch((err) => {
console.info("RdbBackupRestoreTest_0010 restore error: " + err)
expect(false).assertTrue()
})
}).catch((err) => {
expect(false).assertTrue()
})
})
/** /**
* @tc.name RDB Backup test * @tc.name RDB Backup test
* @tc.number SUB_DDM_RDB_JS_RdbBackupRestoreTest_0020 * @tc.number SUB_DDM_RDB_JS_RdbBackupRestoreTest_0020
...@@ -269,33 +257,32 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -269,33 +257,32 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
// RDB restore function test, backup file // RDB restore function test, backup file
await RdbStore.backup(DATABASE_BACKUP_NAME).then(() => { await RdbStore.backup(DATABASE_BACKUP_NAME).then(() => {
try{ try {
console.info(TAG + 'Backup database success') console.info(TAG + 'Backup database success')
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
}catch(err){ } catch (err) {
expect(false).assertTrue(); expect(false).assertTrue();
} }
}).then(() => { }).then(() => {
dataRdb.deleteRdbStore(context, DATABASE_BACKUP_NAME).then(() => { dataRdb.deleteRdbStore(context, DATABASE_BACKUP_NAME).then(() => {
try{ try {
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
}catch(err){ } catch (err) {
console.info(TAG + 'error2 ' + err) console.info(TAG + 'RdbBackupRestoreTest_0050 deleteRdbStore done ')
expect(true).assertTrue();
} }
}) })
}).then(() => { }).then(() => {
RdbStore.backup(DATABASE_BACKUP_NAME).then(() => { RdbStore.backup(DATABASE_BACKUP_NAME).then(() => {
try{ try {
console.info(TAG + 'Backup database success') console.info(TAG + 'Backup database success')
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
}catch(err){ } catch (err) {
console.info(TAG + 'error3 ' + err) console.info(TAG + 'error3 ' + err)
expect(false).assertTrue() expect(false).assertTrue()
} }
done()
}) })
}) })
done()
console.info(TAG + "************* RdbBackupRestoreTest_0050 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0050 end *************")
}) })
...@@ -308,11 +295,11 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -308,11 +295,11 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
console.info(TAG + "************* RdbBackupRestoreTest_0060 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0060 start *************")
// Backup file is specified to database name // Backup file is specified to database name
RdbStore.backup(STORE_CONFIG.name).then(() => { RdbStore.backup(STORE_CONFIG.name).then(() => {
console.info(TAG + 'Backup database finish'); console.info(TAG + 'RdbBackupRestoreTest_0060 Backup database err');
expect(false).assertTrue() ; expect(false).assertTrue();
}).catch((err) => { }).catch((err) => {
console.info(TAG + "Backup database error"); console.info(TAG + "RdbBackupRestoreTest_0060 Backup database done");
expect(true).assertTrue() ; expect(err != null).assertTrue();
done(); done();
}) })
}) })
...@@ -325,14 +312,14 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -325,14 +312,14 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
console.info(TAG + "************* RdbBackupRestoreTest_0070 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0070 start *************")
await RdbStore.backup(DATABASE_BACKUP_NAME) await RdbStore.backup(DATABASE_BACKUP_NAME)
await dataRdb.deleteRdbStore(context, DATABASE_BACKUP_NAME) await dataRdb.deleteRdbStore(context, DATABASE_BACKUP_NAME)
try{ try {
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
}catch(err){ } catch (err) {
expect(true).assertTrue(); console.info(TAG + "RdbBackupRestoreTest_0070 deleteRdbStore done");
} }
await RdbStore.restore(DATABASE_BACKUP_NAME).catch((err) => { await RdbStore.restore(DATABASE_BACKUP_NAME).catch((err) => {
console.info(TAG + 'Restore fail: ' + err) console.info(TAG + 'Restore ')
expect(true).assertTrue(); expect(err != null).assertTrue();
}) })
done(); done();
console.info(TAG + "************* RdbBackupRestoreTest_0070 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0070 end *************")
...@@ -370,7 +357,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -370,7 +357,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
it('RdbBackupRestoreTest_0100', 0, async function (done) { it('RdbBackupRestoreTest_0100', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreTest_0100 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0100 start *************")
await RdbStore.backup(DATABASE_BACKUP_NAME) await RdbStore.backup(DATABASE_BACKUP_NAME)
ReStoreTest([DATABASE_BACKUP_NAME]) await ReStoreTest([DATABASE_BACKUP_NAME])
done(); done();
console.info(TAG + "************* RdbBackupRestoreTest_0100 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0100 end *************")
}) })
...@@ -383,7 +370,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -383,7 +370,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
it('RdbBackupRestoreTest_0110', 0, async function (done) { it('RdbBackupRestoreTest_0110', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreTest_0110 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0110 start *************")
await RdbStore.backup(DATABASE_BACKUP_NAME) await RdbStore.backup(DATABASE_BACKUP_NAME)
ReStoreTest() await ReStoreTest()
done(); done();
console.info(TAG + "************* RdbBackupRestoreTest_0110 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0110 end *************")
}) })
...@@ -396,7 +383,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -396,7 +383,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
it('RdbBackupRestoreTest_0120', 0, async function (done) { it('RdbBackupRestoreTest_0120', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreTest_0120 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0120 start *************")
await RdbStore.backup(DATABASE_BACKUP_NAME) await RdbStore.backup(DATABASE_BACKUP_NAME)
BackupTest(DATABASE_BACKUP_NAME) await BackupTest(DATABASE_BACKUP_NAME)
done(); done();
console.info(TAG + "************* RdbBackupRestoreTest_0120 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0120 end *************")
}) })
...@@ -410,7 +397,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () { ...@@ -410,7 +397,7 @@ describe('rdbStoreBackupRestorePromiseTest', function () {
console.info(TAG + "************* RdbBackupRestoreTest_0130 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0130 start *************")
await RdbStore.backup(DATABASE_BACKUP_NAME) await RdbStore.backup(DATABASE_BACKUP_NAME)
await RdbStore.restore(DATABASE_BACKUP_NAME) await RdbStore.restore(DATABASE_BACKUP_NAME)
ReStoreTest(DATABASE_BACKUP_NAME) await ReStoreTest(DATABASE_BACKUP_NAME)
done(); done();
console.info(TAG + "************* RdbBackupRestoreTest_0130 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0130 end *************")
}) })
......
/* /*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import relationalStoreBackupRestoreCallbackTest from './RelationalStoreBackupRestoreCallbackJsunit.test.js'
import relationalStoreBackupRestoreWithFAContextTest from './RelationalStoreBackupRestoreWithFAContextJsunit.test.js'
import relationalStoreDeleteTest from './RelationalStoreDeleteJsunit.test.js' import relationalStoreDeleteTest from './RelationalStoreDeleteJsunit.test.js'
import relationalStoreDistributedTest from './RelationalStoreDistributedJsunit.test.js' import relationalStoreDistributedTest from './RelationalStoreDistributedJsunit.test.js'
import relationalStoreInsertTest from './RelationalStoreInsertJsunit.test.js' import relationalStoreInsertTest from './RelationalStoreInsertJsunit.test.js'
...@@ -27,9 +26,9 @@ import relationalStoreUpdateTest from './RelationalStoreUpdateJsunit.test.js' ...@@ -27,9 +26,9 @@ import relationalStoreUpdateTest from './RelationalStoreUpdateJsunit.test.js'
import relationalStoreQueryTest from './RelationalStoreQuery.test.js' import relationalStoreQueryTest from './RelationalStoreQuery.test.js'
import relationalStoreEncryptionTest from './RelationalStoreEncryptionJsunit.test.js' import relationalStoreEncryptionTest from './RelationalStoreEncryptionJsunit.test.js'
import relationalStorePredicatesComplexFiledTest from './RelationalStorePredicatesComplexFiledJsunit.test.js' import relationalStorePredicatesComplexFiledTest from './RelationalStorePredicatesComplexFiledJsunit.test.js'
import relationalStoreBackupRestoreWithFAContextTest from './RelationalStoreBackupRestoreWithFAContextJsunit.test.js'
import relationalStoreBackupRestoreCallbackTest from './RelationalStoreBackupRestoreCallbackJsunit.test.js'
export default function testsuite() { export default function testsuite() {
relationalStoreBackupRestoreCallbackTest()
relationalStoreBackupRestoreWithFAContextTest()
relationalStoreDeleteTest() relationalStoreDeleteTest()
relationalStoreDistributedTest() relationalStoreDistributedTest()
relationalStoreInsertTest() relationalStoreInsertTest()
...@@ -43,4 +42,6 @@ export default function testsuite() { ...@@ -43,4 +42,6 @@ export default function testsuite() {
relationalStoreQueryTest() relationalStoreQueryTest()
relationalStoreEncryptionTest() relationalStoreEncryptionTest()
relationalStorePredicatesComplexFiledTest() relationalStorePredicatesComplexFiledTest()
relationalStoreBackupRestoreWithFAContextTest()
relationalStoreBackupRestoreCallbackTest()
} }
...@@ -19,7 +19,7 @@ import fileio from '@ohos.fileio' ...@@ -19,7 +19,7 @@ import fileio from '@ohos.fileio'
const TAG = "[RelationalStore_JSKITS_TEST]" const TAG = "[RelationalStore_JSKITS_TEST]"
const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS backupTest (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS backupTest (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)" + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"
const DATABASE_DIR = "/data/storage/el2/database/entry/rdb/" const DATABASE_DIR = "/data/storage/el2/database/entry/rdb/"
var RdbStore var RdbStore
var context = ability_featureAbility.getContext() var context = ability_featureAbility.getContext()
...@@ -135,7 +135,8 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -135,7 +135,8 @@ export default function relationalStoreBackupRestoreCallbackTest() {
// RelationalStore backup function test // RelationalStore backup function test
await RdbStore.backup(DATABASE_BACKUP_NAME,async (err, data) => { await RdbStore.backup(DATABASE_BACKUP_NAME,async (err, data) => {
if(err != null){ if (err != null) {
console.info(TAG + 'backup err ttt: ' + err)
expect(false).assertTrue() expect(false).assertTrue()
}else{ }else{
try { try {
...@@ -146,7 +147,6 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -146,7 +147,6 @@ export default function relationalStoreBackupRestoreCallbackTest() {
} }
} }
// RelationalStore before restored, delete data // RelationalStore before restored, delete data
let deleteData = new data_Rdb.RdbPredicates("backupTest") let deleteData = new data_Rdb.RdbPredicates("backupTest")
deleteData.equalTo("name", "zhangsan") deleteData.equalTo("name", "zhangsan")
...@@ -159,7 +159,7 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -159,7 +159,7 @@ export default function relationalStoreBackupRestoreCallbackTest() {
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
expect(false).assertTrue() expect(false).assertTrue()
} catch (err) { } catch (err) {
expect(true).assertTrue() console.info(TAG + " restore1 done ")
} }
try { try {
...@@ -259,7 +259,7 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -259,7 +259,7 @@ export default function relationalStoreBackupRestoreCallbackTest() {
it('RdbBackupRestoreCallbackTest_0500', 0, async function (done) { it('RdbBackupRestoreCallbackTest_0500', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0500 start *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_0500 start *************")
// RelationalStore restore function test, backup file // RDB restore function test, backup file
RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => { RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
if(err != null){ if(err != null){
expect(false).assertTrue() expect(false).assertTrue()
...@@ -270,19 +270,15 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -270,19 +270,15 @@ export default function relationalStoreBackupRestoreCallbackTest() {
}catch(err){ }catch(err){
expect(false).assertTrue(); expect(false).assertTrue();
} }
data_Rdb.deleteRdbStore(context, DATABASE_BACKUP_NAME).then(() => { data_Rdb .deleteRdbStore(context, DATABASE_BACKUP_NAME).then(() => {
try{ try{
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
}catch(err){ }catch(err){
console.info(TAG + 'error2 ' + err) console.info(TAG + 'RdbBackupRestoreCallbackTest_0500 deleteRdbStore done')
expect(true).assertTrue();
} }
RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => { RdbStore.backup(DATABASE_BACKUP_NAME, (err, data) => {
if(err != null){ if(err != null){
console.info(`${TAG} Backup database second failed, error: message: ${err.message}`) console.info(`${TAG} Backup database second failed, error: message: ${err.message}`)
expect(true).assertTrue()
done();
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0500 end *************")
}else{ }else{
try{ try{
console.info(TAG + 'Backup database second success') console.info(TAG + 'Backup database second success')
...@@ -290,13 +286,13 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -290,13 +286,13 @@ export default function relationalStoreBackupRestoreCallbackTest() {
}catch(err){ }catch(err){
expect(false).assertTrue(); expect(false).assertTrue();
} }
done();
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0500 end *************")
} }
}) })
}) })
} }
}) })
}) })
/** /**
...@@ -309,23 +305,17 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -309,23 +305,17 @@ export default function relationalStoreBackupRestoreCallbackTest() {
// Backup file is specified to database name // Backup file is specified to database name
RdbStore.backup(STORE_CONFIG.name, (err, data) => { RdbStore.backup(STORE_CONFIG.name, (err, data) => {
if(err != null){ expect(err != null).assertTrue()
expect(true).assertTrue() console.info(TAG + "RdbBackupRestoreCallbackTest_0600 backup1 done")
}else{
expect(false).assertTrue()
}
})
RdbStore.backup(STORE_CONFIG.name, (err, data) => { RdbStore.backup(STORE_CONFIG.name, (err, data) => {
if(err != null){ expect(err != null).assertTrue()
expect(true).assertTrue() console.info(TAG + "RdbBackupRestoreCallbackTest_0600 backup2 done")
}else{
expect(false).assertTrue()
}
})
done(); done();
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0600 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_0600 end *************")
}) })
})
})
/** /**
* @tc.name RelationalStore BackupRestore test * @tc.name RelationalStore BackupRestore test
...@@ -335,27 +325,25 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -335,27 +325,25 @@ export default function relationalStoreBackupRestoreCallbackTest() {
it('RdbBackupRestoreCallbackTest_0700', 0, async function (done) { it('RdbBackupRestoreCallbackTest_0700', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 start *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 start *************")
let DATABASE_BACKUP_TEST_NAME = "BackupTest.db" let DATABASE_BACKUP_TEST_NAME = "BackupTest.db"
RdbStore.backup(DATABASE_BACKUP_TEST_NAME, (err, data) => { RdbStore.backup(DATABASE_BACKUP_TEST_NAME, async (err, data) => {
if(err != null){ if (err != null) {
expect(false).assertTrue() expect(false).assertTrue()
}else{ } else {
expect(true).assertTrue() console.info(TAG + "RdbBackupRestoreCallbackTest_0700 backup done")
} }
}) data_Rdb.deleteRdbStore(context, DATABASE_BACKUP_TEST_NAME, () => {
await data_Rdb.deleteRdbStore(context, DATABASE_BACKUP_TEST_NAME).then(() => { try {
try{
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_TEST_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_TEST_NAME)
}catch(err){ } catch (err) {
expect(true).assertTrue(); console.info(TAG + "RdbBackupRestoreCallbackTest_0700 deleteRdbStore done")
} }
})
RdbStore.restore(DATABASE_BACKUP_TEST_NAME, (err, data) => { RdbStore.restore(DATABASE_BACKUP_TEST_NAME, (err, data) => {
if(err != null){ expect(err != null).assertTrue()
expect(true).assertTrue() console.info(TAG + "RdbBackupRestoreCallbackTest_0700 restore err " + err.code)
}
})
done(); done();
})
})
})
console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_0700 end *************")
}) })
...@@ -394,12 +382,11 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -394,12 +382,11 @@ export default function relationalStoreBackupRestoreCallbackTest() {
if(err != null){ if(err != null){
expect(false).assertTrue() expect(false).assertTrue()
} }
})
ReStoreCallbackTest([DATABASE_BACKUP_NAME]) ReStoreCallbackTest([DATABASE_BACKUP_NAME])
done(); done();
})
console.info(TAG + "************* RdbBackupRestoreCallbackTest_1000 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_1000 end *************")
}) })
/** /**
* @tc.name RelationalStore BackupRestore test * @tc.name RelationalStore BackupRestore test
* @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_1100 * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreCallbackTest_1100
...@@ -411,9 +398,9 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -411,9 +398,9 @@ export default function relationalStoreBackupRestoreCallbackTest() {
if(err != null){ if(err != null){
expect(false).assertTrue() expect(false).assertTrue()
} }
})
ReStoreCallbackTest() ReStoreCallbackTest()
done(); done();
})
console.info(TAG + "************* RdbBackupRestoreCallbackTest_1100 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_1100 end *************")
}) })
...@@ -428,9 +415,9 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -428,9 +415,9 @@ export default function relationalStoreBackupRestoreCallbackTest() {
if(err != null){ if(err != null){
expect(false).assertTrue() expect(false).assertTrue()
} }
})
BackupCallbackTest(DATABASE_BACKUP_NAME) BackupCallbackTest(DATABASE_BACKUP_NAME)
done(); done();
})
console.info(TAG + "************* RdbBackupRestoreCallbackTest_1200 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_1200 end *************")
}) })
...@@ -453,10 +440,10 @@ export default function relationalStoreBackupRestoreCallbackTest() { ...@@ -453,10 +440,10 @@ export default function relationalStoreBackupRestoreCallbackTest() {
} }
}) })
} }
})
done(); done();
console.info(TAG + "************* RdbBackupRestoreCallbackTest_1300 end *************") console.info(TAG + "************* RdbBackupRestoreCallbackTest_1300 end *************")
}) })
})
console.info(TAG + "*************Unit Test End*************") console.info(TAG + "*************Unit Test End*************")
}) })
} }
\ No newline at end of file
...@@ -131,8 +131,8 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -131,8 +131,8 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
it('RdbBackupRestoreTest_0010', 0, async function (done) { it('RdbBackupRestoreTest_0010', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreTest_0010 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0010 start *************")
// RelationalStore backup function test // RDB backup function test
RdbStore.backup(DATABASE_BACKUP_NAME).then(async() => { await RdbStore.backup(DATABASE_BACKUP_NAME)
try { try {
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
fileio.accessSync(DATABASE_DIR + STORE_CONFIG.name) fileio.accessSync(DATABASE_DIR + STORE_CONFIG.name)
...@@ -140,31 +140,29 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -140,31 +140,29 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
console.info("RdbBackupRestoreTest_0010 backup success") console.info("RdbBackupRestoreTest_0010 backup success")
expect(false).assertTrue() expect(false).assertTrue()
} }
// RelationalStore before restored, delete data // RDB before restored, delete data
let deleteData = new data_Rdb.RdbPredicates("test") let deleteData = new data_Rdb.RdbPredicates("test")
deleteData.equalTo("name", "zhangsan") deleteData.equalTo("name", "zhangsan")
await RdbStore.delete(deleteData) await RdbStore.delete(deleteData)
// RelationalStore restore function test // RDB restore function test
RdbStore.restore(DATABASE_BACKUP_NAME).then(async () => { await RdbStore.restore(DATABASE_BACKUP_NAME)
try { try {
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
expect(false).assertTrue() expect(false).assertTrue()
} catch (err) { } catch (err) {
console.info("RdbBackupRestoreTest_0010 restore success") console.info("RdbBackupRestoreTest_0010 restore success")
expect(true).assertTrue()
} }
try { try {
fileio.accessSync(DATABASE_DIR + STORE_CONFIG.name) fileio.accessSync(DATABASE_DIR + STORE_CONFIG.name)
} catch (err) { } catch (err) {
console.info("RdbBackupRestoreTest_0010 restore success2")
expect(false).assertTrue() expect(false).assertTrue()
} }
// RelationalStore after restored, data query test // RDB after restored, data query test
let predicates = new data_Rdb.RdbPredicates("test") let predicates = new data_Rdb.RdbPredicates("test")
predicates.equalTo("name", "zhangsan") predicates.equalTo("name", "zhangsan")
RdbStore.query(predicates).then((resultSet)=>{ let resultSet = await RdbStore.query(predicates)
try { try {
console.info(TAG + "After restore resultSet query done") console.info(TAG + "After restore resultSet query done")
resultSet.goToFirstRow(); resultSet.goToFirstRow();
...@@ -183,24 +181,13 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -183,24 +181,13 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
console.info(TAG + 'RdbBackupRestoreTest_0010 accessSync err4: ' + err) console.info(TAG + 'RdbBackupRestoreTest_0010 accessSync err4: ' + err)
expect(false).assertTrue() expect(false).assertTrue()
} }
resultSet = null resultSet.close()
RdbStore = null RdbStore = null
done() done()
console.info(TAG + "************* RdbBackupRestoreTest_0010 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0010 end *************")
}) })
}).catch((err) => {
console.info("RdbBackupRestoreTest_0010 restore error: " + err)
expect(false).assertTrue()
})
}).catch((err) => {
expect(false).assertTrue()
})
})
/** /**
* @tc.name RelationalStore Backup test * @tc.name RelationalStore Backup test
* @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreTest_0020 * @tc.number SUB_DDM_RelationalStore_JS_RdbBackupRestoreTest_0020
...@@ -281,7 +268,6 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -281,7 +268,6 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
}catch(err){ }catch(err){
console.info(TAG + 'error2 ' + err) console.info(TAG + 'error2 ' + err)
expect(true).assertTrue();
} }
}) })
}).then(() => { }).then(() => {
...@@ -293,9 +279,9 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -293,9 +279,9 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
console.info(TAG + 'error3 ' + err) console.info(TAG + 'error3 ' + err)
expect(false).assertTrue() expect(false).assertTrue()
} }
done();
}) })
}) })
done()
console.info(TAG + "************* RdbBackupRestoreTest_0050 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0050 end *************")
}) })
...@@ -312,7 +298,7 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -312,7 +298,7 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
expect(false).assertTrue() ; expect(false).assertTrue() ;
}).catch((err) => { }).catch((err) => {
console.info(TAG + "Backup database error"); console.info(TAG + "Backup database error");
expect(true).assertTrue() ; expect(err != null).assertTrue() ;
done(); done();
}) })
}) })
...@@ -328,11 +314,11 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -328,11 +314,11 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
try{ try{
fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME) fileio.accessSync(DATABASE_DIR + DATABASE_BACKUP_NAME)
}catch(err){ }catch(err){
expect(true).assertTrue(); console.info(TAG + 'deleteRdbStore done')
} }
await RdbStore.restore(DATABASE_BACKUP_NAME).catch((err) => { await RdbStore.restore(DATABASE_BACKUP_NAME).catch((err) => {
console.info(TAG + 'Restore fail: ' + err) console.info(TAG + 'Restore fail: ' + err.code);
expect(true).assertTrue(); expect(err != null).assertTrue();
}) })
done(); done();
console.info(TAG + "************* RdbBackupRestoreTest_0070 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0070 end *************")
...@@ -370,7 +356,7 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -370,7 +356,7 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
it('RdbBackupRestoreTest_0100', 0, async function (done) { it('RdbBackupRestoreTest_0100', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreTest_0100 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0100 start *************")
await RdbStore.backup(DATABASE_BACKUP_NAME) await RdbStore.backup(DATABASE_BACKUP_NAME)
ReStoreTest([DATABASE_BACKUP_NAME]) await ReStoreTest([DATABASE_BACKUP_NAME])
done(); done();
console.info(TAG + "************* RdbBackupRestoreTest_0100 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0100 end *************")
}) })
...@@ -383,7 +369,7 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -383,7 +369,7 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
it('RdbBackupRestoreTest_0110', 0, async function (done) { it('RdbBackupRestoreTest_0110', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreTest_0110 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0110 start *************")
await RdbStore.backup(DATABASE_BACKUP_NAME) await RdbStore.backup(DATABASE_BACKUP_NAME)
ReStoreTest() await ReStoreTest()
done(); done();
console.info(TAG + "************* RdbBackupRestoreTest_0110 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0110 end *************")
}) })
...@@ -396,7 +382,7 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -396,7 +382,7 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
it('RdbBackupRestoreTest_0120', 0, async function (done) { it('RdbBackupRestoreTest_0120', 0, async function (done) {
console.info(TAG + "************* RdbBackupRestoreTest_0120 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0120 start *************")
await RdbStore.backup(DATABASE_BACKUP_NAME) await RdbStore.backup(DATABASE_BACKUP_NAME)
BackupTest(DATABASE_BACKUP_NAME) await BackupTest(DATABASE_BACKUP_NAME)
done(); done();
console.info(TAG + "************* RdbBackupRestoreTest_0120 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0120 end *************")
}) })
...@@ -410,7 +396,7 @@ describe('relationalStoreBackupRestorePromiseTest', function () { ...@@ -410,7 +396,7 @@ describe('relationalStoreBackupRestorePromiseTest', function () {
console.info(TAG + "************* RdbBackupRestoreTest_0130 start *************") console.info(TAG + "************* RdbBackupRestoreTest_0130 start *************")
await RdbStore.backup(DATABASE_BACKUP_NAME) await RdbStore.backup(DATABASE_BACKUP_NAME)
await RdbStore.restore(DATABASE_BACKUP_NAME) await RdbStore.restore(DATABASE_BACKUP_NAME)
ReStoreTest(DATABASE_BACKUP_NAME) await ReStoreTest(DATABASE_BACKUP_NAME)
done(); done();
console.info(TAG + "************* RdbBackupRestoreTest_0130 end *************") console.info(TAG + "************* RdbBackupRestoreTest_0130 end *************")
}) })
......
...@@ -149,13 +149,11 @@ describe('relationalStoreTest', function () { ...@@ -149,13 +149,11 @@ describe('relationalStoreTest', function () {
} catch (err) { } catch (err) {
expect(null).assertFail(); expect(null).assertFail();
} }
await dataRdb.deleteRdbStore(context,"secure.db");
done();
}).catch((err) => { }).catch((err) => {
expect(null).assertFail(); expect(null).assertFail();
}) })
await storePromise
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0400 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0400 end *************");
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册