diff --git a/appexecfwk/ams_standard/amszipfileunzipfilest/Test.json b/appexecfwk/ams_standard/amszipfileunzipfilest/Test.json index 05ed7da83e34d107a2c3a5fb069d61b47caea48d..8795f1f02e420ecb846378a15034412004da519e 100644 --- a/appexecfwk/ams_standard/amszipfileunzipfilest/Test.json +++ b/appexecfwk/ams_standard/amszipfileunzipfilest/Test.json @@ -2,7 +2,7 @@ "description": "Configuration for hjunit demo Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "120000", "package": "com.example.amsZipfileUnzipfileST", "shell-timeout": "60000" }, @@ -24,16 +24,33 @@ { "type": "PushKit", "push": [ - "amsZipfileUnzipfileST.hap->/data/test/amsZipfileUnzipfileST.hap" + "ceshi.txt->/data/test/ceshi.txt" ] }, { "type": "ShellKit", "run-command": [ - "chmod 644 /data/test/*.hap" + "chmod 777 /data/test/*" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "remount", + "mkdir /data/testA" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 777 /data/testA/*" ] } + + + + ] } diff --git a/appexecfwk/ams_standard/amszipfileunzipfilest/entry/src/main/js/test/ContextJsunit.test.js b/appexecfwk/ams_standard/amszipfileunzipfilest/entry/src/main/js/test/ContextJsunit.test.js index 1a01213a38cbd587d0c08705bb60c9c7440a6ebe..8216b530c5df6abb05c50039dd4c206f8a31c13d 100644 --- a/appexecfwk/ams_standard/amszipfileunzipfilest/entry/src/main/js/test/ContextJsunit.test.js +++ b/appexecfwk/ams_standard/amszipfileunzipfilest/entry/src/main/js/test/ContextJsunit.test.js @@ -14,2036 +14,1692 @@ */ import zlib from '@ohos.zlib' import fileio from '@ohos.fileio' - - import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -console.log("-----------------888888888------------------"); - describe('ZlibTest', function () { - var FLUSH_TYPE_NO_FLUSH = 0; - var FLUSH_TYPE_PARTIAL_FLUSH = 1; - var FLUSH_TYPE_SYNC_FLUSH = 2; - var FLUSH_TYPE_FULL_FLUSH = 3; - var FLUSH_TYPE_FINISH = 4; - var FLUSH_TYPE_BLOCK = 5; - var FLUSH_TYPE_TREES = 6; - var COMPRESS_LEVEL_NO_COMPRESSION = 0; - var COMPRESS_LEVEL_BEST_SPEED = 1; - var COMPRESS_LEVEL_BEST_COMPRESSION = 9; - var COMPRESS_LEVEL_DEFAULT_COMPRESSION = -1; - var COMPRESS_STRATEGY_DEFAULT_STRATEGY = 0; - var COMPRESS_STRATEGY_FILTERED = 1; - var COMPRESS_STRATEGY_HUFFMAN_ONLY = 2; - var COMPRESS_STRATEGY_RLE = 3; - var COMPRESS_STRATEGY_FIXED = 4; - var MEM_LEVEL_MIN_MEMLEVEL = 1; - var MEM_LEVEL_DEFAULT_MEMLEVEL = 8; - var MEM_LEVEL_MAX_MEMLEVEL = 9; - /* -* @tc.number: ACTS_zipFile_0100 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_0100 +* @tc.name: zipFile +* @tc.desc: inFile doesn't exist */ - - function zipFileCallBack(err, data){ - console.log("zipFileCallBack_0100 err: " + err.code); - console.log("zipFileCallBack_0100 data: " + data); - expect(err).assertEqual(0); - expect(data).assertEqual(0); - } - it('ACTS_zipFile_0100', 0, async function (done) { - console.log("==================ACTS_zipFile_0100 start=================="); - var src =""; - var dest =""; - - zlib.zipFile(src,dest, - (err, data) => { - console.log("zipFileCallBack_0100 err: " + err.code); - console.log("zipFileCallBack_0100 data: " + data); - expect(err).assertEqual(0); - expect(data).assertEqual(0); - }); - - function timeout() { - expect().assertFail(); - console.debug('ACTS_zipFile_0100=====timeout======'); - } - setTimeout(timeout, 5000); - done(); - }) - +it('FWK_ZipFile_0100', 0, async function (done) { + console.log("==================FWK_ZipFile_0100 start=================="); + var src = "/data/noExist.txt"; + var dest = "/data/test/"; + var options = {} + zlib.zipFile(src, dest, options, + (err, data) => { + console.log("zipFileCallback_0100 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR); + done(); + }); +}) /* -* @tc.number: ACTS_zipFile_0200 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_0200 +* @tc.name: zipFile +* @tc.desc: inFile is a directory that doesn't exist */ - - it('ACTS_zipFile_0200', 0, async function (done) { - console.log("==================ACTS_zipFile_0200 start=================="); - var src ="/data/test/"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - - zlib.zipFile(src,dest, - (err, data) => { - console.log("zipFileCallBack_0200 err: " + err.code); - console.log("zipFileCallBack_0200 data: " + data); - expect(err).assertEqual(0); - expect(data).assertEqual(0); - }); - - function timeout() { - expect().assertFail(); - console.debug('ACTS_zipFile_0100=====timeout======'); - } - setTimeout(timeout, 5000); - done(); - }) +it('FWK_ZipFile_0200', 0, async function (done) { + console.log("==================FWK_ZipFile_0200 start=================="); + var src = "/data/test/not_exist/"; + var dest = "/data/testA/not_exist.zip"; + var options = {} + zlib.zipFile(src, dest, options, + (err, data) => { + console.log("zipFileCallBack_0200 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR); + done(); + }); +}) /* -* @tc.number: ACTS_zipFile_0300 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_0300 +* @tc.name: zipFile +* @tc.desc: output file not specified */ - - it('ACTS_zipFile_0300', 0, async function (done) { - console.log("==================ACTS_zipFile_0300 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest =""; - - zlib.zipFile(src,dest, - (err, data) => { - console.log("zipFileCallBack_0300 err: " + err.code); - console.log("zipFileCallBack_0300 data: " + data); - expect(err).assertEqual(0); - expect(data).assertEqual(0); - }); - - function timeout() { - expect().assertFail(); - console.debug('ACTS_zipFile_0300=====timeout======'); - } - setTimeout(timeout, 5000); - done(); - }) +it('FWK_ZipFile_0300', 0, async function (done) { + console.log("==================FWK_ZipFile_0300 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = ""; + var options = {} + zlib.zipFile(src, dest, options, + (err, data) => { + console.log("zipFileCallBack_0300 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR); + done(); + }); +}) /* -* @tc.number: ACTS_zipFile_0400 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_0400 +* @tc.name: zipFile +* @tc.desc: The ouput file is a directory that does not exist */ - - it('ACTS_zipFile_0400', 0, async function (done) { - console.log("==================ACTS_zipFile_0400 start=================="); - var src ="/data/test/"; - var dest ="/data/testA/zip_amsZipfileUnzipfileST-signed.zip"; - - zlib.zipFile(src,dest, - (err, data) => { - console.log("zipFileCallBack_0400 err: " + err.code); - console.log("zipFileCallBack_0400 data: " + data); - expect(err).assertEqual(0); - expect(data).assertEqual(0); - }); - - function timeout() { - expect().assertFail(); - console.debug('ACTS_zipFile_0400=====timeout======'); - } - setTimeout(timeout, 5000); - done(); - }) - +it('FWK_ZipFile_0400', 0, async function (done) { + console.log("==================FWK_ZipFile_0400 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testB/ceshi.txt.zip"; + var options = {} + zlib.zipFile(src, dest, options, + (err, data) => { + console.log("zipFileCallBack_0400 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR); + done(); + }); +}) /* -* @tc.number: ACTS_zipFile_0500 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_0500 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH */ - - it('ACTS_zipFile_0500', 0, async function (done) { - console.log("==================ACTS_zipFile_0500 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - - try{ - var Options= { - flush:FLUSH_TYPE_NO_FLUSH, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_0500 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_0500 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_0500 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_0500 big=" + big); - console.log("ACTS_zipFile_0500 small=" + small); - console.log("ACTS_zipFile_0500 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_0500 assertTure err:' + err); - } - console.debug('ACTS_zipFile_0500=====size======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_0500 size err:' + err); - - done(); - } - - setTimeout(function(){ - console.debug('ACTS_zipFile_0500=====timeout======'); - }, '1000'); - - }) +it('FWK_ZipFile_0500', 0, async function (done) { + console.log("==================FWK_ZipFile_0500 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; + + try { + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH; + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }); + } catch(err) { + console.error('FWK_ZipFile_0500 err:' + err); + done(); + } + console.log("==================FWK_ZipFile_0500 end=================="); +}) /* -* @tc.number: ACTS_zipFile_0600 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_0600 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH */ - -it('ACTS_zipFile_0600', 0, async function (done) { - console.log("==================ACTS_zipFile_0600 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_0600', 0, async function (done) { + console.log("==================FWK_ZipFile_0600 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; - try{ - var Options= { - flush:FLUSH_TYPE_NO_FLUSH, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_0600 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_0600 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_0600 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_0600 big=" + big); - console.log("ACTS_zipFile_0600 small=" + small); - console.log("ACTS_zipFile_0600 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_0600 assertTure err:' + err); - } - console.debug('ACTS_zipFile_0600=====size======'); + try { + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); - }catch(err) { - console.error('ACTS_zipFile_0600 size err:' + err); - + } catch(err) { + console.error('FWK_ZipFile_0500 err:' + err); done(); - } - - setTimeout(function(){ - console.debug('ACTS_zipFile_000=====timeout======'); - }, '1000'); - + } + console.log("==================FWK_ZipFile_0600 end=================="); }) /* -* @tc.number: ACTS_zipFile_700 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_0700 +* @tc.name: zipFile +* @tc.desc: zipFile */ - -it('ACTS_zipFile_0700', 0, async function (done) { - console.log("==================ACTS_zipFile_0700 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_0700', 0, async function (done) { + console.log("==================FWK_ZipFile_0700 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flush:FLUSH_TYPE_SYNC_FLUSH, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_0500 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_0700 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_0700 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_0700 big=" + big); - console.log("ACTS_zipFile_0700 small=" + small); - console.log("ACTS_zipFile_0700 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_0700 assertTure err:' + err); - } - console.debug('ACTS_zipFile_0700=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_SYNC_FLUSH, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_0700 size err:' + err); - + console.error('FWK_ZipFile_0700 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_0700=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_0700 end=================="); }) + /* -* @tc.number: ACTS_zipFile_0800 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_0800 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_FULL_FLUSH */ - -it('ACTS_zipFile_0800', 0, async function (done) { - console.log("==================ACTS_zipFile_0800 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_0800', 0, async function (done) { + console.log("==================FWK_ZipFile_0800 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flush:FLUSH_TYPE_FULL_FLUSH, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_0800 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_0800 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_0800 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_0800 big=" + big); - console.log("ACTS_zipFile_0800 small=" + small); - console.log("ACTS_zipFile_0800 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_0800 assertTure err:' + err); - } - console.debug('ACTS_zipFile_0800=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_FULL_FLUSH, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_0800 size err:' + err); - + console.error('FWK_ZipFile_0800 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_0800=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_0800 end=================="); }) - /* -* @tc.number: ACTS_zipFile_0900 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_0900 +* @tc.name: zipFile +* @tc.desc: zipFile */ - -it('ACTS_zipFile_0900', 0, async function (done) { - console.log("==================ACTS_zipFile_0900 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_0900', 0, async function (done) { + console.log("==================FWK_ZipFile_0900 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flush:FLUSH_TYPE_FINISH, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_0900 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_0900 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_0900 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_0900 big=" + big); - console.log("ACTS_zipFile_0900 small=" + small); - console.log("ACTS_zipFile_0900 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_0900 assertTure err:' + err); - } - console.debug('ACTS_zipFile_0900=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_FINISH, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_0900 size err:' + err); - + console.error('FWK_ZipFile_0900 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_0900=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_0900 end=================="); }) - /* -* @tc.number: ACTS_zipFile_1000 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_1000 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_BLOCK */ - -it('ACTS_zipFile_1000', 0, async function (done) { - console.log("==================ACTS_zipFile_1000 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_1000', 0, async function (done) { + console.log("==================FWK_ZipFile_1000 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flush:FLUSH_TYPE_BLOCK, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_1000 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_1000 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_1000 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_1000 big=" + big); - console.log("ACTS_zipFile_1000 small=" + small); - console.log("ACTS_zipFile_1000 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_1000 assertTure err:' + err); - } - console.debug('ACTS_zipFile_1000=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_BLOCK, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_1000 size err:' + err); - + console.error('FWK_ZipFile_1000 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_1000=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_1000 end=================="); }) + /* -* @tc.number: ACTS_zipFile_1100 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_1100 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_TREES */ - -it('ACTS_zipFile_1100', 0, async function (done) { - console.log("==================ACTS_zipFile_1100 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_1100', 0, async function (done) { + console.log("==================FWK_ZipFile_1100 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flush:FLUSH_TYPE_TREES, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_1100 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_1100 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_1100 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_1100 big=" + big); - console.log("ACTS_zipFile_1100 small=" + small); - console.log("ACTS_zipFile_1100 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_1100 assertTure err:' + err); - } - console.debug('ACTS_zipFile_1100=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_TREES, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_1100 size err:' + err); - + console.error('FWK_ZipFile_1100 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_1100=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_1100 end=================="); + sleep(10); }) /* -* @tc.number: ACTS_zipFile_1200 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_1200 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH */ - - it('ACTS_zipFile_1200', 0, async function (done) { - console.log("==================ACTS_zipFile_0900 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; + it('FWK_ZipFile_1200', 0, async function (done) { + console.log("==================FWK_ZipFile_1200 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - finishFlush:FLUSH_TYPE_NO_FLUSH, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_1200 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_1200 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_1200 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_1200 big=" + big); - console.log("ACTS_zipFile_1200 small=" + small); - console.log("ACTS_zipFile_1200 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_1200 assertTure err:' + err); - } - console.debug('ACTS_zipFile_1200=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_1200 size err:' + err); - + console.error('ACTS_zipFile_1200 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_1200=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_1200 end=================="); + sleep(10); }) /* -* @tc.number: ACTS_zipFile_1300 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_1300 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_PARTIAL_FLUSH */ - -it('ACTS_zipFile_1300', 0, async function (done) { - console.log("==================ACTS_zipFile_1300 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_1300', 0, async function (done) { + console.log("==================FWK_ZipFile_1300 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flushFlush:FLUSH_TYPE_PARTIAL_FLUSH - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_1300 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_1300 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_1300 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_1300 big=" + big); - console.log("ACTS_zipFile_1300 small=" + small); - console.log("ACTS_zipFile_1300 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_1300 assertTure err:' + err); - } - console.debug('ACTS_zipFile_1300=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_1300 size err:' + err); - + console.error('FWK_ZipFile_1300 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_1300=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_1300 end=================="); }) /* -* @tc.number: ACTS_zipFile_1400 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_1400 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_SYNC_FLUSH */ - -it('ACTS_zipFile_1400', 0, async function (done) { - console.log("==================ACTS_zipFile_1400 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_1400', 0, async function (done) { + console.log("==================FWK_ZipFile_1400 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flushFlush:FLUSH_TYPE_SYNC_FLUSH, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_1400 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_1400 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_1400 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_1400 big=" + big); - console.log("ACTS_zipFile_1400 small=" + small); - console.log("ACTS_zipFile_1400 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_1400 assertTure err:' + err); - } - console.debug('ACTS_zipFile_1400=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_SYNC_FLUSH, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_1400 size err:' + err); - + console.error('FWK_ZipFile_1400 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_1400=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_1400 end=================="); }) + /* -* @tc.number: ACTS_zipFile_1500 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_1500 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_FULL_FLUSH */ - -it('ACTS_zipFile_1500', 0, async function (done) { - console.log("==================ACTS_zipFile_1500 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_1500', 0, async function (done) { + console.log("==================FWK_ZipFile_1500 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flushFlush:FLUSH_TYPE_FULL_FLUSH, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_1500 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_1500 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_1500 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_1500 big=" + big); - console.log("ACTS_zipFile_1500 small=" + small); - console.log("ACTS_zipFile_1500 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_1500 assertTure err:' + err); - } - console.debug('ACTS_zipFile_1500=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_FULL_FLUSH, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_1500 size err:' + err); - + console.error('FWK_ZipFile_1500 size err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_1500=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_1500 end=================="); }) /* -* @tc.number: ACTS_zipFile_1600 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_1600 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_FINISH */ - -it('ACTS_zipFile_1600', 0, async function (done) { - console.log("==================ACTS_zipFile_1600 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_1600', 0, async function (done) { + console.log("==================FWK_ZipFile_1600 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flushFlush:FLUSH_TYPE_FINISH, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_1600 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_1600 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_1600 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_1600 big=" + big); - console.log("ACTS_zipFile_1600 small=" + small); - console.log("ACTS_zipFile_1600 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_1600 assertTure err:' + err); - } - console.debug('ACTS_zipFile_1600=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_FINISH, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_1600 size err:' + err); - + console.error('FWK_ZipFile_1600 size err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_1600=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_1600 end=================="); }) /* -* @tc.number: ACTS_zipFile_1700 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_1700 +* @tc.name: zipFile +* @tc.desc: zipFile */ - -it('ACTS_zipFile_1700', 0, async function (done) { - console.log("==================ACTS_zipFile_1700 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_1700', 0, async function (done) { + console.log("==================FWK_ZipFile_1700 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flushFlush:FLUSH_TYPE_BLOCK, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_1700 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_1700 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_1700 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_1700 big=" + big); - console.log("ACTS_zipFile_1700 small=" + small); - console.log("ACTS_zipFile_1700 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_1700 assertTure err:' + err); - } - console.debug('ACTS_zipFile_1700=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_BLOCK, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_1700 size err:' + err); - + console.error('FWK_ZipFile_1700 size err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_1700=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_1700 end=================="); }) /* -* @tc.number: ACTS_zipFile_1800 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_1800 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_TREES */ - -it('ACTS_zipFile_1800', 0, async function (done) { - console.log("==================ACTS_zipFile_1800 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_1800', 0, async function (done) { + console.log("==================FWK_ZipFile_1800 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - flushFlush:FLUSH_TYPE_TREES, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_1800 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_1800 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_1800 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_1800 big=" + big); - console.log("ACTS_zipFile_1800 small=" + small); - console.log("ACTS_zipFile_1800 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_1800 assertTure err:' + err); - } - console.debug('ACTS_zipFile_1800=====size======'); + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_TREES, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_1800 size err:' + err); - + console.error('FWK_ZipFile_1800 size err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_1800=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_1800 end=================="); }) /* -* @tc.number: ACTS_zipFile_1900 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_1900 +* @tc.name: zipFile +* @tc.desc: chunkSize:64 */ - -it('ACTS_zipFile_1900', 0, async function (done) { - console.log("==================ACTS_zipFile_1900 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_1900', 0, async function (done) { + console.log("==================FWK_ZipFile_1900 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { + var options = { chunkSize:64, }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_1900 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_1900 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_1900 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_1900 big=" + big); - console.log("ACTS_zipFile_1900 small=" + small); - console.log("ACTS_zipFile_1900 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_1900 assertTure err:' + err); - } - console.debug('ACTS_zipFile_1900=====size======'); + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_1900 size err:' + err); - + console.error('FWK_ZipFile_1900 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_1900=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_1900 end=================="); }) + /* -* @tc.number: ACTS_zipFile_2000 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_2000 +* @tc.name: zipFile +* @tc.desc: chunkSize:1024 */ - -it('ACTS_zipFile_2000', 0, async function (done) { - console.log("==================ACTS_zipFile_2000 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_2000', 0, async function (done) { + console.log("==================FWK_ZipFile_2000 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { + var options = { chunkSize:1024, }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_2000 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_2000 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_2000 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_2000 big=" + big); - console.log("ACTS_zipFile_2000 small=" + small); - console.log("ACTS_zipFile_2000 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_2000 assertTure err:' + err); - } - console.debug('ACTS_zipFile_2000=====size======'); - done(); + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done();; }); }catch(err) { - console.error('ACTS_zipFile_2000 size err:' + err); - + console.error('FWK_ZipFile_2000 size err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_2000=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_2000 end=================="); }) /* -* @tc.number: ACTS_zipFile_2100 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_2100 +* @tc.name: zipFile +* @tc.desc: chunkSize:999 */ - -it('ACTS_zipFile_2100', 0, async function (done) { - console.log("==================ACTS_zipFile_2100 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_2100', 0, async function (done) { + console.log("==================FWK_ZipFile_2100 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { + var options = { chunkSize:999, }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_2100 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_2100 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_2100 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_2100 big=" + big); - console.log("ACTS_zipFile_2100 small=" + small); - console.log("ACTS_zipFile_2100 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_2100 assertTure err:' + err); - } - console.debug('ACTS_zipFile_2100=====size======'); + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_2100 size err:' + err); - + console.error('FWK_ZipFile_2100 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_2100=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_2100 end=================="); }) /* -* @tc.number: ACTS_zipFile_2200 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_2200 +* @tc.name: zipFile +* @tc.desc: level.COMPRESS_LEVEL_NO_COMPRESSION */ - -it('ACTS_zipFile_2200', 0, async function (done) { - console.log("==================ACTS_zipFile_2200 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_2200', 0, async function (done) { + console.log("==================FWK_ZipFile_2200 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - level:COMPRESS_LEVEL_NO_COMPRESSION , - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_2200 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_2200 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_2200 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_2200 big=" + big); - console.log("ACTS_zipFile_2200 small=" + small); - console.log("ACTS_zipFile_2200 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_2200 assertTure err:' + err); - } - console.debug('ACTS_zipFile_2200=====size======'); + var options = {}; + options.level = zlib.CompressLevel.COMPRESS_LEVEL_NO_COMPRESSION , + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_2200 size err:' + err); - + console.error('FWK_ZipFile_2200 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_2200=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_2200 end=================="); }) /* -* @tc.number: ACTS_zipFile_2300 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_2300 +* @tc.name: zipFile +* @tc.desc: level.COMPRESS_LEVEL_BEST_SPEED */ - -it('ACTS_zipFile_2300', 0, async function (done) { - console.log("==================ACTS_zipFile_2300 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_2300', 0, async function (done) { + console.log("==================FWK_ZipFile_2300 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - level:COMPRESS_LEVEL_BEST_SPEED, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_2300 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_2300 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_2300 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_2300 big=" + big); - console.log("ACTS_zipFile_2300 small=" + small); - console.log("ACTS_zipFile_2300 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_2300 assertTure err:' + err); - } - console.debug('ACTS_zipFile_2300=====size======'); + var options = {}; + options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_SPEED, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_2300 size err:' + err); - + console.error('FWK_ZipFile_2300 size err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_2300=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_2300 end=================="); }) /* -* @tc.number: ACTS_zipFile_2400 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_2400 +* @tc.name: zipFile +* @tc.desc: level.COMPRESS_LEVEL_BEST_COMPRESSION */ - -it('ACTS_zipFile_2400', 0, async function (done) { - console.log("==================ACTS_zipFile_2400 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_2400', 0, async function (done) { + console.log("==================FWK_ZipFile_2400 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - level:COMPRESS_LEVEL_BEST_COMPRESSION, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_2400 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_2400 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_2400 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_2400 big=" + big); - console.log("ACTS_zipFile_2400 small=" + small); - console.log("ACTS_zipFile_2400 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_2400 assertTure err:' + err); - } - console.debug('ACTS_zipFile_2400=====size======'); + var options = {}; + options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_COMPRESSION, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_2400 size err:' + err); - + console.error('FWK_ZipFile_2400 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_2400=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_2400 end=================="); }) /* -* @tc.number: ACTS_zipFile_2500 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_2500 +* @tc.name: zipFile +* @tc.desc: level.COMPRESS_LEVEL_DEFAULT_COMPRESSION */ - -it('ACTS_zipFile_2500', 0, async function (done) { - console.log("==================ACTS_zipFile_2500 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_2500', 0, async function (done) { + console.log("==================FWK_ZipFile_2500 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - level:COMPRESS_LEVEL_DEFAULT_COMPRESSION, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_2000 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_2500 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_2500 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_2500 big=" + big); - console.log("ACTS_zipFile_2500 small=" + small); - console.log("ACTS_zipFile_2500 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_2500 assertTure err:' + err); - } - console.debug('ACTS_zipFile_2500=====size======'); + var options = {}; + options.level = zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_2500 size err:' + err); - + console.error('FWK_ZipFile_2500 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_2500=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_2500 end=================="); }) /* -* @tc.number: ACTS_zipFile_2600 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_2600 +* @tc.name: zipFile +* @tc.desc: memlevel.MEM_LEVEL_MIN_MEMLEVEL */ +it('FWK_ZipFile_2600', 0, async function (done) { + console.log("==================FWK_ZipFile_2600 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; -it('ACTS_zipFile_2600', 0, async function (done) { - console.log("==================ACTS_zipFile_2600 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - try{ - var Options= { - memlevel:MEM_LEVEL_MIN_MEMLEVEL, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_2600 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_2600 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_2600 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_2600 big=" + big); - console.log("ACTS_zipFile_2600 small=" + small); - console.log("ACTS_zipFile_2600 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_2600 assertTure err:' + err); - } - console.debug('ACTS_zipFile_2600=====size======'); + var options = {}; + options.memlevel = zlib.MemLevel.MEM_LEVEL_MIN_MEMLEVEL, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_2600 size err:' + err); - + console.error('FWK_ZipFile_2600 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_2600=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_2600 end=================="); }) /* -* @tc.number: ACTS_zipFile_2700 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_2700 +* @tc.name: zipFile +* @tc.desc: memlevel.MEM_LEVEL_MAX_MEMLEVEL */ - -it('ACTS_zipFile_2700', 0, async function (done) { - console.log("==================ACTS_zipFile_2700 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_2700', 0, async function (done) { + console.log("==================FWK_ZipFile_2700 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - memlevel:MEM_LEVEL_MAX_MEMLEVEL, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_2700 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_2700 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_2700 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_2700 big=" + big); - console.log("ACTS_zipFile_2700 small=" + small); - console.log("ACTS_zipFile_2700 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_2700 assertTure err:' + err); - } - console.debug('ACTS_zipFile_2700=====size======'); + var options = {}; + options.memlevel = zlib.MemLevel.MEM_LEVEL_MAX_MEMLEVEL, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_2700 size err:' + err); + console.error('FWK_ZipFile_2700 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_2700=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_2700 end=================="); }) /* -* @tc.number: ACTS_zipFile_2800 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_2800 +* @tc.name: zipFile +* @tc.desc: memlevel.MEM_LEVEL_DEFAULT_MEMLEVEL */ - -it('ACTS_zipFile_2800', 0, async function (done) { - console.log("==================ACTS_zipFile_2800 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_2800', 0, async function (done) { + console.log("==================FWK_ZipFile_2800 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - memlevel:MEM_LEVEL_DEFAULT_MEMLEVEL, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_2800 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_2800 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_2800 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_2800 big=" + big); - console.log("ACTS_zipFile_2800 small=" + small); - console.log("ACTS_zipFile_2800 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_2800 assertTure err:' + err); - } - console.debug('ACTS_zipFile_2800=====size======'); + var options = {}; + options.memlevel = zlib.MemLevel.MEM_LEVEL_DEFAULT_MEMLEVEL, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_2800 size err:' + err); - + console.error('FWK_ZipFile_2800 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_2800=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_2800 end=================="); }) /* -* @tc.number: ACTS_zipFile_2900 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_2900 +* @tc.name: zipFile +* @tc.desc: strategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY */ - -it('ACTS_zipFile_2900', 0, async function (done) { - console.log("==================ACTS_zipFile_2900 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_2900', 0, async function (done) { + console.log("==================FWK_ZipFile_2900 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - strategy:COMPRESS_STRATEGY_DEFAULT_STRATEGY, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_2900 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_2900 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_2900 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_2900 big=" + big); - console.log("ACTS_zipFile_2900 small=" + small); - console.log("ACTS_zipFile_2900 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_2900 assertTure err:' + err); - } - console.debug('ACTS_zipFile_2900=====size======'); + var options = {}; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { console.error('ACTS_zipFile_2900 size err:' + err); - done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_2900=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_2900 end=================="); }) /* -* @tc.number: ACTS_zipFile_3000 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_3000 +* @tc.name: zipFile +* @tc.desc: strategy.COMPRESS_STRATEGY_FILTERED */ - -it('ACTS_zipFile_3000', 0, async function (done) { - console.log("==================ACTS_zipFile_3000 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_3000', 0, async function (done) { + console.log("==================FWK_ZipFile_3000 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - strategy:COMPRESS_STRATEGY_FILTERED, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_3000 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_3000 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_3000 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_3000 big=" + big); - console.log("ACTS_zipFile_3000 small=" + small); - console.log("ACTS_zipFile_3000 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_3000 assertTure err:' + err); - } - console.debug('ACTS_zipFile_3000=====size======'); + var options = {}; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_3000 size err:' + err); - + console.error('FWK_ZipFile_3000 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_3000=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_3000 end=================="); }) /* -* @tc.number: ACTS_zipFile_3100 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_3100 +* @tc.name: zipFile +* @tc.desc: strategy.COMPRESS_STRATEGY_HUFFMAN_ONLY */ - -it('ACTS_zipFile_3100', 0, async function (done) { - console.log("==================ACTS_zipFile_3100 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_3100', 0, async function (done) { + console.log("==================FWK_ZipFile_3100 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - strategy:COMPRESS_STRATEGY_HUFFMAN_ONLY, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_3100 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_3100 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_3100 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_3100 big=" + big); - console.log("ACTS_zipFile_3100 small=" + small); - console.log("ACTS_zipFile_3100 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_3100 assertTure err:' + err); - } - console.debug('ACTS_zipFile_3100=====size======'); + var options = {}; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_HUFFMAN_ONLY, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_3100 size err:' + err); - + console.error('FWK_ZipFile_3100 size err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_3100=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_3100 end=================="); }) /* -* @tc.number: ACTS_zipFile_3200 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_3200 +* @tc.name: zipFile +* @tc.desc: strategy.COMPRESS_STRATEGY_RLE */ - -it('ACTS_zipFile_3200', 0, async function (done) { - console.log("==================ACTS_zipFile_3200 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_3200', 0, async function (done) { + console.log("==================FWK_ZipFile_3200 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - strategy:COMPRESS_STRATEGY_RLE, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_3200 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_3200 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_3200 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_3200 big=" + big); - console.log("ACTS_zipFile_3200 small=" + small); - console.log("ACTS_zipFile_3200 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_3200 assertTure err:' + err); - } - console.debug('ACTS_zipFile_3200=====size======'); + var options = {}; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_RLE, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { console.error('ACTS_zipFile_3200 size err:' + err); - done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_3200=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_3200 end=================="); }) /* -* @tc.number: ACTS_zipFile_3300 -* @tc.name: zipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_3300 +* @tc.name: zipFile +* @tc.desc: strategy.COMPRESS_STRATEGY_HUFFMAN_ONLY */ - -it('ACTS_zipFile_3300', 0, async function (done) { - console.log("==================ACTS_zipFile_3300 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; +it('FWK_ZipFile_3300', 0, async function (done) { + console.log("==================FWK_ZipFile_3300 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; try{ - var Options= { - strategy:COMPRESS_STRATEGY_HUFFMAN_ONLY, - }; - await zlib.zipFile(src,dest,Options, - () => { - console.log("ACTS_zipFile_3300 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_zipFile_3300 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_zipFile_3300 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big>=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_zipFile_3300 big=" + big); - console.log("ACTS_zipFile_3300 small=" + small); - console.log("ACTS_zipFile_3300 big>=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_zipFile_3300 assertTure err:' + err); - } - console.debug('ACTS_zipFile_3300=====size======'); + var options = {}; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_HUFFMAN_ONLY, + await zlib.zipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_zipFile_3300 size err:' + err); - + console.error('FWK_ZipFile_3300 size err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_3300=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_3300 end=================="); }) +/* +* @tc.number: FWK_ZipFile_3400 +* @tc.name: zipFile +* @tc.desc: inFile doesn't exist +*/ +it('FWK_ZipFile_3400', 0, async function (done) { + console.log("==================FWK_ZipFile_3400 start=================="); + var src = "/data/noExist.txt"; + var dest = "/data/test/"; + var options = {} + zlib.zipFile(src, dest, options).then((data) => { + console.log("zipFilePromise_3400 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR); + done(); + }).catch((err)=>{ + console.log("zipFilePromise_3400 err: " + err); + done(); + }); + console.log("==================zipFilePromise_3400 end =================="); +}) /* -* @tc.number: ACTS_unzipFile_0100 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_3500 +* @tc.name: zipFile +* @tc.desc: inFile is a directory that doesn't exist */ +it('FWK_ZipFile_3500', 0, async function (done) { + console.log("==================FWK_ZipFile_3500 start=================="); + var src = "/data/test/not_exist/"; + var dest = "/data/test/not_exist.zip"; + var options = {} + zlib.zipFile(src, dest, options).then((data) => { + console.log("zipFilePromise_3500 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR); + done(); + }).catch((err)=>{ + console.log("zipFilePromise_3500 err: " + err); + done(); + }); + console.log("==================zipFilePromise_3500 end =================="); +}) -it('ACTS_unzipFile_0100', 0, async function (done) { - console.log("==================ACTS_unzipFile_0100 start=================="); - var src =""; - var dest =""; +/* +* @tc.number: FWK_ZipFile_3600 +* @tc.name: zipFile +* @tc.desc:output file not specified +*/ +it('FWK_ZipFile_3600', 0, async function (done) { + console.log("==================FWK_ZipFile_3600 start=================="); + var src = "/data/test/amsZipfileUnzipfileST.hap"; + var dest = ""; + var options = {} + zlib.zipFile(src, dest, options).then((data) => { + console.log("zipFilePromise_3600 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR); + done(); + }).catch((err)=>{ + console.log("zipFilePromise_3600 err: " + err); + done(); + }); + console.log("==================zipFilePromise_3600 end =================="); +}) - zlib.unzipFile(src,dest, - (err, data) => { - console.log("unzipFileCallBack_0100 err: " + err.code); - console.log("unzipFileCallBack_0100 data: " + data); - expect(err).assertEqual(0); - expect(data).assertEqual(0); - }); +/* +* @tc.number: FWK_ZipFile_3700 +* @tc.name: zipFile +* @tc.desc:output file not specified +*/ +it('FWK_ZipFile_3700', 0, async function (done) { + console.log("==================zipFilePromise_3700 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testB/ceshi.txt.zip"; + var options = {} + zlib.zipFile(src, dest, options).then((data) => { + console.log("zipFilePromise_3700 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR); + done(); + }).catch((err)=>{ + console.log("zipFilePromise_3700 err: " + err); + done(); + }); + console.log("==================zipFilePromise_3700 end =================="); +}) - function timeout() { - expect().assertFail(); - console.debug('ACTS_unzipFile_0100=====timeout======'); +/* +* @tc.number: FWK_ZipFile_3800 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH +*/ +it('FWK_ZipFile_3800', 0, async function (done) { + console.log("==================FWK_ZipFile_3800 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; + + try { + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH; + await zlib.zipFile(src, dest, options,).then((data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }).catch((err)=>{ + console.log("FWK_ZipFile_3800 .catch((err)=>" + err); + done(); + }); + } catch(err) { + console.error('FWK_ZipFile_3800 err:' + err); + done(); } - setTimeout(timeout, 5000); - done(); + console.log("==================FWK_ZipFile_3800 end=================="); }) - /* -* @tc.number: ACTS_unzipFile_0200 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_3900 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH */ +it('FWK_ZipFile_3900', 0, async function (done) { + console.log("==================FWK_ZipFile_3900 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testA/ceshi.txt.zip"; + + try { + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH, + await zlib.zipFile(src, dest, options,).then((data) => { + var smallStat = fileio.statSync(dest); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var srcSize = fileio.statSync(src).size; + var destSize = smallStat.size; + expect(srcSize>=destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }).catch((err)=>{ + console.log("FWK_ZipFile_3900 .catch((err)=>" + err); + done(); + }); + } catch(err) { + console.error('FWK_ZipFile_3900 err:' + err); + done(); + } + console.log("==================FWK_ZipFile_3900 end=================="); +}) -it('ACTS_unzipFile_0200', 0, async function (done) { - console.log("==================ACTS_unzipFile_0200 start=================="); - var src ="/data/test/"; - var dest ="/data/test/amsZipfileUnzipfileST.hap"; - - zlib.unzipFile(src,dest, - (err, data) => { - console.log("unzipFileCallBack_0200 err: " + err.code); - console.log("unzipFileCallBack_0200 data: " + data); - expect(err).assertEqual(0); - expect(data).assertEqual(0); - }); - function timeout() { - expect().assertFail(); - console.debug('ACTS_unzipFile_0200=====timeout======'); - } - setTimeout(timeout, 5000); - done(); -}) /* -* @tc.number: ACTS_unzipFile_0300 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_UnzipFile_0100 +* @tc.name: unzipFile +* @tc.desc: unzipFile */ -it('ACTS_unzipFile_0300', 0, async function (done) { - console.log("==================ACTS_unzipFile_0300 start=================="); - var src ="/data/test/amsZipfileUnzipfileST.hap"; - var dest ="/data/test/amsZipfileUnzipfileST.hap"; +it('FWK_UnzipFile_0100', 0, async function (done) { + console.log("==================FWK_UnzipFile_0100 start=================="); + var src = "/data/noExist.txt"; + var dest = "/data/test/"; + var options = {} + zlib.unzipFile(src, dest, options, + (err, data) => { + console.log("unzipfilecallback_0100 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR); + done(); + }); +}) - zlib.unzipFile(src,dest, +/* +* @tc.number: FWK_UnzipFile_0200 +* @tc.name: unzipFile +* @tc.desc: unzipFile +*/ + +it('FWK_UnzipFile_0200', 0, async function (done) { + console.log("==================FWK_UnzipFile_0200 start=================="); + var src = "/data/test/"; + var dest = "/data/testA/ceshi.txt.zip"; + var options = {} + zlib.unzipFile(src, dest, options, (err, data) => { - console.log("unzipFileCallBack_0300 err: " + err.code); - console.log("unzipFileCallBack_0300 data: " + data); - expect(err).assertEqual(0); - expect(data).assertEqual(0); - }); + console.log("unzipfilecallback_0200 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); + done(); + }); +}) - function timeout() { - expect().assertFail(); - console.debug('ACTS_unzipFile_0300=====timeout======'); - } - setTimeout(timeout, 5000); - done(); +/* +* @tc.number: FWK_UnzipFile_0300 +* @tc.name: unzipFile +* @tc.desc: unzipFile +*/ + +it('FWK_UnzipFile_0300', 0, async function (done) { + console.log("==================FWK_UnzipFile_0300 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = ""; + var options = {} + zlib.unzipFile(src, dest, options, + (err, data) => { + console.log("unzipfilecallback_0300 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); + done(); + }); }) /* -* @tc.number: ACTS_unzipFile_0400 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_UnzipFile_0400 +* @tc.name: unzipFile +* @tc.desc: unzipFile */ -it('ACTS_unzipFile_0400', 0, async function (done) { - console.log("==================ACTS_unzipFile_0400 start=================="); - var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - var dest ="/data/testA/"; - - zlib.unzipFile(src,dest, +it('FWK_UnzipFile_0400', 0, async function (done) { + console.log("==================FWK_UnzipFile_0400 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = "/data/testB"; + var options = {} + zlib.unzipFile(src, dest, options, (err, data) => { - console.log("unzipFileCallBack_0400 err: " + err.code); - console.log("unzipFileCallBack_0400 data: " + data); - expect(err).assertEqual(0); - expect(data).assertEqual(0); - }); - - function timeout() { - expect().assertFail(); - console.debug('ACTS_unzipFile_0400=====timeout======'); - } - setTimeout(timeout, 5000); - done(); + console.log("unzipfilecallback_0400 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); + done(); + }); }) /* -* @tc.number: ACTS_unzipFile_0500 +* @tc.number: FWK_UnzipFile_0500 * @tc.name: unzipFile : -* @tc.desc: +* @tc.desc: flushFlush.FLUSH_TYPE_NO_FLUSH */ -it('ACTS_unzipFile_0500', 0, async function (done) { - console.log("==================ACTS_unzipFile_0500 start=================="); - var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - var dest ="/data/test/amsZipfileUnzipfileST.hap"; +it('FWK_UnzipFile_0500', 0, async function (done) { + console.log("==================FWK_UnzipFile_0500 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = "/data/testA"; + var origin = "/data/test/ceshi.txt"; + var destFile = "/data/testA/ceshi.txt"; - try{ - var Options= { - flushFlush:FLUSH_TYPE_NO_FLUSH, - }; - await zlib.unzipFile(src,dest,Options, - () => { - console.log("ACTS_unzipFile_0500 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_unzipFile_0500 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_unzipFile_0500 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big<=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_unzipFile_0500 big=" + big); - console.log("ACTS_unzipFile_0500 small=" + small); - console.log("ACTS_unzipFile_0500 big<=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_unzipFile_0500 assertTure err:' + err); - } - console.debug('ACTS_unzipFile_0500=====size======'); + try { + var options = {}; + options.flushFlush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH, + await zlib.unzipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(destFile); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var destSize = smallStat.size; + var originStat = fileio.statSync(origin); + var originSize = originStat.size; + console.log("FWK_UnzipFile_0500 destSize=" + destSize); + console.log("FWK_UnzipFile_0500 data=" + data); + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); - }catch(err) { - console.error('ACTS_unzipFile_0500 size err:' + err); - + } catch(err) { + console.error('FWK_UnzipFile_0500 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_0500=====timeout======'); - }, '1000'); - + console.log("==================FWK_UnzipFile_0500 end=================="); }) /* -* @tc.number: ACTS_unzipFile_0600 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_UnzipFile_0600 +* @tc.name: unzipFile +* @tc.desc: flushFlush.FLUSH_TYPE_PARTIAL_FLUSH */ -it('ACTS_unzipFile_0600', 0, async function (done) { - console.log("==================ACTS_unzipFile_0600 start=================="); - var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - var dest ="/data/test/amsZipfileUnzipfileST.hap"; +it('FWK_UnzipFile_0600', 0, async function (done) { + console.log("==================FWK_UnzipFile_0600 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = "/data/testA"; + var origin = "/data/test/ceshi.txt"; + var destFile = "/data/testA/ceshi.txt"; try{ - var Options= { - flushFlush:FLUSH_TYPE_PARTIAL_FLUSH, - }; - await zlib.unzipFile(src,dest,Options, - () => { - console.log("ACTS_unzipFile_0600 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_unzipFile_0600 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_unzipFile_0600 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big<=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_unzipFile_0600 big=" + big); - console.log("ACTS_unzipFile_0600 small=" + small); - console.log("ACTS_unzipFile_0600 big<=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_unzipFile_0600 assertTure err:' + err); - } - console.debug('ACTS_unzipFile_0600=====size======'); + var options = {}; + options.flushFlush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH, + await zlib.unzipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(destFile); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var destSize = smallStat.size; + var originStat = fileio.statSync(origin); + var originSize = originStat.size; + console.log("FWK_UnzipFile_0600 destSize=" + destSize); + console.log("FWK_UnzipFile_0600 data=" + data); + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_unzipFile_0600 size err:' + err); - + console.error('FWK_UnzipFile_0600 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_0600=====timeout======'); - }, '1000'); - + console.log("==================FWK_UnzipFile_0600 end=================="); }) /* -* @tc.number: ACTS_unzipFile_0700 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_UnzipFile_0700 +* @tc.name: unzipFile +* @tc.desc: flushFlush.FLUSH_TYPE_SYNC_FLUSH */ -it('ACTS_unzipFile_0700', 0, async function (done) { - console.log("==================ACTS_unzipFile_0700 start=================="); - var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - var dest ="/data/test/amsZipfileUnzipfileST.hap"; +it('FWK_UnzipFile_0700', 0, async function (done) { + console.log("==================FWK_UnzipFile_0700 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = "/data/testA"; + var origin = "/data/test/ceshi.txt"; + var destFile = "/data/testA/ceshi.txt"; try{ - var Options= { - flushFlush:FLUSH_TYPE_SYNC_FLUSH, - }; - await zlib.unzipFile(src,dest,Options, - () => { - console.log("ACTS_unzipFile_0700 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_unzipFile_0700 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_unzipFile_0700 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big<=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_unzipFile_0700 big=" + big); - console.log("ACTS_unzipFile_0700 small=" + small); - console.log("ACTS_unzipFile_0700 big<=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_unzipFile_0700 assertTure err:' + err); - } - console.debug('ACTS_unzipFile_0700=====size======'); + var options = {}; + options.flushFlush = zlib.FlushType.FLUSH_TYPE_SYNC_FLUSH, + await zlib.unzipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(destFile); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var destSize = smallStat.size; + var originStat = fileio.statSync(origin); + var originSize = originStat.size; + console.log("FWK_UnzipFile_0700 destSize=" + destSize); + console.log("FWK_UnzipFile_0700 data=" + data); + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_unzipFile_0700 size err:' + err); - + console.error('FWK_UnzipFile_0700 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_0700=====timeout======'); - }, '1000'); - + console.log("==================FWK_UnzipFile_0700 end=================="); }) /* -* @tc.number: ACTS_unzipFile_0800 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_UnzipFile_0800 +* @tc.name: unzipFile +* @tc.desc: flushFlush.FLUSH_TYPE_FULL_FLUSH */ -it('ACTS_unzipFile_0800', 0, async function (done) { - console.log("==================ACTS_unzipFile_0800 start=================="); - var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - var dest ="/data/test/amsZipfileUnzipfileST.hap"; +it('FWK_UnzipFile_0800', 0, async function (done) { + console.log("==================FWK_UnzipFile_0800 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = "/data/testA"; + var origin = "/data/test/ceshi.txt"; + var destFile = "/data/testA/ceshi.txt"; try{ - var Options= { - flushFlush:FLUSH_TYPE_FULL_FLUSH, - }; - await zlib.unzipFile(src,dest,Options, - () => { - console.log("ACTS_unzipFile_0800 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_unzipFile_0800 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_unzipFile_0800 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big<=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_unzipFile_0800 big=" + big); - console.log("ACTS_unzipFile_0800 small=" + small); - console.log("ACTS_unzipFile_0800 big<=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_unzipFile_0800 assertTure err:' + err); - } - console.debug('ACTS_unzipFile_0800=====size======'); + var options = {}; + options.flushFlush = zlib.FlushType.FLUSH_TYPE_FULL_FLUSH, + await zlib.unzipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(destFile); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var destSize = smallStat.size; + var originStat = fileio.statSync(origin); + var originSize = originStat.size; + console.log("FWK_UnzipFile_0800 destSize=" + destSize); + console.log("FWK_UnzipFile_0800 data=" + data); + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_unzipFile_0800 size err:' + err); - + console.error('FWK_UnzipFile_0800 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_0800=====timeout======'); - }, '1000'); - + console.log("==================FWK_UnzipFile_0800 end=================="); }) /* -* @tc.number: ACTS_unzipFile_0900 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_UnzipFile_0900 +* @tc.name: unzipFile +* @tc.desc: flushFlush.FLUSH_TYPE_FINISH */ - -it('ACTS_unzipFile_0900', 0, async function (done) { +it('FWK_UnzipFile_0900', 0, async function (done) { console.log("==================ACTS_unzipFile_0900 start=================="); - var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - var dest ="/data/test/amsZipfileUnzipfileST.hap"; + var src = "/data/testA/ceshi.txt.zip"; + var dest = "/data/testA"; + var origin = "/data/test/ceshi.txt"; + var destFile = "/data/testA/ceshi.txt"; try{ - var Options= { - flushFlush:FLUSH_TYPE_FINISH, - }; - await zlib.unzipFile(src,dest,Options, - () => { - console.log("ACTS_unzipFile_0900 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_unzipFile_0900 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_unzipFile_0900 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big<=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_unzipFile_0900 big=" + big); - console.log("ACTS_unzipFile_0900 small=" + small); - console.log("ACTS_unzipFile_0900 big<=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_unzipFile_0900 assertTure err:' + err); - } - console.debug('ACTS_unzipFile_0900=====size======'); + var options = {}; + options.flushFlush = zlib.FlushType.FLUSH_TYPE_FINISH, + await zlib.unzipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(destFile); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var destSize = smallStat.size; + var originStat = fileio.statSync(origin); + var originSize = originStat.size; + console.log("FWK_UnzipFile_0900 destSize=" + destSize); + console.log("FWK_UnzipFile_0900 data=" + data); + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_unzipFile_0900 size err:' + err); - + console.error('FWK_UnzipFile_0900 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_0900=====timeout======'); - }, '1000'); - + console.log("==================FWK_UnzipFile_0900 end=================="); }) /* -* @tc.number: ACTS_unzipFile_1000 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_UnzipFile_1000 +* @tc.name: unzipFile +* @tc.desc: flushFlush.FLUSH_TYPE_BLOCK */ - -it('ACTS_unzipFile_1000', 0, async function (done) { - console.log("==================ACTS_unzipFile_1000 start=================="); - var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - var dest ="/data/test/amsZipfileUnzipfileST.hap"; +it('FWK_UnzipFile_1000', 0, async function (done) { + console.log("==================FWK_UnzipFile_1000 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = "/data/testA"; + var origin = "/data/test/ceshi.txt"; + var destFile = "/data/testA/ceshi.txt"; try{ - var Options= { - flushFlush:FLUSH_TYPE_BLOCK, - }; - await zlib.unzipFile(src,dest,Options, - () => { - console.log("ACTS_unzipFile_1000 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_unzipFile_1000 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_unzipFile_1000 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big<=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_unzipFile_1000 big=" + big); - console.log("ACTS_unzipFile_1000 small=" + small); - console.log("ACTS_unzipFile_1000 big<=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_unzipFile_1000 assertTure err:' + err); - } - console.debug('ACTS_unzipFile_1000=====size======'); + var options = {}; + options.flushFlush = zlib.FlushType.FLUSH_TYPE_BLOCK, + await zlib.unzipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(destFile); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var destSize = smallStat.size; + var originStat = fileio.statSync(origin); + var originSize = originStat.size; + console.log("FWK_UnzipFile_1000 destSize=" + destSize); + console.log("FWK_UnzipFile_1000 data=" + data); + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_unzipFile_1000 size err:' + err); + console.error('FWK_UnzipFile_1000 err:' + err); + done(); + } + console.log("==================FWK_UnzipFile_1000 end=================="); +}) +/* +* @tc.number: FWK_UnzipFile_1100 +* @tc.name: unzipFile +* @tc.desc: flushFlush.FLUSH_TYPE_TREES +*/ +it('FWK_UnzipFile_1100', 0, async function (done) { + console.log("==================ACTS_unzipFile_1100 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = "/data/testA"; + var origin = "/data/test/ceshi.txt"; + var destFile = "/data/testA/ceshi.txt"; + + + try{ + var options = {}; + options.flushFlush = zlib.FlushType.FLUSH_TYPE_TREES, + await zlib.unzipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(destFile); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var destSize = smallStat.size; + var originStat = fileio.statSync(origin); + var originSize = originStat.size; + console.log("FWK_UnzipFile_1100 destSize=" + destSize); + console.log("FWK_UnzipFile_1100 data=" + data); + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }); + }catch(err) { + console.error('FWK_UnzipFile_1100 err:' + err); done(); } + console.log("==================FWK_UnzipFile_1100 end=================="); +}) + +/* +* @tc.number: FWK_UnzipFile_1200 +* @tc.name: zipFile +* @tc.desc: inFile doesn't exist +*/ +it('FWK_UnzipFile_1200', 0, async function (done) { + console.log("==================FWK_UnzipFile_1200 start=================="); + var src = "/data/noExist.txt"; + var dest = "/data/test/"; + var options = {} + zlib.unzipFile(src, dest, options).then((data) => { + console.log("FWK_UnzipFile_1200 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR); + done(); + }).catch((err)=>{ + console.log("FWK_UnzipFile_1200 err: " + err); + done(); + }); + console.log("==================FWK_UnzipFile_1200 end =================="); +}) + +/* +* @tc.number: FWK_UnzipFile_1300 +* @tc.name: zipFile +* @tc.desc: inFile is a directory that doesn't exist +*/ +it('FWK_UnzipFile_1300', 0, async function (done) { + console.log("==================FWK_UnzipFile_1300 start=================="); + var src = "/data/test"; + var dest = "/data/testA/ceshi.txt"; + var options = {} + zlib.unzipFile(src, dest, options).then((data) => { + console.log("FWK_UnzipFile_1300 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); + done(); + }).catch((err)=>{ + console.log("FWK_UnzipFile_1300 err: " + err); + done(); + }); + console.log("==================FWK_UnzipFile_1300 end =================="); +}) - setTimeout(function(){ - console.debug('ACTS_unzipFile_1000=====timeout======'); - }, '1000'); - +/* +* @tc.number: FWK_UnzipFile_1400 +* @tc.name: zipFile +* @tc.desc:output file not specified +*/ +it('FWK_UnzipFile_1400', 0, async function (done) { + console.log("==================FWK_UnzipFile_1400 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testB/ceshi.txt.zip"; + var options = {} + zlib.unzipFile(src, dest, options).then((data) => { + console.log("FWK_UnzipFile_1400 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); + done(); + }).catch((err)=>{ + console.log("FWK_UnzipFile_1400 err: " + err); + done(); + }); + console.log("==================FWK_UnzipFile_1400 end =================="); }) /* -* @tc.number: ACTS_unzipFile_1100 +* @tc.number: FWK_UnzipFile_1500 +* @tc.name: zipFile +* @tc.desc:output file not specified +*/ +it('FWK_UnzipFile_1500', 0, async function (done) { + console.log("==================FWK_UnzipFile_1500 start=================="); + var src = "/data/testB/ceshi.txt.zip"; + var dest = "/data/testA/ceshi.txt"; + var options = {} + zlib.unzipFile(src, dest, options).then((data) => { + console.log("FWK_UnzipFile_1500 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR); + done(); + }).catch((err)=>{ + console.log("FWK_UnzipFile_1500 err: " + err); + done(); + }); + console.log("==================FWK_UnzipFile_1500 end =================="); +}) + +/* +* @tc.number: FWK_UnzipFile_1600 * @tc.name: unzipFile : -* @tc.desc: +* @tc.desc: flushFlush.FLUSH_TYPE_NO_FLUSH */ +it('FWK_UnzipFile_1600', 0, async function (done) { + console.log("==================FWK_UnzipFile_1600 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = "/data/testA"; + var origin = "/data/test/ceshi.txt"; + var destFile = "/data/testA/ceshi.txt"; + + try{ + var options = {}; + options.flushFlush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH, + await zlib.unzipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(destFile); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var destSize = smallStat.size; + var originStat = fileio.statSync(origin); + var originSize = originStat.size; + console.log("FWK_UnzipFile_1100 destSize=" + destSize); + console.log("FWK_UnzipFile_1100 data=" + data); + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }); + }catch(err) { + console.error('FWK_UnzipFile_01600 err:' + err); + done(); + } + console.log("==================FWK_UnzipFile_01600 end=================="); +}) -it('ACTS_unzipFile_1100', 0, async function (done) { - console.log("==================ACTS_unzipFile_1100 start=================="); - var src ="/data/test/zip_amsZipfileUnzipfileST-signed.zip"; - var dest ="/data/test/amsZipfileUnzipfileST.hap"; +/* +* @tc.number: FWK_UnzipFile_1700 +* @tc.name: unzipFile +* @tc.desc: flushFlush.FLUSH_TYPE_FINISH +*/ +it('FWK_UnzipFile_1700', 0, async function (done) { + console.log("==================FWK_UnzipFile_1700 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = "/data/testA"; + var origin = "/data/test/ceshi.txt"; + var destFile = "/data/testA/ceshi.txt"; try{ - var Options= { - flushFlush:FLUSH_TYPE_TREES, - }; - await zlib.unzipFile(src,dest,Options, - () => { - console.log("ACTS_unzipFile_1100 err:================================ "); - try{ - var isfileio = fileio.accessSync(dest) - console.log("ACTS_unzipFile_1100 isfileio:==============> "+JSON.stringify(isfileio)); - var isDest = (fileio.accessSync(dest) !== null) - console.log("ACTS_unzipFile_1100 isDest:==============> " +isDest); - expect(isDest).assertTrue(); - var big = fileio.statSync(src).size; - var small = fileio.statSync(dest).size; - var isBigSmall = (big<=small) - expect(isBigSmall).assertTrue(); - console.log("ACTS_unzipFile_1100 big=" + big); - console.log("ACTS_unipFile_1100 small=" + small); - console.log("ACTS_unzipFile_1100 big<=small=" + isBigSmall); - }catch(err) { - console.error('ACTS_unzipFile_1100 assertTure err:' + err); - } - console.debug('ACTS_unzipFile_1100=====size======'); + var options = {}; + options.flushFlush = zlib.FlushType.FLUSH_TYPE_FINISH, + await zlib.unzipFile(src, dest, options, + (err, data) => { + var smallStat = fileio.statSync(destFile); + var isFile = smallStat.isFile(); + expect(isFile).assertTrue(); + + var destSize = smallStat.size; + var originStat = fileio.statSync(origin); + var originSize = originStat.size; + console.log("FWK_UnzipFile_1700 destSize=" + destSize); + console.log("FWK_UnzipFile_1700 data=" + data); + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); }catch(err) { - console.error('ACTS_unzipFile_0500 size err:' + err); - + console.error('FWK_UnzipFile_1700 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_1100=====timeout======'); - }, '1000'); - + console.log("==================FWK_UnzipFile_1700 end=================="); }) + }) diff --git a/appexecfwk/ams_standard/fwkdataaccessor/Test.json b/appexecfwk/ams_standard/fwkdataaccessor/Test.json index fbcac079721ab8dbb8f4fcdd412a1fe5028d0c1f..3378e8d3d6759962e99cea96a8a4e5b1f66ebf93 100644 --- a/appexecfwk/ams_standard/fwkdataaccessor/Test.json +++ b/appexecfwk/ams_standard/fwkdataaccessor/Test.json @@ -19,20 +19,21 @@ "type": "ShellKit", "run-command": [ "remount", - "mkdir /system/vendor" + "mkdir /data/test" ] }, { "type": "PushKit", "push": [ - "amsStDataAbility.hap->/system/vendor/amsStDataAbility.hap" + "amsStDataAbility.hap->/data/test/amsStDataAbility.hap" ] }, { "type": "ShellKit", "run-command": [ - "chmod 644 /system/vendor/*.hap" + "chmod 644 /data/test/*.hap", + "bm install -p /data/test/amsStDataAbility.hap" ] } ] diff --git a/appexecfwk/ams_standard/fwkdataaccessor/entry/src/main/js/test/DataAbilityHelperJsSt.test.js b/appexecfwk/ams_standard/fwkdataaccessor/entry/src/main/js/test/DataAbilityHelperJsSt.test.js index 55d4b2a6489523b4e4fcf2899a844539c3b51748..09615e477b85b20bdb36f4cc19693b0a2c997edd 100644 --- a/appexecfwk/ams_standard/fwkdataaccessor/entry/src/main/js/test/DataAbilityHelperJsSt.test.js +++ b/appexecfwk/ams_standard/fwkdataaccessor/entry/src/main/js/test/DataAbilityHelperJsSt.test.js @@ -14,236 +14,200 @@ */ import featureAbility from '@ohos.ability.featureAbility' import ohos_data_ability from '@ohos.data.dataability' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' describe('ActsDataAbilityHelperTest', function () { - let bundleName = "com.ix.verify.act"; - //let abilityName = "VerifyActDataAbility"; - //let dataAbilityUri = ("dataability:///com.ohos.amsst.AppDataC.AmsStDataAbilityDataC1"); let dataAbilityUri = ("dataability:///com.ix.VerifyActDataAbility"); - + let dataAbilityUri2 = ("dataability:///com.ix.VerifyActDataAbility2"); let DAHelper; - let g_setTimeout = 100 + let g_setTimeout = 5000 + beforeAll(async (done) => { + console.debug('= ACTS_beforeAll ====: ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper)); + } catch (err) { + console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err); + } + console.debug('= ACTS_beforeAll ==== { + console.debug('= ACTS_afterAll ====" - + (" json data【") + JSON.stringify(data)+ (" 】;")); - //expect(data.abilityInfo.length).assertEqual(1); - done(); - }catch(err) { - console.error('=bms_installAbility_0100 install catch(err)====>:'+err); - expect(false).assertTrue(); - done(); - } - setTimeout(function () { - console.info('=bms_installAbility_0100====> setTimeout'); - }, g_setTimeout) - console.log('bms_installAbility_0100====" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof err).assertEqual('object'); - expect(err.code).assertEqual(0); - expect(typeof data).assertEqual('object'); - expect(data.status).assertEqual(0); - expect(data.statusMessage).assertEqual('SUCCESS'); - } - }catch(err) { - console.error('=bms_installAbility_0100 getBundleInstaller catch(err)====>:'+err); - expect(false).assertTrue(); - } - } - -/* -* @tc.number: ACTS_AcquireDataAbilityHelper_0100 -* @tc.name: GetDataAbilityHelper : Connects an ability to a Service ability -* @tc.desc: Check the return value of the interface () -*/ - it('ACTS_AcquireDataAbilityHelper_0100',0, async function (done) { + it('ACTS_AcquireDataAbilityHelper_0100', 0, async function (done) { console.log('ACTS_AcquireDataAbilityHelper_0100====" - + (" json dataAbilityUri 【") + JSON.stringify(dataAbilityUri)+ (" 】; ====>")) - let ret = false; - try{ + console.debug("=ACTS_AcquireDataAbilityHelper_0100 dataAbilityUri====>" + dataAbilityUri) + try { var abilityHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri) -// .then(function (data) { -// console.debug("=ACTS_AcquireDataAbilityHelper_0100 then data====>" -// + (" json data 【") + JSON.stringify(data)+ (" 】; ====>")+data); -// expect(typeof(data)).assertEqual("object"); -// console.log('=ACTS_AcquireDataAbilityHelper_0100 promise JSON.stringify([object])====>:' + JSON.stringify(promise)+","+promise); -// ret = true; -// done() -// }).catch(function (err){ -// console.debug("=ACTS_AcquireDataAbilityHelper_0100 catch err====>" -// + ("json err 【") + JSON.stringify(err) + (" 】 ====>")+err); -// console.log('=ACTS_AcquireDataAbilityHelper_0100 promise====>:' + JSON.stringify(promise)) -// ret = false; -// done(); -// }); - DAHelper = abilityHelper; - ret = true; - done() - }catch(err) { - console.error('=ACTS_GetDataAbilityHelper_0100 acquireDataAbilityHelper catch(err)====>:'+err); - ret = false; - done(); + console.log('ACTS_AcquireDataAbilityHelper_0100 abilityHelper ====>: ' + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) + expect(typeof (abilityHelper)).assertEqual("object"); + } catch (err) { + console.error('=ACTS_GetDataAbilityHelper_0100 acquireDataAbilityHelper catch(err)====>:' + err); + expect(false).assertTrue(); } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); + done(); console.log('ACTS_AcquireDataAbilityHelper_0100====: ' + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) + if (JSON.stringify(abilityHelper) == 'undefined' || JSON.stringify(abilityHelper) == 'null') + expect(true).assertTrue(); + else + expect(false).assertTrue(); + } catch (err) { + console.error('=ACTS_GetDataAbilityHelper_0200 acquireDataAbilityHelper catch(err)====>:' + err); + expect(false).assertTrue(); + } + done(); + console.log('ACTS_AcquireDataAbilityHelper_0200====: ' + JSON.stringify(DAHelper)+","+ DAHelper) + expect(typeof (DAHelper)).assertEqual("object"); + console.log('Insert_0100 DAHelper ====>: ' + DAHelper) let valueBucket - try{ - DAHelper.insert(dataAbilityUri,valueBucket) - .then(function (data){ - console.debug("=ACTS_Insert_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number"); - expect(data).assertEqual(1); - ret = true; - done(); - }).catch(function (err){ - console.debug("=ACTS_Insert_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false; - done(); - }); - }catch(err) { - console.error('=ACTS_Insert_0100 catch(err)====>:'+err); + try { + DAHelper.insert(dataAbilityUri, valueBucket) + .then(function (data) { + console.debug("=ACTS_Insert_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(1); + ret = true; + done(); + }).catch(function (err) { + console.debug("=ACTS_Insert_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false; + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_Insert_0100 catch(err)====>:' + err); ret = false; + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_Insert_0100====: ' + DAHelper) let valueBucket - try{ - var asyncCallback = await DAHelper.insert(dataAbilityUri,valueBucket, - (err,data)=>{ + try { + await DAHelper.insert(dataAbilityUri, valueBucket, + (err, data) => { console.debug("=ACTS_Insert_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); + + ("json err【") + JSON.stringify(err) + (" 】data【") + data + (" 】;")); expect(data).assertEqual(1); - console.log('=ACTS_Insert_0200 asyncCallback ====>:' + JSON.stringify(asyncCallback)) ret = true; done(); } ); - }catch(err) { - console.error('=ACTS_Insert_0200 catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_Insert_0200 catch(err)====>:' + err); ret = false; + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_Insert_0200==== { - console.debug("=ACTS_Insert_0300 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number"); - expect(data).assertEqual(1); - ret = true; - done(); - }).catch((err)=>{ - console.debug("=ACTS_Insert_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - //debugAnsErrorCodePrint(err.code); - ret = false; - done(); - }); - }catch(err) { - console.error('=ACTS_Insert_0300 catch(err)====>:'+err); + console.debug("=ACTS_Insert_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number"); + ret = true; + done(); + }).catch((err) => { + console.debug("=ACTS_Insert_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false; + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_Insert_0300 catch(err)====>:' + err); ret = false; + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_Insert_0300====: ' + DAHelper) const valueBucket = { "name": "ACTS_Insert_0400_rose1", @@ -251,169 +215,175 @@ describe('ActsDataAbilityHelperTest', function () { "salary": 20.5, "blobType": "u8", } - try{ - var asyncCallback = await DAHelper.insert(dataAbilityUri,valueBucket, - (err,data)=>{ + try { + await DAHelper.insert(dataAbilityUri, valueBucket, + (err, data) => { console.debug("=ACTS_Insert_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); expect(data).assertEqual(1); ret = true; done(); } ); - }catch(err) { - console.error('=ACTS_Insert_0400 catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_Insert_0400 catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_Insert_0400====: ' + DAHelper) var valueBucket; - try{ + try { DAHelper.batchInsert( dataAbilityUri, valueBucket ).then((data) => { console.debug("=ACTS_BatchInsert_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】; ====>")); - expect(typeof(data)).assertEqual("number"); + + ("json data 【") + JSON.stringify(data) + (" 】; ====>")); + expect(data).assertEqual(0); ret = true; done(); - }).catch((err)=>{ + }).catch((err) => { console.debug("=ACTS_BatchInsert_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_BatchInsert_0100 catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_BatchInsert_0100 catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_BatchInsert_0100====: ' + DAHelper) var valueBucket; - try{ + try { await DAHelper.batchInsert( dataAbilityUri, valueBucket, - (err,data) => { + (err, data) => { console.debug("=ACTS_BatchInsert_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(0); ret = true; done(); }, ); - }catch(err) { - console.error('=ACTS_BatchInsert_0200 catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_BatchInsert_0200 catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_BatchInsert_0200====: ' + DAHelper) - var valueBucketArray = new Array({},{},{}) - try{ + var valueBucketArray = new Array({}, {}, {}) + try { DAHelper.batchInsert( dataAbilityUri, valueBucketArray, ).then((data) => { console.debug("=ACTS_BatchInsert_0300 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】; ====>")); - expect(typeof(data)).assertEqual("number"); + + ("json data 【") + JSON.stringify(data) + (" 】; ====>")); + expect(data).assertEqual(3); ret = true; done(); - }).catch((err)=>{ + }).catch((err) => { console.debug("=ACTS_BatchInsert_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_BatchInsert_0300 batchInsert AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_BatchInsert_0300 batchInsert AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_BatchInsert_0300====: ' + DAHelper) - var valueBucketArray = new Array({},{},{}) - try{ + var valueBucketArray = new Array({}, {}, {}) + try { await DAHelper.batchInsert( dataAbilityUri, valueBucketArray, - (err,data) => { + (err, data) => { console.debug("=ACTS_BatchInsert_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(3); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_BatchInsert_0400 catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_BatchInsert_0400 catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_BatchInsert_0400====: ' + DAHelper) - try{ + try { const valueBucket = { "name": "ACTS_BatchInsert_0500_roe1", "age": 21, "salary": 20.5, } - var valueBucketArray = new Array({"name": "BatchInsert_0500_roe11", "age": 21, "salary": 20.5, }, - {"name": "BatchInsert_0500_roe12", "age": 21, "salary": 20.5, }, - {"name": "BatchInsert_0500_roe13", "age": 21, "salary": 20.5, }) + var valueBucketArray = new Array({ "name": "BatchInsert_0500_roe11", "age": 21, "salary": 20.5, }, + { "name": "BatchInsert_0500_roe12", "age": 21, "salary": 20.5, }, + { "name": "BatchInsert_0500_roe13", "age": 21, "salary": 20.5, }) DAHelper.batchInsert( dataAbilityUri, valueBucketArray, ).then((data) => { console.debug("=ACTS_BatchInsert_0500 BatchInsert Promise then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number"); + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(3); ret = true done(); - }).catch((err)=>{ + }).catch((err) => { console.debug("=ACTS_BatchInsert_0500 BatchInsert Promise catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_BatchInsert_0500 catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_BatchInsert_0500 catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_BatchInsert_0500====: ' + DAHelper) const valueBucket = { "name": "BatchInsert_0600_roe1", "age": 21, "salary": 20.5, } - var valueBucketArray = new Array({"name": "BatchInsert_0600_roe11", "age": 21, "salary": 20.5, }, - {"name": "BatchInsert_0600_roe12", "age": 21, "salary": 20.5, }, - {"name": "BatchInsert_0600_roe13", "age": 21, "salary": 20.5, }) - try{ + var valueBucketArray = new Array({ "name": "BatchInsert_0600_roe11", "age": 21, "salary": 20.5, }, + { "name": "BatchInsert_0600_roe12", "age": 21, "salary": 20.5, }, + { "name": "BatchInsert_0600_roe13", "age": 21, "salary": 20.5, }) + try { await DAHelper.batchInsert( dataAbilityUri, valueBucketArray, - (err,data) => { + (err, data) => { console.debug("=ACTS_BatchInsert_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(3); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_BatchInsert_0600 catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_BatchInsert_0600 catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_BatchInsert_0600====:' -// + ("json columnsArray 【") + JSON.stringify(columnsArray) + (" 】 ")+","+columnsArray); -//// const valueBucket = { -//// "name": "ACTS_Query_0100_roe1", -//// } -// try{ -// //let predicates = new ohos_data_ability.DataAbilityPredicates() -// let predicates = null -// console.error('=ACTS_Query_0100 ====>:' -// + ("json predicates 【") + JSON.stringify(predicates) + (" 】 ")+","+predicates); -// DAHelper.query(dataAbilityUri,columnsArray,predicates -// ).then((data) => { -// console.debug("=ACTS_Query_0100 then data====>" -// + ("json data 【") + JSON.stringify(data)+ (" 】")); -// expect(typeof(data)).assertEqual("number"); -// ret = true -// expect(ret).assertTrue(); -// done(); -// }).catch((err)=>{ -// console.debug("=ACTS_Query_0100 catch err ====>" -// + ("json err 【") + JSON.stringify(err) + (" 】 ")); -// ret = false -// expect(ret).assertTrue(); -// done(); -// }); -// }catch(err) { -// console.error('=ACTS_Query_0100 insert query AsyncCallback catch(err)====>:'+err); -// ret = false -// expect(ret).assertTrue(); -// done(); -// } -// setTimeout(function(){ -// console.error('=ACTS_Query_0100 setTimeout ret====>:'+ret); -// }, g_setTimeout); -// console.log('ACTS_Query_0100====: ' + DAHelper) -// try{ -// await DAHelper.query( -// dataAbilityUri, -// columnsArray, -// predicates, -// (err,data) => { -// console.debug("=ACTS_Query_0200 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// expect(typeof(data)).assertEqual("object"); -// ret = true -// done(); -// }, -// ); -// }catch(err) { -// console.error('=ACTS_Query_0200 catch(err)====>:'+err); -// ret = false -// done(); -// } -// setTimeout(function(){ -// expect(ret).assertTrue(); -// }, g_setTimeout); -// console.log('ACTS_Query_0200==== { - console.debug("=ACTS_Query_0300 Query then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】") +" , " + data); - expect(typeof(data)).assertEqual("object"); - ret = true - done(); - }).catch((err)=>{ - console.debug("=ACTS_Query_0300 Query catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); + ); console.debug("=ACTS_Query_0300 queryPromise ====>" - + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ")); - }catch(err) { - console.error('=ACTS_Query_0300 query catch(err)====>:'+err); + + ("json queryPromise 【") + JSON.stringify(queryPromise) + (" 】 ") + " , " + queryPromise); + expect(typeof (queryPromise)).assertEqual("object"); + done(); + } catch (err) { + console.error('=ACTS_Query_0300 query catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_Query_0300==== { + (err, data) => { console.debug("=ACTS_Query_0400 query err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;") + " , " +data); - expect(typeof(data)).assertEqual("object"); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + " , " + data); + expect(typeof (data)).assertEqual("object"); ret = true done(); - },); - }catch(err) { - console.error('=ACTS_Query_0400 catch(err)====>:'+err); + }); + } catch (err) { + console.error('=ACTS_Query_0400 catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_Query_0400====: ' + DAHelper) -//// const valueBucket = { -//// "name": "ACTS_Update_0100_roe1", -//// } -//// try{ -//// //let predicates = new ohos_data_ability.DataAbilityPredicates() -//// let valueBucketNull = null -//// let predicates = null -//// DAHelper.update( -//// dataAbilityUri, -//// valueBucketNull, -//// predicates -//// ).then((data) => { -//// console.debug("=ACTS_Update_0100 then data====>" -//// + ("json data 【") + JSON.stringify(data)+ (" 】")); -//// expect(typeof(data)).assertEqual("number"); -//// ret = true -//// done(); -//// }).catch((err)=>{ -//// console.debug("=ACTS_Update_0100 catch err ====>" -//// + ("json err 【") + JSON.stringify(err) + (" 】 ")); -//// ret = false -//// done(); -//// }); -//// }catch(err) { -//// console.error('=ACTS_Update_0100 catch(err)====>:'+err); -//// ret = false -//// done(); -//// } -//// setTimeout(function(){ -//// expect(ret).assertTrue(); -//// }, g_setTimeout); -//// console.log('ACTS_Update_0100====: ' + DAHelper) -//// const valueBucket = { -//// "name": "ACTS_Update_0200_roe1", -//// "age": 21, -//// "salary": 20.5, -//// -//// } -//// try{ -//// //let predicates = new ohos_data_ability.DataAbilityPredicates() -//// let valueBucketNull = null -//// let predicates = null -//// await DAHelper.update( -//// dataAbilityUri, -//// valueBucketNull, -//// predicates, -//// (err,data) => { -//// console.debug("=ACTS_Update_0200 err,data=======>" -//// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -//// expect(typeof(data)).assertEqual("number"); -//// ret = true -//// done(); -//// }, -//// ); -//// }catch(err) { -//// console.error('=ACTS_Update_0200 catch(err)====>:'+err); -//// ret = false -//// done(); -//// } -//// setTimeout(function(){ -//// expect(ret).assertTrue(); -//// }, g_setTimeout); -//// console.log('ACTS_Update_0200====: ' + DAHelper) -// const valueBucket = {"name": "ACTS_Update_0300_roe1","age": 21,"salary": 20.5,} -// try{ -// let predicates = new ohos_data_ability.DataAbilityPredicates() -// DAHelper.update( -// dataAbilityUri, -// valueBucket, -// predicates -// ).then((data) => { -// console.debug("=ACTS_Update_0300 then data====>" -// + ("json data 【") + JSON.stringify(data)+ (" 】")); -// expect(typeof(data)).assertEqual("number"); -// ret = true -// done(); -// }).catch((err)=>{ -// console.debug("=ACTS_Update_0300 catch err ====>" -// + ("json err 【") + JSON.stringify(err) + (" 】 ")); -// ret = false -// done(); -// }); -// }catch(err) { -// console.error('=ACTS_Update_0300 update catch(err)====>:'+err); -// ret = false -// done(); -// } -// setTimeout(function(){ -// expect(ret).assertTrue(); -// }, g_setTimeout); -// console.log('ACTS_Update_0300====: ' + DAHelper) -// const valueBucket = {"name": "ACTS_Update_0400_roe1","age": 21,"salary": 20.5,} -// try{ -// let predicates = new ohos_data_ability.DataAbilityPredicates() -// await DAHelper.update( -// dataAbilityUri, -// valueBucket, -// predicates, -// (err,data) => { -// console.debug("=ACTS_Update_0400 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// expect(typeof(data)).assertEqual("number"); -// ret = true -// done(); -// }, -// ); -// }catch(err) { -// console.error('=ACTS_Update_0400 catch(err)====>:'+err); -// ret = false -// done(); -// } -// setTimeout(function(){ -// expect(ret).assertTrue(); -// }, g_setTimeout); -// console.log('ACTS_Update_0400====: ' + DAHelper) -// try{ -// let predicates = null -// DAHelper.delete( -// dataAbilityUri, -// predicates -// ).then((data) => { -// console.debug("=ACTS_Delete_0100 then data====>" -// + ("json data 【") + JSON.stringify(data)+ (" 】")); -// expect(typeof(data)).assertEqual("number"); -// ret = true -// done(); -// }).catch((err)=>{ -// console.debug("=ACTS_Delete_0100 catch err ====>" -// + ("json err 【") + JSON.stringify(err) + (" 】 ")); -// ret = false -// done(); -// }); -// }catch(err) { -// console.error('=ACTS_Delete_0100 catch(err)====>:'+err); -// ret = false -// done(); -// } -// setTimeout(function(){ -// expect(ret).assertTrue(); -// }, g_setTimeout); -// console.log('ACTS_Delete_0100====: ' + DAHelper) -// try{ -// let predicates = null -// await DAHelper.delete( -// dataAbilityUri, -// predicates, -// (err,data) => { -// console.debug("=ACTS_Delete_0200 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// expect(typeof(data)).assertEqual("number"); -// expect(data).assertEqual(0); -// ret = true -// done(); -// }, -// ); -// }catch(err) { -// console.error('=ACTS_Delete_0200 catch(err)====>:'+err); -// ret = false -// done(); -// } -// setTimeout(function(){ -// expect(ret).assertTrue(); -// }, g_setTimeout); -// console.log('ACTS_Delete_0200====: ' + DAHelper) + try { + let valueBucketNull = {}; + let predicates = new ohos_data_ability.DataAbilityPredicates(); + console.debug("=ACTS_Update_0100 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.update( dataAbilityUri, + valueBucketNull, predicates ).then((data) => { - console.debug("=ACTS_Delete_0300 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number"); + console.debug("=ACTS_Update_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number"); ret = true done(); - }).catch((err)=>{ - console.debug("=ACTS_Delete_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + }).catch((err) => { + console.debug("=ACTS_Update_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false done(); }); - console.debug("=ACTS_Delete_0300 datadelete====>" - + ("json datadelete 【") + JSON.stringify(datadelete)+ (" 】")+" , " + datadelete); - }catch(err) { - console.error('=ACTS_Delete_0300 catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_Update_0100 catch(err)====>:' + err); + ret = false + done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); - console.log('ACTS_Delete_0300====: ' + DAHelper) - try{ - let predicates = new ohos_data_ability.DataAbilityPredicates() - await DAHelper.delete( + expect(typeof (DAHelper)).assertEqual("object"); + try { + let valueBucketNull = {}; + let predicates = new ohos_data_ability.DataAbilityPredicates(); + console.debug("=ACTS_Update_0200 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.update( dataAbilityUri, + valueBucketNull, predicates, - (err,data) => { - console.debug("=ACTS_Delete_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); + (err, data) => { + console.debug("=ACTS_Update_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); ret = true done(); - }); - }catch(err) { - console.error('=ACTS_Delete_0400 catch(err)====>:'+err); + }, + ); + } catch (err) { + console.error('=ACTS_Update_0200 catch(err)====>:' + err); ret = false done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); - console.log('ACTS_Delete_0400====: ' + DAHelper) + const valueBucket = { "name": "ACTS_Update_0300_roe1", "age": 21, "salary": 20.5, } + try { + let predicates = new ohos_data_ability.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_0300 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.update( dataAbilityUri, - mimeTypeFilter, - ).then((data) =>{ - console.debug("=ACTS_GetFileTypes_0100 getFileTypes then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0100 for data[' + i + '] ====>: ' + data[i]) - expect(data[i]).assertEqual(""); - } + valueBucket, + predicates + ).then((data) => { + console.debug("=ACTS_Update_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(1); ret = true done(); - }).catch(err => { - console.debug("=ACTS_GetFileTypes_0100 getFileTypes catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + }).catch((err) => { + console.debug("=ACTS_Update_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - console.log('featureAbility getFileTypes promise ====>: ' + promise) - }catch(err) { - console.error('=ACTS_GetFileTypes_0100 getFileTypes AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_Update_0300 update catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); - console.log('ACTS_GetFileTypes_0100====: ' + DAHelper) - let mimeTypeFilter='*/*' - try{ - await DAHelper.getFileTypes( + expect(typeof (DAHelper)).assertEqual("object"); + console.log('featureAbility Update getDataAbilityHelper ====>: ' + DAHelper) + const valueBucket = { "name": "ACTS_Update_0400_roe1", "age": 21, "salary": 20.5, } + try { + let predicates = new ohos_data_ability.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Update_0400 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.update( dataAbilityUri, - mimeTypeFilter, - (err,data) => { - console.debug("=ACTS_GetFileTypes_0200 getFileTypes err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - console.log('=ACTS_GetFileTypes_0200 data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0200 for data ====>: ' + err.code +" data[" + i + "]: " + data[i]); - expect(data[i]).assertEqual(""); - } + valueBucket, + predicates, + (err, data) => { + console.debug("=ACTS_Update_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(1); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_GetFileTypes_0200 getFileTypes AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_Update_0400 catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); - console.log('ACTS_GetFileTypes_0200====: ' + DAHelper) + try { + let predicates = new ohos_data_ability.DataAbilityPredicates(); + console.debug("=ACTS_Delete_0100 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.delete( dataAbilityUri, - mimeTypeFilter, - ).then((data) =>{ - console.debug("=ACTS_GetFileTypes_0300 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('= =ACTS_GetFileTypes_0300 for data[' + i + '] ====>: ' + data[i]) - expect(data[i]).assertEqual(""); - } + predicates + ).then((data) => { + console.debug("=ACTS_Delete_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number"); ret = true done(); - }).catch(err => { - console.debug("=ACTS_GetFileTypes_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - console.log('DataAbilityHelper getFileTypes error ====>: ' + err) + }).catch((err) => { + console.debug("=ACTS_Delete_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false done(); }); - console.log('featureAbility getFileTypes promise ====>: ' + promise) - }catch(err) { - console.error('=ACTS_GetFileTypes_0300 getFileTypes AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_Delete_0100 catch(err)====>:' + err); ret = false done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); - console.log('ACTS_GetFileTypes_0300====: ' + DAHelper) - let mimeTypeFilter='image/*' - try{ - await DAHelper.getFileTypes( + expect(typeof (DAHelper)).assertEqual("object"); + console.log('featureAbility getDataAbilityHelper ====>: ' + DAHelper) + try { + let predicates = new ohos_data_ability.DataAbilityPredicates(); + console.debug("=ACTS_Delete_0200 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.delete( dataAbilityUri, - mimeTypeFilter, - (err,data) => { - console.debug("=ACTS_GetFileTypes_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0400 for ====>: ' + err.code +" data[" + i + "]: " + data[i]); - expect(data[i]).assertEqual(""); - } + predicates, + (err, data) => { + console.debug("=ACTS_Delete_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + expect(data).assertEqual(1); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_GetFileTypes_0400 getFileTypes AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_Delete_0200 catch(err)====>:' + err); ret = false done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); - console.log('ACTS_GetFileTypes_0400====" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + var datadelete = DAHelper.delete( dataAbilityUri, - mimeTypeFilter, - ).then((data) =>{ - console.debug("=ACTS_GetFileTypes_0500 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); + predicates + ).then((data) => { + console.debug("=ACTS_Delete_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(1); + ret = true + done(); + }).catch((err) => { + console.debug("=ACTS_Delete_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false + expect(false).assertTrue(); + done(); + }); + console.debug("=ACTS_Delete_0300 datadelete====>" + + ("json datadelete 【") + JSON.stringify(datadelete) + (" 】") + " , " + datadelete); + } catch (err) { + console.error('=ACTS_Delete_0300 catch(err)====>:' + err); + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, g_setTimeout); + console.log('ACTS_Delete_0300====: ' + DAHelper) + try { + let predicates = new ohos_data_ability.DataAbilityPredicates(); + predicates.equalTo('contact_id', 1); + predicates.limitAs(10); + predicates.orderByAsc("order_by_class"); + predicates.offsetAs(1); + console.debug("=ACTS_Delete_0400 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + await DAHelper.delete( + dataAbilityUri, + predicates, + (err, data) => { + console.debug("=ACTS_Delete_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(data).assertEqual(1); + ret = true + done(); + }); + } catch (err) { + console.error('=ACTS_Delete_0400 catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, g_setTimeout); + console.log('ACTS_Delete_0400==== { + console.debug("=ACTS_GetFileTypes_0100 getFileTypes then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('=ACTS_GetFileTypes_0100 for data[' + i + '] ====>: ' + data[i]) + expect(data[i]).assertEqual(""); + } + ret = true + done(); + }).catch(err => { + console.debug("=ACTS_GetFileTypes_0100 getFileTypes catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + ret = false + expect(false).assertTrue(); + done(); + }); + console.log('featureAbility getFileTypes promise ====>: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_0100 getFileTypes AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, g_setTimeout); + console.log('ACTS_GetFileTypes_0100====: ' + DAHelper) + let mimeTypeFilter = '*/*' + try { + await DAHelper.getFileTypes( + dataAbilityUri, + mimeTypeFilter, + (err, data) => { + console.debug("=ACTS_GetFileTypes_0200 getFileTypes err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('=ACTS_GetFileTypes_0200 data.length ====>: ' + data.length); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('=ACTS_GetFileTypes_0200 for data ====>: ' + err.code + " data[" + i + "]: " + data[i]); + expect(data[i]).assertEqual(""); + } + ret = true + done(); + }, + ); + } catch (err) { + console.error('=ACTS_GetFileTypes_0200 getFileTypes AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, g_setTimeout); + console.log('ACTS_GetFileTypes_0200==== { + console.debug("=ACTS_GetFileTypes_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('= =ACTS_GetFileTypes_0300 for data[' + i + '] ====>: ' + data[i]) + expect(data[i]).assertEqual(""); + } + ret = true + done(); + }).catch(err => { + console.debug("=ACTS_GetFileTypes_0300 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('DataAbilityHelper getFileTypes error ====>: ' + err) + ret = false + expect(false).assertTrue(); + done(); + }); + console.log('featureAbility getFileTypes promise ====>: ' + promise) + } catch (err) { + console.error('=ACTS_GetFileTypes_0300 getFileTypes AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, g_setTimeout); + console.log('ACTS_GetFileTypes_0300====: ' + DAHelper) + let mimeTypeFilter = 'image/*' + try { + await DAHelper.getFileTypes( + dataAbilityUri, + mimeTypeFilter, + (err, data) => { + console.debug("=ACTS_GetFileTypes_0400 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('=ACTS_GetFileTypes_0400 for ====>: ' + err.code + " data[" + i + "]: " + data[i]); + expect(data[i]).assertEqual(""); + } + ret = true + done(); + }, + ); + } catch (err) { + console.error('=ACTS_GetFileTypes_0400 getFileTypes AsyncCallback catch(err)====>:' + err); + ret = false + expect(false).assertTrue(); + done(); + } + setTimeout(function () { + console.log('setTimeout function====<'); + }, g_setTimeout); + console.log('ACTS_GetFileTypes_0400==== { + console.debug("=ACTS_GetFileTypes_0500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + console.log('DataAbilityHelper getFileTypes data.length ====>: ' + data.length); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); console.log('=ACTS_GetFileTypes_0500 for data [' + i + '] ====>: ' + data[i]) expect(data[i]).assertEqual(""); } @@ -1158,939 +1080,857 @@ describe('ActsDataAbilityHelperTest', function () { done(); }).catch(err => { console.debug("=ACTS_GetFileTypes_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); console.log('DataAbilityHelper getFileTypes error ====>: ' + err) ret = false done(); }); console.log('=ACTS_GetFileTypes_0500 promise ====>: ' + promise) - }catch(err) { - console.error('=ACTS_GetFileTypes_0500 getFileTypes AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_GetFileTypes_0500 getFileTypes AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_GetFileTypes_0500====: ' + DAHelper) - let mimeTypeFilter='*/jpg' - try{ + let mimeTypeFilter = '*/jpg' + try { await DAHelper.getFileTypes( dataAbilityUri, mimeTypeFilter, - (err,data) => { + (err, data) => { console.debug("=ACTS_GetFileTypes_0600 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); console.log('=ACTS_GetFileTypes_0600 data.length ====>: ' + data.length); - for(var i = 0; i < data.length; i++) { - expect(typeof(data[i])).assertEqual("string"); - console.log('=ACTS_GetFileTypes_0600 for errCode ====>: ' + err.code +" data[" + i + "]: " + data[i]); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log('=ACTS_GetFileTypes_0600 for errCode ====>: ' + err.code + " data[" + i + "]: " + data[i]); expect(data[i]).assertEqual(""); } ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_GetFileTypes_0600 catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_GetFileTypes_0600 catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_GetFileTypes_0600===={ + ).then(data => { console.debug("=ACTS_GetType_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("string") + + ("json data 【") + JSON.stringify(data) + (" 】")); + //expect(typeof(data)).assertEqual("string") + expect(data).assertEqual(dataAbilityUri); ret = true done(); }).catch(err => { console.debug("=ACTS_GetFileTypes_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); console.log('featureAbility getType promise ====>: ' + promise) - }catch(err) { - console.error('=ACTS_GetType_0100 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_GetType_0100 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_GetType_0100====: ' + DAHelper) - try{ + try { await DAHelper.getType( dataAbilityUri, - (err,data) => { + (err, data) => { console.debug("=ACTS_GetType_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("string"); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + //expect(typeof(data)).assertEqual("string"); + expect(data).assertEqual(dataAbilityUri); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_GetType_0200 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_GetType_0200 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_GetType_0200===={ + ).then((data) => { console.debug("=ACTS_OpenFile_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") ret = true done(); }).catch(err => { console.debug("=ACTS_OpenFile_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_OpenFile_0100 getType catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_0100 getType catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_0100===={ + ).then((data) => { console.debug("=ACTS_OpenFile_0200 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") console.log('DataAbilityHelper ACTS_OpenFile_0200 OpenFile promise ====>: ' + data) ret = true done(); }).catch(err => { console.debug("=ACTS_OpenFile_0200 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false done(); }); - }catch(err) { - console.error('=ACTS_OpenFile_0200 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_0200 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_0200===={ + ).then((data) => { console.debug("=ACTS_OpenFile_0300 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") console.log('DataAbilityHelper ACTS_OpenFile_0300 OpenFile promise ====>: ' + data) ret = true done(); }).catch(err => { console.debug("=ACTS_OpenFile_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_OpenFile_0300 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_0300 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_0300===={ + ).then((data) => { console.debug("=ACTS_OpenFile_0400 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") console.log('DataAbilityHelper ACTS_OpenFile_0400 OpenFile promise ====>: ' + data) ret = true done(); }).catch(err => { console.debug("=ACTS_OpenFile_0400 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_OpenFile_0400 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_0400 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_0400===={ + ).then((data) => { console.debug("=ACTS_OpenFile_0500 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") console.log('DataAbilityHelper ACTS_OpenFile_0500 OpenFile promise ====>: ' + data) ret = true done(); }).catch(err => { console.debug("=ACTS_OpenFile_0500 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_OpenFile_0500 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_0500 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_0500===={ + ).then((data) => { console.debug("=ACTS_OpenFile_0600 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("number") + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(typeof (data)).assertEqual("number") console.log('DataAbilityHelper ACTS_OpenFile_0600 OpenFile promise ====>: ' + data) ret = true done(); }).catch(err => { console.debug("=ACTS_OpenFile_0600 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_OpenFile_0600 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_0600 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_0600====: ' + DAHelper) var mode = "r"; - try{ + try { DAHelper.openFile( dataAbilityUri, mode, - (err,data) => { + (err, data) => { console.debug("=ACTS_OpenFile_0700 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_0700 OpenFile asyncCallback errCode ====>: ' + err.code +" data: " + data); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + console.log('DataAbilityHelper ACTS_OpenFile_0700 OpenFile asyncCallback errCode ====>: ' + err.code + " data: " + data); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_OpenFile_0700 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_0700 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_0700====: ' + DAHelper) var mode = "w"; - try{ + try { DAHelper.openFile( dataAbilityUri, mode, - (err,data) => { + (err, data) => { console.debug("=ACTS_OpenFile_0800 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_0800 OpenFile asyncCallback errCode ====>: ' + err.code +" data: " + data); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + console.log('DataAbilityHelper ACTS_OpenFile_0800 OpenFile asyncCallback errCode ====>: ' + err.code + " data: " + data); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_OpenFile_0800 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_0800 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_0800====: ' + DAHelper) var mode = "wt"; - try{ + try { DAHelper.openFile( dataAbilityUri, mode, - (err,data) => { + (err, data) => { console.debug("=ACTS_OpenFile_0900 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_0900 OpenFile asyncCallback errCode ====>: ' + err.code +" data: " + data); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + console.log('DataAbilityHelper ACTS_OpenFile_0900 OpenFile asyncCallback errCode ====>: ' + err.code + " data: " + data); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_OpenFile_0900 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_0900 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_0900====: ' + DAHelper) var mode = "wa"; - try{ + try { DAHelper.openFile( dataAbilityUri, mode, - (err,data) => { + (err, data) => { console.debug("=ACTS_OpenFile_1000 err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); - console.log('DataAbilityHelper ACTS_OpenFile_1000 OpenFile asyncCallback errCode ====>: ' + err.code +" data: " + data); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); + console.log('DataAbilityHelper ACTS_OpenFile_1000 OpenFile asyncCallback errCode ====>: ' + err.code + " data: " + data); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_OpenFile_1000 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_1000 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_1000====: ' + DAHelper) var mode = "rw"; - try{ + try { DAHelper.openFile( dataAbilityUri, mode, - (err,data) => { + (err, data) => { console.debug("=ACTS_OpenFile_1100 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_OpenFile_1100 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_1100 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_1100====: ' + DAHelper) var mode = "rwt"; - try{ + try { DAHelper.openFile( dataAbilityUri, mode, - (err,data) => { + (err, data) => { console.debug("=ACTS_OpenFile_1200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("number"); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("number"); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_OpenFile_1200 getType AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_OpenFile_1200 getType AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_OpenFile_1200====: ' + DAHelper) - try{ - var promise = DAHelper.release( + try { + DAHelper.release( dataAbilityUri, - ).then((data) =>{ + ).then((data) => { console.debug("=ACTS_Release_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("boolean") + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); + // expect(typeof(data)).assertEqual("boolean") + expect(data).assertEqual(true); ret = true done(); - }).catch(err =>{ + }).catch(err => { console.debug("=ACTS_Release_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_Release_0100 release promise catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_Release_0100 release promise catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_Release_0100====: ' + DAHelper) - try{ + try { DAHelper.release( dataAbilityUri, - (err,data) => { + (err, data) => { console.debug("=ACTS_Release_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); console.log('featureAbility getDataAbilityHelper ACTS_Release_0100 data: ' + data) - expect(typeof(data)).assertEqual("boolean"); - console.log('DataAbilityHelper ACTS_Release_0200 asyncCallback errCode ====>: ' + err.code +" data: " + data); + //expect(typeof(data)).assertEqual("boolean"); + expect(data).assertEqual(false); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_Release_0200 release AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_Release_0200 release AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_Release_0200====: ' + DAHelper) - try{ - var promise = DAHelper.normalizeUri( + try { + DAHelper.normalizeUri( dataAbilityUri, - ).then((data) =>{ + ).then((data) => { console.debug("=ACTS_NormalizeUri_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("string") - //expect(data).assertEqual("dataability:///com.ix.VerifyActDataAbility"); + + ("json data 【") + JSON.stringify(data) + (" 】")); + //expect(typeof(data)).assertEqual("string") + expect(data).assertEqual(dataAbilityUri); ret = true done(); - }).catch(err =>{ + }).catch(err => { console.debug("=ACTS_NormalizeUri_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_NormalizeUri_0100 normalizeUri promise catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_NormalizeUri_0100 normalizeUri promise catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_NormalizeUri_0100====: ' + DAHelper) - try{ + try { DAHelper.normalizeUri( dataAbilityUri, - (err,data) => { + (err, data) => { console.debug("=ACTS_NormalizeUri_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("string"); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + expect(typeof (data)).assertEqual("string"); expect(data).assertEqual(dataAbilityUri); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_NormalizeUri_0200 normalizeUri AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_NormalizeUri_0200 normalizeUri AsyncCallback catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_NormalizeUri_0200====: ' + DAHelper) - try{ - var promise = DAHelper.denormalizeUri( + try { + DAHelper.denormalizeUri( dataAbilityUri, - ).then((data) =>{ + ).then((data) => { console.debug("=ACTS_DenormalizeUri_0100 then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - expect(typeof(data)).assertEqual("string") + + ("json data 【") + JSON.stringify(data) + (" 】")); + //expect(typeof(data)).assertEqual("string") expect(data).assertEqual(dataAbilityUri); ret = true done(); - }).catch(err =>{ + }).catch(err => { console.debug("=ACTS_DenormalizeUri_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); + + ("json err 【") + JSON.stringify(err) + (" 】 ")); ret = false + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_DenormalizeUri_0100 denormalizeUri promise catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_DenormalizeUri_0100 denormalizeUri promise catch(err)====>:' + err); ret = false + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_DenormalizeUri_0100====: ' + DAHelper) - try{ + try { DAHelper.denormalizeUri( dataAbilityUri, - (err,data) => { + (err, data) => { console.debug("=ACTS_DenormalizeUri_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); - expect(typeof(data)).assertEqual("string"); + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); + //expect(typeof(data)).assertEqual("string"); expect(data).assertEqual(dataAbilityUri); ret = true done(); }, ); - }catch(err) { - console.error('=ACTS_DenormalizeUri_0200 denormalizeUri AsyncCallback catch(err)====>:'+err); + } catch (err) { + console.error('=ACTS_DenormalizeUri_0200 denormalizeUri AsyncCallback catch(err)====>:' + err); ret = true + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); + setTimeout(function () { + console.log('setTimeout function====<'); }, g_setTimeout); console.log('ACTS_DenormalizeUri_0200====" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// isFlagCallback01++; -// console.debug("=ACTS_OnOff_ asyncCallback01 isFlagCallback01=======>" -// + ("json isFlagCallback01【") + JSON.stringify(isFlagCallback01) + (" 】")+" , "+isFlagCallback01); -// } -// function asyncCallback02(err,data){ -// console.debug("=ACTS_OnOff_ asyncCallback02 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// isFlagCallback02++; -// console.debug("=ACTS_OnOff_ asyncCallback02 isFlagCallback02=======>" -// + ("json isFlagCallback02【") + JSON.stringify(isFlagCallback02) + (" 】")+" , "+isFlagCallback02); -// } -// function asyncCallback03(err,data){ -// console.debug("=ACTS_OnOff_ asyncCallback03 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// isFlagCallback02++; -// console.debug("=ACTS_OnOff_ asyncCallback03 isFlagCallback03=======>" -// + ("json isFlagCallback03【") + JSON.stringify(isFlagCallback03) + (" 】")+" , "+isFlagCallback03); -// } -///* -//* @tc.number: ACTS_OnOff_0100 -//* @tc.name: On/Off : Registers an observer to observe data specified by the given Uri -//* @tc.desc: Check the return value of the interface () -//*/ -// it('ACTS_OnOff_0100', 0, async function (done) { -// console.log('ACTS_OnOff_0100==== { -// console.debug("=ACTS_OnOff_0100 notifyChange 1 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// },); -// setTimeout(function(){console.log('ACTS_OnOff_0100====" -// + ("json isFlagCallback01【") + JSON.stringify(isFlagCallback01) + (" 】")+" , "+isFlagCallback01); -// expect(isFlagCallback01).assertEqual(1); -// await DAHelper.off("dataChange",dataAbilityUri,asyncCallback01); -// await DAHelper.notifyChange( -// dataAbilityUri, -// (err,data) => { -// console.debug("=ACTS_OnOff_0100 notifyChange 2 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// },); -// setTimeout(function(){console.log('ACTS_OnOff_0100====" -// + ("json isFlagCallback01【") + JSON.stringify(isFlagCallback01) + (" 】")+" , "+isFlagCallback01); -// expect(isFlagCallback01).assertEqual(1); -// }catch(err) {console.error('=ACTS_OnOff_0100 catch(err)====>:'+err); } -// setTimeout(function(){console.log('ACTS_OnOff_0100==== { -// console.debug("=ACTS_OnOff_0200 notifyChange 1 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// }); -// setTimeout(function(){console.log('ACTS_OnOff_0100====" -// + ("json isFlagCallback01【") + JSON.stringify(isFlagCallback01) + (" 】")+" , "+isFlagCallback01); -// expect(isFlagCallback01).assertEqual(1); -// console.debug("=ACTS_OnOff_0200 isFlagCallback02=======>" -// + ("json isFlagCallback02【") + JSON.stringify(isFlagCallback02) + (" 】")+" , "+isFlagCallback02); -// expect(isFlagCallback02).assertEqual(1); -// console.debug("=ACTS_OnOff_0200 isFlagCallback03=======>" -// + ("json isFlagCallback03【") + JSON.stringify(isFlagCallback03) + (" 】")+" , "+isFlagCallback03); -// expect(isFlagCallback03).assertEqual(1); -// await DAHelper.off("dataChange",dataAbilityUri,asyncCallback02); -// await DAHelper.notifyChange(dataAbilityUri, -// (err,data) => { -// console.debug("=ACTS_OnOff_0200 notifyChange 2 err,data=======>" -// + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")); -// },); -// setTimeout(function(){console.log('ACTS_OnOff_0200====" -// + ("json isFlagCallback01【") + JSON.stringify(isFlagCallback01) + (" 】")+" , "+isFlagCallback01); -// expect(isFlagCallback01).assertEqual(2); -// console.debug("=ACTS_OnOff_0200 isFlagCallback02=======>" -// + ("json isFlagCallback02【") + JSON.stringify(isFlagCallback02) + (" 】")+" , "+isFlagCallback02); -// expect(isFlagCallback02).assertEqual(1); -// console.debug("=ACTS_OnOff_0200 isFlagCallback03=======>" -// + ("json isFlagCallback03【") + JSON.stringify(isFlagCallback03) + (" 】")+" , "+isFlagCallback03); -// expect(isFlagCallback03).assertEqual(2); -// }catch(err) { -// console.error('=ACTS_OnOff_0200 AsyncCallback catch(err)====>:'+err); -// } -// setTimeout(function(){console.log('ACTS_OnOff_0100==== { - console.debug("=ACTS_ExecuteBatch_0100 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - ret = true + console.debug("=ACTS_ExecuteBatch_Insert_0100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data.length); + expect(true).assertTrue(); done(); - }).catch((err)=>{ - console.debug("=ACTS_ExecuteBatch_0100 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Insert_0100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ") + " , " + err); + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0100 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; + } catch (err) { + console.error('=ACTS_ExecuteBatch_Insert_0100 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0100===={ - console.debug("=ACTS_ExecuteBatch_0200 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")+ data.length); - ret = true - done(); - } - ); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0200 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; + ).then((data) => { + console.debug("=ACTS_ExecuteBatch_Insert_0200 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data.length); + expect(true).assertTrue(); + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Insert_0200 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ") + " , " + err); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Insert_0200 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0200==== { - console.debug("=ACTS_ExecuteBatch_0300 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - ret = true + console.debug("=ACTS_ExecuteBatch_Insert_0300 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data.length); + expect(true).assertTrue(); done(); - }).catch((err)=>{ - console.debug("=ACTS_ExecuteBatch_0300 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Insert_0300 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ") + " , " + err); + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0300 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; + } catch (err) { + console.error('=ACTS_ExecuteBatch_Insert_0300 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0300===={ - console.debug("=ACTS_ExecuteBatch_0400 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")+ data.length); - ret = true + (err, data) => { + console.debug("=ACTS_ExecuteBatch_Insert_0400 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(err.code).assertEqual(0); done(); } ); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0400 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; + } catch (err) { + console.error('=ACTS_ExecuteBatch_Insert_0400 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0400==== { - console.debug("=ACTS_ExecuteBatch_0500 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - ret = true - done(); - }).catch((err)=>{ - console.debug("=ACTS_ExecuteBatch_0500 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false - done(); - }); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0500 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; + (err, data) => { + console.debug("=ACTS_ExecuteBatch_Insert_0500 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(err.code).assertEqual(0); + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Insert_0500 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0500===={ - console.debug("=ACTS_ExecuteBatch_0600 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")+ data.length); - ret = true + (err, data) => { + console.debug("=ACTS_ExecuteBatch_Insert_0600 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(err.code).assertEqual(0); done(); } ); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0600 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; + } catch (err) { + console.error('=ACTS_ExecuteBatch_Insert_0600 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0600==== { - console.debug("=ACTS_ExecuteBatch_0700 executeBatch then data====>" - + ("json data 【") + JSON.stringify(data)+ (" 】")); - ret = true + console.debug("=ACTS_ExecuteBatch_Update_0100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0100 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } done(); - }).catch((err)=>{ - console.debug("=ACTS_ExecuteBatch_0700 executeBatch catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - ret = false + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Update_0100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); done(); }); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0700 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; + } catch (err) { + console.error('=ACTS_ExecuteBatch_Update_0100 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); done(); } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0700===={ - console.debug("=ACTS_ExecuteBatch_0800 executeBatch err,data====>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data)+ (" 】;")+ data.length); - ret = true - done(); - } - ); - }catch(err) { - console.error('=ACTS_ExecuteBatch_0800 catch(err)====>:' - + ("json err 【") + JSON.stringify(err) + (" 】 ,")+err); - ret = false; - done(); - } - setTimeout(function(){ - expect(ret).assertTrue(); - }, g_setTimeout); - console.log('ACTS_ExecuteBatch_0800==== { + console.debug("=ACTS_ExecuteBatch_Update_0200 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0200 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); } - }, onReceiveUninstallEvent); - - function onReceiveUninstallEvent(err, data) { - console.info('========uninstall Finish========'); - expect(typeof err).assertEqual('object'); - expect(err.code).assertEqual(0); - expect(typeof data).assertEqual('object'); - expect(data.status).assertEqual(0); - expect(data.statusMessage).assertEqual('SUCCESS'); - } - }catch(err) { - console.error('=bms_uninstallAbility_0100 onReceiveUninstallEvent catch(err)====>:'+err); + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Update_0200 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Update_0200 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); expect(false).assertTrue(); + done(); } - } + console.debug('ACTS_ExecuteBatch_Update_0200====:'+err); + it('ACTS_ExecuteBatch_Update_0300', 0, async function (done) { + console.debug('ACTS_ExecuteBatch_Update_0300==== { + console.debug("=ACTS_ExecuteBatch_Update_0300 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0300 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Update_0300 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Update_0300 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); expect(false).assertTrue(); done(); } - setTimeout(function () { - console.info('bms_uninstallAbility_0100====< setTimeout'); - }, g_setTimeout) - console.info('bms_uninstallAbility_0100====< end'); + console.debug('ACTS_ExecuteBatch_Update_0300==== { + console.debug("=ACTS_ExecuteBatch_Update_0400 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0400 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Update_0400 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Update_0400==== { + console.debug("=ACTS_ExecuteBatch_Update_0500 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0300 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Update_0500 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Update_0500==== { + console.debug("=ACTS_ExecuteBatch_Update_0600 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Update_0300 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Update_0600 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Update_0600==== { + console.debug("=ACTS_ExecuteBatch_Assert_0100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Assert_0100 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Assert_0100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Assert_0100 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Assert_0100==== { + console.debug("=ACTS_ExecuteBatch_Assert_0200 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Assert_0200 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Assert_0200 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Assert_0200 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Assert_0200==== { + console.debug("=ACTS_ExecuteBatch_Assert_0300 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Assert_0300 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Assert_0300 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Assert_0300 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Assert_0300==== { + console.debug("=ACTS_ExecuteBatch_Assert_0400 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Assert_0400 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Assert_0400 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Assert_0400==== { + console.debug("=ACTS_ExecuteBatch_Assert_0500 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Assert_0500 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Assert_0500 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Assert_0500==== { + console.debug("=ACTS_ExecuteBatch_Assert_0600 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Assert_0600 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Assert_0600 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Assert_0600==== { + console.debug("=ACTS_ExecuteBatch_Delete_0100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0100 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Delete_0100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Delete_0100 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Delete_0100==== { + console.debug("=ACTS_ExecuteBatch_Delete_0200 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0200 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Delete_0200 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Delete_0200 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Delete_0200==== { + console.debug("=ACTS_ExecuteBatch_Delete_0300 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0300 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_Delete_0300 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Delete_0300 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Delete_0300==== { + console.debug("=ACTS_ExecuteBatch_Delete_0400 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0400 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Delete_0400 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Delete_0400==== { + console.debug("=ACTS_ExecuteBatch_Delete_0500 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0500 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Delete_0500 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Delete_0500==== { + console.debug("=ACTS_ExecuteBatch_Delete_0600 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_Delete_0600 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_Delete_0600 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_Delete_0600==== { + console.debug("=ACTS_ExecuteBatch_0100 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_0100 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_0100 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_0100 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_0100==== { + console.debug("=ACTS_ExecuteBatch_0200 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_0200 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_0200 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_0200==== { + console.debug("=ACTS_ExecuteBatch_0300 executeBatch then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_0300 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + }).catch((err) => { + console.debug("=ACTS_ExecuteBatch_0300 executeBatch catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_ExecuteBatch_0300 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_0300==== { + console.debug("=ACTS_ExecuteBatch_0400 executeBatch err,data====>" + + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;") + data.length); + expect(true).assertTrue(); + for (var i = 0; i < data.length; i++) { + console.debug('=ACTS_ExecuteBatch_0400 for data[' + i + '].count ====>: ' + data[i].count) + expect(data[i].count).assertEqual(1); + } + done(); + } + ); + } catch (err) { + console.error('=ACTS_ExecuteBatch_0400 catch(err)====>:' + + ("json err 【") + JSON.stringify(err) + (" 】 ,") + err); + expect(false).assertTrue(); + done(); + } + console.debug('ACTS_ExecuteBatch_0400===="); /* @@ -28,13 +28,10 @@ describe('ActsAnsBadgeDisplayTest', function () { await notify.isBadgeDisplayed({ bundle:"com.example.actsanslocalcandisplaytest", },(err,data) => { - console.log("===>ActsGetDisplay_test_0100 success===>"+err+data) + console.log("===>ActsGetDisplay_test_0100 success===>"+JSON.stringify(err)+data) expect(typeof(data)).assertEqual('boolean') done(); }) - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0100====>"); - }, time); }) /* * @tc.number: ActsGetDisplay_test_0200 @@ -42,15 +39,15 @@ describe('ActsAnsBadgeDisplayTest', function () { * @tc.desc: verify the function of isBadgeDisplayed */ it('ActsGetDisplay_test_0200', 0, async function (done) { - var promise = await notify.isBadgeDisplayed({ + notify.isBadgeDisplayed({ bundle:"com.example.actsanslocalcandisplaytest", - }) - console.log("===>ActsGetDisplay_test_0200 success===>"+promise) - expect(typeof(promise)).assertEqual('boolean') - done(); - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0200====>"); - }, time); + }).then((promise)=>{ + console.log("===>ActsGetDisplay_test_0200 success===>"+promise) + expect(typeof(promise)).assertEqual('boolean') + done()} + ).catch((err)=>{ + console.log("===>ActsGetDisplay_test_0200 err===>"+err.code) + }) }) /* * @tc.number: ActsGetDisplay_test_0300 @@ -66,9 +63,6 @@ describe('ActsAnsBadgeDisplayTest', function () { expect(data).assertEqual(false) done(); }) - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0300====>"); - }, time); }) /* * @tc.number: ActsGetDisplay_test_0400 @@ -76,14 +70,14 @@ describe('ActsAnsBadgeDisplayTest', function () { * @tc.desc: verify the function of isBadgeDisplayed */ it('ActsGetDisplay_test_0400', 0, async function (done) { - var promise = await notify.isBadgeDisplayed({ + notify.isBadgeDisplayed({ bundle:"wrong BundleName", - }) - expect(promise).assertEqual(false) - done(); - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0400====>"); - }, time); + }).then().catch((err)=>{ + console.log("===>ActsGetDisplay_test_0400 success===>"+err.code) + expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE) + done(); + }) + }) /* * @tc.number: ActsGetDisplay_test_0500 @@ -96,9 +90,6 @@ describe('ActsAnsBadgeDisplayTest', function () { expect(typeof(data)).assertEqual('boolean') }) done(); - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0500====>"); - }, time); }) /* * @tc.number: ActsGetDisplay_test_0600 @@ -109,9 +100,6 @@ describe('ActsAnsBadgeDisplayTest', function () { var promise = await notify.isBadgeDisplayed("#$#$%$%^") expect(promise).assertEqual(undefined) done(); - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0600====>"); - }, time); }) /* * @tc.number: ActsGetDisplay_test_0700 @@ -124,9 +112,6 @@ describe('ActsAnsBadgeDisplayTest', function () { expect(typeof(data)).assertEqual('boolean') }) done(); - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0700====>"); - }, time); }) /* * @tc.number: ActsGetDisplay_test_0800 @@ -137,9 +122,6 @@ describe('ActsAnsBadgeDisplayTest', function () { var promise = await notify.isBadgeDisplayed({}) expect(promise).assertEqual(undefined) done(); - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0800====>"); - }, time); }) /* * @tc.number: ActsGetDisplay_test_0900 @@ -160,9 +142,6 @@ describe('ActsAnsBadgeDisplayTest', function () { done(); }) }) - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0900====>"); - }, time); }) /* * @tc.number: ActsGetDisplay_test_1000 @@ -182,9 +161,6 @@ describe('ActsAnsBadgeDisplayTest', function () { expect(promise).assertEqual(true) done(); }) - setTimeout(function(){ - console.debug("===>time out ActsGetDisplay_test_1000===>"); - }, time); }) /* * @tc.number: ActsSetDisplay_test_0100 @@ -198,9 +174,6 @@ describe('ActsAnsBadgeDisplayTest', function () { console.log("===>ActsSetDisplay_test_0100 success===>"+err) }) done(); - setTimeout(function(){ - console.debug("====>time out ActsSetDisplay_test_0100====>"); - }, time); }) /* * @tc.number: ActsSetDisplay_test_0200 @@ -213,9 +186,6 @@ describe('ActsAnsBadgeDisplayTest', function () { },100) expect(promise).assertEqual(undefined) done(); - setTimeout(function(){ - console.debug("===>time out ActsSetDisplay_test_0200===>"); - }, time); }) /* * @tc.number: ActsSetDisplay_test_0300 @@ -227,12 +197,9 @@ describe('ActsAnsBadgeDisplayTest', function () { bundle:"Wrong BundleName" },true,(err) => { console.log("===>ActsSetDisplay_test_0300 success===>"+err.code) - expect(err.code).assertEqual(errorCode) + expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE) }) done(); - setTimeout(function(){ - console.debug("====>time out ActsSetDisplay_test_0300====>"); - }, time); }) /* * @tc.number: ActsSetDisplay_test_0400 @@ -240,14 +207,13 @@ describe('ActsAnsBadgeDisplayTest', function () { * @tc.desc: verify the function of displayBadge */ it('ActsSetDisplay_test_0400', 0, async function (done) { - var promise = await notify.displayBadge({ + notify.displayBadge({ bundle:"Wrong BundleName" - },true) - expect(promise).assertEqual(undefined) - done(); - setTimeout(function(){ - console.debug("===>time out ActsSetDisplay_test_0400===>"); - }, time); + },true).then().catch((err)=>{ + console.log("===>ActsSetDisplay_test_0400 err===>"+err.code) + expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE) + done(); + }) }) /* * @tc.number: ActsSetDisplay_test_0500 @@ -267,9 +233,6 @@ describe('ActsAnsBadgeDisplayTest', function () { done(); }) }) - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0900====>"); - }, time); }) /* * @tc.number: ActsSetDisplay_test_0600 @@ -288,9 +251,6 @@ describe('ActsAnsBadgeDisplayTest', function () { expect(promise).assertEqual(true) done(); }) - setTimeout(function(){ - console.debug("===>time out ActsSetDisplay_test_0600===>"); - }, time); }) /* * @tc.number: ActsSetDisplay_test_0700 @@ -310,9 +270,6 @@ describe('ActsAnsBadgeDisplayTest', function () { done(); }) }) - setTimeout(function(){ - console.debug("====>time out ActsSetDisplay_test_0700====>"); - }, time); }) /* * @tc.number: ActsSetDisplay_test_0800 @@ -331,9 +288,6 @@ describe('ActsAnsBadgeDisplayTest', function () { expect(promise).assertEqual(false) done(); }) - setTimeout(function(){ - console.debug("===>time out ActsSetDisplay_test_0800===>"); - }, time); }) /* * @tc.number: ActsSetDisplay_test_0900 @@ -359,9 +313,6 @@ describe('ActsAnsBadgeDisplayTest', function () { expect(promise).assertEqual(true) done(); }) - setTimeout(function(){ - console.debug("===>time out ActsSetDisplay_test_0900===>"); - }, time); }) }) diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/BUILD.gn b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/BUILD.gn index 5f0111f09d1e99cc4e3c235d8a31a042c23c8c8e..3a6f8047d1d126ecedb068db9f227a87bc85bb77 100644 --- a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/BUILD.gn +++ b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/BUILD.gn @@ -13,18 +13,14 @@ import("//test/xts/tools/build/suite.gni") -ohos_hap("localcandisplay") { +ohos_js_hap_suite("localcandisplay") { hap_profile = "./entry/src/main/config.json" - hap_name = "localcandisplay" - subsystem_name = XTS_SUITENAME - final_hap_path = - "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" - testonly = true deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "localcandisplay" } ohos_js_assets("hjs_demo_js_assets") { source_dir = "./entry/src/main/js/default" diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/entry/src/main/js/test/EnableNotification.js b/notification/ans_standard/publish_test/enablenotification/enablenotification/entry/src/main/js/test/EnableNotification.js index e88968450eaeb3ca1c3e5b96aa72f836f6870c09..9ebf8c22ef12e7b0101738e0160282ec4e6de51e 100644 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/entry/src/main/js/test/EnableNotification.js +++ b/notification/ans_standard/publish_test/enablenotification/enablenotification/entry/src/main/js/test/EnableNotification.js @@ -16,7 +16,7 @@ import notify from '@ohos.notification' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' var time = 1000 -var errorCode = 67108870 +var ERR_ANS_INVALID_BUNDLE = 67108870 describe('ActsAnsEnableNotificationTest', function () { console.info("===========ActsAnsEnableNotificationTest start====================>"); /* @@ -78,14 +78,13 @@ describe('ActsAnsEnableNotificationTest', function () { * @tc.desc: verify the function of isNotificationEnabled */ it('ActsGetEnable_test_0400', 0, async function (done) { - var promise = await notify.isNotificationEnabled({ + notify.isNotificationEnabled({ bundle:"wrong BundleName", - }) - expect(promise).assertEqual(false) - done(); - setTimeout(function(){ - console.debug("====>time out ActsGetEnable_test_0400====>"); - }, time); + }).then().catch((err)=>{ + console.debug("====>ActsGetEnable_test_0400 promsie====>"+err.code); + expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE) + done(); + }) }) /* * @tc.number: ActsGetEnable_test_0500 @@ -98,9 +97,6 @@ describe('ActsAnsEnableNotificationTest', function () { expect(typeof(data)).assertEqual('boolean') }) done(); - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0500====>"); - }, time); }) /* * @tc.number: ActsGetEnable_test_0600 @@ -111,9 +107,6 @@ describe('ActsAnsEnableNotificationTest', function () { var promise = await notify.isNotificationEnabled("#$#$%$%^") expect(promise).assertEqual(undefined) done(); - setTimeout(function(){ - console.debug("====>time out ActsGetEnable_test_0600====>"); - }, time); }) /* * @tc.number: ActsGetDisplay_test_0700 @@ -126,9 +119,6 @@ describe('ActsAnsEnableNotificationTest', function () { expect(typeof(data)).assertEqual('boolean') }) done(); - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0700====>"); - }, time); }) /* * @tc.number: ActsGetEnable_test_0800 @@ -139,9 +129,6 @@ describe('ActsAnsEnableNotificationTest', function () { var promise = await notify.isNotificationEnabled({}) expect(promise).assertEqual(undefined) done(); - setTimeout(function(){ - console.debug("====>time out ActsGetEnable_test_0800====>"); - }, time); }) /* * @tc.number: ActsGetEnable_test_0900 @@ -162,9 +149,6 @@ describe('ActsAnsEnableNotificationTest', function () { done(); }) }) - setTimeout(function(){ - console.debug("====>time out ActsGetDisplay_test_0900====>"); - }, time); }) /* * @tc.number: ActsGetEnable_test_1000 @@ -184,9 +168,6 @@ describe('ActsAnsEnableNotificationTest', function () { expect(promise).assertEqual(true) done(); }) - setTimeout(function(){ - console.debug("===>time out ActsGetDisplay_test_1000===>"); - }, time); }) /* * @tc.number: ActsSetEnable_test_0100 @@ -200,9 +181,6 @@ describe('ActsAnsEnableNotificationTest', function () { console.log("===>ActsSetEnable_test_0100 success===>"+err) }) done(); - setTimeout(function(){ - console.debug("====>time out ActsSetEnable_test_0100====>"); - }, time); }) /* * @tc.number: ActsSetEnable_test_0200 @@ -215,9 +193,6 @@ describe('ActsAnsEnableNotificationTest', function () { },100) expect(promise).assertEqual(undefined) done(); - setTimeout(function(){ - console.debug("===>time out ActsSetEnable_test_0200===>"); - }, time); }) /* * @tc.number: ActsSetEnable_test_0300 @@ -229,12 +204,9 @@ describe('ActsAnsEnableNotificationTest', function () { bundle:"Wrong BundleName" },true,(err) => { console.log("===>ActsSetEnable_test_0300 success===>"+err.code) - expect(err.code).assertEqual(errorCode) + expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE) }) done(); - setTimeout(function(){ - console.debug("====>time out ActsSetDisplay_test_0300====>"); - }, time); }) /* * @tc.number: ActsSetEnable_test_0400 @@ -242,14 +214,13 @@ describe('ActsAnsEnableNotificationTest', function () { * @tc.desc: verify the function of enableNotification */ it('ActsSetEnable_test_0400', 0, async function (done) { - var promise = await notify.enableNotification({ + notify.enableNotification({ bundle:"Wrong BundleName" - },true) - expect(promise).assertEqual(undefined) - done(); - setTimeout(function(){ - console.debug("===>time out ActsSetEnable_test_0400===>"); - }, time); + },true).then().catch((err)=>{ + console.log("===>ActsSetEnable_test_0400 err===>"+err.code) + expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE) + done(); + }) }) /* * @tc.number: ActsSetEnable_test_0500 @@ -346,7 +317,7 @@ describe('ActsAnsEnableNotificationTest', function () { await notify.isNotificationEnabled({ bundle:"com.example.actsanslocalnotificationtest", },(err,data) => { - console.log("===>ActsGetEnable_test_0100 success===>"+err+data) + console.log("===>ActsSetEnable_test_0900 success===>"+err+data) expect(typeof(data)).assertEqual('boolean') expect(data).assertEqual(false) }) diff --git a/notification/ans_standard/publish_test/getactive/BUILD.gn b/notification/ans_standard/publish_test/getactive/BUILD.gn index 328bea550289579a91e0c1000e55b90c11959992..f869e9409e7b45075479e89b7244a2fdbb4e1f28 100644 --- a/notification/ans_standard/publish_test/getactive/BUILD.gn +++ b/notification/ans_standard/publish_test/getactive/BUILD.gn @@ -17,9 +17,9 @@ group("getactive") { testonly = true if (is_standard_system) { deps = [ - #"actsansgetactive:ActsAnsActiveTest", + "actsansgetactive:ActsAnsActiveTest", #"actsansgetallactive:ActsAnsAllActiveTestOne", - #"getactiveotherapp:ActsAnsAllActiveTestTwo" + #"getactiveotherapp:ActsAnsAllActiveTestOne" ] } } diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/entry/src/main/js/test/getActive.js b/notification/ans_standard/publish_test/getactive/actsansgetactive/entry/src/main/js/test/getActive.js index bf1a980a7af280b117b81860c3b13d178b407aa0..c7d9cd7af38e8ae7b8a88d47ebb65a226ed61067 100644 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/entry/src/main/js/test/getActive.js +++ b/notification/ans_standard/publish_test/getactive/actsansgetactive/entry/src/main/js/test/getActive.js @@ -16,6 +16,7 @@ import notify from '@ohos.notification' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' var time = 1000 +var ERR_ANS_NON_SYSTEM_APP = 67108877 describe('ActsAnsActiveTest', function () { console.info("===========ActsAnsActiveTest start====================>"); function getCallback(err, data){ @@ -1060,13 +1061,11 @@ describe('ActsAnsActiveTest', function () { } await notify.publish(notificationRequestOfCurrentApp); console.debug("===============Ans_GetAllActive_1000 publish CurrentApp notify end==================>"); - var promiseData = await notify.getAllActiveNotifications(); - expect(promiseData).assertEqual(undefined); - console.debug("===============Ans_GetAllActive_1000 getAllActiveNotifications end==================>"); - done(); - setTimeout(async function(){ - console.debug("===============Ans_GetAllActive_1000 done==================>"); - }, time); + await notify.getAllActiveNotifications().then().catch((err)=>{ + expect(err.code).assertEqual(ERR_ANS_NON_SYSTEM_APP); + console.debug("==Ans_GetAllActive_1000 err==>"+err.code); + done(); + }); }) }) diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/BUILD.gn b/notification/ans_standard/publish_test/getactive/getactiveotherapp/BUILD.gn index 97b5cbba64b985f4b61dc45d2f58a637726d5de1..e3f4f2bae4b170ad056cf1963f5c7631084945d5 100644 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/BUILD.gn +++ b/notification/ans_standard/publish_test/getactive/getactiveotherapp/BUILD.gn @@ -13,18 +13,14 @@ import("//test/xts/tools/build/suite.gni") -ohos_hap("ActsAnsAllActiveTestTwo") { +ohos_js_hap_suite("ActsAnsAllActiveTestOne") { hap_profile = "./entry/src/main/config.json" - hap_name = "ActsAnsAllActiveTestTwo" - subsystem_name = XTS_SUITENAME - final_hap_path = - "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" - testonly = true deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAnsAllActiveTestOne" } ohos_js_assets("hjs_demo_js_assets") { source_dir = "./entry/src/main/js/default" diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/Test.json b/notification/ans_standard/publish_test/getactive/getactiveotherapp/Test.json index b9f4122fbf466755fe279be1082dcf138af90789..9eec8e78da8782f0d9b1ee255a2aaa8338906d4a 100644 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/Test.json +++ b/notification/ans_standard/publish_test/getactive/getactiveotherapp/Test.json @@ -1,3 +1,18 @@ { "description": "Configuration for hjunit demo Tests", -} \ No newline at end of file + "driver": { + "type": "JSUnitTest", + "test-timeout": "60000", + "package": "com.example.activeotherapp", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAnsAllActiveTestOne.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/BUILD.gn b/notification/ans_standard/publish_test/getwantagentinfo/BUILD.gn index 344f124cbcfcac9f6860ef66278539d4631ca886..6ec8a2ba44313ef8873c46e81ad024284a8673a1 100644 --- a/notification/ans_standard/publish_test/getwantagentinfo/BUILD.gn +++ b/notification/ans_standard/publish_test/getwantagentinfo/BUILD.gn @@ -13,14 +13,19 @@ import("//test/xts/tools/build/suite.gni") -group("getwantagentinfo") { - testonly = true - if (is_standard_system) { - deps = [ - "getwantagentinfoone:ActsAnsGetWantAgentInfoOneTest", - "getwantagentinfoonepro:ActsAnsGetWantAgentInfoOneProTest", - "getwantagentinfotwo:ActsAnsGetWantAgentInfoTwoTest", - "getwantagentinfotwopro:ActsAnsGetWantAgentInfoTwoProTest", - ] - } +ohos_js_hap_suite("ActsAnsGetWantAgentInfoTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAnsGetWantAgentInfoTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" } diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/Test.json b/notification/ans_standard/publish_test/getwantagentinfo/Test.json similarity index 71% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/Test.json rename to notification/ans_standard/publish_test/getwantagentinfo/Test.json index 6b213ca8fc72246d7319658495ae19069fd627c4..d9a0115a67952e0ac17f044d60fa58ed0f1c5177 100644 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/Test.json +++ b/notification/ans_standard/publish_test/getwantagentinfo/Test.json @@ -3,13 +3,13 @@ "driver": { "type": "JSUnitTest", "test-timeout": "60000", - "package": "com.example.actsansgetwantagentinfoonetest", + "package": "com.example.actsansgetwantagentinfotest", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsAnsGetWantAgentInfoOneTest.hap" + "ActsAnsGetWantAgentInfoTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/notification/ans_standard/publish_test/getwantagentinfo/entry/.gitignore b/notification/ans_standard/publish_test/getwantagentinfo/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3543521e9fef8e7322940a87c2b45dd0061b0f45 --- /dev/null +++ b/notification/ans_standard/publish_test/getwantagentinfo/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/config.json b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/config.json similarity index 84% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/config.json rename to notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/config.json index 3a611f023a011eb227403c2d6403c30ec62b820c..0167dc4b496e9b38bbe845efea2c2cc6d9d9c536 100644 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/config.json +++ b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.example.actsansgetwantagentinfotwotest", + "bundleName": "com.example.actsansgetwantagentinfotest", "vendor": "example", "version": { "code": 1, @@ -14,7 +14,7 @@ }, "deviceConfig": {}, "module": { - "package": "com.example.actsansgetwantagentinfotwotest", + "package": "com.example.actsansgetwantagentinfotest", "name": ".MyApplication", "deviceType": [ "phone" @@ -36,7 +36,7 @@ ] } ], - "name": "com.example.actsansgetwantagentinfotwotest.MainAbility", + "name": "com.example.actsansgetwantagentinfotest.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", @@ -59,4 +59,4 @@ } ] } -} +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/app.js similarity index 100% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/app.js rename to notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/app.js diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/i18n/en-US.json rename to notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/i18n/en-US.json diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/i18n/zh-CN.json rename to notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/i18n/zh-CN.json diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/pages/index/index.css rename to notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/pages/index/index.css diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/pages/index/index.hml similarity index 69% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/pages/index/index.hml rename to notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/pages/index/index.hml index 14dace840b438719d5f6ad3bce9883b2f9d1009c..633f6b00b49a8029936ba4cdb83713b02c720e3d 100644 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/pages/index/index.hml +++ b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/pages/index/index.hml @@ -1,5 +1,5 @@
- 获取AgentInfo + 获取AgentInfo测试
diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/default/pages/index/index.js rename to notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/default/pages/index/index.js diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/resources/base/element/string.json similarity index 80% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/resources/base/element/string.json rename to notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/resources/base/element/string.json index 31ca8fb1da55eb155b0cd8cb5877968c2f29c5e7..fdceea250aa040f33c1fdd5d70a9046fd35e45e1 100644 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/resources/base/element/string.json +++ b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/resources/base/element/string.json @@ -2,7 +2,7 @@ "string": [ { "name": "app_name", - "value": "AgentInfo1" + "value": "AgentInfo" }, { "name": "mainability_description", diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/resources/base/media/icon.png rename to notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/resources/base/media/icon.png diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/test/List.test.js similarity index 100% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/test/List.test.js rename to notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/test/List.test.js diff --git a/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/test/WantAgent.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f9498c45fc2e80f46bd647aa2ef184e15219bcb2 --- /dev/null +++ b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/test/WantAgent.test.js @@ -0,0 +1,975 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import wantAgent from '@ohos.wantAgent'; +import { OperationType, Flags } from '@ohos.wantagent'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +var WantAgenta; +var WantAgentb; +var WantAgentc; +var WantAgentd; +var WantAgente; +var time = 1000 +describe('ActsAnsGetWantAgentInfoTest', function () { + console.info('----ActsGetWantAgentInfoTest----'); + /* + * @tc.number: ACTS_SetWantInfo_0100 + * @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel() + * @tc.desc: verify the function of getWantAgent(),getBundleName(),getUid(),getWant(),cancel() + */ + it('ACTS_SetWantInfo_0100', 0, async function (done) { + console.info('----ACTS_SetWantInfo_0100----'); + var agentInfoa = { + wants: [ + { + bundleName: "com.example.WantAgentTest", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + }, + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + } + wantAgent.getWantAgent(agentInfoa, + (err, data) => { + if (err.code == 0) { + WantAgenta = data; + console.info('----getWantAgenta success!----'+data); + expect(typeof(data)).assertEqual("object"); + + wantAgent.getBundleName(data, + (err1, data1) => { + if (err1.code == 0) { + console.info('----getBundleNameA success!----'+err.code+data1); + expect(typeof(data1)).assertEqual('string') + } else { + console.info('----getBundleNameA failed!----'); + } + } + ); + wantAgent.getUid(data, + (err2, data2) => { + if (err2.code == 0) { + console.info('----getUidA success!----'+err.code+data2); + expect(typeof(data2)).assertEqual('number') + } else { + console.info('----getUidA failed!----'); + } + } + ); + wantAgent.getWant(data,(err3, data3) => { + if (err3.code == 0) { + console.info('----getWantA success!----'+err.code+data3); + expect(typeof(data3)).assertEqual('object') + } else { + console.info('----getWantA failed!----'); + } + }); + wantAgent.cancel(data,(err)=>{ + console.info("========cancelA========"+err.code) + }); + } else { + console.info('----getWantAgenta failed!----'+err.code+data); + expect(typeof(data)).assertEqual("object"); + } + done(); + }), + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_0100====>"); + }, time); + console.info('----getWantAgenta after----'); + }) + /* + * @tc.number: ACTS_SetWantInfo_0200 + * @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel() + * @tc.desc: verify the function of getWantAgent(),getBundleName(),getUid(),getWant(),cancel() promise + */ + it('ACTS_SetWantInfo_0200', 0, async function (done) { + var agentInfod = { + wants: [ + { + bundleName: "com.example.WantAgentTest", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + }, + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + } + wantAgent.getWantAgent(agentInfod).then( + (data) => { + console.info('----getWantAgent Promise success!----'+data); + expect(typeof(data)).assertEqual("object"); + wantAgent.getBundleName(data).then( + (data1) => { + console.info('----getBcanundleName Promise success!----'+data1); + expect(typeof(data1)).assertEqual('string') + } + ); + wantAgent.getUid(data).then( + (data2) => { + console.info('----getUid Promise success!----'+data2); + expect(typeof(data2)).assertEqual('number') + } + ); + wantAgent.getWant(data).then( + (data3) => { + console.info('----getWant Promise success!----'+data3); + console.info('Want = ' + data3); + expect(typeof(data3)).assertEqual('object') + } + ); + wantAgent.cancel(data).then( + console.info("========cancelPromise========") + ); + }) + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_0200====>"); + }, time) + }) + /* + * @tc.number: ACTS_SetWantInfo_0300 + * @tc.name: equal(normal) + * @tc.desc: verify the function of equal(normal)Callback + */ + it('ACTS_SetWantInfo_0300', 0, async function (done) { + var agentInfob = { + wants: [ + { + bundleName: "bundleName", + abilityName: "abilityName", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + }, + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + } + wantAgent.getWantAgent(agentInfob,(err,data)=>{ + WantAgentb = data + }) + + var agentInfoc = { + wants: [ + { + bundleName: "com.example.WantAgentTest", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + }, + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + } + wantAgent.getWantAgent(agentInfoc, + (err, data) => { + if (err.code == 0) { + WantAgentc = data; + console.log("=======WantAgentb======="+JSON.stringify(WantAgentb)) + console.log("=======WantAgentc======="+JSON.stringify(WantAgentc)) + expect(typeof(data)).assertEqual("object"); + wantAgent.equal(WantAgentb,WantAgentc, + (error,data) => { + if(error.code == 0) { + console.info('----equala success!----'+data) + expect(typeof(data)).assertEqual("boolean"); + expect(data).assertEqual(false); + } + else{ + console.info('----equala failed!----') + } + } + ) + wantAgent.equal(WantAgentb,WantAgentb, + (error,data) => { + if(error.code == 0) { + console.info('----equalb success!----'+data) + expect(typeof(data)).assertEqual("boolean"); + expect(data).assertEqual(true); + } + else{ + console.info('----equalb failed!----') + } + } + ) + } + else{ + console.info('----getWantAgent failed!----'); + console.info(data); + expect(typeof(data)).assertEqual("object"); + } + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_0300====>"); + }, time); + }); + }) + + /* + * @tc.number: ACTS_SetWantInfo_0400 + * @tc.name: equal(normal) + * @tc.desc: verify the function of equal(normal) promise + */ + it('ACTS_SetWantInfo_0400', 0, async function (done) { + var agentInfoe = { + wants: [ + { + bundleName: "bundleName", + abilityName: "abilityName", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + }, + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + } + wantAgent.getWantAgent(agentInfoe,(err,data)=>{ + console.log("=======agentInfoe======="+err.code+JSON.stringify(data)) + WantAgentd = data + }) + + var agentInfof = { + wants: [ + { + bundleName: "com.example.WantAgentTest", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + }, + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + } + wantAgent.getWantAgent(agentInfof, + (err, data) => { + console.log("=======agentInfof======="+err.code+JSON.stringify(data)) + if (err.code == 0) { + WantAgente = data; + console.log("=======WantAgente======="+JSON.stringify(WantAgentd)) + console.log("=======WantAgentf======="+JSON.stringify(WantAgente)) + wantAgent.equal(WantAgentd,WantAgente).then( + (data) => { + console.info('----equalc success!----'+data) + expect(typeof(data)).assertEqual("boolean"); + expect(data).assertEqual(false); + } + ) + wantAgent.equal(WantAgentd,WantAgentd).then( + (data) => { + console.info('----equald success!----'+data) + expect(typeof(data)).assertEqual("boolean"); + expect(data).assertEqual(true); + } + ) + } + else{ + console.info('----getWantAgent failed!----'+err.code+data); + } + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_0400====>"); + }, time); + }); + }) + /* + * @tc.number: ACTS_SetWantInfo_0500 + * @tc.name: equal(),cancel() + * @tc.desc: verify the function of equal(),cancel() promise + */ + it('ACTS_SetWantInfo_0500', 0, async function (done) { + var agentInfoe = { + wants: [ + { + bundleName: "$%^%^%&^%&", + abilityName: "$%^&%&*^&*^", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + }, + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + } + wantAgent.getWantAgent(agentInfoe,(err,data)=>{ + WantAgentd = data + }) + + var agentInfof = { + wants: [ + { + bundleName: "com.neu.WantAgentTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + }, + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + } + wantAgent.getWantAgent(agentInfof, + (err, data) => { + if (err.code == 0) { + WantAgente = data; + console.log("=======WantAgente======="+JSON.stringify(WantAgentd)) + console.log("=======WantAgentf======="+JSON.stringify(WantAgente)) + expect(typeof(data)).assertEqual("object"); + wantAgent.equal(WantAgentd,WantAgente).then( + (data) => { + console.info('----equale success!----'+data) + expect(typeof(data)).assertEqual("boolean"); + } + ) + wantAgent.cancel(WantAgentd).then( + console.info("========cancelPromise========") + ); + wantAgent.equal(WantAgentd,WantAgente).then( + (data) => { + console.info('----equalf success!----'+data) + expect(typeof(data)).assertEqual("boolean"); + } + ) + wantAgent.equal(WantAgentd,WantAgentd).then( + (data) => { + console.info('----equalg success!----'+data) + expect(typeof(data)).assertEqual("boolean"); + } + ) + } + else{ + console.info('----getWantAgent failed!----'+err.code); + } + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_0500====>"); + }, time); + }); + }) + /* + * @tc.number: ACTS_SetWantInfo_0600 + * @tc.name: equal() + * @tc.desc: verify the function of equal("$%$%^$%^","$%$%^$%^")callback + */ + it('ACTS_SetWantInfo_0600', 0, async function (done) { + wantAgent.equal("$%$%^$%^","$%$%^$%^", + (error,data) => { + if(error.code == 0) { + console.info('----equalh success!----'+data) + expect(typeof(data)).assertEqual("boolean"); + } + else{ + console.info('----equalh failed!----') + } + } + ) + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_0600====>"); + }, time); + }); + /* + * @tc.number: ACTS_SetWantInfo_0700 + * @tc.name: equal() + * @tc.desc: verify the function of equal("$%$%^$%^","$%$%^$%^")promise + */ + it('ACTS_SetWantInfo_0700', 0, async function (done) { + var promise = await wantAgent.equal("$%$%^$%^","$%$%^$%^") + console.info('----equali success!----'+promise) + expect(promise).assertEqual(undefined); + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_0700====>"); + }, time); + }); + /* + * @tc.number: ACTS_SetWantInfo_0800 + * @tc.name: equal() + * @tc.desc: verify the function of equal({},{})callback + */ + it('ACTS_SetWantInfo_0800', 0, async function (done) { + wantAgent.equal({},{}, + (err,data) => { + console.info('----equalj success!----'+err.code+data) + expect(typeof(data)).assertEqual("boolean"); + } + ) + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_0800====>"); + }, time); + }); + /* + * @tc.number: ACTS_SetWantInfo_0900 + * @tc.name: equal() + * @tc.desc: verify the function of equal({},{})promise + */ + it('ACTS_SetWantInfo_0900', 0, async function (done) { + var promise = wantAgent.equal({},{}) + console.info('----equalk success!----'+promise) + expect(promise).assertEqual(null); + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_0900====>"); + }, time); + }); + /* + * @tc.number: ACTS_SetWantInfo_1000 + * @tc.name: equal() + * @tc.desc: verify the function of equal(100,100)callback + */ + it('ACTS_SetWantInfo_1000', 0, async function (done) { + wantAgent.equal(100,100, + (err,data) => { + console.info('----equalm success!----'+err.code+data) + expect(typeof(data)).assertEqual("boolean"); + } + ) + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_1000====>"); + }, time); + }); + /* + * @tc.number: ACTS_SetWantInfo_2200 + * @tc.name: equal() + * @tc.desc: verify the function of equal(100,100)promise + */ + it('ACTS_SetWantInfo_1100', 0, async function (done) { + var promise = await wantAgent.equal(100,100) + console.info('----equaln success!----'+promise) + expect(promise).assertEqual(undefined); + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_1100====>"); + }, time); + }); + /* + * @tc.number: ACTS_SetWantInfo_1200 + * @tc.name: getWantAgent() + * @tc.desc: verify the function of getWantAgent("")callback + */ + it('ACTS_SetWantInfo_1200', 0, async function (done) { + console.info('----ACTS_SetWantInfo_0300 begin----'); + wantAgent.getWantAgent("",(err,data) => { + console.log("===getWantAgenta==="+err.code+data)}) + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_1200====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_1300 + * @tc.name: getWantAgent() + * @tc.desc: verify the function of getWantAgent("")promise + */ + it('ACTS_SetWantInfo_1300', 0, async function (done) { + console.info('----ACTS_SetWantInfo_0300 begin----'); + var promise = wantAgent.getWantAgent("") + console.log("===getWantAgentb==="+promise) + expect(promise).assertEqual(null); + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_1300====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_1400 + * @tc.name: getBundleName() + * @tc.desc: verify the function of getBundleName("")callback + */ + it('ACTS_SetWantInfo_1400', 0, async function (done) { + wantAgent.getBundleName("",(err,data) => { + console.info('----getBundleNamea success!----'+err.code+data); + expect(typeof(data)).assertEqual('string')}); + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_1400====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_1500 + * @tc.name: getBundleName() + * @tc.desc: verify the function of getBundleName("")promise + */ + it('ACTS_SetWantInfo_1500', 0, async function (done) { + var promise = await wantAgent.getBundleName("") + console.info('----getBundleNameb success!----'+promise); + expect(promise).assertEqual(undefined) + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_1500====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_1600 + * @tc.name: getUid() + * @tc.desc: verify the function of getUid("")callback + */ + it('ACTS_SetWantInfo_1600', 0, async function (done) { + wantAgent.getUid("",(err,data) => { + console.info('----getUida success!----'+err.code+data); + expect(typeof(data)).assertEqual('number')}); + done() + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_1600====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_1700 + * @tc.name: getUid() + * @tc.desc: verify the function of getUid("")promise + */ + it('ACTS_SetWantInfo_1700', 0, async function (done) { + var promise =await wantAgent.getUid("") + console.info('----getUidb success!----'+promise); + expect(promise).assertEqual(undefined) + done() + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_1700====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_1800 + * @tc.name: getWant() + * @tc.desc: verify the function of getWant("")callback + */ + it('ACTS_SetWantInfo_1800', 0, async function (done) { + wantAgent.getWant("",(err,data) => { + console.info('----getWanta success!----'+err.code+data); + expect(typeof(data)).assertEqual('object') + }); + done() + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_1800====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_1900 + * @tc.name: getWant() + * @tc.desc: verify the function of getWant("")promise + */ + it('ACTS_SetWantInfo_1900', 0, async function (done) { + var promise = await wantAgent.getWant("") + console.info('----getWantb success!----'+promise); + expect(promise).assertEqual(undefined) + done() + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_1900====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_2000 + * @tc.name: getWantAgent() + * @tc.desc: verify the function of getWantAgent(100)callback + */ + it('ACTS_SetWantInfo_2000', 0, async function (done) { + console.info('----ACTS_SetWantInfo_1000 begin----'); + wantAgent.getWantAgent(100,(err,data) => { + console.log('----getWantAgenta success!----'+err.code+data) + }) + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_2000====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_2100 + * @tc.name: getWantAgent() + * @tc.desc: verify the function of getWantAgent(100)promises + */ + it('ACTS_SetWantInfo_2100', 0, async function (done) { + var promise = wantAgent.getWantAgent(100) + console.log("----getWantAgentb success!----"+promise) + expect(promise).assertEqual(null) + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_2100====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_2200 + * @tc.name: getBundleName() + * @tc.desc: verify the function of getBundleName(100)callback + */ + it('ACTS_SetWantInfo_2200', 0, async function (done) { + wantAgent.getBundleName(100,(err,data) => { + console.info('----getBundleNamec success!----'+err.code+data); + expect(typeof(data)).assertEqual('string') + }); + done() + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_2200====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_2300 + * @tc.name: getBundleName() + * @tc.desc: verify the function of getBundleName(100)promise + */ + it('ACTS_SetWantInfo_2300', 0, async function (done) { + var promise =await wantAgent.getBundleName(100) + console.info('----getBundleNamed success!----'+promise); + expect(promise).assertEqual(undefined) + done() + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_2300====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_2400 + * @tc.name: getUid() + * @tc.desc: verify the function of getUid(100)callback + */ + it('ACTS_SetWantInfo_2400', 0, async function (done) { + wantAgent.getUid(100,(err,data) => { + console.info('----getUidc success!----'+err.code+data); + }); + done() + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_2400====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_2500 + * @tc.name: getUid() + * @tc.desc: verify the function of getUid(100)promise + */ + it('ACTS_SetWantInfo_2500', 0, async function (done) { + var promise =await wantAgent.getUid(100) + console.info('----getUidd success!----'+promise); + expect(promise).assertEqual(undefined) + done() + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_2500====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_2600 + * @tc.name: getWant() + * @tc.desc: verify the function of getWant(100)callback + */ + it('ACTS_SetWantInfo_2600', 0, async function (done) { + wantAgent.getWant(100,(err,data) => { + console.info('----getWantc success!----'+err.code+data); + expect(typeof(data)).assertEqual('object') + }); + done() + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_2600====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_2700 + * @tc.name: getWant() + * @tc.desc: verify the function of getWant(100)promise + */ + it('ACTS_SetWantInfo_2700', 0, async function (done) { + var promise = await wantAgent.getWant(100) + console.info('----getWantd success!----'+promise); + expect(promise).assertEqual(undefined) + done() + setTimeout(function(){ + console.debug("====>time out ACTS_SetWantInfo_2700====>"); + }, time); + }) + /* + * @tc.number: ACTS_SetWantInfo_2800 + * @tc.name: getWantAgent() + * @tc.desc: verify the function of getWantAgent({})callback + */ + it('ACTS_SetWantInfo_2800', 0, async function (done) { + console.info('----ACTS_SetWantInfo_2800 begin----'); + wantAgent.getWantAgent({},(err,data) => { + console.log("----getWantAgentc success!----"+err.code+data) + }) + done(); + }) + /* + * @tc.number: ACTS_SetWantInfo_2900 + * @tc.name: getWantAgent() + * @tc.desc: verify the function of getWantAgent({})promise + */ + it('ACTS_SetWantInfo_2900', 0, async function (done) { + console.info('----ACTS_SetWantInfo_2900 begin----'); + wantAgent.getWantAgent({}).then((data)=>{ + console.log("----getWantAgentd success!----"+data) + expect(data).assertEqual("object") + }) + done(); + }) + /* + * @tc.number: ACTS_SetWantInfo_3000 + * @tc.name: getBundleName() + * @tc.desc: verify the function of getBundleName({})callback + */ + it('ACTS_SetWantInfo_3000', 0, async function (done) { + wantAgent.getBundleName({},(err,data) => { + console.info('----getBundleNamee success!----'+err.code+data); + expect(typeof(data)).assertEqual('string') + }); + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_3100 + * @tc.name: getBundleName() + * @tc.desc: verify the function of getBundleName({})promise + */ + it('ACTS_SetWantInfo_3100', 0, async function (done) { + var promise = wantAgent.getBundleName({}) + console.info('----getBundleNamef success!----'+promise); + expect(promise).assertEqual(null) + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_3200 + * @tc.name: getUid() + * @tc.desc: verify the function of getUid({})callback + */ + it('ACTS_SetWantInfo_3200', 0, async function (done) { + wantAgent.getUid({},(err,data) => { + console.info('----getUide success!----'+err.code+data); + }); + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_3300 + * @tc.name: getUid() + * @tc.desc: verify the function of getUid({})promise + */ + it('ACTS_SetWantInfo_3300', 0, async function (done) { + var promise = wantAgent.getUid({}) + console.info('----getUidf success!----'+promise); + expect(promise).assertEqual(null) + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_3400 + * @tc.name: getWant() + * @tc.desc: verify the function of getWant({})callback + */ + it('ACTS_SetWantInfo_3400', 0, async function (done) { + wantAgent.getWant({},(err,data) => { + console.info('----getWante success!----'+err.code+data); + }); + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_3500 + * @tc.name: getWant() + * @tc.desc: verify the function of getWant({})promise + */ + it('ACTS_SetWantInfo_3500', 0, async function (done) { + var promise = wantAgent.getWant({}) + console.info('----getWantf success!----'+promise); + expect(promise).assertEqual(null) + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_3600 + * @tc.name: cancel() + * @tc.desc: verify the function of cancel({})callback + */ + it('ACTS_SetWantInfo_3600', 0, async function (done) { + wantAgent.cancel({},(err,data) => { + console.info('----cancela success!----'+err.code+data); + }); + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_3700 + * @tc.name: cancel() + * @tc.desc: verify the function of cancel({})promise + */ + it('ACTS_SetWantInfo_3700', 0, async function (done) { + var promise = await wantAgent.cancel({}) + console.info('----cancelb success!----'+promise); + expect(promise).assertEqual(null) + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_3800 + * @tc.name: cancel() + * @tc.desc: verify the function of cancel(100)callback + */ + it('ACTS_SetWantInfo_3800', 0, async function (done) { + wantAgent.cancel(100,(err) => { + console.info('----cancelc success!----'+err.code); + }); + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_3900 + * @tc.name: cancel() + * @tc.desc: verify the function of cancel(100)promise + */ + it('ACTS_SetWantInfo_3900', 0, async function (done) { + var promise =await wantAgent.cancel(100) + console.info('----canceld success!----'+promise); + expect(promise).assertEqual(undefined) + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_4000 + * @tc.name: getWant() + * @tc.desc: verify the function of cancel("")callback + */ + it('ACTS_SetWantInfo_4000', 0, async function (done) { + wantAgent.cancel("",(err) => { + console.info('----cancele success!----'+err.code); + }); + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_4100 + * @tc.name: cancel() + * @tc.desc: verify the function of cancel("")promise + */ + it('ACTS_SetWantInfo_4100', 0, async function (done) { + var promise = await wantAgent.cancel("") + console.info('----cancelf success!----'+promise); + expect(promise).assertEqual(undefined) + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_4200 + * @tc.name: cancel() + * @tc.desc: verify the function of cancel("%^%^%^")callback + */ + it('ACTS_SetWantInfo_4200', 0, async function (done) { + wantAgent.cancel("%^%^%^",(err) => { + console.info('----cancelg success!----'+err.code); + }); + done() + }) + /* + * @tc.number: ACTS_SetWantInfo_4300 + * @tc.name: cancel() + * @tc.desc: verify the function of cancel("%^%^%^")promise + */ + it('ACTS_SetWantInfo_4300', 0, async function (done) { + var promise =await wantAgent.cancel("%^%^%^") + console.info('----cancelh success!----'+promise); + expect(promise).assertEqual(undefined) + done() + }) +}) + + diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/BUILD.gn b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/BUILD.gn deleted file mode 100644 index 47c85b202107e69e9265b23959aab499c22d7947..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsAnsGetWantAgentInfoOneTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsGetWantAgentInfoOneTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/config.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/config.json deleted file mode 100644 index 6d8f460a2acfca8e34a9adbf0dd084b003c8320e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/config.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetwantagentinfoonetest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetwantagentinfoonetest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsansgetwantagentinfoonetest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/test/WantAgent.test.js deleted file mode 100644 index 34a83b57752897cc5eddaa259f7736a13243abea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/entry/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -var WantAgent1; -var WantAgent2; -var time = 1000 -describe('ActsAnsGetWantAgentInfoOneTest', function () { - console.info('----ActsGetWantAgentInfoTest----'); - - /* - * @tc.number: ACTS_SetWantInfo_0100 - * @tc.name: getWantAgent(),getBundleName(),getUid(),getWant() - * @tc.desc: verify the function of getWantAgent(),getBundleName(),getUid(),getWant() - */ - it('ACTS_SetWantInfo_0100', 0, async function (done) { - console.info('----scene_test_callback_1----'); - var agentInfo1 = { - wants: [ - { - deviceId: "deviceId", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] - } - - - console.info('----getWantAgent1 before----'); - wantAgent.getWantAgent(agentInfo1, - (err, data) => { - if (err.code == 0) { - WantAgent1 = data; - console.info('----getWantAgent1 success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - - wantAgent.getBundleName(data, - (err1, data1) => { - if (err1.code == 0) { - console.info('----getBundleName success!----'); - console.info('bundleName = ' + data1); - expect(typeof(data1)).assertEqual('string') - } else { - console.info('----getBundleName failed!----'); - } - } - ); - wantAgent.getUid(data, - (err2, data2) => { - if (err2.code == 0) { - console.info('----getUid success!----'); - console.info('Uid = ' + data2); - expect(typeof(data2)).assertEqual('number') - } else { - console.info('----getUid failed!----'); - } - } - ); - wantAgent.getWant(data,(err3, data3) => { - if (err3.code == 0) { - console.info('----getWant success!----'); - console.info('Want = ' + data3); - expect(typeof(data3)).assertEqual('object') - } else { - console.info('----getWant failed!----'); - } - }); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - }), - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0100====>"); - }, time); - console.info('----getWantAgent1 after----'); - }) - - /* - * @tc.number: ACTS_SetWantInfo_0200 - * @tc.name: getWantAgent(),equal() - * @tc.desc: verify the function of getWantAgent(),equal() - */ - it('ACTS_SetWantInfo_0200', 0, async function (done) { - var agentInfo2 = { - wants: [ - { - deviceId: "deviceId", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent2 before----'); - wantAgent.getWantAgent(agentInfo2, - (err, data) => { - if (err.code == 0) { - WantAgent2 = data; - console.info('----getWantAgent2 success!----'); - console.log("==WantAgent1=="+JSON.stringify(WantAgent1)) - console.log("===WantAgent2=="+JSON.stringify(WantAgent2)) - console.info(data); - expect(typeof(data)).assertEqual("object"); - wantAgent.equal(WantAgent1,WantAgent2, - (error,data) => { - if(error.code == 0) { - console.info('----equal1 success!----') - console.info(data); - expect(typeof(data)).assertEqual("boolean"); - } - else{ - console.info('----equal1 failed!----') - } - } - ) - wantAgent.equal(WantAgent1,WantAgent1, - (error,data) => { - if(error.code == 0) { - console.info('----equal2 success!----') - console.info(data); - expect(typeof(data)).assertEqual("boolean"); - } - else{ - console.info('----equal2 failed!----') - } - } - ) - } - else{ - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - }); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0200====>"); - }, time); - console.info('----getWantAgent2 after----'); - }) -}) - diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/BUILD.gn b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/BUILD.gn deleted file mode 100644 index 5415b2410e073689df141c7e0293f6b31d14ca97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsAnsGetWantAgentInfoOneProTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsGetWantAgentInfoOneProTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/Test.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/Test.json deleted file mode 100644 index 7826e24b59b98d5ef2a361f771f7fd6b57e4c1b9..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "160000", - "package": "com.example.actsansgetwantagentinfooneprotest", - "shell-timeout": "160000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsGetWantAgentInfoOneProTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/config.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/config.json deleted file mode 100644 index 58aa4a4cd9ee82a5f52d47194659a7644fce1cc0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/config.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetwantagentinfooneprotest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetwantagentinfooneprotest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsansgetwantagentinfooneprotest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 4485661aeee26cf6b597e2a2a0588b8e27e7f243..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - 获取AgentInfo-Promise - -
diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import file from '@system.file' -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - - require('../../../test/List.test') - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 9d70d7a7f2b80bcf972f473ef228f2ea90ccb93f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "AgentInfoPro" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/resources/base/media/icon.png and /dev/null differ diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/test/List.test.js deleted file mode 100644 index 680626aa64dc7a7d91516062ca239fdf5540d142..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -require('./WantAgent.test.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/test/WantAgent.test.js deleted file mode 100644 index c7011b02170da14a830b7115629199febe1d0aca..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/entry/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -var WantAgent1; -var WantAgent2; -var time = 5000 -describe('ActsAnsGetWantAgentInfoOneProTest', function () { - console.info('----ActsGetWantAgentInfoTest----'); - - /* - * @tc.number: ACTS_SetWantInfo_0300 - * @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel() - * @tc.desc: verify the function of getWantAgent(),getBundleName(),getUid(),getWant(),cancel() promise - */ - it('ACTS_SetWantInfo_0300', 0, async function (done) { - var agentInfo1 = { - wants: [ - { - deviceId: "deviceId", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] - } - - - console.info('----getWantAgent1 before----'); - wantAgent.getWantAgent(agentInfo1, - (err, data) => { - if (err.code == 0) { - WantAgent1 = data; - console.info('----getWantAgent1 Promise success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - - wantAgent.getBundleName(data).then( - (data1) => { - console.info('----getBundleName Promise success!----'); - console.info('bundleName = ' + data1); - expect(typeof(data1)).assertEqual('string') - } - ); - wantAgent.getUid(data).then( - (data2) => { - console.info('----getUid Promise success!----'); - console.info('Uid = ' + data2); - expect(typeof(data2)).assertEqual('number') - } - ); - wantAgent.getWant(data).then( - (data3) => { - console.info('----getWant Promise success!----'); - console.info('Want = ' + data3); - expect(typeof(data3)).assertEqual('object') - } - ); - - wantAgent.cancel(data).then( - console.info("========cancelPromise========") - ); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - }), - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0300====>"); - }, time) - console.info('----getWantAgent1 after----'); - }) - - /* - * @tc.number: ACTS_SetWantInfo_0400 - * @tc.name: getWantAgent(),equal() - * @tc.desc: verify the function of getWantAgent(),equal() promise - */ - it('ACTS_SetWantInfo_0400', 0, async function (done) { - var agentInfo2 = { - wants: [ - { - deviceId: "deviceId", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent2 before----'); - wantAgent.getWantAgent(agentInfo2, - (err, data) => { - if (err.code == 0) { - WantAgent2 = data; - console.info('----getWantAgent2 Promise success!----'); - console.log("==WantAgent1=="+JSON.stringify(WantAgent1)) - console.log("==WantAgent2=="+JSON.stringify(WantAgent2)) - console.info(data); - expect(typeof(data)).assertEqual("object"); - wantAgent.equal(WantAgent1,WantAgent2).then( - (data) => { - console.info('----equalPromise1 success!----') - console.info(data); - expect(data).assertEqual(false); - } - ) - wantAgent.equal(WantAgent1,WantAgent1).then( - (data) => { - console.info('----equalPromise2 success!----') - console.info(data); - expect(data).assertEqual(true); - } - ) - } - else{ - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - }); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0400====>"); - }, time) - console.info('----getWantAgent2 after----'); - }) -}) - diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoonepro/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/BUILD.gn b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/BUILD.gn deleted file mode 100644 index ef151694f1abe0b23155322c3c9bbefcc0ac27f2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsAnsGetWantAgentInfoTwoTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsGetWantAgentInfoTwoTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/Test.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/Test.json deleted file mode 100644 index f52b50841265f44645f21a632220ff5175555533..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "com.example.actsansgetwantagentinfotwotest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsGetWantAgentInfoTwoTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 14dace840b438719d5f6ad3bce9883b2f9d1009c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - 获取AgentInfo - -
diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import file from '@system.file' -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - - require('../../../test/List.test') - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 31ca8fb1da55eb155b0cd8cb5877968c2f29c5e7..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "AgentInfo1" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/resources/base/media/icon.png and /dev/null differ diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/test/List.test.js deleted file mode 100644 index 680626aa64dc7a7d91516062ca239fdf5540d142..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -require('./WantAgent.test.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/test/WantAgent.test.js deleted file mode 100644 index bbbc2ee3c7e94a9a9b3f2ed483ecaaea8d2062b1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/entry/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -var WantAgent1; -var WantAgent2; -var time = 1000 -describe('ActsAnsGetWantAgentInfoTwoTest', function () { - console.info('----ActsGetWantAgentInfoTest----'); - - function CancelWantCallback(){ - console.log("=========CancelWantCallback===========") - } - - /* - * @tc.number: ACTS_SetWantInfo_0500 - * @tc.name: getWantAgent(),cancel() - * @tc.desc: verify the function of getWantAgent(),cancel() - */ - it('ACTS_SetWantInfo_0500', 0, async function (done) { - console.info('----scene_test_callback_1----'); - var agentInfo1 = { - wants: [ - { - deviceId: "deviceId", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] - } - - - console.info('----getWantAgent1 before----'); - wantAgent.getWantAgent(agentInfo1, - (err, data) => { - if (err.code == 0) { - WantAgent1 = data; - console.info('----getWantAgent1 success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - wantAgent.cancel(data,CancelWantCallback); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - }), - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0500====>"); - }, time) - console.info('----getWantAgent1 after----'); - }) - - /* - * @tc.number: ACTS_SetWantInfo_0600 - * @tc.name: getWantAgent(),equal() - * @tc.desc: verify the function of getWantAgent(),equal() - */ - it('ACTS_SetWantInfo_0600', 0, async function (done) { - var agentInfo2 = { - wants: [ - { - deviceId: "deviceId", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent2 before----'); - wantAgent.getWantAgent(agentInfo2, - (err, data) => { - if (err.code == 0) { - WantAgent2 = data; - console.info('----getWantAgent2 success!----'); - console.log("==WantAgent1=="+JSON.stringify(WantAgent1)) - console.log("==WantAgent2=="+JSON.stringify(WantAgent2)) - console.info(data); - expect(typeof(data)).assertEqual("object"); - wantAgent.equal(WantAgent1,WantAgent2, - (error,data) => { - if(error.code == 0) { - console.info('----equal1 success!----') - console.info(data); - } - else{ - console.info('----equal1 failed!----') - } - } - ) - wantAgent.equal(WantAgent1,WantAgent1, - (error,data) => { - if(error.code == 0) { - console.info('----equal2 success!----') - console.info(data); - } - else{ - console.info('----equal2 failed!----') - } - } - ) - } - else{ - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - }); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0600====>"); - }, time) - console.info('----getWantAgent2 after----'); - }) - -}) - diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwo/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/BUILD.gn b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/BUILD.gn deleted file mode 100644 index 9eadad3847dce728fa5c1d733a83cb4555f0f9c1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsAnsGetWantAgentInfoTwoProTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsGetWantAgentInfoTwoProTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/Test.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/Test.json deleted file mode 100644 index d8b11ca7f0e40da41d9e626abd228e070a201ac8..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "com.example.actsansgetwantagentinfotwoprotest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsGetWantAgentInfoTwoProTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/config.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/config.json deleted file mode 100644 index 01e35e7980b4bf542f68cb945aeca5f1b2f9deb6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/config.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetwantagentinfotwoprotest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetwantagentinfotwoprotest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsansgetwantagentinfotwoprotest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index a609d09209149406a084fbdd6ea5f8ca714e4e16..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - 获取AgentInfo-Promise2 - -
diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import file from '@system.file' -import {Core, ExpectExtend} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - - require('../../../test/List.test') - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index c3f9d752b965631b5bd2740effcc7b1ac2be299f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "AgentInfoPro2" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/resources/base/media/icon.png and /dev/null differ diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/test/List.test.js deleted file mode 100644 index 680626aa64dc7a7d91516062ca239fdf5540d142..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -require('./WantAgent.test.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/test/WantAgent.test.js deleted file mode 100644 index dc2262df7f8cbb706b72e7a47bc673ea85df18f4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/entry/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -var WantAgent1; -var WantAgent2; -var time = 1000 -describe('ActsAnsGetWantAgentInfoTwoProTest', function () { - console.info('----ActsGetWantAgentInfoTest----'); - - /* - * @tc.number: ACTS_SetWantInfo_0700 - * @tc.name: getWantAgent() - * @tc.desc: verify the function of getWantAgent() - */ - it('ACTS_SetWantInfo_0700', 0, async function (done) { - var agentInfo1 = { - wants: [ - { - deviceId: "deviceId", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] - } - - - console.info('----getWantAgent1 before----'); - wantAgent.getWantAgent(agentInfo1, - (err, data) => { - if (err.code == 0) { - WantAgent1 = data; - console.info('----getWantAgent1 Promise success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0700====>"); - }, time) - }), - console.info('----getWantAgent1 after----'); - }) - - /* - * @tc.number: ACTS_SetWantInfo_0800 - * @tc.name: getWantAgent(),equal() - * @tc.desc: verify the function of getWantAgent(),equal() promise - */ - it('ACTS_SetWantInfo_0800', 0, async function (done) { - var agentInfo2 = { - wants: [ - { - deviceId: "deviceId", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent2 before----'); - wantAgent.getWantAgent(agentInfo2, - (err, data) => { - if (err.code == 0) { - WantAgent2 = data; - console.info('----getWantAgent2 Promise success!----'); - console.log("==WantAgent1=="+JSON.stringify(WantAgent1)) - console.log("==WantAgent2=="+JSON.stringify(WantAgent2)) - console.info(data); - expect(typeof(data)).assertEqual("object"); - wantAgent.equal(WantAgent1,WantAgent2).then( - (data) => { - console.info('----equalPromise1 success!----') - console.info(data); - expect(data).assertEqual(false); - } - ) - wantAgent.equal(WantAgent1,WantAgent1).then( - (data) => { - console.info('----equalPromise2 success!----') - console.info(data); - expect(data).assertEqual(true); - } - ) - } - else{ - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0800====>"); - }, time) - }); - - console.info('----getWantAgent2 after----'); - }) -}) - diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfotwopro/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/getwantagentinfo/signature/openharmony_sx.p7b similarity index 100% rename from notification/ans_standard/publish_test/getwantagentinfo/getwantagentinfoone/signature/openharmony_sx.p7b rename to notification/ans_standard/publish_test/getwantagentinfo/signature/openharmony_sx.p7b diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/test/Subscriber.js b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/test/Subscriber.js index 43e1d960f072ff40d90b31147eee719b958ee43c..d614011c37c0869cab3a8bab6ddcf375c8742202 100644 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/test/Subscriber.js +++ b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/test/Subscriber.js @@ -554,9 +554,8 @@ describe('ActsAnsCommonEventTest', function () { } } //subscribeOn - function subscribeOnCallback(err) { - console.debug("===>subscribeOnCallback===>"+err.code); - expect(err.code).assertEqual(0); + function subscribeOnCallback() { + console.debug("===>subscribeOnCallback===>"); } //subscribe function subscribeCallback(err) { diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/entry/src/main/js/test/Subscriber.js b/notification/ans_standard/publish_test/subscribe/subscribe/entry/src/main/js/test/Subscriber.js index e83b80ac9756b07c5fd81585dea42dca7752c77b..87990fb1cbfa5e76291120b13653462cec4cad7c 100644 --- a/notification/ans_standard/publish_test/subscribe/subscribe/entry/src/main/js/test/Subscriber.js +++ b/notification/ans_standard/publish_test/subscribe/subscribe/entry/src/main/js/test/Subscriber.js @@ -21,6 +21,7 @@ describe('ActsAnsSubscriberTest', function () { var subInfoa ={ onConsume:consumeCallbackc, onConnect:connectCallbacka, + onDisconnect:disconnectCallbacka, } function consumeCallbackc(err,data) { console.debug("==>consumeCallbackc data : ==>" +err+ JSON.stringify(data)); @@ -28,8 +29,7 @@ describe('ActsAnsSubscriberTest', function () { notify.unsubscribe(subInfoa, unSubscribeCallbacka); } function connectCallbacka(err) { - console.debug("==>connectCallbacka code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbacka code==>"); } function subscribeCallbacka(err) { console.debug("==>subscribeCallbacka code==>" +err.code); @@ -39,10 +39,12 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==>unSubscribeCallbacka code==>" +err.code); expect(err.code).assertEqual(0); } + function disconnectCallbacka(err){ + console.debug("==>disconnectCallbacka code==>"); + } //ActsSubscriber_test_0200 function connectCallbackb(err) { - console.debug("==>connectCallbackb code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbackb code==>"); } function subscribeCallbackb(err) { console.debug("==>subscribeCallbackb code==>" +err.code); @@ -56,14 +58,15 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==>unSubscribeCallbackb code==>" +err.code); expect(err.code).assertEqual(0); } + function disconnectCallbackb(err){ + console.debug("==>disconnectCallbackb code==>"); + } //ActsSubscriber_test_0300 function connectCallbackc(err) { - console.debug("==>connectCallbackc code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbackc code==>"); } function connectCallbackd(err) { - console.debug("==>connectCallbackd code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbackd code==>"); } function subscribeCallbackd(err) { console.debug("==>subscribeCallbackd code==>" +err.code); @@ -81,31 +84,18 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==>unSubscribeCallbackd code==>" +err.code); expect(err.code).assertEqual(0); } - //ActsSubscriber_test_0400 - function connectCallbacke(err) { - console.debug("==>connectCallbacke code==>" +err.code); - expect(err.code).assertEqual(0); + function disconnectCallbackc(err){ + console.debug("==>disconnectCallbackc code==>"); } - function subscribeCallbackf(err) { - console.debug("==>subscribeCallbackf code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbacke(err){ - console.debug("==>unSubscribeCallbacke code==>" +err.code); - expect(err.code).assertEqual(0); + function disconnectCallbackd(err){ + console.debug("==>disconnectCallbackd code==>"); } //ActsSubscriber_test_0500 function connectCallbackf(err) { - console.debug("==>connectCallbackf code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbackf code==>"); } function connectCallbackg(err) { - console.debug("==>connectCallbackg code==>" +err.code); - expect(err.code).assertEqual(0); - } - function connectCallbackh(err) { - console.debug("==>connectCallbackh code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbackg code==>"); } function subscribeCallbackg(err) { console.debug("==>subscribeCallbackg code==>" +err.code); @@ -119,10 +109,6 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==>subscribeCallbacki code==>" +err.code); expect(err.code).assertEqual(0); } - function subscribeCallbackj(err) { - console.debug("==>subscribeCallbackj code==>" +err.code); - expect(err.code).assertEqual(0); - } function unSubscribeCallbackf(err){ console.debug("==>unSubscribeCallbackf code==>" +err.code); expect(err.code).assertEqual(0); @@ -131,14 +117,17 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==>unSubscribeCallbackg code==>" +err.code); expect(err.code).assertEqual(0); } - function unSubscribeCallbackh(err){ - console.debug("==>unSubscribeCallbackh code==>" +err.code); - expect(err.code).assertEqual(0); + function disconnectCallbackf(err){ + console.debug("==>disconnectCallbackf code==>"); + } + function disconnectCallbackg(err){ + console.debug("==>disconnectCallbackg code==>"); } //ActsSubscriber_test_0600 var subInfob = { onConsume:consumeCallbacka, onConnect:connectCallbacki, + onDisconnect:disconnectCallbacki, } function consumeCallbacka(err,data) { console.debug("==>consumeCallbacka data : ==>" +err+ JSON.stringify(data)); @@ -146,8 +135,7 @@ describe('ActsAnsSubscriberTest', function () { notify.unsubscribe(subInfob, unSubscribeCallbacki); } function connectCallbacki(err) { - console.debug("==>connectCallbacki code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbacki code==>"); } function subscribeCallbackl(err) { console.debug("==>subscribeCallbackl code==>" +err.code); @@ -157,10 +145,14 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==>unSubscribeCallbacki code==>" +err.code); expect(err.code).assertEqual(0); } + function disconnectCallbacki(err){ + console.debug("==>disconnectCallbacki code==>"); + } //ActsSubscriber_test_0700 var subInfoc ={ onConsume:consumeCallbackb, - onConnect:connectCallbackj, + onConnecte:connectCallbackj, + onDisconnect:disconnectCallbackj, } function consumeCallbackb(err,data) { console.debug("==>consumeCallbackb data : ==>" +err+ JSON.stringify(data)); @@ -168,17 +160,20 @@ describe('ActsAnsSubscriberTest', function () { notify.unsubscribe(subInfoc, unSubscribeCallbackj); } function connectCallbackj(err) { - console.debug("==>connectCallbackj code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbackj code==>"); } function unSubscribeCallbackj(err){ console.debug("==>unSubscribeCallbackj code==>" +err.code); expect(err.code).assertEqual(0); } + function disconnectCallbackj(err){ + console.debug("==>disconnectCallbackj code==>"); + } //ActsSubscriber_test_0800 var subInfod ={ onConsume:consumeCallbackd, onConnect:connectCallbackm, + onDisconnect:disconnectCallbackl, } function consumeCallbackd(err,data) { console.debug("==>consumeCallbackd data : ==>" +err+ JSON.stringify(data)); @@ -186,8 +181,7 @@ describe('ActsAnsSubscriberTest', function () { notify.unsubscribe(subInfod, unSubscribeCallbackl); } function connectCallbackm(err) { - console.debug("==>connectCallbackm code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbackm code==>"); } function subscribeCallbackn(err) { console.debug("==>subscribeCallbackn code==>" +err.code); @@ -197,10 +191,14 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==>unSubscribeCallbackl code==>" +err.code); expect(err.code).assertEqual(0); } + function disconnectCallbackl(err){ + console.debug("==>disconnectCallbackl code==>"); + } //ActsSubscriber_test_0900 var subInfoe ={ onConsume:consumeCallbacke, onConnect:connectCallbackn, + onDisconnect:disconnectCallbackm, } function consumeCallbacke(err,data) { console.debug("==>consumeCallbacke data : ==>" +err+ JSON.stringify(data)); @@ -208,17 +206,18 @@ describe('ActsAnsSubscriberTest', function () { notify.unsubscribe(subInfoe, unSubscribeCallbackm); } function connectCallbackn(err) { - console.debug("==>connectCallbackn code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbackn code==>"); } function unSubscribeCallbackm(err){ console.debug("==>unSubscribeCallbackm code==>" +err.code); expect(err.code).assertEqual(0); } + function disconnectCallbackm(err){ + console.debug("==>disconnectCallbackm code==>"); + } //ActsSubscriber_test_1400 function connectCallbackl(err){ - console.debug("==>connectCallbackl code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbackl code==>"); } function subscribeCallbacko(err){ console.debug("==>subscribeCallbacko code==>" +err.code); @@ -228,10 +227,12 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==>unSubscribeCallbackn code==>" +err.code); expect(err.code).assertEqual(0); } + function disconnectCallbackn(err){ + console.debug("==>disconnectCallbackn code==>"); + } //ActsSubscriber_test_1500 function connectCallbacko(err){ - console.debug("==>connectCallbacko code==>" +err.code); - expect(err.code).assertEqual(0); + console.debug("==>connectCallbacko code==>"); } function subscribeCallbackp(err){ console.debug("==>subscribeCallbackp code==>" +err.code); @@ -241,6 +242,9 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==>unSubscribeCallbacko code==>" +err.code); expect(err.code).assertEqual(0); } + function disconnectCallbacko(err){ + console.debug("==>disconnectCallbacko code==>"); + } function checkConsumeData(data){ expect(data.request.id).assertEqual(1); expect(data.request.content.contentType).assertEqual(0); @@ -278,9 +282,6 @@ describe('ActsAnsSubscriberTest', function () { await notify.subscribe(subInfoa, subscribeCallbacka); console.debug("==ActsSubscriber_test_0100==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0100====>"); - }, time); }) /* @@ -292,15 +293,13 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==ActsSubscriber_test_0200==begin==>"); var subInfo ={ onConnect:connectCallbackb, + onDisconnect:disconnectCallbackb, } await notify.subscribe(subInfo,subscribeCallbackb); await notify.subscribe(subInfo,subscribeCallbackc); await notify.unsubscribe(subInfo, unSubscribeCallbackb); console.debug("==ActsSubscriber_test_0200==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0200====>"); - }, time); }) /* @@ -313,9 +312,11 @@ describe('ActsAnsSubscriberTest', function () { var subInfo ={ onConnect:connectCallbackc, + onDisconnect:disconnectCallbackc, } var subInfo2 ={ onConnect:connectCallbackd, + onDisconnect:disconnectCallbackd, } await notify.subscribe(subInfo,subscribeCallbackd); await notify.subscribe(subInfo2,subscribeCallbacke); @@ -323,77 +324,43 @@ describe('ActsAnsSubscriberTest', function () { await notify.unsubscribe(subInfo2, unSubscribeCallbackd); console.debug("==ActsSubscriber_test_0300==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0300====>"); - }, time); }) - /* * @tc.number: ActsSubscriber_test_0400 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ it('ActsSubscriber_test_0400', 0, async function (done) { - console.debug("==ActsSubscriber_test_0400==begin==>"); - await notify.subscribe({ - onConnect:connectCallbacke, - },subscribeCallbackf); - await notify.unsubscribe({ - onConnect:connectCallbacke, - }, unSubscribeCallbacke); - console.debug("==ActsSubscriber_test_0400==end==>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0400====>"); - }, time); - }) - - /* - * @tc.number: ActsSubscriber_test_0500 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_0500', 0, async function (done) { console.debug("==ActsSubscriber_test_0500==begin==>"); var subInfo ={ onConnect:connectCallbackf, + onDisconnect:disconnectCallbackf, } var subInfo2 ={ onConnect:connectCallbackg, + onDisconnect:disconnectCallbackg, } - await notify.subscribe(subInfo,subscribeCallbackg); - await notify.subscribe(subInfo,subscribeCallbackh); - await notify.subscribe(subInfo2,subscribeCallbacki); - await notify.subscribe({ - onConnect:connectCallbackh, - },subscribeCallbackj); + await notify.subscribe(subInfo,subscribeCallbackg); + await notify.subscribe(subInfo,subscribeCallbackh); + await notify.subscribe(subInfo2,subscribeCallbacki); await notify.unsubscribe(subInfo, unSubscribeCallbackf); await notify.unsubscribe(subInfo2, unSubscribeCallbackg); - await notify.unsubscribe({ - onConnect:connectCallbackh, - }, unSubscribeCallbackh); console.debug("==ActsSubscriber_test_0500==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0500====>"); - }, time); }) /* - * @tc.number: ActsSubscriber_test_0600 + * @tc.number: ActsSubscriber_test_0500 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ - it('ActsSubscriber_test_0600', 0, async function (done) { - console.debug("==ActsSubscriber_test_0600==begin==>"); + it('ActsSubscriber_test_0500', 0, async function (done) { + console.debug("==ActsSubscriber_test_0500==begin==>"); await notify.subscribe(subInfob, {bundleNames:["com.example.actsanspublishtest"]},subscribeCallbackl); - console.debug("==ActsSubscriber_test_0600==end3==>"); + console.debug("==ActsSubscriber_test_0500==end3==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0600====>"); - }, time); }) /* @@ -401,147 +368,122 @@ describe('ActsAnsSubscriberTest', function () { * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ - it('ActsSubscriber_test_0700', 0, async function (done) { - console.debug("==ActsSubscriber_test_0700==begin==>"); + it('ActsSubscriber_test_0600', 0, async function (done) { + console.debug("==ActsSubscriber_test_0600==begin==>"); await notify.subscribe(subInfoc, {bundleNames:["com.example.actsanspublishtest"]}).then( - console.log("ActsSubscriber_test_0700=======promise") + console.log("ActsSubscriber_test_0600=======promise") ); - console.debug("==ActsSubscriber_test_0700==end==>"); + console.debug("==ActsSubscriber_test_0600==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0700====>"); - }, time); }) /* - * @tc.number: ActsSubscriber_test_0800 + * @tc.number: ActsSubscriber_test_0700 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ - it('ActsSubscriber_test_0800', 0, async function (done) { - console.debug("==ActsSubscriber_test_0800==begin==>"); + it('ActsSubscriber_test_0700', 0, async function (done) { + console.debug("==ActsSubscriber_test_0700==begin==>"); await notify.subscribe(subInfod, {bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]},subscribeCallbackn); - console.debug("==ActsSubscriber_test_0800==end==>"); + console.debug("==ActsSubscriber_test_0700==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0800====>"); - }, time); }) /* - * @tc.number: ActsSubscriber_test_0900 + * @tc.number: ActsSubscriber_test_0800 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ - it('ActsSubscriber_test_0900', 0, async function (done) { + it('ActsSubscriber_test_0800', 0, async function (done) { console.debug("==ActsSubscriber_test_0900==begin==>"); await notify.subscribe(subInfoe, {bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]}).then( console.log("ActsSubscriber_test_0900=======promise") ); console.debug("==ActsSubscriber_test_0900==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0900====>"); - }, time); }) /* - * @tc.number: ActsSubscriber_test_1000 + * @tc.number: ActsSubscriber_test_0900 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ - it('ActsSubscriber_test_1000', 0, async function (done) { + it('ActsSubscriber_test_0900', 0, async function (done) { console.debug("==ActsSubscriber_test_1000==begin==>"); var promise = notify.subscribe(100,{bundleNames:["com.example.actsanspublishtest"]}); expect(promise).assertEqual(undefined); console.debug("==ActsSubscriber_test_1000==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_1000====>"); - }, time); }) /* - * @tc.number: ActsSubscriber_test_1100 + * @tc.number: ActsSubscriber_test_1000 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ - it('ActsSubscriber_test_1100', 0, async function (done) { - console.debug("==ActsSubscriber_test_1100==begin==>"); + it('ActsSubscriber_test_1000', 0, async function (done) { + console.debug("==ActsSubscriber_test_1000==begin==>"); var subInfo = null var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); expect(promise).assertEqual(undefined); - console.debug("==ActsSubscriber_test_1100==end==>"); + console.debug("==ActsSubscriber_test_1000==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_1100====>"); - }, time); }) /* * @tc.number: ActsSubscriber_test_1200 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ - it('ActsSubscriber_test_1200', 0, async function (done) { + it('ActsSubscriber_test_1100', 0, async function (done) { console.debug("==ActsSubscriber_test_1200==begin==>"); var subInfo = "#$#%$%$^&%^%" var promise = notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); expect(promise).assertEqual(undefined); console.debug("==ActsSubscriber_test_1200==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_1200====>"); - }, time); }) /* - * @tc.number: ActsSubscriber_test_1300 + * @tc.number: ActsSubscriber_test_1200 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ - it('ActsSubscriber_test_1300', 0, async function (done) { - console.debug("==ActsSubscriber_test_1300==begin==>"); + it('ActsSubscriber_test_1200', 0, async function (done) { + console.debug("==ActsSubscriber_test_1200==begin==>"); var subInfo = "" var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); expect(promise).assertEqual(undefined); - console.debug("==ActsSubscriber_test_1300==end==>"); + console.debug("==ActsSubscriber_test_1200==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_1300====>"); - }, time); }) /* - * @tc.number: ActsSubscriber_test_1400 + * @tc.number: ActsSubscriber_test_1300 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ - it('ActsSubscriber_test_1400', 0, async function (done) { - console.debug("==ActsSubscriber_test_1100==begin==>"); + it('ActsSubscriber_test_1300', 0, async function (done) { + console.debug("==ActsSubscriber_test_1300==begin==>"); var subInfo ={ onConnect:connectCallbackl, + onDisconnect:disconnectCallbackn, } await notify.subscribe(subInfo,{bundleNames:["wrongBudleName"]},subscribeCallbacko); await notify.unsubscribe(subInfo, unSubscribeCallbackn); - console.debug("==ActsSubscriber_test_1400==end==>"); + console.debug("==ActsSubscriber_test_1300==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_1400====>"); - }, time); }) /* * @tc.number: ActsSubscriber_test_1500 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ - it('ActsSubscriber_test_1500', 0, async function (done) { - console.debug("==ActsSubscriber_test_1500==begin==>"); + it('ActsSubscriber_test_1400', 0, async function (done) { + console.debug("==ActsSubscriber_test_1400==begin==>"); var subInfo ={ onConnect:connectCallbacko, + onDisconnect:disconnectCallbacko, } await notify.subscribe(subInfo,{bundleNames:[]},subscribeCallbackp); await notify.unsubscribe(subInfo, unSubscribeCallbacko); - console.debug("==ActsSubscriber_test_1500==end==>"); + console.debug("==ActsSubscriber_test_1400==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_1500====>"); - }, time); }) })