mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 09:56:37 -04:00
integration tests
This commit is contained in:
parent
0c1dd555c6
commit
162d0a97aa
@ -14,12 +14,14 @@
|
||||
import de.bixilon.kutil.os.Architectures
|
||||
import de.bixilon.kutil.os.OSTypes
|
||||
import de.bixilon.kutil.os.PlatformInfo
|
||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.7.20"
|
||||
id("org.openjfx.javafxplugin") version "0.0.13"
|
||||
`jvm-test-suite`
|
||||
application
|
||||
}
|
||||
|
||||
@ -120,6 +122,83 @@ when (PlatformInfo.OS) {
|
||||
}
|
||||
}
|
||||
|
||||
testing {
|
||||
suites {
|
||||
val test by getting(JvmTestSuite::class) {
|
||||
useJUnitJupiter()
|
||||
|
||||
targets {
|
||||
all {
|
||||
testTask.configure {
|
||||
filter {
|
||||
isFailOnNoMatchingTests = true
|
||||
}
|
||||
testLogging {
|
||||
exceptionFormat = TestExceptionFormat.FULL
|
||||
showExceptions = true
|
||||
showStandardStreams = true
|
||||
events(
|
||||
TestLogEvent.PASSED,
|
||||
TestLogEvent.FAILED,
|
||||
TestLogEvent.SKIPPED,
|
||||
TestLogEvent.STANDARD_OUT,
|
||||
TestLogEvent.STANDARD_ERROR,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val integrationTest by registering(JvmTestSuite::class) {
|
||||
testType.set(TestSuiteType.INTEGRATION_TEST)
|
||||
useTestNG()
|
||||
|
||||
dependencies {
|
||||
implementation(project)
|
||||
// implementation("org.jetbrains.kotlin:kotlin-test:1.7.20")
|
||||
implementation("de.bixilon:kutil:$kutilVersion")
|
||||
}
|
||||
|
||||
targets {
|
||||
all {
|
||||
testTask.configure {
|
||||
filter {
|
||||
isFailOnNoMatchingTests = true
|
||||
}
|
||||
testLogging {
|
||||
exceptionFormat = TestExceptionFormat.FULL
|
||||
showExceptions = true
|
||||
showStandardStreams = true
|
||||
events(
|
||||
TestLogEvent.PASSED,
|
||||
TestLogEvent.FAILED,
|
||||
TestLogEvent.SKIPPED,
|
||||
TestLogEvent.STANDARD_OUT,
|
||||
TestLogEvent.STANDARD_ERROR,
|
||||
)
|
||||
}
|
||||
options {
|
||||
val options = this as TestNGOptions
|
||||
options.preserveOrder = true
|
||||
}
|
||||
shouldRunAfter(test)
|
||||
}
|
||||
}
|
||||
}
|
||||
sources {
|
||||
kotlin {
|
||||
setSrcDirs(listOf("src/integration-test/kotlin"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("check") {
|
||||
dependsOn(testing.suites.named("integrationTest"))
|
||||
}
|
||||
|
||||
fun DependencyHandler.javafx(name: String) {
|
||||
implementation("org.openjfx", "javafx-$name", javafxVersion, classifier = javafxNatives)
|
||||
}
|
||||
@ -197,6 +276,8 @@ dependencies {
|
||||
// kotlin
|
||||
implementation(kotlin("reflect"))
|
||||
testImplementation(kotlin("test"))
|
||||
testImplementation(platform("org.junit:junit-bom:5.9.1"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
|
||||
|
||||
// platform specific
|
||||
@ -228,6 +309,7 @@ tasks.withType<KotlinCompile> {
|
||||
application {
|
||||
mainClass.set("de.bixilon.minosoft.Minosoft")
|
||||
}
|
||||
|
||||
javafx {
|
||||
version = javafxVersion
|
||||
modules("javafx.controls", "javafx.fxml")
|
||||
|
@ -11,17 +11,38 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.setup.data.registries.versions
|
||||
package de.bixilon.minosoft
|
||||
|
||||
import de.bixilon.kutil.latch.CountUpAndDownLatch
|
||||
import de.bixilon.minosoft.data.registries.versions.Versions
|
||||
import org.junit.jupiter.api.Order
|
||||
import org.junit.jupiter.api.Test
|
||||
import de.bixilon.minosoft.protocol.packets.factory.PacketTypeRegistry
|
||||
import org.testng.annotations.Test
|
||||
|
||||
internal class VersionsSIT {
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
internal class MinosoftSIT {
|
||||
|
||||
@Test(priority = 0)
|
||||
fun disableGC() {
|
||||
Thread {
|
||||
val reference = Minosoft
|
||||
reference.hashCode()
|
||||
while (true) {
|
||||
Thread.sleep(100L)
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
@Test(priority = 1)
|
||||
fun initAssetsManager() {
|
||||
Minosoft.MINOSOFT_ASSETS_MANAGER.load(CountUpAndDownLatch(0))
|
||||
}
|
||||
|
||||
@Test(priority = 2)
|
||||
fun setupPacketRegistry() {
|
||||
PacketTypeRegistry.init(CountUpAndDownLatch(0))
|
||||
}
|
||||
|
||||
@Test(priority = 3)
|
||||
fun loadVersionsJson() {
|
||||
Versions.load(CountUpAndDownLatch(0))
|
||||
}
|
@ -11,12 +11,11 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.test.data.registries.versions
|
||||
package de.bixilon.minosoft.data.registries.versions
|
||||
|
||||
import de.bixilon.minosoft.data.registries.versions.Versions
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions
|
||||
import org.junit.jupiter.api.Test
|
||||
import kotlin.test.assertEquals
|
||||
import org.testng.Assert.assertEquals
|
||||
import org.testng.annotations.Test
|
||||
|
||||
internal class VersionsIT {
|
||||
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.setup
|
||||
|
||||
import de.bixilon.kutil.latch.CountUpAndDownLatch
|
||||
import de.bixilon.minosoft.Minosoft
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
import org.junit.jupiter.api.Order
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class MinosoftSIT {
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
fun initAssetsManager() {
|
||||
Minosoft.MINOSOFT_ASSETS_MANAGER.load(CountUpAndDownLatch(0))
|
||||
print("Initialized assets manager")
|
||||
}
|
||||
}
|
@ -91,7 +91,7 @@ object PacketTypeRegistry {
|
||||
val innerLatch = CountUpAndDownLatch(1, latch)
|
||||
for (info in ClassPath.from(classLoader).getTopLevelClassesRecursive(PacketsRoot::class.java.packageName)) {
|
||||
innerLatch.inc()
|
||||
DefaultThreadPool += { loadClass(s2cClassMap, s2cStateMap, c2sClassMap, c2sStateMap, info);innerLatch.dec() }
|
||||
DefaultThreadPool += { loadClass(s2cClassMap, s2cStateMap, c2sClassMap, c2sStateMap, info); innerLatch.dec() }
|
||||
}
|
||||
innerLatch.dec()
|
||||
innerLatch.await()
|
||||
|
Loading…
x
Reference in New Issue
Block a user