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

!5221 【Distributeddatamgr】【master】解决用例失败问题

Merge pull request !5221 from 梁梁/master
......@@ -44,7 +44,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name clear callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0010
* @tc.number SUB_DDM_Preferences_Clear_CallBack_0010
* @tc.desc clear callback interface test
*/
it('testPreferencesClear0012', 0, async function (done) {
......@@ -59,7 +59,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name has string callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0020
* @tc.number SUB_DDM_Preferences_Has_CallBack_0020
* @tc.desc has string callback interface test
*/
it('testPreferencesHasKey0032', 0, async function (done) {
......@@ -72,7 +72,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name has int callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0130
* @tc.number SUB_DDM_Preferences_Has_CallBack_0030
* @tc.desc has int callback interface test
*/
it('testPreferencesHasKey0033', 0, async function (done) {
......@@ -85,7 +85,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name has float callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0140
* @tc.number SUB_DDM_Preferences_Has_CallBack_0040
* @tc.desc has float callback interface test
*/
it('testPreferencesHasKey0034', 0, async function (done) {
......@@ -98,7 +98,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name has long callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0150
* @tc.number SUB_DDM_Preferences_Has_CallBack_0050
* @tc.desc has long callback interface test
*/
it('testPreferencesHasKey0035', 0, async function (done) {
......@@ -111,7 +111,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name has boolean callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0160
* @tc.number SUB_DDM_Preferences_Has_CallBack_0060
* @tc.desc has boolean callback interface test
*/
it('testPreferencesHasKey0036', 0, async function (done) {
......@@ -124,7 +124,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name get defaultValue callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0030
* @tc.number SUB_DDM_Preferences_Get_CallBack_0070
* @tc.desc get defaultValue callback interface test
*/
it('testPreferencesGetDefValue0062', 0, async function (done) {
......@@ -137,7 +137,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name get float callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0040
* @tc.number SUB_DDM_Preferences_Get_CallBack_0080
* @tc.desc get float callback interface test
*/
it('testPreferencesGetFloat0072', 0, async function (done) {
......@@ -151,7 +151,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name get int callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0050
* @tc.number SUB_DDM_Preferences_Get_CallBack_0090
* @tc.desc get int callback interface test
*/
it('testPreferencesGetInt0082', 0, async function (done) {
......@@ -165,7 +165,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name get long callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0060
* @tc.number SUB_DDM_Preferences_Get_CallBack_0100
* @tc.desc get long callback interface test
*/
it('testPreferencesGetLong0092', 0, async function (done) {
......@@ -181,7 +181,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name get String callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0070
* @tc.number SUB_DDM_Preferences_Get_CallBack_0110
* @tc.desc get String callback interface test
*/
it('testPreferencesGetString102', 0, async function (done) {
......@@ -196,7 +196,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name put boolean callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0080
* @tc.number SUB_DDM_Preferences_Put_CallBack_0120
* @tc.desc put boolean callback interface test
*/
it('testPreferencesPutBoolean0122', 0, async function (done) {
......@@ -213,7 +213,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name put float callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0090
* @tc.number SUB_DDM_Preferences_Put_CallBack_0130
* @tc.desc put float callback interface test
*/
it('testPreferencesPutFloat0132', 0, async function (done) {
......@@ -230,7 +230,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name put int callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0100
* @tc.number SUB_DDM_Preferences_Put_CallBack_0140
* @tc.desc put int callback interface test
*/
it('testPreferencesPutInt0142', 0, async function (done) {
......@@ -247,7 +247,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name put long callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0110
* @tc.number SUB_DDM_Preferences_Put_CallBack_0150
* @tc.desc put long callback interface test
*/
it('testPreferencesPutLong0152', 0, async function (done) {
......@@ -265,7 +265,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name put String callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0120
* @tc.number SUB_DDM_Preferences_Put_CallBack_0160
* @tc.desc put String callback interface test
*/
it('testPreferencesPutString0162', 0, async function (done) {
......@@ -282,7 +282,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name clear、put、get、flush String callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0120
* @tc.number SUB_DDM_Preferences_Flush_CallBack_0170
* @tc.desc flush String callback interface test
*/
it('testPreferencesCallback0172', 0, function (done) {
......@@ -320,7 +320,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name put StringArray callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0001
* @tc.number SUB_DDM_Preferences_Put_CallBack_0180
* @tc.desc put String callback interface test
*/
it('testPreferencesPutStringArray0001', 0, async function (done) {
......@@ -338,7 +338,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name put NumberArray callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0002
* @tc.number SUB_DDM_Preferences_Put_CallBack_0190
* @tc.desc put String callback interface test
*/
it('testPreferencesPutNumArray0001', 0, async function (done) {
......@@ -356,7 +356,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name put BoolArray callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0003
* @tc.number SUB_DDM_Preferences_Put_CallBack_0200
* @tc.desc put String callback interface test
*/
it('testPreferencesPutBoolArray0001', 0, async function (done) {
......@@ -374,7 +374,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name getAll callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0004
* @tc.number SUB_DDM_Preferences_GetAll_CallBack_0210
* @tc.desc getAll callback interface test
*/
it('testPreferencesGetAll0001', 0, async function (done) {
......@@ -416,7 +416,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name getPreferences callback interface test
* @tc.number SUB_DDM_AppDataFWK_GetPreferencesTest_CallBack_0001
* @tc.number SUB_DDM_Preferences_GetPreferencesTest_CallBack_0220
* @tc.desc getPreferences callback interface test
*/
it('testPreferencesGetPreferences0001', 0, async function (done) {
......@@ -435,7 +435,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name deletePreferences callback interface test
* @tc.number SUB_DDM_AppDataFWK_DeletePreferencesTest_CallBack_0001
* @tc.number SUB_DDM_Preferences_DeletePreferencesTest_CallBack_0230
* @tc.desc deletePreferences callback interface test
*/
it('testPreferencesDeletePreferences0001', 0, async function (done) {
......@@ -463,7 +463,7 @@ describe('preferencesCallBackTest', function () {
/**
* @tc.name removePreferencesFromCache interface test
* @tc.number SUB_DDM_AppDataFWK_RemovePreferencesFromCache_CallBack_0001
* @tc.number SUB_DDM_Preferences_RemovePreferencesFromCache_CallBack_0240
* @tc.desc removePreferencesFromCache interface test
*/
it('testRemovePreferencesFromCache0001', 0, async function (done) {
......
......@@ -36,7 +36,7 @@ describe('preferencesHelperTest', function () {
/**
* @tc.name getPreferencesSync interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0010
* @tc.number SUB_DDM_Preferences_GetPreferences_Helper_0010
* @tc.desc getPreferencesSync interface test
*/
it('testGetPreferencesHelper001', 0, async function () {
......@@ -49,7 +49,7 @@ describe('preferencesHelperTest', function () {
/**
* @tc.name getPreferences interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0020
* @tc.number SUB_DDM_Preferences_GetPreferences_Helper_0020
* @tc.desc getPreferences interface test
*/
it('testGetPreferencesHelper002', 0, async function (done) {
......@@ -68,7 +68,7 @@ describe('preferencesHelperTest', function () {
/**
* @tc.name removePreferencesFromCache interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0030
* @tc.number SUB_DDM_Preferences_GetPreferences_Helper_0030
* @tc.desc removePreferencesFromCache interface test
*/
it('testRemovePreferencesFromCache001', 0, async function (done) {
......@@ -85,7 +85,7 @@ describe('preferencesHelperTest', function () {
/**
* @tc.name deletePreferences interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0060
* @tc.number SUB_DDM_Preferences_GetPreferences_Helper_0040
* @tc.desc deletePreferences interface test
*/
it('testDeletePreferencesHelper002', 0, async function (done) {
......@@ -102,7 +102,7 @@ describe('preferencesHelperTest', function () {
/**
* @tc.name put interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_0140
* @tc.number SUB_DDM_Preferences_Put_Helper_0050
* @tc.desc put interface test
*/
it('testPreferencesRegisterObserver001', 0, async function () {
......@@ -117,7 +117,7 @@ describe('preferencesHelperTest', function () {
/**
* @tc.name repeat on interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_0150
* @tc.number SUB_DDM_Preferences_On_Helper_0060
* @tc.desc repeat on interface test
*/
it('testPreferencesRegisterObserver002', 0, async function () {
......@@ -133,7 +133,7 @@ describe('preferencesHelperTest', function () {
/**
* @tc.name off interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_0160
* @tc.number SUB_DDM_Preferences_Off_Helper_0070
* @tc.desc off interface test
*/
it('testPreferencesUnRegisterObserver001', 0, async function () {
......
......@@ -43,7 +43,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name put StringArray promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0131
* @tc.number SUB_DDM_Preferences_Put_Promise_0010
* @tc.desc put StringArray promise interface test
*/
it('testPreferencesPutStringArray0131', 0, async function (done) {
......@@ -67,7 +67,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name put NumberArray promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0132
* @tc.number SUB_DDM_Preferences_Put_Promise_0020
* @tc.desc put NumberArray promise interface test
*/
it('testPreferencesPutNumberArray0132', 0, async function (done) {
......@@ -90,7 +90,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name put BoolArray promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0133
* @tc.number SUB_DDM_Preferences_Put_Promise_0030
* @tc.desc put BoolArray promise interface test
*/
it('testPreferencesPutBoolArray0133', 0, async function (done) {
......@@ -113,7 +113,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name getAll promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0133
* @tc.number SUB_DDM_Preferences_GetAll_Promise_0040
* @tc.desc getAll promise interface test
*/
it('testPreferencesGetAll0001', 0, async function (done) {
......@@ -159,7 +159,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name clear promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Promise_0010
* @tc.number SUB_DDM_Preferences_Clear_Promise_0050
* @tc.desc clear promise interface test
*/
it('testPreferencesClear0011', 0, async function (done) {
......@@ -178,7 +178,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name has string interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0020
* @tc.number SUB_DDM_Preferences_Has_Promise_0060
* @tc.desc has string interface test
*/
it('testPreferencesHasKey0031', 0, async function (done) {
......@@ -195,7 +195,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name has int interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0140
* @tc.number SUB_DDM_Preferences_Has_Promise_0070
* @tc.desc has int interface test
*/
it('testPreferencesHasKey0032', 0, async function (done) {
......@@ -212,7 +212,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name has float interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0150
* @tc.number SUB_DDM_Preferences_Put_Promise_0080
* @tc.desc has float interface test
*/
it('testPreferencesHasKey0033', 0, async function (done) {
......@@ -229,7 +229,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name has boolean interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0160
* @tc.number SUB_DDM_Preferences_Has_Promise_0090
* @tc.desc has boolean interface test
*/
it('testPreferencesHasKey0034', 0, async function (done) {
......@@ -246,7 +246,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name has long interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0170
* @tc.number SUB_DDM_Preferences_Put_Promise_0100
* @tc.desc has long interface test
*/
it('testPreferencesHasKey0035', 0, async function (done) {
......@@ -263,7 +263,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name get string promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0030
* @tc.number SUB_DDM_Preferences_Get_Promise_0110
* @tc.desc get string promise interface test
*/
it('testPreferencesGetDefValue0061', 0, async function (done) {
......@@ -280,7 +280,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name get float promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0040
* @tc.number SUB_DDM_Preferences_Get_Promise_0120
* @tc.desc get float promise interface test
*/
it('testPreferencesGetFloat0071', 0, async function (done) {
......@@ -298,7 +298,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name get int promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0050
* @tc.number SUB_DDM_Preferences_Put_Promise_0130
* @tc.desc get int promise interface test
*/
it('testPreferencesGetInt0081', 0, async function (done) {
......@@ -316,7 +316,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name get long promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0060
* @tc.number SUB_DDM_Preferences_Put_Promise_0140
* @tc.desc get long promise interface test
*/
it('testPreferencesGetLong0091', 0, async function (done) {
......@@ -334,7 +334,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name get String promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0070
* @tc.number SUB_DDM_Preferences_Get_Promise_0150
* @tc.desc get String promise interface test
*/
it('tesPreferencesGetString101', 0, async function (done) {
......@@ -353,7 +353,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name put boolean promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0090
* @tc.number SUB_DDM_Preferences_Put_Promise_0160
* @tc.desc put boolean promise interface test
*/
it('testPreferencesPutBoolean0121', 0, async function (done) {
......@@ -373,7 +373,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name put float promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0100
* @tc.number SUB_DDM_Preferences_Put_Promise_0170
* @tc.desc put float promise interface test
*/
it('testPreferencesPutFloat0131', 0, async function (done) {
......@@ -393,7 +393,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name put int promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0110
* @tc.number SUB_DDM_Preferences_Put_Promise_0180
* @tc.desc put int promise interface test
*/
it('testPreferencesPutInt0141', 0, async function (done) {
......@@ -413,7 +413,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name put long promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0120
* @tc.number SUB_DDM_Preferences_Put_Promise_0190
* @tc.desc put long promise interface test
*/
it('testPreferencesPutLong0151', 0, async function (done) {
......@@ -433,7 +433,7 @@ describe('preferencesPromiseTest', function () {
/**
* @tc.name put String promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0130
* @tc.number SUB_DDM_Preferences_Put_Promise_0200
* @tc.desc put String promise interface test
*/
it('testPreferencesPutString0161', 0, async function (done) {
......
......@@ -24,6 +24,41 @@ const STORE_CONFIG = {
const COLOUNM_NAMES = ["id","data1","data2","data3","data4"];
var rdbStore = undefined;
function createUint8Array(length) {
let i = 0
let index = 0
let temp = null
let u8 = new Uint8Array(length)
length = typeof (length) === 'undefined' ? 9 : length
for (i = 1; i <= length; i++) {
u8[i - 1] = i
}
for (i = 1; i <= length; i++) {
index = parseInt(Math.random() * (length - i)) + i
if (index != i) {
temp = u8[i - 1]
u8[i - 1] = u8[index - 1]
u8[index - 1] = temp
}
}
return u8;
}
async function createBigData(size) {
await rdbStore.executeSql("DELETE FROM test");
let u8 = createUint8Array(32768);
let valueBucketArray = new Array();
for (let i = 0; i < size; i++) {
valueBucketArray.push({
"data1": "test" + i,
"data2": 18,
"data3": 100.5,
"data4": u8,
});
}
await rdbStore.batchInsert("test", valueBucketArray);
}
export default function rdbResultSetTest() {
describe('rdbResultSetTest', function () {
beforeAll(async function () {
......@@ -214,20 +249,21 @@ describe('rdbResultSetTest', function () {
* @tc.desc resultSet isStarted normal test
*/
it('testIsStarted0003', 0, async function (done) {
console.info(TAG + '************* testIsStarted0003 start *************');
let predicates = await new dataRdb.RdbPredicates('test')
console.info(TAG + "************* testIsStarted0003 start *************");
let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates)
try {
expect(false).assertEqual(resultSet.isStarted)
expect(true).assertEqual(resultSet.goToNextRow())
expect(true).assertEqual(resultSet.isStarted)
expect(false).assertEqual(resultSet.goToPreviousRow())
expect(false).assertEqual(resultSet.isStarted)
expect(true).assertEqual(resultSet.isStarted)
} catch (e) {
expect(null).assertFail();
}
resultSet = null
done();
console.info(TAG + '************* testIsStarted0003 end *************');
console.info(TAG + "************* testIsStarted0003 end *************");
})
/**
......@@ -1769,6 +1805,94 @@ describe('rdbResultSetTest', function () {
}
})
/**
* @tc.name big resultSet data test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0250
* @tc.desc big resultSet data test
*/
it('testBigData0001', 0, async function (done) {
console.log(TAG + "************* testBigData0001 start *************");
{
await createBigData(500);
let resultSet = await rdbStore.querySql("SELECT * FROM test");
let count = resultSet.rowCount;
expect(500).assertEqual(count);
resultSet.goToFirstRow();
let i = 0;
while (resultSet.isEnded == false) {
expect("test" + i++).assertEqual(resultSet.getString(1))
resultSet.goToNextRow();
}
resultSet.close()
expect(true).assertEqual(resultSet.isClosed)
resultSet = null;
done();
console.log(TAG + "************* testBigData0001 end *************");
}
})
/**
* @tc.name big resultSet data test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0251
* @tc.desc big resultSet data test
*/
it('testBigData0002', 0, async function (done) {
console.log(TAG + "************* testBigData0002 start *************");
{
await createBigData(500);
let resultSet = await rdbStore.querySql("SELECT * FROM test");
let count = resultSet.rowCount;
expect(500).assertEqual(count);
resultSet.goToLastRow();
let i = resultSet.rowCount;
while (i >= 1) {
expect("test" + --i).assertEqual(resultSet.getString(1))
resultSet.goToPreviousRow();
}
resultSet.close()
expect(true).assertEqual(resultSet.isClosed)
resultSet = null;
done();
console.log(TAG + "************* testBigData0002 end *************");
}
})
/**
* @tc.name big resultSet data test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0252
* @tc.desc big resultSet data test
*/
it('testBigData0003', 0, async function (done) {
console.log(TAG + "************* testBigData0003 start *************");
{
await createBigData(1);
let resultSet = await rdbStore.querySql("SELECT * FROM test");
let count = resultSet.rowCount;
expect(1).assertEqual(count);
resultSet.goToFirstRow();
expect(true).assertEqual(resultSet.isStarted);
expect("test0").assertEqual(resultSet.getString(1))
let rows = [1, 2, -1, -2];
for (const i of rows) {
resultSet.goToRow(i);
expect(true).assertEqual(resultSet.isStarted);
expect("").assertEqual(resultSet.getString(1))
}
resultSet.close()
expect(true).assertEqual(resultSet.isClosed)
resultSet = null;
done();
console.log(TAG + "************* testBigData0003 end *************");
}
})
console.info(TAG + '*************Unit Test End*************');
})
}
......@@ -25,6 +25,7 @@ const STORE_CONFIG = {
}
var rdbStore = undefined;
var resultSet = undefined;
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
......@@ -320,7 +321,7 @@ describe('rdbstoreInsertTest', function () {
})
let predicates = new dataRdb.RdbPredicates("test2");
predicates.equalTo("name", "lisi")
resultSet = await rdbStore.query(predicates)
let resultSet = await rdbStore.query(predicates)
try {
console.info(TAG + "resultSet query done");
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -334,11 +335,11 @@ describe('rdbstoreInsertTest', function () {
expect("lisi").assertEqual(name)
expect(23).assertEqual(age)
expect(200).assertEqual(salary)
await rdbstore.delete(predicates).then((number) => {
await rdbStore.delete(predicates).then((number) => {
expect(1).assertEqual(number)
}).then(async () => {
resultSet = await rdbStore.query(predicates).catch((err) =>{
expect(true).assertTrue();
expect(err != null).assertTrue();
})
})
} catch (e) {
......@@ -393,6 +394,7 @@ describe('rdbstoreInsertTest', function () {
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.info(TAG + "id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", blobType=" + blobType);
expect(1).assertEqual(id);
expect("zhangsan").assertEqual(name)
......@@ -414,6 +416,7 @@ describe('rdbstoreInsertTest', function () {
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.info(TAG + "id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", blobType=" + blobType);
expect(2).assertEqual(id);
expect("lisi").assertEqual(name)
......@@ -425,7 +428,7 @@ describe('rdbstoreInsertTest', function () {
"salary": 500,
"blobType": u8,
}
await rdbstore.insert("test3",valueBucket4)
await rdbStore.insert("test3",valueBucket4)
predicates = new dataRdb.RdbPredicates("test3");
predicates.equalTo("name", "zhangmaowen")
resultSet = await rdbStore.query(predicates)
......@@ -488,6 +491,7 @@ describe('rdbstoreInsertTest', function () {
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.info(TAG + "id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", blobType=" + blobType);
expect(56).assertEqual(id);
expect("zhangsan55").assertEqual(name)
......@@ -594,11 +598,11 @@ describe('rdbstoreInsertTest', function () {
const valueBuckets = [valueBucket1, valueBucket2, valueBucket3]
try{
await rdbStore.batchInsert("test6","valueBuckets").catch((err) =>{
expect(true).assertTrue();
expect(err != null).assertTrue();
})
}catch(err){
console.info(TAG + "Batch insert data error: " + err)
expect(true).assertTrue();
expect(err != null).assertTrue();
}
done()
console.info(TAG + "************* testRdbStorebatchInsertPromise0006 end *************");
......@@ -614,11 +618,11 @@ describe('rdbstoreInsertTest', function () {
await rdbStore.executeSql(CREATE_TABLE_NAME + "7" + CREATE_TABLE)
try{
await rdbStore.batchInsert("test7").catch((err) =>{
expect(true).assertTrue();
expect(err != null).assertTrue();
})
}catch(err){
console.info(TAG + "Batch insert data error: " + err)
expect(true).assertTrue();
expect(err != null).assertTrue();
}
done()
console.info(TAG + "************* testRdbStorebatchInsertPromise0007 end *************");
......@@ -748,7 +752,7 @@ describe('rdbstoreInsertTest', function () {
expect(3).assertEqual(data)
let predicates = new dataRdb.RdbPredicates("testCallback2");
predicates.equalTo("name", "lisi")
resultSet = await rdbStore.query(predicates)
let resultSet = await rdbStore.query(predicates)
try {
console.info(TAG + "resultSet query done");
expect(true).assertEqual(resultSet.goToFirstRow())
......@@ -762,11 +766,11 @@ describe('rdbstoreInsertTest', function () {
expect("lisi").assertEqual(name)
expect(23).assertEqual(age)
expect(200).assertEqual(salary)
await rdbstore.delete(predicates).then((number) => {
await rdbStore.delete(predicates).then((number) => {
expect(1).assertEqual(number)
}).then(async () => {
resultSet = await rdbStore.query(predicates).catch((err) =>{
expect(true).assertTrue();
expect(err != null).assertTrue();
})
})
} catch (e) {
......@@ -856,7 +860,7 @@ describe('rdbstoreInsertTest', function () {
"salary": 500,
"blobType": u8,
}
await rdbstore.insert("testCallback3",valueBucket4)
await rdbStore.insert("testCallback3",valueBucket4)
predicates = new dataRdb.RdbPredicates("testCallback3");
predicates.equalTo("name", "zhangmaowen")
resultSet = await rdbStore.query(predicates)
......@@ -1034,14 +1038,14 @@ describe('rdbstoreInsertTest', function () {
try{
await rdbStore.batchInsert("testCallback6", "valueBuckets", (err, data) => {
if(err != null){
expect(true).assertTrue()
expect(err != null).assertTrue()
}else{
expect(false).assertTrue()
}
})
}catch(err){
console.info(TAG + "Batch insert data error: " + err)
expect(true).assertTrue();
expect(err != null).assertTrue();
}
})
......@@ -1059,15 +1063,15 @@ describe('rdbstoreInsertTest', function () {
console.info(TAG + "************* testRdbStorebatchInsertCallback0007 start *************");
try{
await rdbStore.executeSql(CREATE_TABLE_NAME + "Callback7" + CREATE_TABLE).then(async () => {
await rdbstore.batchInsert("testCallback7", (err,data) => {
await rdbStore.batchInsert("testCallback7", (err,data) => {
if(err != null){
expect(true).assertTrue();
expect(err != null).assertTrue();
}
})
})
}catch(err){
console.info(TAG + "Batch insert data error: " + err)
expect(true).assertTrue();
expect(err != null).assertTrue();
}
done()
console.info(TAG + "************* testRdbStorebatchInsertCallback0007 end *************");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册