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

<liangzhenyu6@huawei.com>

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