-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APP-2884 #175
Merged
Merged
APP-2884 #175
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e074649
Add Configuration features for BDK 2.0
symphony-hong 19b7b05
Update SymConfigLoader and detect config format
symphony-hong 5406091
Add profile 2.0 to PR builder
symphony-hong fda5ccd
Update according to @symphony-thibault's comments
symphony-hong 10121f2
Fix read BdkConfigParser parsing InputStream issue
symphony-hong 68d4baf
Fix conflicts with upstream
symphony-hong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion
2
...y/bdk/core/config/LegacyConfigMapper.java → ...ore/config/legacy/LegacyConfigMapper.java
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
53 changes: 53 additions & 0 deletions
53
symphony-bdk-core/src/test/java/com/symphony/bdk/core/config/BdkConfigLoaderTest.java
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,53 @@ | ||
package com.symphony.bdk.core.config; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.symphony.bdk.core.config.model.BdkConfig; | ||
import com.symphony.bdk.core.exceptions.BdkConfigException; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.InputStream; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class BdkConfigLoaderTest { | ||
|
||
@Test | ||
public void loadFromYamlInputStreamTest() throws JsonProcessingException, BdkConfigException { | ||
InputStream inputStream = BdkConfigLoaderTest.class.getResourceAsStream("/config.yaml"); | ||
BdkConfig config = BdkConfigLoader.loadFromInputStream(inputStream); | ||
assertEquals(config.getBot().getUsername(), "tibot"); | ||
} | ||
|
||
@Test | ||
public void loadFromJsonInputStreamTest() throws JsonProcessingException, BdkConfigException { | ||
InputStream inputStream = BdkConfigLoaderTest.class.getResourceAsStream("/config.json"); | ||
BdkConfig config = BdkConfigLoader.loadFromInputStream(inputStream); | ||
assertEquals(config.getBot().getUsername(), "tibot"); | ||
} | ||
|
||
@Test | ||
public void loadFromYamlFileTest() throws JsonProcessingException, BdkConfigException { | ||
String configPath = System.getProperty("user.dir") + "/src/test/resources/config.yaml"; | ||
BdkConfig config = BdkConfigLoader.loadFromFile(configPath); | ||
assertEquals(config.getBot().getUsername(), "tibot"); | ||
} | ||
|
||
@Test | ||
public void loadFromJsonFileTest() throws JsonProcessingException, BdkConfigException { | ||
String configPath = System.getProperty("user.dir") + "/src/test/resources/config.json"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it work in IDEA? not sure the default current folder is the module's folder |
||
BdkConfig config = BdkConfigLoader.loadFromFile(configPath); | ||
assertEquals(config.getBot().getUsername(), "tibot"); | ||
} | ||
|
||
@Test | ||
public void loadFromJsonClasspathTest() throws JsonProcessingException, BdkConfigException { | ||
BdkConfig config = BdkConfigLoader.loadFromClasspath("/config.json"); | ||
assertEquals(config.getBot().getUsername(), "tibot"); | ||
} | ||
|
||
@Test | ||
public void loadFromYamlClasspathTest() throws JsonProcessingException, BdkConfigException { | ||
BdkConfig config = BdkConfigLoader.loadFromClasspath("/config.yaml"); | ||
assertEquals(config.getBot().getUsername(), "tibot"); | ||
} | ||
} |
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,21 @@ | ||
{ | ||
"_version": "2.0", | ||
|
||
"pod": { | ||
"host": "devx1.symphony.com" | ||
}, | ||
"agent": { | ||
"host": "devx1.symphony.com" | ||
}, | ||
"keyManager": { | ||
"host": "devx1.symphony.com" | ||
}, | ||
"bot": { | ||
"username": "tibot", | ||
"privateKeyPath": "/Users/thibault.pensec/local/conf/agent/privatekey.pem" | ||
}, | ||
"app": { | ||
"appId": "tibapp", | ||
"privateKeyPath": "/Users/thibault.pensec/local/conf/agent/privatekey.pem" | ||
} | ||
} |
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,18 @@ | ||
_version: '2.0' | ||
|
||
pod: | ||
host: devx1.symphony.com | ||
|
||
agent: | ||
host: devx1.symphony.com | ||
|
||
keyManager: | ||
host: devx1.symphony.com | ||
|
||
bot: | ||
username: tibot | ||
privateKeyPath: /Users/thibault.pensec/local/conf/agent/privatekey.pem | ||
|
||
app: | ||
appId: tibapp | ||
privateKeyPath: /Users/thibault.pensec/local/conf/agent/privatekey.pem |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we have commons io as a dependency we could use IOUtils.toString(inputstream)