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

!9709 【Distributeddatamgr】【Master】用例优化rdb/relationalstore用例优化

Merge pull request !9709 from yanglifeng/master
......@@ -264,14 +264,15 @@ describe('rdbStoreDistributedTest', function () {
console.info(TAG + "************* testRdbStoreDistributed0009 start *************");
let predicates = new dataRdb.RdbPredicates("employee")
try {
predicates = predicates.inDevices("1234567890");
console.info(TAG + "inDevices success");
expect(predicates).assertEqual(predicates);
let pr = predicates.inDevices(['1234567890']);
console.info(TAG + "inDevices success" + pr);
expect(pr !== null).assertTrue();
done();
} catch (err) {
console.info(TAG + "inDevices failed");
expect(null).assertFail();
done();
}
done();
console.info(TAG + "************* testRdbStoreDistributed0009 end *************");
})
......@@ -303,13 +304,14 @@ describe('rdbStoreDistributedTest', function () {
it('testRdbStoreDistributed0011', 0, async function (done) {
console.info(TAG + "************* testRdbStoreDistributed0011 start *************");
let predicates = new dataRdb.RdbPredicates("employee")
predicates = predicates.inDevices("12345678abcd");
rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PUSH, predicates);
let pr = predicates.inDevices(['12345678abcd']);
console.info(TAG + "testRdbStoreDistributed0011" + pr);
let push = rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PUSH, predicates);
console.info(TAG + "sync push success");
expect(rdbStore).assertEqual(rdbStore);
rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PULL, predicates);
expect(push !== null).assertTrue();
let pull = rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PULL, predicates);
console.info(TAG + "sync pull success");
expect(rdbStore).assertEqual(rdbStore);
expect(pull !== null).assertTrue();
done();
console.info(TAG + "************* testRdbStoreDistributed0011 end *************");
})
......@@ -325,18 +327,17 @@ describe('rdbStoreDistributedTest', function () {
return new Promise(resolve => setTimeout(resolve, ms));
}
let predicates = new dataRdb.RdbPredicates("employee")
predicates = predicates.inDevices("12345678abcd");
rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PUSH, predicates,(err,ret)=>{
let pr = predicates.inDevices(['12345678abcd']);
console.info(TAG + " testRdbStoreDistributedCallback0011 pr = " + pr);
await rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PUSH, predicates, async (err,ret)=>{
console.info(TAG + "sync push success");
expect(rdbStore).assertEqual(rdbStore);
rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PULL, predicates,(err,ret)=>{
console.info(TAG + "sync push success");
expect(rdbStore).assertEqual(rdbStore);
expect(err !== null).assertTrue();
await rdbStore.sync(dataRdb.SyncMode.SYNC_MODE_PULL, predicates,(err,ret)=>{
console.info(TAG + "sync pull success");
expect(err !== null).assertTrue();
done();
});
done();
});
await sleep(2000)
done();
console.info(TAG + "************* testRdbStoreDistributedCallback0011 end *************");
})
......
......@@ -298,14 +298,15 @@ describe('relationalStoreDistributedTest', function () {
console.info(TAG + "************* testRdbStoreDistributed0009 start *************");
let predicates = new data_Rdb.RdbPredicates("employee")
try {
predicates = predicates.inDevices("1234567890");
let pr = predicates.inDevices(["1234567890"]);
console.info(TAG + "inDevices success");
expect(predicates).assertEqual(predicates);
expect(pr !== null).assertTrue();
done();
} catch (err) {
console.info(TAG + "inDevices failed");
expect(null).assertFail();
done();
}
done();
console.info(TAG + "************* testRdbStoreDistributed0009 end *************");
})
......@@ -337,13 +338,13 @@ describe('relationalStoreDistributedTest', function () {
it('testRdbStoreDistributed0011', 0, async function (done) {
console.info(TAG + "************* testRdbStoreDistributed0011 start *************");
let predicates = new data_Rdb.RdbPredicates("employee")
predicates = predicates.inDevices("12345678abcd");
rdbStore.sync(data_Rdb.SyncMode.SYNC_MODE_PUSH, predicates);
let pr = predicates.inDevices(["12345678abcd"]);
let push = rdbStore.sync(data_Rdb.SyncMode.SYNC_MODE_PUSH, predicates);
expect(push !== null).assertTrue();
console.info(TAG + "sync push success");
expect(rdbStore).assertEqual(rdbStore);
rdbStore.sync(data_Rdb.SyncMode.SYNC_MODE_PULL, predicates);
let pull = rdbStore.sync(data_Rdb.SyncMode.SYNC_MODE_PULL, predicates);
console.info(TAG + "sync pull success");
expect(rdbStore).assertEqual(rdbStore);
expect(pull !== null).assertTrue();
done();
console.info(TAG + "************* testRdbStoreDistributed0011 end *************");
})
......@@ -359,18 +360,16 @@ describe('relationalStoreDistributedTest', function () {
return new Promise(resolve => setTimeout(resolve, ms));
}
let predicates = new data_Rdb.RdbPredicates("employee")
predicates = predicates.inDevices("12345678abcd");
rdbStore.sync(data_Rdb.SyncMode.SYNC_MODE_PUSH, predicates,(err,ret)=>{
predicates = predicates.inDevices(["12345678abcd"]);
await rdbStore.sync(data_Rdb.SyncMode.SYNC_MODE_PUSH, predicates, async (err,ret)=>{
console.info(TAG + "sync push success");
expect(rdbStore).assertEqual(rdbStore);
rdbStore.sync(data_Rdb.SyncMode.SYNC_MODE_PULL, predicates,(err,ret)=>{
expect(err !== null).assertTrue();
await rdbStore.sync(data_Rdb.SyncMode.SYNC_MODE_PULL, predicates,(err,ret)=>{
console.info(TAG + "sync push success");
expect(rdbStore).assertEqual(rdbStore);
expect(err !== null).assertTrue();
done();
});
done();
});
await sleep(2000)
done();
console.info(TAG + "************* testRdbStoreDistributedCallback0011 end *************");
})
......@@ -451,14 +450,14 @@ describe('relationalStoreDistributedTest', function () {
done();
})
/**
* @tc.name sync test
* @tc.number SUB_DDM_AppDataFWK_JSRelationalStore_Distributed_016
* @tc.desc sync test
*/
/**
* @tc.name sync test
* @tc.number SUB_DDM_AppDataFWK_JSRelationalStore_Distributed_016
* @tc.desc sync test
*/
it('SUB_DDM_AppDataFWK_JSRelationalStore_Distributed_016', 0, function (done) {
let predicates = new data_Rdb.RdbPredicates("employee")
predicates = predicates.inDevices("12345678abcd");
predicates = predicates.inDevices(["12345678abcd"]);
console.info(TAG + `SYNC_MODE_TIME_FIRST = ` + data_Rdb.SyncMode.SYNC_MODE_TIME_FIRST);
expect(data_Rdb.SyncMode.SYNC_MODE_TIME_FIRST).assertEqual(4);
console.info(TAG + "DATA_CHANGE = " + data_Rdb.ChangeType.DATA_CHANGE);
......@@ -488,7 +487,7 @@ describe('relationalStoreDistributedTest', function () {
*/
it('SUB_DDM_AppDataFWK_JSRelationalStore_Distributed_017', 0, function (done) {
let predicates = new data_Rdb.RdbPredicates("employee")
predicates = predicates.inDevices("12345678abcd");
predicates = predicates.inDevices(["12345678abcd"]);
console.info(TAG + `SYNC_MODE_NATIVE_FIRST = ` + data_Rdb.SyncMode.SYNC_MODE_NATIVE_FIRST);
expect(data_Rdb.SyncMode.SYNC_MODE_NATIVE_FIRST).assertEqual(5);
try{
......@@ -514,7 +513,7 @@ describe('relationalStoreDistributedTest', function () {
*/
it('SUB_DDM_AppDataFWK_JSRelationalStore_Distributed_018', 0, function (done) {
let predicates = new data_Rdb.RdbPredicates("employee")
predicates = predicates.inDevices("12345678abcd");
predicates = predicates.inDevices(["12345678abcd"]);
console.info(TAG + `SYNC_MODE_CLOUD_FIRST = ` + data_Rdb.SyncMode.SYNC_MODE_CLOUD_FIRST);
expect(data_Rdb.SyncMode.SYNC_MODE_CLOUD_FIRST).assertEqual(6);
try{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册