code simplification

This commit is contained in:
2025-01-09 00:05:00 +08:00
parent 0fdb37fb54
commit d5a2c4a591
24 changed files with 11 additions and 1853 deletions

View File

@@ -4,7 +4,6 @@ import net.woggioni.gbcs.GradleBuildCacheServer
import net.woggioni.gbcs.api.Configuration
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.ClassOrderer
import org.junit.jupiter.api.MethodOrderer
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.TestMethodOrder
@@ -14,7 +13,7 @@ import java.nio.file.Path
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestMethodOrder(MethodOrderer.OrderAnnotation::class)
abstract class AbstractServerTestKt {
abstract class AbstractServerTest {
protected lateinit var cfg : Configuration

View File

@@ -23,7 +23,7 @@ import java.util.zip.Deflater
import kotlin.random.Random
class BasicAuthServerTestKt : AbstractServerTestKt() {
class BasicAuthServerTest : AbstractServerTest() {
companion object {
private const val PASSWORD = "password"

View File

@@ -9,17 +9,10 @@ import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.io.TempDir
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.ValueSource
import java.net.URL
import java.nio.file.Files
import java.nio.file.Path
class ConfigurationTestKt {
// companion object {
// init {
// URL.setURLStreamHandlerFactory(ClasspathUrlStreamHandlerFactoryProvider())
// }
// }
class ConfigurationTest {
@ValueSource(
strings = [

View File

@@ -20,7 +20,7 @@ import java.util.zip.Deflater
import kotlin.random.Random
class NoAuthServerTestKt : AbstractServerTestKt() {
class NoAuthServerTest : AbstractServerTest() {
private lateinit var cacheDir : Path

View File

@@ -31,16 +31,13 @@ import javax.net.ssl.TrustManagerFactory
import kotlin.random.Random
class TlsServerTestKt : AbstractServerTestKt() {
class TlsServerTest : AbstractServerTest() {
companion object {
private const val CA_CERTIFICATE_ENTRY = "gbcs-ca"
private const val CLIENT_CERTIFICATE_ENTRY = "gbcs-client"
private const val SERVER_CERTIFICATE_ENTRY = "gbcs-server"
private const val PASSWORD = "password"
// private fun stripLeadingSlash(s : String) = Path.of("/").root.relativize(Path.of(s).normalize()).toString()
}
private lateinit var cacheDir: Path

View File

@@ -4,7 +4,7 @@ import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import javax.naming.ldap.LdapName
class X500NameTestKt {
class X500NameTest {
@Test
fun test() {