Fix load test ; set target jdk ; fix some dependencies
This commit is contained in:
@@ -289,6 +289,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito.kotlin</groupId>
|
<groupId>org.mockito.kotlin</groupId>
|
||||||
<artifactId>mockito-kotlin</artifactId>
|
<artifactId>mockito-kotlin</artifactId>
|
||||||
|
<!--<version>5.2.1</version>-->
|
||||||
<version>4.1.0</version>
|
<version>4.1.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@@ -5,6 +5,7 @@ import org.ajbrown.namemachine.NameGenerator
|
|||||||
import org.ajbrown.namemachine.NameGeneratorOptions
|
import org.ajbrown.namemachine.NameGeneratorOptions
|
||||||
import org.junit.jupiter.api.Disabled
|
import org.junit.jupiter.api.Disabled
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
import java.io.IOException
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
class LoadTest: TestBase() {
|
class LoadTest: TestBase() {
|
||||||
@@ -13,7 +14,18 @@ class LoadTest: TestBase() {
|
|||||||
val PLAYERS = 1500
|
val PLAYERS = 1500
|
||||||
val ROUNDS = 10
|
val ROUNDS = 10
|
||||||
val SKIP_RATIO = 0.1 // 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(
|
private val nameGenerator = NameGenerator(
|
||||||
NameGeneratorOptions().apply {
|
NameGeneratorOptions().apply {
|
||||||
randomSeed = 123456L
|
randomSeed = 123456L
|
||||||
@@ -72,6 +84,9 @@ class LoadTest: TestBase() {
|
|||||||
repeat(PLAYERS) {
|
repeat(PLAYERS) {
|
||||||
TestAPI.post("/api/tour/$tour/part", generatePlayer())
|
TestAPI.post("/api/tour/$tour/part", generatePlayer())
|
||||||
}
|
}
|
||||||
|
getOutputFile("verybig-nopairing.json").printWriter().use {
|
||||||
|
it.println(TestAPI.getJson("/api/tour/$tour"))
|
||||||
|
}
|
||||||
repeat(ROUNDS) {
|
repeat(ROUNDS) {
|
||||||
val round = it + 1
|
val round = it + 1
|
||||||
val resp = TestAPI.post("/api/tour/$tour/pair/$round", Json.Array("all"))
|
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")
|
// val standings = TestAPI.get("/api/tour/$tour/standings/$ROUNDS")
|
||||||
logger.info(standings.toString())
|
// logger.info(standings.toString())
|
||||||
|
getOutputFile("verybig.json").printWriter().use {
|
||||||
|
it.println(TestAPI.getJson("/api/tour/$tour"))
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
val after = System.currentTimeMillis()
|
val after = System.currentTimeMillis()
|
||||||
logger.info("testVeryBigTournament ran in ${(after - before) / 1000} seconds")
|
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 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 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> 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> 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")
|
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()
|
super.close()
|
||||||
sourceStream.close()
|
sourceStream.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -145,11 +145,5 @@
|
|||||||
<version>${junit.jupiter.version}</version>
|
<version>${junit.jupiter.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.mockito.kotlin</groupId>
|
|
||||||
<artifactId>mockito-kotlin</artifactId>
|
|
||||||
<version>4.1.0</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
5
pom.xml
5
pom.xml
@@ -61,7 +61,7 @@
|
|||||||
<!-- kotlin -->
|
<!-- kotlin -->
|
||||||
<kotlin.version>1.9.22</kotlin.version>
|
<kotlin.version>1.9.22</kotlin.version>
|
||||||
<kotlin.code.style>official</kotlin.code.style>
|
<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>
|
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
|
||||||
|
|
||||||
<!-- pairgoth default properties -->
|
<!-- pairgoth default properties -->
|
||||||
@@ -188,6 +188,9 @@
|
|||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin-maven-plugin</artifactId>
|
<artifactId>kotlin-maven-plugin</artifactId>
|
||||||
<version>${kotlin.version}</version>
|
<version>${kotlin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<jvmTarget>11</jvmTarget>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>properties-maven-plugin</artifactId>
|
<artifactId>properties-maven-plugin</artifactId>
|
||||||
|
@@ -303,12 +303,6 @@
|
|||||||
<version>${junit.jupiter.version}</version>
|
<version>${junit.jupiter.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.mockito.kotlin</groupId>
|
|
||||||
<artifactId>mockito-kotlin</artifactId>
|
|
||||||
<version>4.1.0</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<!-- test emails -->
|
<!-- test emails -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.icegreen</groupId>
|
<groupId>com.icegreen</groupId>
|
||||||
|
Reference in New Issue
Block a user