Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a test for S3. Also fixed a bug where you couldn't use get with…
… a List that was ROOT list.
- Loading branch information
Showing
8 changed files
with
51 additions
and
21 deletions.
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
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
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
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
32 changes: 32 additions & 0 deletions
32
cfg4k-s3/src/test/kotlin/com/jdiazcano/cfg4k/s3/S3ConfigSourceTest.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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.jdiazcano.cfg4k.s3 | ||
|
||
import com.amazonaws.regions.Regions | ||
import com.amazonaws.services.s3.AmazonS3ClientBuilder | ||
import com.jdiazcano.cfg4k.json.JsonConfigLoader | ||
import com.jdiazcano.cfg4k.providers.DefaultConfigProvider | ||
import com.jdiazcano.cfg4k.providers.cache | ||
import com.jdiazcano.cfg4k.providers.get | ||
import com.winterbe.expekt.should | ||
import org.jetbrains.spek.api.Spek | ||
import org.jetbrains.spek.api.dsl.describe | ||
|
||
class S3ConfigSourceTest : Spek({ | ||
describe("a config source that can fetch data") { | ||
val client = AmazonS3ClientBuilder.standard().withRegion(Regions.US_EAST_1).build() | ||
val source = S3ConfigSource(client, "mtln-public-data", "Samples/airports.json") | ||
val loader = JsonConfigLoader(source) | ||
val provider = DefaultConfigProvider(loader).cache() | ||
val airports = provider.get<List<Airport>>() | ||
airports.should.not.be.empty | ||
} | ||
}) | ||
|
||
private interface Airport { | ||
val iata: String | ||
val airport: String | ||
val city: String | ||
val state: String | ||
val country: String | ||
val lat: Double | ||
val long: Double | ||
} |