Skip to content

Commit

Permalink
Removed unnecessary AndroidArgs validations
Browse files Browse the repository at this point in the history
  • Loading branch information
zuziaka committed Aug 31, 2020
1 parent 1c4b913 commit 1e18ac6
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import ftl.android.AndroidCatalog.localesAsTable
import ftl.android.AndroidCatalog.supportedOrientationsAsTable
import ftl.android.AndroidCatalog.supportedVersionsAsTable
import ftl.args.AndroidArgs
import ftl.args.validate
import ftl.config.FtlConstants
import ftl.environment.ipBlocksListAsTable
import ftl.environment.networkConfigurationAsTable
Expand All @@ -28,7 +27,7 @@ import java.nio.file.Paths
)
class AndroidTestEnvironmentCommand : Runnable {
override fun run() {
val projectId = AndroidArgs.loadOrDefault(Paths.get(configPath)).validate().project
val projectId = AndroidArgs.loadOrDefault(Paths.get(configPath)).project
println(devicesCatalogAsTable(projectId))
println(supportedVersionsAsTable(projectId))
println(localesAsTable(projectId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ftl.cli.firebase.test.android.configuration

import ftl.android.AndroidCatalog.getLocaleDescription
import ftl.args.AndroidArgs
import ftl.args.validate
import ftl.config.FtlConstants
import ftl.run.exception.FlankConfigurationError
import picocli.CommandLine
Expand All @@ -21,7 +20,7 @@ import java.nio.file.Paths
class AndroidLocalesDescribeCommand : Runnable {
override fun run() {
if (locale.isBlank()) throw FlankConfigurationError("Argument LOCALE must be specified.")
print(getLocaleDescription(AndroidArgs.loadOrDefault(Paths.get(configPath)).validate().project, locale))
print(getLocaleDescription(AndroidArgs.loadOrDefault(Paths.get(configPath)).project, locale))
}

@CommandLine.Parameters(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ftl.cli.firebase.test.android.configuration

import ftl.android.AndroidCatalog
import ftl.args.AndroidArgs
import ftl.args.validate
import ftl.config.FtlConstants
import picocli.CommandLine
import java.nio.file.Paths
Expand All @@ -20,7 +19,7 @@ import java.nio.file.Paths
)
class AndroidLocalesListCommand : Runnable {
override fun run() {
println(AndroidCatalog.localesAsTable(projectId = AndroidArgs.loadOrDefault(Paths.get(configPath)).validate().project))
println(AndroidCatalog.localesAsTable(projectId = AndroidArgs.loadOrDefault(Paths.get(configPath)).project))
}

@CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ftl.cli.firebase.test.android.models

import ftl.android.AndroidCatalog
import ftl.args.AndroidArgs
import ftl.args.validate
import ftl.config.FtlConstants
import ftl.run.exception.FlankConfigurationError
import picocli.CommandLine
Expand All @@ -21,7 +20,7 @@ import java.nio.file.Paths
class AndroidModelDescribeCommand : Runnable {
override fun run() {
if (modelId.isBlank()) throw FlankConfigurationError("Argument MODEL_ID must be specified.")
println(AndroidCatalog.describeModel(AndroidArgs.loadOrDefault(Paths.get(configPath)).validate().project, modelId))
println(AndroidCatalog.describeModel(AndroidArgs.loadOrDefault(Paths.get(configPath)).project, modelId))
}

@CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ftl.cli.firebase.test.android.models

import ftl.android.AndroidCatalog
import ftl.args.AndroidArgs
import ftl.args.validate
import ftl.config.FtlConstants
import picocli.CommandLine
import java.nio.file.Paths
Expand All @@ -20,7 +19,7 @@ import java.nio.file.Paths
)
class AndroidModelsListCommand : Runnable {
override fun run() {
println(AndroidCatalog.devicesCatalogAsTable(AndroidArgs.loadOrDefault(Paths.get(configPath)).validate().project))
println(AndroidCatalog.devicesCatalogAsTable(AndroidArgs.loadOrDefault(Paths.get(configPath)).project))
}

@CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ftl.cli.firebase.test.android.orientations

import ftl.android.AndroidCatalog
import ftl.args.AndroidArgs
import ftl.args.validate
import ftl.config.FtlConstants
import picocli.CommandLine
import java.nio.file.Paths
Expand All @@ -20,7 +19,7 @@ import java.nio.file.Paths
)
class AndroidOrientationsListCommand : Runnable {
override fun run() {
println(AndroidCatalog.supportedOrientationsAsTable(AndroidArgs.loadOrDefault(Paths.get(configPath)).validate().project))
println(AndroidCatalog.supportedOrientationsAsTable(AndroidArgs.loadOrDefault(Paths.get(configPath)).project))
}

@CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ftl.cli.firebase.test.android.versions

import ftl.android.AndroidCatalog
import ftl.args.AndroidArgs
import ftl.args.validate
import ftl.config.FtlConstants
import ftl.run.exception.FlankConfigurationError
import picocli.CommandLine
Expand All @@ -22,7 +21,7 @@ import java.nio.file.Paths
class AndroidVersionsDescribeCommand : Runnable {
override fun run() {
if (versionId.isBlank()) throw FlankConfigurationError("Argument VERSION_ID must be specified.")
println(AndroidCatalog.describeSoftwareVersion(AndroidArgs.loadOrDefault(Paths.get(configPath)).validate().project, versionId))
println(AndroidCatalog.describeSoftwareVersion(AndroidArgs.loadOrDefault(Paths.get(configPath)).project, versionId))
}

@CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ftl.cli.firebase.test.android.versions

import ftl.android.AndroidCatalog.supportedVersionsAsTable
import ftl.args.AndroidArgs
import ftl.args.validate
import ftl.config.FtlConstants
import picocli.CommandLine
import java.nio.file.Paths
Expand All @@ -20,7 +19,7 @@ import java.nio.file.Paths
)
class AndroidVersionsListCommand : Runnable {
override fun run() {
println(supportedVersionsAsTable(AndroidArgs.loadOrDefault(Paths.get(configPath)).validate().project))
println(supportedVersionsAsTable(AndroidArgs.loadOrDefault(Paths.get(configPath)).project))
}

@CommandLine.Option(names = ["-c", "--config"], description = ["YAML config file path"])
Expand Down
4 changes: 2 additions & 2 deletions test_runner/src/test/kotlin/ftl/args/AndroidArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,8 @@ AndroidArgs
test: $testApk
project: a
"""
assertThat(AndroidArgs.load(yaml).validate().project).isEqualTo("a")
assertThat(AndroidArgs.load(yaml, cli).validate().project).isEqualTo("b")
assertThat(AndroidArgs.load(yaml).project).isEqualTo("a")
assertThat(AndroidArgs.load(yaml, cli).project).isEqualTo("b")
}

@Test
Expand Down

0 comments on commit 1e18ac6

Please sign in to comment.