-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from uchuhimo/modularize
Modularize
- Loading branch information
Showing
181 changed files
with
2,600 additions
and
935 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.8 |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Binary file not shown.
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,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
sourceSets { | ||
register("snippet") | ||
} | ||
|
||
val implementation by configurations | ||
val snippetImplementation by configurations | ||
snippetImplementation.extendsFrom(implementation) | ||
|
||
dependencyManagement { | ||
dependencies { | ||
dependency("com.typesafe:config:${Versions.hocon}") | ||
dependency("org.yaml:snakeyaml:${Versions.yaml}") | ||
dependency("com.moandjiezana.toml:toml4j:${Versions.toml4j}") | ||
dependency("org.dom4j:dom4j:${Versions.dom4j}") | ||
dependency("org.eclipse.jgit:org.eclipse.jgit:${Versions.jgit}") | ||
} | ||
} | ||
|
||
dependencies { | ||
for (name in listOf( | ||
":konf-core", | ||
":konf-git", | ||
":konf-hocon", | ||
":konf-toml", | ||
":konf-xml", | ||
":konf-yaml" | ||
)) { | ||
implementation(project(name)) | ||
testImplementation(project(name).dependencyProject.sourceSets["test"].output) | ||
} | ||
|
||
val main by sourceSets | ||
snippetImplementation(main.output) | ||
} |
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
71 changes: 71 additions & 0 deletions
71
konf-all/src/test/kotlin/com/uchuhimo/konf/source/MultipleDefaultLoadersSpec.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,71 @@ | ||
/* | ||
* Copyright 2017-2018 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.uchuhimo.konf.source | ||
|
||
import com.natpryce.hamkrest.assertion.assertThat | ||
import com.natpryce.hamkrest.equalTo | ||
import com.uchuhimo.konf.Config | ||
import org.jetbrains.spek.api.Spek | ||
import org.jetbrains.spek.api.dsl.it | ||
import org.jetbrains.spek.api.dsl.on | ||
|
||
object MultipleDefaultLoadersSpec : Spek({ | ||
on("load from multiple sources") { | ||
val config = Config { | ||
addSpec(DefaultLoadersConfig) | ||
} | ||
val item = DefaultLoadersConfig.type | ||
val afterLoadEnv = config.from.env() | ||
System.setProperty(config.nameOf(DefaultLoadersConfig.type), "system") | ||
val afterLoadSystemProperties = afterLoadEnv.from.systemProperties() | ||
val afterLoadHocon = afterLoadSystemProperties.from.hocon.string(hoconContent) | ||
val afterLoadJson = afterLoadHocon.from.json.string(jsonContent) | ||
val afterLoadProperties = afterLoadJson.from.properties.string(propertiesContent) | ||
val afterLoadToml = afterLoadProperties.from.toml.string(tomlContent) | ||
val afterLoadXml = afterLoadToml.from.xml.string(xmlContent) | ||
val afterLoadYaml = afterLoadXml.from.yaml.string(yamlContent) | ||
val afterLoadFlat = afterLoadYaml.from.map.flat(mapOf("source.test.type" to "flat")) | ||
val afterLoadKv = afterLoadFlat.from.map.kv(mapOf("source.test.type" to "kv")) | ||
val afterLoadHierarchical = afterLoadKv.from.map.hierarchical( | ||
mapOf("source" to | ||
mapOf("test" to | ||
mapOf("type" to "hierarchical")))) | ||
it("should load the corresponding value in each layer") { | ||
assertThat(afterLoadEnv[item], equalTo("env")) | ||
assertThat(afterLoadSystemProperties[item], equalTo("system")) | ||
assertThat(afterLoadHocon[item], equalTo("conf")) | ||
assertThat(afterLoadJson[item], equalTo("json")) | ||
assertThat(afterLoadProperties[item], equalTo("properties")) | ||
assertThat(afterLoadToml[item], equalTo("toml")) | ||
assertThat(afterLoadXml[item], equalTo("xml")) | ||
assertThat(afterLoadYaml[item], equalTo("yaml")) | ||
assertThat(afterLoadFlat[item], equalTo("flat")) | ||
assertThat(afterLoadKv[item], equalTo("kv")) | ||
assertThat(afterLoadHierarchical[item], equalTo("hierarchical")) | ||
} | ||
} | ||
}) | ||
|
||
const val jsonContent = """ | ||
{ | ||
"source": { | ||
"test": { | ||
"type": "json" | ||
} | ||
} | ||
} | ||
""" |
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,3 @@ | ||
dependencies { | ||
jmhImplementation(kotlin("stdlib")) | ||
} |
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.