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() {
|
||||
@@ -14,6 +15,17 @@ class LoadTest: TestBase() {
|
||||
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")
|
||||
|
@@ -145,11 +145,5 @@
|
||||
<version>${junit.jupiter.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito.kotlin</groupId>
|
||||
<artifactId>mockito-kotlin</artifactId>
|
||||
<version>4.1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
5
pom.xml
5
pom.xml
@@ -61,7 +61,7 @@
|
||||
<!-- kotlin -->
|
||||
<kotlin.version>1.9.22</kotlin.version>
|
||||
<kotlin.code.style>official</kotlin.code.style>
|
||||
<kotlin.compiler.jvmTarget>10</kotlin.compiler.jvmTarget>
|
||||
<kotlin.compiler.jvmTarget>11</kotlin.compiler.jvmTarget>
|
||||
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
|
||||
|
||||
<!-- pairgoth default properties -->
|
||||
@@ -188,6 +188,9 @@
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<configuration>
|
||||
<jvmTarget>11</jvmTarget>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>properties-maven-plugin</artifactId>
|
||||
|
@@ -303,12 +303,6 @@
|
||||
<version>${junit.jupiter.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito.kotlin</groupId>
|
||||
<artifactId>mockito-kotlin</artifactId>
|
||||
<version>4.1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- test emails -->
|
||||
<dependency>
|
||||
<groupId>com.icegreen</groupId>
|
||||
|
Reference in New Issue
Block a user