提交 854de3b1 编写于 作者: Y yuxiaoya2

修改优化kv测试用例

Signed-off-by: Nyuxiaoya2 <yuxiaoya@huawei.com>
上级 3dca414d
...@@ -32,7 +32,7 @@ let mKVMgrConfig = { ...@@ -32,7 +32,7 @@ let mKVMgrConfig = {
function sleep(ms) { function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
function publicgetKvStore(optionsp){ function publicGetKvStore(optionsp){
console.log(`Test getKvStore `) console.log(`Test getKvStore `)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvManager = distributedData.createKVManager(mKVMgrConfig); kvManager = distributedData.createKVManager(mKVMgrConfig);
...@@ -49,7 +49,7 @@ function publicgetKvStore(optionsp){ ...@@ -49,7 +49,7 @@ function publicgetKvStore(optionsp){
}) })
} }
function publiccloseKvStore() { function publicCloseKvStore() {
console.log(`Test closeKvStore `) console.log(`Test closeKvStore `)
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
kvManager.closeKVStore(BUNDLE_NAME, STORE_ID, kvStore, (err, data) => { kvManager.closeKVStore(BUNDLE_NAME, STORE_ID, kvStore, (err, data) => {
...@@ -71,7 +71,7 @@ function publiccloseKvStore() { ...@@ -71,7 +71,7 @@ function publiccloseKvStore() {
}) })
} }
function publicput(kvStore,key,value){ function publicPut(kvStore,key,value){
console.log(`Test put ${JSON.stringify(key,value)}`) console.log(`Test put ${JSON.stringify(key,value)}`)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.put(key,value, function(err, data){ kvStore.put(key,value, function(err, data){
...@@ -86,7 +86,7 @@ function publicput(kvStore,key,value){ ...@@ -86,7 +86,7 @@ function publicput(kvStore,key,value){
}) })
} }
function publicget(kvStore,key){ function publicGet(kvStore,key){
console.log(`Test get ${JSON.stringify(key)}`) console.log(`Test get ${JSON.stringify(key)}`)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.get(key, function(err, data){ kvStore.get(key, function(err, data){
...@@ -101,7 +101,7 @@ function publicget(kvStore,key){ ...@@ -101,7 +101,7 @@ function publicget(kvStore,key){
}) })
} }
function publicbackup(kvStore,file){ function publicBackup(kvStore,file){
console.log(`Test backup ${JSON.stringify(file)}`) console.log(`Test backup ${JSON.stringify(file)}`)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.backup(file, function(err, data){ kvStore.backup(file, function(err, data){
...@@ -116,7 +116,7 @@ function publicbackup(kvStore,file){ ...@@ -116,7 +116,7 @@ function publicbackup(kvStore,file){
}) })
} }
function publicdeleteBackup(kvStore,files){ function publicDeleteBackup(kvStore,files){
console.log(`Test deleteBackup ${JSON.stringify(files)}`) console.log(`Test deleteBackup ${JSON.stringify(files)}`)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.deleteBackup(files, function(err, data){ kvStore.deleteBackup(files, function(err, data){
...@@ -135,7 +135,7 @@ function publicdeleteBackup(kvStore,files){ ...@@ -135,7 +135,7 @@ function publicdeleteBackup(kvStore,files){
}) })
} }
function publicrestoresp(kvStore,file){ function publicRestoreSp(kvStore,file){
console.log(`Test restoresp ${JSON.stringify(file)}`) console.log(`Test restoresp ${JSON.stringify(file)}`)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.restore(file, function(err, data){ kvStore.restore(file, function(err, data){
...@@ -151,7 +151,7 @@ function publicrestoresp(kvStore,file){ ...@@ -151,7 +151,7 @@ function publicrestoresp(kvStore,file){
}) })
} }
function publicrestore(kvStore){ function publicRestore(kvStore){
console.log(`Test restore `) console.log(`Test restore `)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.restore(function(err,data){ kvStore.restore(function(err,data){
...@@ -183,25 +183,25 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -183,25 +183,25 @@ describe('kvStoreBackupCallbackJsunittest', function () {
beforeAll( async function () { beforeAll( async function () {
console.info('Test beforeAll: Prerequisites at the test suite level, ' + console.info('Test beforeAll: Prerequisites at the test suite level, ' +
'which are executed before t he test suite is executed.'); 'which are executed before t he test suite is executed.');
await publicgetKvStore(optionLock); await publicGetKvStore(optionLock);
console.info("Test kvstore = " + kvStore) console.info("Test kvstore = " + kvStore)
}) })
beforeEach( async function () { beforeEach( async function () {
console.info('beforeEach: Prerequisites at the test case level,' + console.info('beforeEach: Prerequisites at the test case level,' +
' which are executed before each test case is executed.'); ' which are executed before each test case is executed.');
await publicgetKvStore(optionLock); await publicGetKvStore(optionLock);
}) })
afterEach( async function () { afterEach( async function () {
console.info('afterEach: Test case-level clearance conditions, ' + console.info('afterEach: Test case-level clearance conditions, ' +
'which are executed after each test case is executed.'); 'which are executed after each test case is executed.');
await publicdeleteBackup(kvStore,files); await publicDeleteBackup(kvStore,files);
await publiccloseKvStore(); await publicCloseKvStore();
files = [] files = []
}) })
afterAll(async function () { afterAll(async function () {
console.info('afterAll: Test suite-level cleanup condition, ' + console.info('afterAll: Test suite-level cleanup condition, ' +
'which is executed after the test suite is executed'); 'which is executed after the test suite is executed');
await publiccloseKvStore(); await publicCloseKvStore();
kvManager = null; kvManager = null;
console.info("Test kvstore = " + kvStore) console.info("Test kvstore = " + kvStore)
}) })
...@@ -215,13 +215,13 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -215,13 +215,13 @@ describe('kvStoreBackupCallbackJsunittest', function () {
it('SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0100', 0, async function (done) { it('SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0100', 0, async function (done) {
try{ try{
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0100 before restore"); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0100 before restore");
await publicrestore(kvStore).then((data) => { publicRestore(kvStore).then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0100 going restore = " + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0100 going restore = " + JSON.stringify(data));
expect(true).assertEqual(true); expect().assertFail();
done(); done();
}).catch((err) => { }).catch((err) => {
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0100 Manualrestore fail 1" + err); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0100 Manualrestore fail 1" + err);
expect(true).assertEqual(err == "Error: Parameter error.The number of parameters is incorrect."); expect(err == "Error: Parameter error.The number of parameters is incorrect.").assertEqual(true);
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -231,6 +231,8 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -231,6 +231,8 @@ describe('kvStoreBackupCallbackJsunittest', function () {
} }
}) })
/** /**
* @tc.name SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 * @tc.name SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200
* @tc.desc Test Js Api SingleKvStore.restore() manal testcase 002 * @tc.desc Test Js Api SingleKvStore.restore() manal testcase 002
...@@ -242,18 +244,18 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -242,18 +244,18 @@ describe('kvStoreBackupCallbackJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 before getname");
file = '123' ; file = '123' ;
files[0] = file ; files[0] = file ;
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 before restore"); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 before restore");
await sleep(1000); await sleep(1000);
publicrestore(kvStore); publicRestore(kvStore);
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 going restore "); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 going restore ");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_CALLBACK_0200 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -276,15 +278,15 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -276,15 +278,15 @@ describe('kvStoreBackupCallbackJsunittest', function () {
file = 'true' ; file = 'true' ;
files[0] = file ; files[0] = file ;
console.log("SUB_DDM_DKV_KVBACKUP_BUCKUP_CALLBACK_0100 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_BUCKUP_CALLBACK_0100 before backup");
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_BUCKUP_CALLBACK_0100 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_BUCKUP_CALLBACK_0100 going backup");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_BUCKUP_CALLBACK_0100 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_BUCKUP_CALLBACK_0100 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_BUCKUP_CALLBACK_0100 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_BUCKUP_CALLBACK_0100 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_BUCKUP_CALLBACK_0100 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_BUCKUP_CALLBACK_0100 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -307,15 +309,15 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -307,15 +309,15 @@ describe('kvStoreBackupCallbackJsunittest', function () {
file = 'legal' ; file = 'legal' ;
files[0] = "legal" ; files[0] = "legal" ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0100 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0100 before backup");
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0100 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0100 going backup");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { await publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0100 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0100 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0100 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0100 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0100 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0100 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -336,15 +338,15 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -336,15 +338,15 @@ describe('kvStoreBackupCallbackJsunittest', function () {
file = '1' ; file = '1' ;
files[0] = file ; files[0] = file ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0200 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0200 before backup");
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0200 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0200 going backup");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0200 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0200 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0200 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0200 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0200 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0200 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -366,15 +368,15 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -366,15 +368,15 @@ describe('kvStoreBackupCallbackJsunittest', function () {
file = '1.0' ; file = '1.0' ;
files[0] = file ; files[0] = file ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0300 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0300 before backup");
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0300 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0300 going backup");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { await publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0300 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0300 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0300 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0300 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0300 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0300 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -395,9 +397,9 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -395,9 +397,9 @@ describe('kvStoreBackupCallbackJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0400 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0400 before getname");
file = '' ; file = '' ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0400 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0400 before backup");
await publicbackup(kvStore,file).then((data) => { await publicBackup(kvStore,file).then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0400 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0400 going backup");
expect(true).assertEqual(data == "code数字"); expect().assertFail();
done(); done();
}).catch((err) => { }).catch((err) => {
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0400 ManualbackupCallback002 fail1 " + err); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0400 ManualbackupCallback002 fail1 " + err);
...@@ -432,20 +434,20 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -432,20 +434,20 @@ describe('kvStoreBackupCallbackJsunittest', function () {
files[3] = file3 ; files[3] = file3 ;
files[4] = file4 ; files[4] = file4 ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0500 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0500 before backup");
publicbackup(kvStore,file); publicBackup(kvStore,file);
await sleep(500); await sleep(500);
publicbackup(kvStore,file1); publicBackup(kvStore,file1);
await sleep(500); await sleep(500);
publicbackup(kvStore,file2); publicBackup(kvStore,file2);
await sleep(500); await sleep(500);
publicbackup(kvStore,file3); publicBackup(kvStore,file3);
await sleep(500); await sleep(500);
publicbackup(kvStore,file4); publicBackup(kvStore,file4);
await sleep(500); await sleep(500);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0500 before publicdeleteBackup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0500 before publicDeleteBackup");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
expect("1").assertEqual(delresult[0][0]) expect("1").assertEqual(delresult[0][0])
expect(0).assertEqual(delresult[0][1]); expect(0).assertEqual(delresult[0][1]);
...@@ -462,9 +464,10 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -462,9 +464,10 @@ describe('kvStoreBackupCallbackJsunittest', function () {
expect("5").assertEqual(delresult[4][0]) expect("5").assertEqual(delresult[4][0])
expect(27459591).assertEqual(delresult[4][1]) expect(27459591).assertEqual(delresult[4][1])
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0500 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0500 publicDeleteBackup" + JSON.stringify(data));
files = []; files = [];
console.log("Test clear files"); console.log("Test clear files");
expect(data != null).assertTrue();
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -497,18 +500,18 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -497,18 +500,18 @@ describe('kvStoreBackupCallbackJsunittest', function () {
files[4] = file4 ; files[4] = file4 ;
files[5] = file5 ; files[5] = file5 ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 before backup");
publicbackup(kvStore,file); publicBackup(kvStore,file);
await sleep(500); await sleep(500);
publicbackup(kvStore,file1); publicBackup(kvStore,file1);
await sleep(500); await sleep(500);
publicbackup(kvStore,file2); publicBackup(kvStore,file2);
await sleep(500); await sleep(500);
publicbackup(kvStore,file3); publicBackup(kvStore,file3);
await sleep(500); await sleep(500);
publicbackup(kvStore,file4); publicBackup(kvStore,file4);
await sleep(500); await sleep(500);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 before Sixth backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 before Sixth backup");
await publicbackup(kvStore,file5).then((data) => { publicBackup(kvStore,file5).then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 going backup");
expect(true).assertEqual(data == "code数字"); expect(true).assertEqual(data == "code数字");
done(); done();
...@@ -519,8 +522,8 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -519,8 +522,8 @@ describe('kvStoreBackupCallbackJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 Sixth backup err"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 Sixth backup err");
}) })
await sleep(1000); await sleep(1000);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 before publicdeleteBackup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 before publicDeleteBackup");
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
expect("1").assertEqual(delresult[0][0]) expect("1").assertEqual(delresult[0][0])
expect(0).assertEqual(delresult[0][1]); expect(0).assertEqual(delresult[0][1]);
...@@ -531,9 +534,10 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -531,9 +534,10 @@ describe('kvStoreBackupCallbackJsunittest', function () {
expect("6").assertEqual(delresult[5][0]) expect("6").assertEqual(delresult[5][0])
expect(27459591).assertEqual(delresult[5][1]); expect(27459591).assertEqual(delresult[5][1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_CALLBACK_0600 publicDeleteBackup" + JSON.stringify(data));
files = []; files = [];
console.log("Test clear files"); console.log("Test clear files");
expect(data != null).assertTrue();
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -554,18 +558,18 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -554,18 +558,18 @@ describe('kvStoreBackupCallbackJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 before getname");
file = 'legal' ; file = 'legal' ;
files[0] = file ; files[0] = file ;
publicbackup(kvStore,file); publicBackup(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 before restoresp");
await sleep(1000); await sleep(1000);
publicrestoresp(kvStore,file); publicRestoreSp(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 going restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 going restoresp");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0100 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -586,18 +590,18 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -586,18 +590,18 @@ describe('kvStoreBackupCallbackJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 before getname");
file = 'true' ; file = 'true' ;
files[0] = file ; files[0] = file ;
publicbackup(kvStore,file); publicBackup(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 before restoresp");
await sleep(1000); await sleep(1000);
publicrestoresp(kvStore,file); publicRestoreSp(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 going restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 going restoresp");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0200 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -618,18 +622,18 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -618,18 +622,18 @@ describe('kvStoreBackupCallbackJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 before getname");
file = '1' ; file = '1' ;
files[0] = file ; files[0] = file ;
publicbackup(kvStore,file); publicBackup(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 before restoresp");
await sleep(1000); await sleep(1000);
publicrestoresp(kvStore,file); publicRestoreSp(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 going restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 going restoresp");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0300 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -650,18 +654,18 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -650,18 +654,18 @@ describe('kvStoreBackupCallbackJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 before getname");
file = '1.0' ; file = '1.0' ;
files[0] = file ; files[0] = file ;
publicbackup(kvStore,file); publicBackup(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 before restoresp");
await sleep(1000); await sleep(1000);
publicrestoresp(kvStore,file); publicRestoreSp(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 going restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 going restoresp");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0400 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -681,10 +685,10 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -681,10 +685,10 @@ describe('kvStoreBackupCallbackJsunittest', function () {
try { try {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0500 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0500 before getname");
file = '' ; file = '' ;
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0500 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0500 before restoresp");
await sleep(1000); await sleep(1000);
await publicrestoresp(kvStore,file).then((data) => { publicRestoreSp(kvStore,file).then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0500 going restoresp = " + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0500 going restoresp = " + JSON.stringify(data));
expect(true).assertEqual(false); expect(true).assertEqual(false);
done(); done();
...@@ -711,7 +715,7 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -711,7 +715,7 @@ describe('kvStoreBackupCallbackJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0600 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0600 before getname");
file = 'legal' ; file = 'legal' ;
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0600 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0600 before restoresp");
await publicrestoresp(kvStore,file).then((data) => { publicRestoreSp(kvStore,file).then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0600 going restoresp = " + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORETOSPECIFIEDVERSION_CALLBACK_0600 going restoresp = " + JSON.stringify(data));
expect(true).assertEqual(false); expect(true).assertEqual(false);
done(); done();
...@@ -738,12 +742,12 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -738,12 +742,12 @@ describe('kvStoreBackupCallbackJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_DELETEBUCKUP_CALLBACK_0100 before deleteBackup"); console.log("SUB_DDM_DKV_KVBACKUP_DELETEBUCKUP_CALLBACK_0100 before deleteBackup");
file = '123' ; file = '123' ;
files[0] = file ; files[0] = file ;
await publicdeleteBackup(kvStore,files).then((data) => { await publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_DELETEBUCKUP_CALLBACK_0100 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_DELETEBUCKUP_CALLBACK_0100 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_DELETEBUCKUP_CALLBACK_0100 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_DELETEBUCKUP_CALLBACK_0100 delResult[1] = " + delResult[1]);
expect(27459591).assertEqual(delResult[1]); expect(27459591).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_DELETEBUCKUP_CALLBACK_0100 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_DELETEBUCKUP_CALLBACK_0100 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
console.log("SUB_DDM_DKV_KVBACKUP_DELETEBUCKUP_CALLBACK_0100 going deleteBackup"); console.log("SUB_DDM_DKV_KVBACKUP_DELETEBUCKUP_CALLBACK_0100 going deleteBackup");
...@@ -763,9 +767,16 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -763,9 +767,16 @@ describe('kvStoreBackupCallbackJsunittest', function () {
it('SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0100', 0, async function (done) { it('SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0100', 0, async function (done) {
try { try {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0100 before putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0100 before putdata");
publicput(kvStore,"key","value") ; publicPut(kvStore,"key","value").then((data)=>{
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0100 going putdata data= " + JSON.stringify(data));
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0100 going putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0100 going putdata");
expect(data == undefined).assertTrue();
done(); done();
}).catch((err)=>{
console.log("UB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0100 fail 1 " + JSON.stringify(err));
expect(err).assertFail();
done();
})
} catch (e) { } catch (e) {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0100 Backupinfo fail" + e); console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0100 Backupinfo fail" + e);
expect(e).assertFail(); expect(e).assertFail();
...@@ -782,9 +793,9 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -782,9 +793,9 @@ describe('kvStoreBackupCallbackJsunittest', function () {
it('SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0200', 0, async function (done) { it('SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0200', 0, async function (done) {
try { try {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0200 before putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0200 before putdata");
await publicput(kvStore,"key","value") ; await publicPut(kvStore,"key","value") ;
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0200 going putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0200 going putdata");
await publicget(kvStore,"key").then((data) => { publicGet(kvStore,"key").then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0200 going getdata" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0200 going getdata" + JSON.stringify(data));
expect(true).assertEqual(data == "value"); expect(true).assertEqual(data == "value");
done(); done();
...@@ -809,15 +820,15 @@ describe('kvStoreBackupCallbackJsunittest', function () { ...@@ -809,15 +820,15 @@ describe('kvStoreBackupCallbackJsunittest', function () {
it('SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0300', 0, async function (done) { it('SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0300', 0, async function (done) {
try { try {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0300 before putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0300 before putdata");
await publicput(kvStore,"putcallback003","value1") ; await publicPut(kvStore,"putcallback003","value1") ;
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0300 going putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0300 going putdata");
await publicget(kvStore,"putcallback").then((data) => { publicGet(kvStore,"putcallback").then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0300 going getdata" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0300 going getdata" + JSON.stringify(data));
expect(true).assertEqual(false); expect(true).assertEqual(false);
done(); done();
}).catch((err) => { }).catch((err) => {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0300 Get fail 1 " + JSON.stringify(err)); console.log("SUB_DDM_DKV_KVBACKUP_PUT_CALLBACK_0300 Get fail 1 " + JSON.stringify(err));
expect(true).assertEqual(true); expect(err.code).assertEqual("15100004");
done(); done();
}) })
} catch (e) { } catch (e) {
......
...@@ -29,7 +29,7 @@ let mKVMgrConfig = { ...@@ -29,7 +29,7 @@ let mKVMgrConfig = {
context : context context : context
}; };
function publicgetKvStore(optionsp){ function publicGetKvStore(optionsp){
console.log(`Test getKvStore `) console.log(`Test getKvStore `)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvManager = distributedData.createKVManager(mKVMgrConfig); kvManager = distributedData.createKVManager(mKVMgrConfig);
...@@ -46,7 +46,7 @@ function publicgetKvStore(optionsp){ ...@@ -46,7 +46,7 @@ function publicgetKvStore(optionsp){
}) })
} }
function publiccloseKvStore() { function publicCloseKvStore() {
console.log(`Test closeKvStore `) console.log(`Test closeKvStore `)
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
kvManager.closeKVStore(BUNDLE_NAME, STORE_ID, kvStore, (err, data) => { kvManager.closeKVStore(BUNDLE_NAME, STORE_ID, kvStore, (err, data) => {
...@@ -68,7 +68,7 @@ function publiccloseKvStore() { ...@@ -68,7 +68,7 @@ function publiccloseKvStore() {
}) })
} }
function publicput(kvStore,key,value){ function publicPut(kvStore,key,value){
console.log(`Test put ${JSON.stringify(key,value)}`) console.log(`Test put ${JSON.stringify(key,value)}`)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.put(key,value, function(err, data){ kvStore.put(key,value, function(err, data){
...@@ -83,7 +83,7 @@ function publicput(kvStore,key,value){ ...@@ -83,7 +83,7 @@ function publicput(kvStore,key,value){
}) })
} }
function publicget(kvStore,key){ function publicGet(kvStore,key){
console.log(`Test get ${JSON.stringify(key)}`) console.log(`Test get ${JSON.stringify(key)}`)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.get(key, function(err, data){ kvStore.get(key, function(err, data){
...@@ -98,7 +98,7 @@ function publicget(kvStore,key){ ...@@ -98,7 +98,7 @@ function publicget(kvStore,key){
}) })
} }
function publicbackup(kvStore,file){ function publicBackup(kvStore,file){
console.log(`Test backup ${JSON.stringify(file)}`) console.log(`Test backup ${JSON.stringify(file)}`)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.backup(file).then((data) => { kvStore.backup(file).then((data) => {
...@@ -111,7 +111,7 @@ function publicbackup(kvStore,file){ ...@@ -111,7 +111,7 @@ function publicbackup(kvStore,file){
}) })
} }
function publicdeleteBackup(kvStore,files) { function publicDeleteBackup(kvStore,files) {
console.log(`Test deleteBackup ${JSON.stringify(files)}`) console.log(`Test deleteBackup ${JSON.stringify(files)}`)
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
kvStore.deleteBackup(files).then((data) => { kvStore.deleteBackup(files).then((data) => {
...@@ -128,7 +128,7 @@ function publicdeleteBackup(kvStore,files) { ...@@ -128,7 +128,7 @@ function publicdeleteBackup(kvStore,files) {
}) })
} }
function publicrestoresp(kvStore,file){ function publicRestoreSp(kvStore,file){
console.log(`Test restoresp ${JSON.stringify(file)}`) console.log(`Test restoresp ${JSON.stringify(file)}`)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.restore(file).then((data) => { kvStore.restore(file).then((data) => {
...@@ -141,7 +141,7 @@ function publicrestoresp(kvStore,file){ ...@@ -141,7 +141,7 @@ function publicrestoresp(kvStore,file){
}) })
} }
function publicrestore(kvStore){ function publicRestore(kvStore){
console.log(`Test restore `) console.log(`Test restore `)
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
kvStore.restore.then((data) => { kvStore.restore.then((data) => {
...@@ -174,7 +174,7 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -174,7 +174,7 @@ describe('kvStoreBackupPromiseJsunittest', function () {
beforeAll( async function () { beforeAll( async function () {
console.info('Test beforeAll: Prerequisites at the test suite level, ' + console.info('Test beforeAll: Prerequisites at the test suite level, ' +
'which are executed before the test suite is executed.'); 'which are executed before the test suite is executed.');
await publicgetKvStore(optionLock); await publicGetKvStore(optionLock);
console.info("Test kvstore = " + kvStore) console.info("Test kvstore = " + kvStore)
}) })
beforeEach(function () { beforeEach(function () {
...@@ -184,12 +184,12 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -184,12 +184,12 @@ describe('kvStoreBackupPromiseJsunittest', function () {
afterEach( async function () { afterEach( async function () {
console.info('afterEach: Test case-level clearance conditions, ' + console.info('afterEach: Test case-level clearance conditions, ' +
'which are executed after each test case is executed.'); 'which are executed after each test case is executed.');
await publicdeleteBackup(kvStore,files); await publicDeleteBackup(kvStore,files);
}) })
afterAll( async function () { afterAll( async function () {
console.info('afterAll: Test suite-level cleanup condition, ' + console.info('afterAll: Test suite-level cleanup condition, ' +
'which is executed after the test suite is executed'); 'which is executed after the test suite is executed');
await publiccloseKvStore(); await publicCloseKvStore();
kvManager = null; kvManager = null;
console.info("Test kvstore = " + kvStore) console.info("Test kvstore = " + kvStore)
}) })
...@@ -203,7 +203,9 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -203,7 +203,9 @@ describe('kvStoreBackupPromiseJsunittest', function () {
it('SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0100', 0, async function (done) { it('SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0100', 0, async function (done) {
try { try {
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0100 before restore"); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0100 before restore");
await publicrestore(kvStore).then((data) => {
publicRestore(kvStore).then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0100 going restore = " + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0100 going restore = " + JSON.stringify(data));
expect(true).assertEqual(data == 'code数字'); expect(true).assertEqual(data == 'code数字');
done(); done();
...@@ -230,18 +232,18 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -230,18 +232,18 @@ describe('kvStoreBackupPromiseJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 before getname");
file = '123' ; file = '123' ;
files[0] = file ; files[0] = file ;
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 before restore"); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 before restore");
await sleep(1000); await sleep(1000);
publicrestore(kvStore); publicRestore(kvStore);
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 going restore "); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 going restore ");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { await publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALRESTORE_PROMISE_0200 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -263,15 +265,15 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -263,15 +265,15 @@ describe('kvStoreBackupPromiseJsunittest', function () {
file = 'legal' ; file = 'legal' ;
files[0] = "legal" ; files[0] = "legal" ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0100 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0100 before backup");
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0100 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0100 going backup");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0100 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0100 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0100 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0100 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0100 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0100 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -293,15 +295,15 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -293,15 +295,15 @@ describe('kvStoreBackupPromiseJsunittest', function () {
file = 'true' ; file = 'true' ;
files[0] = file ; files[0] = file ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0200 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0200 before backup");
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0200 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0200 going backup");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0200 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0200 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0200 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0200 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0200 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0200 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -323,15 +325,15 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -323,15 +325,15 @@ describe('kvStoreBackupPromiseJsunittest', function () {
file = '1' ; file = '1' ;
files[0] = file ; files[0] = file ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0300 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0300 before backup");
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0300 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0300 going backup");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0300 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0300 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0300 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0300 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0300 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0300 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -353,15 +355,15 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -353,15 +355,15 @@ describe('kvStoreBackupPromiseJsunittest', function () {
file = '1.0' ; file = '1.0' ;
files[0] = file ; files[0] = file ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0400 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0400 before backup");
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0400 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0400 going backup");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0400 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0400 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0400 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0400 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0400 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0400 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -382,7 +384,7 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -382,7 +384,7 @@ describe('kvStoreBackupPromiseJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0500 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0500 before getname");
file = '' ; file = '' ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0500 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0500 before backup");
await publicbackup(kvStore,file).then((data) => { publicBackup(kvStore,file).then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0500 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0500 going backup");
expect(true).assertEqual(data == "code数字"); expect(true).assertEqual(data == "code数字");
done(); done();
...@@ -419,19 +421,19 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -419,19 +421,19 @@ describe('kvStoreBackupPromiseJsunittest', function () {
files[3] = file3 ; files[3] = file3 ;
files[4] = file4 ; files[4] = file4 ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0600 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0600 before backup");
publicbackup(kvStore,file); publicBackup(kvStore,file);
await sleep(500); await sleep(500);
publicbackup(kvStore,file1); publicBackup(kvStore,file1);
await sleep(500); await sleep(500);
publicbackup(kvStore,file2); publicBackup(kvStore,file2);
await sleep(500); await sleep(500);
publicbackup(kvStore,file3); publicBackup(kvStore,file3);
await sleep(500); await sleep(500);
publicbackup(kvStore,file4); publicBackup(kvStore,file4);
await sleep(500); await sleep(500);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0600 before publicdeleteBackup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0600 before publicDeleteBackup");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
expect("1").assertEqual(delresult[0][0]) expect("1").assertEqual(delresult[0][0])
expect(0).assertEqual(delresult[0][1]); expect(0).assertEqual(delresult[0][1]);
...@@ -448,7 +450,7 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -448,7 +450,7 @@ describe('kvStoreBackupPromiseJsunittest', function () {
expect("5").assertEqual(delresult[4][0]) expect("5").assertEqual(delresult[4][0])
expect(27459591).assertEqual(delresult[4][1]) expect(27459591).assertEqual(delresult[4][1])
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0600 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0600 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -481,18 +483,18 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -481,18 +483,18 @@ describe('kvStoreBackupPromiseJsunittest', function () {
files[4] = file4 ; files[4] = file4 ;
files[5] = file5 ; files[5] = file5 ;
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 before backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 before backup");
publicbackup(kvStore,file); publicBackup(kvStore,file);
await sleep(500); await sleep(500);
publicbackup(kvStore,file1); publicBackup(kvStore,file1);
await sleep(500); await sleep(500);
publicbackup(kvStore,file2); publicBackup(kvStore,file2);
await sleep(500); await sleep(500);
publicbackup(kvStore,file3); publicBackup(kvStore,file3);
await sleep(500); await sleep(500);
publicbackup(kvStore,file4); publicBackup(kvStore,file4);
await sleep(500); await sleep(500);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 before Sixth backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 before Sixth backup");
await publicbackup(kvStore,file5).then((data) => { publicBackup(kvStore,file5).then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 going backup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 going backup");
expect(true).assertEqual(data == "code数字"); expect(true).assertEqual(data == "code数字");
done(); done();
...@@ -503,8 +505,8 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -503,8 +505,8 @@ describe('kvStoreBackupPromiseJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 Sixth backup err"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 Sixth backup err");
}) })
await sleep(1000); await sleep(1000);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 before publicdeleteBackup"); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 before publicDeleteBackup");
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
expect("1").assertEqual(delresult[0][0]) expect("1").assertEqual(delresult[0][0])
console.log(delresult[0][0]); console.log(delresult[0][0]);
...@@ -517,7 +519,7 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -517,7 +519,7 @@ describe('kvStoreBackupPromiseJsunittest', function () {
expect("6").assertEqual(delresult[5][0]) expect("6").assertEqual(delresult[5][0])
expect(27459591).assertEqual(delresult[5][1]); expect(27459591).assertEqual(delresult[5][1]);
console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_MANALBACKUP_PROMISE_0700 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -537,18 +539,18 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -537,18 +539,18 @@ describe('kvStoreBackupPromiseJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 before getname");
file = 'legal' ; file = 'legal' ;
files[0] = file ; files[0] = file ;
publicbackup(kvStore,file); publicBackup(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 before restoresp");
await sleep(1000); await sleep(1000);
publicrestoresp(kvStore,file); publicRestoreSp(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 going restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 going restoresp");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[5]; let delResult = delresult[5];
console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0100 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -569,18 +571,18 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -569,18 +571,18 @@ describe('kvStoreBackupPromiseJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 before getname");
file = 'true' ; file = 'true' ;
files[0] = file ; files[0] = file ;
publicbackup(kvStore,file); publicBackup(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 before restoresp");
await sleep(1000); await sleep(1000);
publicrestoresp(kvStore,file); publicRestoreSp(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 going restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 going restoresp");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[5]; let delResult = delresult[5];
console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0200 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -601,18 +603,18 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -601,18 +603,18 @@ describe('kvStoreBackupPromiseJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 before getname");
file = '1' ; file = '1' ;
files[0] = file ; files[0] = file ;
publicbackup(kvStore,file); publicBackup(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 before restoresp");
await sleep(1000); await sleep(1000);
publicrestoresp(kvStore,file); publicRestoreSp(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 going restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 going restoresp");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0300 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -633,18 +635,18 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -633,18 +635,18 @@ describe('kvStoreBackupPromiseJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 before getname");
file = '1.0' ; file = '1.0' ;
files[0] = file ; files[0] = file ;
publicbackup(kvStore,file); publicBackup(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 before restoresp");
await sleep(1000); await sleep(1000);
publicrestoresp(kvStore,file); publicRestoreSp(kvStore,file);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 going restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 going restoresp");
await sleep(1000); await sleep(1000);
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 delResult[1] = " + delResult[1]);
expect(0).assertEqual(delResult[1]); expect(0).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0400 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
} catch (e) { } catch (e) {
...@@ -664,10 +666,10 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -664,10 +666,10 @@ describe('kvStoreBackupPromiseJsunittest', function () {
try { try {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0500 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0500 before getname");
file = '' ; file = '' ;
publicbackup(kvStore,file) ; publicBackup(kvStore,file) ;
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0500 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0500 before restoresp");
await sleep(1000); await sleep(1000);
await publicrestoresp(kvStore,file).then((data) => { publicRestoreSp(kvStore,file).then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0500 going restoresp = " + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0500 going restoresp = " + JSON.stringify(data));
expect(true).assertEqual(false); expect(true).assertEqual(false);
done(); done();
...@@ -694,7 +696,7 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -694,7 +696,7 @@ describe('kvStoreBackupPromiseJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0600 before getname"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0600 before getname");
file = 'legal' ; file = 'legal' ;
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0600 before restoresp"); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0600 before restoresp");
await publicrestoresp(kvStore,file).then((data) => { publicRestoreSp(kvStore,file).then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0600 going restoresp = " + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_RESTORESPECIFIEDVERSION_PROMISE_0600 going restoresp = " + JSON.stringify(data));
expect(true).assertEqual(false); expect(true).assertEqual(false);
done(); done();
...@@ -723,12 +725,12 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -723,12 +725,12 @@ describe('kvStoreBackupPromiseJsunittest', function () {
console.log("SUB_DDM_DKV_KVBACKUP_DELETEBACKUP_PROMISE_0100 before deleteBackup"); console.log("SUB_DDM_DKV_KVBACKUP_DELETEBACKUP_PROMISE_0100 before deleteBackup");
file = '123' ; file = '123' ;
files[0] = file ; files[0] = file ;
await publicdeleteBackup(kvStore,files).then((data) => { publicDeleteBackup(kvStore,files).then((data) => {
let delResult = delresult[0]; let delResult = delresult[0];
console.info("SUB_DDM_DKV_KVBACKUP_DELETEBACKUP_PROMISE_0100 delResult = " + delResult); console.info("SUB_DDM_DKV_KVBACKUP_DELETEBACKUP_PROMISE_0100 delResult = " + delResult);
console.info("SUB_DDM_DKV_KVBACKUP_DELETEBACKUP_PROMISE_0100 delResult[1] = " + delResult[1]); console.info("SUB_DDM_DKV_KVBACKUP_DELETEBACKUP_PROMISE_0100 delResult[1] = " + delResult[1]);
expect(27459591).assertEqual(delResult[1]); expect(27459591).assertEqual(delResult[1]);
console.log("SUB_DDM_DKV_KVBACKUP_DELETEBACKUP_PROMISE_0100 publicdeleteBackup" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_DELETEBACKUP_PROMISE_0100 publicDeleteBackup" + JSON.stringify(data));
done(); done();
}) })
console.log("SUB_DDM_DKV_KVBACKUP_DELETEBACKUP_PROMISE_0100 going deleteBackup"); console.log("SUB_DDM_DKV_KVBACKUP_DELETEBACKUP_PROMISE_0100 going deleteBackup");
...@@ -748,7 +750,7 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -748,7 +750,7 @@ describe('kvStoreBackupPromiseJsunittest', function () {
it('SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0100', 0, async function (done) { it('SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0100', 0, async function (done) {
try { try {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0100 before putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0100 before putdata");
publicput(kvStore,"key1","value1") ; publicPut(kvStore,"key1","value1") ;
console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0100 going putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0100 going putdata");
done(); done();
} catch (e) { } catch (e) {
...@@ -767,9 +769,9 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -767,9 +769,9 @@ describe('kvStoreBackupPromiseJsunittest', function () {
it('SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0200', 0, async function (done) { it('SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0200', 0, async function (done) {
try { try {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0200 before putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0200 before putdata");
await publicput(kvStore,"PutPromise0002","value") ; await publicPut(kvStore,"PutPromise0002","value") ;
console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0200 going putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0200 going putdata");
await publicget(kvStore,"PutPromise0002").then((data) => { publicGet(kvStore,"PutPromise0002").then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0200 going getdata" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0200 going getdata" + JSON.stringify(data));
expect(true).assertEqual(data == "value"); expect(true).assertEqual(data == "value");
done(); done();
...@@ -794,9 +796,9 @@ describe('kvStoreBackupPromiseJsunittest', function () { ...@@ -794,9 +796,9 @@ describe('kvStoreBackupPromiseJsunittest', function () {
it('SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0300', 0, async function (done) { it('SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0300', 0, async function (done) {
try { try {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0300 before putdata"); console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0300 before putdata");
await publicput(kvStore,"PutPromise0004","value1") ; await publicPut(kvStore,"PutPromise0004","value1") ;
console.log("KvStoreBackupestDbBuckupPutPromiseTest004t going putdata"); console.log("KvStoreBackupestDbBuckupPutPromiseTest004t going putdata");
await publicget(kvStore,"PutPromise").then((data) => { publicGet(kvStore,"PutPromise").then((data) => {
console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0300 going getdata" + JSON.stringify(data)); console.log("SUB_DDM_DKV_KVBACKUP_PUT_PROMISE_0300 going getdata" + JSON.stringify(data));
expect(true).assertEqual(JSON.stringify(data) == '{}'); expect(true).assertEqual(JSON.stringify(data) == '{}');
done(); done();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册