提交 09bfada3 编写于 作者: R renyi

Modify zip infos

Signed-off-by: Nrenyi <ry.renyi@huawei.com>
上级 eeb6e0cb
...@@ -15,10 +15,24 @@ ...@@ -15,10 +15,24 @@
*/ */
import zlib from '@ohos.zlib' import zlib from '@ohos.zlib'
import fileio from '@ohos.fileio' import fileio from '@ohos.fileio'
import file from '@system.file' import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var dir = "";
var infos = "";
describe('ActsZlibTest', function () { describe('ActsZlibTest', function () {
beforeEach(async (done) => {
var context = featureAbility.getContext();
context.getCacheDir((err, data) => {
console.info('ActsZlibTest successful. Data:' + JSON.stringify(data));
dir = data;
var objectone = "com.example.amsZipfileUnzipfileST.MainAbility/com.example.amsZipfileUnzipfileST/";
var objecttwo = "com.example.amsZipfileUnzipfileST.MainAbility/com.example.amsZipfileUnzipfileST/zipunzip";
var objectthree="com.example.amsZipfileUnzipfileST.MainAbility/ActsZlibTest/com.example.amsZipfileUnzipfileST/zipunzip";
infos =dir + objectone + objecttwo + objectthree;
done();
})
});
/* /*
* @tc.number: ACTS_ZipFile_0100 * @tc.number: ACTS_ZipFile_0100
...@@ -26,21 +40,21 @@ describe('ActsZlibTest', function () { ...@@ -26,21 +40,21 @@ describe('ActsZlibTest', function () {
* @tc.desc: inFile is empty * @tc.desc: inFile is empty
*/ */
it('ACTS_ZipFile_0100', 0, async function (done) { it('ACTS_ZipFile_0100', 0, async function (done) {
console.log("==================ACTS_ZipFile_3400 start=================="); console.log("==================ACTS_ZipFile_0100 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path ="";
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 zipDest = dir + "/ACTS_ZipFile_0100.zip"
var options = {}; var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH; options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
await zlib.zipFile(path, dir, options, zlib.zipFile(path, zipDest, options).then((data) => {
(err, data) => {
console.log("ACTS_ZipFile_0100 data: " + data); console.log("ACTS_ZipFile_0100 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
done(); done();
}); }).catch((err) => {
}) console.log("zipFile fail: " + err);
expect(err).assertFail();
done();
})
})
/* /*
* @tc.number: ACTS_ZipFile_0200 * @tc.number: ACTS_ZipFile_0200
...@@ -48,34 +62,28 @@ it('ACTS_ZipFile_0100', 0, async function (done) { ...@@ -48,34 +62,28 @@ it('ACTS_ZipFile_0100', 0, async function (done) {
* @tc.desc: inFile doesn't exist * @tc.desc: inFile doesn't exist
*/ */
it('ACTS_ZipFile_0200', 0, async function (done) { it('ACTS_ZipFile_0200', 0, async function (done) {
console.log("==================FWK_ZipFile_0600 start=================="); console.log("==================ACTS_ZipFile_0200 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_9999900.txt";
let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST" var src = dir + "/ACTS_ZipFile_999991100.txt";
let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files"; var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
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) { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_0200 write data to file successfully:" + 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 = {}; var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH; options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
await zlib.zipFile(src, dir, options, zlib.zipFile(src, dir, options).then((data) => {
(err, data) => {
console.log("ACTS_ZipFile_0200 data: " + data); console.log("ACTS_ZipFile_0200 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
done(); done();
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
done();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_0200 write data to file failed with error:" + err);
done();
}); });
}) })
/* /*
* @tc.number: ACTS_ZipFile_0300 * @tc.number: ACTS_ZipFile_0300
...@@ -83,33 +91,28 @@ it('ACTS_ZipFile_0200', 0, async function (done) { ...@@ -83,33 +91,28 @@ it('ACTS_ZipFile_0200', 0, async function (done) {
* @tc.desc: output file not specified * @tc.desc: output file not specified
*/ */
it('ACTS_ZipFile_0300', 0, async function (done) { it('ACTS_ZipFile_0300', 0, async function (done) {
console.log("==================FWK_ZipFile_0600 start=================="); console.log("==================ACTS_ZipFile_0300 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_0300.txt";
let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST" var zipDest ="";
let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files"; var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
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) { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_0300 write data to file successfully:" + 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 = {}; var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH; options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
await zlib.zipFile(path, zipDest, options, zlib.zipFile(path, zipDest, options).then((data) => {
(err, data) => {
console.log("ACTS_ZipFile_0300 data: " + data); console.log("ACTS_ZipFile_0300 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
done(); done();
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
done();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_0300 write data to file failed with error:" + err);
done();
}); });
}) })
/* /*
* @tc.number: ACTS_ZipFile_0400 * @tc.number: ACTS_ZipFile_0400
...@@ -117,34 +120,28 @@ it('ACTS_ZipFile_0300', 0, async function (done) { ...@@ -117,34 +120,28 @@ it('ACTS_ZipFile_0300', 0, async function (done) {
* @tc.desc: The ouput file is a directory that does not exist * @tc.desc: The ouput file is a directory that does not exist
*/ */
it('ACTS_ZipFile_0400', 0, async function (done) { it('ACTS_ZipFile_0400', 0, async function (done) {
console.log("==================FWK_ZipFile_0600 start=================="); console.log("==================ACTS_ZipFile_0400 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_0400.txt";
let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST" var zipDest ="/ACTS_ZipFile_0400.zip";
let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files"; var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
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) { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_0400 write data to file successfully:" + 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 = {}; var options = {};
options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH; options.flush = zlib.FlushType.FLUSH_TYPE_NO_FLUSH;
await zlib.zipFile(path, zipDest, options, zlib.zipFile(path, zipDest, options).then((data) => {
(err, data) => {
console.log("ACTS_ZipFile_0400 data: " + data); console.log("ACTS_ZipFile_0400 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
done(); done();
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
done();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_0400 write data to file failed with error:" + err);
done();
}); });
})
})
/* /*
* @tc.number: ACTS_ZipFile_1900 * @tc.number: ACTS_ZipFile_1900
...@@ -153,29 +150,17 @@ it('ACTS_ZipFile_0400', 0, async function (done) { ...@@ -153,29 +150,17 @@ it('ACTS_ZipFile_0400', 0, async function (done) {
*/ */
it('ACTS_ZipFile_1900', 0, async function (done) { it('ACTS_ZipFile_1900', 0, async function (done) {
console.log("==================ACTS_ZipFile_1900 start=================="); console.log("==================ACTS_ZipFile_1900 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_1900.txt";
let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST" var zipDest = dir + "/ACTS_ZipFile_1900.zip"
let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files"; var unzipdir = dir + "/ACTS_ZipFile_1900";
let path = dir + "/ACTS_ZipFile_1900.txt"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_1900.txt";
var zipDest = dir + "/ACTS_ZipFile_1900.zip"; var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
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 = { var options = {
chunkSize: 64, chunkSize: 64,
}; };
fileio.write(fd, infos).then(function (number) {
await zlib.zipFile(path, zipDest, options, console.info("ACTS_ZipFile_1900 write data to file successfully:" + number);
(err, data) => { zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -185,9 +170,6 @@ it('ACTS_ZipFile_1900', 0, async function (done) { ...@@ -185,9 +170,6 @@ it('ACTS_ZipFile_1900', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_1900 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -202,16 +184,22 @@ it('ACTS_ZipFile_1900', 0, async function (done) { ...@@ -202,16 +184,22 @@ it('ACTS_ZipFile_1900', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_1900 err: " + err); console.log("ACTS_ZipFile_1900 err: " + err);
done(); done();
}) })
}).catch(function (error) {
console.info("ACTS_ZipFile_1900 mkdir failed with error:" + error);
done(); done();
}); });
} catch (err) { }).catch((err) => {
console.error('ACTS_ZipFile_1900 err:' + err); console.log("zipFile fail: " + err);
expect(err).assertFail();
done();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_1900 write data to file failed with error:" + err);
done(); done();
} });
console.log("==================ACTS_ZipFile_1900 end=================="); console.log("==================ACTS_ZipFile_1900 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_2000 * @tc.number: ACTS_ZipFile_2000
...@@ -220,28 +208,17 @@ it('ACTS_ZipFile_1900', 0, async function (done) { ...@@ -220,28 +208,17 @@ it('ACTS_ZipFile_1900', 0, async function (done) {
*/ */
it('ACTS_ZipFile_2000', 0, async function (done) { it('ACTS_ZipFile_2000', 0, async function (done) {
console.log("==================ACTS_ZipFile_2000 start=================="); console.log("==================ACTS_ZipFile_2000 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_2000.txt";
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" var zipDest = dir + "/ACTS_ZipFile_2000.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_2000";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_2000.txt";
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 = { var options = {
chunkSize: 1024, chunkSize: 1024,
}; };
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_2000 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -251,9 +228,6 @@ it('ACTS_ZipFile_2000', 0, async function (done) { ...@@ -251,9 +228,6 @@ it('ACTS_ZipFile_2000', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_2000 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -268,16 +242,20 @@ it('ACTS_ZipFile_2000', 0, async function (done) { ...@@ -268,16 +242,20 @@ it('ACTS_ZipFile_2000', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_2000 err: " + err); console.log("ACTS_ZipFile_2000 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_2000 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_2000 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_2000 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_2000 end=================="); console.log("==================ACTS_ZipFile_2000 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_2100 * @tc.number: ACTS_ZipFile_2100
...@@ -286,28 +264,17 @@ it('ACTS_ZipFile_2000', 0, async function (done) { ...@@ -286,28 +264,17 @@ it('ACTS_ZipFile_2000', 0, async function (done) {
*/ */
it('ACTS_ZipFile_2100', 0, async function (done) { it('ACTS_ZipFile_2100', 0, async function (done) {
console.log("==================ACTS_ZipFile_2100 start=================="); console.log("==================ACTS_ZipFile_2100 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_2100.txt";
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" var zipDest = dir + "/ACTS_ZipFile_2100.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_2100";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_2100.txt";
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 = { var options = {
chunkSize: 999, chunkSize: 999,
}; };
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_2100 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -317,9 +284,6 @@ it('ACTS_ZipFile_2100', 0, async function (done) { ...@@ -317,9 +284,6 @@ it('ACTS_ZipFile_2100', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_2100 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -334,16 +298,19 @@ it('ACTS_ZipFile_2100', 0, async function (done) { ...@@ -334,16 +298,19 @@ it('ACTS_ZipFile_2100', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_2100 err: " + err); console.log("ACTS_ZipFile_2100 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_2100 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_2100 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_2100 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_2100 end=================="); console.log("==================ACTS_ZipFile_2100 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_2200 * @tc.number: ACTS_ZipFile_2200
...@@ -352,27 +319,16 @@ it('ACTS_ZipFile_2100', 0, async function (done) { ...@@ -352,27 +319,16 @@ it('ACTS_ZipFile_2100', 0, async function (done) {
*/ */
it('ACTS_ZipFile_2200', 0, async function (done) { it('ACTS_ZipFile_2200', 0, async function (done) {
console.log("==================ACTS_ZipFile_2200 start=================="); console.log("==================ACTS_ZipFile_2200 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_2200.txt";
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" var zipDest = dir + "/ACTS_ZipFile_2200.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_2200";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_2200.txt";
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 = {}; var options = {};
options.level = zlib.CompressLevel.COMPRESS_LEVEL_NO_COMPRESSION; options.level = zlib.CompressLevel.COMPRESS_LEVEL_NO_COMPRESSION;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_2200 write data to file secondlly successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -382,9 +338,6 @@ it('ACTS_ZipFile_2200', 0, async function (done) { ...@@ -382,9 +338,6 @@ it('ACTS_ZipFile_2200', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_2200 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -399,16 +352,19 @@ it('ACTS_ZipFile_2200', 0, async function (done) { ...@@ -399,16 +352,19 @@ it('ACTS_ZipFile_2200', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_2200 err: " + err); console.log("ACTS_ZipFile_2200 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_2200 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_2200 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_2200 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_2200 end=================="); console.log("==================ACTS_ZipFile_2200 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_2300 * @tc.number: ACTS_ZipFile_2300
...@@ -417,27 +373,16 @@ it('ACTS_ZipFile_2200', 0, async function (done) { ...@@ -417,27 +373,16 @@ it('ACTS_ZipFile_2200', 0, async function (done) {
*/ */
it('ACTS_ZipFile_2300', 0, async function (done) { it('ACTS_ZipFile_2300', 0, async function (done) {
console.log("==================ACTS_ZipFile_2300 start=================="); console.log("==================ACTS_ZipFile_2300 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_2300.txt";
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" var zipDest = dir + "/ACTS_ZipFile_2300.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_2300";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_2300.txt";
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 = {}; var options = {};
options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_SPEED; options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_SPEED;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_2300 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -447,9 +392,6 @@ it('ACTS_ZipFile_2300', 0, async function (done) { ...@@ -447,9 +392,6 @@ it('ACTS_ZipFile_2300', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_2300 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -464,16 +406,19 @@ it('ACTS_ZipFile_2300', 0, async function (done) { ...@@ -464,16 +406,19 @@ it('ACTS_ZipFile_2300', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_2300 err: " + err); console.log("ACTS_ZipFile_2300 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_2300 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_2200 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_2300 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_2300 end=================="); console.log("==================ACTS_ZipFile_2300 end==================");
}) })
/* /*
* @tc.number: ACTS_ZipFile_2400 * @tc.number: ACTS_ZipFile_2400
...@@ -482,27 +427,16 @@ it('ACTS_ZipFile_2300', 0, async function (done) { ...@@ -482,27 +427,16 @@ it('ACTS_ZipFile_2300', 0, async function (done) {
*/ */
it('ACTS_ZipFile_2400', 0, async function (done) { it('ACTS_ZipFile_2400', 0, async function (done) {
console.log("==================ACTS_ZipFile_2400 start=================="); console.log("==================ACTS_ZipFile_2400 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_2400.txt";
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" var zipDest = dir + "/ACTS_ZipFile_2400.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_2400";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_2400.txt";
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 = {}; var options = {};
options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_COMPRESSION; options.level = zlib.CompressLevel.COMPRESS_LEVEL_BEST_COMPRESSION;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_2400 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -512,9 +446,6 @@ it('ACTS_ZipFile_2400', 0, async function (done) { ...@@ -512,9 +446,6 @@ it('ACTS_ZipFile_2400', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_2400 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -529,16 +460,19 @@ it('ACTS_ZipFile_2400', 0, async function (done) { ...@@ -529,16 +460,19 @@ it('ACTS_ZipFile_2400', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_2400 err: " + err); console.log("ACTS_ZipFile_2400 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_2400 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_2400 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_2400 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_2400 end=================="); console.log("==================ACTS_ZipFile_2400 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_2500 * @tc.number: ACTS_ZipFile_2500
...@@ -547,27 +481,16 @@ it('ACTS_ZipFile_2400', 0, async function (done) { ...@@ -547,27 +481,16 @@ it('ACTS_ZipFile_2400', 0, async function (done) {
*/ */
it('ACTS_ZipFile_2500', 0, async function (done) { it('ACTS_ZipFile_2500', 0, async function (done) {
console.log("==================ACTS_ZipFile_2500 start=================="); console.log("==================ACTS_ZipFile_2500 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_2500.txt";
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" var zipDest = dir + "/ACTS_ZipFile_2500.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_2500";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_2500.txt";
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 = {}; var options = {};
options.level = zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION; options.level = zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_2500 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -577,9 +500,6 @@ it('ACTS_ZipFile_2500', 0, async function (done) { ...@@ -577,9 +500,6 @@ it('ACTS_ZipFile_2500', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_2500 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -593,17 +513,20 @@ it('ACTS_ZipFile_2500', 0, async function (done) { ...@@ -593,17 +513,20 @@ it('ACTS_ZipFile_2500', 0, async function (done) {
done(); done();
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_2500 err: " + err); console.log("ACTS_ZipFile_2500 err: " + err);
done(); done()
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_2500 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_2500 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_2500 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_2500 end=================="); console.log("==================ACTS_ZipFile_2500 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_2600 * @tc.number: ACTS_ZipFile_2600
...@@ -612,27 +535,16 @@ it('ACTS_ZipFile_2500', 0, async function (done) { ...@@ -612,27 +535,16 @@ it('ACTS_ZipFile_2500', 0, async function (done) {
*/ */
it('ACTS_ZipFile_2600', 0, async function (done) { it('ACTS_ZipFile_2600', 0, async function (done) {
console.log("==================ACTS_ZipFile_2600 start=================="); console.log("==================ACTS_ZipFile_2600 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_2600.txt";
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" var zipDest = dir + "/ACTS_ZipFile_2600.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_2600";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_2600.txt";
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 = {}; var options = {};
options.memLevel = zlib.MemLevel.MEM_LEVEL_MIN; options.memLevel = zlib.MemLevel.MEM_LEVEL_MIN;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_2600 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -642,9 +554,6 @@ it('ACTS_ZipFile_2600', 0, async function (done) { ...@@ -642,9 +554,6 @@ it('ACTS_ZipFile_2600', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_2600 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -659,16 +568,19 @@ it('ACTS_ZipFile_2600', 0, async function (done) { ...@@ -659,16 +568,19 @@ it('ACTS_ZipFile_2600', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_2600 err: " + err); console.log("ACTS_ZipFile_2600 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_2600 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_2600 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_2600 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_2600 end=================="); console.log("==================ACTS_ZipFile_2600 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_2700 * @tc.number: ACTS_ZipFile_2700
...@@ -677,27 +589,16 @@ it('ACTS_ZipFile_2600', 0, async function (done) { ...@@ -677,27 +589,16 @@ it('ACTS_ZipFile_2600', 0, async function (done) {
*/ */
it('ACTS_ZipFile_2700', 0, async function (done) { it('ACTS_ZipFile_2700', 0, async function (done) {
console.log("==================ACTS_ZipFile_2700 start=================="); console.log("==================ACTS_ZipFile_2700 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_2700.txt";
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" var zipDest = dir + "/ACTS_ZipFile_2700.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_2700";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_2700.txt";
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 = {}; var options = {};
options.memLevel = zlib.MemLevel.MEM_LEVEL_MAX; options.memLevel = zlib.MemLevel.MEM_LEVEL_MAX;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_2700 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -707,9 +608,6 @@ it('ACTS_ZipFile_2700', 0, async function (done) { ...@@ -707,9 +608,6 @@ it('ACTS_ZipFile_2700', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_2700 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -724,16 +622,19 @@ it('ACTS_ZipFile_2700', 0, async function (done) { ...@@ -724,16 +622,19 @@ it('ACTS_ZipFile_2700', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_2700 err: " + err); console.log("ACTS_ZipFile_2700 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_2700 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_2700 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_2700 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_2700 end=================="); console.log("==================ACTS_ZipFile_2700 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_2800 * @tc.number: ACTS_ZipFile_2800
...@@ -742,27 +643,16 @@ it('ACTS_ZipFile_2700', 0, async function (done) { ...@@ -742,27 +643,16 @@ it('ACTS_ZipFile_2700', 0, async function (done) {
*/ */
it('ACTS_ZipFile_2800', 0, async function (done) { it('ACTS_ZipFile_2800', 0, async function (done) {
console.log("==================ACTS_ZipFile_2800 start=================="); console.log("==================ACTS_ZipFile_2800 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_2800.txt";
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" var zipDest = dir + "/ACTS_ZipFile_2800.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_2800";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_2800.txt";
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 = {}; var options = {};
options.memLevel = zlib.MemLevel.MEM_LEVEL_DEFAULT; options.memLevel = zlib.MemLevel.MEM_LEVEL_DEFAULT;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_2800 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -772,9 +662,6 @@ it('ACTS_ZipFile_2800', 0, async function (done) { ...@@ -772,9 +662,6 @@ it('ACTS_ZipFile_2800', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_2800 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -789,16 +676,19 @@ it('ACTS_ZipFile_2800', 0, async function (done) { ...@@ -789,16 +676,19 @@ it('ACTS_ZipFile_2800', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_2800 err: " + err); console.log("ACTS_ZipFile_2800 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_2800 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_2800 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_2800 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_2800 end=================="); console.log("==================ACTS_ZipFile_2800 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_2900 * @tc.number: ACTS_ZipFile_2900
...@@ -807,27 +697,16 @@ it('ACTS_ZipFile_2800', 0, async function (done) { ...@@ -807,27 +697,16 @@ it('ACTS_ZipFile_2800', 0, async function (done) {
*/ */
it('ACTS_ZipFile_2900', 0, async function (done) { it('ACTS_ZipFile_2900', 0, async function (done) {
console.log("==================ACTS_ZipFile_2900 start=================="); console.log("==================ACTS_ZipFile_2900 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_2900.txt";
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" var zipDest = dir + "/ACTS_ZipFile_2900.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_2900";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_2900.txt";
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 = {}; var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY; options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_2900 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -837,9 +716,6 @@ it('ACTS_ZipFile_2900', 0, async function (done) { ...@@ -837,9 +716,6 @@ it('ACTS_ZipFile_2900', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_2900 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -854,16 +730,19 @@ it('ACTS_ZipFile_2900', 0, async function (done) { ...@@ -854,16 +730,19 @@ it('ACTS_ZipFile_2900', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_2900 err: " + err); console.log("ACTS_ZipFile_2900 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_2900 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_2900 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_2900 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_2900 end=================="); console.log("==================ACTS_ZipFile_2900 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_3000 * @tc.number: ACTS_ZipFile_3000
...@@ -872,27 +751,16 @@ it('ACTS_ZipFile_2900', 0, async function (done) { ...@@ -872,27 +751,16 @@ it('ACTS_ZipFile_2900', 0, async function (done) {
*/ */
it('ACTS_ZipFile_3000', 0, async function (done) { it('ACTS_ZipFile_3000', 0, async function (done) {
console.log("==================ACTS_ZipFile_3000 start=================="); console.log("==================ACTS_ZipFile_3000 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_3000.txt";
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" var zipDest = dir + "/ACTS_ZipFile_3000.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_3000";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_3000.txt";
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 = {}; var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED; options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_3000 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -902,9 +770,6 @@ it('ACTS_ZipFile_3000', 0, async function (done) { ...@@ -902,9 +770,6 @@ it('ACTS_ZipFile_3000', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_3000 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -919,16 +784,19 @@ it('ACTS_ZipFile_3000', 0, async function (done) { ...@@ -919,16 +784,19 @@ it('ACTS_ZipFile_3000', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_3000 err: " + err); console.log("ACTS_ZipFile_3000 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_3000 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_3000 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_3000 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_3000 end=================="); console.log("==================ACTS_ZipFile_3000 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_3100 * @tc.number: ACTS_ZipFile_3100
...@@ -937,27 +805,16 @@ it('ACTS_ZipFile_3000', 0, async function (done) { ...@@ -937,27 +805,16 @@ it('ACTS_ZipFile_3000', 0, async function (done) {
*/ */
it('ACTS_ZipFile_3100', 0, async function (done) { it('ACTS_ZipFile_3100', 0, async function (done) {
console.log("==================ACTS_ZipFile_3100 start=================="); console.log("==================ACTS_ZipFile_3100 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_3100.txt";
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" var zipDest = dir + "/ACTS_ZipFile_3100.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_3100";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_3100.txt";
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 = {}; var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_HUFFMAN_ONLY; options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_HUFFMAN_ONLY;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_3100 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -967,9 +824,6 @@ it('ACTS_ZipFile_3100', 0, async function (done) { ...@@ -967,9 +824,6 @@ it('ACTS_ZipFile_3100', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_3100 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -984,16 +838,19 @@ it('ACTS_ZipFile_3100', 0, async function (done) { ...@@ -984,16 +838,19 @@ it('ACTS_ZipFile_3100', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_3100 err: " + err); console.log("ACTS_ZipFile_3100 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_3100 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_3100 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_3100 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_3100 end=================="); console.log("==================ACTS_ZipFile_3100 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_3200 * @tc.number: ACTS_ZipFile_3200
...@@ -1002,27 +859,16 @@ it('ACTS_ZipFile_3100', 0, async function (done) { ...@@ -1002,27 +859,16 @@ it('ACTS_ZipFile_3100', 0, async function (done) {
*/ */
it('ACTS_ZipFile_3200', 0, async function (done) { it('ACTS_ZipFile_3200', 0, async function (done) {
console.log("==================ACTS_ZipFile_3200 start=================="); console.log("==================ACTS_ZipFile_3200 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_3200.txt";
let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST" var zipDest = dir + "/ACTS_ZipFile_3200.zip";
let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files"; var unzipdir = dir + "/ACTS_ZipFile_3200";
let path = dir + "/ACTS_ZipFile_3200.txt"; var unzipresultfile = unzipdir + "/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 = {}; var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_RLE; options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_RLE;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_3200 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -1032,9 +878,6 @@ it('ACTS_ZipFile_3200', 0, async function (done) { ...@@ -1032,9 +878,6 @@ it('ACTS_ZipFile_3200', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_3200 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -1047,18 +890,20 @@ it('ACTS_ZipFile_3200', 0, async function (done) { ...@@ -1047,18 +890,20 @@ it('ACTS_ZipFile_3200', 0, async function (done) {
console.error('ACTS_ZipFile_3200 unzipFile'); console.error('ACTS_ZipFile_3200 unzipFile');
done(); done();
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_3200 err: " + err); console.log("ACTS_ZipFile_3200 err: " + err);done();
done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_3200 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_3200 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_3200 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_3200 end=================="); console.log("==================ACTS_ZipFile_3200 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_3300 * @tc.number: ACTS_ZipFile_3300
...@@ -1067,27 +912,16 @@ it('ACTS_ZipFile_3200', 0, async function (done) { ...@@ -1067,27 +912,16 @@ it('ACTS_ZipFile_3200', 0, async function (done) {
*/ */
it('ACTS_ZipFile_3300', 0, async function (done) { it('ACTS_ZipFile_3300', 0, async function (done) {
console.log("==================ACTS_ZipFile_3300 start=================="); console.log("==================ACTS_ZipFile_3300 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_3300.txt";
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" var zipDest = dir + "/ACTS_ZipFile_3300.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_3300";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_3300.txt";
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 = {}; var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED; options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_3300 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -1097,9 +931,6 @@ it('ACTS_ZipFile_3300', 0, async function (done) { ...@@ -1097,9 +931,6 @@ it('ACTS_ZipFile_3300', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_3300 mkdir successfully"); 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) => { zlib.unzipFile(zipDest, unzipdir, options).then((data) => {
var unzipStat = fileio.statSync(unzipresultfile); var unzipStat = fileio.statSync(unzipresultfile);
var isFile = unzipStat.isFile(); var isFile = unzipStat.isFile();
...@@ -1114,16 +945,19 @@ it('ACTS_ZipFile_3300', 0, async function (done) { ...@@ -1114,16 +945,19 @@ it('ACTS_ZipFile_3300', 0, async function (done) {
}).catch((err) => { }).catch((err) => {
console.log("ACTS_ZipFile_3300 err: " + err); console.log("ACTS_ZipFile_3300 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_3300 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_3300 write data to file failed with error:" + err);
}); });
} catch (err) {
console.error('ACTS_ZipFile_3300 err:' + err);
done();
}
console.log("==================ACTS_ZipFile_3300 end=================="); console.log("==================ACTS_ZipFile_3300 end==================");
}) });
/* /*
* @tc.number: ACTS_ZipFile_3500 * @tc.number: ACTS_ZipFile_3500
...@@ -1132,25 +966,14 @@ it('ACTS_ZipFile_3300', 0, async function (done) { ...@@ -1132,25 +966,14 @@ it('ACTS_ZipFile_3300', 0, async function (done) {
*/ */
it('ACTS_ZipFile_3500', 0, async function (done) { it('ACTS_ZipFile_3500', 0, async function (done) {
console.log("==================ACTS_ZipFile_3500 start=================="); console.log("==================ACTS_ZipFile_3500 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_3500.txt";
let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST" var src = dir + "/ACTS_ZipFile_9900.txt";
let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files"; var unzipdir = dir + "/ACTS_ZipFile_3500";
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 = {}; var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED;
var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_3500 write successfully:" + number);
zlib.zipFile(src, dir, options).then((data) => { zlib.zipFile(src, dir, options).then((data) => {
console.log("zipFilePromise_3500 data: " + data); console.log("zipFilePromise_3500 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
...@@ -1159,8 +982,11 @@ it('ACTS_ZipFile_3500', 0, async function (done) { ...@@ -1159,8 +982,11 @@ it('ACTS_ZipFile_3500', 0, async function (done) {
console.log("zipFilePromise_3500 err: " + err); console.log("zipFilePromise_3500 err: " + err);
done(); done();
}); });
}).catch(function (err) {
console.info("ACTS_ZipFile_3500 write data to file failed with error:" + err);
});
console.log("==================zipFilePromise_3500 end =================="); console.log("==================zipFilePromise_3500 end ==================");
}) })
/* /*
* @tc.number: ACTS_ZipFile_3600 * @tc.number: ACTS_ZipFile_3600
...@@ -1169,23 +995,13 @@ it('ACTS_ZipFile_3500', 0, async function (done) { ...@@ -1169,23 +995,13 @@ it('ACTS_ZipFile_3500', 0, async function (done) {
*/ */
it('ACTS_ZipFile_3600', 0, async function (done) { it('ACTS_ZipFile_3600', 0, async function (done) {
console.log("==================ACTS_ZipFile_3600 start=================="); console.log("==================ACTS_ZipFile_3600 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_3600.txt";
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 = ""; var zipDest = "";
let infos = path + dir; var options = {};
let unzipdirfirst = "/data/accounts/account_0/appdata"; options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED;
let unzipdirsecond = unzipdirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST" var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
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) { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_3600 write data to file successfully:" + 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) => { zlib.zipFile(path, zipDest, options).then((data) => {
console.log("zipFilePromise_3600 data: " + data); console.log("zipFilePromise_3600 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
...@@ -1194,9 +1010,11 @@ it('ACTS_ZipFile_3600', 0, async function (done) { ...@@ -1194,9 +1010,11 @@ it('ACTS_ZipFile_3600', 0, async function (done) {
console.log("zipFilePromise_3600 err: " + err); console.log("zipFilePromise_3600 err: " + err);
done(); done();
}); });
}).catch(function (err) {
console.info("ACTS_ZipFile_3600 write data to file failed with error:" + err);
});
console.log("==================zipFilePromise_3600 end ==================") console.log("==================zipFilePromise_3600 end ==================")
})
})
/* /*
* @tc.number: ACTS_ZipFile_4500 * @tc.number: ACTS_ZipFile_4500
...@@ -1204,31 +1022,18 @@ it('ACTS_ZipFile_3600', 0, async function (done) { ...@@ -1204,31 +1022,18 @@ it('ACTS_ZipFile_3600', 0, async function (done) {
* @tc.desc: COMPRESS_STRATEGY_FILTERED,, * @tc.desc: COMPRESS_STRATEGY_FILTERED,,
*/ */
it('ACTS_ZipFile_4500', 0, async function (done) { it('ACTS_ZipFile_4500', 0, async function (done) {
console.log("==================ACTS_ZipFile_5000 start=================="); console.log("==================ACTS_ZipFile_4500 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_4500.txt";
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 zipDest = dir + "/ACTS_ZipFile_4500.zip"
var unzipDest = dir + "/ACTS_ZipFile_9900.zip" var unzipDest = dir + "/ACTS_ZipFile_9900.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_4500";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var zipdir = dir + "/ACTS_ZipFile_9900";
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 = {}; var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED; options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED;
await zlib.zipFile(path, zipDest, options, var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
(err, data) => { fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_4500 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then((data) => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -1238,9 +1043,6 @@ it('ACTS_ZipFile_4500', 0, async function (done) { ...@@ -1238,9 +1043,6 @@ it('ACTS_ZipFile_4500', 0, async function (done) {
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () { fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_4500 mkdir successfully"); 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) => { zlib.unzipFile(unzipDest, zipdir, options).then((data) => {
console.log("ACTS_ZipFile_4500 data: " + data); console.log("ACTS_ZipFile_4500 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_ERRNO);
...@@ -1249,9 +1051,17 @@ it('ACTS_ZipFile_4500', 0, async function (done) { ...@@ -1249,9 +1051,17 @@ it('ACTS_ZipFile_4500', 0, async function (done) {
console.log("ACTS_ZipFile_4500 err: " + err); console.log("ACTS_ZipFile_4500 err: " + err);
done(); done();
}) })
done(); }).catch(function (error) {
console.info("ACTS_ZipFile_4500 mkdir failed with error:" + error);
});
}).catch((err) => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_4500 write data to file failed with error:" + err);
});
}) })
})
/* /*
* @tc.number: ACTS_ZipFile_4900 * @tc.number: ACTS_ZipFile_4900
...@@ -1260,29 +1070,17 @@ it('ACTS_ZipFile_4500', 0, async function (done) { ...@@ -1260,29 +1070,17 @@ it('ACTS_ZipFile_4500', 0, async function (done) {
*/ */
it('ACTS_ZipFile_4900', 0, async function (done) { it('ACTS_ZipFile_4900', 0, async function (done) {
console.log("==================ACTS_ZipFile_4900 start=================="); console.log("==================ACTS_ZipFile_4900 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_4900.txt";
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 zipDest = dir + "/ACTS_ZipFile_4900.zip"
var unzipDest = dir + "/ACTS_ZipFile_4900.zip" var unzipDest = dir + "/ACTS_ZipFile_4900.zip"
let infos = path + dir; var unzipdir = dir + "/ACTS_ZipFile_4900";
let unzipdirfirst = "/data/accounts/account_0/appdata"; var zipdir = dir + "/ACTS_ZipFile_4900";
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_4900";
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 = {}; var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED; options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED;
await zlib.zipFile(path, zipDest, options).then(data => { var 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);
zlib.zipFile(path, zipDest, options).then(data => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -1290,17 +1088,9 @@ it('ACTS_ZipFile_4900', 0, async function (done) { ...@@ -1290,17 +1088,9 @@ it('ACTS_ZipFile_4900', 0, async function (done) {
var destSize = zipStat.size; var destSize = zipStat.size;
expect(srcSize > destSize).assertTrue(); expect(srcSize > destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () {
}).catch(err => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
await fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_4900 mkdir successfully"); console.info("ACTS_ZipFile_4900 mkdir successfully");
}).catch(function (error) { zlib.unzipFile(unzipDest, zipdir, options).then(data => {
console.info("ACTS_ZipFile_4900 mkdir failed with error:" + error);
});
await zlib.unzipFile(unzipDest, zipdir, options).then(data => {
console.log("ACTS_ZipFile_4900 data: " + data); console.log("ACTS_ZipFile_4900 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done(); done();
...@@ -1309,8 +1099,17 @@ it('ACTS_ZipFile_4900', 0, async function (done) { ...@@ -1309,8 +1099,17 @@ it('ACTS_ZipFile_4900', 0, async function (done) {
expect(err).assertFail(); expect(err).assertFail();
done(); done();
}) })
}).catch(function (error) {
console.info("ACTS_ZipFile_4900 mkdir failed with error:" + error);
});
}).catch(err => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
}) })
}).catch(function (err) {
console.info("ACTS_ZipFile_4900 write data to file failed with error:" + err);
});
})
/* /*
* @tc.number: ACTS_ZipFile_5000 * @tc.number: ACTS_ZipFile_5000
...@@ -1319,29 +1118,15 @@ it('ACTS_ZipFile_4900', 0, async function (done) { ...@@ -1319,29 +1118,15 @@ it('ACTS_ZipFile_4900', 0, async function (done) {
*/ */
it('ACTS_ZipFile_5000', 0, async function (done) { it('ACTS_ZipFile_5000', 0, async function (done) {
console.log("==================ACTS_ZipFile_5000 start=================="); console.log("==================ACTS_ZipFile_5000 start==================");
let dirfirst = "/data/accounts/account_0/appdata" var path = dir + "/ACTS_ZipFile_5000.txt";
let dirsecond =dirfirst + "/com.example.amsZipfileUnzipfileST/com.example.amsZipfileUnzipfileST"
let dir = dirsecond + "/com.example.amsZipfileUnzipfileST.MainAbility/files";
let path = dir + "/ACTS_ZipFile_5000.txt";
var zipDest = dir + "/ACTS_ZipFile_5000.zip" var zipDest = dir + "/ACTS_ZipFile_5000.zip"
var unzipDest = dir + "/ACTS_ZipFile_5000.zip" var unzipdir = dir + "/ACTS_ZipFile_5000";
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_5000";
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_5000";
let unzipresultfile = zipdir + "/ACTS_ZipFile_5000.txt";
let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_5000 write data to file successfully:" + number);
}).catch(function (err) {
console.info("ACTS_ZipFile_5000 write data to file failed with error:" + err);
});
var options = {}; var options = {};
options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FIXED; options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FIXED;
await zlib.zipFile(path, zipDest, options).then(data => { var fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
fileio.write(fd, infos).then(function (number) {
console.info("ACTS_ZipFile_5000 write data to file successfully:" + number);
zlib.zipFile(path, zipDest, options).then(data => {
var zipStat = fileio.statSync(zipDest); var zipStat = fileio.statSync(zipDest);
var isFile = zipStat.isFile(); var isFile = zipStat.isFile();
expect(isFile).assertTrue(); expect(isFile).assertTrue();
...@@ -1349,17 +1134,9 @@ it('ACTS_ZipFile_5000', 0, async function (done) { ...@@ -1349,17 +1134,9 @@ it('ACTS_ZipFile_5000', 0, async function (done) {
var destSize = zipStat.size; var destSize = zipStat.size;
expect(srcSize > destSize).assertTrue(); expect(srcSize > destSize).assertTrue();
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
fileio.mkdir(unzipdir).then(function () {
}).catch(err => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
await fileio.mkdir(unzipdir).then(function () {
console.info("ACTS_ZipFile_5000 mkdir successfully"); console.info("ACTS_ZipFile_5000 mkdir successfully");
}).catch(function (error) { zlib.unzipFile(zipDest, unzipdir, options).then(data => {
console.info("ACTS_ZipFile_5000 mkdir failed with error:" + error);
});
await zlib.unzipFile(unzipDest, zipdir, options).then(data => {
console.log("ACTS_ZipFile_5000 data: " + data); console.log("ACTS_ZipFile_5000 data: " + data);
expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK);
done(); done();
...@@ -1368,6 +1145,16 @@ it('ACTS_ZipFile_5000', 0, async function (done) { ...@@ -1368,6 +1145,16 @@ it('ACTS_ZipFile_5000', 0, async function (done) {
expect(err).assertFail(); expect(err).assertFail();
done(); done();
}) })
}).catch(function (error) {
console.info("ACTS_ZipFile_5000 mkdir failed with error:" + error);
});
}).catch(err => {
console.log("zipFile fail: " + err);
expect(err).assertFail();
})
}).catch(function (err) {
console.info("ACTS_ZipFile_5000 write data to file failed with error:" + err);
});
}) })
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册