From 187ea5ffd26cb026069606092237add399852a61 Mon Sep 17 00:00:00 2001 From: trydofor Date: Thu, 1 Feb 2024 15:40:34 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20java=20instead=20of=20?= =?UTF-8?q?xml=20in=20jooq=20codegen=20#198?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- observe/docs | 2 +- observe/meepo | 2 +- observe/mirana | 2 +- .../faceless/jooqgen/WingsCodeGenerator.java | 91 ++++++++++++++++++- .../jooqgen/WingsCodeGeneratorTest.java | 29 ++++++ .../wings-flywave/jooq-codegen-faceless.xml | 4 +- 6 files changed, 122 insertions(+), 8 deletions(-) create mode 100644 wings/faceless-codegen/src/test/java/pro/fessional/wings/faceless/jooqgen/WingsCodeGeneratorTest.java rename wings/faceless-codegen/src/{main => test}/resources/wings-flywave/jooq-codegen-faceless.xml (97%) diff --git a/observe/docs b/observe/docs index e3eae7203..1f416c6d4 160000 --- a/observe/docs +++ b/observe/docs @@ -1 +1 @@ -Subproject commit e3eae720319647e7fadc07b43eeff3785cb742cd +Subproject commit 1f416c6d4a2e1a97c8819f08c0370976c2ea6b19 diff --git a/observe/meepo b/observe/meepo index 7c961ca25..a0fdad6bf 160000 --- a/observe/meepo +++ b/observe/meepo @@ -1 +1 @@ -Subproject commit 7c961ca250c80265b994ba1d98c977c81ddb3e3b +Subproject commit a0fdad6bf6707516a39c7f64021bb2d6acb2c30a diff --git a/observe/mirana b/observe/mirana index 4d071334e..1fdfa90c0 160000 --- a/observe/mirana +++ b/observe/mirana @@ -1 +1 @@ -Subproject commit 4d071334e2fbfd26b09a30e614d801a4966b7900 +Subproject commit 1fdfa90c01ecbe38f970cbdbe93f68630bb71206 diff --git a/wings/faceless-codegen/src/main/java/pro/fessional/wings/faceless/jooqgen/WingsCodeGenerator.java b/wings/faceless-codegen/src/main/java/pro/fessional/wings/faceless/jooqgen/WingsCodeGenerator.java index 9868147b2..eb893a56f 100644 --- a/wings/faceless-codegen/src/main/java/pro/fessional/wings/faceless/jooqgen/WingsCodeGenerator.java +++ b/wings/faceless-codegen/src/main/java/pro/fessional/wings/faceless/jooqgen/WingsCodeGenerator.java @@ -8,6 +8,12 @@ import org.jooq.meta.jaxb.Configuration; import org.jooq.meta.jaxb.Database; import org.jooq.meta.jaxb.ForcedType; +import org.jooq.meta.jaxb.Generate; +import org.jooq.meta.jaxb.Generator; +import org.jooq.meta.jaxb.Jdbc; +import org.jooq.meta.jaxb.Logging; +import org.jooq.meta.jaxb.Strategy; +import org.jooq.meta.jaxb.Target; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; @@ -48,7 +54,6 @@ */ public class WingsCodeGenerator { - public static final String JOOQ_XML = "/wings-flywave/jooq-codegen-faceless.xml"; private static final Logger log = LoggerFactory.getLogger(WingsCodeGenerator.class); /** @@ -59,7 +64,8 @@ public class WingsCodeGenerator { * @param suffix Add suffixes to DefaultCatalog, DefaultSchema and Global to distinguish generation. */ - @SuppressWarnings("resource") public static void generate(Configuration conf, boolean incremental, String suffix) { + @SuppressWarnings("resource") + public static void generate(Configuration conf, boolean incremental, String suffix) { if (conf == null) { conf = config(); } @@ -101,9 +107,88 @@ public static Builder builder(Configuration conf) { return new Builder(conf == null ? config() : conf); } + /** + * the default wings mysql configuration + */ @NotNull public static Configuration config() { - return config(WingsCodeGenerator.class.getResourceAsStream(JOOQ_XML)); + Configuration conf = new Configuration(); + conf.withLogging(Logging.INFO); + conf.withJdbc(new Jdbc() + .withDriver("com.mysql.cj.jdbc.Driver") + .withUrl("!!your-config-here!!") + .withUser("!!your-config-here!!") + .withPassword("!!your-config-here!!")); + conf.withGenerator(new Generator() + .withName(WingsJavaGenerator.class.getName()) + .withTarget(new Target() + .withPackageName("!!your-config-here!!") + .withDirectory("!!your-config-here!!")) + .withDatabase(new Database() + .withInputSchema("!!your-config-here!!") + .withOutputCatalogToDefault(true) + .withOutputSchemaToDefault(true) + .withIncludes(".*") + .withExcludes(""" + spring.* # Spring table + |.*__[a-z]* # journal table + |.*\\$[a-z]* # journal table + |sys_commit_journal # jdbc handled + |sys_light_sequence # jdbc handled + |sys_schema_journal # jdbc handled + |sys_schema_version # jdbc handled + """) + .withSchemaVersionProvider("SELECT MAX(revision) FROM sys_schema_version WHERE apply_dt > '1000-01-01'") + .withIncludeTables(true) + .withIncludeRoutines(false) + .withIncludePackages(false) + .withIncludePackageRoutines(false) + .withIncludePackageUDTs(false) + .withIncludePackageConstants(false) + .withIncludeUDTs(false) + .withIncludeSequences(false) + .withIncludePrimaryKeys(true) + .withIncludeUniqueKeys(false) + .withIncludeForeignKeys(false) + .withIncludeCheckConstraints(false) + .withIncludeIndexes(false) + .withForcedTypes( + new ForcedType().withName("BOOLEAN").withIncludeTypes("TINYINT(\\(1\\))?"), + new ForcedType().withName("INTEGER").withIncludeTypes("TINYINT[2-9()]*") + ) + ) + .withGenerate(new Generate() + .withComments(false) + .withEmptyCatalogs(true) + .withEmptySchemas(true) + .withIndexes(false) + // JavaEE / JakartaEE + .withSpringAnnotations(true) + .withJpaAnnotations(false) + + .withValidationAnnotations(false) + .withJavaTimeTypes(true) + .withKeys(false) + .withInterfaces(true) + .withDaos(true) + .withPojos(true) + .withPojosEqualsAndHashCode(true) + .withPojosToString(true) + // Don't open it. or the JournalAware will not work well. column editing is good for setter assignment. + .withFluentSetters(false) + + .withGlobalCatalogReferences(false) + .withGlobalSchemaReferences(false) + .withGlobalTableReferences(true) + .withGlobalSequenceReferences(false) + .withGlobalUDTReferences(false) + .withGlobalRoutineReferences(false) + .withGlobalQueueReferences(false) + .withGlobalLinkReferences(false) + ) + .withStrategy(new Strategy().withName(WingsJavaStrategy.class.getName())) + ); + return conf; } @NotNull diff --git a/wings/faceless-codegen/src/test/java/pro/fessional/wings/faceless/jooqgen/WingsCodeGeneratorTest.java b/wings/faceless-codegen/src/test/java/pro/fessional/wings/faceless/jooqgen/WingsCodeGeneratorTest.java new file mode 100644 index 000000000..78f77e640 --- /dev/null +++ b/wings/faceless-codegen/src/test/java/pro/fessional/wings/faceless/jooqgen/WingsCodeGeneratorTest.java @@ -0,0 +1,29 @@ +package pro.fessional.wings.faceless.jooqgen; + +import lombok.extern.slf4j.Slf4j; +import org.jooq.meta.jaxb.Configuration; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + * @author trydofor + * @since 2024-02-01 + */ +@Slf4j +class WingsCodeGeneratorTest { + + @Test + void config() { + Configuration c1 = WingsCodeGenerator.config(); + Configuration c2 = WingsCodeGenerator.config(WingsCodeGeneratorTest.class.getResourceAsStream("/wings-flywave/jooq-codegen-faceless.xml")); + String s1 = c1.toString(); + String s2 = c2.toString(); + log.debug("java config={}", s1); + log.debug("xml config={}", s2); + Assertions.assertEquals(format(s1), format(s2)); + } + + String format(String str){ + return str.replaceAll("\\s+", "").replace("<","\n<"); + } +} \ No newline at end of file diff --git a/wings/faceless-codegen/src/main/resources/wings-flywave/jooq-codegen-faceless.xml b/wings/faceless-codegen/src/test/resources/wings-flywave/jooq-codegen-faceless.xml similarity index 97% rename from wings/faceless-codegen/src/main/resources/wings-flywave/jooq-codegen-faceless.xml rename to wings/faceless-codegen/src/test/resources/wings-flywave/jooq-codegen-faceless.xml index 202376c79..8754454be 100644 --- a/wings/faceless-codegen/src/main/resources/wings-flywave/jooq-codegen-faceless.xml +++ b/wings/faceless-codegen/src/test/resources/wings-flywave/jooq-codegen-faceless.xml @@ -1,8 +1,8 @@ - + INFO - !!your-config-here!! + com.mysql.cj.jdbc.Driver !!your-config-here!! !!your-config-here!! !!your-config-here!! From 16af76001b96a306fec8db83b5735a9f108be1b1 Mon Sep 17 00:00:00 2001 From: trydofor Date: Thu, 1 Feb 2024 15:50:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20update=20hazelcast=20x?= =?UTF-8?q?sd=20version=20#199?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/extra-conf/hazelcast-client.xml | 2 +- .../src/main/resources/extra-conf/hazelcast-server.xml | 4 ++-- .../main/resources/extra-conf/hazelcast-server-bootadmin.xml | 2 +- .../main/resources/extra-conf/hazelcast-server-session.xml | 2 +- .../src/main/resources/extra-conf/hazelcast-server-webmvc.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wings/slardar-hazel-caching/src/main/resources/extra-conf/hazelcast-client.xml b/wings/slardar-hazel-caching/src/main/resources/extra-conf/hazelcast-client.xml index 83612d6ca..e8add326d 100644 --- a/wings/slardar-hazel-caching/src/main/resources/extra-conf/hazelcast-client.xml +++ b/wings/slardar-hazel-caching/src/main/resources/extra-conf/hazelcast-client.xml @@ -3,7 +3,7 @@ + http://www.hazelcast.com/schema/client-config/hazelcast-client-config-5.3.xsd"> ${wings.slardar.hazelcast.cluster-name} diff --git a/wings/slardar-hazel-caching/src/main/resources/extra-conf/hazelcast-server.xml b/wings/slardar-hazel-caching/src/main/resources/extra-conf/hazelcast-server.xml index 72af9ca95..c0ebe40f7 100644 --- a/wings/slardar-hazel-caching/src/main/resources/extra-conf/hazelcast-server.xml +++ b/wings/slardar-hazel-caching/src/main/resources/extra-conf/hazelcast-server.xml @@ -3,11 +3,11 @@ + http://www.hazelcast.com/schema/config/hazelcast-config-5.3.xsd"> ${wings.slardar.hazelcast.cluster-name} - + diff --git a/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-bootadmin.xml b/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-bootadmin.xml index 85db4fe59..272eea1b6 100644 --- a/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-bootadmin.xml +++ b/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-bootadmin.xml @@ -3,7 +3,7 @@ + http://www.hazelcast.com/schema/config/hazelcast-config-5.3.xsd"> OBJECT diff --git a/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-session.xml b/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-session.xml index e9261b4d1..c0ffb85f2 100644 --- a/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-session.xml +++ b/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-session.xml @@ -3,7 +3,7 @@ + http://www.hazelcast.com/schema/config/hazelcast-config-5.3.xsd"> diff --git a/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-webmvc.xml b/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-webmvc.xml index a737c8243..ff367d241 100644 --- a/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-webmvc.xml +++ b/wings/slardar-hazel-session/src/main/resources/extra-conf/hazelcast-server-webmvc.xml @@ -3,7 +3,7 @@ + http://www.hazelcast.com/schema/config/hazelcast-config-5.3.xsd"> From 6c83afae755323e0e43dfcc4488de6b2ed84173d Mon Sep 17 00:00:00 2001 From: trydofor Date: Sat, 3 Feb 2024 12:10:23 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20update=20wings-docker?= =?UTF-8?q?=20#200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 11 +++++- ...mo-init.sql => 2022-0222u01-demo-init.sql} | 0 ...mo-init.sql => 2022-0222v01-demo-init.sql} | 0 .../devops/init/WingsInitProjectUtil.java | 6 +-- .../project/Devops1SchemaManagerTest.java | 4 +- .../project/Devops5JournalManagerTest.java | 2 +- observe/docker/mysql/conf/wings.cnf | 10 ++++- observe/docker/mysql/init/2-data.sql | 1 + observe/docs | 2 +- observe/scripts/wings-docker.sh | 24 ++++++++---- observe/scripts/wings-starter.sh | 32 ++++++++++++---- .../wings/devs/init/DatabaseExampleTest.java | 37 +++++++++++++++++++ .../wings/devs/init/DatabaseFacelessTest.java | 8 ++-- .../wings/devs/init/DatabaseShard0Test.java | 8 ++-- .../wings/devs/init/DatabaseShard1Test.java | 8 ++-- .../wings/devs/init/DatabaseWingsTest.java | 2 +- .../wings/faceless/flywave/WingsRevision.java | 5 ++- .../faceless/flywave/WingsRevisionTest.java | 4 +- .../sample/TestWingsInitDatabaseSample.java | 4 +- .../TestWingsSchemaGeneratorSample.java | 4 +- .../util/FlywaveRevisionScannerTest.java | 16 ++++---- .../flywave/SchemaJournalManagerTest.kt | 2 +- .../flywave/SchemaRevisionMangerTest.kt | 2 +- .../TestWingsFlywaveInitDatabaseSample.kt | 2 +- .../TestWingsFlywaveShardJournalSample.kt | 4 +- .../jooq/WingsJooqDaoAliasImplTest.java | 4 +- .../faceless/jooq/JooqDeleteListenerTest.java | 4 +- .../jooq/JooqMapperCompatibleTest.java | 2 +- .../jooq/JooqTableCudListenerTest.java | 4 +- .../jooq/TransactionalServiceTest.java | 4 +- .../sample/TestJooqDslAndDaoSample.java | 4 +- .../sample/TestJooqMostSelectSample.java | 4 +- .../faceless/flywave/FlywaveShardingTest.java | 8 ++-- .../wings/faceless/jooq/JooqShardingTest.java | 4 +- ...0601u01-test.sql => 2022-0601u01-test.sql} | 0 ...0601u02-test.sql => 2022-0601u02-test.sql} | 0 ...0601v01-test.sql => 2022-0601v01-test.sql} | 0 ...0601v02-test.sql => 2022-0601v02-test.sql} | 0 38 files changed, 157 insertions(+), 79 deletions(-) rename example/winx-common/src/main/resources/wings-flywave/master/00-init/{9999-99-99u01-demo-init.sql => 2022-0222u01-demo-init.sql} (100%) rename example/winx-common/src/main/resources/wings-flywave/master/00-init/{9999-99-99v01-demo-init.sql => 2022-0222v01-demo-init.sql} (100%) create mode 100644 radiant/devs-codegen/src/test/java/pro/fessional/wings/devs/init/DatabaseExampleTest.java rename wings/testing-faceless/src/main/resources/wings-flywave/master/{20190601u01-test.sql => 2022-0601u01-test.sql} (100%) rename wings/testing-faceless/src/main/resources/wings-flywave/master/{20190601u02-test.sql => 2022-0601u02-test.sql} (100%) rename wings/testing-faceless/src/main/resources/wings-flywave/master/{20190601v01-test.sql => 2022-0601v01-test.sql} (100%) rename wings/testing-faceless/src/main/resources/wings-flywave/master/{20190601v02-test.sql => 2022-0601v02-test.sql} (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be5737349..1f6ae3d4f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,11 @@ on: default: false type: boolean required: false + testVerifyDryRun: + description: 'dryrun coverage report?' + default: false + type: boolean + required: false testLoggerLevel: description: 'test logger level' default: INFO @@ -114,13 +119,15 @@ jobs: run: | 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 -P 'coverage,!example,!devs' -Dmaven.test.failure.ignore=$TESTFAILS_IGNORE test mvn -pl ':devs-coverage' -am jacoco:report-aggregate - mvn -pl ':devs-coverage' -DrepoToken=$COVERALLS_WINGS verify + mvn -pl ':devs-coverage' -DrepoToken=$COVERALLS_WINGS -DdryRun=$COVERALLS_DRYRUN verify env: TZ: Asia/Shanghai JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }} COVERALLS_WINGS: ${{ secrets.COVERALLS_REPO_TOKEN }} + COVERALLS_DRYRUN: ${{ inputs.testVerifyDryRun || 'false' }} + TESTFAILS_IGNORE: ${{ inputs.testFailureIgnore || 'false' }} ## import gpp private key - name: Import GPG key diff --git a/example/winx-common/src/main/resources/wings-flywave/master/00-init/9999-99-99u01-demo-init.sql b/example/winx-common/src/main/resources/wings-flywave/master/00-init/2022-0222u01-demo-init.sql similarity index 100% rename from example/winx-common/src/main/resources/wings-flywave/master/00-init/9999-99-99u01-demo-init.sql rename to example/winx-common/src/main/resources/wings-flywave/master/00-init/2022-0222u01-demo-init.sql diff --git a/example/winx-common/src/main/resources/wings-flywave/master/00-init/9999-99-99v01-demo-init.sql b/example/winx-common/src/main/resources/wings-flywave/master/00-init/2022-0222v01-demo-init.sql similarity index 100% rename from example/winx-common/src/main/resources/wings-flywave/master/00-init/9999-99-99v01-demo-init.sql rename to example/winx-common/src/main/resources/wings-flywave/master/00-init/2022-0222v01-demo-init.sql diff --git a/example/winx-devops/src/main/java/com/moilioncircle/wings/devops/init/WingsInitProjectUtil.java b/example/winx-devops/src/main/java/com/moilioncircle/wings/devops/init/WingsInitProjectUtil.java index 1d16efb0b..52de25e02 100644 --- a/example/winx-devops/src/main/java/com/moilioncircle/wings/devops/init/WingsInitProjectUtil.java +++ b/example/winx-devops/src/main/java/com/moilioncircle/wings/devops/init/WingsInitProjectUtil.java @@ -190,9 +190,9 @@ private static String replaceDate999(String text) { final String ymd1 = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); final String ymd2 = now.format(DateTimeFormatter.ofPattern("yyyy_MMdd")); final String ymh = now.format(DateTimeFormatter.ofPattern("yyyy_MMdd_HHmm")); - return text.replace("9999-99-99", ymd1) - .replace("9999_9999_01L", ymd2 + "_01L") - .replace("9999_9999_9999L", ymh + "_01L") + return text.replace("2022-02-22", ymd1) + .replace("2022_0222_01L", ymd2 + "_01L") + .replace("2022_0222_2222L", ymh + "_01L") ; } diff --git a/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops1SchemaManagerTest.java b/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops1SchemaManagerTest.java index 6c6730aa3..abf306b33 100644 --- a/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops1SchemaManagerTest.java +++ b/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops1SchemaManagerTest.java @@ -31,7 +31,7 @@ class Devops1SchemaManagerTest { void initSchema() { final Warlock1SchemaManager manager = new Warlock1SchemaManager(schemaRevisionManager); // manager.init(WingsRevision.V04_20_1024_02_RolePermit.revision(), - manager.mergePublish(9999_9999_01L, + manager.mergePublish(2022_0222_01L, includeWarlockPath(), Helper::master ); @@ -39,7 +39,7 @@ void initSchema() { @Test void resetSchema() { - long revi = 9999_9999_01L; + long revi = 2022_0222_01L; final Warlock1SchemaManager manager = new Warlock1SchemaManager(schemaRevisionManager); final Helper helper = FlywaveRevisionScanner.helper(); includeWarlockPath().accept(helper); diff --git a/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops5JournalManagerTest.java b/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops5JournalManagerTest.java index bfdfdbb17..4597aaa56 100644 --- a/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops5JournalManagerTest.java +++ b/example/winx-devops/src/test/java/com/moilioncircle/wings/devops/project/Devops5JournalManagerTest.java @@ -36,7 +36,7 @@ public void journal() { schemaJournalManager.askWay(FlywaveInteractiveGui.askGui()); schemaJournalManager.logWay(FlywaveInteractiveGui.logGui()); - long commitId = 9999_9999_9999L; + long commitId = 2022_0222_2222L; boolean enable = true; boolean manage = true; List tables = Arrays.asList( diff --git a/observe/docker/mysql/conf/wings.cnf b/observe/docker/mysql/conf/wings.cnf index 1b899c596..9d3610f97 100644 --- a/observe/docker/mysql/conf/wings.cnf +++ b/observe/docker/mysql/conf/wings.cnf @@ -1,12 +1,18 @@ [mysqld] authentication_policy = caching_sha2_password +max_allowed_packet = 16777216 max_connections = 4096 +## table store lowercase compare case-sensitive lower_case_table_names = 1 +## FULLTEXT indexes by MeCab parser and ngram parser innodb_ft_min_token_size = 2 ft_min_word_len = 2 ngram_token_size = 2 +## default charset and timezone character-set-server = UTF8MB4 -default-time-zone = '+8:00' +default-time-zone = +08:00 log_bin_trust_function_creators = 1 -innodb_file_per_table = 1 +## local +innodb_file_per_table = 1 +innodb_strict_mode = 0 #skip_grant_tables \ No newline at end of file diff --git a/observe/docker/mysql/init/2-data.sql b/observe/docker/mysql/init/2-data.sql index 2cb594791..8aa12b6da 100644 --- a/observe/docker/mysql/init/2-data.sql +++ b/observe/docker/mysql/init/2-data.sql @@ -1,4 +1,5 @@ CREATE DATABASE IF NOT EXISTS wings DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; +CREATE DATABASE IF NOT EXISTS wings_example DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; CREATE DATABASE IF NOT EXISTS wings_faceless DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; CREATE DATABASE IF NOT EXISTS wings_shard_0 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; CREATE DATABASE IF NOT EXISTS wings_shard_1 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; diff --git a/observe/docs b/observe/docs index 1f416c6d4..06bb5aa54 160000 --- a/observe/docs +++ b/observe/docs @@ -1 +1 @@ -Subproject commit 1f416c6d4a2e1a97c8819f08c0370976c2ea6b19 +Subproject commit 06bb5aa5408aa821f4d52d3bd913e9617def8330 diff --git a/observe/scripts/wings-docker.sh b/observe/scripts/wings-docker.sh index 343ba2f86..6d3c86ccc 100755 --- a/observe/scripts/wings-docker.sh +++ b/observe/scripts/wings-docker.sh @@ -1,13 +1,13 @@ #!/bin/bash -THIS_VERSION=2022-01-22 +THIS_VERSION=2024-02-03 TEMP_DIR="../../example/winx-devops/target" # To avoid copy, recommend the same partition on the hard disk. BOOT_JAR="../../example/winx-devops/target/winx-devops-*-SNAPSHOT.jar" BOOT_ENV="./wings-starter.env" BOOT_BSH="./wings-starter.sh" -DOCK_DIR="/opt/" DOCK_TAG="wings/winx-devops" +DOCK_DIR="/opt" #### function show_help() { @@ -52,7 +52,8 @@ function link_file() { cnt=$(find "$frm" -name "$tkn" | wc -l) if [[ $cnt -ne 1 ]]; then find "$frm" -name "$tkn" - echo -e "\033[37;41;1mERROR: found $cnt file, $lnk_it \033[0m should clean" + echo -e "\033[37;41;1mERROR: found $cnt file, $lnk_it \033[0m" + echo -e "must existed 1 file, e.g. mvn clean package" exit fi arg=$(find "$frm" -name "$tkn") @@ -90,18 +91,26 @@ echo "temp-dir=$tmp_dir" echo -e "\033[37;42;1m ==== Dockerfile ==== \033[0m" tee Dockerfile < sql = FlywaveRevisionScanner .helper() .master() - .replace(2019_0601_01, 2021_0120_01) - .include(it -> it >= 2019_0520_01) - .exclude("faceless-test", 2019_0601_01) - .exclude(it -> it < 2021_0101_01) + .replace(2022_0601_02, 2023_0120_02) + .include(it -> it >= 2019_0520_01) // remove 2019051201 + .exclude("testing-faceless-v1", 2022_0601_01) // remove 2022060101 + .exclude(it -> it < 2023_0101_01) // remove 2019052001 .scan(); assertEquals(1, sql.size()); - assertEquals(2019_0601_01, sql.get(2021_0120_01L).getRevision()); + assertEquals(2022_0601_02, sql.get(2023_0120_02L).getRevision()); } @Test diff --git a/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/flywave/SchemaJournalManagerTest.kt b/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/flywave/SchemaJournalManagerTest.kt index 336983a0c..9ff623e5f 100644 --- a/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/flywave/SchemaJournalManagerTest.kt +++ b/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/flywave/SchemaJournalManagerTest.kt @@ -164,7 +164,7 @@ class SchemaJournalManagerTest { "${schemaPrefix}version" ) breakpointDebug("Create test table💰, check all tables in the database") - schemaRevisionManager.publishRevision(WingsRevision.V90_19_0601_01_TestSchema.revision(), 0) + schemaRevisionManager.publishRevision(WingsRevision.V90_22_0601_01_TestSchema.revision(), 0) testingDatabaseHelper.assertSame( TestingDatabaseHelper.Type.Table, "sys_commit_journal", diff --git a/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/flywave/SchemaRevisionMangerTest.kt b/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/flywave/SchemaRevisionMangerTest.kt index cfa984032..24921e3cf 100644 --- a/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/flywave/SchemaRevisionMangerTest.kt +++ b/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/flywave/SchemaRevisionMangerTest.kt @@ -189,7 +189,7 @@ class SchemaRevisionMangerTest { @TmsLink("C12057") fun test9MaintainBreak() { breakpointDebug("Prepare a breakpoint revision to mock a failure💰") - val revision = WingsRevision.V90_19_0601_01_TestSchema.revision() + val revision = WingsRevision.V90_22_0601_01_TestSchema.revision() schemaRevisionManager.forceExecuteSql( """ UPDATE `$schemaVersion` SET `apply_dt` = '1000-01-01 00:00:17' WHERE `revision` = '$revision'; diff --git a/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/sample/TestWingsFlywaveInitDatabaseSample.kt b/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/sample/TestWingsFlywaveInitDatabaseSample.kt index 48d18c3d4..db4285453 100644 --- a/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/sample/TestWingsFlywaveInitDatabaseSample.kt +++ b/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/sample/TestWingsFlywaveInitDatabaseSample.kt @@ -25,6 +25,6 @@ class TestWingsFlywaveInitDatabaseSample { fun forceUpdateSql() { val sqls = FlywaveRevisionScanner.scanMaster() schemaRevisionManager.forceUpdateSql(sqls[WingsRevision.V00_19_0512_01_Schema.revision()]!!, 0) - schemaRevisionManager.forceUpdateSql(sqls[WingsRevision.V90_19_0601_01_TestSchema.revision()]!!, 0) + schemaRevisionManager.forceUpdateSql(sqls[WingsRevision.V90_22_0601_01_TestSchema.revision()]!!, 0) } } diff --git a/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/sample/TestWingsFlywaveShardJournalSample.kt b/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/sample/TestWingsFlywaveShardJournalSample.kt index 1c7bed863..542126778 100644 --- a/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/sample/TestWingsFlywaveShardJournalSample.kt +++ b/wings/faceless-flywave/src/test/kotlin/pro/fessional/wings/faceless/sample/TestWingsFlywaveShardJournalSample.kt @@ -37,10 +37,10 @@ class TestWingsFlywaveShardJournalSample { // upgrade schemaRevisionManager.publishRevision(WingsRevision.V01_19_0520_01_IdLog.revision(), 0) - schemaRevisionManager.publishRevision(WingsRevision.V90_19_0601_01_TestSchema.revision(), 0) + schemaRevisionManager.publishRevision(WingsRevision.V90_22_0601_01_TestSchema.revision(), 0) // force upgrade in master database only - schemaRevisionManager.forceApplyBreak(WingsRevision.V90_19_0601_02_TestRecord.revision(), 2, true, "master") + schemaRevisionManager.forceApplyBreak(WingsRevision.V90_22_0601_02_TestRecord.revision(), 2, true, "master") // sharding val table = "tst_sharding" diff --git a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/database/jooq/WingsJooqDaoAliasImplTest.java b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/database/jooq/WingsJooqDaoAliasImplTest.java index ff14955cf..0bf9497e0 100644 --- a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/database/jooq/WingsJooqDaoAliasImplTest.java +++ b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/database/jooq/WingsJooqDaoAliasImplTest.java @@ -27,7 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static pro.fessional.wings.faceless.enums.autogen.StandardLanguage.ZH_CN; -import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_02_TestRecord; +import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_02_TestRecord; import static pro.fessional.wings.faceless.util.FlywaveRevisionScanner.REVISION_PATH_MASTER; import static pro.fessional.wings.testing.faceless.database.TestingDatabaseHelper.testcaseNotice; @@ -62,7 +62,7 @@ public void test0DropAndInit() { testingDatabaseHelper.cleanTable(); final SortedMap sqls = FlywaveRevisionScanner.scan(REVISION_PATH_MASTER, WingsRevision.V01_19_0521_01_EnumI18n.classpath()); schemaRevisionManager.checkAndInitSql(sqls, 0, true); - schemaRevisionManager.publishRevision(V90_19_0601_02_TestRecord.revision(), -1); + schemaRevisionManager.publishRevision(V90_22_0601_02_TestRecord.revision(), -1); } @Test diff --git a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqDeleteListenerTest.java b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqDeleteListenerTest.java index cdfd2fd02..0c2c0f9a4 100644 --- a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqDeleteListenerTest.java +++ b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqDeleteListenerTest.java @@ -27,7 +27,7 @@ import static pro.fessional.wings.faceless.convention.EmptyValue.DATE_TIME; import static pro.fessional.wings.faceless.enums.autogen.StandardLanguage.ZH_CN; -import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_02_TestRecord; +import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_02_TestRecord; import static pro.fessional.wings.faceless.util.FlywaveRevisionScanner.REVISION_PATH_MASTER; import static pro.fessional.wings.testing.faceless.database.TestingDatabaseHelper.testcaseNotice; @@ -62,7 +62,7 @@ public void test0CleanTables() { testingDatabaseHelper.cleanTable(); final SortedMap sqls = FlywaveRevisionScanner.scan(REVISION_PATH_MASTER); schemaRevisionManager.checkAndInitSql(sqls, 0, true); - schemaRevisionManager.publishRevision(V90_19_0601_02_TestRecord.revision(), -1); + schemaRevisionManager.publishRevision(V90_22_0601_02_TestRecord.revision(), -1); } // 🦁🦁🦁<=<< diff --git a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqMapperCompatibleTest.java b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqMapperCompatibleTest.java index 87f3112b4..02c90e6c2 100644 --- a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqMapperCompatibleTest.java +++ b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqMapperCompatibleTest.java @@ -48,7 +48,7 @@ public void test0Init() { testingDatabaseHelper.cleanTable(); final var sqls = FlywaveRevisionScanner.scanMaster(); schemaRevisionManager.checkAndInitSql(sqls, 0, false); - schemaRevisionManager.publishRevision(WingsRevision.V90_19_0601_02_TestRecord.revision(), 0); + schemaRevisionManager.publishRevision(WingsRevision.V90_22_0601_02_TestRecord.revision(), 0); } @Test diff --git a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqTableCudListenerTest.java b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqTableCudListenerTest.java index 59a3ddbde..c298b45c8 100644 --- a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqTableCudListenerTest.java +++ b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/JooqTableCudListenerTest.java @@ -36,7 +36,7 @@ import static java.util.Collections.singletonList; import static pro.fessional.wings.faceless.enums.autogen.StandardLanguage.ZH_CN; -import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_02_TestRecord; +import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_02_TestRecord; import static pro.fessional.wings.faceless.util.FlywaveRevisionScanner.REVISION_PATH_MASTER; import static pro.fessional.wings.testing.faceless.database.TestingDatabaseHelper.testcaseNotice; @@ -81,7 +81,7 @@ public void test0Init() { testingDatabaseHelper.cleanTable(); final SortedMap sqls = FlywaveRevisionScanner.scan(REVISION_PATH_MASTER); schemaRevisionManager.checkAndInitSql(sqls, 0, true); - schemaRevisionManager.publishRevision(V90_19_0601_02_TestRecord.revision(), -1); + schemaRevisionManager.publishRevision(V90_22_0601_02_TestRecord.revision(), -1); } @Test diff --git a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/TransactionalServiceTest.java b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/TransactionalServiceTest.java index 8d1bb4b9d..efaec9119 100644 --- a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/TransactionalServiceTest.java +++ b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/jooq/TransactionalServiceTest.java @@ -18,7 +18,7 @@ import java.util.concurrent.atomic.AtomicLong; -import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_01_TestSchema; +import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_01_TestSchema; /** * @author trydofor @@ -47,7 +47,7 @@ public class TransactionalServiceTest { public void test0Init() { final var sqls = FlywaveRevisionScanner.scanMaster(); schemaRevisionManager.checkAndInitSql(sqls, 0, false); - schemaRevisionManager.publishRevision(V90_19_0601_01_TestSchema.revision(), 0); + schemaRevisionManager.publishRevision(V90_22_0601_01_TestSchema.revision(), 0); } @Test diff --git a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/sample/TestJooqDslAndDaoSample.java b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/sample/TestJooqDslAndDaoSample.java index 34deb1c92..0aaa9c42c 100644 --- a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/sample/TestJooqDslAndDaoSample.java +++ b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/sample/TestJooqDslAndDaoSample.java @@ -38,7 +38,7 @@ import static pro.fessional.wings.faceless.convention.EmptyValue.DATE_TIME; import static pro.fessional.wings.faceless.enums.autogen.StandardLanguage.ZH_CN; -import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_01_TestSchema; +import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_01_TestSchema; import static pro.fessional.wings.faceless.service.journal.JournalService.Journal; import static pro.fessional.wings.testing.faceless.database.TestingDatabaseHelper.testcaseNotice; @@ -74,7 +74,7 @@ public class TestJooqDslAndDaoSample { public void test0Init() { final var sqls = FlywaveRevisionScanner.scanMaster(); schemaRevisionManager.checkAndInitSql(sqls, 0, true); - schemaRevisionManager.publishRevision(V90_19_0601_01_TestSchema.revision(), 0); + schemaRevisionManager.publishRevision(V90_22_0601_01_TestSchema.revision(), 0); } @Test diff --git a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/sample/TestJooqMostSelectSample.java b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/sample/TestJooqMostSelectSample.java index 439c73866..797944561 100644 --- a/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/sample/TestJooqMostSelectSample.java +++ b/wings/faceless-jooq/src/test/java/pro/fessional/wings/faceless/sample/TestJooqMostSelectSample.java @@ -58,7 +58,7 @@ import static org.jooq.Operator.AND; import static org.jooq.Operator.OR; import static org.junit.jupiter.api.Assertions.assertEquals; -import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_02_TestRecord; +import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_02_TestRecord; import static pro.fessional.wings.testing.faceless.database.TestingDatabaseHelper.testcaseNotice; /** @@ -89,7 +89,7 @@ public class TestJooqMostSelectSample { public void test0Init() { final var sqls = FlywaveRevisionScanner.scanMaster(); schemaRevisionManager.checkAndInitSql(sqls, 0, false); - schemaRevisionManager.publishRevision(V90_19_0601_02_TestRecord.revision(), 0); + schemaRevisionManager.publishRevision(V90_22_0601_02_TestRecord.revision(), 0); } @Test diff --git a/wings/faceless-shard/src/test/java/pro/fessional/wings/faceless/flywave/FlywaveShardingTest.java b/wings/faceless-shard/src/test/java/pro/fessional/wings/faceless/flywave/FlywaveShardingTest.java index 8dad0a31b..603adc08e 100644 --- a/wings/faceless-shard/src/test/java/pro/fessional/wings/faceless/flywave/FlywaveShardingTest.java +++ b/wings/faceless-shard/src/test/java/pro/fessional/wings/faceless/flywave/FlywaveShardingTest.java @@ -17,8 +17,8 @@ import java.util.SortedMap; import static org.junit.jupiter.api.Assertions.assertEquals; -import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_01_TestSchema; -import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_02_TestRecord; +import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_01_TestSchema; +import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_02_TestRecord; import static pro.fessional.wings.testing.faceless.database.TestingDatabaseHelper.testcaseNotice; /** @@ -52,10 +52,10 @@ public void test0CleanTables() { @Test @TmsLink("C12132") public void test1Single() { - schemaRevisionManager.publishRevision(V90_19_0601_01_TestSchema.revision(), 0); + schemaRevisionManager.publishRevision(V90_22_0601_01_TestSchema.revision(), 0); testingDatabaseHelper.assertHas(TestingDatabaseHelper.Type.Table, "tst_sharding"); - schemaRevisionManager.forceApplyBreak(V90_19_0601_02_TestRecord.revision(), 2, true, "writer"); + schemaRevisionManager.forceApplyBreak(V90_22_0601_02_TestRecord.revision(), 2, true, "writer"); assertEquals(20, countRecords("writer", "tst_sharding")); assertEquals(0, countRecords("reader", "tst_sharding")); diff --git a/wings/faceless-shard/src/test/java/pro/fessional/wings/faceless/jooq/JooqShardingTest.java b/wings/faceless-shard/src/test/java/pro/fessional/wings/faceless/jooq/JooqShardingTest.java index 01f468e4c..b0a93635b 100644 --- a/wings/faceless-shard/src/test/java/pro/fessional/wings/faceless/jooq/JooqShardingTest.java +++ b/wings/faceless-shard/src/test/java/pro/fessional/wings/faceless/jooq/JooqShardingTest.java @@ -28,7 +28,7 @@ import java.util.SortedMap; import static pro.fessional.wings.faceless.enums.autogen.StandardLanguage.ZH_CN; -import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_01_TestSchema; +import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_01_TestSchema; import static pro.fessional.wings.testing.faceless.database.TestingDatabaseHelper.testcaseNotice; /** @@ -67,7 +67,7 @@ public void test0CleanTables() { @Test @TmsLink("C12136") public void test1PublishTest() { - schemaRevisionManager.publishRevision(V90_19_0601_01_TestSchema.revision(), 0); + schemaRevisionManager.publishRevision(V90_22_0601_01_TestSchema.revision(), 0); } @Test diff --git a/wings/testing-faceless/src/main/resources/wings-flywave/master/20190601u01-test.sql b/wings/testing-faceless/src/main/resources/wings-flywave/master/2022-0601u01-test.sql similarity index 100% rename from wings/testing-faceless/src/main/resources/wings-flywave/master/20190601u01-test.sql rename to wings/testing-faceless/src/main/resources/wings-flywave/master/2022-0601u01-test.sql diff --git a/wings/testing-faceless/src/main/resources/wings-flywave/master/20190601u02-test.sql b/wings/testing-faceless/src/main/resources/wings-flywave/master/2022-0601u02-test.sql similarity index 100% rename from wings/testing-faceless/src/main/resources/wings-flywave/master/20190601u02-test.sql rename to wings/testing-faceless/src/main/resources/wings-flywave/master/2022-0601u02-test.sql diff --git a/wings/testing-faceless/src/main/resources/wings-flywave/master/20190601v01-test.sql b/wings/testing-faceless/src/main/resources/wings-flywave/master/2022-0601v01-test.sql similarity index 100% rename from wings/testing-faceless/src/main/resources/wings-flywave/master/20190601v01-test.sql rename to wings/testing-faceless/src/main/resources/wings-flywave/master/2022-0601v01-test.sql diff --git a/wings/testing-faceless/src/main/resources/wings-flywave/master/20190601v02-test.sql b/wings/testing-faceless/src/main/resources/wings-flywave/master/2022-0601v02-test.sql similarity index 100% rename from wings/testing-faceless/src/main/resources/wings-flywave/master/20190601v02-test.sql rename to wings/testing-faceless/src/main/resources/wings-flywave/master/2022-0601v02-test.sql