Fix load test ; set target jdk ; fix some dependencies
This commit is contained in:
@@ -289,6 +289,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mockito.kotlin</groupId>
|
||||
<artifactId>mockito-kotlin</artifactId>
|
||||
<!--<version>5.2.1</version>-->
|
||||
<version>4.1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
@@ -5,6 +5,7 @@ import org.ajbrown.namemachine.NameGenerator
|
||||
import org.ajbrown.namemachine.NameGeneratorOptions
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.io.IOException
|
||||
import kotlin.random.Random
|
||||
|
||||
class LoadTest: TestBase() {
|
||||
@@ -13,7 +14,18 @@ class LoadTest: TestBase() {
|
||||
val PLAYERS = 1500
|
||||
val ROUNDS = 10
|
||||
val SKIP_RATIO = 0.1 // 10%
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
System.out.println("Press Enter to continue...")
|
||||
try {
|
||||
System.`in`.read()
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
LoadTest().testVeryBigTournament()
|
||||
}
|
||||
|
||||
private val nameGenerator = NameGenerator(
|
||||
NameGeneratorOptions().apply {
|
||||
randomSeed = 123456L
|
||||
@@ -72,6 +84,9 @@ class LoadTest: TestBase() {
|
||||
repeat(PLAYERS) {
|
||||
TestAPI.post("/api/tour/$tour/part", generatePlayer())
|
||||
}
|
||||
getOutputFile("verybig-nopairing.json").printWriter().use {
|
||||
it.println(TestAPI.getJson("/api/tour/$tour"))
|
||||
}
|
||||
repeat(ROUNDS) {
|
||||
val round = it + 1
|
||||
val resp = TestAPI.post("/api/tour/$tour/pair/$round", Json.Array("all"))
|
||||
@@ -86,8 +101,11 @@ class LoadTest: TestBase() {
|
||||
))
|
||||
}
|
||||
}
|
||||
val standings = TestAPI.get("/api/tour/$tour/standings/$ROUNDS")
|
||||
logger.info(standings.toString())
|
||||
// val standings = TestAPI.get("/api/tour/$tour/standings/$ROUNDS")
|
||||
// logger.info(standings.toString())
|
||||
getOutputFile("verybig.json").printWriter().use {
|
||||
it.println(TestAPI.getJson("/api/tour/$tour"))
|
||||
}
|
||||
} finally {
|
||||
val after = System.currentTimeMillis()
|
||||
logger.info("testVeryBigTournament ran in ${(after - before) / 1000} seconds")
|
||||
|
@@ -82,6 +82,9 @@ object TestAPI {
|
||||
|
||||
fun get(uri: String): Json = Json.parse(testRequest<Void>("GET", uri)) ?: throw Error("no payload")
|
||||
fun getXml(uri: String): String = testRequest<Void>("GET", uri, "application/xml")
|
||||
fun getJson(uri: String): String = testRequest<Void>("GET", uri, "application/json")
|
||||
fun getCSV(uri: String): String = testRequest<Void>("GET", uri, "text/csv")
|
||||
fun getFFG(uri: String): String = testRequest<Void>("GET", uri, "application/ffg")
|
||||
fun <T> post(uri: String, payload: T) = Json.parse(testRequest("POST", uri, payload = payload)) ?: throw Error("no payload")
|
||||
fun <T> put(uri: String, payload: T) = Json.parse(testRequest("PUT", uri, payload = payload)) ?: throw Error("no payload")
|
||||
fun <T> delete(uri: String, payload: T) = Json.parse(testRequest("DELETE", uri, payload = payload)) ?: throw Error("no payload")
|
||||
@@ -117,4 +120,4 @@ class DelegatingServletInputStream(val sourceStream: InputStream) : ServletInput
|
||||
super.close()
|
||||
sourceStream.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user