-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support loading YAML files containing anchors/references
This allows anchors and references to be used in all configuration files. The implementation is a workaround for jackson-dataformats-text bug #98: FasterXML/jackson-dataformats-text#98
- Loading branch information
1 parent
6159198
commit 970af89
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
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,40 @@ | ||
package db | ||
|
||
import io.vertx.core.Vertx | ||
import io.vertx.junit5.VertxExtension | ||
import io.vertx.junit5.VertxTestContext | ||
import io.vertx.kotlin.coroutines.dispatcher | ||
import kotlinx.coroutines.GlobalScope | ||
import kotlinx.coroutines.launch | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
|
||
/** | ||
* Tests for [MetadataRegistry] | ||
* @author Michel Kraemer | ||
*/ | ||
@ExtendWith(VertxExtension::class) | ||
class MetadataRegistryTest { | ||
/** | ||
* Test if a YAML file with references can be loaded | ||
*/ | ||
@Test | ||
fun yamlWithReferences(vertx: Vertx, ctx: VertxTestContext) { | ||
val registry = FileMetadataRegistry(listOf("src/test/resources/db/services_with_references.yaml"), vertx) | ||
|
||
GlobalScope.launch(vertx.dispatcher()) { | ||
val services = registry.findServices() | ||
assertThat(services).hasSize(2) | ||
val s1 = services[0] | ||
val s2 = services[1] | ||
assertThat(s1.id).isEqualTo("service1") | ||
assertThat(s2.id).isEqualTo("service2") | ||
assertThat(s1.path).isEqualTo("service.sh") | ||
assertThat(s2.path).isEqualTo(s1.path) | ||
assertThat(s2.runtime).isEqualTo(s1.runtime) | ||
assertThat(s2.parameters).isEmpty() | ||
ctx.completeNow() | ||
} | ||
} | ||
} |
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,13 @@ | ||
- id: service1 | ||
name: Service 1 | ||
description: My first service | ||
path: &mypath "service.sh" | ||
runtime: &myruntime other | ||
parameters: &myparams [] | ||
|
||
- id: service2 | ||
name: Service 2 | ||
description: My second service | ||
path: *mypath | ||
runtime: *myruntime | ||
parameters: *myparams |