未验证 提交 64004f9d 编写于 作者: O openharmony_ci 提交者: Gitee

!6372 【Distributeddatamgr】【monthly_20221018】用例优化

Merge pull request !6372 from 梁梁/monthly_20221018
......@@ -2337,14 +2337,24 @@ describe('SingleKvStoreCallbackTest', function () {
*/
it('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULT_CALLBACK_8200', 0, async function (done) {
console.info('SingleKvStoreCloseResultSetCallbackTest004');
try {
console.info('SingleKvStoreCloseResultSetCallbackTest004 success');
}catch(e) {
console.error('SingleKvStoreCloseResultSetCallbackTest004 e ' + `, error code is ${e.code}, message is ${e.message}`);
let resultSet = null;
await kvStore.getResultSet('batch_test_string_key').then((result) => {
console.info('SingleKvStoreCloseResultSetCallbackTest004 getResultSet success');
resultSet = result;
})
try{
kvStore.closeResultSet("",(err, data) => {
console.info('SingleKvStoreCloseResultSetCallbackTest004 close result finish')
expect(null).assertFail();
})
}catch(err){
expect(err.code).assertEqual("401")
}
done();
})
});
/**
* @tc.number SUB_DDM_DKV_SINGLEKVSTORE_GETENTRIES_CALLBACK_8300
......
......@@ -2661,7 +2661,7 @@ describe('SingleKvStorePromiseTest', function () {
console.info('SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0500 putBatch success');
expect(err == undefined).assertTrue();
}).catch((err) => {
console.error('SUB_DDM_DKV_SINGLEKVSTORE_SETSYNCRANGE_PROMISE_0100 putBatch fail ' + `, error code is ${err.code}, message is ${err.message}`);
console.error('SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0500 putBatch fail ' + `, error code is ${err.code}, message is ${err.message}`);
expect(null).assertFail();
});
var query = new factory.Query();
......@@ -2714,7 +2714,7 @@ describe('SingleKvStorePromiseTest', function () {
console.info('SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0600 putBatch success');
expect(err == undefined).assertTrue();
}).catch((err) => {
console.error('SUB_DDM_DKV_SINGLEKVSTORE_SETSYNCRANGE_PROMISE_0100 putBatch fail ' + `, error code is ${err.code}, message is ${err.message}`);
console.error('SUB_DDM_DKV_SINGLEKVSTORE_GETSECURITYLEVEL_PROMISE_0600 putBatch fail ' + `, error code is ${err.code}, message is ${err.message}`);
expect(null).assertFail();
});
var query = new factory.Query();
......@@ -2850,8 +2850,7 @@ describe('SingleKvStorePromiseTest', function () {
it('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0200', 0, async function (done) {
console.info('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0200');
try {
console.info('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0200 success');
let resultSet = null;
let resultSet = undefined;
await kvStore.getResultSet('batch_test_string_key').then((result) => {
console.info('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0200 getResultSet success');
resultSet = result;
......@@ -2904,13 +2903,24 @@ describe('SingleKvStorePromiseTest', function () {
* @tc.name Test Js Api SingleKvStoreCloseResultSet testcase 004
*/
it('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400', 0, async function (done) {
console.info('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400');
let resultSet = undefined;
let errorInfo = undefined;
await kvStore.getResultSet('batch_test_string_key').then((result) => {
console.info('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400 getResultSet success');
resultSet = result;
}).catch((err) => {
console.error('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400 getResultSet fail ' + `, error code is ${err.code}, message is ${err.message}`);
expect(null).assertFail();
});
try {
kvStore.closeResultSet("")
console.info('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400 success');
}catch(e) {
console.error('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400 e ' + `, error code is ${e.code}, message is ${e.message}`);
expect(null).assertFail();
}catch(err) {
console.error('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULTSET_PROMISE_0400 e ' + `, error code is ${err.code}, message is ${err.message}`);
errorInfo = err
}
expect(errorInfo.code).assertEqual("401");
done();
})
......
......@@ -2262,15 +2262,24 @@ describe('singleKvStoreCallbackTest', function () {
* @tc.desc Test Js Api SingleKvStore.CloseResultSet() testcase 104
*/
it('testSingleKvStoreCloseResultSet104', 0, async function (done) {
console.info('testSingleKvStoreCloseResultSet104');
try {
console.info('testSingleKvStoreCloseResultSet104 success');
}catch(e) {
console.info('testSingleKvStoreCloseResultSet104 e ' + e);
console.info('SingleKvStoreCloseResultSetCallbackTest004');
let resultSet = null;
await kvStore.getResultSet('batch_test_string_key').then((result) => {
console.info('SingleKvStoreCloseResultSetCallbackTest004 getResultSet success');
resultSet = result;
})
kvStore.closeResultSet("",(err, data) => {
if(err != undefined){
console.info(`SingleKvStoreCloseResultSetCallbackTest004 close result error, error is ${err}`)
}else{
expect(null).assertFail();
}
done();
})
await sleep(1000)
done();
})
/**
* @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_GETRESULTSIZE_1010
......
......@@ -2470,12 +2470,12 @@ describe('singleKvStorePromiseTest', function () {
*/
it('testSingleKvStoreCloseResultSet004', 0, async function (done) {
console.info('testSingleKvStoreCloseResultSet004');
try {
console.info('testSingleKvStoreCloseResultSet004 success');
}catch(e) {
console.info('testSingleKvStoreCloseResultSet004 e ' + e);
await kvStore.closeResultSet("").then((data) => {
console.info("testSingleKvStoreCloseResultSet004 close resultSet success")
expect(null).assertFail();
}
}).catch((err) => {
console.info(`testSingleKvStoreCloseResultSet004 close resultSet error, error is ${err}`)
})
done();
})
......
......@@ -15,7 +15,9 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import dataRdb from '@ohos.data.rdb';
import abilityFeatureAbility from '@ohos.ability.featureAbility';
let context = abilityFeatureAbility.getContext();
const TAG = "[RDB_JSKITS_TEST_Distributed]"
const STORE_NAME = "distributed_rdb.db"
var rdbStore = undefined;
......@@ -311,6 +313,34 @@ describe('rdbStoreDistributedTest', function () {
console.info(TAG + "************* testRdbStoreDistributed0011 end *************");
})
/**
* @tc.name sync test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100
* @tc.desc sync test
*/
it('SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100', 0, async function (done) {
console.info(TAG + "************* SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S1
}
await dataRdb.getRdbStoreV9(context, config, 1).then(async (store) => {
let predicates = new dataRdb.RdbPredicatesV9("employee")
predicates = predicates.inDevices("12345678abcd");
try {
store.sync(dataRdb.SyncMode.SYNC_MODE_PUSH, predicates);
} catch (err) {
expect(null).assertFail();
}
}).catch((err) => {
expect(null).assertFail();
})
await dataRdb.deleteRdbStore(context,"secure.db");
done();
console.info(TAG + "************* SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100 end *************");
})
/**
* @tc.name sync Callback test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Distributed_Callback_011
......
......@@ -34,13 +34,13 @@ describe('rdbStoreDistributedTest', function () {
})
beforeEach(async function () {
rdbStore = await dataRdb.getRdbStore(context, config, 1);
rdbStore = await dataRdb.getRdbStoreV9(context, config, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null)
console.info(TAG + 'beforeEach')
})
afterEach(async function () {
await dataRdb.deleteRdbStore(context, STORE_NAME);
await dataRdb.deleteRdbStoreV9(context, STORE_NAME);
console.info(TAG + 'afterEach')
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册