diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/Cli.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServer.kt similarity index 74% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/Cli.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServer.kt index 5f19223..7134649 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/Cli.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServer.kt @@ -6,7 +6,7 @@ import kotlin.system.exitProcess /** - * Provisions a k3s server, either locally or on a remote machine depending on the given arguments. + * Provisions a server, either locally or on a remote machine depending on the given arguments. * Depending on the cli parameter "type" it will install the k3s server as standalone or as a container. * * Get help with option -h @@ -21,7 +21,7 @@ fun main(args: Array) { val prov = createProvInstance(cmd.target) when (cmd.type()) { - CliK3sArgumentsParser.K3sType.K3S -> prov.provisionK3s() - CliK3sArgumentsParser.K3sType.K3D -> prov.installK3sAsContainers() + CliServerArgumentsParser.K3sType.K3S -> prov.provisionK3s() + CliServerArgumentsParser.K3sType.K3D -> prov.installK3sAsContainers() } } diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliK3sArgumentsParser.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerArgumentsParser.kt similarity index 85% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliK3sArgumentsParser.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerArgumentsParser.kt index 0266134..b31a84a 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliK3sArgumentsParser.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerArgumentsParser.kt @@ -4,7 +4,7 @@ import kotlinx.cli.ArgType import kotlinx.cli.default import org.domaindrivenarchitecture.provs.framework.core.cli.CliTargetParser -class CliK3sArgumentsParser(name: String) : CliTargetParser(name) { +class CliServerArgumentsParser(name: String) : CliTargetParser(name) { enum class K3sType { K3S, K3D diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliK3sCommand.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerCommand.kt similarity index 76% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliK3sCommand.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerCommand.kt index 697f6ec..d3d2827 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliK3sCommand.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerCommand.kt @@ -8,16 +8,16 @@ class ServerCliCommand(private val k3sType: String, val target: TargetCliCommand return target.isValid() && hasValidK3sType() } private fun hasValidK3sType(): Boolean { - return CliK3sArgumentsParser.K3sType.values().map { it.name }.contains(k3sType.uppercase()) + return CliServerArgumentsParser.K3sType.values().map { it.name }.contains(k3sType.uppercase()) } - fun type() = CliK3sArgumentsParser.K3sType.valueOf(k3sType.uppercase()) + fun type() = CliServerArgumentsParser.K3sType.valueOf(k3sType.uppercase()) } fun parseServerArguments( programName: String = "java -jar provs.jar", args: Array ): ServerCliCommand { - val parser = CliK3sArgumentsParser(programName) + val parser = CliServerArgumentsParser(programName) parser.parse(args) return ServerCliCommand( diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/K3d.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/k3s/K3d.kt similarity index 100% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/K3d.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/k3s/K3d.kt diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/K3s.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/k3s/K3sService.kt similarity index 100% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/K3s.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/k3s/K3sService.kt diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliK3sCommandKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerCommandKtTest.kt similarity index 67% rename from src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliK3sCommandKtTest.kt rename to src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerCommandKtTest.kt index 6ed2d35..4dd1cb6 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliK3sCommandKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerCommandKtTest.kt @@ -1,11 +1,9 @@ package org.domaindrivenarchitecture.provs.server.application -import org.domaindrivenarchitecture.provs.server.application.CliK3sArgumentsParser -import org.domaindrivenarchitecture.provs.server.application.parseServerArguments import org.junit.jupiter.api.Test import org.junit.jupiter.api.Assertions.* -internal class CliK3sCommandKtTest { +internal class CliServerCommandKtTest { @Test fun test_parseServerArguments_are_valid_for_k3s() { @@ -14,7 +12,7 @@ internal class CliK3sCommandKtTest { // then assertTrue(cmd.isValid()) - assertEquals(CliK3sArgumentsParser.K3sType.K3S, cmd.type()) + assertEquals(CliServerArgumentsParser.K3sType.K3S, cmd.type()) } @Test @@ -24,7 +22,7 @@ internal class CliK3sCommandKtTest { // then assertFalse(cmd.isValid()) - assertEquals(CliK3sArgumentsParser.K3sType.K3S, cmd.type()) + assertEquals(CliServerArgumentsParser.K3sType.K3S, cmd.type()) } @Test @@ -34,7 +32,7 @@ internal class CliK3sCommandKtTest { // then assertTrue(cmd.isValid()) - assertEquals(CliK3sArgumentsParser.K3sType.K3S, cmd.type()) + assertEquals(CliServerArgumentsParser.K3sType.K3S, cmd.type()) } @Test @@ -44,6 +42,6 @@ internal class CliK3sCommandKtTest { // then assertTrue(cmd.isValid()) - assertEquals(CliK3sArgumentsParser.K3sType.K3D, cmd.type()) + assertEquals(CliServerArgumentsParser.K3sType.K3D, cmd.type()) } } \ No newline at end of file diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerKtTest.kt similarity index 91% rename from src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliKtTest.kt rename to src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerKtTest.kt index 99fb575..db209ae 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/server/application/CliServerKtTest.kt @@ -4,7 +4,7 @@ import org.domaindrivenarchitecture.provs.server.application.main import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -internal class CliKtTest { +internal class CliServerKtTest { @Test @Disabled // run manually -- todo mock execution