-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor DescribeNetworkProfiles logging
- Loading branch information
1 parent
c5122e8
commit 9a098ae
Showing
4 changed files
with
42 additions
and
39 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
test_runner/src/main/kotlin/ftl/domain/DescribeNetworkProfiles.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package ftl.domain | ||
|
||
import flank.common.logLn | ||
import ftl.environment.networkProfileDescription | ||
import ftl.presentation.Output | ||
import ftl.run.exception.FlankConfigurationError | ||
|
||
interface DescribeNetworkProfiles { | ||
interface DescribeNetworkProfiles : Output { | ||
val profileId: String | ||
} | ||
|
||
operator fun DescribeNetworkProfiles.invoke() { | ||
if (profileId.isBlank()) throw FlankConfigurationError("Argument PROFILE_ID must be specified.") | ||
logLn(networkProfileDescription(profileId)) | ||
networkProfileDescription(profileId).out() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ftl.presentation | ||
|
||
import flank.common.logLn | ||
|
||
/** | ||
* The abstraction which allows passing output from the domain to presentation. | ||
* Implement in domain top-level interfaces for getting access to outputting result structures. | ||
* @property out The reference to outputting result function. | ||
*/ | ||
interface Output { | ||
val out: Any.() -> Unit | ||
} | ||
|
||
fun outputLogger(map: Any.() -> String): Any.() -> Unit = { | ||
logLn(map()) | ||
} | ||
|
||
fun Any.throwUnknownType(): Nothing = | ||
throw IllegalArgumentException(javaClass.toGenericString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters