提交 2d5ea024 编写于 作者: L liangzhenyu123

<liangzhenyu6@huawei.com>

Signed-off-by: Nliangzhenyu123 <liangzhenyu6@huawei.com>
上级 d178e2f8
...@@ -50,7 +50,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -50,7 +50,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
await dataRdb.deleteRdbStore(context, "DataShareTest.db") await dataRdb.deleteRdbStore(context, "DataShareTest.db")
}) })
console.log(TAG + "*************Unit Test Begin*************") console.info(TAG + "*************Unit Test Begin*************")
/** /**
...@@ -59,7 +59,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -59,7 +59,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
* @tc.desc rdb DataShare Func insert test * @tc.desc rdb DataShare Func insert test
*/ */
it('testRdbStoreDataShareFunc0001', 0, async function (done) { it('testRdbStoreDataShareFunc0001', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDataShareFunc0001 start *************") console.info(TAG + "************* testRdbStoreDataShareFunc0001 start *************")
let u8 = new Uint8Array([1, 2, 3]) let u8 = new Uint8Array([1, 2, 3])
const valueBucket = { const valueBucket = {
"name": "zhangsan", "name": "zhangsan",
...@@ -70,19 +70,19 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -70,19 +70,19 @@ describe('rdbStoreDataSharePredicatesTest', function () {
let insertPromise = rdbStore.insert("test", valueBucket) let insertPromise = rdbStore.insert("test", valueBucket)
insertPromise.then(async (ret) => { insertPromise.then(async (ret) => {
expect(1).assertEqual(ret) expect(1).assertEqual(ret)
console.log(TAG + "Insert done: " + ret) console.info(TAG + "Insert done: " + ret)
}).catch((err) => { }).catch((err) => {
console.log(TAG + "Insert err: " + err) console.info(TAG + "Insert err: " + err)
expect(false).assertTrue() expect(false).assertTrue()
}) })
await insertPromise await insertPromise
console.log("insert end") console.info("insert end")
let predicates = new dataRdb.RdbPredicates("test") let predicates = new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "zhangsan") predicates.equalTo("name", "zhangsan")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
console.log(TAG + "resultSet query done") console.info(TAG + "resultSet query done")
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
const name = resultSet.getString(resultSet.getColumnIndex("name")) const name = resultSet.getString(resultSet.getColumnIndex("name"))
const age = resultSet.getLong(resultSet.getColumnIndex("age")) const age = resultSet.getLong(resultSet.getColumnIndex("age"))
...@@ -100,7 +100,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -100,7 +100,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
resultSet = null resultSet = null
done() done()
console.log(TAG + "************* testRdbStoreDataShareFunc0001 end *************") console.info(TAG + "************* testRdbStoreDataShareFunc0001 end *************")
}) })
...@@ -110,7 +110,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -110,7 +110,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
* @tc.desc rdb DataShare update promise Func test * @tc.desc rdb DataShare update promise Func test
*/ */
it('testRdbStoreDataShareFunc0002', 0, async function (done) { it('testRdbStoreDataShareFunc0002', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDataShareFunc0002 start *************") console.info(TAG + "************* testRdbStoreDataShareFunc0002 start *************")
let u8 = new Uint8Array([1, 2, 3]) let u8 = new Uint8Array([1, 2, 3])
let valueBucket = { let valueBucket = {
"name": "zhangsan", "name": "zhangsan",
...@@ -133,9 +133,9 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -133,9 +133,9 @@ describe('rdbStoreDataSharePredicatesTest', function () {
let promiseUpdate = rdbStore.update("test", valueBucket, predicates) let promiseUpdate = rdbStore.update("test", valueBucket, predicates)
promiseUpdate.then(async (ret) => { promiseUpdate.then(async (ret) => {
expect(1).assertEqual(ret) expect(1).assertEqual(ret)
console.log(TAG + "Update done: " + ret) console.info(TAG + "Update done: " + ret)
}).catch((err) => { }).catch((err) => {
console.log(TAG + "Update err: " + err) console.info(TAG + "Update err: " + err)
expect(false).assertTrue() expect(false).assertTrue()
}) })
await promiseUpdate await promiseUpdate
...@@ -157,12 +157,12 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -157,12 +157,12 @@ describe('rdbStoreDataSharePredicatesTest', function () {
expect(5).assertEqual(blobType[1]) expect(5).assertEqual(blobType[1])
expect(6).assertEqual(blobType[2]) expect(6).assertEqual(blobType[2])
console.log(TAG + "dataShare update: {id=" + id + ", name=" + name + ", " + console.info(TAG + "dataShare update: {id=" + id + ", name=" + name + ", " +
"age=" + age + ", salary=" + salary + ", blobType=" + blobType) "age=" + age + ", salary=" + salary + ", blobType=" + blobType)
resultSet = null resultSet = null
done() done()
console.log(TAG + "************* testRdbStoreDataShareFunc0002 end *************") console.info(TAG + "************* testRdbStoreDataShareFunc0002 end *************")
}) })
/** /**
...@@ -171,7 +171,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -171,7 +171,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
* @tc.desc rdb DataShare update callback Func test * @tc.desc rdb DataShare update callback Func test
*/ */
it('testRdbStoreDataShareFunc0003', 0, async function (done) { it('testRdbStoreDataShareFunc0003', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDataShareFunc0003 start *************") console.info(TAG + "************* testRdbStoreDataShareFunc0003 start *************")
let u8 = new Uint8Array([1, 2, 3]) let u8 = new Uint8Array([1, 2, 3])
let valueBucket = { let valueBucket = {
"name": "zhangsan", "name": "zhangsan",
...@@ -198,7 +198,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -198,7 +198,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
expect(false).assertTrue() expect(false).assertTrue()
} }
expect(1).assertEqual(ret) expect(1).assertEqual(ret)
console.log("Update done: " + ret) console.info("Update done: " + ret)
let rdbPredicates = await new dataRdb.RdbPredicates("test") let rdbPredicates = await new dataRdb.RdbPredicates("test")
rdbPredicates.equalTo("name", "lisi") rdbPredicates.equalTo("name", "lisi")
let resultSet = await rdbStore.query(rdbPredicates) let resultSet = await rdbStore.query(rdbPredicates)
...@@ -216,13 +216,13 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -216,13 +216,13 @@ describe('rdbStoreDataSharePredicatesTest', function () {
expect(4).assertEqual(blobType[0]) expect(4).assertEqual(blobType[0])
expect(5).assertEqual(blobType[1]) expect(5).assertEqual(blobType[1])
expect(6).assertEqual(blobType[2]) expect(6).assertEqual(blobType[2])
console.log(TAG + "dataShare update: {id=" + id + ", name=" + name + ", " + console.info(TAG + "dataShare update: {id=" + id + ", name=" + name + ", " +
"age=" + age + ", salary=" + salary + ", blobType=" + blobType) "age=" + age + ", salary=" + salary + ", blobType=" + blobType)
resultSet = null resultSet = null
}) })
done() done()
console.log(TAG + "************* testRdbStoreDataShareFunc0003 end *************") console.info(TAG + "************* testRdbStoreDataShareFunc0003 end *************")
}) })
/** /**
...@@ -231,7 +231,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -231,7 +231,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
* @tc.desc rdb DataShare query promise Func test * @tc.desc rdb DataShare query promise Func test
*/ */
it('testRdbStoreDataShareFunc0004', 0, async function (done) { it('testRdbStoreDataShareFunc0004', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDataShareFunc0004 start *************") console.info(TAG + "************* testRdbStoreDataShareFunc0004 start *************")
let u8 = new Uint8Array([4, 5, 6]) let u8 = new Uint8Array([4, 5, 6])
let valueBucket = { let valueBucket = {
"name": "zhangsan", "name": "zhangsan",
...@@ -245,7 +245,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -245,7 +245,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
predicates.equalTo("name", "zhangsan") predicates.equalTo("name", "zhangsan")
let queryPromise = rdbStore.query("test", predicates) let queryPromise = rdbStore.query("test", predicates)
queryPromise.then((resultSet) => { queryPromise.then((resultSet) => {
console.log(TAG + "DataShare Query done: ") console.info(TAG + "DataShare Query done: ")
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
const name = resultSet.getString(resultSet.getColumnIndex("name")) const name = resultSet.getString(resultSet.getColumnIndex("name"))
const age = resultSet.getLong(resultSet.getColumnIndex("age")) const age = resultSet.getLong(resultSet.getColumnIndex("age"))
...@@ -260,13 +260,13 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -260,13 +260,13 @@ describe('rdbStoreDataSharePredicatesTest', function () {
expect(6).assertEqual(blobType[2]) expect(6).assertEqual(blobType[2])
}).catch((err) => { }).catch((err) => {
console.log(TAG + "Query err: " + err) console.info(TAG + "Query err: " + err)
expect(false).assertTrue() expect(false).assertTrue()
}) })
await queryPromise await queryPromise
done() done()
console.log(TAG + "************* testRdbStoreDataShareFunc0004 end *************") console.info(TAG + "************* testRdbStoreDataShareFunc0004 end *************")
}) })
/** /**
...@@ -275,7 +275,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -275,7 +275,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
* @tc.desc rdb DataShare query callback Func test * @tc.desc rdb DataShare query callback Func test
*/ */
it('testRdbStoreDataShareFunc0005', 0, async function (done) { it('testRdbStoreDataShareFunc0005', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDataShareFunc0005 start *************") console.info(TAG + "************* testRdbStoreDataShareFunc0005 start *************")
let u8 = new Uint8Array([4, 5, 6]) let u8 = new Uint8Array([4, 5, 6])
let valueBucket = { let valueBucket = {
"name": "zhangsan", "name": "zhangsan",
...@@ -309,7 +309,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -309,7 +309,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
}) })
done() done()
console.log(TAG + "************* testRdbStoreDataShareFunc0005 end *************") console.info(TAG + "************* testRdbStoreDataShareFunc0005 end *************")
}) })
/** /**
...@@ -318,7 +318,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -318,7 +318,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
* @tc.desc rdb DataShare delete Func test * @tc.desc rdb DataShare delete Func test
*/ */
it('testRdbStoreDataShareFunc0006', 0, async function (done) { it('testRdbStoreDataShareFunc0006', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDataShareFunc0006 start *************") console.info(TAG + "************* testRdbStoreDataShareFunc0006 start *************")
let u8 = new Uint8Array([1, 2, 3]) let u8 = new Uint8Array([1, 2, 3])
let valueBucket = { let valueBucket = {
"name": "zhangsan", "name": "zhangsan",
...@@ -333,9 +333,9 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -333,9 +333,9 @@ describe('rdbStoreDataSharePredicatesTest', function () {
let deletePromise = rdbStore.delete("test", predicates) let deletePromise = rdbStore.delete("test", predicates)
deletePromise.then(async (ret) => { deletePromise.then(async (ret) => {
expect(1).assertEqual(ret) expect(1).assertEqual(ret)
console.log(TAG + "Delete done: " + ret) console.info(TAG + "Delete done: " + ret)
}).catch((err) => { }).catch((err) => {
console.log(TAG + "Delete err: " + err) console.info(TAG + "Delete err: " + err)
expect(false).assertTrue() expect(false).assertTrue()
}) })
await deletePromise await deletePromise
...@@ -347,7 +347,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -347,7 +347,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
resultSet = null resultSet = null
done() done()
console.log(TAG + "************* testRdbStoreDataShareFunc0006 end *************") console.info(TAG + "************* testRdbStoreDataShareFunc0006 end *************")
}) })
/** /**
...@@ -356,7 +356,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -356,7 +356,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
* @tc.desc rdb DataShare delete Func test * @tc.desc rdb DataShare delete Func test
*/ */
it('testRdbStoreDataShareFunc0007', 0, async function (done) { it('testRdbStoreDataShareFunc0007', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDataShareFunc0007 start *************") console.info(TAG + "************* testRdbStoreDataShareFunc0007 start *************")
let u8 = new Uint8Array([1, 2, 3]) let u8 = new Uint8Array([1, 2, 3])
let valueBucket = { let valueBucket = {
"name": "zhangsan", "name": "zhangsan",
...@@ -375,7 +375,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -375,7 +375,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
expect(false).assertTrue() expect(false).assertTrue()
} }
expect(1).assertEqual(ret) expect(1).assertEqual(ret)
console.log("Delete done: " + ret) console.info("Delete done: " + ret)
let rdbPredicates = await new dataRdb.RdbPredicates("test") let rdbPredicates = await new dataRdb.RdbPredicates("test")
rdbPredicates.equalTo("name", "zhangsan") rdbPredicates.equalTo("name", "zhangsan")
let resultSet = await rdbStore.query(rdbPredicates) let resultSet = await rdbStore.query(rdbPredicates)
...@@ -384,7 +384,7 @@ describe('rdbStoreDataSharePredicatesTest', function () { ...@@ -384,7 +384,7 @@ describe('rdbStoreDataSharePredicatesTest', function () {
}) })
done() done()
console.log(TAG + "************* testRdbStoreDataShareFunc0007 end *************") console.info(TAG + "************* testRdbStoreDataShareFunc0007 end *************")
}) })
console.log(TAG + "*************Unit Test End*************") console.info(TAG + "*************Unit Test End*************")
}) })
\ No newline at end of file
...@@ -38,7 +38,7 @@ describe('rdbStoreDistributedTest', function () { ...@@ -38,7 +38,7 @@ describe('rdbStoreDistributedTest', function () {
await dataRdb.deleteRdbStore(STORE_NAME); await dataRdb.deleteRdbStore(STORE_NAME);
}) })
console.log(TAG + "*************Unit Test Begin*************"); console.info(TAG + "*************Unit Test Begin*************");
/** /**
* @tc.name rdb open test * @tc.name rdb open test
...@@ -46,13 +46,13 @@ describe('rdbStoreDistributedTest', function () { ...@@ -46,13 +46,13 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc rdb open test * @tc.desc rdb open test
*/ */
it('testRdbStoreDistributed0001', 0, async function (done) { it('testRdbStoreDistributed0001', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed001 start *************"); console.info(TAG + "************* testRdbStoreDistributed001 start *************");
const config = { const config = {
"name": STORE_NAME, "name": STORE_NAME,
} }
try { try {
rdbStore = await dataRdb.getRdbStore(config, 1); rdbStore = await dataRdb.getRdbStore(config, 1);
console.log(TAG + "create rdb store success") console.info(TAG + "create rdb store success")
expect(rdbStore).assertEqual(rdbStore) expect(rdbStore).assertEqual(rdbStore)
let sqlStatement = "CREATE TABLE IF NOT EXISTS employee (" + let sqlStatement = "CREATE TABLE IF NOT EXISTS employee (" +
"id INTEGER PRIMARY KEY AUTOINCREMENT," + "id INTEGER PRIMARY KEY AUTOINCREMENT," +
...@@ -60,9 +60,9 @@ describe('rdbStoreDistributedTest', function () { ...@@ -60,9 +60,9 @@ describe('rdbStoreDistributedTest', function () {
"age INTEGER)" "age INTEGER)"
try { try {
await rdbStore.executeSql(sqlStatement, null) await rdbStore.executeSql(sqlStatement, null)
console.log(TAG + "create table employee success") console.info(TAG + "create table employee success")
} catch (err) { } catch (err) {
console.log(TAG + "create table employee failed") console.info(TAG + "create table employee failed")
expect(null).assertFail() expect(null).assertFail()
} }
...@@ -74,17 +74,17 @@ describe('rdbStoreDistributedTest', function () { ...@@ -74,17 +74,17 @@ describe('rdbStoreDistributedTest', function () {
"describe TEXT)" "describe TEXT)"
try { try {
await rdbStore.executeSql(sqlStatement, null) await rdbStore.executeSql(sqlStatement, null)
console.log(TAG + "create table product success") console.info(TAG + "create table product success")
} catch (err) { } catch (err) {
console.log(TAG + "create table product failed") console.info(TAG + "create table product failed")
expect(null).assertFail() expect(null).assertFail()
} }
} catch (err) { } catch (err) {
console.log(TAG + "create rdb store failed") console.info(TAG + "create rdb store failed")
expect(null).assertFail() expect(null).assertFail()
} }
done() done()
console.log(TAG + "************* testRdbStoreDistributed001 end *************"); console.info(TAG + "************* testRdbStoreDistributed001 end *************");
}) })
/** /**
...@@ -93,17 +93,17 @@ describe('rdbStoreDistributedTest', function () { ...@@ -93,17 +93,17 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc rdb set distributed table using none table as argment * @tc.desc rdb set distributed table using none table as argment
*/ */
it('testRdbStoreDistributed0002', 0, async function (done) { it('testRdbStoreDistributed0002', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed002 start *************"); console.info(TAG + "************* testRdbStoreDistributed002 start *************");
try { try {
await rdbStore.setDistributedTables([]) await rdbStore.setDistributedTables([])
console.log(TAG + "set none to be distributed table success"); console.info(TAG + "set none to be distributed table success");
expect(rdbStore).assertEqual(rdbStore) expect(rdbStore).assertEqual(rdbStore)
} catch (err) { } catch (err) {
console.log(TAG + "set none to be distributed table failed"); console.info(TAG + "set none to be distributed table failed");
expect(null).assertFail(); expect(null).assertFail();
} }
done() done()
console.log(TAG + "************* testRdbStoreDistributed002 end *************"); console.info(TAG + "************* testRdbStoreDistributed002 end *************");
}) })
/** /**
...@@ -112,17 +112,17 @@ describe('rdbStoreDistributedTest', function () { ...@@ -112,17 +112,17 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc set distributed table using one table name * @tc.desc set distributed table using one table name
*/ */
it('testRdbStoreDistributed0003', 0, async function (done) { it('testRdbStoreDistributed0003', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed003 start *************"); console.info(TAG + "************* testRdbStoreDistributed003 start *************");
try { try {
await rdbStore.setDistributedTables(['employee']) await rdbStore.setDistributedTables(['employee'])
console.log(TAG + "set employee to be distributed table success"); console.info(TAG + "set employee to be distributed table success");
expect(rdbStore).assertEqual(rdbStore) expect(rdbStore).assertEqual(rdbStore)
} catch (err) { } catch (err) {
console.log(TAG + "set employee to be distributed table failed"); console.info(TAG + "set employee to be distributed table failed");
expect(null).assertFail(); expect(null).assertFail();
} }
done() done()
console.log(TAG + "************* testRdbStoreDistributed003 end *************"); console.info(TAG + "************* testRdbStoreDistributed003 end *************");
}) })
/** /**
...@@ -131,17 +131,17 @@ describe('rdbStoreDistributedTest', function () { ...@@ -131,17 +131,17 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc set distributed table using two table name * @tc.desc set distributed table using two table name
*/ */
it('testRdbStoreDistributed0004', 0, async function (done) { it('testRdbStoreDistributed0004', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed004 start *************"); console.info(TAG + "************* testRdbStoreDistributed004 start *************");
try { try {
await rdbStore.setDistributedTables(['employee', 'product']) await rdbStore.setDistributedTables(['employee', 'product'])
console.log(TAG + "set employee and product to be distributed table success"); console.info(TAG + "set employee and product to be distributed table success");
expect(rdbStore).assertEqual(rdbStore) expect(rdbStore).assertEqual(rdbStore)
} catch (err) { } catch (err) {
console.log(TAG + "set employee and product to be distributed table failed"); console.info(TAG + "set employee and product to be distributed table failed");
expect(null).assertFail(); expect(null).assertFail();
} }
done() done()
console.log(TAG + "************* testRdbStoreDistributed004 end *************"); console.info(TAG + "************* testRdbStoreDistributed004 end *************");
}) })
/** /**
...@@ -150,21 +150,21 @@ describe('rdbStoreDistributedTest', function () { ...@@ -150,21 +150,21 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc insert record after setting distributed table * @tc.desc insert record after setting distributed table
*/ */
it('testRdbStoreDistributed0005', 0, async function (done) { it('testRdbStoreDistributed0005', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed005 start *************"); console.info(TAG + "************* testRdbStoreDistributed005 start *************");
const record = { const record = {
"name": "Jim", "name": "Jim",
"age": 20, "age": 20,
} }
try { try {
let rowId = await rdbStore.insert("employee", record) let rowId = await rdbStore.insert("employee", record)
console.log(TAG + "insert one record success " + rowId) console.info(TAG + "insert one record success " + rowId)
expect(1).assertEqual(rowId) expect(1).assertEqual(rowId)
} catch (err) { } catch (err) {
console.log(TAG + "insert one record failed"); console.info(TAG + "insert one record failed");
expect(null).assertFail(); expect(null).assertFail();
} }
done() done()
console.log(TAG + "************* testRdbStoreDistributed005 end *************"); console.info(TAG + "************* testRdbStoreDistributed005 end *************");
}) })
/** /**
...@@ -173,7 +173,7 @@ describe('rdbStoreDistributedTest', function () { ...@@ -173,7 +173,7 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc update record after setting distributed table * @tc.desc update record after setting distributed table
*/ */
it('testRdbStoreDistributed0006', 0, async function (done) { it('testRdbStoreDistributed0006', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed006 start *************"); console.info(TAG + "************* testRdbStoreDistributed006 start *************");
const record = { const record = {
"name": "Jim", "name": "Jim",
"age": 30, "age": 30,
...@@ -183,18 +183,18 @@ describe('rdbStoreDistributedTest', function () { ...@@ -183,18 +183,18 @@ describe('rdbStoreDistributedTest', function () {
predicate.equalTo("id", 1); predicate.equalTo("id", 1);
try { try {
let rowId = await rdbStore.update(record, predicate); let rowId = await rdbStore.update(record, predicate);
console.log(TAG + "update one record success " + rowId) console.info(TAG + "update one record success " + rowId)
expect(1).assertEqual(rowId) expect(1).assertEqual(rowId)
} catch (err) { } catch (err) {
console.log(TAG + "update one record failed"); console.info(TAG + "update one record failed");
expect(null).assertFail(); expect(null).assertFail();
} }
} catch (err) { } catch (err) {
console.log(TAG + "construct predicate failed"); console.info(TAG + "construct predicate failed");
expect(null).assertFail(); expect(null).assertFail();
} }
done() done()
console.log(TAG + "************* testRdbStoreDistributed006 end *************"); console.info(TAG + "************* testRdbStoreDistributed006 end *************");
}) })
/** /**
...@@ -203,12 +203,12 @@ describe('rdbStoreDistributedTest', function () { ...@@ -203,12 +203,12 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc query record after setting distributed table * @tc.desc query record after setting distributed table
*/ */
it('testRdbStoreDistributed0007', 0, async function (done) { it('testRdbStoreDistributed0007', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed0007 start *************"); console.info(TAG + "************* testRdbStoreDistributed0007 start *************");
try { try {
let predicates = new dataRdb.RdbPredicates("employee") let predicates = new dataRdb.RdbPredicates("employee")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
console.log(TAG + "product resultSet query done"); console.info(TAG + "product resultSet query done");
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
const id = await resultSet.getLong(resultSet.getColumnIndex("id")) const id = await resultSet.getLong(resultSet.getColumnIndex("id"))
const name = await resultSet.getString(resultSet.getColumnIndex("name")) const name = await resultSet.getString(resultSet.getColumnIndex("name"))
...@@ -220,15 +220,15 @@ describe('rdbStoreDistributedTest', function () { ...@@ -220,15 +220,15 @@ describe('rdbStoreDistributedTest', function () {
resultSet.close(); resultSet.close();
expect(true).assertEqual(resultSet.isClosed) expect(true).assertEqual(resultSet.isClosed)
} catch (e) { } catch (e) {
console.log(TAG + "result get value failed") console.info(TAG + "result get value failed")
expect(null).assertFail(); expect(null).assertFail();
} }
} catch (err) { } catch (err) {
console.log("query failed"); console.info("query failed");
expect(null).assertFail(); expect(null).assertFail();
} }
done(); done();
console.log(TAG + "************* testRdbStoreDistributed0007 end *************"); console.info(TAG + "************* testRdbStoreDistributed0007 end *************");
}) })
/** /**
...@@ -237,18 +237,18 @@ describe('rdbStoreDistributedTest', function () { ...@@ -237,18 +237,18 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc delete record after setting distributed table * @tc.desc delete record after setting distributed table
*/ */
it('testRdbStoreDistributed0008', 0, async function (done) { it('testRdbStoreDistributed0008', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed0008 start *************"); console.info(TAG + "************* testRdbStoreDistributed0008 start *************");
let predicates = new dataRdb.RdbPredicates("employee") let predicates = new dataRdb.RdbPredicates("employee")
try { try {
let number = await rdbStore.delete(predicates) let number = await rdbStore.delete(predicates)
console.log(TAG + "employee Delete done: " + number) console.info(TAG + "employee Delete done: " + number)
expect(1).assertEqual(number) expect(1).assertEqual(number)
} catch (err) { } catch (err) {
console.log(TAG + "delete record failed"); console.info(TAG + "delete record failed");
expect(null).assertFail() expect(null).assertFail()
} }
done(); done();
console.log(TAG + "************* testRdbStoreDistributed0008 end *************"); console.info(TAG + "************* testRdbStoreDistributed0008 end *************");
}) })
/** /**
...@@ -257,18 +257,18 @@ describe('rdbStoreDistributedTest', function () { ...@@ -257,18 +257,18 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc predicates inDevice * @tc.desc predicates inDevice
*/ */
it('testRdbStoreDistributed0009', 0, async function (done) { it('testRdbStoreDistributed0009', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed0009 start *************"); console.info(TAG + "************* testRdbStoreDistributed0009 start *************");
let predicates = new dataRdb.RdbPredicates("employee") let predicates = new dataRdb.RdbPredicates("employee")
try { try {
predicates = predicates.inDevices("1234567890"); predicates = predicates.inDevices("1234567890");
console.log(TAG + "inDevices success"); console.info(TAG + "inDevices success");
expect(predicates).assertEqual(predicates); expect(predicates).assertEqual(predicates);
} catch (err) { } catch (err) {
console.log(TAG + "inDevices failed"); console.info(TAG + "inDevices failed");
expect(null).assertFail(); expect(null).assertFail();
} }
done(); done();
console.log(TAG + "************* testRdbStoreDistributed0009 end *************"); console.info(TAG + "************* testRdbStoreDistributed0009 end *************");
}) })
/** /**
...@@ -277,18 +277,18 @@ describe('rdbStoreDistributedTest', function () { ...@@ -277,18 +277,18 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc predicates inAllDevices * @tc.desc predicates inAllDevices
*/ */
it('testRdbStoreDistributed0010', 0, async function (done) { it('testRdbStoreDistributed0010', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed0010 start *************"); console.info(TAG + "************* testRdbStoreDistributed0010 start *************");
let predicates = new dataRdb.RdbPredicates("employee") let predicates = new dataRdb.RdbPredicates("employee")
try { try {
predicates = predicates.inAllDevices(); predicates = predicates.inAllDevices();
console.log(TAG + "inAllDevices success"); console.info(TAG + "inAllDevices success");
expect(predicates).assertEqual(predicates); expect(predicates).assertEqual(predicates);
} catch (err) { } catch (err) {
console.log(TAG + "inAllDevices failed"); console.info(TAG + "inAllDevices failed");
expect(null).assertFail(); expect(null).assertFail();
} }
done(); done();
console.log(TAG + "************* testRdbStoreDistributed0010 end *************"); console.info(TAG + "************* testRdbStoreDistributed0010 end *************");
}) })
/** /**
...@@ -297,17 +297,17 @@ describe('rdbStoreDistributedTest', function () { ...@@ -297,17 +297,17 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc sync test * @tc.desc sync test
*/ */
it('testRdbStoreDistributed0011', 0, async function (done) { it('testRdbStoreDistributed0011', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed0011 start *************"); console.info(TAG + "************* testRdbStoreDistributed0011 start *************");
let predicates = new dataRdb.RdbPredicates("employee") let predicates = new dataRdb.RdbPredicates("employee")
predicates = predicates.inDevices("12345678abcd"); predicates = predicates.inDevices("12345678abcd");
rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PUSH, predicates); rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PUSH, predicates);
console.log(TAG + "sync push success"); console.info(TAG + "sync push success");
expect(rdbStore).assertEqual(rdbStore); expect(rdbStore).assertEqual(rdbStore);
rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PULL, predicates); rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PULL, predicates);
console.log(TAG + "sync pull success"); console.info(TAG + "sync pull success");
expect(rdbStore).assertEqual(rdbStore); expect(rdbStore).assertEqual(rdbStore);
done(); done();
console.log(TAG + "************* testRdbStoreDistributed0011 end *************"); console.info(TAG + "************* testRdbStoreDistributed0011 end *************");
}) })
/** /**
...@@ -316,19 +316,19 @@ describe('rdbStoreDistributedTest', function () { ...@@ -316,19 +316,19 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc sync Callback test * @tc.desc sync Callback test
*/ */
it('testRdbStoreDistributedCallback0011', 0, async function (done) { it('testRdbStoreDistributedCallback0011', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributedCallback0011 start *************"); console.info(TAG + "************* testRdbStoreDistributedCallback0011 start *************");
let predicates = new dataRdb.RdbPredicates("employee") let predicates = new dataRdb.RdbPredicates("employee")
predicates = predicates.inDevices("12345678abcd"); predicates = predicates.inDevices("12345678abcd");
rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PUSH, predicates,(err,ret)=>{ rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PUSH, predicates,(err,ret)=>{
console.log(TAG + "sync push success"); console.info(TAG + "sync push success");
expect(rdbStore).assertEqual(rdbStore); expect(rdbStore).assertEqual(rdbStore);
}); });
rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PULL, predicates,(err,ret)=>{ rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PULL, predicates,(err,ret)=>{
console.log(TAG + "sync push success"); console.info(TAG + "sync push success");
expect(rdbStore).assertEqual(rdbStore); expect(rdbStore).assertEqual(rdbStore);
}); });
done(); done();
console.log(TAG + "************* testRdbStoreDistributedCallback0011 end *************"); console.info(TAG + "************* testRdbStoreDistributedCallback0011 end *************");
}) })
/** /**
...@@ -337,14 +337,14 @@ describe('rdbStoreDistributedTest', function () { ...@@ -337,14 +337,14 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc subscribe test * @tc.desc subscribe test
*/ */
it('testRdbStoreDistributed0012', 0, async function (done) { it('testRdbStoreDistributed0012', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed0012 start *************"); console.info(TAG + "************* testRdbStoreDistributed0012 start *************");
rdbStore.on("dataChange", (device) => { rdbStore.on("dataChange", (device) => {
console.log(TAG + device + " dataChange"); console.info(TAG + device + " dataChange");
}); });
console.log(TAG + "on dataChange success"); console.info(TAG + "on dataChange success");
expect(rdbStore).assertEqual(rdbStore); expect(rdbStore).assertEqual(rdbStore);
done() done()
console.log(TAG + "************* testRdbStoreDistributed0012 end *************"); console.info(TAG + "************* testRdbStoreDistributed0012 end *************");
}) })
/** /**
...@@ -353,14 +353,14 @@ describe('rdbStoreDistributedTest', function () { ...@@ -353,14 +353,14 @@ describe('rdbStoreDistributedTest', function () {
* @tc.desc subscribe test * @tc.desc subscribe test
*/ */
it('testRdbStoreDistributed0013', 0, async function (done) { it('testRdbStoreDistributed0013', 0, async function (done) {
console.log(TAG + "************* testRdbStoreDistributed0013 start *************"); console.info(TAG + "************* testRdbStoreDistributed0013 start *************");
rdbStore.off("dataChange", (device) => { rdbStore.off("dataChange", (device) => {
console.log(TAG + device + " dataChange"); console.info(TAG + device + " dataChange");
}); });
console.log(TAG + "off dataChange success"); console.info(TAG + "off dataChange success");
expect(rdbStore).assertEqual(rdbStore); expect(rdbStore).assertEqual(rdbStore);
done() done()
console.log(TAG + "************* testRdbStoreDistributed0013 end *************"); console.info(TAG + "************* testRdbStoreDistributed0013 end *************");
}) })
/** /**
...@@ -398,5 +398,5 @@ describe('rdbStoreDistributedTest', function () { ...@@ -398,5 +398,5 @@ describe('rdbStoreDistributedTest', function () {
done(); done();
}) })
console.log(TAG + "*************Unit Test End*************"); console.info(TAG + "*************Unit Test End*************");
}) })
...@@ -34,7 +34,7 @@ var i = 1; ...@@ -34,7 +34,7 @@ var i = 1;
var rdbStore = undefined; var rdbStore = undefined;
describe('rdbStoreInsertTest_insert1', function () { describe('rdbstoreChangeEncryptKeyTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
}) })
...@@ -60,7 +60,7 @@ describe('rdbStoreInsertTest_insert1', function () { ...@@ -60,7 +60,7 @@ describe('rdbStoreInsertTest_insert1', function () {
console.info(TAG + 'afterAll') console.info(TAG + 'afterAll')
}) })
console.log(TAG + "*************Unit Test Begin*************"); console.info(TAG + "*************Unit Test Begin*************");
/** /**
* @tc.name testRdbStoreChangeEncryptKey0001 * @tc.name testRdbStoreChangeEncryptKey0001
...@@ -68,7 +68,7 @@ describe('rdbStoreInsertTest_insert1', function () { ...@@ -68,7 +68,7 @@ describe('rdbStoreInsertTest_insert1', function () {
* @tc.desc encrypt the db at start, then change the encrypt key * @tc.desc encrypt the db at start, then change the encrypt key
*/ */
it('testRdbStoreChangeEncryptKey0001', 0, async function (done) { it('testRdbStoreChangeEncryptKey0001', 0, async function (done) {
console.log(TAG + "************* testRdbStoreChangeEncryptKey0001 start *************"); console.info(TAG + "************* testRdbStoreChangeEncryptKey0001 start *************");
var u8 = new Uint8Array([1, 2, 3]) var u8 = new Uint8Array([1, 2, 3])
{ {
...@@ -89,16 +89,16 @@ describe('rdbStoreInsertTest_insert1', function () { ...@@ -89,16 +89,16 @@ describe('rdbStoreInsertTest_insert1', function () {
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
console.log(TAG + "resultSet query done"); console.info(TAG + "resultSet query done");
resultSet.goToFirstRow() resultSet.goToFirstRow()
const id = resultSet.getLong(resultSet.getColumnIndex("id")) const id = resultSet.getLong(resultSet.getColumnIndex("id"))
expect(1).assertEqual(id); expect(1).assertEqual(id);
} catch (e) { } catch (e) {
console.log("insert1 error " + e); console.info("insert1 error " + e);
} }
done() done()
console.log(TAG + "************* testRdbStoreChangeEncryptKey0001 end *************"); console.info(TAG + "************* testRdbStoreChangeEncryptKey0001 end *************");
}) })
/** /**
...@@ -107,7 +107,7 @@ describe('rdbStoreInsertTest_insert1', function () { ...@@ -107,7 +107,7 @@ describe('rdbStoreInsertTest_insert1', function () {
* @tc.desc encrypt the db at start, then change the encrypt key * @tc.desc encrypt the db at start, then change the encrypt key
*/ */
it('testRdbStoreChangeEncryptKey0002', 0, async function (done) { it('testRdbStoreChangeEncryptKey0002', 0, async function (done) {
console.log(TAG + "************* testRdbStoreChangeEncryptKey0002 start *************"); console.info(TAG + "************* testRdbStoreChangeEncryptKey0002 start *************");
var u8 = new Uint8Array([1, 2, 3]) var u8 = new Uint8Array([1, 2, 3])
let result = 1; let result = 1;
{ {
...@@ -124,10 +124,10 @@ describe('rdbStoreInsertTest_insert1', function () { ...@@ -124,10 +124,10 @@ describe('rdbStoreInsertTest_insert1', function () {
} catch (e) { } catch (e) {
expect(1).assertEqual(result); expect(1).assertEqual(result);
console.log(TAG + "can not change encrypt key, since config with no key"); console.info(TAG + "can not change encrypt key, since config with no key");
} }
done() done()
console.log(TAG + "************* testRdbStoreChangeEncryptKey0002 end *************"); console.info(TAG + "************* testRdbStoreChangeEncryptKey0002 end *************");
}) })
/** /**
...@@ -137,7 +137,7 @@ describe('rdbStoreInsertTest_insert1', function () { ...@@ -137,7 +137,7 @@ describe('rdbStoreInsertTest_insert1', function () {
* now sqlite does not support this feature, switch encrypt to non-encrypt. * now sqlite does not support this feature, switch encrypt to non-encrypt.
*/ */
it('testRdbStoreChangeEncryptKey0003', 0, async function (done) { it('testRdbStoreChangeEncryptKey0003', 0, async function (done) {
console.log(TAG + "************* testRdbStoreChangeEncryptKey0003 start *************"); console.info(TAG + "************* testRdbStoreChangeEncryptKey0003 start *************");
let result = -1; let result = -1;
var u8 = new Uint8Array([1, 2, 3]) var u8 = new Uint8Array([1, 2, 3])
{ {
...@@ -153,12 +153,12 @@ describe('rdbStoreInsertTest_insert1', function () { ...@@ -153,12 +153,12 @@ describe('rdbStoreInsertTest_insert1', function () {
result = await rdbStore.changeEncryptKey(new Uint8Array()); result = await rdbStore.changeEncryptKey(new Uint8Array());
} catch (e) { } catch (e) {
expect(-1).assertEqual(result); expect(-1).assertEqual(result);
console.log(TAG + "can not clear encrypt key 2"); console.info(TAG + "can not clear encrypt key 2");
} }
done() done()
console.log(TAG + "************* testRdbStoreChangeEncryptKey0003 end *************"); console.info(TAG + "************* testRdbStoreChangeEncryptKey0003 end *************");
}) })
console.log(TAG + "*************Unit Test End*************"); console.info(TAG + "*************Unit Test End*************");
}) })
\ No newline at end of file
...@@ -25,7 +25,7 @@ const STORE_CONFIG = { ...@@ -25,7 +25,7 @@ const STORE_CONFIG = {
var rdbStore = undefined; var rdbStore = undefined;
describe('rdbStoreInsertTest_insert2', function () { describe('rdbstoreInsertTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1); rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
...@@ -47,7 +47,7 @@ describe('rdbStoreInsertTest_insert2', function () { ...@@ -47,7 +47,7 @@ describe('rdbStoreInsertTest_insert2', function () {
await dataRdb.deleteRdbStore("InsertTest.db"); await dataRdb.deleteRdbStore("InsertTest.db");
}) })
console.log(TAG + "*************Unit Test Begin*************"); console.info(TAG + "*************Unit Test Begin*************");
/** /**
* @tc.name rdb insert test * @tc.name rdb insert test
...@@ -55,7 +55,7 @@ describe('rdbStoreInsertTest_insert2', function () { ...@@ -55,7 +55,7 @@ describe('rdbStoreInsertTest_insert2', function () {
* @tc.desc rdb insert test * @tc.desc rdb insert test
*/ */
it('testRdbStoreInsert0001', 0, async function (done) { it('testRdbStoreInsert0001', 0, async function (done) {
console.log(TAG + "************* testRdbStoreInsert0001 start *************"); console.info(TAG + "************* testRdbStoreInsert0001 start *************");
var u8 = new Uint8Array([1, 2, 3]) var u8 = new Uint8Array([1, 2, 3])
{ {
const valueBucket = { const valueBucket = {
...@@ -89,14 +89,14 @@ describe('rdbStoreInsertTest_insert2', function () { ...@@ -89,14 +89,14 @@ describe('rdbStoreInsertTest_insert2', function () {
predicates.equalTo("name", "zhangsan") predicates.equalTo("name", "zhangsan")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
console.log(TAG + "resultSet query done"); console.info(TAG + "resultSet query done");
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
const id = resultSet.getLong(resultSet.getColumnIndex("id")) const id = resultSet.getLong(resultSet.getColumnIndex("id"))
const name = resultSet.getString(resultSet.getColumnIndex("name")) const name = resultSet.getString(resultSet.getColumnIndex("name"))
const age = resultSet.getLong(resultSet.getColumnIndex("age")) const age = resultSet.getLong(resultSet.getColumnIndex("age"))
const salary = resultSet.getDouble(resultSet.getColumnIndex("salary")) const salary = resultSet.getDouble(resultSet.getColumnIndex("salary"))
const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType")) const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType"))
console.log(TAG + "id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", blobType=" + blobType); console.info(TAG + "id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", blobType=" + blobType);
expect(1).assertEqual(id); expect(1).assertEqual(id);
expect("zhangsan").assertEqual(name) expect("zhangsan").assertEqual(name)
expect(18).assertEqual(age) expect(18).assertEqual(age)
...@@ -106,11 +106,11 @@ describe('rdbStoreInsertTest_insert2', function () { ...@@ -106,11 +106,11 @@ describe('rdbStoreInsertTest_insert2', function () {
expect(3).assertEqual(blobType[2]) expect(3).assertEqual(blobType[2])
expect(false).assertEqual(resultSet.goToNextRow()) expect(false).assertEqual(resultSet.goToNextRow())
} catch (e) { } catch (e) {
console.log("insert1 error " + e); console.info("insert1 error " + e);
} }
resultSet = null resultSet = null
done() done()
console.log(TAG + "************* testRdbStoreInsert0001 end *************"); console.info(TAG + "************* testRdbStoreInsert0001 end *************");
}) })
/** /**
...@@ -119,7 +119,7 @@ describe('rdbStoreInsertTest_insert2', function () { ...@@ -119,7 +119,7 @@ describe('rdbStoreInsertTest_insert2', function () {
* @tc.desc rdb insert test * @tc.desc rdb insert test
*/ */
it('testRdbStoreInsert0002', 0, async function (done) { it('testRdbStoreInsert0002', 0, async function (done) {
console.log(TAG + "************* testRdbStoreInsert0002 start *************"); console.info(TAG + "************* testRdbStoreInsert0002 start *************");
var u8 = new Uint8Array([1, 2, 3]) var u8 = new Uint8Array([1, 2, 3])
{ {
const valueBucket = { const valueBucket = {
...@@ -131,14 +131,14 @@ describe('rdbStoreInsertTest_insert2', function () { ...@@ -131,14 +131,14 @@ describe('rdbStoreInsertTest_insert2', function () {
let insertPromise = rdbStore.insert("wrong", valueBucket) let insertPromise = rdbStore.insert("wrong", valueBucket)
insertPromise.then(async (ret) => { insertPromise.then(async (ret) => {
expect(1).assertEqual(ret) expect(1).assertEqual(ret)
console.log(TAG + "insert first done: " + ret) console.info(TAG + "insert first done: " + ret)
expect(null).assertFail() expect(null).assertFail()
}).catch((err) => { }).catch((err) => {
console.log(TAG + "insert with wrong table") console.info(TAG + "insert with wrong table")
}) })
} }
done() done()
console.log(TAG + "************* testRdbStoreInsert0002 end *************"); console.info(TAG + "************* testRdbStoreInsert0002 end *************");
}) })
/** /**
...@@ -147,7 +147,7 @@ describe('rdbStoreInsertTest_insert2', function () { ...@@ -147,7 +147,7 @@ describe('rdbStoreInsertTest_insert2', function () {
* @tc.desc rdb insert test * @tc.desc rdb insert test
*/ */
it('testRdbStoreInsert0003', 0, async function (done) { it('testRdbStoreInsert0003', 0, async function (done) {
console.log(TAG + "************* testRdbStoreInsert0003 start *************"); console.info(TAG + "************* testRdbStoreInsert0003 start *************");
var u8 = new Uint8Array([1, 2, 3]) var u8 = new Uint8Array([1, 2, 3])
{ {
const valueBucket = { const valueBucket = {
...@@ -159,14 +159,14 @@ describe('rdbStoreInsertTest_insert2', function () { ...@@ -159,14 +159,14 @@ describe('rdbStoreInsertTest_insert2', function () {
let insertPromise = rdbStore.insert(null, valueBucket) let insertPromise = rdbStore.insert(null, valueBucket)
insertPromise.then(async (ret) => { insertPromise.then(async (ret) => {
expect(1).assertEqual(ret) expect(1).assertEqual(ret)
console.log(TAG + "insert first done: " + ret) console.info(TAG + "insert first done: " + ret)
expect(null).assertFail() expect(null).assertFail()
}).catch((err) => { }).catch((err) => {
console.log(TAG + "insert with null table") console.info(TAG + "insert with null table")
}) })
} }
done() done()
console.log(TAG + "************* testRdbStoreInsert0003 end *************"); console.info(TAG + "************* testRdbStoreInsert0003 end *************");
}) })
console.log(TAG + "*************Unit Test End*************"); console.info(TAG + "*************Unit Test End*************");
}) })
\ No newline at end of file
...@@ -19,7 +19,7 @@ import storage from '@ohos.data.storage' ...@@ -19,7 +19,7 @@ import storage from '@ohos.data.storage'
const PATH = '/data/storage/el2/database/test_storage'; const PATH = '/data/storage/el2/database/test_storage';
var mPref; var mPref;
describe('storageTest_storage3', function () { describe('storageHelperTest', function () {
beforeAll(function () { beforeAll(function () {
console.info('beforeAll') console.info('beforeAll')
mPref = storage.getStorageSync(PATH); mPref = storage.getStorageSync(PATH);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册