diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js index f94d09e9131cd9c3b97de2052db064ee3bbd6f0c..50127167b04964d26cc5552b5b498dad5e80f80a 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js @@ -2105,7 +2105,7 @@ describe('deviceKvStoreCallbackTest', function () { * @tc.type: FUNC * @tc.name Test Js Api DeviceKvStore.GetResultSet() testcase 007 */ - it('SUB_DDM_DKV_DEVICESTORE_GETRESULTSET_0700', 0, async function (done) { + it('SUB_DDM_DKV_DEVICESTORE_GETRESULTSET_0700', 0, async function (done) { console.info('SUB_DDM_DKV_DEVICESTORE_GETRESULTSET_0700'); try { let resultSet; @@ -2124,9 +2124,9 @@ describe('deviceKvStoreCallbackTest', function () { await kvStore.putBatch(entries, async function (err, data) { console.info('SUB_DDM_DKV_DEVICESTORE_GETRESULTSET_0700 putBatch success'); expect(err == undefined).assertTrue(); - let predicates = new dataSharePredicates.DataSharePredicates(); - predicates.inKeys("batch_test"); - await kvStore.getResultSet(localDeviceId, predicates, async function (err, result) { + let query = new factory.Query(); + query.prefixKey("batch_test"); + await kvStore.getResultSet(localDeviceId, query, async function (err, result) { console.info('SUB_DDM_DKV_DEVICESTORE_GETRESULTSET_0700 getResultSet success'); resultSet = result; expect(resultSet.getCount() == 10).assertTrue(); diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js index 6a2869a9e80b984de57dc051bedd00ef8b151d6e..0c3949db395b14e3198abbffbc228480fcea57a5 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js @@ -2330,7 +2330,7 @@ describe('deviceKvStorePromiseTest', function () { * @tc.type: FUNC * @tc.name Test Js Api DeviceKvStore.getResultSet() testcase 007 */ - it('SUB_DDM_DKV_DEVICEKVSTORE_GETRESULTSET_PROMISE_0700', 0, async function (done) { + it('SUB_DDM_DKV_DEVICEKVSTORE_GETRESULTSET_PROMISE_0700', 0, async function (done) { console.info('SUB_DDM_DKV_DEVICEKVSTORE_GETRESULTSET_PROMISE_0700'); try { let resultSet; @@ -2349,9 +2349,9 @@ describe('deviceKvStorePromiseTest', function () { await kvStore.putBatch(entries).then( async (err) => { console.info('SUB_DDM_DKV_DEVICEKVSTORE_GETRESULTSET_PROMISE_0700 putBatch success'); expect(err == undefined).assertTrue(); - let predicates = new dataSharePredicates.DataSharePredicates(); - predicates.inKeys("batch_test"); - await kvStore.getResultSet(localDeviceId, predicates).then( async (result) => { + let query = new factory.Query(); + query.prefixKey("batch_test"); + await kvStore.getResultSet(localDeviceId, query).then( async (result) => { console.info('SUB_DDM_DKV_DEVICEKVSTORE_GETRESULTSET_PROMISE_0700 getResultSet success'); resultSet = result; expect(resultSet.getCount() == 10).assertTrue(); @@ -2367,7 +2367,7 @@ describe('deviceKvStorePromiseTest', function () { expect(null).assertFail(); done(); } - }) + }) /** * @tc.number SUB_DDM_DKV_DEVICEKVSTORE_CLOSERESULTSET_PROMISE_0100 diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js index dd7624983b8278b980c49307c7a037818b2fcc29..3714b3cc98b976ced3dafba19aa8467b74ea2e54 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js @@ -775,19 +775,14 @@ describe('SingleKvStoreCallbackTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2700', 0, async function (done) { console.log('SingleKvStoreDeletePredicatesCallbackTest001'); try { - let predicates = new dataShare.DataSharePredicates(); - await kvStore.delete(predicates, function (err,data) { - if (err == undefined) { - console.log('SingleKvStoreDeletePredicatesCallbackTest001 delete success'); - expect(null).assertFail(); - } else { - console.error('SingleKvStoreDeletePredicatesCallbackTest001 delete fail' + err`, error code is ${err.code}, message is ${err.message}`); - expect(err != undefined).assertTrue(); - } + await kvStore.delete(KEY_TEST_STRING_ELEMENT, function (err,data) { + console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2700 delete err: ' + err); + expect(err == undefined).assertTrue(); + console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2700 expect fin'); done(); }); }catch(e) { - console.error('SingleKvStoreDeletePredicatesCallbackTest001 e' + `, error code is ${e.code}, message is ${e.message}`); + console.error('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2700 e' + `, error code is ${e.code}, message is ${e.message}`); expect(e.code == 401).assertTrue(); done(); } @@ -802,13 +797,10 @@ describe('SingleKvStoreCallbackTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2800', 0, async function (done) { console.log('SingleKvStoreDeletePredicatesCallbackTest002'); try { - let predicates = new dataShare.DataSharePredicates(); - let arr = ["name"]; - predicates.inKeys(arr); await kvStore.put("name", "Bob", async function (err, data) { console.log('SingleKvStoreDeletePredicatesCallbackTest002 put success'); expect(err == undefined).assertTrue(); - await kvStore.delete(predicates, function (err,data) { + await kvStore.delete("name", function (err,data) { console.log('SingleKvStoreDeletePredicatesCallbackTest002 delete success'); expect(err == undefined).assertTrue(); done(); @@ -828,23 +820,20 @@ describe('SingleKvStoreCallbackTest', function () { * @tc.name Test Js Api SingleKvStore.Delete() testcase 003 */ it('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900', 0, async function (done) { - console.log('SingleKvStoreDeletePredicatesCallbackTest003'); + console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900'); try { - let predicates = new dataShare.DataSharePredicates(); let arr = [null]; - predicates.inKeys(arr); await kvStore.put("name", "Bob", async function (err, data) { - console.log('SingleKvStoreDeletePredicatesCallbackTest003 put success'); + console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900 put success'); expect(err == undefined).assertTrue(); - await kvStore.delete(predicates, function (err,data) { - console.log('SingleKvStoreDeletePredicatesCallbackTest003 delete success: '+err); - expect(err == undefined).assertTrue(); - done(); - }); + console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900 expect finash'); }) + await kvStore.delete(arr, function (err,data) { + console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900 delete success: '+err); + }); } catch(e) { - console.error('SingleKvStoreDeletePredicatesCallbackTest003 e' + `, error code is ${e.code}, message is ${e.message}`); - expect(null).assertFail(); + console.error('SUB_DDM_DKV_SINGLEKVSTORE_DELETE_CALLBACK_2900 e' + `, error code is ${e.code}, message is ${e.message}`); + expect(e.code == 401).assertTrue(); done(); } }) @@ -2228,8 +2217,8 @@ describe('SingleKvStoreCallbackTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_GETRESULT_CALLBACK_7800', 0, async function (done) { console.log('SingleKvStoreGetResultSetPredicatesCallbackTest001'); try { - let predicates = new dataShare.DataSharePredicates(); - await kvStore.getResultSet(predicates).then((result) => { + let query = new factory.Query(); + await kvStore.getResultSet(query).then((result) => { console.log('SingleKvStoreGetResultSetPredicatesCallbackTest001 getResultSet success'); }).catch((err) => { console.error('SingleKvStoreGetResultSetPredicatesCallbackTest001 getResultSet fail ' + err`, error code is ${err.code}, message is ${err.message}`); diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js index 63c5d287e7a0786c1fd3e7a63181d1c543dae6ca..2d887d522f8ac9feeebedb4c615cf853999536e2 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js @@ -771,13 +771,12 @@ describe('SingleKvStorePromiseTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100', 0, async function (done) { console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100'); try { - let predicates = new dataShare.DataSharePredicates(); - await kvStore.delete(predicates).then((data) => { + await kvStore.delete("KEY_TEST_STRING_ELEMENTS").then((data) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100 delete success'); - expect(null).assertFail(); }).catch((err) => { - console.error('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100 delete fail ' + `, error code is ${err.code}, message is ${err.message}`); - expect(err != undefined).assertTrue(); + console.error('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100 delete fail err ' + err); + expect(err == undefined).assertTrue(); + done(); }); }catch(e) { console.error('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0100 e' + `, error code is ${e.code}, message is ${e.message}`); @@ -795,13 +794,10 @@ describe('SingleKvStorePromiseTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0200', 0, async function (done) { console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0200'); try { - let predicates = new dataShare.DataSharePredicates(); - let arr = ["name"]; - predicates.inKeys(arr); await kvStore.put("name", "Bob").then(async (data) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0200 put success'); expect(data == undefined).assertTrue(); - await kvStore.delete(predicates).then((data) => { + await kvStore.delete("name").then((data) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0200 delete success'); expect(data == undefined).assertTrue(); }).catch((err) => { @@ -828,16 +824,14 @@ describe('SingleKvStorePromiseTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0300', 0, async function (done) { console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0300'); try { - let predicates = new dataShare.DataSharePredicates(); - let arr = [null]; - predicates.inKeys(arr); + await kvStore.put("name", "Bob").then(async (data) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0300 put success'); }).catch((err) => { console.error('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0300 put fail ' + `, error code is ${err.code}, message is ${err.message}`); expect(null).assertFail(); }); - await kvStore.delete(predicates, function (err,data) { + await kvStore.delete("name", function (err,data) { console.log('SUB_DDM_DKV_SINGLEKVSTORE_DELETEPREDICATES_PROMISE_0300 delete success'); expect(err != undefined).assertTrue(); done(); @@ -1553,24 +1547,29 @@ describe('SingleKvStorePromiseTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100', 0, async function (done) { console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100'); try { - let values = []; - let arr1 = new Uint8Array([4,5,6,7]); - let arr2 = new Uint8Array([4,5,6,7,8]); - let vb1 = {key : "name_1", value : arr1}; - let vb2 = {key : "name_2", value : arr2}; - values.push(vb1); - values.push(vb2); - console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 values: ' + JSON.stringify(values)); - await kvStore.putBatch(values).then(async (err) => { + let entries = []; + for (var i = 0; i < 10; i++) { + var key = 'batch_test_number_key'; + var entry = { + key : key + i, + value : { + type : factory.ValueType.DOUBLE, + value : 2.00 + } + } + entries.push(entry); + } + console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 entries: ' + JSON.stringify(entries)); + await kvStore.putBatch(entries).then(async (err) => { console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 putBatch success'); expect(err == undefined).assertTrue(); var query = new factory.Query(); - query.prefixKey("name_"); + query.prefixKey("batch_test_"); await kvStore.getEntries(query).then((entrys) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 getEntries success'); console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 entrys.length: ' + entrys.length); console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 entrys[0]: ' + JSON.stringify(entrys[1])); - expect(entrys.length == 2).assertTrue(); + expect(entrys.length == 10).assertTrue(); done(); }); }); @@ -1590,22 +1589,29 @@ describe('SingleKvStorePromiseTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200', 0, async function (done) { console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200'); try { - let values = []; - let vb1 = {key : "name_1", value : "arr1"}; - let vb2 = {key : "name_2", value : "arr2"}; - values.push(vb1); - values.push(vb2); - console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 values: ' + JSON.stringify(values)); - await kvStore.putBatch(values).then(async (err) => { + let entries = []; + for (var i = 0; i < 10; i++) { + var key = 'key_test_int'; + var entry = { + key: key + i, + value: { + type: factory.ValueType.INTEGER, + value: '123' + } + } + entries.push(entry); + } + console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 entries: ' + JSON.stringify(entries)); + await kvStore.putBatch(entries).then(async (err) => { console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0100 putBatch success'); expect(err == undefined).assertTrue(); var query = new factory.Query(); - query.prefixKey("name_"); + query.prefixKey("key_test_"); await kvStore.getEntries(query).then((entrys) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 getEntries success'); console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 entrys.length: ' + entrys.length); console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 entrys[0]: ' + JSON.stringify(entrys[1])); - expect(entrys.length == 2).assertTrue(); + expect(entrys.length == 10).assertTrue(); done(); }).catch((err) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0200 delete fail ' + err); @@ -1631,24 +1637,29 @@ describe('SingleKvStorePromiseTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300', 0, async function (done) { console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300'); try { - let values = []; - let vb1 = {key : "name_1", value : 123}; - let vb2 = {key : "name_2", value : 321.0}; - let vb3 = {key : "name_3", value : 321.00}; - values.push(vb1); - values.push(vb2); - values.push(vb3); - console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 values: ' + JSON.stringify(values)); - await kvStore.putBatch(values).then(async (err) => { + let entries = []; + for (var i = 0; i < 10; i++) { + var key = 'key_test_boolean'; + var entry = { + key: key + i, + value: { + type: factory.ValueType.BOOLEAN, + value: 'true' + } + } + entries.push(entry); + } + console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 entries: ' + JSON.stringify(entries)); + await kvStore.putBatch(entries).then(async (err) => { console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 putBatch success'); expect(err == undefined).assertTrue(); var query = new factory.Query(); - query.prefixKey("name_"); + query.prefixKey("key_test_"); await kvStore.getEntries(query).then((entrys) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 getEntries success'); console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 entrys.length: ' + entrys.length); console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0300 entrys[0]: ' + JSON.stringify(entrys[2])); - expect(entrys.length == 3).assertTrue(); + expect(entrys.length == 10).assertTrue(); done(); }); }); @@ -1668,22 +1679,29 @@ describe('SingleKvStorePromiseTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400', 0, async function (done) { console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400'); try { - let values = []; - let vb1 = {key : "name_1", value : true}; - let vb2 = {key : "name_2", value : false}; - values.push(vb1); - values.push(vb2); - console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 values: ' + JSON.stringify(values)); - await kvStore.putBatch(values).then(async (err) => { + let entries = []; + for (var i = 0; i < 10; i++) { + var key = 'key_test_float'; + var entry = { + key: key + i, + value: { + type: factory.ValueType.FLOAT, + value: '321.12' + } + } + entries.push(entry); + } + console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 entries: ' + JSON.stringify(entries)); + await kvStore.putBatch(entries).then(async (err) => { console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 putBatch success'); expect(err == undefined).assertTrue(); var query = new factory.Query(); - query.prefixKey("name_"); + query.prefixKey("key_test_"); await kvStore.getEntries(query).then((entrys) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 getEntries success'); console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 entrys.length: ' + entrys.length); console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0400 entrys[0]: ' + JSON.stringify(entrys[1])); - expect(entrys.length == 2).assertTrue(); + expect(entrys.length == 10).assertTrue(); done(); }); }); @@ -1703,23 +1721,32 @@ describe('SingleKvStorePromiseTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500', 0, async function (done) { console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500'); try { - let values = []; - let vb1 = {key : "name_1", value : null}; - let vb2 = {key : "name_2", value : null}; - values.push(vb1); - values.push(vb2); - console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 values: ' + JSON.stringify(values)); - await kvStore.putBatch(values).then(async (err) => { + let entries = []; + for (var i = 0; i < 10; i++) { + var key = 'key_test_string'; + var entry = { + key: key + i, + value: { + type: factory.ValueType.STRING, + value: 'value-string-001' + } + } + entries.push(entry); + } + console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entries: ' + JSON.stringify(entries)); + await kvStore.putBatch(entries).then(async (err) => { console.info('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 putBatch success'); expect(err == undefined).assertTrue(); var query = new factory.Query(); - query.prefixKey("name_"); + query.prefixKey("key_test_"); await kvStore.getEntries(query).then((entrys) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 getEntries success'); console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entrys.length: ' + entrys.length); - console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entrys[0]: ' + JSON.stringify(entrys[1])); - expect(entrys.length == 2).assertTrue(); - expect(entrys[0].value == null).assertTrue(); + console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entrys[1]: ' + JSON.stringify(entrys[1])); + expect(entrys.length == 10).assertTrue(); + console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entrys[0]: ' + JSON.stringify(entrys[0])); + console.log('SUB_DDM_DKV_SINGLEKVSTORE_PUTBATCHVALUE_PROMISE_0500 entrys[0]: ' + JSON.stringify(entrys[0].value)); + expect(entrys[0].value.value == 'value-string-001').assertTrue(); done(); }); }); @@ -2762,9 +2789,9 @@ describe('SingleKvStorePromiseTest', function () { console.error('SUB_DDM_DKV_SINGLEKVSTORE_GETRESULTSET_PROMISE_0700 putBatch fail ' + `, error code is ${err.code}, message is ${err.message}`); expect(null).assertFail(); }); - let predicates = new dataShare.DataSharePredicates(); - predicates.prefixKey("name_"); - await kvStore.getResultSet(predicates).then((result) => { + let query = new factory.Query(); + query.prefixKey("name_"); + await kvStore.getResultSet(query).then((result) => { console.log('SUB_DDM_DKV_SINGLEKVSTORE_GETRESULTSET_PROMISE_0700 getResultSet success'); resultSet = result; expect(resultSet.getCount() == 10).assertTrue(); @@ -2795,8 +2822,8 @@ describe('SingleKvStorePromiseTest', function () { it('SUB_DDM_DKV_SINGLEKVSTORE_GETRESULTSET_PROMISE_0800', 0, async function (done) { console.log('SUB_DDM_DKV_SINGLEKVSTORE_GETRESULTSET_PROMISE_0800'); try { - let predicates = new dataShare.DataSharePredicates(); - await kvStore.getResultSet(predicates, async function (err, result) { + let query = new factory.Query(); + await kvStore.getResultSet(query, async function (err, result) { console.error('SUB_DDM_DKV_SINGLEKVSTORE_GETRESULTSET_PROMISE_0800 GetResultSet success: '+`, error code is ${err.code}, message is ${err.message}`); kvStore.closeResultSet(result); expect(err == undefined).assertTrue(); diff --git a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js index f476677e1016566c9689be9611f7b93a1b18b133..20737c3cce73bbb8a69c1ea8d7b27c36b5a47d40 100644 --- a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js +++ b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import factory from '@ohos.data.distributedData'; const TEST_BUNDLE_NAME = 'ohos.acts.kvStore'; diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js index faa7ef2461b7a7c621e834e69cc4430f333247c7..74274f0dc6a49079a7991ea22d95377c518c3040 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import dataPreferences from '@ohos.data.preferences' import featureAbility from '@ohos.ability.featureAbility'; diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesHelperJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesHelperJsunit.test.js index c9a4f1acabda2dd5ec759e81a1d387b62e9d6693..cae9a79669e7ce456142a57d5e2269b9efed8a4b 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesHelperJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesHelperJsunit.test.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import dataPreferences from '@ohos.data.preferences' import featureAbility from '@ohos.ability.featureAbility'; diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js index b2701b332a83d2c7318ae2cf53986c0b3d686808..31d5ac4505ad329bc2f5148fb0dfcd1cd080b59b 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import dataPreferences from '@ohos.data.preferences' import featureAbility from '@ohos.ability.featureAbility'; diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/SystemStorageJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/SystemStorageJsunit.test.js index 50bad829a4dce9f8725c95eb29e170499b5b5d89..a5ac65ae2a9122eb30531080bd6bc1338d94bda0 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/SystemStorageJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/SystemStorageJsunit.test.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import storage from '@system.storage'; const TAG = '[SYSTEM_STORAGE_JSKITS_TEST]' diff --git a/distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstorePredicatesComplexFiledJsunit.test.js b/distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstorePredicatesComplexFiledJsunit.test.js index 11958df234088c500cbd710a987ab5e1eafb28d3..ac2df6d922f58669c4125c54119c75120d65f111 100644 --- a/distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstorePredicatesComplexFiledJsunit.test.js +++ b/distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstorePredicatesComplexFiledJsunit.test.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import dataRdb from '@ohos.data.rdb'; const TAG = "[RDB_JSKITS_TEST]" diff --git a/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStorePredicatesComplexFiledJsunit.test.js b/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStorePredicatesComplexFiledJsunit.test.js index 806de1cae364592d53808c8f4bcc66d0fae58b47..e30c7931d0821addb4f2c38096f24a84fdf24f94 100644 --- a/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStorePredicatesComplexFiledJsunit.test.js +++ b/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStorePredicatesComplexFiledJsunit.test.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import data_Rdb from '@ohos.data.relationalStore'; import ability_featureAbility from '@ohos.ability.featureAbility' var context = ability_featureAbility.getContext();