diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index 4afcf7dd1d135e46268d232390e5128ad44ba515..12815ff7885c00ef3b53040e77efaefd07722d14 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -143,7 +143,7 @@ describe('ActsAmsCallBackFifthScene', function () { ' + error.code + ', data length [' + info.length + ']'); console.info('Acts_Ams_test_6600 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); @@ -278,7 +278,7 @@ describe('ActsAmsCallBackFifthScene', function () { ' + error.code + ', data length [' + info.length + ']'); console.info('Acts_Ams_test_9000 getActiveProcessInfos data ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index c24102920dabb67c16a539ce0347b3adf88c531a..4658704bddb03f1d9fa3a2e9903e6932cc08c93a 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -114,7 +114,7 @@ describe('ActsAmsCallBackFirstScene', function () { ' + error.code + ', data length [' + info.length + ']'); console.info('Acts_Ams_test_0200 getAllRunningProcesses data ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(5); + expect(info.length).assertEqual(4); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); @@ -249,7 +249,7 @@ describe('ActsAmsCallBackFirstScene', function () { ' + error.code + ', data length [' + info.length + ']'); console.info('Acts_Ams_test_8600 getActiveProcessInfos data ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(5); + expect(info.length).assertEqual(4); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index d13ab2163067f05a6eb977da266609a32a923425..5496ef1fb816b7c986c562eeda92633cd38afecf 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -159,7 +159,7 @@ describe('ActsAmsCallBackFourthScene', function () { ' + error.code + ', data length [' + info.length + ']'); console.info('Acts_Ams_test_5000 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(7); + expect(info.length).assertEqual(6); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); @@ -315,7 +315,7 @@ describe('ActsAmsCallBackFourthScene', function () { ' + error.code + ', data length [' + info.length + ']'); console.info('Acts_Ams_test_8900 getActiveProcessInfos data ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(7); + expect(info.length).assertEqual(6); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index 601cccc28876182aea4ba8475e94ca6a2fdb4dd9..be306bd23421e2a113f7dad7566f4a443340f5ea 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -129,7 +129,7 @@ describe('ActsAmsCallBackSecondScene', function () { ' + error.code + ', data length [' + info.length + ']'); console.info('Acts_Ams_test_1800 getAllRunningProcesses data ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); @@ -264,7 +264,7 @@ describe('ActsAmsCallBackSecondScene', function () { ' + error.code + ', data length [' + info.length + ']'); console.info('Acts_Ams_test_8700 getActiveProcessInfos data ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index fcc044b49cb4cbcfe976771289b4c9aa308c8233..e273f75222e5b5d5dd885db86a20b41210fb55bc 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -140,7 +140,7 @@ describe('ActsAmsCallBackThirdScene', function () { ' + error.code + ', data length [' + info.length + ']'); console.info('Acts_Ams_test_3400 getAllRunningProcesses data ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); @@ -275,7 +275,7 @@ describe('ActsAmsCallBackThirdScene', function () { ' + error.code + ', data length [' + info.length + ']'); console.info('Acts_Ams_test_8800 getActiveProcessInfos data ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json index ddef007937b0bed0425e88daa176ab3f40884ba1..0cc038c3d6b4b8db3e350b803d961a156f4fff82 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json +++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json @@ -10,6 +10,7 @@ { "test-file-name": [ "ActsAmsTestFifthSceneTest.hap", + "simulateFAbilityFir.hap", "simulateFAbilitySed.hap", "verifyIAbility.hap" ], diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index fe0cea293d02b5f136067c17c1fb9e322205a4e8..5ee51bde8b89adbe576cbc58e68195cf2af75745 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -161,7 +161,7 @@ describe('ActsAmsTestFifthScene', function () { console.info('getAllRunningProcesses data length [' + info.length + ']'); console.info('Acts_Ams_test_6500 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); @@ -260,7 +260,7 @@ describe('ActsAmsTestFifthScene', function () { var info = await abilitymanager.getActiveProcessInfos(); console.info('Acts_Ams_test_8500 getActiveProcessInfos JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index 514d70aa61843e0151a0cc0c609dde00794cd16c..e64f7a0e79cf4377b170836cb3ebb98ef3a824f7 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -121,7 +121,7 @@ describe('ActsAmsTestFirstScene', function () { var info = await abilitymanager.getAllRunningProcesses(); console.info('Acts_Ams_test_0100 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(5); + expect(info.length).assertEqual(4); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); @@ -258,7 +258,7 @@ describe('ActsAmsTestFirstScene', function () { var info = await abilitymanager.getActiveProcessInfos(); console.info('Acts_Ams_test_8100 getActiveProcessInfos JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(5); + expect(info.length).assertEqual(4); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index 81406386255ccd6a65d5bdc86daedca5889e128e..d8b4572efa78147693f333f701c8f320954334b0 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -181,7 +181,7 @@ describe('ActsAmsTestFourthScene', function () { console.info('getAllRunningProcesses data length [' + info.length + ']'); console.info('Acts_Ams_test_4900 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(7); + expect(info.length).assertEqual(6); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); @@ -218,7 +218,7 @@ describe('ActsAmsTestFourthScene', function () { var info = await abilitymanager.getActiveProcessInfos(); console.info('Acts_Ams_test_8400 getActiveProcessInfos JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(7); + expect(info.length).assertEqual(6); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index 1cb33a656873dc2769fc1ca264f12774c5748ac8..dd68bda82e60daefbd81422d96d8121662869caf 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -141,7 +141,7 @@ describe('ActsAmsTestSecondScene', function () { var info = await abilitymanager.getAllRunningProcesses(); console.info('Acts_Ams_test_1700 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); @@ -279,7 +279,7 @@ describe('ActsAmsTestSecondScene', function () { var info = await abilitymanager.getActiveProcessInfos(); console.info('Acts_Ams_test_8200 getActiveProcessInfos JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index 7a1e76af2e26be21201836f7c8c81081ef077778..9297cf1831d0b8c449f66baf5927b0f2cfdd80b5 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -159,7 +159,7 @@ describe('ActsAmsTestThirdScene', function () { var info = await abilitymanager.getAllRunningProcesses(); console.info('Acts_Ams_test_3300 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); @@ -280,7 +280,7 @@ describe('ActsAmsTestThirdScene', function () { var info = await abilitymanager.getActiveProcessInfos(); console.info('Acts_Ams_test_8300 getActiveProcessInfos JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); - expect(info.length).assertEqual(6); + expect(info.length).assertEqual(5); for (var i = 0; i < info.length; i++) { expect(typeof (info[i].pid)).assertEqual("number"); expect(info[i].pid).assertLarger(0); diff --git a/appexecfwk/ams_standard/amszipfileunzipfilest/Test.json b/appexecfwk/ams_standard/amszipfileunzipfilest/Test.json index 05ed7da83e34d107a2c3a5fb069d61b47caea48d..fa764b47dd7bc7b304032949393163d6371da339 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,52 @@ { "type": "PushKit", "push": [ - "amsZipfileUnzipfileST.hap->/data/test/amsZipfileUnzipfileST.hap" + "/resource/appexecfwk/ceshi.txt->/data/test/ceshi.txt", + "/resource/appexecfwk/ceshitwo.zip->/data/test/ceshitwo.zip", + "/resource/appexecfwk/ceshitwo.txt->/data/test/ceshitwo.txt" + ] }, + { "type": "ShellKit", "run-command": [ - "chmod 644 /data/test/*.hap" + "remount", + "mkdir /data/testA" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 777 /data/testA/*" + ] + }, + + { + "type": "ShellKit", + "run-command": [ + "chmod 777 /data/test/*" + ] + }, + + { + "type": "ShellKit", + "run-command": [ + "remount", + "mkdir /data/testb" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 777 /data/testb/*" ] } + + + + ] } 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..904a969650e0871632dc4ebdc2020abb6a719107 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 @@ -8,2042 +8,1888 @@ * * 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 zlib from '@ohos.zlib' import fileio from '@ohos.fileio' - - +import file from '@system.file' 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 is empty */ +it('FWK_ZipFile_0100', 0, async function (done) { + console.log("==================FWK_ZipFile_0100 start=================="); + var src = ""; + var dest = "/data/testA/"; + var options = {} + zlib.zipFile(src, dest, options, + (err, data) => { - 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(); - }) - + 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 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/notExist.txt"; + var dest = "/data/testA/"; + var options = {} + zlib.zipFile(src, dest, options, + (err, data) => { + console.log("zipFileCallBack_0200 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_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/notExist/"; + 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; + + try { + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH; + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; - 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_0600 size err:' + err); - + try { + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_0700 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_SYNC_FLUSH, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_0800 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_FULL_FLUSH, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_0900 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_FINISH, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_1000 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_BLOCK, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_1100 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_TREES, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_1200 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_1300 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_1400 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_SYNC_FLUSH, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_1500 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_FULL_FLUSH, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_1600 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_FINISH, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_1700 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_BLOCK, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_1800 size err:' + err); - + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_TREES, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_1900 size err:' + err); - - done(); + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); +} catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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(); - }); - }catch(err) { - console.error('ACTS_zipFile_2000 size err:' + err); - - done(); + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); +} catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_2100 size err:' + err); - - done(); + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); +} catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_2200 size err:' + err); - + var options = {}; + options.level = zlib.CompressLevel.COMPRESS_LEVEL_NO_COMPRESSION , + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_2300 size err:' + err); - + var options = {}; + options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_SPEED, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_2400 size err:' + err); - + var options = {}; + options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_COMPRESSION, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_2500 size err:' + err); - + var options = {}; + options.level = zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; -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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_2600 size err:' + err); - + var options = {}; + options.memlevel = zlib.MemLevel.MEM_LEVEL_MIN_MEMLEVEL, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_2700 size err:' + err); - + var options = {}; + options.memlevel = zlib.MemLevel.MEM_LEVEL_MAX_MEMLEVEL, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_2800 size err:' + err); - + var options = {}; + options.memlevel = zlib.MemLevel.MEM_LEVEL_DEFAULT_MEMLEVEL, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_2900 size err:' + err); - + var options = {}; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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('FWK_ZipFile_3000', 0, async function (done) { + console.log("==================FWK_ZipFile_3000 start=================="); + var src = "/data/test/ceshi.txt"; + var zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; -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"; - 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_3000 size err:' + err); - + var options = {}; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_3100 size err:' + err); - + var options = {}; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_HUFFMAN_ONLY, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_3200 size err:' + err); - + var options = {}; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_RLE, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 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 zipDest = "/data/testA/ceshi.zip"; + var unzipDir = "/data/testA/"; + var unzipDest = "/data/testA/ceshi.txt"; 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_zipFile_3300 size err:' + err); - + var options = {}; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED, + await zlib.zipFile(src, zipDest, options, + (err, data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.unzipFile(zipDest, unzipDir, options, + (err, data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }) + }); + } catch(err) { + console.error('FWK_ZipFile_0500 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_zipFile_3300=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_3300 end=================="); }) - - /* -* @tc.number: ACTS_unzipFile_0100 -* @tc.name: unzipFile : -* @tc.desc: +* @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 =================="); -it('ACTS_unzipFile_0100', 0, async function (done) { - console.log("==================ACTS_unzipFile_0100 start=================="); - var src =""; - var dest =""; - - 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); - }); - - function timeout() { - expect().assertFail(); - console.debug('ACTS_unzipFile_0100=====timeout======'); - } - setTimeout(timeout, 5000); - done(); }) - /* -* @tc.number: ACTS_unzipFile_0200 -* @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/teste/fefsef.txt"; + var dest = "/data/testA/sfefsfe.zip"; + var options = {} -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); - }); + 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 =================="); - 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_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/ceshi.txt"; + 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 ==================") -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"; - - zlib.unzipFile(src,dest, - (err, data) => { - console.log("unzipFileCallBack_0300 err: " + err.code); - console.log("unzipFileCallBack_0300 data: " + data); - expect(err).assertEqual(0); - expect(data).assertEqual(0); - }); - - function timeout() { - expect().assertFail(); - console.debug('ACTS_unzipFile_0300=====timeout======'); - } - setTimeout(timeout, 5000); - done(); }) - /* -* @tc.number: ACTS_unzipFile_0400 -* @tc.name: unzipFile : -* @tc.desc: +* @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 =================="); + +}) -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, - (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(); -}) /* -* @tc.number: ACTS_unzipFile_0500 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_3800 +* @tc.name: zipFile +* @tc.desc: FlushType.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_ZipFile_3800', 0, async function (done) { + console.log("==================FWK_ZipFile_3800 start=================="); + var src = "/data/test/ceshi.txt"; + var zipDest = "/data/testb/ceshi.zip"; + var unzipDir = "/data/testb/"; + var unzipDest = "/data/testb/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.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH; + zlib.zipFile(src, unzipDir, options,).then((data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.zipFile(zipDest, unzipDir, options,).then((data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }).catch((err)=>{ + console.log("FWK_ZipFile_3800 .catch((err)=>" + err); + done(); + }) + }).catch((err)=>{ + console.log("FWK_ZipFile_3800 .catch((err)=>" + err); done(); - }); - }catch(err) { - console.error('ACTS_unzipFile_0500 size err:' + err); - + }); + } catch(err) { + console.error('FWK_ZipFile_3800 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_0500=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_3800 end=================="); }) /* -* @tc.number: ACTS_unzipFile_0600 -* @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 zipDest = "/data/testb/ceshi.zip"; + var unzipDir = "/data/testb/"; + var unzipDest = "/data/testb/ceshi.txt"; + + try { + var options = {}; + options.flush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH, + zlib.zipFile(src, unzipDir, options,).then((data) => { + var zipStat = fileio.statSync(zipDest); + var isFile = zipStat.isFile(); + expect(isFile).assertTrue(); + var srcSize = fileio.statSync(src).size; + var destSize = zipStat.size; + expect(srcSize>destSize).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + + zlib.zipFile(zipDest, unzipDir, options,).then((data) => { + var unzipStat = fileio.statSync(unzipDest); + var isFile = unzipStat.isFile(); + expect(isFile).assertTrue(); + var destSize = unzipStat.size; + var originSize = fileio.statSync(src).size; + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }).catch((err)=>{ + console.log("FWK_ZipFile_3900 .catch((err)=>" + err); + 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_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"; +/* +* @tc.number: FWK_ZipFile_4000 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH +*/ +it('FWK_ZipFile_4000', 0, async function (done) { + console.log("==================FWK_ZipFile_4000 start=================="); + var src = "/data/test/"; + var dest = "/data/testA/ceshi.txt.zip"; - 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======'); + 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(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }); - }catch(err) { - console.error('ACTS_unzipFile_0600 size err:' + err); - + } catch(err) { + console.error('FWK_ZipFile_4000 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_0600=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_4000 end=================="); }) - /* -* @tc.number: ACTS_unzipFile_0700 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_4100 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_NO_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_ZipFile_4100', 0, async function (done) { + console.log("==================FWK_ZipFile_4100 start=================="); + var src = "/data/test/"; + var dest = "/data/testA/ceshi.txt.zip"; - 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======'); + 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(); + + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }).catch((err)=>{ + console.log("FWK_ZipFile_4100 .catch((err)=>" + err); done(); }); - }catch(err) { - console.error('ACTS_unzipFile_0700 size err:' + err); - + } catch(err) { + console.error('FWK_ZipFile_4100 err:' + err); done(); - } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_0700=====timeout======'); - }, '1000'); - + } + console.log("==================FWK_ZipFile_4100 end=================="); }) - /* -* @tc.number: ACTS_unzipFile_0800 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_4200 +* @tc.name: unzipFile +* @tc.desc: unzipFile */ +it('FWK_ZipFile_4200', 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("FWK_ZipFile_4200 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR); + done(); + }); +}) -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"; - - 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_unzipFile_0800 size err:' + err); +/* +* @tc.number: FWK_ZipFile_4300 +* @tc.name: unzipFile +* @tc.desc: unzipFile +*/ +it('FWK_ZipFile_4300', 0, async function (done) { + console.log("==================FWK_ZipFile_4300 start=================="); + var src = "/data/test/"; + var dest = "/data/testA/ceshi.txt.zip"; + var options = {} + zlib.unzipFile(src, dest, options, + (err, data) => { + console.log("FWK_ZipFile_4300 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); + done(); + }); +}) - done(); - } +/* +* @tc.number: FWK_ZipFile_4400 +* @tc.name: unzipFile +* @tc.desc: unzipFile +*/ +it('FWK_ZipFile_4400', 0, async function (done) { + console.log("==================FWK_ZipFile_4300 start=================="); + var src = "/data/test/cdshitwo.txt"; + var dest = "/data/testA/ceshi.txt.zip"; + var options = {} + zlib.unzipFile(src, dest, options, + (err, data) => { + console.log("FWK_ZipFile_4400 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR); + done(); + }); +}) - setTimeout(function(){ - console.debug('ACTS_unzipFile_0800=====timeout======'); - }, '1000'); - +/* +* @tc.number: FWK_ZipFile_4500 +* @tc.name: unzipFile +* @tc.desc: unzipFile +*/ +it('FWK_ZipFile_4500', 0, async function (done) { + console.log("==================FWK_ZipFile_4500 start=================="); + var src = "/data/testA/ceshi.txt.zip"; + var dest = ""; + var options = {} + zlib.unzipFile(src, dest, options, + (err, data) => { + console.log("FWK_ZipFile_4500 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); + done(); + }); }) /* -* @tc.number: ACTS_unzipFile_0900 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_4600 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH */ - -it('ACTS_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"; +it('FWK_ZipFile_4600', 0, async function (done) { + console.log("==================FWK_ZipFile_4600 start=================="); + var src = "/data/test/ceshitwo.zip"; + var dest = "/data/testb"; + var origin = "/data/test/ceshitwo.txt"; + var destFile = "/data/testb/ceshitwo.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======'); + 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_ZipFile_4600 destSize=" + destSize); + console.log("FWK_ZipFile_4600 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); - + } catch(err) { + console.error('FWK_ZipFilFWK_ZipFile_4600e_4200 err:' + err); done(); } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_0900=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_4600 end=================="); }) - /* -* @tc.number: ACTS_unzipFile_1000 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_4700 +* @tc.name: zipFile +* @tc.desc: inFile doesn't exist */ +it('FWK_ZipFile_4700', 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_ZipFile_4700 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR); + done(); + }).catch((err)=>{ + console.log("FWK_ZipFile_4700 err: " + err); + done(); + }); + console.log("==================FWK_ZipFile_4700 end =================="); +}) -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"; - - 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======'); - done(); - }); - }catch(err) { - console.error('ACTS_unzipFile_1000 size err:' + err); - - done(); - } +/* +* @tc.number: FWK_ZipFile_4800 +* @tc.name: zipFile +* @tc.desc: inFile is a directory that doesn't exist +*/ +it('FWK_ZipFile_4800', 0, async function (done) { + console.log("==================FWK_ZipFile_4800 start=================="); + var src = "/data/test"; + var dest = "/data/testA/ceshi.txt"; + var options = {} + zlib.unzipFile(src, dest, options).then((data) => { + console.log("FWK_ZipFile_4800 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); + done(); + }).catch((err)=>{ + console.log("FWK_ZipFile_4800 err: " + err); + done(); + }); + console.log("==================FWK_ZipFile_4800 end =================="); +}) - setTimeout(function(){ - console.debug('ACTS_unzipFile_1000=====timeout======'); - }, '1000'); - +/* +* @tc.number: FWK_ZipFile_4900 +* @tc.name: zipFile +* @tc.desc:output file not specified +*/ +it('FWK_ZipFile_4900', 0, async function (done) { + console.log("==================FWK_ZipFile_4900 start=================="); + var src = "/data/test/ceshi.txt"; + var dest = "/data/testc/ceshi.txt.zip"; + var options = {} + zlib.unzipFile(src, dest, options).then((data) => { + console.log("FWK_ZipFile_4900 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); + done(); + }).catch((err)=>{ + console.log("FWK_ZipFile_4900 err: " + err); + done(); + }); + console.log("==================FWK_ZipFile_4900 end =================="); }) /* -* @tc.number: ACTS_unzipFile_1100 -* @tc.name: unzipFile : -* @tc.desc: +* @tc.number: FWK_ZipFile_5000 +* @tc.name: unzipFile +* @tc.desc: unzipFile */ +it('FWK_ZipFile_5000', 0, async function (done) { + console.log("==================FWK_ZipFile_5000 start=================="); + var src = "/data/test/cdshitwo.txt"; + var dest = "/data/testA/ceshi.txt.zip"; + var options = {} + zlib.unzipFile(src, dest, options,).then((data)=>{ + console.log("FWK_ZipFile_5000 data: " + data); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_DATA_ERROR); + done(); + }).catch((err)=>{ + console.log("FWK_ZipFile_5000 err: " + err); + done(); + }); +}) -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_ZipFile_5100 +* @tc.name: zipFile +* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH +*/ +it('FWK_ZipFile_5100', 0, async function (done) { + console.log("==================FWK_ZipFile_5100 start=================="); + var src = "/data/test/ceshitwo.zip"; + var dest = "/data/testb"; + var origin = "/data/test/ceshitwo.txt"; + var destFile = "/data/testb/ceshitwo.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======'); + try { + var options = {}; + options.flushFlush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH, + zlib.unzipFile(src, dest, options).then((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_ZipFile_5100 destSize=" + destSize); + console.log("FWK_ZipFile_5100 data=" + data); + var result = (originSize == destSize); + expect(result).assertTrue(); + expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); + done(); + }).catch((err)=>{ + expect(fail).assertTrue(); + console.log("FWK_ZipFile_5100 .catch((err)=>" + err); done(); }); - }catch(err) { - console.error('ACTS_unzipFile_0500 size err:' + err); - + } catch(err) { + console.error('FWK_ZipFile_5100 err:' + err); + expect(fail).assertTrue(); done(); } - - setTimeout(function(){ - console.debug('ACTS_unzipFile_1100=====timeout======'); - }, '1000'); - + console.log("==================FWK_ZipFile_5100 end=================="); }) + }) diff --git a/appexecfwk/ams_standard/serviceability/actsparticleabilitytest/entry/src/main/js/test/ActsParticleAbilityTest.test.js b/appexecfwk/ams_standard/serviceability/actsparticleabilitytest/entry/src/main/js/test/ActsParticleAbilityTest.test.js index 081a981f167fa0380e161b9e97d7e0e7002ce884..f28fc3f3dab9470b0c8a66957939ba096725c6b8 100644 --- a/appexecfwk/ams_standard/serviceability/actsparticleabilitytest/entry/src/main/js/test/ActsParticleAbilityTest.test.js +++ b/appexecfwk/ams_standard/serviceability/actsparticleabilitytest/entry/src/main/js/test/ActsParticleAbilityTest.test.js @@ -17,14 +17,12 @@ import rpc from "@ohos.rpc" import featureAbility from '@ohos.ability.featureAbility' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' -const TIMEOUT = 9000; const START_ABILITY_TIMEOUT = 5000; - var subscriberInfoStartAbility_0100 = { - events: ["ACTS_Particle_StartAbility_0100_CommonEvent"], + events: ["ACTS_Particle_StartAbility_0100_CommonEvent", "DISCONNECT_0100"], }; var subscriberInfoStartAbility_0200 = { - events: ["ACTS_Particle_StartAbility_0200_CommonEvent"], + events: ["ACTS_Particle_StartAbility_0200_CommonEvent", "DISCONNECT_0200"], }; describe('ActsParticleAbilityTest', function () { @@ -42,7 +40,16 @@ describe('ActsParticleAbilityTest', function () { console.log('ACTS_featureAbilityTest ConnectAbility onConnect remote 是否为proxy:' + (remote instanceof rpc.RemoteProxy)); } - function onDisconnectCallback(element) { + function onDisconnectCallback1(element) { + commonEvent.publish("DISCONNECT_0100", ()=>{console.log('disconnect finish1')}); + console.log('ACTS_featureAbilityTest ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) + console.log('ACTS_featureAbilityTest ConnectAbility onDisconnect element.bundleName : ' + element.bundleName) + console.log('ACTS_featureAbilityTest ConnectAbility onDisconnect element.abilityName : ' + element.abilityName) + console.log('ACTS_featureAbilityTest ConnectAbility onDisconnect element.uri : ' + element.uri) + console.log('ACTS_featureAbilityTest ConnectAbility onDisconnect element.shortName : ' + element.shortName) + } + function onDisconnectCallback2(element) { + commonEvent.publish("DISCONNECT_0200", ()=>{console.log('disconnect finish2')}); console.log('ACTS_featureAbilityTest ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) console.log('ACTS_featureAbilityTest ConnectAbility onDisconnect element.bundleName : ' + element.bundleName) console.log('ACTS_featureAbilityTest ConnectAbility onDisconnect element.abilityName : ' + element.abilityName) @@ -65,20 +72,32 @@ describe('ActsParticleAbilityTest', function () { var subscriber; let id; let connId; + let events = new Map(); function subscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual("ACTS_Particle_StartAbility_0100_CommonEvent"); console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - var result = featureAbility.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }, - ); - console.log('DisconnectNative ConnectAbility result : ' + result); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - done(); + events.set(data.event, 0); + if(events.size == 1){ + if(data.event != "DISCONNECT_0100"){ + clearTimeout(id); + expect(data.event).assertEqual("ACTS_Particle_StartAbility_0100_CommonEvent"); + featureAbility.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }, + ); + } else { + expect(data.event).assertEqual("DISCONNECT_0100"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } + } else { + expect(data.event).assertEqual("DISCONNECT_0100"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } + } commonEvent.createSubscriber(subscriberInfoStartAbility_0100).then(async (data) => { @@ -89,14 +108,17 @@ describe('ActsParticleAbilityTest', function () { function unSubscribeCallback() { console.debug("====>UnSubscribe CallBack====>"); - done(); } function timeout() { expect().assertFail(); console.debug('ACTS_ParticleAbility_startAbility_0100 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - done(); + featureAbility.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }, + ); } id = setTimeout(timeout, START_ABILITY_TIMEOUT); @@ -108,14 +130,11 @@ describe('ActsParticleAbilityTest', function () { }, { onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, + onDisconnect: onDisconnectCallback1, onFailed: onFailedCallback, }, ); console.log('StartConnectNative ConnectAbility connId : ' + connId); - setTimeout(function () { - console.log('StartConnectNative ConnectAbility timeout') - }, TIMEOUT); }) /* @@ -129,20 +148,31 @@ describe('ActsParticleAbilityTest', function () { var subscriber; let id; let connId; - + let events = new Map(); + function subscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual("ACTS_Particle_StartAbility_0200_CommonEvent"); console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); - var result = featureAbility.disconnectAbility( - connId, - (error, data) => { - console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) - }, - ); - console.log('DisconnectNative ConnectAbility result : ' + result); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - done(); + events.set(data.event, 0); + if(events.size == 1){ + if(data.event != "DISCONNECT_0200"){ + clearTimeout(id); + expect(data.event).assertEqual("ACTS_Particle_StartAbility_0200_CommonEvent"); + featureAbility.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }, + ); + } else { + expect(data.event).assertEqual("DISCONNECT_0200"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } + } else { + expect(data.event).assertEqual("DISCONNECT_0200"); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } } commonEvent.createSubscriber(subscriberInfoStartAbility_0200).then(async (data) => { @@ -153,14 +183,17 @@ describe('ActsParticleAbilityTest', function () { function unSubscribeCallback() { console.debug("====>UnSubscribe CallBack====>"); - done(); } function timeout() { expect().assertFail(); console.debug('ACTS_ParticleAbility_startAbility_0200 timeout'); - commonEvent.unsubscribe(subscriber, unSubscribeCallback) - done(); + featureAbility.disconnectAbility( + connId, + (error, data) => { + console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) + }, + ); } id = setTimeout(timeout, START_ABILITY_TIMEOUT); @@ -172,14 +205,10 @@ describe('ActsParticleAbilityTest', function () { }, { onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, + onDisconnect: onDisconnectCallback2, onFailed: onFailedCallback, }, ); console.log('StartConnectNative ConnectAbility connId : ' + connId); - setTimeout(function () { - console.log('StartConnectNative ConnectAbility timeout') - }, TIMEOUT); }) - }) \ No newline at end of file diff --git a/appexecfwk/ams_standard/serviceability/sceneProject/particlestartability/src/main/js/default/pages/index/index.js b/appexecfwk/ams_standard/serviceability/sceneProject/particlestartability/src/main/js/default/pages/index/index.js index 8555bfc25a35b9021e7cc0b31f72440d33ca9361..9c7b845271e34dd18e013b0ec5779f35a0c6a134 100644 --- a/appexecfwk/ams_standard/serviceability/sceneProject/particlestartability/src/main/js/default/pages/index/index.js +++ b/appexecfwk/ams_standard/serviceability/sceneProject/particlestartability/src/main/js/default/pages/index/index.js @@ -23,33 +23,20 @@ function publishCallBackOne() { function publishCallBackTwo() { console.debug("====>Publish CallBack ACTS_Particle_StartAbility_0200_CommonEvent====>"); } -function publishCallBackThree() { - console.debug("====>Publish CallBack ACTS_Particle_StartAbility_0300_CommonEvent====>"); -} -function publishCallBackFour() { - console.debug("====>Publish CallBack ACTS_Particle_StartAbility_0400_CommonEvent====>"); -} -function publishCallBackFive() { - console.debug("====>Publish CallBack ACTS_Particle_StartAbility_0500_CommonEvent====>"); -} -function publishCallBackSix() { - console.debug("====>Publish CallBack ACTS_Particle_StartAbility_0600_CommonEvent====>"); -} + export default { data: { title: "ParticleStartAbility" }, onInit() { - this.title = this.data.title; + this.title = "ParticleStartAbility"; }, onShow() { commonEvent.publish("ACTS_Particle_StartAbility_0100_CommonEvent", publishCallBackOne); commonEvent.publish("ACTS_Particle_StartAbility_0200_CommonEvent", publishCallBackTwo); - commonEvent.publish("ACTS_Particle_StartAbility_0300_CommonEvent", publishCallBackThree); - commonEvent.publish("ACTS_Particle_StartAbility_0400_CommonEvent", publishCallBackFour); - commonEvent.publish("ACTS_Particle_StartAbility_0500_CommonEvent", publishCallBackFive); - commonEvent.publish("ACTS_Particle_StartAbility_0600_CommonEvent", publishCallBackSix); + + }, onReady() { }, diff --git a/appexecfwk/ams_standard/serviceability/sceneProject/particletestserver/src/main/js/default/pages/index/index.js b/appexecfwk/ams_standard/serviceability/sceneProject/particletestserver/src/main/js/default/pages/index/index.js index 23497bb4dc7f9aa545cfc66c4172cef88c96f4db..8e6615b21b63b0b78ae83b16dd06588137e6dac9 100644 --- a/appexecfwk/ams_standard/serviceability/sceneProject/particletestserver/src/main/js/default/pages/index/index.js +++ b/appexecfwk/ams_standard/serviceability/sceneProject/particletestserver/src/main/js/default/pages/index/index.js @@ -20,7 +20,10 @@ let mMyProxy; export default { data: { - title: "" + title: "ParticleStartAbility" + }, + onInit() { + this.title = "ParticleStartAbility"; }, onStart(want) { console.log('SerivceAbilityServer onStart');