From 83299c782c9dd8187785cf579989c2a19684eee3 Mon Sep 17 00:00:00 2001 From: trydofor Date: Tue, 30 Jan 2024 11:28:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20boot=203.2.2,=20wings?= =?UTF-8?q?=20110ss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 29 ++++---- observe/docs | 2 +- observe/meepo | 2 +- observe/mirana | 2 +- pom.xml | 32 +++++---- radiant/devs-codegen/pom.xml | 1 - radiant/devs-coverage/pom.xml | 19 ----- radiant/devs-mvndeps/pom.xml | 61 +++++++++++++++- .../service/impl/TinyTaskConfServiceImpl.java | 69 ++++++++++--------- .../silencer/i18n/MessageModuleTest.java | 16 ++--- .../slardar/json/WingsJacksonMapperTest.java | 2 +- 11 files changed, 145 insertions(+), 90 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 91170ec7e..f37dd1917 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,14 +30,16 @@ on: required: false release: types: [published] - + push: + branches: + - 'main' jobs: release: name: Release to Sonatype runs-on: ubuntu-latest env: MAVEN_OPTS: -Xmx2g - LOG_LEVEL: ${{ inputs.testLoggerLevel }} + LOG_LEVEL: ${{ inputs.testLoggerLevel || 'INFO' }} TEST_VERBOSE: ${{ inputs.testLoggerLevel == 'DEBUG' }} steps: @@ -73,16 +75,21 @@ jobs: _opt=$(git describe --tags --exact-match 2>/dev/null || true) if [ "$_opt" != "" ]; then _opt="-Drevision=$_opt" - echo $_opt + echo "MVN_REVISION=$_opt" echo "MVN_REVISION=$_opt" >> "$GITHUB_OUTPUT" fi _ver=$(mvn --quiet --non-recursive -DforceStdout -Dexpression=project.version $_opt help:evaluate) - echo $_ver + echo "WINGS_VERSION=$_ver" echo "WINGS_VERSION=$_ver" >> "$GITHUB_OUTPUT" - echo "MVN_COVERAGE=${{ inputs.testCoverReport || github.event_name == 'release' }}" >> "$GITHUB_OUTPUT" - echo "MVN_DEPLOYRH=${{ inputs.deployOssrh || github.event_name == 'release' }}" >> "$GITHUB_OUTPUT" + _cov=${{ inputs.testCoverReport || github.event_name == 'push' }} + echo "MVN_COVERAGE=$_cov" + echo "MVN_COVERAGE=$_cov" >> "$GITHUB_OUTPUT" + + _drh=${{ inputs.deployOssrh || github.event_name == 'release' }} + echo "MVN_DEPLOYRH=$_drh" + echo "MVN_DEPLOYRH=$_drh" >> "$GITHUB_OUTPUT" mvn -v git --no-pager log --graph -10 --pretty=format:'%H - %ai %d %s' @@ -103,7 +110,7 @@ jobs: ## report if not release - name: Test Coverage ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }} - if: steps.settings.outputs.MVN_COVERAGE + if: steps.settings.outputs.MVN_COVERAGE == 'true' run: | mvn -pl ':devs-codegen' -am -Ddevs-codegen.test.skip=false -Ddevs-initdb=true -Dwings.test.skip=true clean test mvn -P 'coverage,!example' -Dmaven.test.failure.ignore=${{ inputs.testFailureIgnore }} clean test @@ -112,15 +119,11 @@ jobs: env: TZ: Asia/Shanghai JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }} - MAIL_USER: ${{ secrets.MAIL_USER }} - MAIL_PASS: ${{ secrets.MAIL_PASS }} - MAIL_FROM: ${{ secrets.MAIL_FROM }} - MAIL_TO: ${{ secrets.MAIL_TO }} COVERALLS_WINGS: ${{ secrets.COVERALLS_REPO_TOKEN }} ## import gpp private key - name: Import GPG key - if: steps.settings.outputs.MVN_DEPLOYRH + if: steps.settings.outputs.MVN_DEPLOYRH == 'true' uses: crazy-max/ghaction-import-gpg@v6 with: gpg_private_key: ${{ secrets.MVN_GPG_SKEY }} @@ -128,7 +131,7 @@ jobs: ## maven deploy - name: Deploy ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }} - if: steps.settings.outputs.MVN_DEPLOYRH + if: steps.settings.outputs.MVN_DEPLOYRH == 'true' run: > mvn -P 'ossrh,doc,!example,!devs' diff --git a/observe/docs b/observe/docs index 7567f0132..e3eae7203 160000 --- a/observe/docs +++ b/observe/docs @@ -1 +1 @@ -Subproject commit 7567f0132707bfd190c9ea7fd90e17cc3f9423f4 +Subproject commit e3eae720319647e7fadc07b43eeff3785cb742cd diff --git a/observe/meepo b/observe/meepo index 55a1fdb34..c5e58c49a 160000 --- a/observe/meepo +++ b/observe/meepo @@ -1 +1 @@ -Subproject commit 55a1fdb3495674771742d5c26ab2b32a39ef77e5 +Subproject commit c5e58c49ae61b77ea973ee77b0e8fe6e87026cdd diff --git a/observe/mirana b/observe/mirana index 2991b285d..9bfe8f87e 160000 --- a/observe/mirana +++ b/observe/mirana @@ -1 +1 @@ -Subproject commit 2991b285de47bbd29ea0723678a49470a6e76f04 +Subproject commit 9bfe8f87ee1a4a744d187bc63d16b58177f8f8aa diff --git a/pom.xml b/pom.xml index b379fc675..df5b913d7 100644 --- a/pom.xml +++ b/pom.xml @@ -21,9 +21,9 @@ - 3.2.101-SNAPSHOT - - 3.2.1 + 3.2.110-SNAPSHOT + + 3.2.2 ${revision} ${highest-basedir} @@ -35,7 +35,7 @@ true false - 24.0.1 + 24.1.0 1.5.5.Final 33.0.0-jre @@ -44,29 +44,30 @@ 1.11.0 2.2.3 - 2.6.4 - 1.5.0 + 2.6.5 + 1.5.1 2.3.3 - 2.0.44 + 2.0.46 ${fastjson2.version} - 5.5.0 - 2.14.4 + 5.6.0 + 2.14.5 1.77 1.16.6 5.4.1 - 3.0.0 + 3.0.1 2.3.0 - 3.2.0 - 7.1.0 + 3.2.1 + 7.2.0 2.9.0 2.25.0 - 1.2.20 + 1.2.21 1.5.0 1.0 + 2.16.2 3.1.0 1.6.13 4.3.0 @@ -812,6 +813,11 @@ + + org.codehaus.mojo + versions-maven-plugin + ${versions-maven-plugin.version} + org.jetbrains.kotlin diff --git a/radiant/devs-codegen/pom.xml b/radiant/devs-codegen/pom.xml index 021494323..fd8a06734 100644 --- a/radiant/devs-codegen/pom.xml +++ b/radiant/devs-codegen/pom.xml @@ -41,7 +41,6 @@ ${devs-codegen.test.skip} - diff --git a/radiant/devs-coverage/pom.xml b/radiant/devs-coverage/pom.xml index be902af59..3fbfce8e3 100644 --- a/radiant/devs-coverage/pom.xml +++ b/radiant/devs-coverage/pom.xml @@ -24,97 +24,78 @@ pro.fessional.wings silencer - ${wings.version} pro.fessional.wings silencer-curse - ${wings.version} pro.fessional.wings silencer-jaxb - ${wings.version} pro.fessional.wings faceless - ${wings.version} pro.fessional.wings faceless-awesome - ${wings.version} pro.fessional.wings faceless-flywave - ${wings.version} pro.fessional.wings faceless-jooq - ${wings.version} pro.fessional.wings faceless-shard - ${wings.version} pro.fessional.wings slardar - ${wings.version} pro.fessional.wings slardar-hazel-caching - ${wings.version} pro.fessional.wings slardar-hazel-session - ${wings.version} pro.fessional.wings slardar-sprint - ${wings.version} pro.fessional.wings slardar-webmvc - ${wings.version} pro.fessional.wings warlock - ${wings.version} pro.fessional.wings warlock-awesome - ${wings.version} pro.fessional.wings warlock-bond - ${wings.version} pro.fessional.wings warlock-shadow - ${wings.version} pro.fessional.wings tiny-mail - ${wings.version} pro.fessional.wings tiny-task - ${wings.version} diff --git a/radiant/devs-mvndeps/pom.xml b/radiant/devs-mvndeps/pom.xml index e0175652d..186e5fc67 100644 --- a/radiant/devs-mvndeps/pom.xml +++ b/radiant/devs-mvndeps/pom.xml @@ -13,7 +13,7 @@ jar Radiant::Devs::Mvndeps - check dependency's version by maven-dependency-checker + mvn versions:display-dependency-updates or maven-dependency-checker true @@ -22,6 +22,11 @@ + + org.springframework.boot + spring-boot + ${spring-boot.version} + org.jetbrains @@ -60,6 +65,21 @@ ${joda-convert.version} + + pro.fessional + mirana + ${mirana.version} + + + pro.fessional + meepo + ${meepo.version} + + + pro.fessional + kaptcha + ${kaptcha.version} + com.alibaba.fastjson2 fastjson2 @@ -91,11 +111,13 @@ JustAuth ${justauth.version} + org.apache.shardingsphere shardingsphere-jdbc-core ${shardingsphere.version} + org.apache.servicecomb java-chassis-core @@ -133,4 +155,41 @@ ${druid.version} + + + + org.codehaus.mojo + versions-maven-plugin + + + org.springframework.boot:spring-boot + org.jetbrains:annotations + org.mapstruct:mapstruct-processor + com.google.guava:guava + commons-io:commons-io + org.apache.commons:commons-collections4 + org.apache.commons:commons-text + org.joda:joda-convert + pro.fessional:mirana + pro.fessional:meepo + pro.fessional:kaptcha + com.alibaba.fastjson2:fastjson2 + com.alibaba:fastjson + com.esotericsoftware:kryo + com.alibaba:transmittable-thread-local + org.bouncycastle:bcpkix-jdk18on + me.zhyd.oauth:JustAuth + org.apache.shardingsphere:shardingsphere-jdbc-core + org.apache.servicecomb:java-chassis-core + org.springdoc:springdoc-openapi-starter-webmvc-ui + de.codecentric:spring-boot-admin-starter-client + io.sentry:sentry-spring-boot-starter-jakarta + com.squareup.retrofit2:retrofit + io.qameta.allure:allure-java-commons + com.alibaba:druid-spring-boot-starter + + + + + diff --git a/radiant/tiny-task/src/main/java/pro/fessional/wings/tiny/task/service/impl/TinyTaskConfServiceImpl.java b/radiant/tiny-task/src/main/java/pro/fessional/wings/tiny/task/service/impl/TinyTaskConfServiceImpl.java index bb15d7a34..0758f05fe 100644 --- a/radiant/tiny-task/src/main/java/pro/fessional/wings/tiny/task/service/impl/TinyTaskConfServiceImpl.java +++ b/radiant/tiny-task/src/main/java/pro/fessional/wings/tiny/task/service/impl/TinyTaskConfServiceImpl.java @@ -42,6 +42,7 @@ import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.function.Function; @@ -419,41 +420,47 @@ private T fetchProp(Class claz, Function c private LinkedHashMap> diff(WinTaskDefine v1, TaskerProp v2) { LinkedHashMap> result = new LinkedHashMap<>(); - Diff.V.diff(result, "enabled", v1.getEnabled(), v2.isEnabled()); - Diff.V.diff(result, "autorun", v1.getAutorun(), v2.isAutorun()); - Diff.V.diff(result, "version", v1.getVersion(), v2.getVersion()); - - Diff.V.diff(result, "taskerBean", v1.getTaskerBean(), v2.getTaskerBean()); - Diff.V.diff(result, "taskerPara", v1.getTaskerPara(), v2.getTaskerPara()); - Diff.V.diff(result, "taskerName", v1.getTaskerName(), v2.getTaskerName()); - Diff.V.diff(result, "taskerFast", v1.getTaskerFast(), v2.isTaskerFast()); - Diff.V.diff(result, "taskerApps", v1.getTaskerApps(), v2.getTaskerApps()); - Diff.V.diff(result, "taskerRuns", v1.getTaskerRuns(), v2.getTaskerRuns()); - - Diff.V.diff(result, "noticeBean", v1.getNoticeBean(), v2.getNoticeBean()); - Diff.V.diff(result, "noticeWhen", v1.getNoticeWhen(), v2.getNoticeWhen()); - Diff.V.diff(result, "noticeConf", v1.getNoticeConf(), v2.getNoticeConf()); - - Diff.V.diff(result, "timingZone", v1.getTimingZone(), v2.getTimingZone()); - Diff.V.diff(result, "timingType", v1.getTimingType(), v2.getTimingType()); - Diff.V.diff(result, "timingCron", v1.getTimingCron(), v2.getTimingCron()); - Diff.V.diff(result, "timingIdle", v1.getTimingIdle(), v2.getTimingIdle()); - Diff.V.diff(result, "timingRate", v1.getTimingRate(), v2.getTimingRate()); - Diff.V.diff(result, "timingMiss", v1.getTimingMiss(), v2.getTimingMiss()); - Diff.V.diff(result, "timingBeat", v1.getTimingBeat(), v2.getTimingBeat()); - - Diff.V.diff(result, "duringFrom", v1.getDuringFrom(), v2.getDuringFrom()); - Diff.V.diff(result, "duringStop", v1.getDuringStop(), v2.getDuringStop()); - Diff.V.diff(result, "duringExec", v1.getDuringExec(), v2.getDuringExec()); - Diff.V.diff(result, "duringFail", v1.getDuringFail(), v2.getDuringFail()); - Diff.V.diff(result, "duringDone", v1.getDuringDone(), v2.getDuringDone()); - Diff.V.diff(result, "duringBoot", v1.getDuringBoot(), v2.getDuringBoot()); - - Diff.V.diff(result, "resultKeep", v1.getResultKeep(), v2.getResultKeep()); + diff(result, "enabled", v1.getEnabled(), v2.isEnabled()); + diff(result, "autorun", v1.getAutorun(), v2.isAutorun()); + diff(result, "version", v1.getVersion(), v2.getVersion()); + + diff(result, "taskerBean", v1.getTaskerBean(), v2.getTaskerBean()); + diff(result, "taskerPara", v1.getTaskerPara(), v2.getTaskerPara()); + diff(result, "taskerName", v1.getTaskerName(), v2.getTaskerName()); + diff(result, "taskerFast", v1.getTaskerFast(), v2.isTaskerFast()); + diff(result, "taskerApps", v1.getTaskerApps(), v2.getTaskerApps()); + diff(result, "taskerRuns", v1.getTaskerRuns(), v2.getTaskerRuns()); + + diff(result, "noticeBean", v1.getNoticeBean(), v2.getNoticeBean()); + diff(result, "noticeWhen", v1.getNoticeWhen(), v2.getNoticeWhen()); + diff(result, "noticeConf", v1.getNoticeConf(), v2.getNoticeConf()); + + diff(result, "timingZone", v1.getTimingZone(), v2.getTimingZone()); + diff(result, "timingType", v1.getTimingType(), v2.getTimingType()); + diff(result, "timingCron", v1.getTimingCron(), v2.getTimingCron()); + diff(result, "timingIdle", v1.getTimingIdle(), v2.getTimingIdle()); + diff(result, "timingRate", v1.getTimingRate(), v2.getTimingRate()); + diff(result, "timingMiss", v1.getTimingMiss(), v2.getTimingMiss()); + diff(result, "timingBeat", v1.getTimingBeat(), v2.getTimingBeat()); + + diff(result, "duringFrom", v1.getDuringFrom(), v2.getDuringFrom()); + diff(result, "duringStop", v1.getDuringStop(), v2.getDuringStop()); + diff(result, "duringExec", v1.getDuringExec(), v2.getDuringExec()); + diff(result, "duringFail", v1.getDuringFail(), v2.getDuringFail()); + diff(result, "duringDone", v1.getDuringDone(), v2.getDuringDone()); + diff(result, "duringBoot", v1.getDuringBoot(), v2.getDuringBoot()); + + diff(result, "resultKeep", v1.getResultKeep(), v2.getResultKeep()); return result; } + public void diff(Map> map, K key, T t1, T t2) { + if (!Objects.equals(t1, t2)) { + map.put(key, Diff.v(t1, t2)); + } + } + public enum Jane { Insert, Update, diff --git a/wings/silencer/src/test/java/pro/fessional/wings/silencer/i18n/MessageModuleTest.java b/wings/silencer/src/test/java/pro/fessional/wings/silencer/i18n/MessageModuleTest.java index 8b2849d9c..2f9303fbd 100644 --- a/wings/silencer/src/test/java/pro/fessional/wings/silencer/i18n/MessageModuleTest.java +++ b/wings/silencer/src/test/java/pro/fessional/wings/silencer/i18n/MessageModuleTest.java @@ -37,13 +37,13 @@ void modulePropAndLangTag() { @TmsLink("C11002") void messageOfStandard() { // use lang - String cn = messageSource.getMessage("base.not-empty", Arr.of("姓名"), Locale.CHINA); + String cn = messageSource.getMessage("base.not-empty", Arr.obj("姓名"), Locale.CHINA); // use default - String en = messageSource.getMessage("base.not-empty", Arr.of("name"), Locale.US); + String en = messageSource.getMessage("base.not-empty", Arr.obj("name"), Locale.US); // use lang and region - String tw = messageSource.getMessage("base.not-empty", Arr.of("姓名"), Locale.TAIWAN); + String tw = messageSource.getMessage("base.not-empty", Arr.obj("姓名"), Locale.TAIWAN); // use default - String jp = messageSource.getMessage("base.not-empty", Arr.of("name"), Locale.JAPAN); + String jp = messageSource.getMessage("base.not-empty", Arr.obj("name"), Locale.JAPAN); assertEquals("姓名 不能为空", cn); assertEquals("name can not be empty", en); @@ -55,13 +55,13 @@ void messageOfStandard() { @TmsLink("C11003") void messageOfPartial() { // use lang - String zh = messageSource.getMessage("base.not-empty", Arr.of("姓名"), Locale.forLanguageTag("zh")); + String zh = messageSource.getMessage("base.not-empty", Arr.obj("姓名"), Locale.forLanguageTag("zh")); // use default - String en = messageSource.getMessage("base.not-empty", Arr.of("name"), Locale.forLanguageTag("en")); + String en = messageSource.getMessage("base.not-empty", Arr.obj("name"), Locale.forLanguageTag("en")); // use lang and region - String tw = messageSource.getMessage("base.not-empty", Arr.of("姓名"), Locale.forLanguageTag("zh-TW")); + String tw = messageSource.getMessage("base.not-empty", Arr.obj("姓名"), Locale.forLanguageTag("zh-TW")); // use default - String jp = messageSource.getMessage("base.not-empty", Arr.of("name"), Locale.forLanguageTag("jp")); + String jp = messageSource.getMessage("base.not-empty", Arr.obj("name"), Locale.forLanguageTag("jp")); assertEquals("姓名 不能为空", zh); assertEquals("name can not be empty", en); diff --git a/wings/slardar-webmvc/src/test/java/pro/fessional/wings/slardar/json/WingsJacksonMapperTest.java b/wings/slardar-webmvc/src/test/java/pro/fessional/wings/slardar/json/WingsJacksonMapperTest.java index 035642013..ec4fc6ce2 100644 --- a/wings/slardar-webmvc/src/test/java/pro/fessional/wings/slardar/json/WingsJacksonMapperTest.java +++ b/wings/slardar-webmvc/src/test/java/pro/fessional/wings/slardar/json/WingsJacksonMapperTest.java @@ -426,7 +426,7 @@ public void testStringMapHelper() { assertEquals("{code=base.not-empty, codeIgnore=base.not-empty, codeManual={0} can not be empty, hint=, i18n=textAuto can not be empty, ikey=ival, longIgnore=0, textAuto=textAuto can not be empty}", j1.toString()); assertEquals("{Map=1, bool-val=false, decimalVal=3.3, doubleVal=2.2, floatVal=1.1, instantVal=2020-06-01T12:34:46Z, intVal=2147483646, listVal=List, localDateTimeVal=2020-06-01 12:34:46, localDateVal=2020-06-01, localTimeVal=12:34:46, longVal=9223372036854775806, zonedDateTimeVal=2020-06-01 13:34:46 Asia/Tokyo, zonedDateTimeValV=2020-06-01 13:34:46.000 Asia/Tokyo, zonedDateTimeValZ=2020-06-01 13:34:46.000 +0900}", j2.toString()); - assertEquals("{codeIgnore=base.not-empty, codeManual=base.not-empty, key=ikey, longIgnore=0, value=ival}", x1.toString()); + assertEquals("{codeIgnore=base.not-empty, codeManual=base.not-empty, hint=, key=ikey, longIgnore=0, value=ival}", x1.toString()); assertEquals("{boolVal=false, decimalVal=3.3, doubleVal=2.2, floatVal=1.1, intVal=2147483646, key=Map, listVal=List, longVal=9223372036854775806, value=1}", x2.toString()); } From 025e0fc125250a5182dc462f379055c4a74c4a23 Mon Sep 17 00:00:00 2001 From: trydofor Date: Wed, 31 Jan 2024 11:25:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=85=20auto=20dryrun=20if=20no=20email?= =?UTF-8?q?=20prop=20#196?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 13 ++++---- observe/meepo | 2 +- observe/mirana | 2 +- pom.xml | 2 -- radiant/devs-codegen/pom.xml | 13 -------- .../wings/tiny/mail/TestingMailUtil.java | 33 +++++++++++++++++++ .../tiny/mail/sender/MailNoticeTest.java | 16 ++++----- .../mail/sender/MailSenderManagerTest.java | 19 +++++++---- .../mail/service/TinyMailServiceTest.java | 11 +++++-- 9 files changed, 71 insertions(+), 40 deletions(-) create mode 100644 radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/TestingMailUtil.java diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f37dd1917..be5737349 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,5 @@ name: Release-To-OssRh -run-name: Release ${{github.ref_name}} by @${{ github.event_name }} +run-name: Release ${{ github.ref_name }} by @${{ github.event_name }} on: workflow_dispatch: @@ -43,7 +43,7 @@ jobs: TEST_VERBOSE: ${{ inputs.testLoggerLevel == 'DEBUG' }} steps: - - name: Checkout ${{github.event.release.tag_name}} + - name: Checkout ${{ github.event.release.tag_name }} uses: actions/checkout@v4 with: fetch-depth: 10 @@ -56,13 +56,13 @@ jobs: path: | ~/.asdf/ ~/.m2/repository/ - key: asdf-m2-repo-${{hashFiles('.tool-versions')}} + key: asdf-m2-repo-${{ hashFiles('pom.xml') }} ## install jdk and maven - name: Install asdf & tools uses: asdf-vm/actions/install@v3 with: - skip_install: ${{steps.cache-sdk-repo.outputs.cache-hit == 'true'}} + skip_install: ${{ steps.cache-sdk-repo.outputs.cache-hit == 'true' }} ## write settings.xml - name: Maven settings.xml @@ -112,8 +112,9 @@ jobs: - name: Test Coverage ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }} if: steps.settings.outputs.MVN_COVERAGE == 'true' run: | - mvn -pl ':devs-codegen' -am -Ddevs-codegen.test.skip=false -Ddevs-initdb=true -Dwings.test.skip=true clean test - mvn -P 'coverage,!example' -Dmaven.test.failure.ignore=${{ inputs.testFailureIgnore }} clean test + mvn -P '!example,!devs' -Dmaven.test.skip=true clean install + mvn -pl ':devs-codegen' -Ddevs-initdb=true clean test + mvn -P 'coverage,!example,!devs' -Dmaven.test.failure.ignore=${{ inputs.testFailureIgnore }} test mvn -pl ':devs-coverage' -am jacoco:report-aggregate mvn -pl ':devs-coverage' -DrepoToken=$COVERALLS_WINGS verify env: diff --git a/observe/meepo b/observe/meepo index c5e58c49a..7c961ca25 160000 --- a/observe/meepo +++ b/observe/meepo @@ -1 +1 @@ -Subproject commit c5e58c49ae61b77ea973ee77b0e8fe6e87026cdd +Subproject commit 7c961ca250c80265b994ba1d98c977c81ddb3e3b diff --git a/observe/mirana b/observe/mirana index 9bfe8f87e..4d071334e 160000 --- a/observe/mirana +++ b/observe/mirana @@ -1 +1 @@ -Subproject commit 9bfe8f87ee1a4a744d187bc63d16b58177f8f8aa +Subproject commit 4d071334e2fbfd26b09a30e614d801a4966b7900 diff --git a/pom.xml b/pom.xml index df5b913d7..f1186b9fd 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,6 @@ 21 - false true false @@ -533,7 +532,6 @@ maven-surefire-plugin ${maven-surefire-plugin.version} - ${wings.test.skip} ${wings.rootdir} diff --git a/radiant/devs-codegen/pom.xml b/radiant/devs-codegen/pom.xml index fd8a06734..596107f7e 100644 --- a/radiant/devs-codegen/pom.xml +++ b/radiant/devs-codegen/pom.xml @@ -16,7 +16,6 @@ generate the wings auto-gen code automatically - true true true @@ -31,16 +30,4 @@ testing-faceless - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - ${devs-codegen.test.skip} - - - - diff --git a/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/TestingMailUtil.java b/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/TestingMailUtil.java new file mode 100644 index 000000000..dd82ff7d1 --- /dev/null +++ b/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/TestingMailUtil.java @@ -0,0 +1,33 @@ +package pro.fessional.wings.tiny.mail; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.boot.autoconfigure.mail.MailProperties; + +/** + * @author trydofor + * @since 2024-01-30 + */ +public class TestingMailUtil { + + public static final String DRYRUN = "[DRYRUN]"; + + public static String dryrun(String sub, MailProperties prop) { + return dryrun(sub, isDryrun(prop)); + } + + public static String dryrun(String sub, boolean isDryrun) { + return isDryrun ? dryrun(sub) : sub; + } + + public static String dryrun(String sub) { + return DRYRUN + sub; + } + + public static boolean isDryrun(MailProperties prop) { + return prop == null + || StringUtils.isEmpty(prop.getHost()) + || StringUtils.isEmpty(prop.getUsername()) + || StringUtils.isEmpty(prop.getPassword()) + ; + } +} diff --git a/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/sender/MailNoticeTest.java b/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/sender/MailNoticeTest.java index 628d880fa..a66fa461f 100644 --- a/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/sender/MailNoticeTest.java +++ b/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/sender/MailNoticeTest.java @@ -8,9 +8,11 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.mail.MailProperties; import org.springframework.boot.test.context.SpringBootTest; import pro.fessional.mirana.time.StopWatch; import pro.fessional.wings.testing.silencer.TestingLoggerAssert; +import pro.fessional.wings.tiny.mail.TestingMailUtil; import java.util.Collections; @@ -31,11 +33,8 @@ public class MailNoticeTest { @Setter(onMethod_ = {@Autowired}) protected MailConfigProvider mailConfigProvider; - @Setter(onMethod_ = {@Value("${spring.mail.username:}")}) - protected String mailUser; - - @Setter(onMethod_ = {@Value("${spring.mail.password:}")}) - protected String mailPass; + @Setter(onMethod_ = {@Autowired}) + protected MailProperties mailProperties; @Setter(onMethod_ = {@Value("${GMAIL_USER:}")}) protected String gmailUser; @@ -46,8 +45,9 @@ public class MailNoticeTest { @Test @TmsLink("C15001") public void postMailNotice() { - final boolean snd = mailNotice.post("test tiny mail send", "test send"); - Assertions.assertTrue(snd, "need env MAIL_USER, MAIL_PASS, current user=" + mailUser); + String subject = TestingMailUtil.dryrun("test tiny mail send", mailProperties); + final boolean snd = mailNotice.post(subject, "test send"); + Assertions.assertTrue(snd, "need env MAIL_USER, MAIL_PASS, current user=" + mailProperties.getUsername()); } @Test @@ -57,7 +57,7 @@ public void postMailNoticeDryrun() { al.rule("single dryrun", it -> it.getFormattedMessage().contains("single mail dryrun and sleep")); al.start(); - mailNotice.post("[DRYRUN] test tiny mail send", "test send"); + mailNotice.post(TestingMailUtil.dryrun("test tiny mail send"), "test send"); al.assertCount(1); al.stop(); diff --git a/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/sender/MailSenderManagerTest.java b/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/sender/MailSenderManagerTest.java index 08aa813eb..f56bad44e 100644 --- a/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/sender/MailSenderManagerTest.java +++ b/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/sender/MailSenderManagerTest.java @@ -8,6 +8,7 @@ import org.springframework.boot.test.context.SpringBootTest; import pro.fessional.mirana.time.StopWatch; import pro.fessional.wings.testing.silencer.TestingLoggerAssert; +import pro.fessional.wings.tiny.mail.TestingMailUtil; import java.util.ArrayList; import java.util.List; @@ -49,18 +50,21 @@ public class MailSenderManagerTest { @Test @TmsLink("C15004") public void timeLoopAndBatch() { - int size = 1; // auto test 1, manual 5 final TinyMailConfig config = mailConfigProvider.defaultConfig(); - final StopWatch stopWatch = new StopWatch(); + final boolean dryrun = TestingMailUtil.isDryrun(config); + // Too many emails per second. Please upgrade your plan + final int size = dryrun ? 1 : 5; + final StopWatch stopWatch = new StopWatch(); try (final StopWatch.Watch ignored = stopWatch.start("single")) { for (int i = 0; i < size; i++) { TinyMailMessage message = new TinyMailMessage(); message.adopt(config); - message.setSubject("test single tiny mail " + i); - message.setContent("test single tiny mail " + i); + String text = "test single tiny mail " + i; + message.setSubject(TestingMailUtil.dryrun(text, dryrun)); + message.setContent(text); log.info("single {} send start ====", i); mailSenderManager.singleSend(message); log.info("single {} send done ====", i); @@ -73,8 +77,9 @@ public void timeLoopAndBatch() { for (int i = 0; i < size; i++) { TinyMailMessage message = new TinyMailMessage(); message.adopt(config); - message.setSubject("test batch tiny mail " + i); - message.setContent("test batch tiny mail " + i); + String text = "test batch tiny mail " + i; + message.setSubject(TestingMailUtil.dryrun(text, dryrun)); + message.setContent(text); messages.add(message); } log.info("batch {} send start ====", size); @@ -105,7 +110,7 @@ public void batchMailDryrun() { for (int i = 0; i < 2; i++) { TinyMailMessage message = new TinyMailMessage(); message.adopt(config); - message.setSubject("[DRYRUN] test batch tiny mail " + i); + message.setSubject(TestingMailUtil.dryrun("test batch tiny mail " + i)); message.setContent("test batch tiny mail " + i); messages.add(message); } diff --git a/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/service/TinyMailServiceTest.java b/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/service/TinyMailServiceTest.java index 1fd6eac77..e39c8c7ac 100644 --- a/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/service/TinyMailServiceTest.java +++ b/radiant/tiny-mail/src/test/java/pro/fessional/wings/tiny/mail/service/TinyMailServiceTest.java @@ -8,10 +8,12 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.mail.MailProperties; import org.springframework.boot.test.context.SpringBootTest; import pro.fessional.mirana.pain.ThrowableUtil; import pro.fessional.mirana.time.Sleep; import pro.fessional.wings.slardar.context.Now; +import pro.fessional.wings.tiny.mail.TestingMailUtil; /** * @author trydofor @@ -26,11 +28,15 @@ class TinyMailServiceTest { @Setter(onMethod_ = {@Autowired}) protected TinyMailService tinyMailService; + @Setter(onMethod_ = {@Autowired}) + protected MailProperties mailProperties; + @Test @TmsLink("C15006") void sendMailOk() { TinyMail message = new TinyMail(); - message.setSubject("Mail Service Test"); + String subject = TestingMailUtil.dryrun("Mail Service Send Test", mailProperties); + message.setSubject(subject); message.setContentHtml("Nothing"); message.setMark("wings tiny mail"); boolean ok = tinyMailService.send(message, true); @@ -41,7 +47,8 @@ void sendMailOk() { @TmsLink("C15007") void emitMailAfter5s() { TinyMail message = new TinyMail(); - message.setSubject("Mail Service Test"); + String subject = TestingMailUtil.dryrun("Mail Service Emit Test", mailProperties); + message.setSubject(subject); message.setContentHtml("Nothing"); message.setMark("wings tiny mail");