فهرست منبع

:zap: 优化单元测试的配置文件

smallchill 6 سال پیش
والد
کامیت
fcc587a76f

+ 17 - 6
src/test/resources/application-dev.yml

@@ -12,16 +12,27 @@ spring:
     #  nodes: 127.0.0.1:7001,127.0.0.1:7002,127.0.0.1:7003
     #  commandTimeout: 5000
   datasource:
-    url: jdbc:mysql://localhost:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
+    # MySql
+    url: jdbc:mysql://localhost:3306/bladex_boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
     username: root
     password: root
-    driver-class-name: com.mysql.cj.jdbc.Driver
+    # PostgreSQL
+    #url: jdbc:postgresql://127.0.0.1:5432/bladex_boot
+    #username: postgres
+    #password: 123456
+    # Oracle
+    #url: jdbc:oracle:thin:@127.0.0.1:49161:orcl
+    #username: BLADEX_BOOT
+    #password: oracle
 
 #blade配置
 blade:
-  prop:
-    upload-domain: http://localhost:8888
+  #分布式锁
+  lock:
+    enabled: false
+    address: redis://127.0.0.1:6379
+  #本地文件上传
+  file:
     remote-mode: true
+    upload-domain: http://localhost:8999
     remote-path: /usr/share/nginx/html
-    remote-path-iis: D://iis/html
-    log-mode: true

+ 29 - 0
src/test/resources/application-prod.yml

@@ -0,0 +1,29 @@
+#数据源配置
+spring:
+  redis:
+    ##redis 单机环境配置
+    host: 127.0.0.1
+    port: 6379
+    password:
+    database: 0
+    ssl: false
+    ##redis 集群环境配置
+    #cluster:
+    #  nodes: 127.0.0.1:7001,127.0.0.1:7002,127.0.0.1:7003
+    #  commandTimeout: 5000
+  datasource:
+    url: jdbc:mysql://localhost:3306/bladex_boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+    username: root
+    password: root
+
+#blade配置
+blade:
+  #分布式锁
+  lock:
+    enabled: false
+    address: redis://127.0.0.1:6379
+  #本地文件上传
+  file:
+    remote-mode: true
+    upload-domain: http://localhost:8999
+    remote-path: /usr/share/nginx/html

+ 29 - 0
src/test/resources/application-test.yml

@@ -0,0 +1,29 @@
+#数据源配置
+spring:
+  redis:
+    ##redis 单机环境配置
+    host: 127.0.0.1
+    port: 6379
+    password:
+    database: 0
+    ssl: false
+    ##redis 集群环境配置
+    #cluster:
+    #  nodes: 127.0.0.1:7001,127.0.0.1:7002,127.0.0.1:7003
+    #  commandTimeout: 5000
+  datasource:
+    url: jdbc:mysql://localhost:3306/bladex_boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+    username: root
+    password: root
+
+#blade配置
+blade:
+  #分布式锁
+  lock:
+    enabled: false
+    address: redis://127.0.0.1:6379
+  #本地文件上传
+  file:
+    remote-mode: true
+    upload-domain: http://localhost:8999
+    remote-path: /usr/share/nginx/html

+ 59 - 9
src/test/resources/application.yml

@@ -3,9 +3,9 @@ server:
   port: 80
   undertow:
     # 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
-    io-threads: 4
+    io-threads: 16
     # 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载
-    worker-threads: 20
+    worker-threads: 400
     # 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理
     buffer-size: 1024
     # 是否分配的直接内存
@@ -21,17 +21,16 @@ spring:
       validation-query: select 1
       # Oracle校验
       #validation-query: select 1 from dual
+      validation-query-timeout: 2000
       initial-size: 5
       max-active: 20
       min-idle: 5
       max-wait: 60000
-      validation-query-timeout: 2000
       test-on-borrow: false
       test-on-return: false
       test-while-idle: true
       time-between-eviction-runs-millis: 60000
       min-evictable-idle-time-millis: 300000
-      filters: stat,wall
       stat-view-servlet:
         enabled: true
         login-username: blade
@@ -43,6 +42,53 @@ spring:
         session-stat-enable: true
         session-stat-max-count: 10
 
+# mybatis
+mybatis-plus:
+  mapper-locations: classpath:org/springblade/**/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: org.springblade.**.entity
+  #typeEnumsPackage: org.springblade.dashboard.entity.enums
+  global-config:
+    # 关闭MP3.0自带的banner
+    banner: false
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"不操作", 2:"用户输入ID",3:"数字型snowflake", 4:"全局唯一ID UUID", 5:"字符串型snowflake";
+      id-type: id_worker
+      #字段策略
+      insert-strategy: not_null
+      update-strategy: not_null
+      select-strategy: not_empty
+      #驼峰下划线转换
+      table-underline: true
+      # 逻辑删除配置
+      # 逻辑删除全局值(1表示已删除,这也是Mybatis Plus的默认配置)
+      logic-delete-value: 1
+      # 逻辑未删除全局值(0表示未删除,这也是Mybatis Plus的默认配置)
+      logic-not-delete-value: 0
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+
+#swagger公共信息
+swagger:
+  title: BladeX 接口文档系统
+  description: BladeX 接口文档系统
+  version: 2.3.0.RELEASE
+  license: Powered By BladeX
+  license-url: https://bladex.vip
+  terms-of-service-url: https://bladex.vip
+  contact:
+    name: smallchill
+    email: smallchill@163.com
+    url: https://gitee.com/smallc
+
+#flowable配置
+flowable:
+  activity-font-name: \u5B8B\u4F53
+  label-font-name: \u5B8B\u4F53
+  annotation-font-name: \u5B8B\u4F53
+  check-process-definitions: false
+
 #oss默认配置
 oss:
   enable: true
@@ -56,10 +102,13 @@ oss:
 
 #blade配置
 blade:
+  xss:
+    skip-url:
+      - /weixin
+      - /notice/submit
   secure:
-    url:
-      exclude-patterns:
-        - /blade-test/**
+    skip-url:
+      - /blade-test/**
     client:
       - client-id: sword
         path-patterns:
@@ -68,8 +117,9 @@ blade:
         path-patterns:
           - /blade-saber/**
   tenant:
+    enhance: false
     column: tenant_id
-    tables:
-      - blade_notice
+    exclude-tables:
+      - blade_user