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

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

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