增加测试接口

更新gradle
master
pan 4 years ago
parent 741d966170
commit f363d7966b
  1. 2
      gradle/wrapper/gradle-wrapper.properties
  2. 1
      src/Application.kt
  3. 20
      src/TestController.kt
  4. 5
      test/ApplicationTest.kt

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

@ -31,4 +31,5 @@ fun Application.module(testing: Boolean = false) {
fun Application.Controller(testing: Boolean = false){ fun Application.Controller(testing: Boolean = false){
this.AccountController() this.AccountController()
this.TestController()
} }

@ -0,0 +1,20 @@
package com.gyf.csams
import io.ktor.application.*
import io.ktor.response.*
import io.ktor.routing.*
import org.jetbrains.exposed.sql.transactions.transaction
import org.slf4j.LoggerFactory
private val logger = LoggerFactory.getLogger(Application::class.java)
fun Application.TestController(){
routing {
get("$ApiPathPrefix/test"){
transaction {
logger.info("查询到个${User.count()}用户")
}
call.respond(ApiResponse(message = "成功连接服务端",body=true))
}
}
}

@ -100,10 +100,11 @@ class ApplicationTest {
fun documentGeneration() { fun documentGeneration() {
initApp { initApp {
val fileName="数据库设计文档" val fileName="数据库设计文档"
val dir="${System.getenv("UserProfile")}\\Desktop"
//生成配置 //生成配置
val engineConfig = EngineConfig.builder() val engineConfig = EngineConfig.builder()
//生成文件路径 //生成文件路径
.fileOutputDir("f:\\Desktop") .fileOutputDir(dir)
//打开目录 //打开目录
.openOutputDir(true) .openOutputDir(true)
//文件类型 //文件类型
@ -112,7 +113,7 @@ class ApplicationTest {
.produceType(EngineTemplateType.freemarker) .produceType(EngineTemplateType.freemarker)
//自定义文件名称 //自定义文件名称
.fileName(fileName).build(); .fileName(fileName).build();
println("数据库文档输出路径${engineConfig.fileOutputDir}")
//忽略表 //忽略表
// val ignoreTableName = ArrayList<String>() // val ignoreTableName = ArrayList<String>()
// ignoreTableName.add("test_user") // ignoreTableName.add("test_user")

Loading…
Cancel
Save