diff --git a/POP3Client/build-profile.json5 b/POP3Client/build-profile.json5 index 841bc52f905b482a439660a61edf8498a0df525d..b6857b4c1e2ead607ef37a96a2b6d92643c9665d 100644 --- a/POP3Client/build-profile.json5 +++ b/POP3Client/build-profile.json5 @@ -5,7 +5,7 @@ "products": [ { "name": "default", - "signingConfig": "default", + "signingConfig": "default" } ] }, diff --git a/POP3Client/entry/src/ohosTest/ets/test/List.test.ets b/POP3Client/entry/src/ohosTest/ets/test/List.test.ets index ee82ae4da6d6aec0115329f7d62711adbb3d78ae..3c2a8efa169515482cb1fc11f3f7258c1d552c59 100644 --- a/POP3Client/entry/src/ohosTest/ets/test/List.test.ets +++ b/POP3Client/entry/src/ohosTest/ets/test/List.test.ets @@ -13,8 +13,10 @@ * limitations under the License. */ -import POP3Test from './POP3.test' +// import POP3Test from './POP3.test' +import POP3PressTest from './POP3Press.test' export default function testsuite() { - POP3Test() + // POP3Test() + POP3PressTest() } \ No newline at end of file diff --git a/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets b/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b45e6457c86f759c2044a7d20c6924123b8f43cc --- /dev/null +++ b/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets @@ -0,0 +1,243 @@ +/* + * Copyright (C) 2023 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 hilog from '@ohos.hilog'; +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '@ohos/hypium' +import promptAction from '@ohos.promptAction' +import router from '@ohos.router' +import socket from '@ohos.net.socket' +import Pop3Command from '@ohos/node_pop3' +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import MsgBean from '../../../../../entry/src/main/ets/MsgBean' + +export default function POP3PressTest() { + + let message = 'Hello World' + let account = '479868299' + let password = 'zkljojjdatjrbgcg' + let mailType = '@qq.com' + let textValue = '' + let inputValue = 'click me' + let secure = false + let listData: Array = [] + let client: Pop3Command = undefined + let selectMsgNum: number = -1 + let isListShow: boolean = false + const BASE_COUNT = 1000 + + describe('POP3PressTest', function () { + + it('LIST', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.LIST(); + console.log("LIST count:" + i) + } + }) + + it('STAT', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.STAT() + console.log("STAT count:" + i) + } + }) + + it('NOOP', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.NOOP() + console.log("NOOP count:" + i) + } + }) + + it('UIDL', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.UIDL("1") + console.log("UIDL count:" + i) + } + }) + + it('RSET', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.RSET() + console.log("RSET count:" + i) + } + }) + + it('RETR', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.RETR("1") + console.log("RETR count:" + i) + } + }) + + + it('DELE', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.DELE("1") + console.log("DELE count:" + i) + } + }) + + + it('QUIT', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.QUIT() + console.log("QUIT count:" + i) + } + }) + + it('connect', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.connect() + console.log("connect count:" + i) + } + }) + + it('TOP', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.TOP("1") + console.log("TOP count:" + i) + } + }) + + it('command', 0, function () { + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + for (var i = 1;i < BASE_COUNT; i++) { + let result = client.command("NOOP") + console.log("command count:" + i) + } + }) + + }) +} \ No newline at end of file diff --git a/SMTPClient/entry/src/main/ets/pages/SendMailPage.ets b/SMTPClient/entry/src/main/ets/pages/SendMailPage.ets index 52df92f85725d9c147da4bc182ff56be0369b0b8..bb2232de2a64c10fd92cdd15f0cbedf337db965b 100644 --- a/SMTPClient/entry/src/main/ets/pages/SendMailPage.ets +++ b/SMTPClient/entry/src/main/ets/pages/SendMailPage.ets @@ -365,7 +365,7 @@ struct SendMailPage { from: `${this.accountName} <${this.from}>`, to: this.to, cc: this.cc, - bcc: this.cc, + bcc: this.bcc, subject: this.subject, attachment: this.attachment } diff --git a/SMTPClient/entry/src/ohosTest/ets/test/List.test.ets b/SMTPClient/entry/src/ohosTest/ets/test/List.test.ets index 277027cd62a9f8763a2c32d91fec837cda1df31f..1c22bdf942b0151d93a9d4e2d2ac41d22ca9b22c 100644 --- a/SMTPClient/entry/src/ohosTest/ets/test/List.test.ets +++ b/SMTPClient/entry/src/ohosTest/ets/test/List.test.ets @@ -13,14 +13,16 @@ * limitations under the License. */ -import addressTest from './Address.test' -import connectionTest from './Connection.test' -import dateTest from './Date.test' -import mimeTest from './Mime.test' +// import addressTest from './Address.test' +// import connectionTest from './Connection.test' +// import dateTest from './Date.test' +// import mimeTest from './Mime.test' +import SMTPPressTest from './SMTPPress.test' export default function testsuite() { - addressTest() - connectionTest() - dateTest() - mimeTest() + // addressTest() + // connectionTest() + // dateTest() + // mimeTest() + SMTPPressTest() } \ No newline at end of file diff --git a/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets b/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..687758e3134951f11d2e8916baa17ac458027def --- /dev/null +++ b/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets @@ -0,0 +1,66 @@ +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import { AUTH_METHODS, SMTPClient } from '@ohos/emailjs' +import promptAction from '@ohos.promptAction' +import router from '@ohos.router' +import socket from '@ohos.net.socket' +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import { Message, MessageHeaders, MessageAttachment } from '@ohos/emailjs' +import fs from '@ohos.file.fs'; + +export default function SMTPPressTest() { + + let from: string = '479868299@qq.com' + let accountName: string = '479868299' + let to: string = '12345689@qq.com' + let cc: string = '1' + let bcc: string = '2' + let subject: string = 'test' + let content: string = 'test' + + describe('SMTPPressTest', function () { + + it('new_SMTPClient', 0, function () { + for (var i = 1;i <= 1000; i++) { + let client = new SMTPClient({ + user: '479868299@qq.com', + password: 'bfxeualuaxambged', + host: 'smtp.qq.com', + port: 25, + timeout: 30000, + authentication: [AUTH_METHODS.LOGIN], + ssl: false, + tls: undefined + }); + console.log("new SMTPClient count:" + i); + } + }) + + it('sendAsync', 0, function () { + let client = new SMTPClient({ + user: '479868299@qq.com', + password: 'bfxeualuaxambged', + host: 'smtp.qq.com', + port: 25, + timeout: 30000, + authentication: [AUTH_METHODS.LOGIN], + ssl: false, + tls: undefined + }); + + let msg: Message | MessageHeaders = { + text: content, + from: `${accountName} <${from}>`, + to: to, + cc: cc, + bcc: cc, + subject: subject, + attachment: null + } + for (var i = 1;i <= 1000; i++) { + client.sendAsync(msg) + console.log("sendAsync count:" + i) + } + }) + }) +} \ No newline at end of file