This commit is contained in:
parent
f2cb3e4e91
commit
15095f2d9f
@ -1,7 +1,7 @@
|
||||
FROM openjdk:11-jre
|
||||
|
||||
ENV APPLICATION_USER ktor
|
||||
RUN adduser -D -g '' $APPLICATION_USER
|
||||
RUN adduser --defaults --gid '' $APPLICATION_USER
|
||||
|
||||
RUN mkdir /app
|
||||
RUN chown -R $APPLICATION_USER /app
|
||||
|
@ -67,4 +67,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
baseName = 'output-service-rdb'
|
||||
classifier = null
|
||||
version = null
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.kmalbz
|
||||
|
||||
import io.ktor.application.*
|
||||
import io.ktor.response.*
|
||||
import io.ktor.request.*
|
||||
import io.ktor.routing.*
|
||||
import io.ktor.http.*
|
||||
import io.ktor.gson.*
|
||||
import io.ktor.features.*
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.engine.apache.*
|
||||
import io.ktor.auth.*
|
||||
import kotlin.reflect.*
|
||||
import java.util.*
|
||||
import kotlin.test.*
|
||||
import io.ktor.server.testing.*
|
||||
import io.ktor.util.KtorExperimentalAPI
|
||||
|
||||
class ApplicationTest {
|
||||
@KtorExperimentalAPI
|
||||
@Test
|
||||
fun testRoot() {
|
||||
withTestApplication({ module(testing = true) }) {
|
||||
handleRequest(HttpMethod.Get, "/").apply {
|
||||
assertEquals(HttpStatusCode.OK, response.status())
|
||||
assertEquals("HELLO WORLD!", response.content)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
package com.kmalbz
|
||||
|
||||
import io.ktor.config.*
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.testing.*
|
||||
import kotlin.test.*
|
||||
|
||||
class SwaggerRoutesTest {
|
||||
/**
|
||||
* @see OutputServiceRDBServer.getallnegative
|
||||
*/
|
||||
@Test
|
||||
fun testGetallnegative() {
|
||||
withTestApplication {
|
||||
// @TODO: Adjust path as required
|
||||
handleRequest(HttpMethod.Get, "/output/filter/negative") {
|
||||
}.apply {
|
||||
// @TODO: Your test here
|
||||
assertEquals(HttpStatusCode.OK, response.status())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see OutputServiceRDBServer.getallpositive
|
||||
*/
|
||||
@Test
|
||||
fun testGetallpositive() {
|
||||
withTestApplication {
|
||||
// @TODO: Adjust path as required
|
||||
handleRequest(HttpMethod.Get, "/output/filter/positive") {
|
||||
}.apply {
|
||||
// @TODO: Your test here
|
||||
assertEquals(HttpStatusCode.OK, response.status())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see OutputServiceRDBServer.getallafter
|
||||
*/
|
||||
@Test
|
||||
fun testGetallafter() {
|
||||
withTestApplication {
|
||||
// @TODO: Adjust path as required
|
||||
handleRequest(HttpMethod.Get, "/output/after/{dateAfter}") {
|
||||
}.apply {
|
||||
// @TODO: Your test here
|
||||
assertEquals(HttpStatusCode.OK, response.status())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see OutputServiceRDBServer.getallbefore
|
||||
*/
|
||||
@Test
|
||||
fun testGetallbefore() {
|
||||
withTestApplication {
|
||||
// @TODO: Adjust path as required
|
||||
handleRequest(HttpMethod.Get, "/output/before/{dateBefore}") {
|
||||
}.apply {
|
||||
// @TODO: Your test here
|
||||
assertEquals(HttpStatusCode.OK, response.status())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see OutputServiceRDBServer.getDecision
|
||||
*/
|
||||
@Test
|
||||
fun testGetDecision() {
|
||||
withTestApplication {
|
||||
// @TODO: Adjust path as required
|
||||
handleRequest(HttpMethod.Get, "/output/{tagID}") {
|
||||
}.apply {
|
||||
// @TODO: Your test here
|
||||
assertEquals(HttpStatusCode.OK, response.status())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun <R> withTestApplication(test: TestApplicationEngine.() -> R): R {
|
||||
return withApplication(createTestEnvironment()) {
|
||||
(environment.config as MapApplicationConfig).apply {
|
||||
put("jwt.secret", "TODO-change-this-supersecret-or-use-SECRET-env")
|
||||
}
|
||||
application.module()
|
||||
test()
|
||||
}
|
||||
}
|
||||
|
||||
//fun TestApplicationRequest.setBodyJson(value: Any?) = setBody(Gson.stringify(value))
|
||||
}
|
Loading…
Reference in New Issue
Block a user