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 a70c8fdaf1acda7a4818d632b8dc9873db7e821c..f94d09e9131cd9c3b97de2052db064ee3bbd6f0c 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVCallbackJsTest.js @@ -76,12 +76,7 @@ describe('deviceKvStoreCallbackTest', function () { beforeAll(async function (done) { console.info('beforeAll config:'+ JSON.stringify(config)); - await factory.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - }).catch((err) => { - console.error('beforeAll createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config) await kvManager.getKVStore(TEST_STORE_ID, options).then((store) => { kvStore = store; console.info('beforeAll getKVStore for getDeviceId success'); 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 b18e7a35ab74598779e1075475ba7e251f6c89ad..6a2869a9e80b984de57dc051bedd00ef8b151d6e 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/DeviceKvStoreKVPromiseJsTest.js @@ -76,12 +76,7 @@ describe('deviceKvStorePromiseTest', function () { beforeAll(async function (done) { console.info('beforeAll config:'+ JSON.stringify(config)); - await factory.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - }).catch((err) => { - console.error('beforeAll createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config); await kvManager.getKVStore(TEST_STORE_ID, options).then((store) => { kvStore = store; console.info('beforeAll getKVStore for getDeviceId success'); diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVCallbackJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVCallbackJsTest.js index e86aefe067ad0205d771d8cb809a1821fe708081..4283b1d8da2bce7dfa369159c5851773d0d681b5 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVCallbackJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVCallbackJsTest.js @@ -42,11 +42,9 @@ describe('kvManagerCallbackTest', function () { beforeAll(async function (done) { console.info('beforeAll'); - await factory.createKVManager(config, function (err, manager) { - kvManager = manager; - done(); - }); + kvManager = factory.createKVManager(config); console.info('beforeAll end'); + done(); }) afterAll(async function (done) { diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVPromiseJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVPromiseJsTest.js index c7b019ee3db8c2b87cf081a5df1beef4122a9f0f..68e3a2bc15c2307d8dea49067f217e4239412bb3 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVPromiseJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvManagerKVPromiseJsTest.js @@ -45,17 +45,12 @@ describe('KVManagerPromiseTest', function () { beforeAll(async function (done) { console.info('beforeAll'); - await factory.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - kvManager.getKVStore(TEST_STORE_ID, options).then((store) => { - console.info("beforeAll getKVStore success"); - kvStoreNew = store; - }).catch((err) => { - console.info("beforeAll getKVStore err: " + JSON.stringify(err)); - }); + kvManager = factory.createKVManager(config) + kvManager.getKVStore(TEST_STORE_ID, options).then((store) => { + console.info("beforeAll getKVStore success"); + kvStoreNew = store; }).catch((err) => { - console.error('beforeAll createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); + console.info("beforeAll getKVStore err: " + JSON.stringify(err)); }); console.info('beforeAll end'); done(); @@ -394,36 +389,30 @@ describe('KVManagerPromiseTest', function () { context:context } try { - await factory.createKVManager(config).then(async (manager) => { - kvManager = manager; - expect(manager !=null).assertTrue(); - console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 createKVManager success'); - await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { - console.info("testcreateKVManager001 getKVStore success"); - await store.put(STORE_KEY, STORE_VALUE).then(async (data) => { - console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 put data success'); - await store.get(STORE_KEY).then((data) => { - console.info("testcreateKVManager001 get data success"); - expect(data).assertEqual(STORE_VALUE); - }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 get data err' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config) + kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { + console.info("testcreateKVManager001 getKVStore success"); + store.put(STORE_KEY, STORE_VALUE).then(async (data) => { + console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 put data success'); + store.get(STORE_KEY).then((data) => { + console.info("testcreateKVManager001 get data success"); + expect(data).assertEqual(STORE_VALUE); + done(); }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 put data err' + `, error code is ${err.code}, message is ${err.message}`); + console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 get data err' + `, error code is ${err.code}, message is ${err.message}`); }); }).catch((err) => { - console.info("testcreateKVManager001 getKVStore err: " + JSON.stringify(err)); - expect(null).assertFail(); + console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 put data err' + `, error code is ${err.code}, message is ${err.message}`); }); }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - expect(null).assertFail() + console.info("testcreateKVManager001 getKVStore err: " + JSON.stringify(err)); + expect(null).assertFail(); }); }catch (e) { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 promise delete fail err' + `, error code is ${err.code}, message is ${err.message}`); + console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0100 promise delete fail err' + `, error code is ${e.code}, message is ${e.message}`); expect(null).assertFail(); } - done(); + }) /** @@ -439,35 +428,31 @@ describe('KVManagerPromiseTest', function () { context:contextApplication } try { - await factory.createKVManager(config).then(async (manager) => { - kvManager = manager; - console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 createKVManager success'); - await kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { - console.info("testcreateKVManager002 getKVStore success"); - await store.put(STORE_KEY, STORE_VALUE).then(async (data) => { - console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 put data success'); - await store.get(STORE_KEY).then((data) => { - console.info("testcreateKVManager002 get data success"); - expect(data).assertEqual(STORE_VALUE); - }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 get data err' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config) + kvManager.getKVStore(TEST_STORE_ID, options).then(async (store) => { + console.info("testcreateKVManager002 getKVStore success"); + store.put(STORE_KEY, STORE_VALUE).then(async (data) => { + console.info('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 put data success'); + store.get(STORE_KEY).then((data) => { + console.info("testcreateKVManager002 get data success"); + expect(data).assertEqual(STORE_VALUE); + done(); }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 put data err' + `, error code is ${err.code}, message is ${err.message}`); + console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 get data err' + `, error code is ${err.code}, message is ${err.message}`); }); }).catch((err) => { - console.info("testcreateKVManager002 getKVStore err: " + JSON.stringify(err)); - expect(null).assertFail(); + console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 put data err' + `, error code is ${err.code}, message is ${err.message}`); }); + }).catch((err) => { - console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - expect(null).assertFail() + console.info("testcreateKVManager002 getKVStore err: " + JSON.stringify(err)); + expect(null).assertFail(); }); }catch (e) { console.error('SUB_DDM_DKV_KVMANAGER_CREATEKVMANAGER_PROMISE_0200 promise delete fail err' + `, error code is ${err.code}, message is ${err.message}`); expect(null).assertFail(); } - done(); + }) }) } \ No newline at end of file diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupCallbackJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupCallbackJsTest.js index 50aab867b675053e18dfc47eeca53a53184f8d08..56374e0941b9cbe532e4e8ccd23ac2a06474a7dc 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupCallbackJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupCallbackJsTest.js @@ -35,25 +35,16 @@ function sleep(ms) { function publicgetKvStore(optionsp){ console.log(`Test getKvStore `) return new Promise(function(resolve, reject) { - distributedData.createKVManager(mKVMgrConfig, (err, data) => { - console.info('Test createKVManager begin') + kvManager = distributedData.createKVManager(mKVMgrConfig); + kvManager.getKVStore(STORE_ID, optionsp, (err, data) => { + console.info('Test getKVStore begin') if (err) { - console.info('Test createKVManager err = ' + err ); + console.info('Test getKVStore err = ' + err); reject(err); } - console.info('Test createKVManager data = ' + data); - - kvManager = data; - data.getKVStore(STORE_ID, optionsp, (err, data) => { - console.info('Test getKVStore begin') - if (err) { - console.info('Test getKVStore err = ' + err); - reject(err); - } - console.info('Test getKVStore data = ' + data); - kvStore = data; - resolve(data); - }); + console.info('Test getKVStore data = ' + data); + kvStore = data; + resolve(data); }); }) } diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupPromiseJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupPromiseJsTest.js index 0869987cd7ce8801f9d06f5ce9fb389b5a0c1ef1..4ab5125bd12f504206547c0711746094c07a73ef 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupPromiseJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreBackupPromiseJsTest.js @@ -32,25 +32,16 @@ let mKVMgrConfig = { function publicgetKvStore(optionsp){ console.log(`Test getKvStore `) return new Promise(function(resolve, reject) { - distributedData.createKVManager(mKVMgrConfig, (err, data) => { - console.info('Test createKVManager begin') + kvManager = distributedData.createKVManager(mKVMgrConfig); + kvManager.getKVStore(STORE_ID, optionsp, (err, data) => { + console.info('Test getKVStore begin') if (err) { - console.info('Test createKVManager err = ' + err ); + console.info('Test getKVStore err = ' + err); reject(err); } - console.info('Test createKVManager data = ' + data); - - kvManager = data; - data.getKVStore(STORE_ID, optionsp, (err, data) => { - console.info('Test getKVStore begin') - if (err) { - console.info('Test getKVStore err = ' + err); - reject(err); - } - console.info('Test getKVStore data = ' + data); - kvStore = data; - resolve(data); - }); + console.info('Test getKVStore data = ' + data); + kvStore = data; + resolve(data); }); }) } diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreResultSetKVJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreResultSetKVJsTest.js index 20186700ba1580c580b55e60fbc7ba9a42810740..23230756b01b475a18c92f9e2cf35a945e338bdd 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreResultSetKVJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/KvStoreResultSetKVJsTest.js @@ -42,12 +42,7 @@ export default function KvStoreResultSetTest(){ beforeAll(async function (done) { console.info('beforeAll'); console.info('beforeAll config:' + JSON.stringify(config)); - await factory.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - }).catch((err) => { - console.error('beforeAll createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config); await kvManager.getAllKVStoreId(TEST_BUNDLE_NAME).then(async (data) => { console.info('beforeAll getAllKVStoreId size = ' + data.length); for (var i = 0; i < data.length; i++) { diff --git a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js index 424bd5a80a20ba83a1bb5f4cbd529c63e85314fc..b882502a2b46019a03e7c882b53f7ac9921fb48f 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js @@ -104,18 +104,14 @@ describe('schemaTest', function() { beforeAll(async function (done) { try { - console.info("beforeAll: createKVManager (single) with " + JSON.stringify(options)); - await ddm.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - }).catch((err) => { - console.info('beforeAll createKVManager err ' + err); - }); + console.info("beforeAll: createKVManager (single) with " + JSON.stringify(config)); + kvManager = ddm.createKVManager(config) + done(); } catch (e) { console.info("fail on exception: " + e); expect(null).assertFail(); } - done(); + }) afterAll(async function (done) { 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 6d3a19c1e664dd60e7db25757ad364d72d339dce..dd7624983b8278b980c49307c7a037818b2fcc29 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVCallbackJsTest.js @@ -75,11 +75,8 @@ describe('SingleKvStoreCallbackTest', function () { beforeAll(async function (done) { console.info('beforeAll config:'+ JSON.stringify(config)); - await factory.createKVManager(config, function (err, manager) { - kvManager = manager; - console.info('beforeAll createKVManager success'); - done(); - }) + kvManager = factory.createKVManager(config) + done(); }) afterAll(async function (done) { @@ -2337,6 +2334,7 @@ describe('SingleKvStoreCallbackTest', function () { */ it('SUB_DDM_DKV_SINGLEKVSTORE_CLOSERESULT_CALLBACK_8200', 0, async function (done) { console.info('SingleKvStoreCloseResultSetCallbackTest004'); + try{ kvStore.closeResultSet("",(err, data) => { console.info('SingleKvStoreCloseResultSetCallbackTest004 close result finish') 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 6905f774aad3c46c3ac297e286c48ec69b8818ee..63c5d287e7a0786c1fd3e7a63181d1c543dae6ca 100644 --- a/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js +++ b/distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SingleKvStoreKVPromiseJsTest.js @@ -75,12 +75,7 @@ describe('SingleKvStorePromiseTest', function () { beforeAll(async function (done) { console.info('beforeAll config:'+ JSON.stringify(config)); - await factory.createKVManager(config).then((manager) => { - kvManager = manager; - console.info('beforeAll createKVManager success'); - }).catch((err) => { - console.error('beforeAll createKVManager err ' + `, error code is ${err.code}, message is ${err.message}`); - }); + kvManager = factory.createKVManager(config) console.info('beforeAll end'); done(); })