diff --git a/aafwk/aafwk_standard/BUILD.gn b/aafwk/aafwk_standard/BUILD.gn
index 08a86b67888ef9f3fbbc43b7c7086a01d205213d..7b647df95c2c55adee3d284488251cb62d4919e5 100755
--- a/aafwk/aafwk_standard/BUILD.gn
+++ b/aafwk/aafwk_standard/BUILD.gn
@@ -21,6 +21,7 @@ group("aafwk_standard") {
"abilitymanager:actsabilitymanagertest",
"actsabilitydistributetest:ActsAbilityDistributeTest",
"actsabilitydistributetest:ActsAbilityDistributeTest",
+ "amsZipfileUnzipfileST:ActsZlibTest",
"amsabilitymanager/amsMissionSnapshotTest:ActsAmsMissionSnapshotTest",
"amsabilitymanager/amsMissionSnapshotTestSingleton:ActsAmsMissionSnapshotTestSingleton",
"amsabilitymanager/amsMissionSnapshotTestSingletonS:ActsAmsMissionSnapshotTestSingletonS",
@@ -43,7 +44,6 @@ group("aafwk_standard") {
"amsmultiapp/amsmultiapptester:ActsAmsMultiAppTester",
"amsmultiapp/amsmultidataabilityclone:ActsAmsMultiDataAbilityClone",
"amsmultiapp/amsmultidataabilityself:ActsAmsMultiDataAbilitySelf",
- "amszipfileunzipfilest:ActsAmsZipfileUnzipfileSTest",
"context:context",
"featureability:featureability",
"formmanager:formmanager",
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/.gitignore b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..52c0fa2ebccc570f0beb3e329e1fea389f7676e0
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.gitignore
@@ -0,0 +1,16 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+/entry/.preview
+.cxx
+/node_modules
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/.gitignore b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..eaf91e2ac647df635a09f01b8a2a254252aae8d7
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/compiler.xml b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/compiler.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7d7ec2eaff970ea468433aae59edca2f9f6ae6a5
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/gradle.xml b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/gradle.xml
new file mode 100644
index 0000000000000000000000000000000000000000..bd281968de3d79b380603a0382778d7a702526ca
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/gradle.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/jarRepositories.xml b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/jarRepositories.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d76bbd8a2d2027c2dface071abe1f6b139d806d2
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/jarRepositories.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/misc.xml b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/misc.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9883d055f8725da2d0f5c1cecc525b815e5dfcec
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/BUILD.gn b/aafwk/aafwk_standard/amsZipfileUnzipfileST/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..a35ad5e14abc8bf0f83663397e59f655d783d081
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("ActsZlibTest") {
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsZlibTest"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ source_dir = "./entry/src/main/js/default"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./entry/src/main/js/resources" ]
+ hap_profile = "./entry/src/main/config.json"
+}
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/Test.json b/aafwk/aafwk_standard/amsZipfileUnzipfileST/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..b9026fac7b75b1510f1ee291a7e20687a16fc035
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "60000",
+ "package": "com.example.amsZipfileUnzipfileST",
+ "shell-timeout": "60000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsZlibTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/.gitignore b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..f77260b1509284d42a7f8a2449ad1e8f4b489a3a
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/.gitignore
@@ -0,0 +1,2 @@
+/build
+/node_modules
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/config.json b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..c296a6f20efd97a2ade730897fe966143d74642c
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/config.json
@@ -0,0 +1,92 @@
+{
+ "app": {
+ "bundleName": "com.example.amsZipfileUnzipfileST",
+ "vendor": "example",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.amsZipfileUnzipfileST",
+ "name": ".MyApplication",
+ "mainAbility": "com.example.amsZipfileUnzipfileST.MainAbility",
+ "deviceType": [
+ "phone",
+ "tablet",
+ "tv",
+ "wearable"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "visible": true,
+ "name": "com.example.amsZipfileUnzipfileST.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:entry_MainAbility",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": true
+ }
+ }
+ ],
+ "reqPermissions": [
+
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name":"ohos.permission.INSTALL_BUNDLE",
+ "reason":"need use ohos.permission.INSTALL_BUNDLE"
+ },
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":" ohos.permission.MANAGE_MISSIONS",
+ "reason":"need use ohos.permission.MANAGE_MISSIONS"
+ },
+ {
+ "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
+ "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
+ },
+ {
+ "name":"ohos.permission.REMOVE_CACHE_FILES",
+ "reason":"need use ohos.permission.REMOVE_CACHE_FILES"
+ },
+ {
+ "name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
+ "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..c158442201abb1888ae8fb1d57f150c5ec26c36b
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/app.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..5bd7567028568bd522193b2519d545ca6dcf397d
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,46 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ width: 100%;
+ height: 100%;
+}
+
+.title {
+ font-size: 40px;
+ color: #000000;
+ opacity: 0.9;
+}
+
+@media screen and (device-type: tablet) and (orientation: landscape) {
+ .title {
+ font-size: 100px;
+ }
+}
+
+@media screen and (device-type: wearable) {
+ .title {
+ font-size: 28px;
+ color: #FFFFFF;
+ }
+}
+
+@media screen and (device-type: tv) {
+ .container {
+ background-image: url("/common/images/Wallpaper.png");
+ background-size: cover;
+ background-repeat: no-repeat;
+ background-position: center;
+ }
+
+ .title {
+ font-size: 100px;
+ color: #FFFFFF;
+ }
+}
+
+@media screen and (device-type: phone) and (orientation: landscape) {
+ .title {
+ font-size: 60px;
+ }
+}
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ad355555d698b0cbc4d08d916abcaf0728f46056
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import file from '@system.file'
+import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
+
+const injecttRef = Object.getPrototypeOf(global) || global
+injecttRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default{
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ core.addService('expect', expectExtend)
+ core.init()
+
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../../test/List.test.js')
+ core.execute()
+ },
+ onReady() {
+ },
+}
+
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..c0dd3a09e5dcefc69f22b5e00e92296f1c3f55a5
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "entry_MainAbility"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Empty Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/test/ContextJsunit.test.js b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/test/ContextJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..6969d5ad92450f369b2e96625a503b35d0b9723e
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/test/ContextJsunit.test.js
@@ -0,0 +1,2720 @@
+/*
+* Copyright (C) 2021 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+import 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'
+
+describe('ActsZlibTest', function () {
+
+/*
+* @tc.number: ACTS_ZipFile_0100
+* @tc.name: zipFile
+* @tc.desc: inFile is empty
+*/
+it('ACTS_ZipFile_0100', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3400 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = "";
+ var zipDest = dir + "/ACTS_ZipFile_0100.zip"
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(path, dir, options,
+ (err, data) => {
+ console.log("ACTS_ZipFile_0100 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+})
+
+/*
+* @tc.number: ACTS_ZipFile_0200
+* @tc.name: zipFile
+* @tc.desc: inFile doesn't exist
+*/
+it('ACTS_ZipFile_0200', 0, async function (done) {
+ console.log("==================FWK_ZipFile_0600 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let src = dir + "/ACTS_ZipFile_100000.txt";
+ let path = dir + "/ACTS_ZipFile_9900.txt";
+ var zipDest = dir + "/ACTS_ZipFile_6600.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_0200";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_0200.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_0200 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_0200 write data to file failed with error:" + err);
+ });
+
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(src, dir, options,
+ (err, data) => {
+ console.log("ACTS_ZipFile_0200 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+})
+
+/*
+* @tc.number: ACTS_ZipFile_0300
+* @tc.name: zipFile
+* @tc.desc: output file not specified
+*/
+it('ACTS_ZipFile_0300', 0, async function (done) {
+ console.log("==================FWK_ZipFile_0600 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_0300.txt";
+ var zipDest = ""
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_0300";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_0300.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_0300 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_0300 write data to file failed with error:" + err);
+ });
+
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ console.log("ACTS_ZipFile_0300 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+})
+
+/*
+* @tc.number: ACTS_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("==================FWK_ZipFile_0600 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_0400.txt";
+ var zipDest = "/ACTS_ZipFile_0400.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_0400";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_0400.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_0400 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_0400 write data to file failed with error:" + err);
+ });
+
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ console.log("ACTS_ZipFile_0400 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+
+})
+
+/*
+* @tc.number: ACTS_ZipFile_0500
+* @tc.name: zipFile
+* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
+*/
+it('ACTS_ZipFile_0500', 0, async function (done) {
+ console.log("==================FWK_ZipFile_0600 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_0500.txt";a
+ var zipDest = dir + "/ACTS_ZipFile_0500.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_0500";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_0500.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_0500 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_0500 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_0500 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_0500 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_0500 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_0500 err: " + err);
+ done();
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_0500 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_0500 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_0600
+* @tc.name: zipFile
+* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
+*/
+it('ACTS_ZipFile_0600', 0, async function (done) {
+ console.log("==================FWK_ZipFile_0600 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_0600.txt";
+ var zipDest = dir + "/ACTS_ZipFile_0600.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_0600";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_0600.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_0600 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_0600 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_0600 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_0600 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_0600 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_0600 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_0600 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_0600 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_0700
+* @tc.name: zipFile
+* @tc.desc: FlushType.FLUSH_TYPE_SYNC_FLUSH
+*/
+it('ACTS_ZipFile_0700', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_0700 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_0700.txt";
+ var zipDest = dir + "/ACTS_ZipFile_0700.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_0700";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_0700.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_0700 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_0700 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_SYNC_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_0700 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_0700 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_0700 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_0700 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_0700 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_0700 end==================");
+})
+
+/*
+* @tc.number: ACTS_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==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_0800.txt";
+ var zipDest = dir + "/ACTS_ZipFile_0800.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_0800";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_0800.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_0800 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_0800 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_FULL_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_0800 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_0800 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_0800 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_0800 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_0800 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_0800 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_0900
+* @tc.name: zipFile
+* @tc.desc: FlushType.FLUSH_TYPE_FINISH
+*/
+it('ACTS_ZipFile_0900', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_0900 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_0900.txt";
+ var zipDest = dir + "/ACTS_ZipFile_0900.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_0900";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_0900.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_0900 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_0900 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_FINISH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_0900 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_0900 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_0900 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_0900 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_0900 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_0900 end==================");
+})
+
+/*
+* @tc.number: ACTS_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==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_1000.txt";
+ var zipDest = dir + "/ACTS_ZipFile_1000.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_1000";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_1000.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_1000 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_1000 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_BLOCK;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_1000 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_1000 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_1000 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_1000 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_1000 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_1000 end==================");
+})
+
+/*
+* @tc.number: ACTS_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==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_1100.txt";
+ var zipDest = dir + "/ACTS_ZipFile_1100.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_1100";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_1100.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_1100 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_1100 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_TREES;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_1100 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_1100 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_1100 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_1100 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_1100 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_1100 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_1200
+* @tc.name: zipFile
+* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
+*/
+it('ACTS_ZipFile_1200', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_1200 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_1200.txt";
+ var zipDest = dir + "/ACTS_ZipFile_1200.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_1200";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_1200.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_1200 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_1200 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_1200 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_1200 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_1200 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_1200 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_1200 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_1200 end==================");
+})
+
+/*
+* @tc.number: ACTS_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==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_1300.txt";
+ var zipDest = dir + "/ACTS_ZipFile_1300.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_1300";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_1300.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_1300 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_1300 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_1300 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_1300 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_1300 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_1300 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_1300 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_1300 end==================");
+})
+
+/*
+* @tc.number: ACTS_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==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_1400.txt";
+ var zipDest = dir + "/ACTS_ZipFile_1400.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_1400";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_1400.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_1400 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_1400 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_SYNC_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_1400 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_1400 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_1400 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_1400 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_1400 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_1400 end==================");
+})
+
+/*
+* @tc.number: ACTS_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==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_1500.txt";
+ var zipDest = dir + "/ACTS_ZipFile_1500.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_1500";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_1500.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_1500 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_1500 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_FULL_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_1500 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_1500 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_1500 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_1500 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_1500 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_1500 end==================");
+})
+
+/*
+* @tc.number: ACTS_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==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_1600.txt";
+ var zipDest = dir + "/ACTS_ZipFile_1600.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_1600";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_1600.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_1600 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_1600 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_FINISH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_1600 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_1600 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_1600 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_1600 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_1600 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_1600 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_1700
+* @tc.name: zipFile
+* @tc.desc: FlushType.FLUSH_TYPE_BLOCK
+*/
+it('ACTS_ZipFile_1700', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_1700 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_1700.txt";
+ var zipDest = dir + "/ACTS_ZipFile_1700.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_1700";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_1700.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_1700 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_1700 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_BLOCK;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_1700 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_1700 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_1700 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_1700 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_1700 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_1700 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_1800
+* @tc.name: zipFile
+* @tc.desc: FlushType.FLUSH_TYPE_TREES
+*/
+it('ACTS_ZipFile_1800', 0, async function (done) {
+ console.log("==================FWK_ZipFile_0600 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_1800.txt";
+ var zipDest = dir + "/ACTS_ZipFile_1800.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_1800";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_1800.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_1800 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_1800 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_TREES;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_1800 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_1800 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_1800 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_1800 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_1800 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_1800 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_1900
+* @tc.name: zipFile
+* @tc.desc: chunkSize: 64,
+*/
+it('ACTS_ZipFile_1900', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_1900 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_1900.txt";
+ var zipDest = dir + "/ACTS_ZipFile_1900.zip";
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_1900";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_1900.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_1900 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_1900 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {
+ chunkSize: 64,
+ };
+
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_1900 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_1900 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_1900 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_1900 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_1900 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_1900 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_2000
+* @tc.name: zipFile
+* @tc.desc: chunkSize: 1024,
+*/
+it('ACTS_ZipFile_2000', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_2000 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_2000.txt";
+ var zipDest = dir + "/ACTS_ZipFile_2000.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_2000";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_2000.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_2000 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_2000 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {
+ chunkSize: 1024,
+ };
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_2000 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_2000 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_2000 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_2000 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_2000 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_2000 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_2100
+* @tc.name: zipFile
+* @tc.desc: chunkSize: 999,
+*/
+it('ACTS_ZipFile_2100', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_2100 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_2100.txt";
+ var zipDest = dir + "/ACTS_ZipFile_2100.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_2100";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_2100.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_2100 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_2100 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {
+ chunkSize: 999,
+ };
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_2100 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_2100 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_2100 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_2100 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_2100 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_2100 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_2200
+* @tc.name: zipFile
+* @tc.desc: COMPRESS_LEVEL_NO_COMPRESSION,
+*/
+it('ACTS_ZipFile_2200', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_2200 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_2200.txt";
+ var zipDest = dir + "/ACTS_ZipFile_2200.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_2200";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_2200.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_2200 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_2200 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.level = zlib.CompressLevel.COMPRESS_LEVEL_NO_COMPRESSION;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_2200 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_2200 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_2200 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_2200 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_2200 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_2200 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_2300
+* @tc.name: zipFile
+* @tc.desc: COMPRESS_LEVEL_BEST_SPEED,
+*/
+it('ACTS_ZipFile_2300', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_2300 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_2300.txt";
+ var zipDest = dir + "/ACTS_ZipFile_2300.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_2300";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_2300.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_2300 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_2300 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_SPEED;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_2300 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_2300 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_2300 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_2300 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_2300 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_2300 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_2400
+* @tc.name: zipFile
+* @tc.desc: COMPRESS_LEVEL_BEST_COMPRESSION,
+*/
+it('ACTS_ZipFile_2400', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_2400 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_2400.txt";
+ var zipDest = dir + "/ACTS_ZipFile_2400.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_2400";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_2400.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_2400 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_2400 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_COMPRESSION;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_2400 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_2400 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_2400 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_2400 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_2400 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_2400 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_2500
+* @tc.name: zipFile
+* @tc.desc: COMPRESS_LEVEL_DEFAULT_COMPRESSION,
+*/
+it('ACTS_ZipFile_2500', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_2500 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_2500.txt";
+ var zipDest = dir + "/ACTS_ZipFile_2500.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_2500";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_2500.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_2500 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_2500 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.level = zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_2500 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_2500 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_2500 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_2500 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_2500 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_2500 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_2600
+* @tc.name: zipFile
+* @tc.desc: MEM_LEVEL_MIN_MEMLEVEL,,
+*/
+it('ACTS_ZipFile_2600', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_2600 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_2600.txt";
+ var zipDest = dir + "/ACTS_ZipFile_2600.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_2600";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_2600.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_2600 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_2600 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.memLevel = zlib.MemLevel.MEM_LEVEL_MIN_MEMLEVEL;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_2600 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_2600 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_2600 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_2600 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_2600 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_2600 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_2700
+* @tc.name: zipFile
+* @tc.desc: MEM_LEVEL_MAX_MEMLEVEL,,
+*/
+it('ACTS_ZipFile_2700', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_2700 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_2700.txt";
+ var zipDest = dir + "/ACTS_ZipFile_2700.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_2700";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_2700.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_2700 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_2700 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.memLevel = zlib.MemLevel.MEM_LEVEL_MAX_MEMLEVEL;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_2700 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_2700 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_2700 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_2700 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_2700 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_2700 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_2800
+* @tc.name: zipFile
+* @tc.desc: MEM_LEVEL_DEFAULT_MEMLEVEL,,
+*/
+it('ACTS_ZipFile_2800', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_2800 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_2800.txt";
+ var zipDest = dir + "/ACTS_ZipFile_2800.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_2800";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_2800.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_2800 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_2800 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.memLevel = zlib.MemLevel.MEM_LEVEL_DEFAULT_MEMLEVEL;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_2800 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_2800 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_2800 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_2800 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_2800 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_2800 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_2900
+* @tc.name: zipFile
+* @tc.desc: COMPRESS_STRATEGY_DEFAULT_STRATEGY,,
+*/
+it('ACTS_ZipFile_2900', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_2900 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_2900.txt";
+ var zipDest = dir + "/ACTS_ZipFile_2900.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_2900";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_2900.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_2900 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_2900 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_2900 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_2900 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_2900 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_2900 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_2900 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_2900 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_3000
+* @tc.name: zipFile
+* @tc.desc: COMPRESS_STRATEGY_FILTERED,,
+*/
+it('ACTS_ZipFile_3000', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3000 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_3000.txt";
+ var zipDest = dir + "/ACTS_ZipFile_3000.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_3000";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_3000.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_3000 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_3000 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_3000 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_3000 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_3000 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_3000 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_3000 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_3000 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_3100
+* @tc.name: zipFile
+* @tc.desc: COMPRESS_STRATEGY_HUFFMAN_ONLY,,
+*/
+it('ACTS_ZipFile_3100', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3100 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_3100.txt";
+ var zipDest = dir + "/ACTS_ZipFile_3100.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_3100";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_3100.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_3100 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_3100 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_HUFFMAN_ONLY;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_3100 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_3100 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_3100 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_3100 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_3100 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_3100 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_3200
+* @tc.name: zipFile
+* @tc.desc: COMPRESS_STRATEGY_RLE,,
+*/
+it('ACTS_ZipFile_3200', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3200 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_3200.txt";
+ var zipDest = dir + "/ACTS_ZipFile_3200.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_3200";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_3200.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_3200 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_3200 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_RLE;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_3200 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_3200 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_3200 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_3200 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_3200 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_3200 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_3300
+* @tc.name: zipFile
+* @tc.desc: COMPRESS_STRATEGY_FILTERED,,
+*/
+it('ACTS_ZipFile_3300', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3300 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_3300.txt";
+ var zipDest = dir + "/ACTS_ZipFile_3300.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_3300";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_3300.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_3300 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_3300 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_3300 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_3300 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_3300 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_3300 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_3300 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_3300 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_3400
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_3400', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3400 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = "";
+ var zipDest = dir + "/ACTS_ZipFile_3400.zip"
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ zlib.zipFile(path, dir, options).then((data) => {
+ console.log("ACTS_ZipFile_3400 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_3400 err: " + err);
+ done();
+ });
+ console.log("==================ACTS_ZipFile_3400 end ==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_3500
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_3500', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3500 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_3500.txt";
+ let src = dir + "/ACTS_ZipFile_5500.txt";
+ var zipDest = dir + "/ACTS_ZipFile_3500.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_3500";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_3500.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_3500 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_3500 write data to file failed with error:" + err);
+ });
+
+ var options = {};
+ zlib.zipFile(src, dir, options).then((data) => {
+ console.log("zipFilePromise_3500 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ }).catch((err) => {
+ console.log("zipFilePromise_3500 err: " + err);
+ done();
+ });
+ console.log("==================zipFilePromise_3500 end ==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_3600
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_3600', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3600 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_3600.txt";
+ var zipDest = "";
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_3600";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_3600.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_3600 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_3600 write data to file failed with error:" + err);
+ });
+ var options = {};
+ zlib.zipFile(path, zipDest, options).then((data) => {
+ console.log("zipFilePromise_3600 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ }).catch((err) => {
+ console.log("zipFilePromise_3600 err: " + err);
+ done();
+ });
+ console.log("==================zipFilePromise_3600 end ==================")
+
+})
+
+/*
+* @tc.number: ACTS_ZipFile_3700
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_3700', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3700 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_3700.txt";
+ var zipDest = dir + "/ACTS_ZipFile_3700.zip";
+ var src = dir + "/ACTS_ZipFile_6600.zip";
+ let infos = path + dir;
+ let unzipresultfilefirst = "/data/accounts/account_0/appdata";
+ let unzipresultfilersecond = unzipresultfilefirst + "/com.example.amsZipfileUnzipfileST";
+ let unzipresultfilerThrid = unzipresultfilersecond+"/com.example.amsZipfileUnzipfileST";
+ let unzipresult=unzipresultfilerThrid+"/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_9200";
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_3700";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_3700 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_3700 write data to file failed with error:" + err);
+ });
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ zlib.zipFile(src, unzipresultfile, options).then((data) => {
+ console.log("zipFilePromise_3700 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ }).catch((err) => {
+ console.log("zipFilePromise_3700 err: " + err);
+ done();
+ });
+ console.log("==================zipFilePromise_3700 end ==================");
+
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_3700 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_3700 mkdir failed with error:" + error);
+ });
+
+})
+
+/*
+* @tc.number: ACTS_ZipFile_3800
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_3800', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3800 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_3800.txt";
+ var zipDest = dir + "/ACTS_ZipFile_3800.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_3800";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_3800.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_3800 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_3800 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_3800 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_3800 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_3800 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_3800 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_3800 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_3800 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_3900
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_3900', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_3900 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_3900.txt";
+ var zipDest = dir + "/ACTS_ZipFile_3900.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_3900";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_3900.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_3900 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_3900 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_3900 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_3900 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_3900 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_3900 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_3900 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_3900 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_4000
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_4000', 0, async function (done) {
+ console.log("==================FWK_ZipFile_0600 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_4000.txt";
+ var zipDest = dir + "/ACTS_ZipFile_4000.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_4000";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_4000.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_4000 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_4000 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_4000 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_4000 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_4000 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_4000 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_0500 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_4000 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_4100
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_4100', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_4100 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_4100.txt";
+ var zipDest = dir + "/ACTS_ZipFile_4100.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_4100";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_4100.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_4100 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_4100 write data to file failed with error:" + err);
+ });
+ try {
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_4100 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_4100 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
+ var unzipStat = fileio.statSync(unzipresultfile);
+ var isFile = unzipStat.isFile();
+ expect(isFile).assertTrue();
+ var destSize = unzipStat.size;
+ var originSize = fileio.statSync(path).size;
+ var result = (originSize == destSize);
+ expect(result).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ console.error('ACTS_ZipFile_4100 unzipFile');
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_4100 err: " + err);
+ done();
+
+ })
+ done();
+ });
+ } catch (err) {
+ console.error('ACTS_ZipFile_4100 err:' + err);
+ done();
+ }
+ console.log("==================ACTS_ZipFile_4100 end==================");
+})
+
+/*
+* @tc.number: ACTS_ZipFile_4200
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_4200', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_4200 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let src = dir + "/ACTS_ZipFile_100000.txt";
+ let path = dir + "/ACTS_ZipFile_9900.txt";
+ var zipDest = dir + "/ACTS_ZipFile_4200.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_4200";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_4200.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_0200 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_0200 write data to file failed with error:" + err);
+ });
+
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.zipFile(src, dir, options,
+ (err, data) => {
+ console.log("ACTS_ZipFile_4200 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+
+})
+
+/*
+* @tc.number: ACTS_ZipFile_4300
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_4300', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_4300 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ var zipDest = dir + "/ACTS_ZipFile_4300.zip"
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.unzipFile(dir, zipDest, options,
+ (err, data) => {
+ console.log("ACTS_ZipFile_4300 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+})
+
+/*
+* @tc.number: ACTS_ZipFile_4400
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_4400', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_4400 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_4400.txt";
+ var zipDest = dir + "/ACTS_ZipFile_4400.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_4400";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_4400.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_4400 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_4400 write data to file failed with error:" + err);
+ });
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH;
+ zlib.unzipFile(path, zipDest, options,
+ (err, data) => {
+ console.log("FWK_ZipFile_4400 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+})
+
+/*
+* @tc.number: ACTS_ZipFile_4500
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_4500', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_5000 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_4500.txt";
+ var zipDest = dir + "/ACTS_ZipFile_4500.zip"
+ var unzipDest = dir + "/ACTS_ZipFile_9900.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_4500";
+ let zipdirfirst = "/data/accounts/account_0/appdata";
+ let zipdirsecond = zipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let zipdir =zipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_9900";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_4500.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_4500 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_4500 write data to file failed with error:" + err);
+ });
+ var options = {};
+ options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_4500 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_4500 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(unzipDest, zipdir, options).then((data) => {
+ console.log("ACTS_ZipFile_4500 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ }).catch((err) => {
+ console.log("ACTS_ZipFile_4500 err: " + err);
+ done();
+ })
+ done();
+ })
+})
+
+/*
+* @tc.number: ACTS_ZipFile_4600
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_4600', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_4600 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = "";
+ var zipDest = dir + "/ACTS_ZipFile_4600.txt";
+ let infos = path + dir;
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.unzipFile(path, dir, options,
+ (err, data) => {
+ console.log("ACTS_ZipFile_4600 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+
+})
+
+/*
+* @tc.number: ACTS_ZipFile_4700
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_4700', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_4700 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ var zipDest = dir + "/ACTS_ZipFile_4700.zip"
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
+ await zlib.unzipFile(dir, zipDest, options,
+ (err, data) => {
+ console.log("ACTS_ZipFile_4700 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+})
+
+/*
+* @tc.number: ACTS_ZipFile_4800
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_4800', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_4800 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_4800.txt";
+ var zipDest = dir + "/ACTS_ZipFile_4800.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_4800";
+ let unzipresultfile = unzipdir + "/ACTS_ZipFile_4800.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_4800 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_4800 write data to file failed with error:" + err);
+ });
+ var options = {};
+ options.flush = zlib.FlushType.FLUSH_TYPE_PARTIAL_FLUSH;
+ zlib.unzipFile(path, zipDest, options,
+ (err, data) => {
+ console.log("ACTS_ZipFile_4800 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+})
+
+/*
+* @tc.number: ACTS_ZipFile_4900
+* @tc.name: zipFile
+* @tc.desc: FLUSH_TYPE_NO_FLUSH,,
+*/
+it('ACTS_ZipFile_4900', 0, async function (done) {
+ console.log("==================ACTS_ZipFile_4900 start==================");
+ let dirfirst = "/data/accounts/account_0/appdata"
+ let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
+ let path = dir + "/ACTS_ZipFile_4900.txt";
+ var zipDest = dir + "/ACTS_ZipFile_4900.zip"
+ var unzipDest = dir + "/ACTS_ZipFile_4900.zip"
+ let infos = path + dir;
+ let unzipdirfirst = "/data/accounts/account_0/appdata";
+ let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let unzipdir =unzipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_4900";
+ let zipdirfirst = "/data/accounts/account_0/appdata";
+ let zipdirsecond = zipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
+ let zipdir =zipdirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files/ACTS_ZipFile_9800";
+ let unzipresultfile = zipdir + "/ACTS_ZipFile_4900.txt";
+ let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
+ fileio.write(fd, infos).then(function (number) {
+ console.info("ACTS_ZipFile_4900 write data to file successfully:" + number);
+ }).catch(function (err) {
+ console.info("ACTS_ZipFile_4900 write data to file failed with error:" + err);
+ });
+ var options = {};
+ options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED;
+ await zlib.zipFile(path, zipDest, options,
+ (err, data) => {
+ var zipStat = fileio.statSync(zipDest);
+ var isFile = zipStat.isFile();
+ expect(isFile).assertTrue();
+ var srcSize = fileio.statSync(path).size;
+ var destSize = zipStat.size;
+ expect(srcSize > destSize).assertTrue();
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
+ fileio.mkdir(unzipdir).then(function () {
+ console.info("ACTS_ZipFile_4900 mkdir successfully");
+ }).catch(function (error) {
+ console.info("ACTS_ZipFile_4900 mkdir failed with error:" + error);
+ });
+ zlib.unzipFile(unzipDest, zipdir, options,
+ (err, data) => {
+ console.log("ACTS_ZipFile_4900 data: " + data);
+ expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
+ done();
+ });
+
+ })
+
+ })
+})
+
+
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..b5d5265591aba656f6112e40a64a7cf0f8af254d
--- /dev/null
+++ b/aafwk/aafwk_standard/amsZipfileUnzipfileST/entry/src/main/js/test/List.test.js
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+require('./ContextJsunit.test.js')
diff --git a/aafwk/aafwk_standard/amsZipfileUnzipfileST/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsZipfileUnzipfileST/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/aafwk/aafwk_standard/amsZipfileUnzipfileST/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/amszipfileunzipfilest/Test.json b/aafwk/aafwk_standard/amszipfileunzipfilest/Test.json
deleted file mode 100644
index db8a1571925c645f1a50b1c581024b34032e5aca..0000000000000000000000000000000000000000
--- a/aafwk/aafwk_standard/amszipfileunzipfilest/Test.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "description": "Configuration for hjunit demo Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "120000",
- "package": "com.example.amsZipfileUnzipfileST",
- "shell-timeout": "600000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsAmsZipfileUnzipfileSTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- },
- {
- "type": "ShellKit",
- "run-command": [
- "remount",
- "mkdir /data/test"
- ]
- },
- {
- "type": "PushKit",
- "push": [
- "./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": [
- "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/aafwk/aafwk_standard/amszipfileunzipfilest/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amszipfileunzipfilest/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000
--- a/aafwk/aafwk_standard/amszipfileunzipfilest/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
diff --git a/aafwk/aafwk_standard/amszipfileunzipfilest/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amszipfileunzipfilest/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index cf5cea3dc13c1e9161974cad3c964ec07adf3f3a..0000000000000000000000000000000000000000
--- a/aafwk/aafwk_standard/amszipfileunzipfilest/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "amsZipfileUnzipfileST"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- },
- {
- "name": "serviceability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amszipfileunzipfilest/entry/src/main/js/test/ContextJsunit.test.js b/aafwk/aafwk_standard/amszipfileunzipfilest/entry/src/main/js/test/ContextJsunit.test.js
deleted file mode 100644
index 4ac3fe3d6eae12ca6b855ea6960af18886e2963c..0000000000000000000000000000000000000000
--- a/aafwk/aafwk_standard/amszipfileunzipfilest/entry/src/main/js/test/ContextJsunit.test.js
+++ /dev/null
@@ -1,1940 +0,0 @@
-/*
-* Copyright (C) 2021 Huawei Device Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-import 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'
-
-describe('ZlibTest', function () {
-
-/*
-* @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) => {
-
- console.log("zipFileCallback_0100 data: " + data);
- expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR);
- done();
- });
-})
-
-/*
-* @tc.number: FWK_ZipFile_0200
-* @tc.name: zipFile
-* @tc.desc: inFile doesn't exist
-*/
-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: FWK_ZipFile_0300
-* @tc.name: zipFile
-* @tc.desc: output file not specified
-*/
-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: FWK_ZipFile_0400
-* @tc.name: zipFile
-* @tc.desc: The ouput file is a directory that does not exist
-*/
-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: FWK_ZipFile_0500
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
-*/
-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: FWK_ZipFile_0600
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
-*/
-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 = {};
- 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_0600 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_0700
-* @tc.name: zipFile
-* @tc.desc: zipFile
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_0700 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_0800
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_FULL_FLUSH
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_0800 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_0900
-* @tc.name: zipFile
-* @tc.desc: zipFile
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_0900 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_1000
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_BLOCK
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_1000 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_1100
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_TREES
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_1100 end==================");
- sleep(10);
-})
-
-/*
-* @tc.number: FWK_ZipFile_1200
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
-*/
- 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 = {};
- 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_1200 end==================");
- sleep(10);
-})
-
-/*
-* @tc.number: FWK_ZipFile_1300
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_PARTIAL_FLUSH
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_1300 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_1400
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_SYNC_FLUSH
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_1400 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_1500
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_FULL_FLUSH
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_1500 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_1600
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_FINISH
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_1600 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_1700
-* @tc.name: zipFile
-* @tc.desc: zipFile
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_1700 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_1800
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_TREES
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_1800 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_1900
-* @tc.name: zipFile
-* @tc.desc: chunkSize:64
-*/
-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 = {
- chunkSize:64,
- };
- 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_1900 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_2000
-* @tc.name: zipFile
-* @tc.desc: chunkSize:1024
-*/
-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 = {
- chunkSize:1024,
- };
- 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_2000 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_2100
-* @tc.name: zipFile
-* @tc.desc: chunkSize:999
-*/
-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 = {
- chunkSize:999,
- };
- 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_2100 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_2200
-* @tc.name: zipFile
-* @tc.desc: level.COMPRESS_LEVEL_NO_COMPRESSION
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_2200 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_2300
-* @tc.name: zipFile
-* @tc.desc: level.COMPRESS_LEVEL_BEST_SPEED
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_2300 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_2400
-* @tc.name: zipFile
-* @tc.desc: level.COMPRESS_LEVEL_BEST_COMPRESSION
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_2400 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_2500
-* @tc.name: zipFile
-* @tc.desc: level.COMPRESS_LEVEL_DEFAULT_COMPRESSION
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_2500 end==================");
-})
-
-/*
-* @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";
-
- try{
- 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();
- }
- console.log("==================FWK_ZipFile_2600 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_2700
-* @tc.name: zipFile
-* @tc.desc: memlevel.MEM_LEVEL_MAX_MEMLEVEL
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_2700 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_2800
-* @tc.name: zipFile
-* @tc.desc: memlevel.MEM_LEVEL_DEFAULT_MEMLEVEL
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_2800 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_2900
-* @tc.name: zipFile
-* @tc.desc: strategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_2900 end==================");
-})
-
-/*
-* @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";
-
- try{
- 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();
- }
- console.log("==================FWK_ZipFile_3000 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_3100
-* @tc.name: zipFile
-* @tc.desc: strategy.COMPRESS_STRATEGY_HUFFMAN_ONLY
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_3100 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_3200
-* @tc.name: zipFile
-* @tc.desc: strategy.COMPRESS_STRATEGY_RLE
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_3200 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_3300
-* @tc.name: zipFile
-* @tc.desc: strategy.COMPRESS_STRATEGY_HUFFMAN_ONLY
-*/
-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 = {};
- 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();
- }
- console.log("==================FWK_ZipFile_3300 end==================");
-})
-
-/*
-* @tc.number: FWK_zipFile_3400
-* @tc.name: zipFile
-* @tc.desc: inFile doesn't exist
-*/
-it('FWK_zipFile_3400', 0, async function (done) {
- console.log("==================FWK_zipFile_3400 start==================");
- var src = "/data/noExist.txt";
- var dest = "/data/test/";
- var options = {}
-
- zlib.zipFile(src, dest, options).then((data) => {
- console.log("zipFilePromise_3400 data: " + data);
- expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_STREAM_ERROR);
- done();
- }).catch((err)=>{
- console.log("zipFilePromise_3400 err: " + err);
- done();
- });
- console.log("==================zipFilePromise_3400 end ==================");
-
-})
-
-/*
-* @tc.number: 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 = {}
-
-
- 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 ==================");
-
-})
-
-/*
-* @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 ==================")
-
-})
-
-/*
-* @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 ==================");
-
-})
-
-
-
-
-/*
-* @tc.number: FWK_ZipFile_3800
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
-*/
-it('FWK_ZipFile_3800', 0, async function (done) {
- console.log("==================FWK_ZipFile_3800 start==================");
- var src = "/data/test/ceshi.txt";
- var zipDest = "/data/testb/ceshi.zip";
- var unzipDir = "/data/testb/";
- var unzipDest = "/data/testb/ceshi.txt";
-
- 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('FWK_ZipFile_3800 err:' + err);
- done();
- }
- console.log("==================FWK_ZipFile_3800 end==================");
-})
-
-/*
-* @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==================");
-})
-
-/*
-* @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 = {};
- 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('FWK_ZipFile_4000 err:' + err);
- done();
- }
- console.log("==================FWK_ZipFile_4000 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_4100
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
-*/
-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 = {};
- 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('FWK_ZipFile_4100 err:' + err);
- done();
- }
- console.log("==================FWK_ZipFile_4100 end==================");
-})
-
-/*
-* @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();
- });
-})
-
-/*
-* @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();
- });
-})
-
-/*
-* @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();
- });
-})
-
-/*
-* @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: FWK_ZipFile_4600
-* @tc.name: zipFile
-* @tc.desc: FlushType.FLUSH_TYPE_NO_FLUSH
-*/
-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 = {};
- 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('FWK_ZipFilFWK_ZipFile_4600e_4200 err:' + err);
- done();
- }
- console.log("==================FWK_ZipFile_4600 end==================");
-})
-
-/*
-* @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 ==================");
-})
-
-/*
-* @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 ==================");
-})
-
-/*
-* @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: 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();
- });
-})
-
-/*
-* @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 = {};
- 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('FWK_ZipFile_5100 err:' + err);
- expect(fail).assertTrue();
- done();
- }
- console.log("==================FWK_ZipFile_5100 end==================");
-})
-
-/*
-* @tc.number: FWK_ZipFile_5200
-* @tc.name: zipFile
-* @tc.desc: strategy.COMPRESS_STRATEGY_FIXED
-*/
-it('FWK_ZipFile_5200', 0, async function (done) {
- console.log("==================FWK_ZipFile_5200 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.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FIXED,
- 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_5200 err:' + err);
- done();
- }
- console.log("==================FWK_ZipFile_5200 end==================");
-})
-
-})